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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public Builder appendPlaceholderReference(String name) {
Preconditions.checkNotNull(name, "Placeholder name could not be null");
parts.add(new PlaceholderReference(name));
placeholders.add(name);
return this;
} | Builder function(String name) { Preconditions.checkNotNull(name, STR); parts.add(new PlaceholderReference(name)); placeholders.add(name); return this; } | /**
* Appends a placeholder reference to the message
*/ | Appends a placeholder reference to the message | appendPlaceholderReference | {
"repo_name": "anomaly/closure-compiler",
"path": "src/com/google/javascript/jscomp/JsMessage.java",
"license": "apache-2.0",
"size": 20636
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,474,600 |
void enterLiteral(@NotNull JavaParser.LiteralContext ctx);
void exitLiteral(@NotNull JavaParser.LiteralContext ctx); | void enterLiteral(@NotNull JavaParser.LiteralContext ctx); void exitLiteral(@NotNull JavaParser.LiteralContext ctx); | /**
* Exit a parse tree produced by {@link JavaParser#literal}.
* @param ctx the parse tree
*/ | Exit a parse tree produced by <code>JavaParser#literal</code> | exitLiteral | {
"repo_name": "code4craft/daogen",
"path": "daogen-core/src/main/java/com/dianping/daogen/antlr/JavaListener.java",
"license": "mit",
"size": 38983
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,470,342 |
public final void create(LocalRegion region, DiskEntry entry, ValueWrapper value, boolean async) {
if (this != getOplogSet().getChild()) {
getOplogSet().getChild().create(region, entry, value, async);
} else {
DiskId did = entry.getDiskId();
boolean exceptionOccured = false;
byte prevUsrBit = did.getUserBits();
int len = did.getValueLength();
try {
// It is ok to do this outside of "lock" because
// create records do not need to change.
byte userBits = calcUserBits(value);
// save versions for creates and updates even if value is bytearrary in
// 7.0
if (entry.getVersionStamp() != null) {
if (entry.getVersionStamp().getMemberID() == null) {
throw new AssertionError("Version stamp should have a member at this point for entry " + entry);
}
// pdx and tx will not use version
userBits = EntryBits.setWithVersions(userBits, true);
}
basicCreate(region.getDiskRegion(), entry, value, userBits, async);
} catch (IOException ex) {
exceptionOccured = true;
region.getCancelCriterion().checkCancelInProgress(ex);
throw new DiskAccessException(LocalizedStrings.Oplog_FAILED_WRITING_KEY_TO_0.toLocalizedString(this.diskFile.getPath()),
ex, region.getFullPath());
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
exceptionOccured = true;
region.getCancelCriterion().checkCancelInProgress(ie);
throw new DiskAccessException(
LocalizedStrings.Oplog_FAILED_WRITING_KEY_TO_0_DUE_TO_FAILURE_IN_ACQUIRING_READ_LOCK_FOR_ASYNCH_WRITING
.toLocalizedString(this.diskFile.getPath()), ie, region.getFullPath());
} finally {
if (exceptionOccured) {
did.setValueLength(len);
did.setUserBits(prevUsrBit);
}
}
}
} | final void function(LocalRegion region, DiskEntry entry, ValueWrapper value, boolean async) { if (this != getOplogSet().getChild()) { getOplogSet().getChild().create(region, entry, value, async); } else { DiskId did = entry.getDiskId(); boolean exceptionOccured = false; byte prevUsrBit = did.getUserBits(); int len = did.getValueLength(); try { byte userBits = calcUserBits(value); if (entry.getVersionStamp() != null) { if (entry.getVersionStamp().getMemberID() == null) { throw new AssertionError(STR + entry); } userBits = EntryBits.setWithVersions(userBits, true); } basicCreate(region.getDiskRegion(), entry, value, userBits, async); } catch (IOException ex) { exceptionOccured = true; region.getCancelCriterion().checkCancelInProgress(ex); throw new DiskAccessException(LocalizedStrings.Oplog_FAILED_WRITING_KEY_TO_0.toLocalizedString(this.diskFile.getPath()), ex, region.getFullPath()); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); exceptionOccured = true; region.getCancelCriterion().checkCancelInProgress(ie); throw new DiskAccessException( LocalizedStrings.Oplog_FAILED_WRITING_KEY_TO_0_DUE_TO_FAILURE_IN_ACQUIRING_READ_LOCK_FOR_ASYNCH_WRITING .toLocalizedString(this.diskFile.getPath()), ie, region.getFullPath()); } finally { if (exceptionOccured) { did.setValueLength(len); did.setUserBits(prevUsrBit); } } } } | /**
* Asif: Modified the code so as to reuse the already created ByteBuffer
* during transition. Creates a key/value pair from a region entry on disk.
* Updates all of the necessary {@linkplain DiskStoreStats statistics} and
* invokes basicCreate
*
* @param entry
* The DiskEntry object for this key/value pair.
* @param value
* byte array representing the value
* @throws DiskAccessException
* @throws IllegalStateException
*
*/ | Asif: Modified the code so as to reuse the already created ByteBuffer during transition. Creates a key/value pair from a region entry on disk. Updates all of the necessary DiskStoreStats statistics and invokes basicCreate | create | {
"repo_name": "sshcherbakov/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java",
"license": "apache-2.0",
"size": 294400
} | [
"com.gemstone.gemfire.cache.DiskAccessException",
"com.gemstone.gemfire.internal.cache.DiskEntry",
"com.gemstone.gemfire.internal.i18n.LocalizedStrings",
"java.io.IOException"
] | import com.gemstone.gemfire.cache.DiskAccessException; import com.gemstone.gemfire.internal.cache.DiskEntry; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import java.io.IOException; | import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.internal.i18n.*; import java.io.*; | [
"com.gemstone.gemfire",
"java.io"
] | com.gemstone.gemfire; java.io; | 1,505,530 |
public void draw(Graphics buffer) {
for (int i = 0; i < particles.size(); i++)
particles.get(i).draw(buffer);
} | void function(Graphics buffer) { for (int i = 0; i < particles.size(); i++) particles.get(i).draw(buffer); } | /**
* Calls the draw method for all particles in the list
* @param buffer Buffer to draw to
*/ | Calls the draw method for all particles in the list | draw | {
"repo_name": "quartz55/lpoo_asteroids",
"path": "asteroids/Managers/ParticleManager.java",
"license": "gpl-2.0",
"size": 1578
} | [
"java.awt.Graphics"
] | import java.awt.Graphics; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,088,034 |
Collection<String> getRepositoryAliases(String repositoryName); | Collection<String> getRepositoryAliases(String repositoryName); | /**
* Gets all aliases known for the specified repository.
* @param repositoryName the repository-ID or -alias. Must not be <code>null</code>.
* @return the known aliases. <code>null</code>, if there is no repository with
* the given {@code repositoryName}. Empty, if the repository is known, but there
* are no aliases for it.
*/ | Gets all aliases known for the specified repository | getRepositoryAliases | {
"repo_name": "cloudstore/cloudstore",
"path": "co.codewizards.cloudstore.core/src/main/java/co/codewizards/cloudstore/core/repo/local/LocalRepoRegistry.java",
"license": "lgpl-3.0",
"size": 3346
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,191,501 |
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<RouteFilterInner> listByResourceGroup(String resourceGroupName); | @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<RouteFilterInner> listByResourceGroup(String resourceGroupName); | /**
* Gets all route filters in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all route filters in a resource group.
*/ | Gets all route filters in a resource group | listByResourceGroup | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/RouteFiltersClient.java",
"license": "mit",
"size": 25711
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedIterable",
"com.azure.resourcemanager.network.fluent.models.RouteFilterInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.network.fluent.models.RouteFilterInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,306,001 |
@Pure
public Resource eResource() {
return getXBlockExpression().eResource();
} | Resource function() { return getXBlockExpression().eResource(); } | /** Replies the resource to which the XBlockExpression is attached.
*/ | Replies the resource to which the XBlockExpression is attached | eResource | {
"repo_name": "jgfoster/sarl",
"path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/BlockExpressionBuilderImpl.java",
"license": "apache-2.0",
"size": 5709
} | [
"org.eclipse.emf.ecore.resource.Resource"
] | import org.eclipse.emf.ecore.resource.Resource; | import org.eclipse.emf.ecore.resource.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,800,958 |
@Test
public void testListIndexedWriteMethod() throws Exception {
final PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "stringList");
assertNotNull("stringList descriptor not found", descriptor);
assumeTrue("JDK does not support index bean properties on java.util.List",
Jira492IndexedListsSupport.supportsIndexedLists());
assertNotNull("No List Indexed Write Method", ((IndexedPropertyDescriptor)descriptor).getIndexedWriteMethod());
} | void function() throws Exception { final PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, STR); assertNotNull(STR, descriptor); assumeTrue(STR, Jira492IndexedListsSupport.supportsIndexedLists()); assertNotNull(STR, ((IndexedPropertyDescriptor)descriptor).getIndexedWriteMethod()); } | /**
* Test Indexed Write Method for a List
*/ | Test Indexed Write Method for a List | testListIndexedWriteMethod | {
"repo_name": "apache/commons-beanutils",
"path": "src/test/java/org/apache/commons/beanutils2/IndexedPropertyTestCase.java",
"license": "apache-2.0",
"size": 15948
} | [
"java.beans.IndexedPropertyDescriptor",
"java.beans.PropertyDescriptor",
"org.apache.commons.beanutils2.bugs.other.Jira492IndexedListsSupport",
"org.junit.Assert",
"org.junit.Assume"
] | import java.beans.IndexedPropertyDescriptor; import java.beans.PropertyDescriptor; import org.apache.commons.beanutils2.bugs.other.Jira492IndexedListsSupport; import org.junit.Assert; import org.junit.Assume; | import java.beans.*; import org.apache.commons.beanutils2.bugs.other.*; import org.junit.*; | [
"java.beans",
"org.apache.commons",
"org.junit"
] | java.beans; org.apache.commons; org.junit; | 739,314 |
protected void showSession(PortalRenderContext rcontext, boolean html)
{
// get the current user session information
Session s = SessionManager.getCurrentSession();
rcontext.put("sessionSession", s);
ToolSession ts = SessionManager.getCurrentToolSession();
rcontext.put("sessionToolSession", ts);
} | void function(PortalRenderContext rcontext, boolean html) { Session s = SessionManager.getCurrentSession(); rcontext.put(STR, s); ToolSession ts = SessionManager.getCurrentToolSession(); rcontext.put(STR, ts); } | /**
* Output some session information
*
* @param rcontext
* The print writer
* @param html
* If true, output in HTML, else in text.
*/ | Output some session information | showSession | {
"repo_name": "ktakacs/sakai",
"path": "portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/SkinnableCharonPortal.java",
"license": "apache-2.0",
"size": 76048
} | [
"org.sakaiproject.portal.api.PortalRenderContext",
"org.sakaiproject.tool.api.Session",
"org.sakaiproject.tool.api.ToolSession",
"org.sakaiproject.tool.cover.SessionManager"
] | import org.sakaiproject.portal.api.PortalRenderContext; import org.sakaiproject.tool.api.Session; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.cover.SessionManager; | import org.sakaiproject.portal.api.*; import org.sakaiproject.tool.api.*; import org.sakaiproject.tool.cover.*; | [
"org.sakaiproject.portal",
"org.sakaiproject.tool"
] | org.sakaiproject.portal; org.sakaiproject.tool; | 1,166,550 |
public void connector(short connectorType) throws SAXException;
public final short OCCURENCE_ZERO_OR_MORE = 0;
public final short OCCURENCE_ONE_OR_MORE = 1;
public final short OCCURENCE_ZERO_OR_ONE = 2;
public final short OCCURENCE_ONCE = 3; | void function(short connectorType) throws SAXException; public final short OCCURENCE_ZERO_OR_MORE = 0; public final short OCCURENCE_ONE_OR_MORE = 1; public final short OCCURENCE_ZERO_OR_ONE = 2; public final short OCCURENCE_ONCE = 3; | /**
* Connectors in one model group is guaranteed to be the same.
* <p/>
* <p/>
* IOW, you'll never see an event sequence like (a|b,c)
*
* @return {@link #CHOICE} or {@link #SEQUENCE}.
*/ | Connectors in one model group is guaranteed to be the same. IOW, you'll never see an event sequence like (a|b,c) | connector | {
"repo_name": "shelan/jdk9-mirror",
"path": "jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/dtdparser/DTDEventListener.java",
"license": "gpl-2.0",
"size": 13531
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 639,891 |
protected void skipSubPath() throws ParseException, IOException {
for (;;) {
switch (current) {
case -1: case 'm': case 'M': return;
default: break;
}
current = reader.read();
}
} | void function() throws ParseException, IOException { for (;;) { switch (current) { case -1: case 'm': case 'M': return; default: break; } current = reader.read(); } } | /**
* Skips a sub-path.
*/ | Skips a sub-path | skipSubPath | {
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/parser/PathParser.java",
"license": "apache-2.0",
"size": 20870
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,025,051 |
int deleteByExample(AuthorityExample example); | int deleteByExample(AuthorityExample example); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table g_authority
*
* @mbg.generated Sun Aug 13 20:54:51 CST 2017
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table g_authority | deleteByExample | {
"repo_name": "happyxiaofan/springboot-learning-example",
"path": "src/main/java/com/rhwayfun/springboot/security/datasource/mapper/AuthorityMapper.java",
"license": "epl-1.0",
"size": 3098
} | [
"com.rhwayfun.springboot.security.datasource.model.AuthorityExample"
] | import com.rhwayfun.springboot.security.datasource.model.AuthorityExample; | import com.rhwayfun.springboot.security.datasource.model.*; | [
"com.rhwayfun.springboot"
] | com.rhwayfun.springboot; | 2,752,374 |
Field field = new Field(4);
Bomberman man = new Bomberman("A", field);
Bomberman man1 = new Bomberman("B", field);
Bomberman man2 = new Bomberman("C", field);
new Thread(man).start();
new Thread(man1).start();
new Thread(man2).start();
Cell[][] board = field.getBoard();
int index = 15;
while (--index > 0) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
System.out.print(board[i][j].toString());
}
System.out.println();
}
Thread.sleep(1000);
System.out.println();
}
man.setAlive(false);
man1.setAlive(false);
man2.setAlive(false);
} | Field field = new Field(4); Bomberman man = new Bomberman("A", field); Bomberman man1 = new Bomberman("B", field); Bomberman man2 = new Bomberman("C", field); new Thread(man).start(); new Thread(man1).start(); new Thread(man2).start(); Cell[][] board = field.getBoard(); int index = 15; while (--index > 0) { for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[0].length; j++) { System.out.print(board[i][j].toString()); } System.out.println(); } Thread.sleep(1000); System.out.println(); } man.setAlive(false); man1.setAlive(false); man2.setAlive(false); } | /**
* The method main.
* @param args line parameters.
* @throws InterruptedException exception.
*/ | The method main | main | {
"repo_name": "OleksandrProshak/Alexandr_Proshak",
"path": "Level_Junior/Part_002_Multithreading/7_Control_Tasks_Multithreading/src/main/java/ru/job4j/bomberv1/Runner.java",
"license": "apache-2.0",
"size": 1270
} | [
"ru.job4j.bomberv1.heroes.Bomberman",
"ru.job4j.bomberv1.playground.Cell",
"ru.job4j.bomberv1.playground.Field"
] | import ru.job4j.bomberv1.heroes.Bomberman; import ru.job4j.bomberv1.playground.Cell; import ru.job4j.bomberv1.playground.Field; | import ru.job4j.bomberv1.heroes.*; import ru.job4j.bomberv1.playground.*; | [
"ru.job4j.bomberv1"
] | ru.job4j.bomberv1; | 963,216 |
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
if (this.averageGroundLvl < 0)
{
this.averageGroundLvl = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
if (this.averageGroundLvl < 0)
{
return true;
}
this.boundingBox.offset(0, this.averageGroundLvl - this.boundingBox.maxY + 6 - 1, 0);
}
IBlockState iblockstate = this.getBiomeSpecificBlockState(Blocks.COBBLESTONE.getDefaultState());
IBlockState iblockstate1 = this.getBiomeSpecificBlockState(Blocks.PLANKS.getDefaultState());
IBlockState iblockstate2 = this.getBiomeSpecificBlockState(Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH));
IBlockState iblockstate3 = this.getBiomeSpecificBlockState(Blocks.LOG.getDefaultState());
IBlockState iblockstate4 = this.getBiomeSpecificBlockState(Blocks.OAK_FENCE.getDefaultState());
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 5, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 3, 0, 4, iblockstate, iblockstate, false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 3, Blocks.DIRT.getDefaultState(), Blocks.DIRT.getDefaultState(), false);
if (this.isTallHouse)
{
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 2, 4, 3, iblockstate3, iblockstate3, false);
}
else
{
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 2, 5, 3, iblockstate3, iblockstate3, false);
}
this.setBlockState(worldIn, iblockstate3, 1, 4, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 2, 4, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 1, 4, 4, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 2, 4, 4, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 0, 4, 1, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 0, 4, 2, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 0, 4, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 3, 4, 1, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 3, 4, 2, structureBoundingBoxIn);
this.setBlockState(worldIn, iblockstate3, 3, 4, 3, structureBoundingBoxIn);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 3, 0, iblockstate3, iblockstate3, false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 3, 3, 0, iblockstate3, iblockstate3, false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 4, 0, 3, 4, iblockstate3, iblockstate3, false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 4, 3, 3, 4, iblockstate3, iblockstate3, false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, iblockstate1, iblockstate1, false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 1, 3, 3, 3, iblockstate1, iblockstate1, false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, iblockstate1, iblockstate1, false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 2, 3, 4, iblockstate1, iblockstate1, false);
this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 0, 2, 2, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 3, 2, 2, structureBoundingBoxIn);
if (this.tablePosition > 0)
{
this.setBlockState(worldIn, iblockstate4, this.tablePosition, 1, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.WOODEN_PRESSURE_PLATE.getDefaultState(), this.tablePosition, 2, 3, structureBoundingBoxIn);
}
this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
this.func_189927_a(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, EnumFacing.NORTH);
if (this.getBlockStateFromPos(worldIn, 1, 0, -1, structureBoundingBoxIn).getMaterial() == Material.AIR && this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getMaterial() != Material.AIR)
{
this.setBlockState(worldIn, iblockstate2, 1, 0, -1, structureBoundingBoxIn);
if (this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getBlock() == Blocks.GRASS_PATH)
{
this.setBlockState(worldIn, Blocks.GRASS.getDefaultState(), 1, -1, -1, structureBoundingBoxIn);
}
}
for (int i = 0; i < 5; ++i)
{
for (int j = 0; j < 4; ++j)
{
this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, i, structureBoundingBoxIn);
this.replaceAirAndLiquidDownwards(worldIn, iblockstate, j, -1, i, structureBoundingBoxIn);
}
}
this.spawnVillagers(worldIn, structureBoundingBoxIn, 1, 1, 2, 1);
return true;
}
} | boolean function(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { if (this.averageGroundLvl < 0) { this.averageGroundLvl = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); if (this.averageGroundLvl < 0) { return true; } this.boundingBox.offset(0, this.averageGroundLvl - this.boundingBox.maxY + 6 - 1, 0); } IBlockState iblockstate = this.getBiomeSpecificBlockState(Blocks.COBBLESTONE.getDefaultState()); IBlockState iblockstate1 = this.getBiomeSpecificBlockState(Blocks.PLANKS.getDefaultState()); IBlockState iblockstate2 = this.getBiomeSpecificBlockState(Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH)); IBlockState iblockstate3 = this.getBiomeSpecificBlockState(Blocks.LOG.getDefaultState()); IBlockState iblockstate4 = this.getBiomeSpecificBlockState(Blocks.OAK_FENCE.getDefaultState()); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 5, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 3, 0, 4, iblockstate, iblockstate, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 3, Blocks.DIRT.getDefaultState(), Blocks.DIRT.getDefaultState(), false); if (this.isTallHouse) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 2, 4, 3, iblockstate3, iblockstate3, false); } else { this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 2, 5, 3, iblockstate3, iblockstate3, false); } this.setBlockState(worldIn, iblockstate3, 1, 4, 0, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 2, 4, 0, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 1, 4, 4, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 2, 4, 4, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 0, 4, 1, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 0, 4, 2, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 0, 4, 3, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 3, 4, 1, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 3, 4, 2, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate3, 3, 4, 3, structureBoundingBoxIn); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 3, 0, iblockstate3, iblockstate3, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 3, 3, 0, iblockstate3, iblockstate3, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 4, 0, 3, 4, iblockstate3, iblockstate3, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 4, 3, 3, 4, iblockstate3, iblockstate3, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, iblockstate1, iblockstate1, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 1, 3, 3, 3, iblockstate1, iblockstate1, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, iblockstate1, iblockstate1, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 2, 3, 4, iblockstate1, iblockstate1, false); this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 3, 2, 2, structureBoundingBoxIn); if (this.tablePosition > 0) { this.setBlockState(worldIn, iblockstate4, this.tablePosition, 1, 3, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.WOODEN_PRESSURE_PLATE.getDefaultState(), this.tablePosition, 2, 3, structureBoundingBoxIn); } this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), 1, 1, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), 1, 2, 0, structureBoundingBoxIn); this.func_189927_a(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, EnumFacing.NORTH); if (this.getBlockStateFromPos(worldIn, 1, 0, -1, structureBoundingBoxIn).getMaterial() == Material.AIR && this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getMaterial() != Material.AIR) { this.setBlockState(worldIn, iblockstate2, 1, 0, -1, structureBoundingBoxIn); if (this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getBlock() == Blocks.GRASS_PATH) { this.setBlockState(worldIn, Blocks.GRASS.getDefaultState(), 1, -1, -1, structureBoundingBoxIn); } } for (int i = 0; i < 5; ++i) { for (int j = 0; j < 4; ++j) { this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, i, structureBoundingBoxIn); this.replaceAirAndLiquidDownwards(worldIn, iblockstate, j, -1, i, structureBoundingBoxIn); } } this.spawnVillagers(worldIn, structureBoundingBoxIn, 1, 1, 2, 1); return true; } } | /**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
* Mineshafts at the end, it adds Fences...
*/ | second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences.. | addComponentParts | {
"repo_name": "Im-Jrotica/forge_latest",
"path": "build/tmp/recompileMc/sources/net/minecraft/world/gen/structure/StructureVillagePieces.java",
"license": "lgpl-2.1",
"size": 136617
} | [
"java.util.Random",
"net.minecraft.block.BlockStairs",
"net.minecraft.block.material.Material",
"net.minecraft.block.state.IBlockState",
"net.minecraft.init.Blocks",
"net.minecraft.util.EnumFacing",
"net.minecraft.world.World"
] | import java.util.Random; import net.minecraft.block.BlockStairs; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; | import java.util.*; import net.minecraft.block.*; import net.minecraft.block.material.*; import net.minecraft.block.state.*; import net.minecraft.init.*; import net.minecraft.util.*; import net.minecraft.world.*; | [
"java.util",
"net.minecraft.block",
"net.minecraft.init",
"net.minecraft.util",
"net.minecraft.world"
] | java.util; net.minecraft.block; net.minecraft.init; net.minecraft.util; net.minecraft.world; | 141,071 |
private void processAbstractWidget(AbstractWidget widget, Boolean sidePanel) {
if (widget instanceof Panel) {
processPanel((Panel) widget, sidePanel);
} else if (widget instanceof PanelRelated) {
PanelRelated panelRelated = (PanelRelated) widget;
sidePanel = sidePanel != null && sidePanel ? sidePanel
: panelRelated.getSidebar();
processPanelRelated(panelRelated, sidePanel, "12");
} else if (widget instanceof PanelField) {
processField((PanelField) widget, sidePanel);
}
} | void function(AbstractWidget widget, Boolean sidePanel) { if (widget instanceof Panel) { processPanel((Panel) widget, sidePanel); } else if (widget instanceof PanelRelated) { PanelRelated panelRelated = (PanelRelated) widget; sidePanel = sidePanel != null && sidePanel ? sidePanel : panelRelated.getSidebar(); processPanelRelated(panelRelated, sidePanel, "12"); } else if (widget instanceof PanelField) { processField((PanelField) widget, sidePanel); } } | /**
* Check given AbstractWidget and process it according to its type.
*
* @param widget
* AbstractWidget to process
* @param sidePanel
* Boolean to check if widget is sidePanel.
*/ | Check given AbstractWidget and process it according to its type | processAbstractWidget | {
"repo_name": "jph-axelor/axelor-business-suite",
"path": "axelor-studio/src/main/java/com/axelor/studio/service/builder/ReportBuilderService.java",
"license": "agpl-3.0",
"size": 17063
} | [
"com.axelor.meta.schema.views.AbstractWidget",
"com.axelor.meta.schema.views.Panel",
"com.axelor.meta.schema.views.PanelField",
"com.axelor.meta.schema.views.PanelRelated"
] | import com.axelor.meta.schema.views.AbstractWidget; import com.axelor.meta.schema.views.Panel; import com.axelor.meta.schema.views.PanelField; import com.axelor.meta.schema.views.PanelRelated; | import com.axelor.meta.schema.views.*; | [
"com.axelor.meta"
] | com.axelor.meta; | 1,580,770 |
protected Element findNamedType(QName typeName) {
Schema s = getSchema(typeName.getNamespaceURI());
if (s == null) {
return null;
}
Element schemaRoot = s.getElement();
// get all simple and complex types defined at the top-level.
//
List<Element> types = DomUtils.getChildElementsByName(schemaRoot, WsdlUtils.COMPLEX_TYPE_NAME);
types.addAll(DomUtils.getChildElementsByName(schemaRoot, WsdlUtils.SIMPLE_TYPE_NAME));
Element namedType = null;
for (Element t : types) {
String schemaTypeName = t.getAttribute(WsdlUtils.NAME_ATTR);
if (typeName.getLocalPart().equals(schemaTypeName)) {
namedType = t;
break;
}
}
return namedType;
}
| Element function(QName typeName) { Schema s = getSchema(typeName.getNamespaceURI()); if (s == null) { return null; } Element schemaRoot = s.getElement(); List<Element> types = DomUtils.getChildElementsByName(schemaRoot, WsdlUtils.COMPLEX_TYPE_NAME); types.addAll(DomUtils.getChildElementsByName(schemaRoot, WsdlUtils.SIMPLE_TYPE_NAME)); Element namedType = null; for (Element t : types) { String schemaTypeName = t.getAttribute(WsdlUtils.NAME_ATTR); if (typeName.getLocalPart().equals(schemaTypeName)) { namedType = t; break; } } return namedType; } | /**
* Find a named <complexType> or <simpleType> in the types section of the WSDL.
*
* @param typeName Name of the type to find.
* @return null if type not found.
*/ | Find a named <complexType> or <simpleType> in the types section of the WSDL | findNamedType | {
"repo_name": "icholy/geokettle-2.0",
"path": "src/org/pentaho/di/trans/steps/webservices/wsdl/WsdlTypes.java",
"license": "lgpl-2.1",
"size": 8018
} | [
"java.util.List",
"javax.wsdl.extensions.schema.Schema",
"javax.xml.namespace.QName",
"org.w3c.dom.Element"
] | import java.util.List; import javax.wsdl.extensions.schema.Schema; import javax.xml.namespace.QName; import org.w3c.dom.Element; | import java.util.*; import javax.wsdl.extensions.schema.*; import javax.xml.namespace.*; import org.w3c.dom.*; | [
"java.util",
"javax.wsdl",
"javax.xml",
"org.w3c.dom"
] | java.util; javax.wsdl; javax.xml; org.w3c.dom; | 2,182,893 |
public AzureFirewallIpConfiguration withProvisioningState(ProvisioningState provisioningState) {
if (this.innerProperties() == null) {
this.innerProperties = new AzureFirewallIpConfigurationPropertiesFormat();
}
this.innerProperties().withProvisioningState(provisioningState);
return this;
} | AzureFirewallIpConfiguration function(ProvisioningState provisioningState) { if (this.innerProperties() == null) { this.innerProperties = new AzureFirewallIpConfigurationPropertiesFormat(); } this.innerProperties().withProvisioningState(provisioningState); return this; } | /**
* Set the provisioningState property: The provisioning state of the resource.
*
* @param provisioningState the provisioningState value to set.
* @return the AzureFirewallIpConfiguration object itself.
*/ | Set the provisioningState property: The provisioning state of the resource | withProvisioningState | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallIpConfiguration.java",
"license": "mit",
"size": 5979
} | [
"com.azure.resourcemanager.network.fluent.models.AzureFirewallIpConfigurationPropertiesFormat"
] | import com.azure.resourcemanager.network.fluent.models.AzureFirewallIpConfigurationPropertiesFormat; | import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 902,535 |
public PowerHost findHostForVm(Vm vm, Set<? extends Host> excludedHosts) {
double minPower = Double.MAX_VALUE;
PowerHost allocatedHost = null;
for (PowerHost host : this.<PowerHost> getHostList()) {
if (excludedHosts.contains(host)) {
continue;
}
if (host.isSuitableForVm(vm)) {
if (getUtilizationOfCpuMips(host) != 0 && isHostOverUtilizedAfterAllocation(host, vm)) {
continue;
}
try {
double powerAfterAllocation = getPowerAfterAllocation(host, vm);
if (powerAfterAllocation != -1) {
double powerDiff = powerAfterAllocation - host.getPower();
if (powerDiff < minPower) {
minPower = powerDiff;
allocatedHost = host;
}
}
} catch (Exception e) {
}
}
}
return allocatedHost;
}
| PowerHost function(Vm vm, Set<? extends Host> excludedHosts) { double minPower = Double.MAX_VALUE; PowerHost allocatedHost = null; for (PowerHost host : this.<PowerHost> getHostList()) { if (excludedHosts.contains(host)) { continue; } if (host.isSuitableForVm(vm)) { if (getUtilizationOfCpuMips(host) != 0 && isHostOverUtilizedAfterAllocation(host, vm)) { continue; } try { double powerAfterAllocation = getPowerAfterAllocation(host, vm); if (powerAfterAllocation != -1) { double powerDiff = powerAfterAllocation - host.getPower(); if (powerDiff < minPower) { minPower = powerDiff; allocatedHost = host; } } } catch (Exception e) { } } } return allocatedHost; } | /**
* Find host for vm.
*
* @param vm the vm
* @param excludedHosts the excluded hosts
* @return the power host
*/ | Find host for vm | findHostForVm | {
"repo_name": "hieuvt/tccloudsim",
"path": "sources/org/cloudbus/cloudsim/power/PowerVmAllocationPolicyMigrationAbstract.java",
"license": "lgpl-3.0",
"size": 20796
} | [
"java.util.Set",
"org.cloudbus.cloudsim.Host",
"org.cloudbus.cloudsim.Vm"
] | import java.util.Set; import org.cloudbus.cloudsim.Host; import org.cloudbus.cloudsim.Vm; | import java.util.*; import org.cloudbus.cloudsim.*; | [
"java.util",
"org.cloudbus.cloudsim"
] | java.util; org.cloudbus.cloudsim; | 121,572 |
private static List<File> findFilesInDirectory(File directory,
Pattern pattern, boolean scanRecursive) {
List<File> files = new ArrayList<File>();
String[] filesInDirectory = directory.list();
if (filesInDirectory == null) {
return files;
}
for (String fileToCheck : filesInDirectory) {
File file = new File(directory, fileToCheck);
if (file.isFile()) {
if (pattern.matcher(fileToCheck).matches()) {
files.add(file);
}
} else if (file.isDirectory()) {
if (scanRecursive) {
files.addAll(findFilesInDirectory(file, pattern,
scanRecursive));
}
}
}
return files;
} | static List<File> function(File directory, Pattern pattern, boolean scanRecursive) { List<File> files = new ArrayList<File>(); String[] filesInDirectory = directory.list(); if (filesInDirectory == null) { return files; } for (String fileToCheck : filesInDirectory) { File file = new File(directory, fileToCheck); if (file.isFile()) { if (pattern.matcher(fileToCheck).matches()) { files.add(file); } } else if (file.isDirectory()) { if (scanRecursive) { files.addAll(findFilesInDirectory(file, pattern, scanRecursive)); } } } return files; } | /**
* This class is the recursive part of the file search.
*
* @param directory
* @param pattern
* @param scanRecursive
* @return
*/ | This class is the recursive part of the file search | findFilesInDirectory | {
"repo_name": "PureSolTechnologies/commons",
"path": "misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileSearch.java",
"license": "apache-2.0",
"size": 3443
} | [
"java.io.File",
"java.util.ArrayList",
"java.util.List",
"java.util.regex.Pattern"
] | import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; | import java.io.*; import java.util.*; import java.util.regex.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 651,932 |
public static int hiddenLayer(
final NetCoreGenerator gen,
final int blocksnum,
final CellType gates,
final CellType netin,
final CellType netout,
final boolean peepholes,
final boolean usegatesbias,
final double gatesbias,
final boolean useinputbias,
final double inputbias,
final boolean useoutputbias,
final double outputbias
) {
//
// create lstmlayer.
//
final int layer = gen.beginLayer();
//
// input gates, forget gates and input cells.
//
gen.inputConnectors();
final int input_gates = gen.cells(blocksnum, gates);
final int forget_gates = gen.cells(blocksnum, gates);
final int input_cells = gen.cells(blocksnum, netin);
gen.shiftComputationIndex();
//
// mul1, mul2 and dmul11, dmul12, dmul21, dmul22.
//
gen.nonConnectors();
final int dmul11 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE);
final int dmul12 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE);
final int dmul21 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE);
final int dmul22 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE);
gen.shiftComputationIndex();
final int mul1 = gen.cells(blocksnum, CellType.MULTIPLICATIVE);
final int mul2 = gen.cells(blocksnum, CellType.MULTIPLICATIVE);
gen.shiftComputationIndex();
//
// state.
//
final int state_cells = gen.cells(blocksnum, CellType.LINEAR);
gen.shiftComputationIndex();
//
// state-squash and output gates.
//
final int output_squash = gen.cells(blocksnum, netout);
gen.inputConnectors();
final int output_gates = gen.cells(blocksnum, gates);
gen.shiftComputationIndex();
//
// mul3 and dmul31, dmul32
//
gen.nonConnectors();
final int dmul31 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE);
final int dmul32 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE);
gen.shiftComputationIndex();
//
gen.outputConnectors();
final int mul3 = gen.cells(blocksnum, CellType.MULTIPLICATIVE);
//
// define links.
//
gen.link(forget_gates, dmul11, blocksnum);
gen.link(input_gates, dmul21, blocksnum);
gen.link(input_cells, dmul22, blocksnum);
//
gen.link(dmul11, mul1, blocksnum);
gen.link(dmul12, mul1, blocksnum);
gen.link(mul1, state_cells, blocksnum);
//
gen.link(state_cells, dmul12, blocksnum);
//
gen.link(dmul21, mul2, blocksnum);
gen.link(dmul22, mul2, blocksnum);
gen.link(mul2, state_cells, blocksnum);
//
gen.link(state_cells, output_squash, blocksnum);
gen.link(output_squash, dmul31, blocksnum);
gen.link(output_gates, dmul32, blocksnum);
gen.link(dmul31, mul3, blocksnum);
gen.link(dmul32, mul3, blocksnum);
//
// use weighted peepholes?
//
if (peepholes) {
gen.weightedLink(state_cells, forget_gates, blocksnum);
gen.weightedLink(state_cells, input_gates, blocksnum);
gen.weightedLink(state_cells, output_gates, blocksnum);
}
//
// add biases if requested.
//
if (usegatesbias) {
//
final int bias = gen.valueCell();
gen.assign(bias, gatesbias);
//
// link bias to the gates.
//
gen.weightedLink(bias, 1, forget_gates, blocksnum);
gen.weightedLink(bias, 1, input_gates, blocksnum);
gen.weightedLink(bias, 1, output_gates, blocksnum);
}
//
if (useinputbias) {
//
final int bias = gen.valueCell();
gen.assign(bias, inputbias);
//
// link bias to the input.
//
gen.weightedLink(bias, 1, input_cells, blocksnum);
}
//
if (useoutputbias) {
//
final int bias = gen.valueCell();
gen.assign(bias, outputbias);
//
// link bias to output.
//
gen.weightedLink(bias, 1, output_squash, blocksnum);
}
//
gen.endLayer();
//
return layer;
} | static int function( final NetCoreGenerator gen, final int blocksnum, final CellType gates, final CellType netin, final CellType netout, final boolean peepholes, final boolean usegatesbias, final double gatesbias, final boolean useinputbias, final double inputbias, final boolean useoutputbias, final double outputbias ) { final int input_gates = gen.cells(blocksnum, gates); final int forget_gates = gen.cells(blocksnum, gates); final int input_cells = gen.cells(blocksnum, netin); gen.shiftComputationIndex(); final int dmul11 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE); final int dmul12 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE); final int dmul21 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE); final int dmul22 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE); gen.shiftComputationIndex(); final int mul1 = gen.cells(blocksnum, CellType.MULTIPLICATIVE); final int mul2 = gen.cells(blocksnum, CellType.MULTIPLICATIVE); gen.shiftComputationIndex(); gen.shiftComputationIndex(); gen.inputConnectors(); final int output_gates = gen.cells(blocksnum, gates); gen.shiftComputationIndex(); final int dmul31 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE); final int dmul32 = gen.cells(blocksnum, CellType.DMULTIPLICATIVE); gen.shiftComputationIndex(); final int mul3 = gen.cells(blocksnum, CellType.MULTIPLICATIVE); gen.link(input_gates, dmul21, blocksnum); gen.link(input_cells, dmul22, blocksnum); gen.link(dmul12, mul1, blocksnum); gen.link(mul1, state_cells, blocksnum); gen.link(dmul22, mul2, blocksnum); gen.link(mul2, state_cells, blocksnum); gen.link(output_squash, dmul31, blocksnum); gen.link(output_gates, dmul32, blocksnum); gen.link(dmul31, mul3, blocksnum); gen.link(dmul32, mul3, blocksnum); gen.weightedLink(state_cells, forget_gates, blocksnum); gen.weightedLink(state_cells, input_gates, blocksnum); gen.weightedLink(state_cells, output_gates, blocksnum); } gen.assign(bias, gatesbias); gen.weightedLink(bias, 1, input_gates, blocksnum); gen.weightedLink(bias, 1, output_gates, blocksnum); } gen.assign(bias, inputbias); } gen.assign(bias, outputbias); } } | /**
* Creates a hidden layer with n LSTM blocks.
* <br></br>
* @param gen Instance of NetCoreGenerator.
* @param blocksnum Number of LSTM blocks
* @param gates CellType of the gates.
* @param netin CellType of cell-input.
* @param netout CellType of cell-output.
* @param peepholes Use peepholes?
* @param usegatesbias Add bias to the gates?
* @param gatesbias The bias value for the gates.
* @param useinputbias Add bias to input?
* @param inputbias The bias value for the input.
* @return Layer index.
*/ | Creates a hidden layer with n LSTM blocks. | hiddenLayer | {
"repo_name": "JANNLab/JANNLab",
"path": "src/main/java/de/jannlab/generator/LSTMGenerator.java",
"license": "gpl-3.0",
"size": 13158
} | [
"de.jannlab.core.CellType"
] | import de.jannlab.core.CellType; | import de.jannlab.core.*; | [
"de.jannlab.core"
] | de.jannlab.core; | 822,016 |
private void launchOnNewNotificationEventRunnable(Context context, Bundle extras) {
//2.- Run the runnable set for a new notification received event.
if(NotificationModule.doWhenNotificationRunnable==null) {
//...if null, we try to get the runnable from the saved configuration
//in the SharedPreferences. This could happen if the app was closed because
//the service does not know nothing when is called in this case.
String notificationOnNotReceivedThreadToCall = (String) ToolBox.prefs_readPreference(context.getApplicationContext().getApplicationContext(),
NotificationModule.FIREBASE_PREF_NAME,
NotificationModule.FIREBASE_PREF_KEY_APP_NOTIFICATION_ONNOTRECEIVEDTHREAD_TO_CALL, String.class);
Log.i(NotificationModule.TAG, "Runnable to run when a new notification is received: " + notificationOnNotReceivedThreadToCall);
if(notificationOnNotReceivedThreadToCall!=null) {
//Get a new instance from the class with reflection.
try{
Class<?> c = Class.forName(notificationOnNotReceivedThreadToCall);
Constructor<?> cons = c.getConstructor();
Object onNewNotificationRunnableObject = cons.newInstance();
NotificationModule.doWhenNotificationRunnable = (OnNewNotificationCallback)onNewNotificationRunnableObject;
NotificationModule.doWhenNotificationRunnable.context = (context.getApplicationContext()!=null?context.getApplicationContext():context);
}catch(Exception e) {
if(NotificationModule.LOG_ENABLE)
Log.e(NotificationModule.TAG,"Runnable for a new notification received could not be run. " +
"Class could not be found/get (" + e.getMessage() + ").", e);
}
}else{
if(NotificationModule.LOG_ENABLE)
Log.i(NotificationModule.TAG,"No Runnable specified for a new notification received event.");
}
}else{
NotificationModule.doWhenNotificationRunnable.context = (context.getApplicationContext()!=null?context.getApplicationContext():context);
}
//Do something when new notification arrives.
if(NotificationModule.doWhenNotificationRunnable!=null &&
!NotificationModule.doWhenNotificationRunnable.isAlive()){
//Set the intent extras
NotificationModule.doWhenNotificationRunnable.setNotificationBundle(extras);
NotificationModule.doWhenNotificationRunnable.context = (context.getApplicationContext()!=null?context.getApplicationContext():context);
//Launch the thread
Thread t = new Thread(NotificationModule.doWhenNotificationRunnable);
t.start();
if(NotificationModule.LOG_ENABLE)
Log.i(NotificationModule.TAG, "ACK (received) executed.");
}
} | void function(Context context, Bundle extras) { if(NotificationModule.doWhenNotificationRunnable==null) { String notificationOnNotReceivedThreadToCall = (String) ToolBox.prefs_readPreference(context.getApplicationContext().getApplicationContext(), NotificationModule.FIREBASE_PREF_NAME, NotificationModule.FIREBASE_PREF_KEY_APP_NOTIFICATION_ONNOTRECEIVEDTHREAD_TO_CALL, String.class); Log.i(NotificationModule.TAG, STR + notificationOnNotReceivedThreadToCall); if(notificationOnNotReceivedThreadToCall!=null) { try{ Class<?> c = Class.forName(notificationOnNotReceivedThreadToCall); Constructor<?> cons = c.getConstructor(); Object onNewNotificationRunnableObject = cons.newInstance(); NotificationModule.doWhenNotificationRunnable = (OnNewNotificationCallback)onNewNotificationRunnableObject; NotificationModule.doWhenNotificationRunnable.context = (context.getApplicationContext()!=null?context.getApplicationContext():context); }catch(Exception e) { if(NotificationModule.LOG_ENABLE) Log.e(NotificationModule.TAG,STR + STR + e.getMessage() + ").", e); } }else{ if(NotificationModule.LOG_ENABLE) Log.i(NotificationModule.TAG,STR); } }else{ NotificationModule.doWhenNotificationRunnable.context = (context.getApplicationContext()!=null?context.getApplicationContext():context); } if(NotificationModule.doWhenNotificationRunnable!=null && !NotificationModule.doWhenNotificationRunnable.isAlive()){ NotificationModule.doWhenNotificationRunnable.setNotificationBundle(extras); NotificationModule.doWhenNotificationRunnable.context = (context.getApplicationContext()!=null?context.getApplicationContext():context); Thread t = new Thread(NotificationModule.doWhenNotificationRunnable); t.start(); if(NotificationModule.LOG_ENABLE) Log.i(NotificationModule.TAG, STR); } } | /**
* Try to launch the configured runnable (if set) from the
* Firebase OnNewNotification received event.
*
* @param extras
*/ | Try to launch the configured runnable (if set) from the Firebase OnNewNotification received event | launchOnNewNotificationEventRunnable | {
"repo_name": "javocsoft/JavocsoftToolboxAS",
"path": "toolbox/src/main/java/es/javocsoft/android/lib/toolbox/firebase/core/FirebaseCustomNotificationReceiver.java",
"license": "gpl-3.0",
"size": 22614
} | [
"android.content.Context",
"android.os.Bundle",
"android.util.Log",
"es.javocsoft.android.lib.toolbox.ToolBox",
"es.javocsoft.android.lib.toolbox.firebase.NotificationModule",
"es.javocsoft.android.lib.toolbox.firebase.core.callback.OnNewNotificationCallback",
"java.lang.reflect.Constructor"
] | import android.content.Context; import android.os.Bundle; import android.util.Log; import es.javocsoft.android.lib.toolbox.ToolBox; import es.javocsoft.android.lib.toolbox.firebase.NotificationModule; import es.javocsoft.android.lib.toolbox.firebase.core.callback.OnNewNotificationCallback; import java.lang.reflect.Constructor; | import android.content.*; import android.os.*; import android.util.*; import es.javocsoft.android.lib.toolbox.*; import es.javocsoft.android.lib.toolbox.firebase.*; import es.javocsoft.android.lib.toolbox.firebase.core.callback.*; import java.lang.reflect.*; | [
"android.content",
"android.os",
"android.util",
"es.javocsoft.android",
"java.lang"
] | android.content; android.os; android.util; es.javocsoft.android; java.lang; | 953,625 |
public void setConfiguration(FacebookEndpointConfiguration configuration) {
this.configuration = configuration;
} | void function(FacebookEndpointConfiguration configuration) { this.configuration = configuration; } | /**
* Sets the {@link FacebookEndpointConfiguration} to use
*
* @param configuration the {@link FacebookEndpointConfiguration} to use
*/ | Sets the <code>FacebookEndpointConfiguration</code> to use | setConfiguration | {
"repo_name": "pax95/camel",
"path": "components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java",
"license": "apache-2.0",
"size": 8495
} | [
"org.apache.camel.component.facebook.config.FacebookEndpointConfiguration"
] | import org.apache.camel.component.facebook.config.FacebookEndpointConfiguration; | import org.apache.camel.component.facebook.config.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,021,196 |
CiPaint createReferencePointPaint(); | CiPaint createReferencePointPaint(); | /**
* Creates a paint for drawing reference point.
*
* @return the paint object created
*/ | Creates a paint for drawing reference point | createReferencePointPaint | {
"repo_name": "mocircle/cidrawing",
"path": "cidrawinglib/src/main/java/com/mocircle/cidrawing/PaintBuilder.java",
"license": "apache-2.0",
"size": 1992
} | [
"com.mocircle.cidrawing.core.CiPaint"
] | import com.mocircle.cidrawing.core.CiPaint; | import com.mocircle.cidrawing.core.*; | [
"com.mocircle.cidrawing"
] | com.mocircle.cidrawing; | 1,165,601 |
private static String capitalFirst(@Nullable String str) {
return str == null ? null :
str.isEmpty() ? "" : Character.toUpperCase(str.charAt(0)) + str.substring(1);
} | static String function(@Nullable String str) { return str == null ? null : str.isEmpty() ? "" : Character.toUpperCase(str.charAt(0)) + str.substring(1); } | /**
* Capitalizes the first character of the given string.
*
* @param str String.
* @return String with capitalized first character.
*/ | Capitalizes the first character of the given string | capitalFirst | {
"repo_name": "kromulan/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 298812
} | [
"org.jetbrains.annotations.Nullable"
] | import org.jetbrains.annotations.Nullable; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 2,316,365 |
protected void set(String name, String value, String namespaceUri) {
Element currentElement = element.element(name);
if (value == null) {
if (element != null) {
element.remove(currentElement);
}
}
if (currentElement == null) {
if (namespaceUri == null) {
currentElement = element.addElement(name);
} else {
currentElement = element.addElement(new QName(name, new Namespace("", namespaceUri)));
}
if (value != null) {
currentElement.setText(value);
}
}
}
| void function(String name, String value, String namespaceUri) { Element currentElement = element.element(name); if (value == null) { if (element != null) { element.remove(currentElement); } } if (currentElement == null) { if (namespaceUri == null) { currentElement = element.addElement(name); } else { currentElement = element.addElement(new QName(name, new Namespace("", namespaceUri))); } if (value != null) { currentElement.setText(value); } } } | /**
* <p>Sets the value of a given XMPP element. If the element does not exist then a new element
* with the given name will be created.</p>
* <p>The value can be null. If the value is null then the element will be removed from the XMPP object.</p>
*
* @param name Name of the element to be added
* @param value Value that the element will have or <code>null</code>
* @param namespaceUri Namespace for this new element. If the namespace is <code>null</code> then the element will
* be added without a namespace definition.
*/ | Sets the value of a given XMPP element. If the element does not exist then a new element with the given name will be created. The value can be null. If the value is null then the element will be removed from the XMPP object | set | {
"repo_name": "voxeolabs/moho",
"path": "moho-remote/src/main/java/com/voxeo/rayo/client/xmpp/stanza/AbstractXmppObject.java",
"license": "apache-2.0",
"size": 13338
} | [
"org.dom4j.Element",
"org.dom4j.Namespace",
"org.dom4j.QName"
] | import org.dom4j.Element; import org.dom4j.Namespace; import org.dom4j.QName; | import org.dom4j.*; | [
"org.dom4j"
] | org.dom4j; | 2,313,749 |
private void scanLibs(List<T> factories, String libDir) {
LOG.info("Loading core jars from {}", libDir);
List<File> files = new ArrayList<>();
try (DirectoryStream<Path> stream =
Files.newDirectoryStream(Paths.get(libDir), mExtensionPattern)) {
for (Path entry : stream) {
if (entry.toFile().isFile()) {
files.add(entry.toFile());
}
}
} catch (IOException e) {
LOG.warn("Failed to load libs: {}", e.toString());
}
scan(files, factories);
} | void function(List<T> factories, String libDir) { LOG.info(STR, libDir); List<File> files = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(libDir), mExtensionPattern)) { for (Path entry : stream) { if (entry.toFile().isFile()) { files.add(entry.toFile()); } } } catch (IOException e) { LOG.warn(STR, e.toString()); } scan(files, factories); } | /**
* Finds all factory from the lib directory.
*
* @param factories list of factories to add to
*/ | Finds all factory from the lib directory | scanLibs | {
"repo_name": "EvilMcJerkface/alluxio",
"path": "core/common/src/main/java/alluxio/extensions/ExtensionFactoryRegistry.java",
"license": "apache-2.0",
"size": 10065
} | [
"java.io.File",
"java.io.IOException",
"java.nio.file.DirectoryStream",
"java.nio.file.Files",
"java.nio.file.Path",
"java.nio.file.Paths",
"java.util.ArrayList",
"java.util.List"
] | import java.io.File; import java.io.IOException; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; | import java.io.*; import java.nio.file.*; import java.util.*; | [
"java.io",
"java.nio",
"java.util"
] | java.io; java.nio; java.util; | 1,900,594 |
public void valueChanged(ListSelectionEvent e)
{
//if (e.getValueIsAdjusting()) return;
ListSelectionModel lsm = (ListSelectionModel) e.getSource();
List<Integer> indexes = new ArrayList<Integer>();
if (!lsm.isSelectionEmpty()) {
int minIndex = lsm.getMinSelectionIndex();
int maxIndex = lsm.getMaxSelectionIndex();
for (int i = minIndex; i <= maxIndex; i++) {
if (lsm.isSelectedIndex(i)) {
indexes.add(i);
}
}
}
Entry entry;
ROI roi;
TreeMap<Coord3D, ROIShape> shapes;
Iterator<ROIShape> j;
ROIShape shape;
Iterator i = rowIDs.entrySet().iterator();
try {
List<ROIFigure> list = new ArrayList<ROIFigure>();
while (i.hasNext()) {
entry = (Entry) i.next();
if (indexes.contains(entry.getValue())) {
roi = model.getROI((Long) entry.getKey());
shapes = roi.getShapes();
j = shapes.values().iterator();
while (j.hasNext()) {
shape = j.next();
list.add(shape.getFigure());
}
}
}
view.setTableSelectedFigure(list);
} catch (Exception ex) {
// TODO: handle exception
}
}
| void function(ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); List<Integer> indexes = new ArrayList<Integer>(); if (!lsm.isSelectionEmpty()) { int minIndex = lsm.getMinSelectionIndex(); int maxIndex = lsm.getMaxSelectionIndex(); for (int i = minIndex; i <= maxIndex; i++) { if (lsm.isSelectedIndex(i)) { indexes.add(i); } } } Entry entry; ROI roi; TreeMap<Coord3D, ROIShape> shapes; Iterator<ROIShape> j; ROIShape shape; Iterator i = rowIDs.entrySet().iterator(); try { List<ROIFigure> list = new ArrayList<ROIFigure>(); while (i.hasNext()) { entry = (Entry) i.next(); if (indexes.contains(entry.getValue())) { roi = model.getROI((Long) entry.getKey()); shapes = roi.getShapes(); j = shapes.values().iterator(); while (j.hasNext()) { shape = j.next(); list.add(shape.getFigure()); } } } view.setTableSelectedFigure(list); } catch (Exception ex) { } } | /**
* Listens to selection in table. Selects the ROIs in the display.
* @see ListSelectionListener#valueChanged(ListSelectionEvent)
*/ | Listens to selection in table. Selects the ROIs in the display | valueChanged | {
"repo_name": "simleo/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/measurement/view/ServerROITable.java",
"license": "gpl-2.0",
"size": 13665
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"java.util.TreeMap",
"javax.swing.ListSelectionModel",
"javax.swing.event.ListSelectionEvent",
"org.openmicroscopy.shoola.util.roi.figures.ROIFigure",
"org.openmicroscopy.shoola.util.roi.model.ROIShape",
"org.openmicroscopy.shoola.util.roi.model.util.Coord3D"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import org.openmicroscopy.shoola.util.roi.figures.ROIFigure; import org.openmicroscopy.shoola.util.roi.model.ROIShape; import org.openmicroscopy.shoola.util.roi.model.util.Coord3D; | import java.util.*; import javax.swing.*; import javax.swing.event.*; import org.openmicroscopy.shoola.util.roi.figures.*; import org.openmicroscopy.shoola.util.roi.model.*; import org.openmicroscopy.shoola.util.roi.model.util.*; | [
"java.util",
"javax.swing",
"org.openmicroscopy.shoola"
] | java.util; javax.swing; org.openmicroscopy.shoola; | 2,303,403 |
EClass getConditionalExpression(); | EClass getConditionalExpression(); | /**
* Returns the meta object for class '{@link org.yakindu.base.expressions.expressions.ConditionalExpression <em>Conditional Expression</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Conditional Expression</em>'.
* @see org.yakindu.base.expressions.expressions.ConditionalExpression
* @generated
*/ | Returns the meta object for class '<code>org.yakindu.base.expressions.expressions.ConditionalExpression Conditional Expression</code>'. | getConditionalExpression | {
"repo_name": "Yakindu/statecharts",
"path": "plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/ExpressionsPackage.java",
"license": "epl-1.0",
"size": 108238
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,930,841 |
protected void addExcludedPathsPropertyDescriptor(Object object)
{
itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(),
getString("_UI_ProjectFactory_excludedPaths_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_ProjectFactory_excludedPaths_feature", "_UI_ProjectFactory_type"),
ResourcesPackage.Literals.PROJECT_FACTORY__EXCLUDED_PATHS, 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), ResourcesPackage.Literals.PROJECT_FACTORY__EXCLUDED_PATHS, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Excluded Paths feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Excluded Paths feature. | addExcludedPathsPropertyDescriptor | {
"repo_name": "peterkir/org.eclipse.oomph",
"path": "plugins/org.eclipse.oomph.resources.edit/src/org/eclipse/oomph/resources/provider/ProjectFactoryItemProvider.java",
"license": "epl-1.0",
"size": 4175
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.eclipse.oomph.resources.ResourcesPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.oomph.resources.ResourcesPackage; | import org.eclipse.emf.edit.provider.*; import org.eclipse.oomph.resources.*; | [
"org.eclipse.emf",
"org.eclipse.oomph"
] | org.eclipse.emf; org.eclipse.oomph; | 1,714,852 |
public void setSinogramParams(Grid2D sino, double focalLength, double maxRot)
{
this.focalLength = focalLength;
this.numProjs = sino.getHeight();
this.detectorPixels = sino.getWidth();
this.detectorSpacing = sino.getSpacing()[0];
this.detectorLength = detectorSpacing*detectorPixels;
double halfFanAngle = 0;//TODO
System.out.println("Half fan angle: " + halfFanAngle*180.0/Math.PI);
//TODO
this.betaIncrement = maxBeta /(double) numProjs;
System.out.println("Short-scan range: " + maxBeta*180/Math.PI);
}
| void function(Grid2D sino, double focalLength, double maxRot) { this.focalLength = focalLength; this.numProjs = sino.getHeight(); this.detectorPixels = sino.getWidth(); this.detectorSpacing = sino.getSpacing()[0]; this.detectorLength = detectorSpacing*detectorPixels; double halfFanAngle = 0; System.out.println(STR + halfFanAngle*180.0/Math.PI); this.betaIncrement = maxBeta /(double) numProjs; System.out.println(STR + maxBeta*180/Math.PI); } | /**
* Initialize all relevant parameters for the reconstruction
* @param sino the sinogram
* @param focalLength source to detector distance
* @param maxRot maximum rotation angle in [rad] at which the sinogram was acquired
*/ | Initialize all relevant parameters for the reconstruction | setSinogramParams | {
"repo_name": "bergerma/CONRAD",
"path": "src/edu/stanford/rsl/tutorial/dmip/DMIP_FanBeamBackProjector2D.java",
"license": "gpl-3.0",
"size": 10151
} | [
"edu.stanford.rsl.conrad.data.numeric.Grid2D"
] | import edu.stanford.rsl.conrad.data.numeric.Grid2D; | import edu.stanford.rsl.conrad.data.numeric.*; | [
"edu.stanford.rsl"
] | edu.stanford.rsl; | 2,531,111 |
EClass getNotes(); | EClass getNotes(); | /**
* Returns the meta object for class '{@link io.opensemantics.semiotics.model.assessment.Notes <em>Notes</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Notes</em>'.
* @see io.opensemantics.semiotics.model.assessment.Notes
* @generated
*/ | Returns the meta object for class '<code>io.opensemantics.semiotics.model.assessment.Notes Notes</code>'. | getNotes | {
"repo_name": "CoastalHacking/semiotics-main",
"path": "bundles/io.opensemantics.semiotics.model.assessment/src-gen/io/opensemantics/semiotics/model/assessment/AssessmentPackage.java",
"license": "apache-2.0",
"size": 151116
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,795,315 |
private void validatorClassMarker(PsiElement psiElement, Collection<LineMarkerInfo> results) {
PsiElement phpClassContext = psiElement.getContext();
if(!(phpClassContext instanceof PhpClass) || !PhpElementsUtil.isInstanceOf((PhpClass) phpClassContext, "\\Symfony\\Component\\Validator\\Constraint")) {
return;
}
Collection<PhpClass> phpClasses = new ArrayList<>();
// class in same namespace
String className = ((PhpClass) phpClassContext).getFQN() + "Validator";
phpClasses.addAll(
PhpElementsUtil.getClassesInterface(psiElement.getProject(), className)
);
// @TODO: validateBy alias
if(phpClasses.size() == 0) {
return;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(Symfony2Icons.SYMFONY_LINE_MARKER).
setTargets(phpClasses).
setTooltipText("Navigate to validator");
results.add(builder.createLineMarkerInfo(psiElement));
} | void function(PsiElement psiElement, Collection<LineMarkerInfo> results) { PsiElement phpClassContext = psiElement.getContext(); if(!(phpClassContext instanceof PhpClass) !PhpElementsUtil.isInstanceOf((PhpClass) phpClassContext, STR)) { return; } Collection<PhpClass> phpClasses = new ArrayList<>(); String className = ((PhpClass) phpClassContext).getFQN() + STR; phpClasses.addAll( PhpElementsUtil.getClassesInterface(psiElement.getProject(), className) ); if(phpClasses.size() == 0) { return; } NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(Symfony2Icons.SYMFONY_LINE_MARKER). setTargets(phpClasses). setTooltipText(STR); results.add(builder.createLineMarkerInfo(psiElement)); } | /**
* Constraints in same namespace and validateBy service name
*/ | Constraints in same namespace and validateBy service name | validatorClassMarker | {
"repo_name": "gencer/idea-php-symfony2-plugin",
"path": "src/fr/adrienbrault/idea/symfony2plugin/config/ServiceLineMarkerProvider.java",
"license": "mit",
"size": 10009
} | [
"com.intellij.codeInsight.daemon.LineMarkerInfo",
"com.intellij.codeInsight.navigation.NavigationGutterIconBuilder",
"com.intellij.psi.PsiElement",
"com.jetbrains.php.lang.psi.elements.PhpClass",
"fr.adrienbrault.idea.symfony2plugin.Symfony2Icons",
"fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil",
"java.util.ArrayList",
"java.util.Collection"
] | import com.intellij.codeInsight.daemon.LineMarkerInfo; import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; import com.intellij.psi.PsiElement; import com.jetbrains.php.lang.psi.elements.PhpClass; import fr.adrienbrault.idea.symfony2plugin.Symfony2Icons; import fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil; import java.util.ArrayList; import java.util.Collection; | import com.intellij.*; import com.intellij.psi.*; import com.jetbrains.php.lang.psi.elements.*; import fr.adrienbrault.idea.symfony2plugin.*; import fr.adrienbrault.idea.symfony2plugin.util.*; import java.util.*; | [
"com.intellij",
"com.intellij.psi",
"com.jetbrains.php",
"fr.adrienbrault.idea",
"java.util"
] | com.intellij; com.intellij.psi; com.jetbrains.php; fr.adrienbrault.idea; java.util; | 1,681,778 |
private Node parseRecordType(JsDocToken token) {
Node recordType = newNode(Token.LC);
Node fieldTypeList = parseFieldTypeList(token);
if (fieldTypeList == null) {
return reportGenericTypeSyntaxWarning();
}
skipEOLs();
if (!match(JsDocToken.RC)) {
return reportTypeSyntaxWarning("msg.jsdoc.missing.rc");
}
next();
recordType.addChildToBack(fieldTypeList);
return recordType;
} | Node function(JsDocToken token) { Node recordType = newNode(Token.LC); Node fieldTypeList = parseFieldTypeList(token); if (fieldTypeList == null) { return reportGenericTypeSyntaxWarning(); } skipEOLs(); if (!match(JsDocToken.RC)) { return reportTypeSyntaxWarning(STR); } next(); recordType.addChildToBack(fieldTypeList); return recordType; } | /**
* RecordType := '{' FieldTypeList '}'
*/ | RecordType := '{' FieldTypeList '}' | parseRecordType | {
"repo_name": "JonathanWalsh/Granule-Closure-Compiler",
"path": "src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java",
"license": "apache-2.0",
"size": 73655
} | [
"com.google.javascript.rhino.Node",
"com.google.javascript.rhino.Token"
] | import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,274,219 |
private static <T> void assertListsEqualInOrder(
String message, String expectedLabel, List<T> expected, String actualLabel, List<T> actual) {
int i = 0;
for (; i < expected.size() && i < actual.size(); ++i) {
if (!Objects.equals(expected.get(i), actual.get(i))) {
Assert.fail(String.format(
"%s: %s and %s have %d items in common and then differ. "
+ "Item in %s (%d more): %s, item in %s (%d more): %s",
message, expectedLabel, actualLabel, i,
expectedLabel, expected.size() - i - 1, expected.get(i),
actualLabel, actual.size() - i - 1, actual.get(i)));
}
}
if (i < expected.size() ) {
Assert.fail(String.format(
"%s: %s has %d more items after matching all %d from %s. First 5: %s",
message, expectedLabel, expected.size() - actual.size(), actual.size(), actualLabel,
expected.subList(actual.size(), Math.min(expected.size(), actual.size() + 5))));
} else if (i < actual.size() ) {
Assert.fail(String.format(
"%s: %s has %d more items after matching all %d from %s. First 5: %s",
message, actualLabel, actual.size() - expected.size(), expected.size(), expectedLabel,
actual.subList(expected.size(), Math.min(actual.size(), expected.size() + 5))));
} else {
// All is well.
}
} | static <T> void function( String message, String expectedLabel, List<T> expected, String actualLabel, List<T> actual) { int i = 0; for (; i < expected.size() && i < actual.size(); ++i) { if (!Objects.equals(expected.get(i), actual.get(i))) { Assert.fail(String.format( STR + STR, message, expectedLabel, actualLabel, i, expectedLabel, expected.size() - i - 1, expected.get(i), actualLabel, actual.size() - i - 1, actual.get(i))); } } if (i < expected.size() ) { Assert.fail(String.format( STR, message, expectedLabel, expected.size() - actual.size(), actual.size(), actualLabel, expected.subList(actual.size(), Math.min(expected.size(), actual.size() + 5)))); } else if (i < actual.size() ) { Assert.fail(String.format( STR, message, actualLabel, actual.size() - expected.size(), expected.size(), expectedLabel, actual.subList(expected.size(), Math.min(actual.size(), expected.size() + 5)))); } else { } } | /**
* Compares two lists elementwise and throws a detailed assertion failure optimized for
* human reading in case they are unequal.
*/ | Compares two lists elementwise and throws a detailed assertion failure optimized for human reading in case they are unequal | assertListsEqualInOrder | {
"repo_name": "shakamunyi/beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/testing/SourceTestUtils.java",
"license": "apache-2.0",
"size": 32668
} | [
"java.util.List",
"java.util.Objects",
"org.junit.Assert"
] | import java.util.List; import java.util.Objects; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 2,839,876 |
private void offer(Node<K, V> node) {
node.setState(State.LINKING);
node.setNext(tail);
for (; ;) {
Node<K, V> prev = tail.getPrev();
node.setPrev(prev);
if (prev.casNext(tail, node)) {
Node<K, V> next = tail;
for (; ;) {
if (next.casPrev(prev, node)) {
node.setState(State.LINKED);
return;
}
// walk up the list until a node can be linked
next = next.getPrev();
}
}
}
} | void function(Node<K, V> node) { node.setState(State.LINKING); node.setNext(tail); for (; ;) { Node<K, V> prev = tail.getPrev(); node.setPrev(prev); if (prev.casNext(tail, node)) { Node<K, V> next = tail; for (; ;) { if (next.casPrev(prev, node)) { node.setState(State.LINKED); return; } next = next.getPrev(); } } } } | /**
* Inserts the specified node on to the tail of the list.
*
* @param node An unlinked node to append to the tail of the list.
*/ | Inserts the specified node on to the tail of the list | offer | {
"repo_name": "unkascrack/compass-fork",
"path": "compass-core/src/main/java/org/compass/core/util/concurrent/ConcurrentLinkedHashMap.java",
"license": "apache-2.0",
"size": 25189
} | [
"org.compass.core.util.concurrent.ConcurrentLinkedHashMap"
] | import org.compass.core.util.concurrent.ConcurrentLinkedHashMap; | import org.compass.core.util.concurrent.*; | [
"org.compass.core"
] | org.compass.core; | 2,118,115 |
public void exitSign(SQLParser.SignContext ctx) { } | public void exitSign(SQLParser.SignContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterSign | {
"repo_name": "HEIG-GAPS/slasher",
"path": "slasher.corrector/src/main/java/ch/gaps/slasher/corrector/SQLParserBaseListener.java",
"license": "mit",
"size": 73849
} | [
"ch.gaps.slasher.corrector.SQLParser"
] | import ch.gaps.slasher.corrector.SQLParser; | import ch.gaps.slasher.corrector.*; | [
"ch.gaps.slasher"
] | ch.gaps.slasher; | 761,167 |
@Test
public void testPaboUploadProvidedPaboFile() throws Exception{
List<PaboData> paboDataList = PaboParser.parsePaboUpload(shortenedProvidedPaboFile);
int validRows = 5; // The first 5 rows
int remainingEmptyRows = 6; // Last 6 rows are empty like in the example file
PaboData expectedPaboData123450 = new PaboData();
expectedPaboData123450.setAttempt(2);
expectedPaboData123450.setExamName("Modulprüfung");
expectedPaboData123450.setPaboFirstName("Vorname1");
expectedPaboData123450.setPaboLastName("Nachname1");
expectedPaboData123450.setMajor("Bachelor Informatik");
expectedPaboData123450.setMatriculation("123450");
assertTrue(paboDataList.get(0).equalsContents(expectedPaboData123450));
PaboData expectedPaboData123454 = new PaboData();
expectedPaboData123454.setAttempt(3);
expectedPaboData123454.setPaboFirstName("Vorname5");
expectedPaboData123454.setPaboLastName("Nachname5");
expectedPaboData123454.setExamName("Modulprüfung");
expectedPaboData123454.setMajor("Bachelor Informatik");
expectedPaboData123454.setMatriculation("123454");
assertTrue(paboDataList.get(1).equalsContents(expectedPaboData123454));
PaboData expectedPaboData123463 = new PaboData();
expectedPaboData123463.setAttempt(2);
expectedPaboData123463.setPaboFirstName("Vorname14");
expectedPaboData123463.setPaboLastName("Nachname14");
expectedPaboData123463.setExamName("INF-3 Softwareprojekt 1 inkl. Datenbankgrundlagen");
expectedPaboData123463.setMajor("Bachelor Wirtschaftsinformatik");
expectedPaboData123463.setMatriculation("123463");
assertTrue(paboDataList.get(2).equalsContents(expectedPaboData123463));
PaboData expectedPaboData123464 = new PaboData();
expectedPaboData123464.setAttempt(2);
expectedPaboData123464.setPaboFirstName("Vorname15");
expectedPaboData123464.setPaboLastName("Nachname15");
expectedPaboData123464.setExamName("INF-3 Softwareprojekt 1 inkl. Datenbankgrundlagen");
expectedPaboData123464.setMajor("Bachelor Wirtschaftsinformatik");
expectedPaboData123464.setMatriculation("123464");
assertTrue(paboDataList.get(3).equalsContents(expectedPaboData123464));
PaboData expectedPaboData123465 = new PaboData();
expectedPaboData123465.setAttempt(2);
expectedPaboData123465.setPaboFirstName("Vorname16");
expectedPaboData123465.setPaboLastName("Nachname16");
expectedPaboData123465.setExamName("Modulprüfung");
expectedPaboData123465.setMajor("Bachelor Informatik");
expectedPaboData123465.setMatriculation("123465");
assertTrue(paboDataList.get(4).equalsContents(expectedPaboData123465));
for (int i = validRows; i < validRows-1 + remainingEmptyRows; i++) {
assertFalse(paboDataList.get(i).isValdid());
}
assertTrue(paboDataList.size() == validRows+remainingEmptyRows);
} | void function() throws Exception{ List<PaboData> paboDataList = PaboParser.parsePaboUpload(shortenedProvidedPaboFile); int validRows = 5; int remainingEmptyRows = 6; PaboData expectedPaboData123450 = new PaboData(); expectedPaboData123450.setAttempt(2); expectedPaboData123450.setExamName(STR); expectedPaboData123450.setPaboFirstName(STR); expectedPaboData123450.setPaboLastName(STR); expectedPaboData123450.setMajor(STR); expectedPaboData123450.setMatriculation(STR); assertTrue(paboDataList.get(0).equalsContents(expectedPaboData123450)); PaboData expectedPaboData123454 = new PaboData(); expectedPaboData123454.setAttempt(3); expectedPaboData123454.setPaboFirstName(STR); expectedPaboData123454.setPaboLastName(STR); expectedPaboData123454.setExamName(STR); expectedPaboData123454.setMajor(STR); expectedPaboData123454.setMatriculation(STR); assertTrue(paboDataList.get(1).equalsContents(expectedPaboData123454)); PaboData expectedPaboData123463 = new PaboData(); expectedPaboData123463.setAttempt(2); expectedPaboData123463.setPaboFirstName(STR); expectedPaboData123463.setPaboLastName(STR); expectedPaboData123463.setExamName(STR); expectedPaboData123463.setMajor(STR); expectedPaboData123463.setMatriculation(STR); assertTrue(paboDataList.get(2).equalsContents(expectedPaboData123463)); PaboData expectedPaboData123464 = new PaboData(); expectedPaboData123464.setAttempt(2); expectedPaboData123464.setPaboFirstName(STR); expectedPaboData123464.setPaboLastName(STR); expectedPaboData123464.setExamName(STR); expectedPaboData123464.setMajor(STR); expectedPaboData123464.setMatriculation(STR); assertTrue(paboDataList.get(3).equalsContents(expectedPaboData123464)); PaboData expectedPaboData123465 = new PaboData(); expectedPaboData123465.setAttempt(2); expectedPaboData123465.setPaboFirstName(STR); expectedPaboData123465.setPaboLastName(STR); expectedPaboData123465.setExamName(STR); expectedPaboData123465.setMajor(STR); expectedPaboData123465.setMatriculation(STR); assertTrue(paboDataList.get(4).equalsContents(expectedPaboData123465)); for (int i = validRows; i < validRows-1 + remainingEmptyRows; i++) { assertFalse(paboDataList.get(i).isValdid()); } assertTrue(paboDataList.size() == validRows+remainingEmptyRows); } | /**
* Tests if the contents of rows with data gets parsed with the shortened
* provided pabo csv file.
* @throws Exception If there is an IOException while parsing this file, not
* expected.
*/ | Tests if the contents of rows with data gets parsed with the shortened provided pabo csv file | testPaboUploadProvidedPaboFile | {
"repo_name": "stefanoberdoerfer/exmatrikulator",
"path": "src/test/java/de/unibremen/opensores/util/csv/PaboParserTest.java",
"license": "agpl-3.0",
"size": 16062
} | [
"de.unibremen.opensores.model.PaboData",
"java.util.List",
"org.junit.Assert"
] | import de.unibremen.opensores.model.PaboData; import java.util.List; import org.junit.Assert; | import de.unibremen.opensores.model.*; import java.util.*; import org.junit.*; | [
"de.unibremen.opensores",
"java.util",
"org.junit"
] | de.unibremen.opensores; java.util; org.junit; | 596,815 |
public List<Shape> getShapes() {
return this.shapes;
} | List<Shape> function() { return this.shapes; } | /**
* shape_id Optional The shape_id field contains an ID that defines a shape for the trip. This
* value is referenced from the shapes.txt file. The shapes.txt file allows you to define how a
* line should be drawn on the map to represent a trip.
*
* @return shares related to the current trip.
*/ | shape_id Optional The shape_id field contains an ID that defines a shape for the trip. This value is referenced from the shapes.txt file. The shapes.txt file allows you to define how a line should be drawn on the map to represent a trip | getShapes | {
"repo_name": "trein/gtfs-java",
"path": "gtfs-mongo/src/main/java/com/trein/gtfs/mongo/entity/Trip.java",
"license": "mit",
"size": 6566
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 222,629 |
private void handleLayoutAnimation() throws IllegalStateException {
final List<Animator> animators = new ArrayList<Animator>();
// b/8422632 - Without this dummy first animator, startDelays of subsequent animators won't
// be honored correctly; all animators will block regardless of startDelay until the first
// animator in the AnimatorSet truly starts playing.
final ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
anim.setDuration(0);
animators.add(anim);
addOutAnimatorsForStaleViews(animators, mAnimationOutMode);
// Play the In animators at a slight delay after all Out animators have started.
final int animationInStartDelay = animators.size() > 0 ?
(SgvAnimationHelper.getDefaultAnimationDuration() / 2) : 0;
addInAnimators(animators, mAnimationInMode, animationInStartDelay); | void function() throws IllegalStateException { final List<Animator> animators = new ArrayList<Animator>(); final ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f); anim.setDuration(0); animators.add(anim); addOutAnimatorsForStaleViews(animators, mAnimationOutMode); final int animationInStartDelay = animators.size() > 0 ? (SgvAnimationHelper.getDefaultAnimationDuration() / 2) : 0; addInAnimators(animators, mAnimationInMode, animationInStartDelay); | /**
* Performs layout animation of child views.
* @throws IllegalStateException Exception is thrown of currently set animation mode is
* not recognized.
*/ | Performs layout animation of child views | handleLayoutAnimation | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "packages/apps/DeskClock/src/com/android/deskclock/widget/sgv/StaggeredGridView.java",
"license": "gpl-3.0",
"size": 168058
} | [
"android.animation.Animator",
"android.animation.ValueAnimator",
"java.util.ArrayList",
"java.util.List"
] | import android.animation.Animator; import android.animation.ValueAnimator; import java.util.ArrayList; import java.util.List; | import android.animation.*; import java.util.*; | [
"android.animation",
"java.util"
] | android.animation; java.util; | 2,178,864 |
public static ImageDescriptor getImageDescriptor(String path)
{
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
| static ImageDescriptor function(String path) { return imageDescriptorFromPlugin(PLUGIN_ID, path); } | /**
* Creates and returns a new image descriptor for an image file in this plug-in.
* @param path the relative path of the image file, relative to the root of the plug-in; the path must be legal
* @return an image descriptor, or null if no image could be found
*/ | Creates and returns a new image descriptor for an image file in this plug-in | getImageDescriptor | {
"repo_name": "DmitryADP/diff_qc750",
"path": "tools/motodev/src/plugins/android.codeutils/src/com/motorola/studio/android/codeutils/CodeUtilsActivator.java",
"license": "gpl-2.0",
"size": 2767
} | [
"org.eclipse.jface.resource.ImageDescriptor"
] | import org.eclipse.jface.resource.ImageDescriptor; | import org.eclipse.jface.resource.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 1,144,713 |
protected void init() throws IOException, ReplicationException {
for (String id : this.replicationPeers.getConnectedPeers()) {
addSource(id);
}
List<String> currentReplicators = this.replicationQueues.getListOfReplicators();
if (currentReplicators == null || currentReplicators.size() == 0) {
return;
}
List<String> otherRegionServers = replicationTracker.getListOfRegionServers();
LOG.info("Current list of replicators: " + currentReplicators + " other RSs: "
+ otherRegionServers);
// Look if there's anything to process after a restart
for (String rs : currentReplicators) {
if (!otherRegionServers.contains(rs)) {
transferQueues(rs);
}
}
} | void function() throws IOException, ReplicationException { for (String id : this.replicationPeers.getConnectedPeers()) { addSource(id); } List<String> currentReplicators = this.replicationQueues.getListOfReplicators(); if (currentReplicators == null currentReplicators.size() == 0) { return; } List<String> otherRegionServers = replicationTracker.getListOfRegionServers(); LOG.info(STR + currentReplicators + STR + otherRegionServers); for (String rs : currentReplicators) { if (!otherRegionServers.contains(rs)) { transferQueues(rs); } } } | /**
* Adds a normal source per registered peer cluster and tries to process all
* old region server hlog queues
*/ | Adds a normal source per registered peer cluster and tries to process all old region server hlog queues | init | {
"repo_name": "tobegit3hub/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java",
"license": "apache-2.0",
"size": 20382
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.hbase.replication.ReplicationException"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.replication.ReplicationException; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.replication.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 1,137,498 |
void createSdpFile(String fileName) throws LibavException, FileNotFoundException; | void createSdpFile(String fileName) throws LibavException, FileNotFoundException; | /**
* Generate the SDP and write it to the file. DO NOT call this method before
* the writeHeader is called.
*
* @param fileName a file name
* @throws LibavException if an error occurs while creating the SDP
* @throws FileNotFoundException if the given file name does not represent
* a writeable file
*/ | Generate the SDP and write it to the file. DO NOT call this method before the writeHeader is called | createSdpFile | {
"repo_name": "operutka/jlibav",
"path": "jlibav/src/main/java/org/libav/IMediaWriter.java",
"license": "lgpl-3.0",
"size": 5147
} | [
"java.io.FileNotFoundException"
] | import java.io.FileNotFoundException; | import java.io.*; | [
"java.io"
] | java.io; | 2,005,990 |
public static void setUserAttributes(Map<String, Object> userAttributes) {
if (userAttributes == null || userAttributes.isEmpty()) {
Log.e("setUserAttributes - Invalid userAttributes parameter provided (null or empty).");
return;
}
setUserAttributes(null, userAttributes);
} | static void function(Map<String, Object> userAttributes) { if (userAttributes == null userAttributes.isEmpty()) { Log.e(STR); return; } setUserAttributes(null, userAttributes); } | /**
* Adds or modifies user attributes.
*/ | Adds or modifies user attributes | setUserAttributes | {
"repo_name": "Leanplum/Leanplum-Android-SDK",
"path": "AndroidSDKCore/src/main/java/com/leanplum/Leanplum.java",
"license": "apache-2.0",
"size": 82101
} | [
"com.leanplum.internal.Log",
"java.util.Map"
] | import com.leanplum.internal.Log; import java.util.Map; | import com.leanplum.internal.*; import java.util.*; | [
"com.leanplum.internal",
"java.util"
] | com.leanplum.internal; java.util; | 669,143 |
@Override
public RecoverDatabaseOperationCreateResponse create(String sourceServerName, RecoverDatabaseOperationCreateParameters parameters) throws ParserConfigurationException, SAXException, TransformerException, IOException, ServiceException {
// Validate
if (sourceServerName == null) {
throw new NullPointerException("sourceServerName");
}
if (parameters == null) {
throw new NullPointerException("parameters");
}
if (parameters.getSourceDatabaseName() == null) {
throw new NullPointerException("parameters.SourceDatabaseName");
}
// Tracing
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
tracingParameters.put("sourceServerName", sourceServerName);
tracingParameters.put("parameters", parameters);
CloudTracing.enter(invocationId, this, "createAsync", tracingParameters);
}
// Construct URL
String url = "";
url = url + "/";
if (this.getClient().getCredentials().getSubscriptionId() != null) {
url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
}
url = url + "/services/sqlservers/servers/";
url = url + URLEncoder.encode(sourceServerName, "UTF-8");
url = url + "/recoverdatabaseoperations";
String baseUrl = this.getClient().getBaseUri().toString();
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
}
if (url.charAt(0) == '/') {
url = url.substring(1);
}
url = baseUrl + "/" + url;
url = url.replace(" ", "%20");
// Create HTTP transport objects
HttpPost httpRequest = new HttpPost(url);
// Set Headers
httpRequest.setHeader("Content-Type", "application/xml");
httpRequest.setHeader("x-ms-version", "2012-03-01");
// Serialize Request
String requestContent = null;
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document requestDoc = documentBuilder.newDocument();
Element serviceResourceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ServiceResource");
requestDoc.appendChild(serviceResourceElement);
Element sourceDatabaseNameElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "SourceDatabaseName");
sourceDatabaseNameElement.appendChild(requestDoc.createTextNode(parameters.getSourceDatabaseName()));
serviceResourceElement.appendChild(sourceDatabaseNameElement);
if (parameters.getTargetServerName() != null) {
Element targetServerNameElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "TargetServerName");
targetServerNameElement.appendChild(requestDoc.createTextNode(parameters.getTargetServerName()));
serviceResourceElement.appendChild(targetServerNameElement);
}
if (parameters.getTargetDatabaseName() != null) {
Element targetDatabaseNameElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "TargetDatabaseName");
targetDatabaseNameElement.appendChild(requestDoc.createTextNode(parameters.getTargetDatabaseName()));
serviceResourceElement.appendChild(targetDatabaseNameElement);
}
DOMSource domSource = new DOMSource(requestDoc);
StringWriter stringWriter = new StringWriter();
StreamResult streamResult = new StreamResult(stringWriter);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.transform(domSource, streamResult);
requestContent = stringWriter.toString();
StringEntity entity = new StringEntity(requestContent);
httpRequest.setEntity(entity);
httpRequest.setHeader("Content-Type", "application/xml");
// Send Request
HttpResponse httpResponse = null;
try {
if (shouldTrace) {
CloudTracing.sendRequest(invocationId, httpRequest);
}
httpResponse = this.getClient().getHttpClient().execute(httpRequest);
if (shouldTrace) {
CloudTracing.receiveResponse(invocationId, httpResponse);
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_CREATED) {
ServiceException ex = ServiceException.createFromXml(httpRequest, requestContent, httpResponse, httpResponse.getEntity());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
}
// Create Result
RecoverDatabaseOperationCreateResponse result = null;
// Deserialize Response
if (statusCode == HttpStatus.SC_CREATED) {
InputStream responseContent = httpResponse.getEntity().getContent();
result = new RecoverDatabaseOperationCreateResponse();
DocumentBuilderFactory documentBuilderFactory2 = DocumentBuilderFactory.newInstance();
documentBuilderFactory2.setNamespaceAware(true);
DocumentBuilder documentBuilder2 = documentBuilderFactory2.newDocumentBuilder();
Document responseDoc = documentBuilder2.parse(new BOMInputStream(responseContent));
Element serviceResourceElement2 = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ServiceResource");
if (serviceResourceElement2 != null) {
RecoverDatabaseOperation serviceResourceInstance = new RecoverDatabaseOperation();
result.setOperation(serviceResourceInstance);
Element requestIDElement = XmlUtility.getElementByTagNameNS(serviceResourceElement2, "http://schemas.microsoft.com/windowsazure", "RequestID");
if (requestIDElement != null) {
String requestIDInstance;
requestIDInstance = requestIDElement.getTextContent();
serviceResourceInstance.setId(requestIDInstance);
}
Element sourceDatabaseNameElement2 = XmlUtility.getElementByTagNameNS(serviceResourceElement2, "http://schemas.microsoft.com/windowsazure", "SourceDatabaseName");
if (sourceDatabaseNameElement2 != null) {
String sourceDatabaseNameInstance;
sourceDatabaseNameInstance = sourceDatabaseNameElement2.getTextContent();
serviceResourceInstance.setSourceDatabaseName(sourceDatabaseNameInstance);
}
Element targetServerNameElement2 = XmlUtility.getElementByTagNameNS(serviceResourceElement2, "http://schemas.microsoft.com/windowsazure", "TargetServerName");
if (targetServerNameElement2 != null) {
String targetServerNameInstance;
targetServerNameInstance = targetServerNameElement2.getTextContent();
serviceResourceInstance.setTargetServerName(targetServerNameInstance);
}
Element targetDatabaseNameElement2 = XmlUtility.getElementByTagNameNS(serviceResourceElement2, "http://schemas.microsoft.com/windowsazure", "TargetDatabaseName");
if (targetDatabaseNameElement2 != null) {
String targetDatabaseNameInstance;
targetDatabaseNameInstance = targetDatabaseNameElement2.getTextContent();
serviceResourceInstance.setTargetDatabaseName(targetDatabaseNameInstance);
}
Element nameElement = XmlUtility.getElementByTagNameNS(serviceResourceElement2, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
serviceResourceInstance.setName(nameInstance);
}
Element typeElement = XmlUtility.getElementByTagNameNS(serviceResourceElement2, "http://schemas.microsoft.com/windowsazure", "Type");
if (typeElement != null) {
String typeInstance;
typeInstance = typeElement.getTextContent();
serviceResourceInstance.setType(typeInstance);
}
Element stateElement = XmlUtility.getElementByTagNameNS(serviceResourceElement2, "http://schemas.microsoft.com/windowsazure", "State");
if (stateElement != null) {
String stateInstance;
stateInstance = stateElement.getTextContent();
serviceResourceInstance.setState(stateInstance);
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (httpResponse != null && httpResponse.getEntity() != null) {
httpResponse.getEntity().getContent().close();
}
}
} | RecoverDatabaseOperationCreateResponse function(String sourceServerName, RecoverDatabaseOperationCreateParameters parameters) throws ParserConfigurationException, SAXException, TransformerException, IOException, ServiceException { if (sourceServerName == null) { throw new NullPointerException(STR); } if (parameters == null) { throw new NullPointerException(STR); } if (parameters.getSourceDatabaseName() == null) { throw new NullPointerException(STR); } boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put(STR, sourceServerName); tracingParameters.put(STR, parameters); CloudTracing.enter(invocationId, this, STR, tracingParameters); } String url = STR/STRUTF-8STR/services/sqlservers/servers/STRUTF-8STR/recoverdatabaseoperationsSTR/STR STR%20STRContent-TypeSTRapplication/xmlSTRx-ms-versionSTR2012-03-01STRhttp: requestDoc.appendChild(serviceResourceElement); Element sourceDatabaseNameElement = requestDoc.createElementNS(STRhttp: targetServerNameElement.appendChild(requestDoc.createTextNode(parameters.getTargetServerName())); serviceResourceElement.appendChild(targetServerNameElement); } if (parameters.getTargetDatabaseName() != null) { Element targetDatabaseNameElement = requestDoc.createElementNS(STRContent-TypeSTRapplication/xmlSTRhttp: if (serviceResourceElement2 != null) { RecoverDatabaseOperation serviceResourceInstance = new RecoverDatabaseOperation(); result.setOperation(serviceResourceInstance); Element requestIDElement = XmlUtility.getElementByTagNameNS(serviceResourceElement2, STRhttp: if (sourceDatabaseNameElement2 != null) { String sourceDatabaseNameInstance; sourceDatabaseNameInstance = sourceDatabaseNameElement2.getTextContent(); serviceResourceInstance.setSourceDatabaseName(sourceDatabaseNameInstance); } Element targetServerNameElement2 = XmlUtility.getElementByTagNameNS(serviceResourceElement2, STRhttp: if (targetDatabaseNameElement2 != null) { String targetDatabaseNameInstance; targetDatabaseNameInstance = targetDatabaseNameElement2.getTextContent(); serviceResourceInstance.setTargetDatabaseName(targetDatabaseNameInstance); } Element nameElement = XmlUtility.getElementByTagNameNS(serviceResourceElement2, STRhttp: if (typeElement != null) { String typeInstance; typeInstance = typeElement.getTextContent(); serviceResourceInstance.setType(typeInstance); } Element stateElement = XmlUtility.getElementByTagNameNS(serviceResourceElement2, STRx-ms-request-idSTRx-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } } | /**
* Issues a recovery request for an Azure SQL Database.
*
* @param sourceServerName Required. The name of the Azure SQL Database
* Server on which the database was hosted.
* @param parameters Required. Additional parameters for the Create Recover
* Database Operation request.
* @throws ParserConfigurationException Thrown if there was an error
* configuring the parser for the response body.
* @throws SAXException Thrown if there was an error parsing the response
* body.
* @throws TransformerException Thrown if there was an error creating the
* DOM transformer.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Contains the response to the Create Recover Database Operation
* request.
*/ | Issues a recovery request for an Azure SQL Database | create | {
"repo_name": "southworkscom/azure-sdk-for-java",
"path": "service-management/azure-svc-mgmt-sql/src/main/java/com/microsoft/windowsazure/management/sql/RecoverDatabaseOperationsImpl.java",
"license": "apache-2.0",
"size": 15429
} | [
"com.microsoft.windowsazure.core.utils.XmlUtility",
"com.microsoft.windowsazure.exception.ServiceException",
"com.microsoft.windowsazure.management.sql.models.RecoverDatabaseOperation",
"com.microsoft.windowsazure.management.sql.models.RecoverDatabaseOperationCreateParameters",
"com.microsoft.windowsazure.management.sql.models.RecoverDatabaseOperationCreateResponse",
"com.microsoft.windowsazure.tracing.CloudTracing",
"java.io.IOException",
"java.util.HashMap",
"javax.xml.parsers.ParserConfigurationException",
"javax.xml.transform.TransformerException",
"org.w3c.dom.Element",
"org.xml.sax.SAXException"
] | import com.microsoft.windowsazure.core.utils.XmlUtility; import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.management.sql.models.RecoverDatabaseOperation; import com.microsoft.windowsazure.management.sql.models.RecoverDatabaseOperationCreateParameters; import com.microsoft.windowsazure.management.sql.models.RecoverDatabaseOperationCreateResponse; import com.microsoft.windowsazure.tracing.CloudTracing; import java.io.IOException; import java.util.HashMap; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import org.w3c.dom.Element; import org.xml.sax.SAXException; | import com.microsoft.windowsazure.core.utils.*; import com.microsoft.windowsazure.exception.*; import com.microsoft.windowsazure.management.sql.models.*; import com.microsoft.windowsazure.tracing.*; import java.io.*; import java.util.*; import javax.xml.parsers.*; import javax.xml.transform.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"com.microsoft.windowsazure",
"java.io",
"java.util",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] | com.microsoft.windowsazure; java.io; java.util; javax.xml; org.w3c.dom; org.xml.sax; | 928,718 |
@Override
public Adapter createDivideAdapter() {
if (divideItemProvider == null) {
divideItemProvider = new DivideItemProvider(this);
}
return divideItemProvider;
}
protected FloorItemProvider floorItemProvider; | Adapter function() { if (divideItemProvider == null) { divideItemProvider = new DivideItemProvider(this); } return divideItemProvider; } protected FloorItemProvider floorItemProvider; | /**
* This creates an adapter for a {@link org.wso2.developerstudio.datamapper.Divide}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This creates an adapter for a <code>org.wso2.developerstudio.datamapper.Divide</code>. | createDivideAdapter | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.visualdatamapper.edit/src/org/wso2/developerstudio/datamapper/provider/DataMapperItemProviderAdapterFactory.java",
"license": "apache-2.0",
"size": 41714
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,428,896 |
@Transactional(propagation = Propagation.REQUIRED)
private void removeUserRoleForEntity(final String uid, final Long target) {
// remove from childs
List<Category> categories = categoryDao.getAllCategoryOfEntity(target);
for (Category c : categories) {
List<Topic> topics = topicDao.getTopicListByCategory(c.getCategoryId());
for (Topic t : topics) {
if (LOG.isDebugEnabled()) {
LOG.debug("Remove user role in topic id[" + t.getTopicId() + "].");
}
this.userDao.removeUserRoleForCtx(uid, t.getTopicId(), NewsConstants.CTX_T);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Remove user role in category id[" + c.getCategoryId() + "].");
}
this.userDao.removeUserRoleForCtx(uid, c.getCategoryId(), NewsConstants.CTX_C);
}
// remove from entity
if (LOG.isDebugEnabled()) {
LOG.debug("Remove user role in entity id[" + target + "].");
}
this.userDao.removeUserRoleForCtx(uid, target, NewsConstants.CTX_E);
}
| @Transactional(propagation = Propagation.REQUIRED) void function(final String uid, final Long target) { List<Category> categories = categoryDao.getAllCategoryOfEntity(target); for (Category c : categories) { List<Topic> topics = topicDao.getTopicListByCategory(c.getCategoryId()); for (Topic t : topics) { if (LOG.isDebugEnabled()) { LOG.debug(STR + t.getTopicId() + "]."); } this.userDao.removeUserRoleForCtx(uid, t.getTopicId(), NewsConstants.CTX_T); } if (LOG.isDebugEnabled()) { LOG.debug(STR + c.getCategoryId() + "]."); } this.userDao.removeUserRoleForCtx(uid, c.getCategoryId(), NewsConstants.CTX_C); } if (LOG.isDebugEnabled()) { LOG.debug(STR + target + "]."); } this.userDao.removeUserRoleForCtx(uid, target, NewsConstants.CTX_E); } | /**
* Remove roles from the Entity and on all categories and topics of the entity.
* @param uid
* @param target
*/ | Remove roles from the Entity and on all categories and topics of the entity | removeUserRoleForEntity | {
"repo_name": "GIP-RECIA/esup-news",
"path": "src/org/esco/portlets/news/services/UserManagerImpl.java",
"license": "gpl-3.0",
"size": 39276
} | [
"java.util.List",
"org.springframework.transaction.annotation.Propagation",
"org.springframework.transaction.annotation.Transactional",
"org.uhp.portlets.news.NewsConstants",
"org.uhp.portlets.news.domain.Category",
"org.uhp.portlets.news.domain.Topic"
] | import java.util.List; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.uhp.portlets.news.NewsConstants; import org.uhp.portlets.news.domain.Category; import org.uhp.portlets.news.domain.Topic; | import java.util.*; import org.springframework.transaction.annotation.*; import org.uhp.portlets.news.*; import org.uhp.portlets.news.domain.*; | [
"java.util",
"org.springframework.transaction",
"org.uhp.portlets"
] | java.util; org.springframework.transaction; org.uhp.portlets; | 1,328,023 |
@Test
public void listValues() throws Exception {
final ScheduleObject so = new ScheduleObject(d1, 0, "sch0", new DateRange(Date.MINIMUM_DATE, Date.MAXIMUM_DATE),
null, new SequenceOf<>(), new Real(8), new SequenceOf<>(), 12, false);
// Add a few items to the list.
final ObjectIdentifier oid = new ObjectIdentifier(ObjectType.analogInput, 0);
final DeviceObjectPropertyReference local1 = new DeviceObjectPropertyReference(oid,
PropertyIdentifier.presentValue, null, null);
final DeviceObjectPropertyReference remote10 = new DeviceObjectPropertyReference(oid,
PropertyIdentifier.presentValue, null, new ObjectIdentifier(ObjectType.device, 10));
final DeviceObjectPropertyReference remote11 = new DeviceObjectPropertyReference(oid,
PropertyIdentifier.presentValue, null, new ObjectIdentifier(ObjectType.device, 11));
// Ensure that the list is empty.
SequenceOf<Destination> list = RequestUtils.getProperty(d2, rd1, so.getId(),
PropertyIdentifier.listOfObjectPropertyReferences);
assertEquals(list, new SequenceOf<>());
// Add a few elements.
final AddListElementRequest aler = new AddListElementRequest(so.getId(),
PropertyIdentifier.listOfObjectPropertyReferences, null, new SequenceOf<>(local1, remote10));
d2.send(rd1, aler).get();
list = RequestUtils.getProperty(d2, rd1, so.getId(), PropertyIdentifier.listOfObjectPropertyReferences);
assertEquals(list, new SequenceOf<>(local1, remote10));
// Write one more.
d2.send(rd1, new AddListElementRequest(so.getId(), PropertyIdentifier.listOfObjectPropertyReferences, null,
new SequenceOf<>(remote11))).get();
list = RequestUtils.getProperty(d2, rd1, so.getId(), PropertyIdentifier.listOfObjectPropertyReferences);
assertEquals(list, new SequenceOf<>(local1, remote10, remote11));
// Remove some.
d2.send(rd1, new RemoveListElementRequest(so.getId(), PropertyIdentifier.listOfObjectPropertyReferences, null,
new SequenceOf<Encodable>(remote10, local1))).get();
list = RequestUtils.getProperty(d2, rd1, so.getId(), PropertyIdentifier.listOfObjectPropertyReferences);
assertEquals(list, new SequenceOf<>(remote11));
} | void function() throws Exception { final ScheduleObject so = new ScheduleObject(d1, 0, "sch0", new DateRange(Date.MINIMUM_DATE, Date.MAXIMUM_DATE), null, new SequenceOf<>(), new Real(8), new SequenceOf<>(), 12, false); final ObjectIdentifier oid = new ObjectIdentifier(ObjectType.analogInput, 0); final DeviceObjectPropertyReference local1 = new DeviceObjectPropertyReference(oid, PropertyIdentifier.presentValue, null, null); final DeviceObjectPropertyReference remote10 = new DeviceObjectPropertyReference(oid, PropertyIdentifier.presentValue, null, new ObjectIdentifier(ObjectType.device, 10)); final DeviceObjectPropertyReference remote11 = new DeviceObjectPropertyReference(oid, PropertyIdentifier.presentValue, null, new ObjectIdentifier(ObjectType.device, 11)); SequenceOf<Destination> list = RequestUtils.getProperty(d2, rd1, so.getId(), PropertyIdentifier.listOfObjectPropertyReferences); assertEquals(list, new SequenceOf<>()); final AddListElementRequest aler = new AddListElementRequest(so.getId(), PropertyIdentifier.listOfObjectPropertyReferences, null, new SequenceOf<>(local1, remote10)); d2.send(rd1, aler).get(); list = RequestUtils.getProperty(d2, rd1, so.getId(), PropertyIdentifier.listOfObjectPropertyReferences); assertEquals(list, new SequenceOf<>(local1, remote10)); d2.send(rd1, new AddListElementRequest(so.getId(), PropertyIdentifier.listOfObjectPropertyReferences, null, new SequenceOf<>(remote11))).get(); list = RequestUtils.getProperty(d2, rd1, so.getId(), PropertyIdentifier.listOfObjectPropertyReferences); assertEquals(list, new SequenceOf<>(local1, remote10, remote11)); d2.send(rd1, new RemoveListElementRequest(so.getId(), PropertyIdentifier.listOfObjectPropertyReferences, null, new SequenceOf<Encodable>(remote10, local1))).get(); list = RequestUtils.getProperty(d2, rd1, so.getId(), PropertyIdentifier.listOfObjectPropertyReferences); assertEquals(list, new SequenceOf<>(remote11)); } | /**
* Ensures that schedule.listOfObjectPropertyReferences can be modified with WriteProperty
*/ | Ensures that schedule.listOfObjectPropertyReferences can be modified with WriteProperty | listValues | {
"repo_name": "infiniteautomation/BACnet4J",
"path": "src/test/java/com/serotonin/bacnet4j/obj/ScheduleObjectTest.java",
"license": "gpl-3.0",
"size": 18806
} | [
"com.serotonin.bacnet4j.service.confirmed.AddListElementRequest",
"com.serotonin.bacnet4j.service.confirmed.RemoveListElementRequest",
"com.serotonin.bacnet4j.type.Encodable",
"com.serotonin.bacnet4j.type.constructed.DateRange",
"com.serotonin.bacnet4j.type.constructed.Destination",
"com.serotonin.bacnet4j.type.constructed.DeviceObjectPropertyReference",
"com.serotonin.bacnet4j.type.constructed.SequenceOf",
"com.serotonin.bacnet4j.type.enumerated.ObjectType",
"com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier",
"com.serotonin.bacnet4j.type.primitive.Date",
"com.serotonin.bacnet4j.type.primitive.ObjectIdentifier",
"com.serotonin.bacnet4j.type.primitive.Real",
"com.serotonin.bacnet4j.util.RequestUtils",
"org.junit.Assert"
] | import com.serotonin.bacnet4j.service.confirmed.AddListElementRequest; import com.serotonin.bacnet4j.service.confirmed.RemoveListElementRequest; import com.serotonin.bacnet4j.type.Encodable; import com.serotonin.bacnet4j.type.constructed.DateRange; import com.serotonin.bacnet4j.type.constructed.Destination; import com.serotonin.bacnet4j.type.constructed.DeviceObjectPropertyReference; import com.serotonin.bacnet4j.type.constructed.SequenceOf; import com.serotonin.bacnet4j.type.enumerated.ObjectType; import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier; import com.serotonin.bacnet4j.type.primitive.Date; import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier; import com.serotonin.bacnet4j.type.primitive.Real; import com.serotonin.bacnet4j.util.RequestUtils; import org.junit.Assert; | import com.serotonin.bacnet4j.service.confirmed.*; import com.serotonin.bacnet4j.type.*; import com.serotonin.bacnet4j.type.constructed.*; import com.serotonin.bacnet4j.type.enumerated.*; import com.serotonin.bacnet4j.type.primitive.*; import com.serotonin.bacnet4j.util.*; import org.junit.*; | [
"com.serotonin.bacnet4j",
"org.junit"
] | com.serotonin.bacnet4j; org.junit; | 1,894,329 |
public String selectGame(Client client, HashMap<String, String> param)
{
String actionResult = null;
String gameName = param.get("gameName");
ServerController controller = ServerController.getInstance();
// search the hall of the game
GameHall hall = controller.getRealm().searchHall(gameName);
if(hall == null)
actionResult = Action.ERROR + "?" + "errorTitle=Game Error" +
"&errorContent=Game not found";
// add the client to the game hall
client.getUserAccount().setGameHall(hall);
hall.addClient(client);
//set response for the client
actionResult = Action.MOVE_TO_GAME_HALL + "?" + "gameName=" + gameName;
return actionResult;
}
| String function(Client client, HashMap<String, String> param) { String actionResult = null; String gameName = param.get(STR); ServerController controller = ServerController.getInstance(); GameHall hall = controller.getRealm().searchHall(gameName); if(hall == null) actionResult = Action.ERROR + "?" + STR + STR; client.getUserAccount().setGameHall(hall); hall.addClient(client); actionResult = Action.MOVE_TO_GAME_HALL + "?" + STR + gameName; return actionResult; } | /**
* Sets the game of the client as the selected game.
* (action command: SELECT_GAME)
*
* @param client source Client of the action command
* @param param parameter list of the action
* @return action result as a string
*/ | Sets the game of the client as the selected game. (action command: SELECT_GAME) | selectGame | {
"repo_name": "onursumer/game-server",
"path": "src/main/java/server/action/RealmAction.java",
"license": "lgpl-3.0",
"size": 5337
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,231,098 |
@Override
protected TestEnvironment createTestEnvironment(TestParameters tParam,
PrintWriter log) throws Exception {
XInterface oObj = null;
// create testobject here
SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF());
xTextDoc = SOF.createTextDoc(null);
XTextCursor xCursor = xTextDoc.getText().createTextCursor();
try {
XMultiServiceFactory xMultiServiceFactory = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc);
Object o = xMultiServiceFactory.createInstance("com.sun.star.text.TextEmbeddedObject" );
XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, o);
String sChartClassID = "12dcae26-281f-416f-a234-c3086127382e";
XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xTextContent);
xPropertySet.setPropertyValue( "CLSID", sChartClassID );
xTextDoc.getText().insertTextContent( xCursor, xTextContent, false );
}
catch(com.sun.star.uno.Exception e) {
e.printStackTrace(log);
}
XTextEmbeddedObjectsSupplier oTEOS = UnoRuntime.queryInterface(
XTextEmbeddedObjectsSupplier.class,
xTextDoc);
XNameAccess oEmObj = oTEOS.getEmbeddedObjects();
XIndexAccess oEmIn = UnoRuntime.queryInterface(
XIndexAccess.class, oEmObj);
oObj = (XInterface) AnyConverter.toObject(
new Type(XInterface.class), oEmIn.getByIndex(0));
TestEnvironment tEnv = new TestEnvironment(oObj);
tEnv.addObjRelation("NoAttach", "SwXTextEmbeddedObject");
XTextFrame aFrame = SOfficeFactory.createTextFrame(xTextDoc, 500, 500);
XText oText = xTextDoc.getText();
XTextCursor oCursor = oText.createTextCursor();
XTextContent the_content = UnoRuntime.queryInterface(
XTextContent.class, aFrame);
try {
oText.insertTextContent(oCursor, the_content, true);
} catch (com.sun.star.lang.IllegalArgumentException e) {
log.println("Couldn't insert frame " + e.getMessage());
}
tEnv.addObjRelation("TextFrame", aFrame);
tEnv.addObjRelation("NoSetSize", "SwXTextEmbeddedObject");
tEnv.addObjRelation("NoPos", "SwXTextEmbeddedObject");
return tEnv;
} // finish method getTestEnvironment | TestEnvironment function(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); xTextDoc = SOF.createTextDoc(null); XTextCursor xCursor = xTextDoc.getText().createTextCursor(); try { XMultiServiceFactory xMultiServiceFactory = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); Object o = xMultiServiceFactory.createInstance(STR ); XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, o); String sChartClassID = STR; XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xTextContent); xPropertySet.setPropertyValue( "CLSID", sChartClassID ); xTextDoc.getText().insertTextContent( xCursor, xTextContent, false ); } catch(com.sun.star.uno.Exception e) { e.printStackTrace(log); } XTextEmbeddedObjectsSupplier oTEOS = UnoRuntime.queryInterface( XTextEmbeddedObjectsSupplier.class, xTextDoc); XNameAccess oEmObj = oTEOS.getEmbeddedObjects(); XIndexAccess oEmIn = UnoRuntime.queryInterface( XIndexAccess.class, oEmObj); oObj = (XInterface) AnyConverter.toObject( new Type(XInterface.class), oEmIn.getByIndex(0)); TestEnvironment tEnv = new TestEnvironment(oObj); tEnv.addObjRelation(STR, STR); XTextFrame aFrame = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); XTextContent the_content = UnoRuntime.queryInterface( XTextContent.class, aFrame); try { oText.insertTextContent(oCursor, the_content, true); } catch (com.sun.star.lang.IllegalArgumentException e) { log.println(STR + e.getMessage()); } tEnv.addObjRelation(STR, aFrame); tEnv.addObjRelation(STR, STR); tEnv.addObjRelation("NoPos", STR); return tEnv; } | /**
* creating a TestEnvironment for the interfaces to be tested
*
* @param tParam class which contains additional test parameters
* @param log class to log the test state and result
*
* @return Status class
*
* @see TestParameters
* @see PrintWriter
*/ | creating a TestEnvironment for the interfaces to be tested | createTestEnvironment | {
"repo_name": "sbbic/core",
"path": "qadevOOo/tests/java/mod/_sw/SwXTextEmbeddedObject.java",
"license": "gpl-3.0",
"size": 5748
} | [
"com.sun.star.beans.XPropertySet",
"com.sun.star.container.XIndexAccess",
"com.sun.star.container.XNameAccess",
"com.sun.star.lang.XMultiServiceFactory",
"com.sun.star.text.XText",
"com.sun.star.text.XTextContent",
"com.sun.star.text.XTextCursor",
"com.sun.star.text.XTextEmbeddedObjectsSupplier",
"com.sun.star.text.XTextFrame",
"com.sun.star.uno.AnyConverter",
"com.sun.star.uno.Type",
"com.sun.star.uno.UnoRuntime",
"com.sun.star.uno.XInterface",
"java.io.PrintWriter"
] | import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.XText; import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextEmbeddedObjectsSupplier; import com.sun.star.text.XTextFrame; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import java.io.PrintWriter; | import com.sun.star.beans.*; import com.sun.star.container.*; import com.sun.star.lang.*; import com.sun.star.text.*; import com.sun.star.uno.*; import java.io.*; | [
"com.sun.star",
"java.io"
] | com.sun.star; java.io; | 511,093 |
@Test
public void testDelimiterParsingDisabledXPath() throws ConfigurationException
{
XMLConfiguration conf2 = new XMLConfiguration();
conf2.setExpressionEngine(new XPathExpressionEngine());
load(conf2, testProperties);
assertEquals("a,b,c", conf2.getString("split/list3/@values"));
assertEquals(0, conf2.getMaxIndex("split/list3/@values"));
assertEquals("a\\,b\\,c", conf2.getString("split/list4/@values"));
assertEquals("a,b,c", conf2.getString("split/list1"));
assertEquals(0, conf2.getMaxIndex("split/list1"));
assertEquals("a\\,b\\,c", conf2.getString("split/list2"));
} | void function() throws ConfigurationException { XMLConfiguration conf2 = new XMLConfiguration(); conf2.setExpressionEngine(new XPathExpressionEngine()); load(conf2, testProperties); assertEquals("a,b,c", conf2.getString(STR)); assertEquals(0, conf2.getMaxIndex(STR)); assertEquals(STR, conf2.getString(STR)); assertEquals("a,b,c", conf2.getString(STR)); assertEquals(0, conf2.getMaxIndex(STR)); assertEquals(STR, conf2.getString(STR)); } | /**
* Tests whether string properties with list delimiters can be accessed if
* delimiter parsing is disabled and the XPath expression engine is used.
*/ | Tests whether string properties with list delimiters can be accessed if delimiter parsing is disabled and the XPath expression engine is used | testDelimiterParsingDisabledXPath | {
"repo_name": "mohanaraosv/commons-configuration",
"path": "src/test/java/org/apache/commons/configuration2/TestXMLConfiguration.java",
"license": "apache-2.0",
"size": 59359
} | [
"org.apache.commons.configuration2.ex.ConfigurationException",
"org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine",
"org.junit.Assert"
] | import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine; import org.junit.Assert; | import org.apache.commons.configuration2.ex.*; import org.apache.commons.configuration2.tree.xpath.*; import org.junit.*; | [
"org.apache.commons",
"org.junit"
] | org.apache.commons; org.junit; | 2,849,714 |
Long smembers(ValueStreamingChannel<V> channel, K key); | Long smembers(ValueStreamingChannel<V> channel, K key); | /**
* Get all the members in a set.
*
* @param channel the channel.
* @param key the keys.
* @return Long count of members of the resulting set.
*/ | Get all the members in a set | smembers | {
"repo_name": "lettuce-io/lettuce-core",
"path": "src/main/java/io/lettuce/core/api/sync/RedisSetCommands.java",
"license": "apache-2.0",
"size": 10193
} | [
"io.lettuce.core.output.ValueStreamingChannel"
] | import io.lettuce.core.output.ValueStreamingChannel; | import io.lettuce.core.output.*; | [
"io.lettuce.core"
] | io.lettuce.core; | 2,658,218 |
@Deprecated
public static void write(final StringBuffer data, final Writer output)
throws IOException {
if (data != null) {
output.write(data.toString());
}
} | static void function(final StringBuffer data, final Writer output) throws IOException { if (data != null) { output.write(data.toString()); } } | /**
* Writes chars from a <code>StringBuffer</code> to a <code>Writer</code>.
*
* @param data the <code>StringBuffer</code> to write, null ignored
* @param output the <code>Writer</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since 1.1
* @deprecated replaced by write(CharSequence, Writer)
*/ | Writes chars from a <code>StringBuffer</code> to a <code>Writer</code> | write | {
"repo_name": "krosenvold/commons-io",
"path": "src/main/java/org/apache/commons/io/IOUtils.java",
"license": "apache-2.0",
"size": 125142
} | [
"java.io.IOException",
"java.io.Writer"
] | import java.io.IOException; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 2,548,596 |
public Page findByTechnical(String pagename); | Page function(String pagename); | /**
* Methode zum laden eines Objektes der Klasse Page anhand der
* Benutzernames.
*
* @param pagename - Benutzername des Objektes das geladen werden soll.
* @return Page - Objekt das den angegebenen Benutzernamen besitzt.
*/ | Methode zum laden eines Objektes der Klasse Page anhand der Benutzernames | findByTechnical | {
"repo_name": "tiv-source/tiv-page",
"path": "dao/src/main/java/de/tivsource/page/dao/page/PageDaoLocal.java",
"license": "gpl-2.0",
"size": 2526
} | [
"de.tivsource.page.entity.page.Page"
] | import de.tivsource.page.entity.page.Page; | import de.tivsource.page.entity.page.*; | [
"de.tivsource.page"
] | de.tivsource.page; | 2,712,572 |
protected void alk(final EncodingResult result, final Variable[] vars, final int rhs) {
if (rhs < 0) {
throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs);
}
if (rhs > vars.length) {
result.addClause();
return;
}
if (rhs == 0) {
return;
}
if (rhs == 1) {
result.addClause(vars);
return;
}
if (rhs == vars.length) {
for (final Variable var : vars) {
result.addClause(var);
}
return;
}
switch (this.config().alkEncoder) {
case TOTALIZER:
if (this.alkTotalizer == null) {
this.alkTotalizer = new CCALKTotalizer();
}
this.alkTotalizer.build(result, vars, rhs);
break;
case MODULAR_TOTALIZER:
if (this.alkModularTotalizer == null) {
this.alkModularTotalizer = new CCALKModularTotalizer(this.f);
}
this.alkModularTotalizer.build(result, vars, rhs);
break;
case CARDINALITY_NETWORK:
if (this.alkCardinalityNetwork == null) {
this.alkCardinalityNetwork = new CCALKCardinalityNetwork();
}
this.alkCardinalityNetwork.build(result, vars, rhs);
break;
case BEST:
this.bestALK(vars.length).build(result, vars, rhs);
break;
default:
throw new IllegalStateException("Unknown at-least-k encoder: " + this.config().alkEncoder);
}
} | void function(final EncodingResult result, final Variable[] vars, final int rhs) { if (rhs < 0) { throw new IllegalArgumentException(STR + rhs); } if (rhs > vars.length) { result.addClause(); return; } if (rhs == 0) { return; } if (rhs == 1) { result.addClause(vars); return; } if (rhs == vars.length) { for (final Variable var : vars) { result.addClause(var); } return; } switch (this.config().alkEncoder) { case TOTALIZER: if (this.alkTotalizer == null) { this.alkTotalizer = new CCALKTotalizer(); } this.alkTotalizer.build(result, vars, rhs); break; case MODULAR_TOTALIZER: if (this.alkModularTotalizer == null) { this.alkModularTotalizer = new CCALKModularTotalizer(this.f); } this.alkModularTotalizer.build(result, vars, rhs); break; case CARDINALITY_NETWORK: if (this.alkCardinalityNetwork == null) { this.alkCardinalityNetwork = new CCALKCardinalityNetwork(); } this.alkCardinalityNetwork.build(result, vars, rhs); break; case BEST: this.bestALK(vars.length).build(result, vars, rhs); break; default: throw new IllegalStateException(STR + this.config().alkEncoder); } } | /**
* Encodes an at-lest-k constraint.
* @param result the result
* @param vars the variables of the constraint
* @param rhs the right hand side of the constraint
*/ | Encodes an at-lest-k constraint | alk | {
"repo_name": "logic-ng/LogicNG",
"path": "src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java",
"license": "apache-2.0",
"size": 25318
} | [
"org.logicng.datastructures.EncodingResult",
"org.logicng.formulas.Variable"
] | import org.logicng.datastructures.EncodingResult; import org.logicng.formulas.Variable; | import org.logicng.datastructures.*; import org.logicng.formulas.*; | [
"org.logicng.datastructures",
"org.logicng.formulas"
] | org.logicng.datastructures; org.logicng.formulas; | 1,969,133 |
public ActionForward recalculateDirectFandADistributionTotals(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
return mapping.findForward(Constants.MAPPING_BASIC);
} | ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward(Constants.MAPPING_BASIC); } | /**
* This method is used to recalculate the Total amounts in the Direct F and A Distribution panel.
*
* @param mapping
* @param form
* @param request
* @param response
* @return mapping forward
* @throws Exception
*/ | This method is used to recalculate the Total amounts in the Direct F and A Distribution panel | recalculateDirectFandADistributionTotals | {
"repo_name": "vivantech/kc_fixes",
"path": "src/main/java/org/kuali/kra/timeandmoney/web/struts/action/TimeAndMoneyAction.java",
"license": "apache-2.0",
"size": 75923
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping",
"org.kuali.kra.infrastructure.Constants"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.kra.infrastructure.Constants; | import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.kra.infrastructure.*; | [
"javax.servlet",
"org.apache.struts",
"org.kuali.kra"
] | javax.servlet; org.apache.struts; org.kuali.kra; | 1,398,052 |
public Gesture fill(double zoomFactor, double scale, PredefinedColor color) throws IOException
{ Gesture result = new Gesture();
double zoom = zoomFactor/scale;
// name
result.setName(name);
// animes
for(Entry<Direction,HollowAnimeDirection> e: animes.entrySet())
{ AnimeDirection temp = e.getValue().fill(zoom,color);
Direction direction = e.getKey();
result.addAnimeDirection(temp,direction);
}
// trajectories
for(Entry<Direction,HollowTrajectoryDirection> e: trajectories.entrySet())
{ TrajectoryDirection temp = e.getValue().fill(zoomFactor);
result.addTrajectoryDirection(temp);
}
// modulations
for(SelfModulation e: selfModulations)
result.addModulation(e);
for(OtherModulation e: otherModulations)
result.addModulation(e);
for(ActorModulation e: actorModulations)
result.addModulation(e);
for(TargetModulation e: targetModulations)
result.addModulation(e);
for(ThirdModulation e: thirdModulations)
result.addModulation(e);
return result;
}
| Gesture function(double zoomFactor, double scale, PredefinedColor color) throws IOException { Gesture result = new Gesture(); double zoom = zoomFactor/scale; result.setName(name); for(Entry<Direction,HollowAnimeDirection> e: animes.entrySet()) { AnimeDirection temp = e.getValue().fill(zoom,color); Direction direction = e.getKey(); result.addAnimeDirection(temp,direction); } for(Entry<Direction,HollowTrajectoryDirection> e: trajectories.entrySet()) { TrajectoryDirection temp = e.getValue().fill(zoomFactor); result.addTrajectoryDirection(temp); } for(SelfModulation e: selfModulations) result.addModulation(e); for(OtherModulation e: otherModulations) result.addModulation(e); for(ActorModulation e: actorModulations) result.addModulation(e); for(TargetModulation e: targetModulations) result.addModulation(e); for(ThirdModulation e: thirdModulations) result.addModulation(e); return result; } | /**
* used when generating an actual Factory from a HollowFactory.
* Images names are replaced by the actual images, scalable stuff
* is scaled, etc.
*/ | used when generating an actual Factory from a HollowFactory. Images names are replaced by the actual images, scalable stuff is scaled, etc | fill | {
"repo_name": "vlabatut/totalboumboum",
"path": "src/org/totalboumboum/engine/content/feature/gesture/HollowGesture.java",
"license": "gpl-2.0",
"size": 5677
} | [
"java.io.IOException",
"java.util.Map",
"org.totalboumboum.engine.content.feature.Direction",
"org.totalboumboum.engine.content.feature.gesture.anime.direction.AnimeDirection",
"org.totalboumboum.engine.content.feature.gesture.anime.direction.HollowAnimeDirection",
"org.totalboumboum.engine.content.feature.gesture.modulation.ActorModulation",
"org.totalboumboum.engine.content.feature.gesture.modulation.OtherModulation",
"org.totalboumboum.engine.content.feature.gesture.modulation.SelfModulation",
"org.totalboumboum.engine.content.feature.gesture.modulation.TargetModulation",
"org.totalboumboum.engine.content.feature.gesture.modulation.ThirdModulation",
"org.totalboumboum.engine.content.feature.gesture.trajectory.direction.HollowTrajectoryDirection",
"org.totalboumboum.engine.content.feature.gesture.trajectory.direction.TrajectoryDirection",
"org.totalboumboum.tools.images.PredefinedColor"
] | import java.io.IOException; import java.util.Map; import org.totalboumboum.engine.content.feature.Direction; import org.totalboumboum.engine.content.feature.gesture.anime.direction.AnimeDirection; import org.totalboumboum.engine.content.feature.gesture.anime.direction.HollowAnimeDirection; import org.totalboumboum.engine.content.feature.gesture.modulation.ActorModulation; import org.totalboumboum.engine.content.feature.gesture.modulation.OtherModulation; import org.totalboumboum.engine.content.feature.gesture.modulation.SelfModulation; import org.totalboumboum.engine.content.feature.gesture.modulation.TargetModulation; import org.totalboumboum.engine.content.feature.gesture.modulation.ThirdModulation; import org.totalboumboum.engine.content.feature.gesture.trajectory.direction.HollowTrajectoryDirection; import org.totalboumboum.engine.content.feature.gesture.trajectory.direction.TrajectoryDirection; import org.totalboumboum.tools.images.PredefinedColor; | import java.io.*; import java.util.*; import org.totalboumboum.engine.content.feature.*; import org.totalboumboum.engine.content.feature.gesture.anime.direction.*; import org.totalboumboum.engine.content.feature.gesture.modulation.*; import org.totalboumboum.engine.content.feature.gesture.trajectory.direction.*; import org.totalboumboum.tools.images.*; | [
"java.io",
"java.util",
"org.totalboumboum.engine",
"org.totalboumboum.tools"
] | java.io; java.util; org.totalboumboum.engine; org.totalboumboum.tools; | 1,429,567 |
public void setImageMagickPath(String ImageMagickPath) {
if (!ImageMagickPath.isEmpty() && !ImageMagickPath.endsWith(File.separator))
ImageMagickPath += File.separator;
this.ImageMagickPath = ImageMagickPath;
} | void function(String ImageMagickPath) { if (!ImageMagickPath.isEmpty() && !ImageMagickPath.endsWith(File.separator)) ImageMagickPath += File.separator; this.ImageMagickPath = ImageMagickPath; } | /**
* Set the path to the ImageMagick executable, needed if it is not on system path.
*
* @param ImageMagickPath to ImageMagick file.
*/ | Set the path to the ImageMagick executable, needed if it is not on system path | setImageMagickPath | {
"repo_name": "zamattiac/tika",
"path": "tika-parsers/src/main/java/org/apache/tika/parser/ocr/TesseractOCRConfig.java",
"license": "apache-2.0",
"size": 16463
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 734,885 |
public List<String> getInformation() {
return this.mInformationsAsString;
}
| List<String> function() { return this.mInformationsAsString; } | /**
* Gets the information hold by this panel.
*
* @return The information mentioned.
*/ | Gets the information hold by this panel | getInformation | {
"repo_name": "ZabuzaW/TreeFlood",
"path": "src/de/zabuza/treeflood/demo/gui/model/InformationPanel.java",
"license": "gpl-3.0",
"size": 4800
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,908,167 |
@Test
public void testErrorNonForeachInput() throws Exception {
String query = "A = load 'myfile' as (name, age, gpa);" +
"store A into 'output';";
LogicalPlan newLogicalPlan = migrateAndOptimizePlan( query );
Operator load = newLogicalPlan.getSources().get( 0 );
Assert.assertTrue( load instanceof LOLoad );
List<Operator> nexts = newLogicalPlan.getSuccessors( load );
Assert.assertTrue( nexts != null && nexts.size() == 1 );
} | void function() throws Exception { String query = STR + STR; LogicalPlan newLogicalPlan = migrateAndOptimizePlan( query ); Operator load = newLogicalPlan.getSources().get( 0 ); Assert.assertTrue( load instanceof LOLoad ); List<Operator> nexts = newLogicalPlan.getSuccessors( load ); Assert.assertTrue( nexts != null && nexts.size() == 1 ); } | /**
* No foreach in the plan, no effect.
*/ | No foreach in the plan, no effect | testErrorNonForeachInput | {
"repo_name": "kaituo/sedge",
"path": "trunk/test/org/apache/pig/test/TestNewPlanPushDownForeachFlatten.java",
"license": "mit",
"size": 51650
} | [
"java.util.List",
"org.apache.pig.newplan.Operator",
"org.apache.pig.newplan.logical.relational.LOLoad",
"org.apache.pig.newplan.logical.relational.LogicalPlan",
"org.junit.Assert"
] | import java.util.List; import org.apache.pig.newplan.Operator; import org.apache.pig.newplan.logical.relational.LOLoad; import org.apache.pig.newplan.logical.relational.LogicalPlan; import org.junit.Assert; | import java.util.*; import org.apache.pig.newplan.*; import org.apache.pig.newplan.logical.relational.*; import org.junit.*; | [
"java.util",
"org.apache.pig",
"org.junit"
] | java.util; org.apache.pig; org.junit; | 1,690,713 |
public void destroy() {
getScheduler().stop();
}
static Logger logger = LoggerFactory.getLogger(Interpreter.class);
private InterpreterGroup interpreterGroup;
private URL [] classloaderUrls;
protected Properties property;
public Interpreter(Properties property) {
this.property = property;
} | void function() { getScheduler().stop(); } static Logger logger = LoggerFactory.getLogger(Interpreter.class); private InterpreterGroup interpreterGroup; private URL [] classloaderUrls; protected Properties property; public Interpreter(Properties property) { this.property = property; } | /**
* Called when interpreter is no longer used.
*/ | Called when interpreter is no longer used | destroy | {
"repo_name": "myrtleTree33/zeppelin",
"path": "zeppelin-interpreter/src/main/java/com/nflabs/zeppelin/interpreter/Interpreter.java",
"license": "apache-2.0",
"size": 7063
} | [
"java.util.Properties",
"org.slf4j.Logger",
"org.slf4j.LoggerFactory"
] | import java.util.Properties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; | import java.util.*; import org.slf4j.*; | [
"java.util",
"org.slf4j"
] | java.util; org.slf4j; | 525,993 |
protected void applyToAbstractRenderer(AbstractRenderer renderer) {
if (renderer.getAutoPopulateSeriesPaint()) {
renderer.clearSeriesPaints(false);
}
if (renderer.getAutoPopulateSeriesStroke()) {
renderer.clearSeriesStrokes(false);
}
}
| void function(AbstractRenderer renderer) { if (renderer.getAutoPopulateSeriesPaint()) { renderer.clearSeriesPaints(false); } if (renderer.getAutoPopulateSeriesStroke()) { renderer.clearSeriesStrokes(false); } } | /**
* Applies the attributes for this theme to an {@link AbstractRenderer}.
*
* @param renderer the renderer (<code>null</code> not permitted).
*/ | Applies the attributes for this theme to an <code>AbstractRenderer</code> | applyToAbstractRenderer | {
"repo_name": "sebkur/JFreeChart",
"path": "src/main/java/org/jfree/chart/StandardChartTheme.java",
"license": "lgpl-3.0",
"size": 60532
} | [
"org.jfree.chart.renderer.AbstractRenderer"
] | import org.jfree.chart.renderer.AbstractRenderer; | import org.jfree.chart.renderer.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 2,796,948 |
int read(byte[] writeBuffer, int writeOffset, int writeSize, byte[] readBuffer, int readOffset, int readSize) throws IOException; | int read(byte[] writeBuffer, int writeOffset, int writeSize, byte[] readBuffer, int readOffset, int readSize) throws IOException; | /**
* This method writes and reads bytes to/from the i2c device in a single method call
*
* @param writeBuffer buffer of data to be written to the i2c device in one go
* @param writeOffset offset in write buffer
* @param writeSize number of bytes to be written from buffer
* @param readBuffer buffer of data to be read from the i2c device in one go
* @param readOffset offset in read buffer
* @param readSize number of bytes to be read
*
* @return number of bytes read
*
* @throws IOException thrown in case byte cannot be read from the i2c device or i2c bus
*/ | This method writes and reads bytes to/from the i2c device in a single method call | read | {
"repo_name": "RasPelikan/pi4j",
"path": "pi4j-core/src/main/java/com/pi4j/io/i2c/I2CDevice.java",
"license": "lgpl-3.0",
"size": 5890
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 845,438 |
List<BeanInfo> searchByName(String beanName); | List<BeanInfo> searchByName(String beanName); | /**
* Search beans by bean name.
*
* @param beanName
* @return
*/ | Search beans by bean name | searchByName | {
"repo_name": "arthur-except/spring-bean-browser",
"path": "src/main/java/com/arthur/bean/service/BeanService.java",
"license": "apache-2.0",
"size": 476
} | [
"com.arthur.bean.details.BeanInfo",
"java.util.List"
] | import com.arthur.bean.details.BeanInfo; import java.util.List; | import com.arthur.bean.details.*; import java.util.*; | [
"com.arthur.bean",
"java.util"
] | com.arthur.bean; java.util; | 1,673,237 |
private synchronized void destroyProcess() {
boolean wasInterrupted = false;
try {
this.process.destroy();
while (true) {
try {
this.process.waitFor();
return;
} catch (InterruptedException ie) {
wasInterrupted = true;
}
}
} finally {
if (shutdownHook != null) {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
shutdownHook = null;
}
// Stop the subthreads only when the process is dead, or their loops will go on.
if (this.requestSender != null) {
this.requestSender.interrupt();
}
if (this.responseReceiver != null) {
this.responseReceiver.interrupt();
}
// Might as well release any waiting workers
for (Semaphore semaphore : responseChecker.values()) {
semaphore.release();
}
// Read this for detailed explanation: http://www.ibm.com/developerworks/library/j-jtp05236/
if (wasInterrupted) {
Thread.currentThread().interrupt(); // preserve interrupted status
}
}
} | synchronized void function() { boolean wasInterrupted = false; try { this.process.destroy(); while (true) { try { this.process.waitFor(); return; } catch (InterruptedException ie) { wasInterrupted = true; } } } finally { if (shutdownHook != null) { Runtime.getRuntime().removeShutdownHook(shutdownHook); shutdownHook = null; } if (this.requestSender != null) { this.requestSender.interrupt(); } if (this.responseReceiver != null) { this.responseReceiver.interrupt(); } for (Semaphore semaphore : responseChecker.values()) { semaphore.release(); } if (wasInterrupted) { Thread.currentThread().interrupt(); } } } | /**
* Destroys the worker subprocess. This might block forever if the subprocess refuses to die. It
* is safe to call this multiple times.
*/ | Destroys the worker subprocess. This might block forever if the subprocess refuses to die. It is safe to call this multiple times | destroyProcess | {
"repo_name": "bazelbuild/bazel",
"path": "src/main/java/com/google/devtools/build/lib/worker/WorkerMultiplexer.java",
"license": "apache-2.0",
"size": 18173
} | [
"java.util.concurrent.Semaphore"
] | import java.util.concurrent.Semaphore; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 488,525 |
private Color getFillColor(Object annotationType, boolean temporary) {
return getColor(annotationType, temporary && fIsTemporaryAnnotationDiscolored ? 0.9 : 0.75);
} | Color function(Object annotationType, boolean temporary) { return getColor(annotationType, temporary && fIsTemporaryAnnotationDiscolored ? 0.9 : 0.75); } | /**
* Returns the fill color for the given annotation type and characteristics.
*
* @param annotationType the annotation type
* @param temporary <code>true</code> if for temporary annotations
* @return the fill color
*/ | Returns the fill color for the given annotation type and characteristics | getFillColor | {
"repo_name": "neelance/jface4ruby",
"path": "jface4ruby/src/org/eclipse/jface/text/source/OverviewRuler.java",
"license": "epl-1.0",
"size": 39538
} | [
"org.eclipse.swt.graphics.Color"
] | import org.eclipse.swt.graphics.Color; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 1,284,261 |
public void updateLong(int index,
long x,
boolean forceEncrypt) throws SQLServerException {
if (loggerExternal.isLoggable(java.util.logging.Level.FINER))
loggerExternal.entering(getClassNameLogging(), "updateLong", new Object[] {index, x, forceEncrypt});
checkClosed();
updateValue(index, JDBCType.BIGINT, Long.valueOf(x), JavaType.LONG, forceEncrypt);
loggerExternal.exiting(getClassNameLogging(), "updateLong");
} | void function(int index, long x, boolean forceEncrypt) throws SQLServerException { if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) loggerExternal.entering(getClassNameLogging(), STR, new Object[] {index, x, forceEncrypt}); checkClosed(); updateValue(index, JDBCType.BIGINT, Long.valueOf(x), JavaType.LONG, forceEncrypt); loggerExternal.exiting(getClassNameLogging(), STR); } | /**
* Updates the designated column with a <code>long</code> value. The updater methods are used to update column values in the current row or the
* insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are
* called to update the database.
*
* @param index
* the first column is 1, the second is 2, ...
* @param x
* the new column value
* @param forceEncrypt
* If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
* Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
* encryption on parameters.
* @throws SQLServerException
* when an error occurs
*/ | Updates the designated column with a <code>long</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database | updateLong | {
"repo_name": "v-nisidh/mssql-jdbc",
"path": "src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSet.java",
"license": "mit",
"size": 288041
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 2,630,785 |
public void addKeywordsToDatabase(String[] kws) {
// if keyeord is empty, return
if (null == kws || 0 == kws.length) {
return;
}
// iterate all keywords
for (String kw : kws) {
// check whether keyword already exists
int pos = getKeywordPosition(kw, false);
// no, we have a new keyword. so add it...
if (-1 == pos) {
// check whether we have any empty elements in between where we can insert the keyword
int emptypos = retrieveFirstEmptyElement(keywordFile);
// if we have any empty elements, go on here
if (emptypos != -1) {
try {
// retrieve empty element
Element k = retrieveElement(keywordFile, emptypos);
// set keyword string as new value
k.setText(kw);
// set frequency of occurences to 0
// set timestamp attribute
// set ID attribute
// but first, check the length of "kw", because we want max. 5 first chars of kw
// in keyword id
String kwid;
try {
kwid = kw.substring(0, 5);
} catch (IndexOutOfBoundsException ex) {
kwid = kw;
}
updateKeywordTimestampAndID(k, 0, Tools.getTimeStampWithMilliseconds(), String.valueOf(emptypos) + kwid + Tools.getTimeStampWithMilliseconds());
// change list-up-to-date-state
setKeywordlistUpToDate(false);
// change modified state
setModified(true);
} catch (IllegalNameException | IllegalDataException ex) {
Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
}
} // get the root element of the keyword xml datafile
else {
Element kwFile = keywordFile.getRootElement();
// create a new keyword element
Element newKeyword = new Element(ELEMENT_ENTRY);
// add the new keyword element to the keyword datafile
try {
kwFile.addContent(newKeyword);
// and finally add the parameter (new keyword string) to the recently created
// keyword element
newKeyword.addContent(kw);
// set frequency of occurences to 0
// set timestamp attribute
// set ID attribute
// but first, check the length of "kw", because we want max. 5 first chars of kw
// in keyword id
String kwid;
try {
kwid = kw.substring(0, 5);
} catch (IndexOutOfBoundsException ex) {
kwid = kw;
}
updateKeywordTimestampAndID(newKeyword, 0, Tools.getTimeStampWithMilliseconds(), String.valueOf(keywordFile.getRootElement().getContent().size()) + kwid + Tools.getTimeStampWithMilliseconds());
// change list-up-to-date-state
setKeywordlistUpToDate(false);
// change modified state
setModified(true);
} catch (IllegalAddException e) {
// do nothing here
Constants.zknlogger.log(Level.WARNING, e.getLocalizedMessage());
} catch (IllegalNameException | IllegalDataException ex) {
Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
}
}
}
}
}
/**
* This methods returns the keyword of a given position in the
* <b>keyword-datafile</b>.<br><br>
* <b>Caution!</b> The position {@code pos} is a value from <b>1</b> to
* {@link #getCount(int) getCount(KWCOUNT)} - in contrary to usual array
* handling where the range is from 0 to (size-1).
*
* @param pos a valid position of an element, ranged from 1 to
* {@link #getCount(int) getCount(KWCOUNT)} | void function(String[] kws) { if (null == kws 0 == kws.length) { return; } for (String kw : kws) { int pos = getKeywordPosition(kw, false); if (-1 == pos) { int emptypos = retrieveFirstEmptyElement(keywordFile); if (emptypos != -1) { try { Element k = retrieveElement(keywordFile, emptypos); k.setText(kw); String kwid; try { kwid = kw.substring(0, 5); } catch (IndexOutOfBoundsException ex) { kwid = kw; } updateKeywordTimestampAndID(k, 0, Tools.getTimeStampWithMilliseconds(), String.valueOf(emptypos) + kwid + Tools.getTimeStampWithMilliseconds()); setKeywordlistUpToDate(false); setModified(true); } catch (IllegalNameException IllegalDataException ex) { Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage()); } } else { Element kwFile = keywordFile.getRootElement(); Element newKeyword = new Element(ELEMENT_ENTRY); try { kwFile.addContent(newKeyword); newKeyword.addContent(kw); String kwid; try { kwid = kw.substring(0, 5); } catch (IndexOutOfBoundsException ex) { kwid = kw; } updateKeywordTimestampAndID(newKeyword, 0, Tools.getTimeStampWithMilliseconds(), String.valueOf(keywordFile.getRootElement().getContent().size()) + kwid + Tools.getTimeStampWithMilliseconds()); setKeywordlistUpToDate(false); setModified(true); } catch (IllegalAddException e) { Constants.zknlogger.log(Level.WARNING, e.getLocalizedMessage()); } catch (IllegalNameException IllegalDataException ex) { Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage()); } } } } } /** * This methods returns the keyword of a given position in the * <b>keyword-datafile</b>.<br><br> * <b>Caution!</b> The position {@code pos} is a value from <b>1</b> to * {@link #getCount(int) getCount(KWCOUNT)} - in contrary to usual array * handling where the range is from 0 to (size-1). * * @param pos a valid position of an element, ranged from 1 to * {@link #getCount(int) getCount(KWCOUNT)} | /**
* This method adds several keywords to the keyword xml datafile, without
* assigning them to a certain entry
*
* @param kws the keywords which should be added
*/ | This method adds several keywords to the keyword xml datafile, without assigning them to a certain entry | addKeywordsToDatabase | {
"repo_name": "sjPlot/Zettelkasten",
"path": "src/main/java/de/danielluedecke/zettelkasten/database/Daten.java",
"license": "gpl-3.0",
"size": 336724
} | [
"de.danielluedecke.zettelkasten.util.Constants",
"de.danielluedecke.zettelkasten.util.Tools",
"java.util.logging.Level",
"org.jdom2.Element",
"org.jdom2.IllegalAddException",
"org.jdom2.IllegalDataException",
"org.jdom2.IllegalNameException"
] | import de.danielluedecke.zettelkasten.util.Constants; import de.danielluedecke.zettelkasten.util.Tools; import java.util.logging.Level; import org.jdom2.Element; import org.jdom2.IllegalAddException; import org.jdom2.IllegalDataException; import org.jdom2.IllegalNameException; | import de.danielluedecke.zettelkasten.util.*; import java.util.logging.*; import org.jdom2.*; | [
"de.danielluedecke.zettelkasten",
"java.util",
"org.jdom2"
] | de.danielluedecke.zettelkasten; java.util; org.jdom2; | 181,377 |
protected int getRefreshTokenValiditySeconds(OAuth2Request clientAuth) {
if (clientDetailsService != null) {
ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId());
Integer validity = client.getRefreshTokenValiditySeconds();
if (validity != null) {
return validity;
}
}
return refreshTokenValiditySeconds;
} | int function(OAuth2Request clientAuth) { if (clientDetailsService != null) { ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId()); Integer validity = client.getRefreshTokenValiditySeconds(); if (validity != null) { return validity; } } return refreshTokenValiditySeconds; } | /**
* The refresh token validity period in seconds
*
* @param clientAuth the current authorization request
* @return the refresh token validity period in seconds
*/ | The refresh token validity period in seconds | getRefreshTokenValiditySeconds | {
"repo_name": "spring-projects/spring-security-oauth",
"path": "spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/DefaultTokenServices.java",
"license": "apache-2.0",
"size": 17711
} | [
"org.springframework.security.oauth2.provider.ClientDetails",
"org.springframework.security.oauth2.provider.OAuth2Request"
] | import org.springframework.security.oauth2.provider.ClientDetails; import org.springframework.security.oauth2.provider.OAuth2Request; | import org.springframework.security.oauth2.provider.*; | [
"org.springframework.security"
] | org.springframework.security; | 2,301,988 |
protected void handleResponse(final NextFilter nextFilter,
final IoBuffer buf, int step) throws Exception {
int len = 2;
if (step == SocksProxyConstants.SOCKS5_GREETING_STEP) {
// Send greeting message
byte method = buf.get(1);
if (method == SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) {
throw new IllegalStateException(
"No acceptable authentication method to use with " +
"the socks proxy server");
}
getSession().setAttribute(SELECTED_AUTH_METHOD, method);
} else if (step == SocksProxyConstants.SOCKS5_AUTH_STEP) {
// Authentication to the SOCKS server
byte method = ((Byte) getSession().getAttribute(
Socks5LogicHandler.SELECTED_AUTH_METHOD)).byteValue();
if (method == SocksProxyConstants.GSSAPI_AUTH) {
int oldPos = buf.position();
if (buf.get(0) != 0x01) {
throw new IllegalStateException("Authentication failed");
}
if (buf.get(1) == 0xFF) {
throw new IllegalStateException(
"Authentication failed: GSS API Security Context Failure");
}
if (buf.remaining() >= 2) {
byte[] size = new byte[2];
buf.get(size);
int s = ByteUtilities.makeIntFromByte2(size);
if (buf.remaining() >= s) {
byte[] token = new byte[s];
buf.get(token);
getSession().setAttribute(GSS_TOKEN, token);
len = 0;
} else {
//buf.position(oldPos);
return;
}
} else {
buf.position(oldPos);
return;
}
} else if (buf.get(1) != SocksProxyConstants.V5_REPLY_SUCCEEDED) {
throw new IllegalStateException("Authentication failed");
}
} else if (step == SocksProxyConstants.SOCKS5_REQUEST_STEP) {
// Send the request
byte addressType = buf.get(3);
len = 6;
if (addressType == SocksProxyConstants.IPV6_ADDRESS_TYPE) {
len += 16;
} else if (addressType == SocksProxyConstants.IPV4_ADDRESS_TYPE) {
len += 4;
} else if (addressType == SocksProxyConstants.DOMAIN_NAME_ADDRESS_TYPE) {
len += 1 + (buf.get(4));
} else {
throw new IllegalStateException("Unknwon address type");
}
if (buf.remaining() >= len) {
// handle response
byte status = buf.get(1);
LOGGER.debug(" response status: {}", SocksProxyConstants
.getReplyCodeAsString(status));
if (status == SocksProxyConstants.V5_REPLY_SUCCEEDED) {
buf.position(buf.position() + len);
setHandshakeComplete();
return;
}
throw new Exception("Proxy handshake failed - Code: 0x"
+ ByteUtilities.asHex(new byte[] { status }));
}
return;
}
if (len > 0) {
buf.position(buf.position() + len);
}
// Move to the handshaking next step if not in the middle of
// the authentication process
boolean isAuthenticating = false;
if (step == SocksProxyConstants.SOCKS5_AUTH_STEP) {
byte method = ((Byte) getSession().getAttribute(
Socks5LogicHandler.SELECTED_AUTH_METHOD)).byteValue();
if (method == SocksProxyConstants.GSSAPI_AUTH) {
GSSContext ctx = (GSSContext) getSession().getAttribute(
GSS_CONTEXT);
if (ctx == null || !ctx.isEstablished()) {
isAuthenticating = true;
}
}
}
if (!isAuthenticating) {
getSession().setAttribute(HANDSHAKE_STEP, ++step);
}
doHandshake(nextFilter);
} | void function(final NextFilter nextFilter, final IoBuffer buf, int step) throws Exception { int len = 2; if (step == SocksProxyConstants.SOCKS5_GREETING_STEP) { byte method = buf.get(1); if (method == SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) { throw new IllegalStateException( STR + STR); } getSession().setAttribute(SELECTED_AUTH_METHOD, method); } else if (step == SocksProxyConstants.SOCKS5_AUTH_STEP) { byte method = ((Byte) getSession().getAttribute( Socks5LogicHandler.SELECTED_AUTH_METHOD)).byteValue(); if (method == SocksProxyConstants.GSSAPI_AUTH) { int oldPos = buf.position(); if (buf.get(0) != 0x01) { throw new IllegalStateException(STR); } if (buf.get(1) == 0xFF) { throw new IllegalStateException( STR); } if (buf.remaining() >= 2) { byte[] size = new byte[2]; buf.get(size); int s = ByteUtilities.makeIntFromByte2(size); if (buf.remaining() >= s) { byte[] token = new byte[s]; buf.get(token); getSession().setAttribute(GSS_TOKEN, token); len = 0; } else { return; } } else { buf.position(oldPos); return; } } else if (buf.get(1) != SocksProxyConstants.V5_REPLY_SUCCEEDED) { throw new IllegalStateException(STR); } } else if (step == SocksProxyConstants.SOCKS5_REQUEST_STEP) { byte addressType = buf.get(3); len = 6; if (addressType == SocksProxyConstants.IPV6_ADDRESS_TYPE) { len += 16; } else if (addressType == SocksProxyConstants.IPV4_ADDRESS_TYPE) { len += 4; } else if (addressType == SocksProxyConstants.DOMAIN_NAME_ADDRESS_TYPE) { len += 1 + (buf.get(4)); } else { throw new IllegalStateException(STR); } if (buf.remaining() >= len) { byte status = buf.get(1); LOGGER.debug(STR, SocksProxyConstants .getReplyCodeAsString(status)); if (status == SocksProxyConstants.V5_REPLY_SUCCEEDED) { buf.position(buf.position() + len); setHandshakeComplete(); return; } throw new Exception(STR + ByteUtilities.asHex(new byte[] { status })); } return; } if (len > 0) { buf.position(buf.position() + len); } boolean isAuthenticating = false; if (step == SocksProxyConstants.SOCKS5_AUTH_STEP) { byte method = ((Byte) getSession().getAttribute( Socks5LogicHandler.SELECTED_AUTH_METHOD)).byteValue(); if (method == SocksProxyConstants.GSSAPI_AUTH) { GSSContext ctx = (GSSContext) getSession().getAttribute( GSS_CONTEXT); if (ctx == null !ctx.isEstablished()) { isAuthenticating = true; } } } if (!isAuthenticating) { getSession().setAttribute(HANDSHAKE_STEP, ++step); } doHandshake(nextFilter); } | /**
* Handle a SOCKS v5 response from the proxy server.
*
* @param nextFilter the next filter
* @param buf the buffered data received
* @param step the current step in the authentication process
*/ | Handle a SOCKS v5 response from the proxy server | handleResponse | {
"repo_name": "krismcqueen/gateway",
"path": "mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java",
"license": "apache-2.0",
"size": 18046
} | [
"org.apache.mina.core.buffer.IoBuffer",
"org.apache.mina.core.filterchain.IoFilter",
"org.apache.mina.proxy.utils.ByteUtilities",
"org.ietf.jgss.GSSContext"
] | import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.filterchain.IoFilter; import org.apache.mina.proxy.utils.ByteUtilities; import org.ietf.jgss.GSSContext; | import org.apache.mina.core.buffer.*; import org.apache.mina.core.filterchain.*; import org.apache.mina.proxy.utils.*; import org.ietf.jgss.*; | [
"org.apache.mina",
"org.ietf.jgss"
] | org.apache.mina; org.ietf.jgss; | 1,462,108 |
public ServiceCall putNonResourceAsync(Sku sku, final ServiceCallback<Sku> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
} | ServiceCall function(Sku sku, final ServiceCallback<Sku> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException(STR); } | /**
* Long running put request with non resource.
*
* @param sku sku to put
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link ServiceCall} object
*/ | Long running put request with non resource | putNonResourceAsync | {
"repo_name": "sharadagarwal/autorest",
"path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperationsImpl.java",
"license": "mit",
"size": 315973
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,700,799 |
void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) {
MenuManager menuMgr= new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(menuListener);
Menu menu= menuMgr.createContextMenu(getControl());
getControl().setMenu(menu);
viewSite.registerContextMenu(popupId, menuMgr, this);
} | void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) { MenuManager menuMgr= new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(menuListener); Menu menu= menuMgr.createContextMenu(getControl()); getControl().setMenu(menu); viewSite.registerContextMenu(popupId, menuMgr, this); } | /**
* Attaches a contextmenu listener to the tree
*/ | Attaches a contextmenu listener to the tree | initContextMenu | {
"repo_name": "boniatillo-com/PhaserEditor",
"path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/callhierarchy/LocationViewer.java",
"license": "epl-1.0",
"size": 4635
} | [
"org.eclipse.jface.action.IMenuListener",
"org.eclipse.jface.action.MenuManager",
"org.eclipse.swt.widgets.Menu",
"org.eclipse.ui.IWorkbenchPartSite"
] | import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.MenuManager; import org.eclipse.swt.widgets.Menu; import org.eclipse.ui.IWorkbenchPartSite; | import org.eclipse.jface.action.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.*; | [
"org.eclipse.jface",
"org.eclipse.swt",
"org.eclipse.ui"
] | org.eclipse.jface; org.eclipse.swt; org.eclipse.ui; | 101,015 |
@Test
public void testRequestNewWorkers() throws Exception {
new Context() {{
startResourceManager();
// allocate a worker
when(rmServices.workerStore.newTaskID()).thenReturn(task1).thenThrow(new AssertionFailedError());
rmServices.slotManagerStarted.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
CompletableFuture<Void> allocateResourceFuture = resourceManager.callAsync(
() -> {
rmServices.rmActions.allocateResource(resourceProfile1);
return null;
},
timeout);
// check for exceptions
allocateResourceFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
// verify that a new worker was persisted, the internal state was updated, the task router was notified,
// and the launch coordinator was asked to launch a task
MesosWorkerStore.Worker expected = MesosWorkerStore.Worker.newWorker(task1, resourceProfile1);
verify(rmServices.workerStore, Mockito.timeout(timeout.toMilliseconds())).putWorker(expected);
assertThat(resourceManager.workersInNew, hasEntry(extractResourceID(task1), expected));
resourceManager.taskRouter.expectMsgClass(TaskMonitor.TaskGoalStateUpdated.class);
resourceManager.launchCoordinator.expectMsgClass(LaunchCoordinator.Launch.class);
}};
} | void function() throws Exception { new Context() {{ startResourceManager(); when(rmServices.workerStore.newTaskID()).thenReturn(task1).thenThrow(new AssertionFailedError()); rmServices.slotManagerStarted.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); CompletableFuture<Void> allocateResourceFuture = resourceManager.callAsync( () -> { rmServices.rmActions.allocateResource(resourceProfile1); return null; }, timeout); allocateResourceFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); MesosWorkerStore.Worker expected = MesosWorkerStore.Worker.newWorker(task1, resourceProfile1); verify(rmServices.workerStore, Mockito.timeout(timeout.toMilliseconds())).putWorker(expected); assertThat(resourceManager.workersInNew, hasEntry(extractResourceID(task1), expected)); resourceManager.taskRouter.expectMsgClass(TaskMonitor.TaskGoalStateUpdated.class); resourceManager.launchCoordinator.expectMsgClass(LaunchCoordinator.Launch.class); }}; } | /**
* Test request for new workers.
*/ | Test request for new workers | testRequestNewWorkers | {
"repo_name": "mylog00/flink",
"path": "flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/MesosResourceManagerTest.java",
"license": "apache-2.0",
"size": 33027
} | [
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.TimeUnit",
"junit.framework.AssertionFailedError",
"org.apache.flink.mesos.runtime.clusterframework.store.MesosWorkerStore",
"org.apache.flink.mesos.scheduler.LaunchCoordinator",
"org.apache.flink.mesos.scheduler.TaskMonitor",
"org.hamcrest.Matchers",
"org.junit.Assert",
"org.mockito.Mockito"
] | import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import junit.framework.AssertionFailedError; import org.apache.flink.mesos.runtime.clusterframework.store.MesosWorkerStore; import org.apache.flink.mesos.scheduler.LaunchCoordinator; import org.apache.flink.mesos.scheduler.TaskMonitor; import org.hamcrest.Matchers; import org.junit.Assert; import org.mockito.Mockito; | import java.util.concurrent.*; import junit.framework.*; import org.apache.flink.mesos.runtime.clusterframework.store.*; import org.apache.flink.mesos.scheduler.*; import org.hamcrest.*; import org.junit.*; import org.mockito.*; | [
"java.util",
"junit.framework",
"org.apache.flink",
"org.hamcrest",
"org.junit",
"org.mockito"
] | java.util; junit.framework; org.apache.flink; org.hamcrest; org.junit; org.mockito; | 1,686,912 |
public okhttp3.Call readClusterRoleAsync(
String name, String pretty, final ApiCallback<V1ClusterRole> _callback) throws ApiException {
okhttp3.Call localVarCall = readClusterRoleValidateBeforeCall(name, pretty, _callback);
Type localVarReturnType = new TypeToken<V1ClusterRole>() {}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
} | okhttp3.Call function( String name, String pretty, final ApiCallback<V1ClusterRole> _callback) throws ApiException { okhttp3.Call localVarCall = readClusterRoleValidateBeforeCall(name, pretty, _callback); Type localVarReturnType = new TypeToken<V1ClusterRole>() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } | /**
* (asynchronously) read the specified ClusterRole
*
* @param name name of the ClusterRole (required)
* @param pretty If 'true', then the output is pretty printed. (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
* <table summary="Response Details" border="1">
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
* </table>
*/ | (asynchronously) read the specified ClusterRole | readClusterRoleAsync | {
"repo_name": "kubernetes-client/java",
"path": "kubernetes/src/main/java/io/kubernetes/client/openapi/apis/RbacAuthorizationV1Api.java",
"license": "apache-2.0",
"size": 563123
} | [
"com.google.gson.reflect.TypeToken",
"io.kubernetes.client.openapi.ApiCallback",
"io.kubernetes.client.openapi.ApiException",
"io.kubernetes.client.openapi.models.V1ClusterRole",
"java.lang.reflect.Type"
] | import com.google.gson.reflect.TypeToken; import io.kubernetes.client.openapi.ApiCallback; import io.kubernetes.client.openapi.ApiException; import io.kubernetes.client.openapi.models.V1ClusterRole; import java.lang.reflect.Type; | import com.google.gson.reflect.*; import io.kubernetes.client.openapi.*; import io.kubernetes.client.openapi.models.*; import java.lang.reflect.*; | [
"com.google.gson",
"io.kubernetes.client",
"java.lang"
] | com.google.gson; io.kubernetes.client; java.lang; | 2,509,511 |
Map<String, Collection<String>> toMap(); | Map<String, Collection<String>> toMap(); | /**
* Converts to a {@link Map}.
*
* @return
*/ | Converts to a <code>Map</code> | toMap | {
"repo_name": "wildfly-security-incubator/keycloak",
"path": "server-spi/src/main/java/org/keycloak/authorization/attribute/Attributes.java",
"license": "apache-2.0",
"size": 4475
} | [
"java.util.Collection",
"java.util.Map"
] | import java.util.Collection; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,739,704 |
public void setQty (BigDecimal Qty)
{
super.setQty (Qty);
} // setQty
| void function (BigDecimal Qty) { super.setQty (Qty); } | /**
* Set Allocation Qty (e.g. free products)
* @param Qty
*/ | Set Allocation Qty (e.g. free products) | setQty | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.business/src/main/java-legacy/org/compiere/model/MLandedCostAllocation.java",
"license": "gpl-2.0",
"size": 4725
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 1,649,580 |
protected void delay(long delay, Exchange exchange) throws InterruptedException {
// only run is we are started
if (!isRunAllowed()) {
return;
}
if (delay < 0) {
return;
} else {
try {
// keep track on delayer counter while we sleep
delayedCount.incrementAndGet();
sleep(delay);
} catch (InterruptedException e) {
handleSleepInterruptedException(e, exchange);
} finally {
delayedCount.decrementAndGet();
}
}
} | void function(long delay, Exchange exchange) throws InterruptedException { if (!isRunAllowed()) { return; } if (delay < 0) { return; } else { try { delayedCount.incrementAndGet(); sleep(delay); } catch (InterruptedException e) { handleSleepInterruptedException(e, exchange); } finally { delayedCount.decrementAndGet(); } } } | /**
* Delays the given time before continuing.
* <p/>
* This implementation will block while waiting
*
* @param delay the delay time in millis
* @param exchange the exchange being processed
*/ | Delays the given time before continuing. This implementation will block while waiting | delay | {
"repo_name": "punkhorn/camel-upstream",
"path": "core/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java",
"license": "apache-2.0",
"size": 10403
} | [
"org.apache.camel.Exchange"
] | import org.apache.camel.Exchange; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,342,140 |
Collection<DataRistorante> getToBeImported(int maxResults); | Collection<DataRistorante> getToBeImported(int maxResults); | /**
* Return restaurants to be imported randomly
*
* @param maxResults the max number of results, 0 for unlimited
* @return Collection<DataRistorante>
*/ | Return restaurants to be imported randomly | getToBeImported | {
"repo_name": "alessandro-vincelli/youeat",
"path": "src/main/java/it/av/youeat/service/DataRistoranteService.java",
"license": "apache-2.0",
"size": 3800
} | [
"it.av.youeat.ocm.model.DataRistorante",
"java.util.Collection"
] | import it.av.youeat.ocm.model.DataRistorante; import java.util.Collection; | import it.av.youeat.ocm.model.*; import java.util.*; | [
"it.av.youeat",
"java.util"
] | it.av.youeat; java.util; | 302,318 |
default Map<String, RecoveryStateFactory> getRecoveryStateFactories() {
return Collections.emptyMap();
} | default Map<String, RecoveryStateFactory> getRecoveryStateFactories() { return Collections.emptyMap(); } | /**
* The {@link RecoveryStateFactory} mappings for this plugin. When an index is created the recovery type setting
* {@link org.elasticsearch.index.IndexModule#INDEX_RECOVERY_TYPE_SETTING} on the index will be examined and either use the default
* or looked up among all the recovery state factories from {@link IndexStorePlugin} plugins.
*
* @return a map from recovery type to an recovery state factory
*/ | The <code>RecoveryStateFactory</code> mappings for this plugin. When an index is created the recovery type setting <code>org.elasticsearch.index.IndexModule#INDEX_RECOVERY_TYPE_SETTING</code> on the index will be examined and either use the default or looked up among all the recovery state factories from <code>IndexStorePlugin</code> plugins | getRecoveryStateFactories | {
"repo_name": "GlenRSmith/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/plugins/IndexStorePlugin.java",
"license": "apache-2.0",
"size": 6396
} | [
"java.util.Collections",
"java.util.Map"
] | import java.util.Collections; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 860,868 |
private void truncateTable(TTruncateParams params, TDdlExecResponse resp)
throws ImpalaException {
synchronized (metastoreDdlLock_) {
TTableName tblName = params.getTable_name();
try {
Table table = getExistingTable(tblName.getDb_name(), tblName.getTable_name());
Preconditions.checkNotNull(table);
if (!(table instanceof HdfsTable)) {
throw new CatalogException(
String.format("TRUNCATE TABLE not supported on non-HDFS table: %s",
table.getFullName()));
}
HdfsTable hdfsTable = (HdfsTable)table;
for (HdfsPartition part: hdfsTable.getPartitions()) {
if (part.isDefaultPartition()) continue;
FileSystemUtil.deleteAllVisibleFiles(new Path(part.getLocation()));
}
dropColumnStats(table);
dropTableStats(table);
} catch (Exception e) {
String fqName = tblName.db_name + "." + tblName.table_name;
throw new CatalogException(String.format("Failed to truncate table: %s.\n" +
"Table may be in a partially truncated state.", fqName), e);
}
}
// Reload the table to pick up on the now empty directories.
Table refreshedTbl = catalog_.reloadTable(params.getTable_name());
resp.getResult().setUpdated_catalog_object(TableToTCatalogObject(refreshedTbl));
resp.getResult().setVersion(
resp.getResult().getUpdated_catalog_object().getCatalog_version());
} | void function(TTruncateParams params, TDdlExecResponse resp) throws ImpalaException { synchronized (metastoreDdlLock_) { TTableName tblName = params.getTable_name(); try { Table table = getExistingTable(tblName.getDb_name(), tblName.getTable_name()); Preconditions.checkNotNull(table); if (!(table instanceof HdfsTable)) { throw new CatalogException( String.format(STR, table.getFullName())); } HdfsTable hdfsTable = (HdfsTable)table; for (HdfsPartition part: hdfsTable.getPartitions()) { if (part.isDefaultPartition()) continue; FileSystemUtil.deleteAllVisibleFiles(new Path(part.getLocation())); } dropColumnStats(table); dropTableStats(table); } catch (Exception e) { String fqName = tblName.db_name + "." + tblName.table_name; throw new CatalogException(String.format(STR + STR, fqName), e); } } Table refreshedTbl = catalog_.reloadTable(params.getTable_name()); resp.getResult().setUpdated_catalog_object(TableToTCatalogObject(refreshedTbl)); resp.getResult().setVersion( resp.getResult().getUpdated_catalog_object().getCatalog_version()); } | /**
* Truncate a table by deleting all files in its partition directories, and dropping
* all column and table statistics.
* TODO truncate specified partitions.
*/ | Truncate a table by deleting all files in its partition directories, and dropping all column and table statistics. TODO truncate specified partitions | truncateTable | {
"repo_name": "theyaa/Impala",
"path": "fe/src/main/java/com/cloudera/impala/service/CatalogOpExecutor.java",
"license": "apache-2.0",
"size": 116066
} | [
"com.cloudera.impala.catalog.CatalogException",
"com.cloudera.impala.catalog.HdfsPartition",
"com.cloudera.impala.catalog.HdfsTable",
"com.cloudera.impala.catalog.Table",
"com.cloudera.impala.common.FileSystemUtil",
"com.cloudera.impala.common.ImpalaException",
"com.cloudera.impala.thrift.TDdlExecResponse",
"com.cloudera.impala.thrift.TTableName",
"com.cloudera.impala.thrift.TTruncateParams",
"com.google.common.base.Preconditions",
"org.apache.hadoop.fs.Path"
] | import com.cloudera.impala.catalog.CatalogException; import com.cloudera.impala.catalog.HdfsPartition; import com.cloudera.impala.catalog.HdfsTable; import com.cloudera.impala.catalog.Table; import com.cloudera.impala.common.FileSystemUtil; import com.cloudera.impala.common.ImpalaException; import com.cloudera.impala.thrift.TDdlExecResponse; import com.cloudera.impala.thrift.TTableName; import com.cloudera.impala.thrift.TTruncateParams; import com.google.common.base.Preconditions; import org.apache.hadoop.fs.Path; | import com.cloudera.impala.catalog.*; import com.cloudera.impala.common.*; import com.cloudera.impala.thrift.*; import com.google.common.base.*; import org.apache.hadoop.fs.*; | [
"com.cloudera.impala",
"com.google.common",
"org.apache.hadoop"
] | com.cloudera.impala; com.google.common; org.apache.hadoop; | 670,086 |
ExternalTaskQuery lockExpirationBefore(Date lockExpirationDate); | ExternalTaskQuery lockExpirationBefore(Date lockExpirationDate); | /**
* Only select external tasks that have a lock expiring before the given date
*/ | Only select external tasks that have a lock expiring before the given date | lockExpirationBefore | {
"repo_name": "hawky-4s-/camunda-bpm-platform",
"path": "engine/src/main/java/org/camunda/bpm/engine/externaltask/ExternalTaskQuery.java",
"license": "apache-2.0",
"size": 3740
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 783,218 |
public ServiceFuture<P2SVpnGatewayInner> getP2sVpnConnectionHealthAsync(String resourceGroupName, String gatewayName, final ServiceCallback<P2SVpnGatewayInner> serviceCallback) {
return ServiceFuture.fromResponse(getP2sVpnConnectionHealthWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback);
} | ServiceFuture<P2SVpnGatewayInner> function(String resourceGroupName, String gatewayName, final ServiceCallback<P2SVpnGatewayInner> serviceCallback) { return ServiceFuture.fromResponse(getP2sVpnConnectionHealthWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); } | /**
* Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the P2SVpnGateway.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified resource group | getP2sVpnConnectionHealthAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/network/v2019_07_01/implementation/P2sVpnGatewaysInner.java",
"license": "mit",
"size": 105321
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 723,274 |
public Map<String, Map<String, List<String>>> getResourcePermissions() {
if (resourcePermissions == null) {
resourcePermissions = new LinkedHashMap<>();
}
return resourcePermissions;
} | Map<String, Map<String, List<String>>> function() { if (resourcePermissions == null) { resourcePermissions = new LinkedHashMap<>(); } return resourcePermissions; } | /**
* Returns a map of resource permissions.
* @return the permissions map
*/ | Returns a map of resource permissions | getResourcePermissions | {
"repo_name": "Erudika/para",
"path": "para-core/src/main/java/com/erudika/para/core/App.java",
"license": "apache-2.0",
"size": 42818
} | [
"java.util.LinkedHashMap",
"java.util.List",
"java.util.Map"
] | import java.util.LinkedHashMap; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 234,834 |
public void setPatchLevel(final int patchLevel) throws SQLException {
final PatchTable patchTable = this.makePatchTable();
patchTable.lockPatchTable();
patchTable.updatePatchLevel(patchLevel);
AutopatchSupport.log.info("Set the patch level to " + patchLevel);
patchTable.unlockPatchTable();
} | void function(final int patchLevel) throws SQLException { final PatchTable patchTable = this.makePatchTable(); patchTable.lockPatchTable(); patchTable.updatePatchLevel(patchLevel); AutopatchSupport.log.info(STR + patchLevel); patchTable.unlockPatchTable(); } | /**
* Sets the patch level.
*
* @param patchLevel
* the new patch level
* @throws SQLException
* the SQL exception
*/ | Sets the patch level | setPatchLevel | {
"repo_name": "alarulrajan/CodeFest",
"path": "src/com/tacitknowledge/util/migration/jdbc/AutopatchSupport.java",
"license": "gpl-2.0",
"size": 3173
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,461,924 |
protected void initFactoidWeb(Result[] resultsCorp) {
// question analysis
Ontology wordNet = new WordNet();
// - dictionaries for term extraction
QuestionAnalysis.clearDictionaries();
QuestionAnalysis.addDictionary(wordNet);
// - ontologies for term expansion
QuestionAnalysis.clearOntologies();
QuestionAnalysis.addOntology(wordNet);
// query generation
QueryGeneration.clearQueryGenerators();
QueryGeneration.addQueryGenerator(new BagOfWordsG());
QueryGeneration.addQueryGenerator(new BagOfTermsG());
QueryGeneration.addQueryGenerator(new PredicateG());
QueryGeneration.addQueryGenerator(new QuestionInterpretationG());
QueryGeneration.addQueryGenerator(new QuestionReformulationG());
// search
// - knowledge miners for unstructured knowledge sources
Search.clearKnowledgeMiners();
// Search.addKnowledgeMiner(new GoogleKM());
Search.addKnowledgeMiner(new YahooKM());
// - knowledge annotators for (semi-)structured knowledge sources
Search.clearKnowledgeAnnotators();
// answer extraction and selection
// (the filters are applied in this order)
AnswerSelection.clearFilters();
// - answer extraction filters
AnswerSelection.addFilter(new AnswerTypeFilter());
AnswerSelection.addFilter(new AnswerPatternFilter());
AnswerSelection.addFilter(new WebDocumentFetcherFilter());
AnswerSelection.addFilter(new PredicateExtractionFilter());
AnswerSelection.addFilter(new FactoidsFromPredicatesFilter());
AnswerSelection.addFilter(new TruncationFilter());
// - answer selection filters
AnswerSelection.addFilter(new StopwordFilter());
AnswerSelection.addFilter(new QuestionKeywordsFilter());
AnswerSelection.addFilter(new AnswerProjectionFilter(resultsCorp));
AnswerSelection.addFilter(new ScoreNormalizationFilter(NORMALIZER));
AnswerSelection.addFilter(new ScoreCombinationFilter());
AnswerSelection.addFilter(new FactoidSubsetFilter());
AnswerSelection.addFilter(new DuplicateFilter());
AnswerSelection.addFilter(new ScoreSorterFilter());
AnswerSelection.addFilter(new ResultLengthFilter());
}
| void function(Result[] resultsCorp) { Ontology wordNet = new WordNet(); QuestionAnalysis.clearDictionaries(); QuestionAnalysis.addDictionary(wordNet); QuestionAnalysis.clearOntologies(); QuestionAnalysis.addOntology(wordNet); QueryGeneration.clearQueryGenerators(); QueryGeneration.addQueryGenerator(new BagOfWordsG()); QueryGeneration.addQueryGenerator(new BagOfTermsG()); QueryGeneration.addQueryGenerator(new PredicateG()); QueryGeneration.addQueryGenerator(new QuestionInterpretationG()); QueryGeneration.addQueryGenerator(new QuestionReformulationG()); Search.clearKnowledgeMiners(); Search.addKnowledgeMiner(new YahooKM()); Search.clearKnowledgeAnnotators(); AnswerSelection.clearFilters(); AnswerSelection.addFilter(new AnswerTypeFilter()); AnswerSelection.addFilter(new AnswerPatternFilter()); AnswerSelection.addFilter(new WebDocumentFetcherFilter()); AnswerSelection.addFilter(new PredicateExtractionFilter()); AnswerSelection.addFilter(new FactoidsFromPredicatesFilter()); AnswerSelection.addFilter(new TruncationFilter()); AnswerSelection.addFilter(new StopwordFilter()); AnswerSelection.addFilter(new QuestionKeywordsFilter()); AnswerSelection.addFilter(new AnswerProjectionFilter(resultsCorp)); AnswerSelection.addFilter(new ScoreNormalizationFilter(NORMALIZER)); AnswerSelection.addFilter(new ScoreCombinationFilter()); AnswerSelection.addFilter(new FactoidSubsetFilter()); AnswerSelection.addFilter(new DuplicateFilter()); AnswerSelection.addFilter(new ScoreSorterFilter()); AnswerSelection.addFilter(new ResultLengthFilter()); } | /**
* Initializes the pipeline for factoid questions, using the Web as a
* knowledge source.
*
* @param resultsCorp results retrieved from the corpus
*/ | Initializes the pipeline for factoid questions, using the Web as a knowledge source | initFactoidWeb | {
"repo_name": "vishnujayvel/QAGenerator",
"path": "src/info/ephyra/trec/OpenEphyraCorpus.java",
"license": "gpl-3.0",
"size": 10246
} | [
"info.ephyra.answerselection.AnswerSelection",
"info.ephyra.answerselection.filters.AnswerPatternFilter",
"info.ephyra.answerselection.filters.AnswerProjectionFilter",
"info.ephyra.answerselection.filters.AnswerTypeFilter",
"info.ephyra.answerselection.filters.DuplicateFilter",
"info.ephyra.answerselection.filters.FactoidSubsetFilter",
"info.ephyra.answerselection.filters.FactoidsFromPredicatesFilter",
"info.ephyra.answerselection.filters.PredicateExtractionFilter",
"info.ephyra.answerselection.filters.QuestionKeywordsFilter",
"info.ephyra.answerselection.filters.ResultLengthFilter",
"info.ephyra.answerselection.filters.ScoreCombinationFilter",
"info.ephyra.answerselection.filters.ScoreNormalizationFilter",
"info.ephyra.answerselection.filters.ScoreSorterFilter",
"info.ephyra.answerselection.filters.StopwordFilter",
"info.ephyra.answerselection.filters.TruncationFilter",
"info.ephyra.answerselection.filters.WebDocumentFetcherFilter",
"info.ephyra.nlp.semantics.ontologies.Ontology",
"info.ephyra.nlp.semantics.ontologies.WordNet",
"info.ephyra.querygeneration.QueryGeneration",
"info.ephyra.querygeneration.generators.BagOfTermsG",
"info.ephyra.querygeneration.generators.BagOfWordsG",
"info.ephyra.querygeneration.generators.PredicateG",
"info.ephyra.querygeneration.generators.QuestionInterpretationG",
"info.ephyra.querygeneration.generators.QuestionReformulationG",
"info.ephyra.questionanalysis.QuestionAnalysis",
"info.ephyra.search.Result",
"info.ephyra.search.Search",
"info.ephyra.search.searchers.YahooKM"
] | import info.ephyra.answerselection.AnswerSelection; import info.ephyra.answerselection.filters.AnswerPatternFilter; import info.ephyra.answerselection.filters.AnswerProjectionFilter; import info.ephyra.answerselection.filters.AnswerTypeFilter; import info.ephyra.answerselection.filters.DuplicateFilter; import info.ephyra.answerselection.filters.FactoidSubsetFilter; import info.ephyra.answerselection.filters.FactoidsFromPredicatesFilter; import info.ephyra.answerselection.filters.PredicateExtractionFilter; import info.ephyra.answerselection.filters.QuestionKeywordsFilter; import info.ephyra.answerselection.filters.ResultLengthFilter; import info.ephyra.answerselection.filters.ScoreCombinationFilter; import info.ephyra.answerselection.filters.ScoreNormalizationFilter; import info.ephyra.answerselection.filters.ScoreSorterFilter; import info.ephyra.answerselection.filters.StopwordFilter; import info.ephyra.answerselection.filters.TruncationFilter; import info.ephyra.answerselection.filters.WebDocumentFetcherFilter; import info.ephyra.nlp.semantics.ontologies.Ontology; import info.ephyra.nlp.semantics.ontologies.WordNet; import info.ephyra.querygeneration.QueryGeneration; import info.ephyra.querygeneration.generators.BagOfTermsG; import info.ephyra.querygeneration.generators.BagOfWordsG; import info.ephyra.querygeneration.generators.PredicateG; import info.ephyra.querygeneration.generators.QuestionInterpretationG; import info.ephyra.querygeneration.generators.QuestionReformulationG; import info.ephyra.questionanalysis.QuestionAnalysis; import info.ephyra.search.Result; import info.ephyra.search.Search; import info.ephyra.search.searchers.YahooKM; | import info.ephyra.answerselection.*; import info.ephyra.answerselection.filters.*; import info.ephyra.nlp.semantics.ontologies.*; import info.ephyra.querygeneration.*; import info.ephyra.querygeneration.generators.*; import info.ephyra.questionanalysis.*; import info.ephyra.search.*; import info.ephyra.search.searchers.*; | [
"info.ephyra.answerselection",
"info.ephyra.nlp",
"info.ephyra.querygeneration",
"info.ephyra.questionanalysis",
"info.ephyra.search"
] | info.ephyra.answerselection; info.ephyra.nlp; info.ephyra.querygeneration; info.ephyra.questionanalysis; info.ephyra.search; | 2,844,995 |
@Deprecated
void postLockRow(final ObserverContext<RegionCoprocessorEnvironment> ctx,
final byte[] regionName, final byte[] row) throws IOException; | void postLockRow(final ObserverContext<RegionCoprocessorEnvironment> ctx, final byte[] regionName, final byte[] row) throws IOException; | /**
* Called after locking a row.
*
* @param ctx
* @param regionName the region name
* @param row
* @throws IOException Signals that an I/O exception has occurred.
* @deprecated Will be removed in 0.96
*/ | Called after locking a row | postLockRow | {
"repo_name": "zqxjjj/NobidaBase",
"path": "target/hbase-0.94.9/hbase-0.94.9/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java",
"license": "apache-2.0",
"size": 41666
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 904,971 |
@Test
public void testHierarchyOfColocatedChildPRsMissing() throws Exception {
int childPRGenerations = 2;
for (VM vm : toArray(vm0, vm1)) {
vm.invoke(() -> {
createCache();
createDiskStore(diskStoreName1);
createPR_withPersistence(regionName, diskStoreName1, DEFAULT_RECOVERY_DELAY,
DEFAULT_REDUNDANT_COPIES, DEFAULT_STARTUP_RECOVERY_DELAY);
createChildPR_withPersistence(regionName, childRegionName1, diskStoreName1,
DEFAULT_RECOVERY_DELAY, DEFAULT_REDUNDANT_COPIES, DEFAULT_STARTUP_RECOVERY_DELAY);
for (int i = 3; i < childPRGenerations + 2; ++i) {
createChildPR_withPersistence("region" + (i - 1), "region" + i, diskStoreName1,
DEFAULT_RECOVERY_DELAY, DEFAULT_REDUNDANT_COPIES, DEFAULT_STARTUP_RECOVERY_DELAY);
}
});
}
vm0.invoke(() -> {
createData(regionName, "a");
createData(childRegionName1, "b");
createData(childRegionName2, "c");
});
Map<Integer, Set<Integer>> bucketIdsInVM = new HashMap<>();
for (VM vm : toArray(vm0, vm1)) {
bucketIdsInVM.put(vm.getId(), vm.invoke(() -> {
Set<Integer> bucketIds = getBucketIds(regionName);
assertThat(bucketIds).isNotEmpty();
return bucketIds;
}));
}
for (int i = 2; i < childPRGenerations + 2; ++i) {
String childRegionName = "region" + i;
for (VM vm : toArray(vm0, vm1)) {
Set<Integer> bucketIds = bucketIdsInVM.get(vm.getId());
assertThat(vm.invoke(() -> getBucketIds(childRegionName))).isEqualTo(bucketIds);
}
}
// Expected warning logs only on the child region, because without the child there's nothing
// known about the remaining hierarchy
AsyncInvocation<Void> createPRWithMissingChildInVM0 =
vm0.invokeAsync(() -> validateColocationLogger_withMissingChildRegion(childPRGenerations));
AsyncInvocation<Void> createPRWithMissingChildInVM1 =
vm1.invokeAsync(() -> validateColocationLogger_withMissingChildRegion(childPRGenerations));
createPRWithMissingChildInVM0.await();
createPRWithMissingChildInVM1.await();
} | void function() throws Exception { int childPRGenerations = 2; for (VM vm : toArray(vm0, vm1)) { vm.invoke(() -> { createCache(); createDiskStore(diskStoreName1); createPR_withPersistence(regionName, diskStoreName1, DEFAULT_RECOVERY_DELAY, DEFAULT_REDUNDANT_COPIES, DEFAULT_STARTUP_RECOVERY_DELAY); createChildPR_withPersistence(regionName, childRegionName1, diskStoreName1, DEFAULT_RECOVERY_DELAY, DEFAULT_REDUNDANT_COPIES, DEFAULT_STARTUP_RECOVERY_DELAY); for (int i = 3; i < childPRGenerations + 2; ++i) { createChildPR_withPersistence(STR + (i - 1), STR + i, diskStoreName1, DEFAULT_RECOVERY_DELAY, DEFAULT_REDUNDANT_COPIES, DEFAULT_STARTUP_RECOVERY_DELAY); } }); } vm0.invoke(() -> { createData(regionName, "a"); createData(childRegionName1, "b"); createData(childRegionName2, "c"); }); Map<Integer, Set<Integer>> bucketIdsInVM = new HashMap<>(); for (VM vm : toArray(vm0, vm1)) { bucketIdsInVM.put(vm.getId(), vm.invoke(() -> { Set<Integer> bucketIds = getBucketIds(regionName); assertThat(bucketIds).isNotEmpty(); return bucketIds; })); } for (int i = 2; i < childPRGenerations + 2; ++i) { String childRegionName = STR + i; for (VM vm : toArray(vm0, vm1)) { Set<Integer> bucketIds = bucketIdsInVM.get(vm.getId()); assertThat(vm.invoke(() -> getBucketIds(childRegionName))).isEqualTo(bucketIds); } } AsyncInvocation<Void> createPRWithMissingChildInVM0 = vm0.invokeAsync(() -> validateColocationLogger_withMissingChildRegion(childPRGenerations)); AsyncInvocation<Void> createPRWithMissingChildInVM1 = vm1.invokeAsync(() -> validateColocationLogger_withMissingChildRegion(childPRGenerations)); createPRWithMissingChildInVM0.await(); createPRWithMissingChildInVM1.await(); } | /**
* Testing that all missing persistent PRs in a colocation hierarchy are logged as warnings
*/ | Testing that all missing persistent PRs in a colocation hierarchy are logged as warnings | testHierarchyOfColocatedChildPRsMissing | {
"repo_name": "jdeppe-pivotal/geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/internal/cache/partitioned/PersistentColocatedPartitionedRegionDistributedTest.java",
"license": "apache-2.0",
"size": 82266
} | [
"java.util.HashMap",
"java.util.Map",
"java.util.Set",
"org.apache.geode.test.awaitility.GeodeAwaitility",
"org.apache.geode.test.dunit.AsyncInvocation",
"org.apache.geode.test.dunit.VM",
"org.assertj.core.api.Assertions"
] | import java.util.HashMap; import java.util.Map; import java.util.Set; import org.apache.geode.test.awaitility.GeodeAwaitility; import org.apache.geode.test.dunit.AsyncInvocation; import org.apache.geode.test.dunit.VM; import org.assertj.core.api.Assertions; | import java.util.*; import org.apache.geode.test.awaitility.*; import org.apache.geode.test.dunit.*; import org.assertj.core.api.*; | [
"java.util",
"org.apache.geode",
"org.assertj.core"
] | java.util; org.apache.geode; org.assertj.core; | 2,469,659 |
public static String getBundleProperty(final String inKey) {
// without context path set, we try to retrieve the properties file from the bundle
if (cContextPath.isEmpty()) {
try {
final ResourceBundle lBundle = ResourceBundle.getBundle(cSysName);
return lBundle == null ? null : (String) lBundle.getObject(inKey);
} catch (final MissingResourceException exc) {
return null;
}
}
// else, load the properties file from appContext/WEB-INF/conf/
try {
return getVSysProperties().getProperty(inKey);
} catch (final IOException exc) { // NOPMD by lbenno
// intentionally left empty
}
return null;
}
| static String function(final String inKey) { if (cContextPath.isEmpty()) { try { final ResourceBundle lBundle = ResourceBundle.getBundle(cSysName); return lBundle == null ? null : (String) lBundle.getObject(inKey); } catch (final MissingResourceException exc) { return null; } } try { return getVSysProperties().getProperty(inKey); } catch (final IOException exc) { } return null; } | /** <p>
* Convenience method to get the specified key's value from the application's properties possibly without
* initializing the system.
* </p>
* <p>
* This method should only be used in the bundle activation phase.
* </p>
*
* @param inKey String
* @return String the property value */ | Convenience method to get the specified key's value from the application's properties possibly without initializing the system. This method should only be used in the bundle activation phase. | getBundleProperty | {
"repo_name": "aktion-hip/viffw",
"path": "org.hip.viffw/src/org/hip/kernel/sys/VSys.java",
"license": "lgpl-2.1",
"size": 17607
} | [
"java.io.IOException",
"java.util.MissingResourceException",
"java.util.ResourceBundle"
] | import java.io.IOException; import java.util.MissingResourceException; import java.util.ResourceBundle; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,229,441 |
@Override
public Request<ModifySubnetAttributeRequest> getDryRunRequest() {
Request<ModifySubnetAttributeRequest> request = new ModifySubnetAttributeRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
} | Request<ModifySubnetAttributeRequest> function() { Request<ModifySubnetAttributeRequest> request = new ModifySubnetAttributeRequestMarshaller().marshall(this); request.addParameter(STR, Boolean.toString(true)); return request; } | /**
* This method is intended for internal use only. Returns the marshaled request configured with additional
* parameters to enable operation dry-run.
*/ | This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run | getDryRunRequest | {
"repo_name": "dagnir/aws-sdk-java",
"path": "aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifySubnetAttributeRequest.java",
"license": "apache-2.0",
"size": 14983
} | [
"com.amazonaws.Request",
"com.amazonaws.services.ec2.model.transform.ModifySubnetAttributeRequestMarshaller"
] | import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.ModifySubnetAttributeRequestMarshaller; | import com.amazonaws.*; import com.amazonaws.services.ec2.model.transform.*; | [
"com.amazonaws",
"com.amazonaws.services"
] | com.amazonaws; com.amazonaws.services; | 1,045,275 |
public Page beginPage(); | Page function(); | /**
* Positions the questionnaire at the first page containing a question.
*
* @return new current page (first page with a question)
*/ | Positions the questionnaire at the first page containing a question | beginPage | {
"repo_name": "apruden/onyx",
"path": "onyx-modules/quartz/quartz-core/src/main/java/org/obiba/onyx/quartz/core/service/ActiveQuestionnaireAdministrationService.java",
"license": "gpl-3.0",
"size": 11728
} | [
"org.obiba.onyx.quartz.core.engine.questionnaire.question.Page"
] | import org.obiba.onyx.quartz.core.engine.questionnaire.question.Page; | import org.obiba.onyx.quartz.core.engine.questionnaire.question.*; | [
"org.obiba.onyx"
] | org.obiba.onyx; | 488,654 |
public void onItemAdd(final Memorea memorea, final int position) {
mMemoreaList.add(position, memorea);
notifyItemInserted(position);
} | void function(final Memorea memorea, final int position) { mMemoreaList.add(position, memorea); notifyItemInserted(position); } | /**
* Adds a memorea to the memorea list in the position specified
*/ | Adds a memorea to the memorea list in the position specified | onItemAdd | {
"repo_name": "thomasameisel/memorease",
"path": "app/src/main/java/com/tarian/memorease/presenter/MemoreaListAdapter.java",
"license": "apache-2.0",
"size": 10093
} | [
"com.tarian.memorease.model.Memorea"
] | import com.tarian.memorease.model.Memorea; | import com.tarian.memorease.model.*; | [
"com.tarian.memorease"
] | com.tarian.memorease; | 2,280,632 |
public static void putSequentialKeysTaskForInValid() throws Exception {
Set regionVisited = new HashSet();
for (String regionName : regionNames) {
if (!regionVisited.contains(regionName)) {
regionVisited.add(regionName);
Region region = RegionHelper.getRegion(regionName);
Log.getLogWriter()
.info(
"putSequentialKeysTaskForInValid : working on region "
+ regionName);
String key = INVALID_PRIFIX
+ +WANBlackboard.getInstance().getSharedCounters()
.incrementAndRead(WANBlackboard.currentEntry_invalid);
Log.getLogWriter().info("The vm will be operating on the key : " + key);
for (int i = 1; i <= ITERATIONS; i++) {
if (TestConfig.tab().getRandGen().nextBoolean()) {
region.put(key, new Integer(i));
}
else {
Object v = region.replace(key, new Integer(i));
if (v == null) { // force update
region.put(key, new Integer(i));
}
}
}
}
}
} | static void function() throws Exception { Set regionVisited = new HashSet(); for (String regionName : regionNames) { if (!regionVisited.contains(regionName)) { regionVisited.add(regionName); Region region = RegionHelper.getRegion(regionName); Log.getLogWriter() .info( STR + regionName); String key = INVALID_PRIFIX + +WANBlackboard.getInstance().getSharedCounters() .incrementAndRead(WANBlackboard.currentEntry_invalid); Log.getLogWriter().info(STR + key); for (int i = 1; i <= ITERATIONS; i++) { if (TestConfig.tab().getRandGen().nextBoolean()) { region.put(key, new Integer(i)); } else { Object v = region.replace(key, new Integer(i)); if (v == null) { region.put(key, new Integer(i)); } } } } } } | /**
* Same as the putSequentialKeysTask() but with the keys prefixed with
* "invalid"
*/ | Same as the putSequentialKeysTask() but with the keys prefixed with "invalid" | putSequentialKeysTaskForInValid | {
"repo_name": "papicella/snappy-store",
"path": "tests/core/src/main/java/newWan/security/WanSecurity.java",
"license": "apache-2.0",
"size": 26405
} | [
"com.gemstone.gemfire.cache.Region",
"java.util.HashSet",
"java.util.Set"
] | import com.gemstone.gemfire.cache.Region; import java.util.HashSet; import java.util.Set; | import com.gemstone.gemfire.cache.*; import java.util.*; | [
"com.gemstone.gemfire",
"java.util"
] | com.gemstone.gemfire; java.util; | 839,801 |
public Axis getAxis() {
return axis;
} | Axis function() { return axis; } | /**
* Returns the name of the axis this axis expression is populating.
*
* @return axis name
*/ | Returns the name of the axis this axis expression is populating | getAxis | {
"repo_name": "tesluk/olap4j",
"path": "src/org/olap4j/mdx/AxisNode.java",
"license": "apache-2.0",
"size": 5306
} | [
"org.olap4j.Axis"
] | import org.olap4j.Axis; | import org.olap4j.*; | [
"org.olap4j"
] | org.olap4j; | 2,683,244 |
@ServiceMethod(returns = ReturnType.SINGLE)
public SnapshotInner createOrUpdate(String resourceGroupName, String snapshotName, SnapshotInner snapshot) {
return createOrUpdateAsync(resourceGroupName, snapshotName, snapshot).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) SnapshotInner function(String resourceGroupName, String snapshotName, SnapshotInner snapshot) { return createOrUpdateAsync(resourceGroupName, snapshotName, snapshot).block(); } | /**
* Creates or updates a snapshot.
*
* @param resourceGroupName The name of the resource group.
* @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot
* is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80
* characters.
* @param snapshot Snapshot object supplied in the body of the Put disk 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 snapshot resource.
*/ | Creates or updates a snapshot | createOrUpdate | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/SnapshotsClientImpl.java",
"license": "mit",
"size": 112349
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.compute.fluent.models.SnapshotInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.compute.fluent.models.SnapshotInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.compute.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,566,548 |
public String makeResponseCtx(ResponseCtx resCtx) {
ByteArrayOutputStream response = new ByteArrayOutputStream();
resCtx.encode(response, new Indenter());
return new String(response.toByteArray());
} | String function(ResponseCtx resCtx) { ByteArrayOutputStream response = new ByteArrayOutputStream(); resCtx.encode(response, new Indenter()); return new String(response.toByteArray()); } | /**
* Converst a ResponseCtx object to its string representation.
*
* @param resCtx
* the ResponseCtx object
* @return the String representation of the ResponseCtx object
*/ | Converst a ResponseCtx object to its string representation | makeResponseCtx | {
"repo_name": "FLVC/fcrepo-src-3.4.2",
"path": "fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/util/ContextUtil.java",
"license": "apache-2.0",
"size": 19487
} | [
"com.sun.xacml.Indenter",
"com.sun.xacml.ctx.ResponseCtx",
"java.io.ByteArrayOutputStream"
] | import com.sun.xacml.Indenter; import com.sun.xacml.ctx.ResponseCtx; import java.io.ByteArrayOutputStream; | import com.sun.xacml.*; import com.sun.xacml.ctx.*; import java.io.*; | [
"com.sun.xacml",
"java.io"
] | com.sun.xacml; java.io; | 2,478,606 |
ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request); | ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request); | /**
* A search scroll request to continue searching a previous scrollable search request.
*
* @param request The search scroll request
* @return The result future
* @see Requests#searchScrollRequest(String)
*/ | A search scroll request to continue searching a previous scrollable search request | searchScroll | {
"repo_name": "strapdata/elassandra",
"path": "server/src/main/java/org/elasticsearch/client/Client.java",
"license": "apache-2.0",
"size": 17621
} | [
"org.elasticsearch.action.ActionFuture",
"org.elasticsearch.action.search.SearchResponse",
"org.elasticsearch.action.search.SearchScrollRequest"
] | import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchScrollRequest; | import org.elasticsearch.action.*; import org.elasticsearch.action.search.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 2,588,053 |
public void decrement(int numBytes) {
if (this.mNumBytes >= numBytes && this.mCount > 0) {
this.mCount--;
this.mNumBytes -= numBytes;
} else {
FLog.wtf(
TAG,
"Unexpected decrement of %d. Current numBytes = %d, count = %d",
numBytes,
this.mNumBytes,
this.mCount);
}
} | void function(int numBytes) { if (this.mNumBytes >= numBytes && this.mCount > 0) { this.mCount--; this.mNumBytes -= numBytes; } else { FLog.wtf( TAG, STR, numBytes, this.mNumBytes, this.mCount); } } | /**
* 'Decrement' an item from the counter
* @param numBytes size of the item in bytes
*/ | 'Decrement' an item from the counter | decrement | {
"repo_name": "amitshekhariitbhu/fresco",
"path": "imagepipeline/src/main/java/com/facebook/imagepipeline/memory/BasePool.java",
"license": "bsd-3-clause",
"size": 28644
} | [
"com.facebook.common.logging.FLog"
] | import com.facebook.common.logging.FLog; | import com.facebook.common.logging.*; | [
"com.facebook.common"
] | com.facebook.common; | 2,765,592 |
public BigInteger getCommitment(){
// Q
return BigIntegerUtils.multiplyBaseExponents(G.getP(), bases, randomExponents);
}
| BigInteger function(){ return BigIntegerUtils.multiplyBaseExponents(G.getP(), bases, randomExponents); } | /**
* Get the commitment value
* @return the commitment value
*/ | Get the commitment value | getCommitment | {
"repo_name": "twyburton/MCompProject",
"path": "java/PKProject/src/uk/ac/ncl/burton/twy/ZKPoK/components/PKComponentProver.java",
"license": "mit",
"size": 5785
} | [
"java.math.BigInteger",
"uk.ac.ncl.burton.twy.ZKPoK"
] | import java.math.BigInteger; import uk.ac.ncl.burton.twy.ZKPoK; | import java.math.*; import uk.ac.ncl.burton.twy.*; | [
"java.math",
"uk.ac.ncl"
] | java.math; uk.ac.ncl; | 971,547 |
public SocketConnection getConnection() {
return connection;
}
| SocketConnection function() { return connection; } | /**
* Returns the connection to the server.
*
* @return the connection to the server.
*/ | Returns the connection to the server | getConnection | {
"repo_name": "onlychoice/ws-xmpp-proxy",
"path": "src/java/org/jivesoftware/multiplexer/ConnectionWorkerThread.java",
"license": "gpl-2.0",
"size": 21281
} | [
"org.jivesoftware.multiplexer.net.SocketConnection"
] | import org.jivesoftware.multiplexer.net.SocketConnection; | import org.jivesoftware.multiplexer.net.*; | [
"org.jivesoftware.multiplexer"
] | org.jivesoftware.multiplexer; | 1,746,322 |
public AssetStatusDTO findDefaultStatusForItem(int itemId) {
Query query = getSession().getNamedQuery("AssetStatusDTO.findDefaultStatusForItem");
query.setParameter("item_id", itemId);
return (AssetStatusDTO) query.uniqueResult();
} | AssetStatusDTO function(int itemId) { Query query = getSession().getNamedQuery(STR); query.setParameter(STR, itemId); return (AssetStatusDTO) query.uniqueResult(); } | /**
* Find the default status for the ItemTypeDTO (which allows asset management) linked to the item.
*
* @param itemId ItemDTO id
* @return
*/ | Find the default status for the ItemTypeDTO (which allows asset management) linked to the item | findDefaultStatusForItem | {
"repo_name": "WebDataConsulting/billing",
"path": "src/java/com/sapienter/jbilling/server/item/db/AssetStatusDAS.java",
"license": "agpl-3.0",
"size": 2203
} | [
"org.hibernate.Query"
] | import org.hibernate.Query; | import org.hibernate.*; | [
"org.hibernate"
] | org.hibernate; | 372,497 |
protected List<Order> getOrderList(CriteriaBuilder cb, Root<T> root) {
logger.log(Level.FINEST, "Order list not overridden by subclass. Order will not be specified.");
return null;
}
| List<Order> function(CriteriaBuilder cb, Root<T> root) { logger.log(Level.FINEST, STR); return null; } | /**
* Method that can be overriden by the subclasses to determine the default ordering when using retrieveAll and
* retrieveSome methods. The default implementation returns null, establishing no order.
*
* @param cb
* The criteria builder object, needed to build queries.
* @param root
* The root of the query, meta-object that represents the class of objects beind queried.
*
* @return A list of Order objects
* @see javax.persistence.criteria.Order
*/ | Method that can be overriden by the subclasses to determine the default ordering when using retrieveAll and retrieveSome methods. The default implementation returns null, establishing no order | getOrderList | {
"repo_name": "manzoli2122/Vip",
"path": "src/br/ufes/inf/nemo/jbutler/ejb/persistence/BaseJPADAO.java",
"license": "apache-2.0",
"size": 32771
} | [
"java.util.List",
"java.util.logging.Level",
"javax.persistence.criteria.CriteriaBuilder",
"javax.persistence.criteria.Order",
"javax.persistence.criteria.Root"
] | import java.util.List; import java.util.logging.Level; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.Order; import javax.persistence.criteria.Root; | import java.util.*; import java.util.logging.*; import javax.persistence.criteria.*; | [
"java.util",
"javax.persistence"
] | java.util; javax.persistence; | 908,368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.