method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@VisibleForTesting public static boolean start(final Context context, final Bundle serviceBundle, final Bundle connectionBundle, final LaunchCallback launchCallback, final IBinder childProcessCallback, final boolean inSandbox, final boolean alwaysInForeground, final ChildProcessCreationParams creationParams) { assert LauncherThread.runningOnLauncherThread(); try { TraceEvent.begin("ChildProcessLauncher.start"); ChildProcessConnection.StartCallback startCallback = new ChildProcessConnection.StartCallback() { @Override public void onChildStarted() {}
static boolean function(final Context context, final Bundle serviceBundle, final Bundle connectionBundle, final LaunchCallback launchCallback, final IBinder childProcessCallback, final boolean inSandbox, final boolean alwaysInForeground, final ChildProcessCreationParams creationParams) { assert LauncherThread.runningOnLauncherThread(); try { TraceEvent.begin(STR); ChildProcessConnection.StartCallback startCallback = new ChildProcessConnection.StartCallback() { public void onChildStarted() {}
/** * Spawns and connects to a child process. It will not block, but will instead callback to * {@link #LaunchCallback} on the launcher thread when the connection is established on. * * @param context Context used to obtain the application context. * @param paramId Key used to retrieve ChildProcessCreationParams. * @param serviceBundle The Bundle passed in the intent used to bind to the service. * @param connectionBundle The Bundle passed in setupConnection call. * @param launchCallback Callback invoked when the connection is established. * @param childProcessCallback IBinder callback passed to the service. */
Spawns and connects to a child process. It will not block, but will instead callback to <code>#LaunchCallback</code> on the launcher thread when the connection is established on
start
{ "repo_name": "mogoweb/365browser", "path": "app/src/main/java/org/chromium/content/browser/ChildProcessLauncher.java", "license": "apache-2.0", "size": 24243 }
[ "android.content.Context", "android.os.Bundle", "android.os.IBinder", "org.chromium.base.TraceEvent", "org.chromium.base.process_launcher.ChildProcessCreationParams" ]
import android.content.Context; import android.os.Bundle; import android.os.IBinder; import org.chromium.base.TraceEvent; import org.chromium.base.process_launcher.ChildProcessCreationParams;
import android.content.*; import android.os.*; import org.chromium.base.*; import org.chromium.base.process_launcher.*;
[ "android.content", "android.os", "org.chromium.base" ]
android.content; android.os; org.chromium.base;
1,146,373
public IWizardPage getNextPage() { saveDataToModel(); PageAlgorithms page = ((NewEncryptionWizard) getWizard()).getPageAlgorithms(); page.onEnterPage(); return page; }
IWizardPage function() { saveDataToModel(); PageAlgorithms page = ((NewEncryptionWizard) getWizard()).getPageAlgorithms(); page.onEnterPage(); return page; }
/** * Returns the next wizard page after all the necessary data is entered correctly. * * @return IWizardPage The next wizard page */
Returns the next wizard page after all the necessary data is entered correctly
getNextPage
{ "repo_name": "jcryptool/incubator", "path": "org.jcryptool.crypto.xml.ui/src/org/jcryptool/crypto/xml/ui/encrypt/PageKey.java", "license": "epl-1.0", "size": 9419 }
[ "org.eclipse.jface.wizard.IWizardPage" ]
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
2,660,910
SortedMap<ValidationRule, String> getInvalidValidationRuleLeftSideExpressions();
SortedMap<ValidationRule, String> getInvalidValidationRuleLeftSideExpressions();
/** * Gets all ValidationRules with invalid left side expressions. */
Gets all ValidationRules with invalid left side expressions
getInvalidValidationRuleLeftSideExpressions
{ "repo_name": "uonafya/jphes-core", "path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java", "license": "bsd-3-clause", "size": 7902 }
[ "java.util.SortedMap", "org.hisp.dhis.validation.ValidationRule" ]
import java.util.SortedMap; import org.hisp.dhis.validation.ValidationRule;
import java.util.*; import org.hisp.dhis.validation.*;
[ "java.util", "org.hisp.dhis" ]
java.util; org.hisp.dhis;
1,510,364
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { if (par6EntityPlayer.capabilities.isCreativeMode) { par5 |= 8; par1World.setBlockMetadataWithNotify(par2, par3, par4, par5, 4); } dropBlockAsItem(par1World, par2, par3, par4, par5, 0); super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer); }
void function(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { if (par6EntityPlayer.capabilities.isCreativeMode) { par5 = 8; par1World.setBlockMetadataWithNotify(par2, par3, par4, par5, 4); } dropBlockAsItem(par1World, par2, par3, par4, par5, 0); super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer); }
/** * Called when the block is attempted to be harvested */
Called when the block is attempted to be harvested
onBlockHarvested
{ "repo_name": "HATB0T/RuneCraftery", "path": "forge/mcp/src/minecraft/net/minecraft/block/BlockSkull.java", "license": "lgpl-3.0", "size": 13885 }
[ "net.minecraft.entity.player.EntityPlayer", "net.minecraft.world.World" ]
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World;
import net.minecraft.entity.player.*; import net.minecraft.world.*;
[ "net.minecraft.entity", "net.minecraft.world" ]
net.minecraft.entity; net.minecraft.world;
1,061,983
@Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { RemoveInfo info = (RemoveInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut); }
void function(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { RemoveInfo info = (RemoveInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut); }
/** * Write the booleans that this object uses to a BooleanStream */
Write the booleans that this object uses to a BooleanStream
looseMarshal
{ "repo_name": "tabish121/OpenWire", "path": "openwire-legacy/src/main/java/io/openwire/codec/v2/RemoveInfoMarshaller.java", "license": "apache-2.0", "size": 4038 }
[ "io.openwire.codec.OpenWireFormat", "io.openwire.commands.RemoveInfo", "java.io.DataOutput", "java.io.IOException" ]
import io.openwire.codec.OpenWireFormat; import io.openwire.commands.RemoveInfo; import java.io.DataOutput; import java.io.IOException;
import io.openwire.codec.*; import io.openwire.commands.*; import java.io.*;
[ "io.openwire.codec", "io.openwire.commands", "java.io" ]
io.openwire.codec; io.openwire.commands; java.io;
1,731,929
Field originatingView = mode.getClass().getDeclaredField("mOriginatingView"); originatingView.setAccessible(true); return (View) originatingView.get(mode); } private ViewUtil() { }
Field originatingView = mode.getClass().getDeclaredField(STR); originatingView.setAccessible(true); return (View) originatingView.get(mode); } private ViewUtil() { }
/** * Find the originating view of an ActionMode. * @param mode The ActionMode in question. * @return The view from which the ActionMode originated. * @throws NoSuchFieldException * @throws IllegalAccessException */
Find the originating view of an ActionMode
getOriginatingView
{ "repo_name": "Wikinaut/wikipedia-app", "path": "app/src/main/java/org/wikipedia/util/ViewUtil.java", "license": "apache-2.0", "size": 736 }
[ "android.view.View", "java.lang.reflect.Field" ]
import android.view.View; import java.lang.reflect.Field;
import android.view.*; import java.lang.reflect.*;
[ "android.view", "java.lang" ]
android.view; java.lang;
1,094,840
@Override public String processReturningText(final String s, final HttpAction hm) { return processAllReturningText(s); }
String function(final String s, final HttpAction hm) { return processAllReturningText(s); }
/** * Deals with the MediaWiki API's response by parsing the provided text. * * @param s the answer to the most recently generated MediaWiki API request * @param hm the requestor message * @return the returning text on processing problems */
Deals with the MediaWiki API's response by parsing the provided text
processReturningText
{ "repo_name": "Hunsu/jwbf", "path": "src/main/java/net/sourceforge/jwbf/mediawiki/actions/util/MWAction.java", "license": "apache-2.0", "size": 3245 }
[ "net.sourceforge.jwbf.core.actions.util.HttpAction" ]
import net.sourceforge.jwbf.core.actions.util.HttpAction;
import net.sourceforge.jwbf.core.actions.util.*;
[ "net.sourceforge.jwbf" ]
net.sourceforge.jwbf;
707,110
@WebMethod(operationName = "GetWeather", action = "http://www.webserviceX.NET/GetWeather") @WebResult(name = "GetWeatherResult", targetNamespace = "http://www.webserviceX.NET") @RequestWrapper(localName = "GetWeather", targetNamespace = "http://www.webserviceX.NET", className = "net.webservicex.GetWeather") @ResponseWrapper(localName = "GetWeatherResponse", targetNamespace = "http://www.webserviceX.NET", className = "net.webservicex.GetWeatherResponse") public String getWeather( @WebParam(name = "CityName", targetNamespace = "http://www.webserviceX.NET") String cityName, @WebParam(name = "CountryName", targetNamespace = "http://www.webserviceX.NET") String countryName);
@WebMethod(operationName = STR, action = STRGetWeatherResultSTRhttp: @RequestWrapper(localName = STR, targetNamespace = STRGetWeatherResponseSTRhttp: String function( @WebParam(name = "CityNameSTRhttp: String cityName, @WebParam(name = "CountryNameSTRhttp: String countryName);
/** * Get weather report for all major cities around the world. * * @param countryName * @param cityName * @return * returns java.lang.String */
Get weather report for all major cities around the world
getWeather
{ "repo_name": "crisstanza/GlobalWeather", "path": "src/main/java.wsimport/net/webservicex/GlobalWeatherSoap.java", "license": "unlicense", "size": 2309 }
[ "javax.jws.WebMethod", "javax.jws.WebParam", "javax.xml.ws.RequestWrapper" ]
import javax.jws.WebMethod; import javax.jws.WebParam; import javax.xml.ws.RequestWrapper;
import javax.jws.*; import javax.xml.ws.*;
[ "javax.jws", "javax.xml" ]
javax.jws; javax.xml;
784,213
protected String ensureId(Element element) { String id = element.getId(); if ((id == null) || "".equals(id)) { id = Document.get().createUniqueId(); element.setId(id); } return id; }
String function(Element element) { String id = element.getId(); if ((id == null) "".equals(id)) { id = Document.get().createUniqueId(); element.setId(id); } return id; }
/** * Gives an element an id if it doesn't already have an id, and then returns the element's id.<p> * * @param element the element for which we want to add the id * * @return the id */
Gives an element an id if it doesn't already have an id, and then returns the element's id
ensureId
{ "repo_name": "mediaworx/opencms-core", "path": "src-gwt/org/opencms/acacia/client/widgets/CmsTinyMCEWidget.java", "license": "lgpl-2.1", "size": 26076 }
[ "com.google.gwt.dom.client.Document", "com.google.gwt.dom.client.Element" ]
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.*;
[ "com.google.gwt" ]
com.google.gwt;
485,062
public static boolean doesPluginRequireRestart(final Plugin plugin) { //PLUG-451: When in dev mode, plugins should not require a restart. if (Boolean.getBoolean(ATLASSIAN_DEV_MODE)) { return false; } for (final ModuleDescriptor<?> descriptor : plugin.getModuleDescriptors()) { if (descriptor.getClass().getAnnotation(RequiresRestart.class) != null) { return true; } } return false; }
static boolean function(final Plugin plugin) { if (Boolean.getBoolean(ATLASSIAN_DEV_MODE)) { return false; } for (final ModuleDescriptor<?> descriptor : plugin.getModuleDescriptors()) { if (descriptor.getClass().getAnnotation(RequiresRestart.class) != null) { return true; } } return false; }
/** * Determines if a plugin requires a restart after being installed at runtime. Looks for the annotation * {@link RequiresRestart} on the plugin's module descriptors. * * @param plugin The plugin that was just installed at runtime, but not yet enabled * @return True if a restart is required * @since 2.1 */
Determines if a plugin requires a restart after being installed at runtime. Looks for the annotation <code>RequiresRestart</code> on the plugin's module descriptors
doesPluginRequireRestart
{ "repo_name": "mrdon/PLUG", "path": "atlassian-plugins-core/src/main/java/com/atlassian/plugin/util/PluginUtils.java", "license": "bsd-3-clause", "size": 4280 }
[ "com.atlassian.plugin.ModuleDescriptor", "com.atlassian.plugin.Plugin", "com.atlassian.plugin.descriptors.RequiresRestart" ]
import com.atlassian.plugin.ModuleDescriptor; import com.atlassian.plugin.Plugin; import com.atlassian.plugin.descriptors.RequiresRestart;
import com.atlassian.plugin.*; import com.atlassian.plugin.descriptors.*;
[ "com.atlassian.plugin" ]
com.atlassian.plugin;
707,359
public static final void waitForAcmeToCreateCertificate(LibertyServer server) { assertNotNull("ACME did not fetch the certificate.", server.waitForStringInLog("CWPKI2064I", 120000)); assertNotNull("ACME did not create the certificate.", server.waitForStringInLogUsingMark("CWPKI2007I", 120000)); }
static final void function(LibertyServer server) { assertNotNull(STR, server.waitForStringInLog(STR, 120000)); assertNotNull(STR, server.waitForStringInLogUsingMark(STR, 120000)); }
/** * Wait for the ACME service to report that a new certificate has been * created. * * @param server * The server to check. */
Wait for the ACME service to report that a new certificate has been created
waitForAcmeToCreateCertificate
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/utils/AcmeFatUtils.java", "license": "epl-1.0", "size": 36960 }
[ "junit.framework.Assert" ]
import junit.framework.Assert;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
2,559,187
void rmidx(String command) throws QueryException { List args = new ArrayList(); parseCommand(command, args); if (args.size() < 1) { System.out.println("rmidx requires 1 arg: name"); return; } String name = (String)args.get(1); QueryService qs = this.cache.getQueryService(); Index index = qs.getIndex(this.currRegion, name); if (index == null) { String s = "There is no index named \"" + name + "\" in region " + this.currRegion.getFullPath(); System.err.println(s); } else { qs.removeIndex(index); } }
void rmidx(String command) throws QueryException { List args = new ArrayList(); parseCommand(command, args); if (args.size() < 1) { System.out.println(STR); return; } String name = (String)args.get(1); QueryService qs = this.cache.getQueryService(); Index index = qs.getIndex(this.currRegion, name); if (index == null) { String s = STRSTR\STR + this.currRegion.getFullPath(); System.err.println(s); } else { qs.removeIndex(index); } }
/** * Removes an index. * Argument is type */
Removes an index. Argument is type
rmidx
{ "repo_name": "papicella/snappy-store", "path": "gemfire-examples/src/dist/java/cacheRunner/CacheRunner.java", "license": "apache-2.0", "size": 58690 }
[ "com.gemstone.gemfire.cache.query.Index", "com.gemstone.gemfire.cache.query.QueryException", "com.gemstone.gemfire.cache.query.QueryService", "java.util.ArrayList", "java.util.List" ]
import com.gemstone.gemfire.cache.query.Index; import com.gemstone.gemfire.cache.query.QueryException; import com.gemstone.gemfire.cache.query.QueryService; import java.util.ArrayList; import java.util.List;
import com.gemstone.gemfire.cache.query.*; import java.util.*;
[ "com.gemstone.gemfire", "java.util" ]
com.gemstone.gemfire; java.util;
1,936,478
public void validate() throws ParameterException { // Check if files exists if (problemFilePath == null || solutionFilePath == null) { throw new ParameterException("Files cannot have null value."); } File problemFile = new File(problemFilePath); File solutionFile = new File(problemFilePath); try { if (!problemFile.isFile()) { throw new ParameterException("The problem file cannot be found" + "."); } if (!solutionFile.isFile()) { throw new ParameterException("The solution file cannot be found" + "."); } } catch (SecurityException e) { throw new ParameterException("The problem file or solution file" + "cannot be accessed."); } }
void function() throws ParameterException { if (problemFilePath == null solutionFilePath == null) { throw new ParameterException(STR); } File problemFile = new File(problemFilePath); File solutionFile = new File(problemFilePath); try { if (!problemFile.isFile()) { throw new ParameterException(STR + "."); } if (!solutionFile.isFile()) { throw new ParameterException(STR + "."); } } catch (SecurityException e) { throw new ParameterException(STR + STR); } }
/** * Validates the parameters and throw an exception if one of the * parameter is not valid. * * @throws ParameterException if a parameter value is not valid. */
Validates the parameters and throw an exception if one of the parameter is not valid
validate
{ "repo_name": "dmeignan/INRC2010-UOS-evaluator", "path": "fr.lalea.inrc2010evaluator/src/main/java/fr/lalea/inrc2010evaluator/EvaluatorParameters.java", "license": "apache-2.0", "size": 2213 }
[ "com.beust.jcommander.ParameterException", "java.io.File" ]
import com.beust.jcommander.ParameterException; import java.io.File;
import com.beust.jcommander.*; import java.io.*;
[ "com.beust.jcommander", "java.io" ]
com.beust.jcommander; java.io;
464,275
Date getLastChange();
Date getLastChange();
/** * Returns the last change date of this report. * * @return the last change date of this report, or <tt>null</tt> if it was * never changed */
Returns the last change date of this report
getLastChange
{ "repo_name": "BellaDati/belladati-sdk-api", "path": "src/main/java/com/belladati/sdk/report/Report.java", "license": "apache-2.0", "size": 2652 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
958,598
Pair<ReturnResult, TransferData> changeHandler(RevisionKey key, boolean clear);
Pair<ReturnResult, TransferData> changeHandler(RevisionKey key, boolean clear);
/** * Changes revision handler if revision can be found and there is a need to change the handler. * @param key RevisionKey to find the revision * @param clear Should handler be cleared or set to current user * @return Pair */
Changes revision handler if revision can be found and there is a need to change the handler
changeHandler
{ "repo_name": "Tietoarkisto/metka", "path": "metka/src/main/java/fi/uta/fsd/metka/storage/repository/RevisionHandlerRepository.java", "license": "bsd-3-clause", "size": 3651 }
[ "fi.uta.fsd.metka.model.general.RevisionKey", "fi.uta.fsd.metka.model.transfer.TransferData", "fi.uta.fsd.metka.storage.repository.enums.ReturnResult", "org.apache.commons.lang3.tuple.Pair" ]
import fi.uta.fsd.metka.model.general.RevisionKey; import fi.uta.fsd.metka.model.transfer.TransferData; import fi.uta.fsd.metka.storage.repository.enums.ReturnResult; import org.apache.commons.lang3.tuple.Pair;
import fi.uta.fsd.metka.model.general.*; import fi.uta.fsd.metka.model.transfer.*; import fi.uta.fsd.metka.storage.repository.enums.*; import org.apache.commons.lang3.tuple.*;
[ "fi.uta.fsd", "org.apache.commons" ]
fi.uta.fsd; org.apache.commons;
2,027,236
public void testReport() throws Exception { generateReport( "summary", "summary-plugin-config.xml" ); assertTrue( "Test html generated", getGeneratedReport( "project-summary.html" ).exists() ); URL reportURL = getGeneratedReport( "project-summary.html" ).toURI().toURL(); assertNotNull( reportURL ); // HTTPUnit WebRequest request = new GetMethodWebRequest( reportURL.toString() ); WebResponse response = WEB_CONVERSATION.getResponse( request ); // Basic HTML tests assertTrue( response.isHTML() ); assertTrue( response.getContentLength() > 0 ); // Test the Page title String expectedTitle = prepareTitle( getString( "report.summary.name" ), getString( "report.summary.title" ) ); assertEquals( expectedTitle, response.getTitle() ); // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); assertEquals( getString( "report.summary.title" ), textBlocks[0].getText() ); assertEquals( getString( "report.summary.general.title" ), textBlocks[1].getText() ); assertEquals( getString( "report.summary.organization.title" ), textBlocks[2].getText() ); assertEquals( getString( "report.summary.noorganization" ), textBlocks[3].getText() ); assertEquals( getString( "report.summary.build.title" ), textBlocks[4].getText() ); }
void function() throws Exception { generateReport( STR, STR ); assertTrue( STR, getGeneratedReport( STR ).exists() ); URL reportURL = getGeneratedReport( STR ).toURI().toURL(); assertNotNull( reportURL ); WebRequest request = new GetMethodWebRequest( reportURL.toString() ); WebResponse response = WEB_CONVERSATION.getResponse( request ); assertTrue( response.isHTML() ); assertTrue( response.getContentLength() > 0 ); String expectedTitle = prepareTitle( getString( STR ), getString( STR ) ); assertEquals( expectedTitle, response.getTitle() ); TextBlock[] textBlocks = response.getTextBlocks(); assertEquals( getString( STR ), textBlocks[0].getText() ); assertEquals( getString( STR ), textBlocks[1].getText() ); assertEquals( getString( STR ), textBlocks[2].getText() ); assertEquals( getString( STR ), textBlocks[3].getText() ); assertEquals( getString( STR ), textBlocks[4].getText() ); }
/** * Test report * * @throws Exception if any */
Test report
testReport
{ "repo_name": "mcculls/maven-plugins", "path": "maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/SummaryReportTest.java", "license": "apache-2.0", "size": 2934 }
[ "com.meterware.httpunit.GetMethodWebRequest", "com.meterware.httpunit.TextBlock", "com.meterware.httpunit.WebRequest", "com.meterware.httpunit.WebResponse" ]
import com.meterware.httpunit.GetMethodWebRequest; import com.meterware.httpunit.TextBlock; import com.meterware.httpunit.WebRequest; import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.*;
[ "com.meterware.httpunit" ]
com.meterware.httpunit;
1,970,152
public static ParseResult parseFileForSkylark( ParserInputSource input, EventHandler eventHandler) { Lexer lexer = new Lexer(input, eventHandler); Parser parser = new Parser(lexer, eventHandler, SKYLARK); List<Statement> statements = parser.parseFileInput(); return new ParseResult( statements, parser.comments, locationFromStatements(lexer, statements), parser.errorsCount > 0 || lexer.containsErrors()); }
static ParseResult function( ParserInputSource input, EventHandler eventHandler) { Lexer lexer = new Lexer(input, eventHandler); Parser parser = new Parser(lexer, eventHandler, SKYLARK); List<Statement> statements = parser.parseFileInput(); return new ParseResult( statements, parser.comments, locationFromStatements(lexer, statements), parser.errorsCount > 0 lexer.containsErrors()); }
/** * Entry-point to parser that parses a build file with comments. All errors encountered during * parsing are reported via "reporter". Enable Skylark extensions that are not part of the core * BUILD language. */
Entry-point to parser that parses a build file with comments. All errors encountered during parsing are reported via "reporter". Enable Skylark extensions that are not part of the core BUILD language
parseFileForSkylark
{ "repo_name": "iamthearm/bazel", "path": "src/main/java/com/google/devtools/build/lib/syntax/Parser.java", "license": "apache-2.0", "size": 53785 }
[ "com.google.devtools.build.lib.events.EventHandler", "java.util.List" ]
import com.google.devtools.build.lib.events.EventHandler; import java.util.List;
import com.google.devtools.build.lib.events.*; import java.util.*;
[ "com.google.devtools", "java.util" ]
com.google.devtools; java.util;
1,945,529
public InputStream getInputStream(ZipEntry entry) throws IOException { if(descriptor == -1) { throw new IllegalStateException(); } byte[] buf = inflateEntryImpl2(descriptor, entry.getName()); if (buf == null) { return null; } return new ByteArrayInputStream(buf); }
InputStream function(ZipEntry entry) throws IOException { if(descriptor == -1) { throw new IllegalStateException(); } byte[] buf = inflateEntryImpl2(descriptor, entry.getName()); if (buf == null) { return null; } return new ByteArrayInputStream(buf); }
/** * Answers an input stream on the data of the specified ZipEntry. * * @param entry * the ZipEntry * @return an input stream on the ZipEntry data */
Answers an input stream on the data of the specified ZipEntry
getInputStream
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java", "license": "apache-2.0", "size": 6653 }
[ "java.io.ByteArrayInputStream", "java.io.IOException", "java.io.InputStream" ]
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
81,443
public ModelAndView display(HttpServletRequest request, HttpServletResponse response) throws Exception { String logFileName = request.getParameter(PARAM_LOG_FILE); String contents = logFileManager.tail(logFileName, tailBytes); Map<String, Object> model = new HashMap<String, Object>(); model.put("contents", contents); // task id will only be set if we activate this controller from the task runs view Long taskId = RequestUtils.getLongValue(request, Constants.PARAM_TASK_ID, false); model.put("taskId", taskId); model.put(Constants.PARAM_SELECTED_GROUP_NAME, request.getParameter(Constants.PARAM_SELECTED_GROUP_NAME)); return new ModelAndView("log_display", model); }
ModelAndView function(HttpServletRequest request, HttpServletResponse response) throws Exception { String logFileName = request.getParameter(PARAM_LOG_FILE); String contents = logFileManager.tail(logFileName, tailBytes); Map<String, Object> model = new HashMap<String, Object>(); model.put(STR, contents); Long taskId = RequestUtils.getLongValue(request, Constants.PARAM_TASK_ID, false); model.put(STR, taskId); model.put(Constants.PARAM_SELECTED_GROUP_NAME, request.getParameter(Constants.PARAM_SELECTED_GROUP_NAME)); return new ModelAndView(STR, model); }
/** * Displays the contents of a particular log file. * * @param request * @param response * @return A ModelAndView to render. * @throws Exception */
Displays the contents of a particular log file
display
{ "repo_name": "titantang/citrine-scheduler", "path": "src/main/java/fm/last/citrine/web/DisplayLogsController.java", "license": "apache-2.0", "size": 2870 }
[ "java.util.HashMap", "java.util.Map", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.springframework.web.servlet.ModelAndView" ]
import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView;
import java.util.*; import javax.servlet.http.*; import org.springframework.web.servlet.*;
[ "java.util", "javax.servlet", "org.springframework.web" ]
java.util; javax.servlet; org.springframework.web;
2,410,591
private void repositionComponent(){ valueLabel.setBounds( this.getWidth()-margin-valueLabel.getPreferredSize().width-1, header, valueLabel.getPreferredSize().width+1, 10); slider.setBounds( margin, header+10, this.getWidth()-2*margin, 20); leftLabel.setBounds( margin, header+30, leftLabel.getPreferredSize().width+1, 10); rightLabel.setBounds( this.getWidth()-margin-rightLabel.getPreferredSize().width-1, header+30, rightLabel.getPreferredSize().width+1, 10); this.revalidate(); } public void componentHidden(ComponentEvent e){}
void function(){ valueLabel.setBounds( this.getWidth()-margin-valueLabel.getPreferredSize().width-1, header, valueLabel.getPreferredSize().width+1, 10); slider.setBounds( margin, header+10, this.getWidth()-2*margin, 20); leftLabel.setBounds( margin, header+30, leftLabel.getPreferredSize().width+1, 10); rightLabel.setBounds( this.getWidth()-margin-rightLabel.getPreferredSize().width-1, header+30, rightLabel.getPreferredSize().width+1, 10); this.revalidate(); } public void componentHidden(ComponentEvent e){}
/** * Repositions the components of this widget. Should be called * whenever clients invoke an internal method that changes the * bounding strings of the text fields or size of this widget */
Repositions the components of this widget. Should be called whenever clients invoke an internal method that changes the bounding strings of the text fields or size of this widget
repositionComponent
{ "repo_name": "boubre/BayouBot", "path": "Workspace/src/codeblockutil/CSliderPane.java", "license": "mit", "size": 14880 }
[ "java.awt.event.ComponentEvent" ]
import java.awt.event.ComponentEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,352,904
@Test public void testPutWithTsSlop() throws IOException { byte[] fam = Bytes.toBytes("info"); byte[][] families = { fam }; String method = this.getName(); // add data with a timestamp that is too recent for range. Ensure assert CONF.setInt("hbase.hregion.keyvalue.timestamp.slop.millisecs", 1000); this.region = initHRegion(tableName, method, CONF, families); boolean caughtExcep = false; try { try { // no TS specified == use latest. should not error region.put(new Put(row).add(fam, Bytes.toBytes("qual"), Bytes.toBytes("value"))); // TS out of range. should error region.put(new Put(row).add(fam, Bytes.toBytes("qual"), System.currentTimeMillis() + 2000, Bytes.toBytes("value"))); fail("Expected IOE for TS out of configured timerange"); } catch (FailedSanityCheckException ioe) { LOG.debug("Received expected exception", ioe); caughtExcep = true; } assertTrue("Should catch FailedSanityCheckException", caughtExcep); } finally { HBaseTestingUtility.closeRegionAndWAL(this.region); this.region = null; } }
void function() throws IOException { byte[] fam = Bytes.toBytes("info"); byte[][] families = { fam }; String method = this.getName(); CONF.setInt(STR, 1000); this.region = initHRegion(tableName, method, CONF, families); boolean caughtExcep = false; try { try { region.put(new Put(row).add(fam, Bytes.toBytes("qual"), Bytes.toBytes("value"))); region.put(new Put(row).add(fam, Bytes.toBytes("qual"), System.currentTimeMillis() + 2000, Bytes.toBytes("value"))); fail(STR); } catch (FailedSanityCheckException ioe) { LOG.debug(STR, ioe); caughtExcep = true; } assertTrue(STR, caughtExcep); } finally { HBaseTestingUtility.closeRegionAndWAL(this.region); this.region = null; } }
/** * Tests that there is server-side filtering for invalid timestamp upper * bound. Note that the timestamp lower bound is automatically handled for us * by the TTL field. */
Tests that there is server-side filtering for invalid timestamp upper bound. Note that the timestamp lower bound is automatically handled for us by the TTL field
testPutWithTsSlop
{ "repo_name": "justintung/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java", "license": "apache-2.0", "size": 221371 }
[ "java.io.IOException", "org.apache.hadoop.hbase.HBaseTestingUtility", "org.apache.hadoop.hbase.client.Put", "org.apache.hadoop.hbase.exceptions.FailedSanityCheckException", "org.apache.hadoop.hbase.util.Bytes", "org.junit.Assert" ]
import java.io.IOException; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.exceptions.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
95,024
public static void createSuperTenantDLC() throws AndesException { CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext(); try { String adminUserName = carbonContext.getUserRealm().getRealmConfiguration().getAdminUserName(); DLCQueueUtils.createDLCQueue(carbonContext.getTenantDomain(), adminUserName); } catch (UserStoreException e) { throw new AndesException("Error getting super tenant username", e); } }
static void function() throws AndesException { CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext(); try { String adminUserName = carbonContext.getUserRealm().getRealmConfiguration().getAdminUserName(); DLCQueueUtils.createDLCQueue(carbonContext.getTenantDomain(), adminUserName); } catch (UserStoreException e) { throw new AndesException(STR, e); } }
/** * Create a DEAD_LETTER_CHANNEL for the super tenant. */
Create a DEAD_LETTER_CHANNEL for the super tenant
createSuperTenantDLC
{ "repo_name": "ramith/andes", "path": "modules/andes-core/broker/src/main/java/org/wso2/andes/kernel/AndesKernelBoot.java", "license": "apache-2.0", "size": 26611 }
[ "org.wso2.andes.server.queue.DLCQueueUtils", "org.wso2.carbon.context.CarbonContext", "org.wso2.carbon.user.api.UserStoreException" ]
import org.wso2.andes.server.queue.DLCQueueUtils; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.andes.server.queue.*; import org.wso2.carbon.context.*; import org.wso2.carbon.user.api.*;
[ "org.wso2.andes", "org.wso2.carbon" ]
org.wso2.andes; org.wso2.carbon;
555,653
public BigDecimal getBOMQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_BOMQty); if (bd == null) return Env.ZERO; return bd; }
BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_BOMQty); if (bd == null) return Env.ZERO; return bd; }
/** Get BOM Quantity. @return Bill of Materials Quantity */
Get BOM Quantity
getBOMQty
{ "repo_name": "TaymourReda/-https-github.com-adempiere-adempiere", "path": "base/src/org/compiere/model/X_M_Product_BOM.java", "license": "gpl-2.0", "size": 10174 }
[ "java.math.BigDecimal", "org.compiere.util.Env" ]
import java.math.BigDecimal; import org.compiere.util.Env;
import java.math.*; import org.compiere.util.*;
[ "java.math", "org.compiere.util" ]
java.math; org.compiere.util;
2,809,375
@Test public void testEquals() throws Exception { Set<Object> set = new HashSet<>(); List<VtnFlowFilter> list = new ArrayList<>(); VtnDropFilterCase drop = new VtnDropFilterCaseBuilder(). setVtnDropFilter(new VtnDropFilterBuilder().build()). build(); VnodeName vcond1 = new VnodeName("cond_1"); VnodeName vcond2 = new VnodeName("cond_2"); VtnFlowFilter vff = new VtnFlowFilterBuilder(). setIndex(1). setCondition(vcond1). setVtnFlowFilterType(drop). build(); list.add(vff); vff = new VtnFlowFilterBuilder(). setIndex(12345). setCondition(vcond2). setVtnFlowFilterType(drop). build(); list.add(vff); VtnPassFilterCase pass = new VtnPassFilterCaseBuilder(). setVtnPassFilter(new VtnPassFilterBuilder().build()). build(); vff = new VtnFlowFilterBuilder(). setIndex(99). setCondition(vcond1). setVtnFlowFilterType(pass). build(); list.add(vff); vff = new VtnFlowFilterBuilder(). setIndex(9384). setCondition(vcond2). setVtnFlowFilterType(pass). build(); list.add(vff); RedirectDestination rdest = new RedirectDestinationBuilder(). setBridgeName("vbr1").setInterfaceName("if1").build(); VtnRedirectFilterCase redirect = new VtnRedirectFilterCaseBuilder(). setVtnRedirectFilter(new VtnRedirectFilterBuilder(). setRedirectDestination(rdest). setOutput(true).build()). build(); vff = new VtnFlowFilterBuilder(). setIndex(65535). setCondition(vcond1). setVtnFlowFilterType(redirect). build(); list.add(vff); rdest = new RedirectDestinationBuilder(). setTerminalName("vtm1").setInterfaceName("if2").build(); redirect = new VtnRedirectFilterCaseBuilder(). setVtnRedirectFilter(new VtnRedirectFilterBuilder(). setRedirectDestination(rdest). setOutput(false).build()). build(); vff = new VtnFlowFilterBuilder(). setIndex(123). setCondition(vcond2). setVtnFlowFilterType(redirect). build(); list.add(vff); List<VtnFlowFilter> vfilters = new ArrayList<>(); for (VtnFlowFilter vf: list) { vfilters.add(vf); VtnFlowFilterList vflist = mock(VtnFlowFilterList.class); when(vflist.getVtnFlowFilter()).thenReturn(vfilters); FlowFilterList ffl1 = FlowFilterList.create(vflist, true); FlowFilterList ffl2 = FlowFilterList.create(vflist, true); testEquals(set, ffl1, ffl2); } FlowFilterList ffl1 = FlowFilterList.create(null, false); FlowFilterList ffl2 = FlowFilterList.create(null, false); testEquals(set, ffl1, ffl2); assertEquals(list.size() + 1, set.size()); }
void function() throws Exception { Set<Object> set = new HashSet<>(); List<VtnFlowFilter> list = new ArrayList<>(); VtnDropFilterCase drop = new VtnDropFilterCaseBuilder(). setVtnDropFilter(new VtnDropFilterBuilder().build()). build(); VnodeName vcond1 = new VnodeName(STR); VnodeName vcond2 = new VnodeName(STR); VtnFlowFilter vff = new VtnFlowFilterBuilder(). setIndex(1). setCondition(vcond1). setVtnFlowFilterType(drop). build(); list.add(vff); vff = new VtnFlowFilterBuilder(). setIndex(12345). setCondition(vcond2). setVtnFlowFilterType(drop). build(); list.add(vff); VtnPassFilterCase pass = new VtnPassFilterCaseBuilder(). setVtnPassFilter(new VtnPassFilterBuilder().build()). build(); vff = new VtnFlowFilterBuilder(). setIndex(99). setCondition(vcond1). setVtnFlowFilterType(pass). build(); list.add(vff); vff = new VtnFlowFilterBuilder(). setIndex(9384). setCondition(vcond2). setVtnFlowFilterType(pass). build(); list.add(vff); RedirectDestination rdest = new RedirectDestinationBuilder(). setBridgeName("vbr1").setInterfaceName("if1").build(); VtnRedirectFilterCase redirect = new VtnRedirectFilterCaseBuilder(). setVtnRedirectFilter(new VtnRedirectFilterBuilder(). setRedirectDestination(rdest). setOutput(true).build()). build(); vff = new VtnFlowFilterBuilder(). setIndex(65535). setCondition(vcond1). setVtnFlowFilterType(redirect). build(); list.add(vff); rdest = new RedirectDestinationBuilder(). setTerminalName("vtm1").setInterfaceName("if2").build(); redirect = new VtnRedirectFilterCaseBuilder(). setVtnRedirectFilter(new VtnRedirectFilterBuilder(). setRedirectDestination(rdest). setOutput(false).build()). build(); vff = new VtnFlowFilterBuilder(). setIndex(123). setCondition(vcond2). setVtnFlowFilterType(redirect). build(); list.add(vff); List<VtnFlowFilter> vfilters = new ArrayList<>(); for (VtnFlowFilter vf: list) { vfilters.add(vf); VtnFlowFilterList vflist = mock(VtnFlowFilterList.class); when(vflist.getVtnFlowFilter()).thenReturn(vfilters); FlowFilterList ffl1 = FlowFilterList.create(vflist, true); FlowFilterList ffl2 = FlowFilterList.create(vflist, true); testEquals(set, ffl1, ffl2); } FlowFilterList ffl1 = FlowFilterList.create(null, false); FlowFilterList ffl2 = FlowFilterList.create(null, false); testEquals(set, ffl1, ffl2); assertEquals(list.size() + 1, set.size()); }
/** * Test case for {@link FlowFilterList#equals(Object)} and * {@link FlowFilterList#hashCode()}. * * @throws Exception An error occurred. */
Test case for <code>FlowFilterList#equals(Object)</code> and <code>FlowFilterList#hashCode()</code>
testEquals
{ "repo_name": "opendaylight/vtn", "path": "manager/implementation/src/test/java/org/opendaylight/vtn/manager/internal/util/flow/filter/FlowFilterListTest.java", "license": "epl-1.0", "size": 28790 }
[ "java.util.ArrayList", "java.util.HashSet", "java.util.List", "java.util.Set", "org.mockito.Mockito", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.VtnFlowFilterList", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.list.VtnFlowFilter", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.list.VtnFlowFilterBuilder", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnDropFilterCase", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnDropFilterCaseBuilder", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnPassFilterCase", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnPassFilterCaseBuilder", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnRedirectFilterCase", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnRedirectFilterCaseBuilder", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.drop.filter._case.VtnDropFilterBuilder", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.pass.filter._case.VtnPassFilterBuilder", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.redirect.filter._case.VtnRedirectFilterBuilder", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.redirect.filter.config.RedirectDestination", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.redirect.filter.config.RedirectDestinationBuilder", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.VnodeName" ]
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.mockito.Mockito; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.VtnFlowFilterList; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.list.VtnFlowFilter; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.list.VtnFlowFilterBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnDropFilterCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnDropFilterCaseBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnPassFilterCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnPassFilterCaseBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnRedirectFilterCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.VtnRedirectFilterCaseBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.drop.filter._case.VtnDropFilterBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.pass.filter._case.VtnPassFilterBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.redirect.filter._case.VtnRedirectFilterBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.redirect.filter.config.RedirectDestination; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.redirect.filter.config.RedirectDestinationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.VnodeName;
import java.util.*; import org.mockito.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.list.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.drop.filter._case.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.pass.filter._case.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.flow.filter.type.fields.vtn.flow.filter.type.vtn.redirect.filter._case.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.filter.rev150907.vtn.redirect.filter.config.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.*;
[ "java.util", "org.mockito", "org.opendaylight.yang" ]
java.util; org.mockito; org.opendaylight.yang;
1,176,205
protected void assumeGlobalXactIdentity( TransactionTableEntry ent) { if (SanityManager.DEBUG) { SanityManager.ASSERT(ent != null); SanityManager.ASSERT(ent.getXid() != null, "TTE.xid is null"); SanityManager.ASSERT( ent.getFirstLog() != null, "TTE.firstLog is null"); SanityManager.ASSERT(ent.isPrepared()); } myId = ent.getXid(); myGlobalId = ent.getGid(); logStart = ent.getFirstLog(); logLast = ent.getLastLog(); // I am very active if (state == IDLE) { if (SanityManager.DEBUG) { if (SanityManager.DEBUG_ON("XATrace")) SanityManager.DEBUG("XATrace","set active state in assume Global XactIdentity"); } state = ACTIVE; } if (ent.isPrepared()) state = PREPARED; // I am the transaction that is using this TransactionTableEntry ent.setXact(this); if (SanityManager.DEBUG) { if (state != ACTIVE && state != UPDATE && state != PREPARED) SanityManager.THROWASSERT( "recovery transaction have illegal state " + state + "xact = " + this); } if (logger == null) getLogger(); savedEndStatus = 0; if (SanityManager.DEBUG) { SanityManager.ASSERT(myGlobalId != null); // at least right now only prepared xact call this during recovery. SanityManager.ASSERT(state == PREPARED); } }
void function( TransactionTableEntry ent) { if (SanityManager.DEBUG) { SanityManager.ASSERT(ent != null); SanityManager.ASSERT(ent.getXid() != null, STR); SanityManager.ASSERT( ent.getFirstLog() != null, STR); SanityManager.ASSERT(ent.isPrepared()); } myId = ent.getXid(); myGlobalId = ent.getGid(); logStart = ent.getFirstLog(); logLast = ent.getLastLog(); if (state == IDLE) { if (SanityManager.DEBUG) { if (SanityManager.DEBUG_ON(STR)) SanityManager.DEBUG(STR,STR); } state = ACTIVE; } if (ent.isPrepared()) state = PREPARED; ent.setXact(this); if (SanityManager.DEBUG) { if (state != ACTIVE && state != UPDATE && state != PREPARED) SanityManager.THROWASSERT( STR + state + STR + this); } if (logger == null) getLogger(); savedEndStatus = 0; if (SanityManager.DEBUG) { SanityManager.ASSERT(myGlobalId != null); SanityManager.ASSERT(state == PREPARED); } }
/** * Assume complete identity of the given Transaction Table Entry. * <p> * Used by the final phase of the recovery to create new real transactions * to take on the identity of in-doubt prepared transactions found during * redo. Need to assume the globalId. * * @param ent The original entry we are assuming the identity of. * **/
Assume complete identity of the given Transaction Table Entry. Used by the final phase of the recovery to create new real transactions to take on the identity of in-doubt prepared transactions found during redo. Need to assume the globalId
assumeGlobalXactIdentity
{ "repo_name": "lpxz/grail-derby104", "path": "java/engine/org/apache/derby/impl/store/raw/xact/Xact.java", "license": "apache-2.0", "size": 80536 }
[ "org.apache.derby.iapi.services.sanity.SanityManager" ]
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.services.sanity.*;
[ "org.apache.derby" ]
org.apache.derby;
1,246,199
static class Allocator implements TypeAllocator<ImagesType> { public ImagesType newInstance(String elementName, ComplexDataType parent) { return new ImagesType(elementName, parent); } } private static Allocator allocator = new Allocator();
static class Allocator implements TypeAllocator<ImagesType> { ImagesType function(String elementName, ComplexDataType parent) { return new ImagesType(elementName, parent); } } private static Allocator allocator = new Allocator();
/** * method for getting a new instance of type ImagesType. * * @param elementName the name of the originating XML tag * @param parent the parent data * @return new instance */
method for getting a new instance of type ImagesType
newInstance
{ "repo_name": "lolkedijkstra/xml2j-gen", "path": "samples/discogs/releases/src/main/java/com/xml2j/discogs/releases/ImagesType.java", "license": "mit", "size": 3086 }
[ "com.xml2j.xml.core.ComplexDataType", "com.xml2j.xml.core.TypeAllocator" ]
import com.xml2j.xml.core.ComplexDataType; import com.xml2j.xml.core.TypeAllocator;
import com.xml2j.xml.core.*;
[ "com.xml2j.xml" ]
com.xml2j.xml;
1,937,176
public static SparseBitmap xor(SparseBitmap... bitmaps) { if (bitmaps.length == 0) return new SparseBitmap(); else if (bitmaps.length == 1) return bitmaps[0]; else if (bitmaps.length == 2) return bitmaps[0].or(bitmaps[1]); PriorityQueue<SparseBitmap> pq = new PriorityQueue<SparseBitmap>( bitmaps.length, smallfirst); for (SparseBitmap x : bitmaps) pq.add(x); while (pq.size() > 1) { SparseBitmap x1 = pq.poll(); SparseBitmap x2 = pq.poll(); pq.add(x1.xor(x2)); } return pq.poll(); }
static SparseBitmap function(SparseBitmap... bitmaps) { if (bitmaps.length == 0) return new SparseBitmap(); else if (bitmaps.length == 1) return bitmaps[0]; else if (bitmaps.length == 2) return bitmaps[0].or(bitmaps[1]); PriorityQueue<SparseBitmap> pq = new PriorityQueue<SparseBitmap>( bitmaps.length, smallfirst); for (SparseBitmap x : bitmaps) pq.add(x); while (pq.size() > 1) { SparseBitmap x1 = pq.poll(); SparseBitmap x2 = pq.poll(); pq.add(x1.xor(x2)); } return pq.poll(); }
/** * Computes the bit-wise exclusive or aggregate over several bitmaps. * * @param bitmaps * the bitmaps to aggregate * @return the resulting bitmap */
Computes the bit-wise exclusive or aggregate over several bitmaps
xor
{ "repo_name": "lemire/sparsebitmap", "path": "src/main/java/sparsebitmap/SparseBitmap.java", "license": "apache-2.0", "size": 29014 }
[ "java.util.PriorityQueue" ]
import java.util.PriorityQueue;
import java.util.*;
[ "java.util" ]
java.util;
1,625,540
public static void makeAccessible(Field field) { if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) { field.setAccessible(true); } }
static void function(Field field) { if ((!Modifier.isPublic(field.getModifiers()) !Modifier.isPublic(field.getDeclaringClass().getModifiers()) Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) { field.setAccessible(true); } }
/** * Make the given field accessible, explicitly setting it accessible if * necessary. The <code>setAccessible(true)</code> method is only called * when actually necessary, to avoid unnecessary conflicts with a JVM * SecurityManager (if active). * @param field the field to make accessible * @see java.lang.reflect.Field#setAccessible */
Make the given field accessible, explicitly setting it accessible if necessary. The <code>setAccessible(true)</code> method is only called when actually necessary, to avoid unnecessary conflicts with a JVM SecurityManager (if active)
makeAccessible
{ "repo_name": "xuse/ef-orm", "path": "common-core/src/main/java/jef/tools/reflect/ReflectionUtils.java", "license": "apache-2.0", "size": 22293 }
[ "java.lang.reflect.Field", "java.lang.reflect.Modifier" ]
import java.lang.reflect.Field; import java.lang.reflect.Modifier;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,739,328
public void setAttackTimerValue(String attackTimerValue) throws JNCException { setAttackTimerValue(new YangUInt16(attackTimerValue)); }
void function(String attackTimerValue) throws JNCException { setAttackTimerValue(new YangUInt16(attackTimerValue)); }
/** * Sets the value for child leaf "attack-timer", * using a String value. * @param attackTimerValue used during instantiation. */
Sets the value for child leaf "attack-timer", using a String value
setAttackTimerValue
{ "repo_name": "jnpr-shinma/yangfile", "path": "hitel/src/hctaEpc/mmeSgsn/interface_/ss7/MmeSccpProfile.java", "license": "apache-2.0", "size": 19551 }
[ "com.tailf.jnc.YangUInt16" ]
import com.tailf.jnc.YangUInt16;
import com.tailf.jnc.*;
[ "com.tailf.jnc" ]
com.tailf.jnc;
1,663,700
private ObservableList<CuteElementContainer<Action>> generateCasesBasedOnMap( TreeMap<String, ArrayList<Action>> actionsMap) { ObservableList<CuteElementContainer<Action>> genCases = FXCollections.observableArrayList(); for (Entry<String, ArrayList<Action>> entry : actionsMap.entrySet()) { CuteElementContainer<Action> container = new CuteElementContainer<Action>( entry.getValue(), entry.getKey(), AddableChildrenTypeInfo.ACTION, MaxAddableChildrenCount.INFINITY, MinAddableChildrenCount.ONE, "Variable's Value"); container.getElementInfo().setEditable(true); container.getElementInfo().setEmptyNameAllowed(true); genCases.add(container); } return genCases; }
ObservableList<CuteElementContainer<Action>> function( TreeMap<String, ArrayList<Action>> actionsMap) { ObservableList<CuteElementContainer<Action>> genCases = FXCollections.observableArrayList(); for (Entry<String, ArrayList<Action>> entry : actionsMap.entrySet()) { CuteElementContainer<Action> container = new CuteElementContainer<Action>( entry.getValue(), entry.getKey(), AddableChildrenTypeInfo.ACTION, MaxAddableChildrenCount.INFINITY, MinAddableChildrenCount.ONE, STR); container.getElementInfo().setEditable(true); container.getElementInfo().setEmptyNameAllowed(true); genCases.add(container); } return genCases; }
/** * Generates list of {@link CuteElementContainer}s containing Action from the map of string * Values and corresponding Actions. * * @param actionsMap * map which keys are Values and it's values are corresponding lists of Actions. * @return ObservableList of CuteElementContainers which contain lists of Actions. Names of * CuteElementContainers are Values. * */
Generates list of <code>CuteElementContainer</code>s containing Action from the map of string Values and corresponding Actions
generateCasesBasedOnMap
{ "repo_name": "ubershy/StreamSis", "path": "src/main/java/com/ubershy/streamsis/elements/actions/VariableSwitchAction.java", "license": "gpl-3.0", "size": 8674 }
[ "com.ubershy.streamsis.elements.CuteElementContainer", "java.util.ArrayList", "java.util.Map", "java.util.TreeMap" ]
import com.ubershy.streamsis.elements.CuteElementContainer; import java.util.ArrayList; import java.util.Map; import java.util.TreeMap;
import com.ubershy.streamsis.elements.*; import java.util.*;
[ "com.ubershy.streamsis", "java.util" ]
com.ubershy.streamsis; java.util;
2,247,240
public static BufferedImage renderProjected(Registry context, Long pixelsID, int startZ, int endZ, int type, int stepping, List<Integer> channels) throws RenderingServiceException, DSOutOfServiceException { if (!(context.equals(registry))) throw new IllegalArgumentException("Not allow to access method."); RenderingControlProxy proxy = (RenderingControlProxy) singleton.rndSvcProxies.get(pixelsID); if (proxy == null) throw new RuntimeException("No rendering service " + "initialized for the specified pixels set."); return proxy.renderProjected(startZ, endZ, stepping, type, channels); }
static BufferedImage function(Registry context, Long pixelsID, int startZ, int endZ, int type, int stepping, List<Integer> channels) throws RenderingServiceException, DSOutOfServiceException { if (!(context.equals(registry))) throw new IllegalArgumentException(STR); RenderingControlProxy proxy = (RenderingControlProxy) singleton.rndSvcProxies.get(pixelsID); if (proxy == null) throw new RuntimeException(STR + STR); return proxy.renderProjected(startZ, endZ, stepping, type, channels); }
/** * Renders the projected images. * * @param context Reference to the registry. To ensure that agents cannot * call the method. It must be a reference to the * container's registry. * @param pixelsID The id of the pixels set. * @param startZ The first optical section. * @param endZ The last optical section. * @param stepping Stepping value to use while calculating the projection. * @param type One of the projection type defined by this class. * @param channels The collection of channels to project. * @return See above. * @throws RenderingServiceException If an error occurred while setting * the value. * @throws DSOutOfServiceException If the connection is broken. */
Renders the projected images
renderProjected
{ "repo_name": "emilroz/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/rnd/PixelsServicesFactory.java", "license": "gpl-2.0", "size": 27446 }
[ "java.awt.image.BufferedImage", "java.util.List", "org.openmicroscopy.shoola.env.config.Registry", "org.openmicroscopy.shoola.env.data.DSOutOfServiceException" ]
import java.awt.image.BufferedImage; import java.util.List; import org.openmicroscopy.shoola.env.config.Registry; import org.openmicroscopy.shoola.env.data.DSOutOfServiceException;
import java.awt.image.*; import java.util.*; import org.openmicroscopy.shoola.env.config.*; import org.openmicroscopy.shoola.env.data.*;
[ "java.awt", "java.util", "org.openmicroscopy.shoola" ]
java.awt; java.util; org.openmicroscopy.shoola;
402,952
private void setCurrentActivity(Activity activity) { if (VectorApp.isAppInBackground() && (null != activity)) { Matrix matrixInstance = Matrix.getInstance(activity.getApplicationContext()); // sanity check if (null != matrixInstance) { matrixInstance.refreshPushRules(); } Log.d(LOG_TAG, "The application is resumed"); // display the memory usage when the application is put iun foreground.. CommonActivityUtils.displayMemoryInformation(activity); } // wait 2s to check that the application is put in background if (null != getInstance()) { if (null == activity) { getInstance().startActivityTransitionTimer(); } else { getInstance().stopActivityTransitionTimer(); } } mCurrentActivity = activity; } public static Activity getCurrentActivity() { return mCurrentActivity; }
void function(Activity activity) { if (VectorApp.isAppInBackground() && (null != activity)) { Matrix matrixInstance = Matrix.getInstance(activity.getApplicationContext()); if (null != matrixInstance) { matrixInstance.refreshPushRules(); } Log.d(LOG_TAG, STR); CommonActivityUtils.displayMemoryInformation(activity); } if (null != getInstance()) { if (null == activity) { getInstance().startActivityTransitionTimer(); } else { getInstance().stopActivityTransitionTimer(); } } mCurrentActivity = activity; } public static Activity getCurrentActivity() { return mCurrentActivity; }
/** * Update the current active activity. * It manages the application background / foreground when it is required. * @param activity the current activity, null if there is no more one. */
Update the current active activity. It manages the application background / foreground when it is required
setCurrentActivity
{ "repo_name": "floviolleau/vector-android", "path": "vector/src/main/java/im/vector/VectorApp.java", "license": "apache-2.0", "size": 14732 }
[ "android.app.Activity", "android.util.Log", "im.vector.activity.CommonActivityUtils" ]
import android.app.Activity; import android.util.Log; import im.vector.activity.CommonActivityUtils;
import android.app.*; import android.util.*; import im.vector.activity.*;
[ "android.app", "android.util", "im.vector.activity" ]
android.app; android.util; im.vector.activity;
1,061,367
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<EffectiveNetworkSecurityGroupListResultInner>, EffectiveNetworkSecurityGroupListResultInner> beginListEffectiveNetworkSecurityGroups(String resourceGroupName, String networkInterfaceName, Context context);
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<EffectiveNetworkSecurityGroupListResultInner>, EffectiveNetworkSecurityGroupListResultInner> beginListEffectiveNetworkSecurityGroups(String resourceGroupName, String networkInterfaceName, Context context);
/** * Gets all network security groups applied to a network interface. * * @param resourceGroupName The name of the resource group. * @param networkInterfaceName The name of the network interface. * @param context The context to associate with this operation. * @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 network security groups applied to a network interface. */
Gets all network security groups applied to a network interface
beginListEffectiveNetworkSecurityGroups
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/NetworkInterfacesClient.java", "license": "mit", "size": 60151 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.network.fluent.models.EffectiveNetworkSecurityGroupListResultInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.network.fluent.models.EffectiveNetworkSecurityGroupListResultInner;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
355,159
public final void init(final FilterConfig filterConfig) throws ServletException { try { this.filterConfig = filterConfig; processInitParams(filterConfig); // Attempt to initialise this filter doInit(filterConfig); } catch (final Exception e) { LOG.error("Could not initialise servlet filter.", e); throw new ServletException("Could not initialise servlet filter.", e); } }
final void function(final FilterConfig filterConfig) throws ServletException { try { this.filterConfig = filterConfig; processInitParams(filterConfig); doInit(filterConfig); } catch (final Exception e) { LOG.error(STR, e); throw new ServletException(STR, e); } }
/** * Initialises the filter. * <p/> * Calls template method {@link #doInit(javax.servlet.FilterConfig)} to perform any filter specific initialisation. */
Initialises the filter. Calls template method <code>#doInit(javax.servlet.FilterConfig)</code> to perform any filter specific initialisation
init
{ "repo_name": "hailin0/pagecache-parent", "path": "pagecache-common/src/main/java/net/sf/pagecache/constructs/web/filter/Filter.java", "license": "apache-2.0", "size": 13347 }
[ "javax.servlet.FilterConfig", "javax.servlet.ServletException" ]
import javax.servlet.FilterConfig; import javax.servlet.ServletException;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,872,113
protected boolean isSnapshotArtifactValid(@Nonnull Artifact artifact, @Nullable Path path) { try { return !artifact.isSnapshot() || (path != null && Files.getLastModifiedTime(path).toInstant().isAfter(Instant.now().minus(SNAPSHOT_CACHING_DURATION))); } catch (IOException ex) { this.getLog().warn("Could not verify state of snapshot artifact " + this.getArtifactCoordinateString(artifact) + ": " + ex.getMessage()); return false; } }
boolean function(@Nonnull Artifact artifact, @Nullable Path path) { try { return !artifact.isSnapshot() (path != null && Files.getLastModifiedTime(path).toInstant().isAfter(Instant.now().minus(SNAPSHOT_CACHING_DURATION))); } catch (IOException ex) { this.getLog().warn(STR + this.getArtifactCoordinateString(artifact) + STR + ex.getMessage()); return false; } }
/** * Checks whether a snapshot artifact is considered valid. */
Checks whether a snapshot artifact is considered valid
isSnapshotArtifactValid
{ "repo_name": "BasinMC/minecraft-maven-plugin", "path": "src/main/java/org/basinmc/maven/plugins/minecraft/AbstractArtifactMojo.java", "license": "apache-2.0", "size": 9222 }
[ "java.io.IOException", "java.nio.file.Files", "java.nio.file.Path", "java.time.Instant", "javax.annotation.Nonnull", "javax.annotation.Nullable", "org.apache.maven.artifact.Artifact" ]
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.time.Instant; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.artifact.Artifact;
import java.io.*; import java.nio.file.*; import java.time.*; import javax.annotation.*; import org.apache.maven.artifact.*;
[ "java.io", "java.nio", "java.time", "javax.annotation", "org.apache.maven" ]
java.io; java.nio; java.time; javax.annotation; org.apache.maven;
2,033,573
public static String getArgValue(List<String> args, int argValueIndex) { if (argValueIndex >= args.size() || argValueIndex < 0) { return null; } String argValue = args.get(argValueIndex); if (argValue.startsWith("-")) { return null; } return argValue; }
static String function(List<String> args, int argValueIndex) { if (argValueIndex >= args.size() argValueIndex < 0) { return null; } String argValue = args.get(argValueIndex); if (argValue.startsWith("-")) { return null; } return argValue; }
/** * Returns the argument value that should be at the given index. If the index * is out of bounds or the string at the index is another argument (i.e. * starts with '-'), null is returned. */
Returns the argument value that should be at the given index. If the index is out of bounds or the string at the index is another argument (i.e. starts with '-'), null is returned
getArgValue
{ "repo_name": "boa0332/google-plugin-for-eclipse", "path": "plugins/com.google.gdt.eclipse.core/src/com/google/gdt/eclipse/core/launch/LaunchConfigurationProcessorUtilities.java", "license": "epl-1.0", "size": 9889 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,411,004
EdgeStyleDescription getStyle();
EdgeStyleDescription getStyle();
/** * Returns the value of the '<em><b>Style</b></em>' containment reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Style</em>' containment reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * * @return the value of the '<em>Style</em>' containment reference. * @see #setStyle(EdgeStyleDescription) * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getConditionalEdgeStyleDescription_Style() * @model containment="true" resolveProxies="true" * @generated */
Returns the value of the 'Style' containment reference. If the meaning of the 'Style' containment reference isn't clear, there really should be more of a description here...
getStyle
{ "repo_name": "FTSRG/iq-sirius-integration", "path": "host/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/ConditionalEdgeStyleDescription.java", "license": "epl-1.0", "size": 2283 }
[ "org.eclipse.sirius.diagram.description.style.EdgeStyleDescription" ]
import org.eclipse.sirius.diagram.description.style.EdgeStyleDescription;
import org.eclipse.sirius.diagram.description.style.*;
[ "org.eclipse.sirius" ]
org.eclipse.sirius;
2,140,496
@NotNull protected List<Property<String>> findByResult( @NotNull final String resultId, @NotNull final Map<String, List<Property<String>>> properties, @NotNull final List<Result<String>> customResults) { @NotNull final List<Property<String>> result = new ArrayList<>(); @Nullable final Result<String> customResult = new CucumberSqlResultDAO(customResults).findByPrimaryKey(resultId); if (customResult != null) { for (@Nullable final Property<String> property : properties.get(resultId)) { if (property != null) { for (@Nullable final PropertyRef propertyRef : customResult.getPropertyRefs()) { if ( (propertyRef != null) && (propertyRef.getId().equals(property.getId()))) { result.add(property); break; } } } } } return result; }
List<Property<String>> function( @NotNull final String resultId, @NotNull final Map<String, List<Property<String>>> properties, @NotNull final List<Result<String>> customResults) { @NotNull final List<Property<String>> result = new ArrayList<>(); @Nullable final Result<String> customResult = new CucumberSqlResultDAO(customResults).findByPrimaryKey(resultId); if (customResult != null) { for (@Nullable final Property<String> property : properties.get(resultId)) { if (property != null) { for (@Nullable final PropertyRef propertyRef : customResult.getPropertyRefs()) { if ( (propertyRef != null) && (propertyRef.getId().equals(property.getId()))) { result.add(property); break; } } } } } return result; }
/** * Retrieves all {@link Property properties} used in given * {@link Result}. * @param resultId the {@link Result} identifier. * @param properties the properties. * @param customResults the custom results. * @return the list of properties associated to given {@link Result}. */
Retrieves all <code>Property properties</code> used in given <code>Result</code>
findByResult
{ "repo_name": "rydnr/queryj-rt", "path": "queryj-test/src/main/java/org/acmsl/queryj/test/sql/CucumberSqlPropertyDAO.java", "license": "gpl-2.0", "size": 9227 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map", "org.acmsl.queryj.customsql.Property", "org.acmsl.queryj.customsql.PropertyRef", "org.acmsl.queryj.customsql.Result", "org.jetbrains.annotations.NotNull", "org.jetbrains.annotations.Nullable" ]
import java.util.ArrayList; import java.util.List; import java.util.Map; import org.acmsl.queryj.customsql.Property; import org.acmsl.queryj.customsql.PropertyRef; import org.acmsl.queryj.customsql.Result; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
import java.util.*; import org.acmsl.queryj.customsql.*; import org.jetbrains.annotations.*;
[ "java.util", "org.acmsl.queryj", "org.jetbrains.annotations" ]
java.util; org.acmsl.queryj; org.jetbrains.annotations;
650,329
public ResponsesCCE SendResponseCCE(byte[] message, ElGamalKey tKeys) { Masks mask = this.SendMasksCCE(tKeys); BigInteger challenge = this.SendChallenge(mask, message); BigInteger response = this.ResponseCCE(challenge, mask); return new ResponsesCCE(mask,challenge,response); }
ResponsesCCE function(byte[] message, ElGamalKey tKeys) { Masks mask = this.SendMasksCCE(tKeys); BigInteger challenge = this.SendChallenge(mask, message); BigInteger response = this.ResponseCCE(challenge, mask); return new ResponsesCCE(mask,challenge,response); }
/** * Create responseCCE will send * @return response in bigInteger */
Create responseCCE will send
SendResponseCCE
{ "repo_name": "pja35/SXP", "path": "src/main/java/protocol/impl/sigma/Sender.java", "license": "lgpl-3.0", "size": 6451 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
2,547,140
public Signature getSignature() { return sig1; }
Signature function() { return sig1; }
/** * Return the signature of the proxied method. */
Return the signature of the proxied method
getSignature
{ "repo_name": "vongosling/cglib-ext", "path": "src/proxy/net/sf/cglib/proxy/MethodProxy.java", "license": "apache-2.0", "size": 8384 }
[ "net.sf.cglib.core.Signature" ]
import net.sf.cglib.core.Signature;
import net.sf.cglib.core.*;
[ "net.sf.cglib" ]
net.sf.cglib;
1,026,827
public KCTScript parseFromJson(String jsonText) throws TurtleException { JSONParser parser=new JSONParser(); try { log.trace(jsonText); JSONObject json=(JSONObject)parser.parse(jsonText); String scriptname=(String)json.get("scriptname"); KCTScript script=new KCTScript(scriptname); log.trace(String.format("%s\n", scriptname)); JSONArray lang= (JSONArray) json.get("commands"); for (int i=0; i<lang.size(); i++) { JSONObject cmd=(JSONObject)lang.get(i); script.addCommand(cmd); log.trace(String.format("script %s has command %s", script.getScriptName(), cmd.get(KCTCommand.CMD))); } return script; } catch (ParseException e) { // TODO: log better? handle better? throw new TurtleException(e); } }
KCTScript function(String jsonText) throws TurtleException { JSONParser parser=new JSONParser(); try { log.trace(jsonText); JSONObject json=(JSONObject)parser.parse(jsonText); String scriptname=(String)json.get(STR); KCTScript script=new KCTScript(scriptname); log.trace(String.format("%s\n", scriptname)); JSONArray lang= (JSONArray) json.get(STR); for (int i=0; i<lang.size(); i++) { JSONObject cmd=(JSONObject)lang.get(i); script.addCommand(cmd); log.trace(String.format(STR, script.getScriptName(), cmd.get(KCTCommand.CMD))); } return script; } catch (ParseException e) { throw new TurtleException(e); } }
/** * Static factory method to parse Json and produce a KCTScript. * * @param jsonText * @return * @throws TurtleException If there are any errors in the json */
Static factory method to parse Json and produce a KCTScript
parseFromJson
{ "repo_name": "jspacco/Knoxcraft", "path": "TurtleSponge/src/main/java/org/knoxcraft/turtle3d/TurtleCompiler.java", "license": "agpl-3.0", "size": 14201 }
[ "org.json.simple.JSONArray", "org.json.simple.JSONObject", "org.json.simple.parser.JSONParser", "org.json.simple.parser.ParseException" ]
import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException;
import org.json.simple.*; import org.json.simple.parser.*;
[ "org.json.simple" ]
org.json.simple;
2,443,880
protected void unlock(String lock, String resource) throws PermissionException { if (!unlockCheck(lock, resource)) { throw new PermissionException(sessionManager().getCurrentSessionUserId(), lock, resource); } }
void function(String lock, String resource) throws PermissionException { if (!unlockCheck(lock, resource)) { throw new PermissionException(sessionManager().getCurrentSessionUserId(), lock, resource); } }
/** * Check security permission. * * @param lock * The lock id string. * @param resource * The resource reference string, or null if no resource is involved. * @exception PermissionException * Thrown if the user does not have access */
Check security permission
unlock
{ "repo_name": "harfalm/Sakai-10.1", "path": "kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSiteService.java", "license": "apache-2.0", "size": 95539 }
[ "org.sakaiproject.exception.PermissionException" ]
import org.sakaiproject.exception.PermissionException;
import org.sakaiproject.exception.*;
[ "org.sakaiproject.exception" ]
org.sakaiproject.exception;
1,704,418
public Date getUpdateStart() { return (m_updateStart); }
Date function() { return (m_updateStart); }
/** * Gets the Update Start Field value. * * @return update Start Date */
Gets the Update Start Field value
getUpdateStart
{ "repo_name": "tmyroadctfig/mpxj", "path": "net/sf/mpxj/ResourceAssignmentWorkgroupFields.java", "license": "lgpl-2.1", "size": 3374 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,526,842
private MenuItem addConnectionAction(Menu menu, final EClass relationshipType, final boolean reverseDirection) { final MenuItem item = new MenuItem(menu, SWT.CASCADE); item.setText(ArchiLabelProvider.INSTANCE.getRelationshipPhrase(relationshipType, reverseDirection)); item.setImage(ArchiLabelProvider.INSTANCE.getImage(relationshipType));
MenuItem function(Menu menu, final EClass relationshipType, final boolean reverseDirection) { final MenuItem item = new MenuItem(menu, SWT.CASCADE); item.setText(ArchiLabelProvider.INSTANCE.getRelationshipPhrase(relationshipType, reverseDirection)); item.setImage(ArchiLabelProvider.INSTANCE.getImage(relationshipType));
/** * Add a Connection Action with a relationship type */
Add a Connection Action with a relationship type
addConnectionAction
{ "repo_name": "archimatetool/archi", "path": "com.archimatetool.editor/src/com/archimatetool/editor/diagram/tools/MagicConnectionCreationTool.java", "license": "mit", "size": 28490 }
[ "com.archimatetool.editor.ui.ArchiLabelProvider", "org.eclipse.emf.ecore.EClass", "org.eclipse.swt.widgets.Menu", "org.eclipse.swt.widgets.MenuItem" ]
import com.archimatetool.editor.ui.ArchiLabelProvider; import org.eclipse.emf.ecore.EClass; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem;
import com.archimatetool.editor.ui.*; import org.eclipse.emf.ecore.*; import org.eclipse.swt.widgets.*;
[ "com.archimatetool.editor", "org.eclipse.emf", "org.eclipse.swt" ]
com.archimatetool.editor; org.eclipse.emf; org.eclipse.swt;
989,884
public static JSONObject getEntry(File file) throws JSONException { JSONObject entry = new JSONObject(); entry.put("isFile", file.isFile()); entry.put("isDirectory", file.isDirectory()); entry.put("name", file.getName()); entry.put("fullPath", "file://" + file.getAbsolutePath()); // The file system can't be specified, as it would lead to an infinite loop. // entry.put("filesystem", null); return entry; }
static JSONObject function(File file) throws JSONException { JSONObject entry = new JSONObject(); entry.put(STR, file.isFile()); entry.put(STR, file.isDirectory()); entry.put("name", file.getName()); entry.put(STR, "file: return entry; }
/** * Returns a JSON object representing the given File. * * @param file the File to convert * @return a JSON representation of the given File * @throws org.json.JSONException */
Returns a JSON object representing the given File
getEntry
{ "repo_name": "usersource/tasks", "path": "tasks_phonegap/Tasks/plugins/io.usersource.anno/anno_plugin_android/src/org/apache/cordova/file/FileUtils.java", "license": "mpl-2.0", "size": 47712 }
[ "java.io.File", "org.json.JSONException", "org.json.JSONObject" ]
import java.io.File; import org.json.JSONException; import org.json.JSONObject;
import java.io.*; import org.json.*;
[ "java.io", "org.json" ]
java.io; org.json;
2,674,242
@Override public void widgetSelected(final SelectionEvent arg0) { selectedDelimiter = comboDelimiter.getSelectionIndex(); customDelimiter = true; evaluatePage(); } }); new Label(container, SWT.NONE); lblQuote = new Label(container, SWT.NONE); lblQuote.setVisible(false); lblQuote.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblQuote.setText(Resources.getMessage("ImportWizardPageCSV.11")); //$NON-NLS-1$ comboQuote = new Combo(container, SWT.READ_ONLY); comboQuote.setVisible(false); for (final char c : quotes) { comboQuote.add(String.valueOf(c)); } comboQuote.select(selectedQuote); comboQuote.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboQuote.addSelectionListener(new SelectionAdapter() {
void function(final SelectionEvent arg0) { selectedDelimiter = comboDelimiter.getSelectionIndex(); customDelimiter = true; evaluatePage(); } }); new Label(container, SWT.NONE); lblQuote = new Label(container, SWT.NONE); lblQuote.setVisible(false); lblQuote.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblQuote.setText(Resources.getMessage(STR)); comboQuote = new Combo(container, SWT.READ_ONLY); comboQuote.setVisible(false); for (final char c : quotes) { comboQuote.add(String.valueOf(c)); } comboQuote.select(selectedQuote); comboQuote.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboQuote.addSelectionListener(new SelectionAdapter() {
/** * Set selection index and customDelimiter and (re-)evaluates page */
Set selection index and customDelimiter and (re-)evaluates page
widgetSelected
{ "repo_name": "RaffaelBild/arx", "path": "src/gui/org/deidentifier/arx/gui/view/impl/wizard/ImportWizardPageCSV.java", "license": "apache-2.0", "size": 31391 }
[ "org.deidentifier.arx.gui.resources.Resources", "org.eclipse.swt.events.SelectionAdapter", "org.eclipse.swt.events.SelectionEvent", "org.eclipse.swt.layout.GridData", "org.eclipse.swt.widgets.Combo", "org.eclipse.swt.widgets.Label" ]
import org.deidentifier.arx.gui.resources.Resources; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Label;
import org.deidentifier.arx.gui.resources.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*;
[ "org.deidentifier.arx", "org.eclipse.swt" ]
org.deidentifier.arx; org.eclipse.swt;
1,250,818
protected void parseValueConstraints( TokenStream tokens, JcrPropertyDefinitionTemplate propDefn ) { if (tokens.canConsume('<')) { List<String> defaultValues = parseStringList(tokens); if (!defaultValues.isEmpty()) { propDefn.setValueConstraints(strings(defaultValues)); } } }
void function( TokenStream tokens, JcrPropertyDefinitionTemplate propDefn ) { if (tokens.canConsume('<')) { List<String> defaultValues = parseStringList(tokens); if (!defaultValues.isEmpty()) { propDefn.setValueConstraints(strings(defaultValues)); } } }
/** * Parse the property definition's value constraints, if they appear next on the token stream. * * @param tokens the tokens containing the definition; never null * @param propDefn the property definition; never null * @throws ParsingException if there is a problem parsing the content */
Parse the property definition's value constraints, if they appear next on the token stream
parseValueConstraints
{ "repo_name": "phantomjinx/modeshape", "path": "modeshape-jcr/src/main/java/org/modeshape/jcr/CndImporter.java", "license": "apache-2.0", "size": 38876 }
[ "java.util.List", "org.modeshape.common.text.TokenStream" ]
import java.util.List; import org.modeshape.common.text.TokenStream;
import java.util.*; import org.modeshape.common.text.*;
[ "java.util", "org.modeshape.common" ]
java.util; org.modeshape.common;
1,294,176
boolean isObjectProperty(Predicate predicate);
boolean isObjectProperty(Predicate predicate);
/** * Checks whether the predicate is a object property assertion. * * @param predicate * The target predicate. * @return Returns true if the predicate is a object property assertion from * the input ontology, or false otherwise. */
Checks whether the predicate is a object property assertion
isObjectProperty
{ "repo_name": "srapisarda/ontop", "path": "obdalib-core/src/main/java/it/unibz/inf/ontop/io/TargetQueryVocabularyValidator.java", "license": "apache-2.0", "size": 2556 }
[ "it.unibz.inf.ontop.model.Predicate" ]
import it.unibz.inf.ontop.model.Predicate;
import it.unibz.inf.ontop.model.*;
[ "it.unibz.inf" ]
it.unibz.inf;
1,900,053
public LoadStats plus(final LoadStats stats) { return new LoadStats(loadSuccessCount + stats.loadSuccessCount, loadTimeoutCount + stats.loadTimeoutCount, loadExceptionCount + stats.loadExceptionCount, totalLoadTime + stats.totalLoadTime, BASE_UNIT); } public LoadStats(final long loadSuccessCount, final long loadTimeoutCount, final long loadExceptionCount, final long totalLoadTime, final TimeUnit unit) { this.loadSuccessCount = check(loadSuccessCount); this.loadTimeoutCount = check(loadTimeoutCount); this.loadExceptionCount = check(loadExceptionCount); this.totalLoadTime = BASE_UNIT.convert(check(totalLoadTime), unit); } protected LoadStats(final LoadStats stats) { this(stats.loadSuccessCount, stats.loadTimeoutCount, stats.loadExceptionCount, stats.totalLoadTime, BASE_UNIT); } public static LoadStats empty() { return new LoadStats(0, 0, 0, 0, BASE_UNIT); }
LoadStats function(final LoadStats stats) { return new LoadStats(loadSuccessCount + stats.loadSuccessCount, loadTimeoutCount + stats.loadTimeoutCount, loadExceptionCount + stats.loadExceptionCount, totalLoadTime + stats.totalLoadTime, BASE_UNIT); } public LoadStats(final long loadSuccessCount, final long loadTimeoutCount, final long loadExceptionCount, final long totalLoadTime, final TimeUnit unit) { this.loadSuccessCount = check(loadSuccessCount); this.loadTimeoutCount = check(loadTimeoutCount); this.loadExceptionCount = check(loadExceptionCount); this.totalLoadTime = BASE_UNIT.convert(check(totalLoadTime), unit); } protected LoadStats(final LoadStats stats) { this(stats.loadSuccessCount, stats.loadTimeoutCount, stats.loadExceptionCount, stats.totalLoadTime, BASE_UNIT); } public static LoadStats empty() { return new LoadStats(0, 0, 0, 0, BASE_UNIT); }
/** * Returns a new LoadStats representing the aggregation of this object and the other one. Subclasses will want * to override this. */
Returns a new LoadStats representing the aggregation of this object and the other one. Subclasses will want to override this
plus
{ "repo_name": "toonetown/guava-ext", "path": "src/main/java/com/toonetown/guava_ext/LoadStats.java", "license": "mit", "size": 8333 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,578,083
@Override public Attribute fillAttribute(PerunSessionImpl perunSession, User user, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { Attribute filledAttribute = new Attribute(attribute); // Get all attributes urn:perun:user:attribute-def:def:login-namespace:[login-namespace], then we can get the new login List<Attribute> loginAttributes = perunSession.getPerunBl().getAttributesManagerBl().getAttributesByAttributeDefinition(perunSession, attribute); Set<String> values = new HashSet<>(); for (Attribute loginAttribute: loginAttributes) { values.add((String) loginAttribute.getValue()); } String login = UUID.randomUUID().toString(); while(values.contains(login)) { login = UUID.randomUUID().toString(); } filledAttribute.setValue(login); return filledAttribute; }
Attribute function(PerunSessionImpl perunSession, User user, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { Attribute filledAttribute = new Attribute(attribute); List<Attribute> loginAttributes = perunSession.getPerunBl().getAttributesManagerBl().getAttributesByAttributeDefinition(perunSession, attribute); Set<String> values = new HashSet<>(); for (Attribute loginAttribute: loginAttributes) { values.add((String) loginAttribute.getValue()); } String login = UUID.randomUUID().toString(); while(values.contains(login)) { login = UUID.randomUUID().toString(); } filledAttribute.setValue(login); return filledAttribute; }
/** * Fill unique (not used) login for user defined as number starting from 1 * * @param perunSession PerunSession * @param user User to fill attribute for * @param attribute Attribute to fill value to * @return Filled attribute * @throws InternalErrorException * @throws WrongAttributeAssignmentException */
Fill unique (not used) login for user defined as number starting from 1
fillAttribute
{ "repo_name": "stavamichal/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/impl/modules/attributes/urn_perun_user_attribute_def_def_login_namespace_fedcloud.java", "license": "bsd-2-clause", "size": 3414 }
[ "cz.metacentrum.perun.core.api.Attribute", "cz.metacentrum.perun.core.api.AttributeDefinition", "cz.metacentrum.perun.core.api.User", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException", "cz.metacentrum.perun.core.impl.PerunSessionImpl", "java.util.HashSet", "java.util.List", "java.util.Set", "java.util.UUID" ]
import cz.metacentrum.perun.core.api.Attribute; import cz.metacentrum.perun.core.api.AttributeDefinition; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException; import cz.metacentrum.perun.core.impl.PerunSessionImpl; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import cz.metacentrum.perun.core.impl.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,572,295
public void parse(Format format) throws IOException { parse(format, null); }
void function(Format format) throws IOException { parse(format, null); }
/** * Parse the given file and check if it is a confirming file according to the given format. * * @param format * format that the document should follow (default {@link Format#PDF_A1B}) * @throws IOException */
Parse the given file and check if it is a confirming file according to the given format
parse
{ "repo_name": "ZhenyaM/veraPDF-pdfbox", "path": "preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java", "license": "apache-2.0", "size": 34951 }
[ "java.io.IOException", "org.apache.pdfbox.preflight.Format" ]
import java.io.IOException; import org.apache.pdfbox.preflight.Format;
import java.io.*; import org.apache.pdfbox.preflight.*;
[ "java.io", "org.apache.pdfbox" ]
java.io; org.apache.pdfbox;
1,577,465
public Observable<ServiceResponse<PublicIPPrefixInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName, String expand) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (publicIpPrefixName == null) { throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<PublicIPPrefixInner>> function(String resourceGroupName, String publicIpPrefixName, String expand) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (publicIpPrefixName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * Gets the specified public IP prefix in a specified resource group. * * @param resourceGroupName The name of the resource group. * @param publicIpPrefixName The name of the public IP prefix. * @param expand Expands referenced resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PublicIPPrefixInner object */
Gets the specified public IP prefix in a specified resource group
getByResourceGroupWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/network/v2019_04_01/implementation/PublicIPPrefixesInner.java", "license": "mit", "size": 78189 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
941,101
public static Path getWindupHome() { String windupHome = System.getProperty(WINDUP_HOME); if (windupHome == null) { Path path = new File("").toPath(); LOG.warning("$WINDUP_HOME not set, using [" + path.toAbsolutePath().toString() + "] instead."); return path; } return Paths.get(windupHome); }
static Path function() { String windupHome = System.getProperty(WINDUP_HOME); if (windupHome == null) { Path path = new File(STR$WINDUP_HOME not set, using [STR] instead."); return path; } return Paths.get(windupHome); }
/** * The path $WINDUP_HOME (where Windup is installed.) */
The path $WINDUP_HOME (where Windup is installed.)
getWindupHome
{ "repo_name": "lincolnthree/windup", "path": "utils/src/main/java/org/jboss/windup/util/PathUtil.java", "license": "epl-1.0", "size": 6532 }
[ "java.io.File", "java.nio.file.Path", "java.nio.file.Paths" ]
import java.io.File; import java.nio.file.Path; import java.nio.file.Paths;
import java.io.*; import java.nio.file.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
2,904,536
@Test public void canDoActionShareableDiskVolumeFormatFails() { DiskImage image = createShareableDiskImage(); image.setvolumeFormat(VolumeFormat.COW); AddDiskParameters parameters = createParameters(); parameters.setDiskInfo(image); Guid storageId = Guid.newGuid(); initializeCommand(storageId, parameters); mockVm(); mockStorageDomain(storageId, Version.v3_1); mockStoragePoolIsoMap(); mockMaxPciSlots(); assertFalse(command.canDoAction()); assertTrue(command.getReturnValue() .getCanDoActionMessages() .contains(EngineMessage.SHAREABLE_DISK_IS_NOT_SUPPORTED_BY_VOLUME_FORMAT.toString())); }
void function() { DiskImage image = createShareableDiskImage(); image.setvolumeFormat(VolumeFormat.COW); AddDiskParameters parameters = createParameters(); parameters.setDiskInfo(image); Guid storageId = Guid.newGuid(); initializeCommand(storageId, parameters); mockVm(); mockStorageDomain(storageId, Version.v3_1); mockStoragePoolIsoMap(); mockMaxPciSlots(); assertFalse(command.canDoAction()); assertTrue(command.getReturnValue() .getCanDoActionMessages() .contains(EngineMessage.SHAREABLE_DISK_IS_NOT_SUPPORTED_BY_VOLUME_FORMAT.toString())); }
/** * CanDoAction should fail when creating a Shareable Disk with COW volume format */
CanDoAction should fail when creating a Shareable Disk with COW volume format
canDoActionShareableDiskVolumeFormatFails
{ "repo_name": "yingyun001/ovirt-engine", "path": "backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddDiskCommandTest.java", "license": "apache-2.0", "size": 40788 }
[ "org.junit.Assert", "org.ovirt.engine.core.common.action.AddDiskParameters", "org.ovirt.engine.core.common.businessentities.storage.DiskImage", "org.ovirt.engine.core.common.businessentities.storage.VolumeFormat", "org.ovirt.engine.core.common.errors.EngineMessage", "org.ovirt.engine.core.compat.Guid", "org.ovirt.engine.core.compat.Version" ]
import org.junit.Assert; import org.ovirt.engine.core.common.action.AddDiskParameters; import org.ovirt.engine.core.common.businessentities.storage.DiskImage; import org.ovirt.engine.core.common.businessentities.storage.VolumeFormat; import org.ovirt.engine.core.common.errors.EngineMessage; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.Version;
import org.junit.*; import org.ovirt.engine.core.common.action.*; import org.ovirt.engine.core.common.businessentities.storage.*; import org.ovirt.engine.core.common.errors.*; import org.ovirt.engine.core.compat.*;
[ "org.junit", "org.ovirt.engine" ]
org.junit; org.ovirt.engine;
599,623
Artifact getAssociatedArtifact( final Overlay overlay ) throws InvalidOverlayConfigurationException { if ( overlay.isCurrentProject() ) { return null; } for ( Artifact artifact : artifactsOverlays ) { // Handle classifier dependencies properly (clash management) if ( compareOverlayWithArtifact( overlay, artifact ) ) { return artifact; } } // maybe its a project dependencies zip or an other type @SuppressWarnings( "unchecked" ) Set<Artifact> projectArtifacts = this.project.getDependencyArtifacts(); if ( projectArtifacts != null ) { for ( Artifact artifact : projectArtifacts ) { if ( compareOverlayWithArtifact( overlay, artifact ) ) { return artifact; } } } throw new InvalidOverlayConfigurationException( "overlay [" + overlay + "] is not a dependency of the project." ); }
Artifact getAssociatedArtifact( final Overlay overlay ) throws InvalidOverlayConfigurationException { if ( overlay.isCurrentProject() ) { return null; } for ( Artifact artifact : artifactsOverlays ) { if ( compareOverlayWithArtifact( overlay, artifact ) ) { return artifact; } } @SuppressWarnings( STR ) Set<Artifact> projectArtifacts = this.project.getDependencyArtifacts(); if ( projectArtifacts != null ) { for ( Artifact artifact : projectArtifacts ) { if ( compareOverlayWithArtifact( overlay, artifact ) ) { return artifact; } } } throw new InvalidOverlayConfigurationException( STR + overlay + STR ); }
/** * Returns the Artifact associated to the specified overlay. * <p/> * If the overlay defines the current project, <tt>null</tt> is * returned. If no artifact could not be found for the overlay * a InvalidOverlayConfigurationException is thrown. * * @param overlay an overlay * @return the artifact associated to the overlay * @throws org.apache.maven.plugin.war.overlay.InvalidOverlayConfigurationException * if the overlay does not have an associated artifact */
Returns the Artifact associated to the specified overlay. If the overlay defines the current project, null is returned. If no artifact could not be found for the overlay a InvalidOverlayConfigurationException is thrown
getAssociatedArtifact
{ "repo_name": "dmlloyd/maven-plugins", "path": "maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java", "license": "apache-2.0", "size": 8944 }
[ "java.util.Set", "org.apache.maven.artifact.Artifact", "org.apache.maven.plugin.war.Overlay" ]
import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.war.Overlay;
import java.util.*; import org.apache.maven.artifact.*; import org.apache.maven.plugin.war.*;
[ "java.util", "org.apache.maven" ]
java.util; org.apache.maven;
2,241,244
private static boolean codecNeedsDiscardChannelsWorkaround(String codecName) { // The workaround applies to Samsung Galaxy S6 and Samsung Galaxy S7. return Util.SDK_INT < 24 && "OMX.SEC.aac.dec".equals(codecName) && "samsung".equals(Util.MANUFACTURER) && (Util.DEVICE.startsWith("zeroflte") || Util.DEVICE.startsWith("herolte") || Util.DEVICE.startsWith("heroqlte")); }
static boolean function(String codecName) { return Util.SDK_INT < 24 && STR.equals(codecName) && STR.equals(Util.MANUFACTURER) && (Util.DEVICE.startsWith(STR) Util.DEVICE.startsWith(STR) Util.DEVICE.startsWith(STR)); }
/** * Returns whether the decoder is known to output six audio channels when provided with input with * fewer than six channels. * <p> * See [Internal: b/35655036]. */
Returns whether the decoder is known to output six audio channels when provided with input with fewer than six channels. See [Internal: b/35655036]
codecNeedsDiscardChannelsWorkaround
{ "repo_name": "superbderrick/ExoPlayer", "path": "library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java", "license": "apache-2.0", "size": 42299 }
[ "com.google.android.exoplayer2.util.Util" ]
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.util.*;
[ "com.google.android" ]
com.google.android;
1,274,257
@HiveDecimalWritableVersionV1 @Override public void write(DataOutput out) throws IOException { if (!isSet()) { throw new RuntimeException("no value set"); } if (internalScratchLongs == null) { internalScratchLongs = new long[FastHiveDecimal.FAST_SCRATCH_LONGS_LEN]; internalScratchBuffer = new byte[FastHiveDecimal.FAST_SCRATCH_BUFFER_LEN_BIG_INTEGER_BYTES]; } write(out, internalScratchLongs, internalScratchBuffer); }
@HiveDecimalWritableVersionV1 void function(DataOutput out) throws IOException { if (!isSet()) { throw new RuntimeException(STR); } if (internalScratchLongs == null) { internalScratchLongs = new long[FastHiveDecimal.FAST_SCRATCH_LONGS_LEN]; internalScratchBuffer = new byte[FastHiveDecimal.FAST_SCRATCH_BUFFER_LEN_BIG_INTEGER_BYTES]; } write(out, internalScratchLongs, internalScratchBuffer); }
/** * Standard Writable method that serialize the fields of this object to a DataOutput. * */
Standard Writable method that serialize the fields of this object to a DataOutput
write
{ "repo_name": "vergilchiu/hive", "path": "storage-api/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java", "license": "apache-2.0", "size": 26923 }
[ "java.io.DataOutput", "java.io.IOException", "org.apache.hadoop.hive.common.type.FastHiveDecimal" ]
import java.io.DataOutput; import java.io.IOException; import org.apache.hadoop.hive.common.type.FastHiveDecimal;
import java.io.*; import org.apache.hadoop.hive.common.type.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,013,084
EnrolmentInfo getEnrolment(DeviceIdentifier deviceId, int tenantId) throws DeviceManagementDAOException;
EnrolmentInfo getEnrolment(DeviceIdentifier deviceId, int tenantId) throws DeviceManagementDAOException;
/** * This method is used to retrieve current enrollment of a given device. * * @param deviceId device id. * @param tenantId tenant id. * @return returns EnrolmentInfo object. * @throws DeviceManagementDAOException */
This method is used to retrieve current enrollment of a given device
getEnrolment
{ "repo_name": "prithvi66/carbon-device-mgt", "path": "components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java", "license": "apache-2.0", "size": 16585 }
[ "org.wso2.carbon.device.mgt.common.DeviceIdentifier", "org.wso2.carbon.device.mgt.common.EnrolmentInfo" ]
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,783,543
@RequirePOST public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { Jenkins.get().checkPermission(Jenkins.ADMINISTER); if(req.hasParameter("no")) { disable(true); rsp.sendRedirect(req.getContextPath()+"/manage"); } else { rsp.sendRedirect(req.getContextPath()+"/newView"); } }
void function(StaplerRequest req, StaplerResponse rsp) throws IOException { Jenkins.get().checkPermission(Jenkins.ADMINISTER); if(req.hasParameter("no")) { disable(true); rsp.sendRedirect(req.getContextPath()+STR); } else { rsp.sendRedirect(req.getContextPath()+STR); } }
/** * Depending on whether the user said "yes" or "no", send him to the right place. */
Depending on whether the user said "yes" or "no", send him to the right place
doAct
{ "repo_name": "rsandell/jenkins", "path": "core/src/main/java/hudson/diagnosis/TooManyJobsButNoView.java", "license": "mit", "size": 2947 }
[ "java.io.IOException", "org.kohsuke.stapler.StaplerRequest", "org.kohsuke.stapler.StaplerResponse" ]
import java.io.IOException; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse;
import java.io.*; import org.kohsuke.stapler.*;
[ "java.io", "org.kohsuke.stapler" ]
java.io; org.kohsuke.stapler;
657,467
protected void addDistribution_energyPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Substation_distribution_energy_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Substation_distribution_energy_feature", "_UI_Substation_type"), VisGridPackage.eINSTANCE.getSubstation_Distribution_energy(), 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), VisGridPackage.eINSTANCE.getSubstation_Distribution_energy(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Distribution energy feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Distribution energy feature.
addDistribution_energyPropertyDescriptor
{ "repo_name": "mikesligo/visGrid", "path": "ie.tcd.gmf.visGrid.edit/src/visGrid/provider/SubstationItemProvider.java", "license": "gpl-3.0", "size": 29813 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,354,124
@SuppressWarnings("unchecked") public T setHeaders(final Map<String, List<String>> headers) { this.headers = headers; return (T) this; }
@SuppressWarnings(STR) T function(final Map<String, List<String>> headers) { this.headers = headers; return (T) this; }
/** * Sets all of the headers in one call. * * @param headers * A Map of headers, where the header name is a String, and the value is a List of one or more values. * @return this Message, to support chained method calls */
Sets all of the headers in one call
setHeaders
{ "repo_name": "hyperwallet/java-sdk", "path": "src/main/java/com/hyperwallet/clientsdk/util/Message.java", "license": "mit", "size": 4191 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,242,443
// // BookmarksXMLLoader // public T load(Class docClass) throws IOException { final InputStream in = getClass().getResourceAsStream("/" + uri.getPath()); if (in == null) { errors.add(new Error(0, Error.ERROR_SEVERITY.FATAL, "Cannot find resource: " + uri)); throw new FileNotFoundException("Cannot find resource: " + uri); } try { return load(docClass, in); } finally { in.close(); } }
T function(Class docClass) throws IOException { final InputStream in = getClass().getResourceAsStream("/" + uri.getPath()); if (in == null) { errors.add(new Error(0, Error.ERROR_SEVERITY.FATAL, STR + uri)); throw new FileNotFoundException(STR + uri); } try { return load(docClass, in); } finally { in.close(); } }
/** * Load bookmarks into a action list. * * @throws IOException If an I/O error occurred. * @throws FileNotFoundException If the resource was not found. */
Load bookmarks into a action list
load
{ "repo_name": "isa-group/SEDL", "path": "modules/SEDL-core/src/main/java/es/us/isa/sedl/core/util/xml/XMLUnmarshaller.java", "license": "gpl-2.0", "size": 3254 }
[ "es.us.isa.sedl.core.util.Error", "java.io.FileNotFoundException", "java.io.IOException", "java.io.InputStream" ]
import es.us.isa.sedl.core.util.Error; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream;
import es.us.isa.sedl.core.util.*; import java.io.*;
[ "es.us.isa", "java.io" ]
es.us.isa; java.io;
1,701,044
MockContext.initContext(); FileField field = new FileField("name"); String value = "<script>"; String expected = "&lt;script&gt;"; field.setValue(value); assertTrue(field.toString().indexOf(expected) > 1); // Check that the value <script> is not rendered assertTrue(field.toString().indexOf(value) < 0); }
MockContext.initContext(); FileField field = new FileField("name"); String value = STR; String expected = STR; field.setValue(value); assertTrue(field.toString().indexOf(expected) > 1); assertTrue(field.toString().indexOf(value) < 0); }
/** * Check that FileField value is escaped. This protects against * cross-site scripting attacks (XSS). */
Check that FileField value is escaped. This protects against cross-site scripting attacks (XSS)
testEscapeValue
{ "repo_name": "medgar/click", "path": "framework/test/org/apache/click/control/FileFieldTest.java", "license": "apache-2.0", "size": 2994 }
[ "org.apache.click.MockContext" ]
import org.apache.click.MockContext;
import org.apache.click.*;
[ "org.apache.click" ]
org.apache.click;
515,261
public static ExpectedCondition<Boolean> attributeContains(final By locator, final String attribute, final String value) { return new ExpectedCondition<Boolean>() { private String currentValue = null;
static ExpectedCondition<Boolean> function(final By locator, final String attribute, final String value) { return new ExpectedCondition<Boolean>() { private String currentValue = null;
/** * An expectation for checking WebElement with given locator has attribute which contains specific * value * * @param locator used to define WebElement to check its parameters * @param attribute used to define css or html attribute * @param value used as expected attribute value * @return Boolean true when element has css or html attribute which contains the value */
An expectation for checking WebElement with given locator has attribute which contains specific value
attributeContains
{ "repo_name": "xmhubj/selenium", "path": "java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java", "license": "apache-2.0", "size": 50692 }
[ "org.openqa.selenium.By" ]
import org.openqa.selenium.By;
import org.openqa.selenium.*;
[ "org.openqa.selenium" ]
org.openqa.selenium;
1,260,882
if (!versionMeetsMinimum(5, 0)) { return; } createTable("testCoordination", "(field1 int) ENGINE=InnoDB"); Connection conn1 = null; Connection conn2 = null; XAConnection xaConn1 = null; XAConnection xaConn2 = null; try { xaConn1 = getXAConnection(); XAResource xaRes1 = xaConn1.getXAResource(); conn1 = xaConn1.getConnection(); xaConn2 = getXAConnection(); XAResource xaRes2 = xaConn2.getXAResource(); conn2 = xaConn2.getConnection(); Xid xid1 = createXid(); Xid xid2 = createXid(xid1); xaRes1.start(xid1, XAResource.TMNOFLAGS); xaRes2.start(xid2, XAResource.TMNOFLAGS); conn1.createStatement().executeUpdate("INSERT INTO testCoordination VALUES (1)"); conn2.createStatement().executeUpdate("INSERT INTO testCoordination VALUES (2)"); xaRes1.end(xid1, XAResource.TMSUCCESS); xaRes2.end(xid2, XAResource.TMSUCCESS); xaRes1.prepare(xid1); xaRes2.prepare(xid2); xaRes1.commit(xid1, false); xaRes2.commit(xid2, false); this.rs = this.stmt.executeQuery("SELECT field1 FROM testCoordination ORDER BY field1"); assertTrue(this.rs.next()); assertEquals(1, this.rs.getInt(1)); assertTrue(this.rs.next()); assertEquals(2, this.rs.getInt(1)); this.stmt.executeUpdate("TRUNCATE TABLE testCoordination"); // // Now test rollback // xid1 = createXid(); xid2 = createXid(xid1); xaRes1.start(xid1, XAResource.TMNOFLAGS); xaRes2.start(xid2, XAResource.TMNOFLAGS); conn1.createStatement().executeUpdate("INSERT INTO testCoordination VALUES (1)"); // ensure visibility assertEquals("1", getSingleIndexedValueWithQuery(conn1, 1, "SELECT field1 FROM testCoordination WHERE field1=1").toString()); conn2.createStatement().executeUpdate("INSERT INTO testCoordination VALUES (2)"); // ensure visibility assertEquals("2", getSingleIndexedValueWithQuery(conn2, 1, "SELECT field1 FROM testCoordination WHERE field1=2").toString()); xaRes1.end(xid1, XAResource.TMSUCCESS); xaRes2.end(xid2, XAResource.TMSUCCESS); xaRes1.prepare(xid1); xaRes2.prepare(xid2); xaRes1.rollback(xid1); xaRes2.rollback(xid2); this.rs = this.stmt.executeQuery("SELECT field1 FROM testCoordination ORDER BY field1"); assertTrue(!this.rs.next()); } finally { if (conn1 != null) { conn1.close(); } if (conn2 != null) { conn2.close(); } if (xaConn1 != null) { xaConn1.close(); } if (xaConn2 != null) { xaConn2.close(); } } }
if (!versionMeetsMinimum(5, 0)) { return; } createTable(STR, STR); Connection conn1 = null; Connection conn2 = null; XAConnection xaConn1 = null; XAConnection xaConn2 = null; try { xaConn1 = getXAConnection(); XAResource xaRes1 = xaConn1.getXAResource(); conn1 = xaConn1.getConnection(); xaConn2 = getXAConnection(); XAResource xaRes2 = xaConn2.getXAResource(); conn2 = xaConn2.getConnection(); Xid xid1 = createXid(); Xid xid2 = createXid(xid1); xaRes1.start(xid1, XAResource.TMNOFLAGS); xaRes2.start(xid2, XAResource.TMNOFLAGS); conn1.createStatement().executeUpdate(STR); conn2.createStatement().executeUpdate(STR); xaRes1.end(xid1, XAResource.TMSUCCESS); xaRes2.end(xid2, XAResource.TMSUCCESS); xaRes1.prepare(xid1); xaRes2.prepare(xid2); xaRes1.commit(xid1, false); xaRes2.commit(xid2, false); this.rs = this.stmt.executeQuery(STR); assertTrue(this.rs.next()); assertEquals(1, this.rs.getInt(1)); assertTrue(this.rs.next()); assertEquals(2, this.rs.getInt(1)); this.stmt.executeUpdate(STR); xid1 = createXid(); xid2 = createXid(xid1); xaRes1.start(xid1, XAResource.TMNOFLAGS); xaRes2.start(xid2, XAResource.TMNOFLAGS); conn1.createStatement().executeUpdate(STR); assertEquals("1", getSingleIndexedValueWithQuery(conn1, 1, STR).toString()); conn2.createStatement().executeUpdate(STR); assertEquals("2", getSingleIndexedValueWithQuery(conn2, 1, STR).toString()); xaRes1.end(xid1, XAResource.TMSUCCESS); xaRes2.end(xid2, XAResource.TMSUCCESS); xaRes1.prepare(xid1); xaRes2.prepare(xid2); xaRes1.rollback(xid1); xaRes2.rollback(xid2); this.rs = this.stmt.executeQuery(STR); assertTrue(!this.rs.next()); } finally { if (conn1 != null) { conn1.close(); } if (conn2 != null) { conn2.close(); } if (xaConn1 != null) { xaConn1.close(); } if (xaConn2 != null) { xaConn2.close(); } } }
/** * Tests that simple distributed transaction processing works as expected. * * @throws Exception * if the test fails. */
Tests that simple distributed transaction processing works as expected
testCoordination
{ "repo_name": "yyuu/libmysql-java", "path": "src/testsuite/simple/XATest.java", "license": "gpl-2.0", "size": 13254 }
[ "java.sql.Connection", "javax.sql.XAConnection", "javax.transaction.xa.XAResource", "javax.transaction.xa.Xid" ]
import java.sql.Connection; import javax.sql.XAConnection; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid;
import java.sql.*; import javax.sql.*; import javax.transaction.xa.*;
[ "java.sql", "javax.sql", "javax.transaction" ]
java.sql; javax.sql; javax.transaction;
919,401
public final Markup getMarkup(final MarkupContainer container, final Class<?> clazz, final boolean enforceReload) { Class<?> containerClass = clazz; if (clazz == null) { containerClass = container.getClass(); } else if (!clazz.isAssignableFrom(container.getClass())) { throw new WicketRuntimeException("Parameter clazz must be an instance of " + container.getClass().getName() + ", but is a " + clazz.getName()); } // Get the cache key to be associated with the markup resource stream final String cacheKey = getMarkupCacheKeyProvider(container).getCacheKey(container, containerClass); // Is the markup already in the cache? Markup markup = (enforceReload == false ? getMarkupFromCache(cacheKey, container) : null); if (markup == null) { if (log.isDebugEnabled()) { log.debug("Load markup: cacheKey=" + cacheKey); } // Who is going to provide the markup resource stream? // And ask the provider to locate the markup resource stream final IResourceStream resourceStream = getMarkupResourceStreamProvider(container).getMarkupResourceStream( container, containerClass); // Found markup? if (resourceStream != null) { final MarkupResourceStream markupResourceStream; if (resourceStream instanceof MarkupResourceStream) { markupResourceStream = (MarkupResourceStream)resourceStream; } else { markupResourceStream = new MarkupResourceStream(resourceStream, new ContainerInfo(container), containerClass); } markupResourceStream.setCacheKey(cacheKey); // load the markup and watch for changes markup = loadMarkupAndWatchForChanges(container, markupResourceStream, enforceReload); } else { markup = onMarkupNotFound(cacheKey, container); } } return markup; }
final Markup function(final MarkupContainer container, final Class<?> clazz, final boolean enforceReload) { Class<?> containerClass = clazz; if (clazz == null) { containerClass = container.getClass(); } else if (!clazz.isAssignableFrom(container.getClass())) { throw new WicketRuntimeException(STR + container.getClass().getName() + STR + clazz.getName()); } final String cacheKey = getMarkupCacheKeyProvider(container).getCacheKey(container, containerClass); Markup markup = (enforceReload == false ? getMarkupFromCache(cacheKey, container) : null); if (markup == null) { if (log.isDebugEnabled()) { log.debug(STR + cacheKey); } final IResourceStream resourceStream = getMarkupResourceStreamProvider(container).getMarkupResourceStream( container, containerClass); if (resourceStream != null) { final MarkupResourceStream markupResourceStream; if (resourceStream instanceof MarkupResourceStream) { markupResourceStream = (MarkupResourceStream)resourceStream; } else { markupResourceStream = new MarkupResourceStream(resourceStream, new ContainerInfo(container), containerClass); } markupResourceStream.setCacheKey(cacheKey); markup = loadMarkupAndWatchForChanges(container, markupResourceStream, enforceReload); } else { markup = onMarkupNotFound(cacheKey, container); } } return markup; }
/** * THIS IS NOT PART OF WICKET'S PUBLIC API. DO NOT USE IT. * * I still don't like this method being part of the API but I didn't find a suitable other * solution. * * @see org.apache.wicket.markup.IMarkupCache#getMarkup(org.apache.wicket.MarkupContainer, * java.lang.Class, boolean) */
THIS IS NOT PART OF WICKET'S PUBLIC API. DO NOT USE IT. I still don't like this method being part of the API but I didn't find a suitable other solution
getMarkup
{ "repo_name": "Servoy/wicket", "path": "wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java", "license": "apache-2.0", "size": 22301 }
[ "org.apache.wicket.MarkupContainer", "org.apache.wicket.WicketRuntimeException", "org.apache.wicket.util.resource.IResourceStream" ]
import org.apache.wicket.MarkupContainer; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.util.resource.IResourceStream;
import org.apache.wicket.*; import org.apache.wicket.util.resource.*;
[ "org.apache.wicket" ]
org.apache.wicket;
2,052,615
public void resetToDefault(TreeTableNode node) { if (node == null) { node = root; } if (node instanceof DataTypePropertiesTableNode) { DataTypePropertiesTableNode tableNode = (DataTypePropertiesTableNode) node; tableNode.resetToDefault(); } for (int i = 0; i < node.getChildCount(); i++) { resetToDefault(node.getChildAt(i)); } }
void function(TreeTableNode node) { if (node == null) { node = root; } if (node instanceof DataTypePropertiesTableNode) { DataTypePropertiesTableNode tableNode = (DataTypePropertiesTableNode) node; tableNode.resetToDefault(); } for (int i = 0; i < node.getChildCount(); i++) { resetToDefault(node.getChildAt(i)); } }
/** * Resets the node and all of its children to the data type's default values */
Resets the node and all of its children to the data type's default values
resetToDefault
{ "repo_name": "encapturemd/MirthConnect", "path": "client/src/com/mirth/connect/client/ui/DataTypePropertiesTableModel.java", "license": "mpl-2.0", "size": 8582 }
[ "org.jdesktop.swingx.treetable.TreeTableNode" ]
import org.jdesktop.swingx.treetable.TreeTableNode;
import org.jdesktop.swingx.treetable.*;
[ "org.jdesktop.swingx" ]
org.jdesktop.swingx;
2,496,423
public Observable<ServiceResponse<Void>> putUtcMaxDateTimeAsync(DateTime datetimeBody) { if (datetimeBody == null) { throw new IllegalArgumentException("Parameter datetimeBody is required and cannot be null."); }
Observable<ServiceResponse<Void>> function(DateTime datetimeBody) { if (datetimeBody == null) { throw new IllegalArgumentException(STR); }
/** * Put max datetime value 9999-12-31T23:59:59.9999999Z. * * @param datetimeBody the DateTime value * @return the {@link ServiceResponse} object if successful. */
Put max datetime value 9999-12-31T23:59:59.9999999Z
putUtcMaxDateTimeAsync
{ "repo_name": "haocs/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydatetime/implementation/DatetimesImpl.java", "license": "mit", "size": 50464 }
[ "com.microsoft.rest.ServiceResponse", "org.joda.time.DateTime" ]
import com.microsoft.rest.ServiceResponse; import org.joda.time.DateTime;
import com.microsoft.rest.*; import org.joda.time.*;
[ "com.microsoft.rest", "org.joda.time" ]
com.microsoft.rest; org.joda.time;
953,205
@Override public VcfEmission next() { if (!hasNext()) { throw new NoSuchElementException(); } VcfRecord nextRecord = it.next(); if (nextRecord.hasFormat("PGP")){ return new PGPRefGT(nextRecord); } else return new BitSetRefGT(nextRecord); }
VcfEmission function() { if (!hasNext()) { throw new NoSuchElementException(); } VcfRecord nextRecord = it.next(); if (nextRecord.hasFormat("PGP")){ return new PGPRefGT(nextRecord); } else return new BitSetRefGT(nextRecord); }
/** * Returns the next element in the iteration. * @return the next element in the iteration. * @throws NoSuchElementException if the iteration has no more elements. * * @throws IllegalArgumentException if the next VCF record * does not have a "GT" format field, has a missing allele, or * has an unphased genotype. */
Returns the next element in the iteration
next
{ "repo_name": "tfwillems/PhasedBEAGLE", "path": "vcf/VcfRefIterator.java", "license": "gpl-3.0", "size": 3172 }
[ "java.util.NoSuchElementException" ]
import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
740,399
public void setFantasyFontFamily(String font) { if (TRACE) Log.i(LOGTAG, "setFantasyFontFamily=" + font); synchronized (mAwSettingsLock) { if (font != null && !mFantasyFontFamily.equals(font)) { mFantasyFontFamily = font; mEventHandler.updateWebkitPreferencesLocked(); } } }
void function(String font) { if (TRACE) Log.i(LOGTAG, STR + font); synchronized (mAwSettingsLock) { if (font != null && !mFantasyFontFamily.equals(font)) { mFantasyFontFamily = font; mEventHandler.updateWebkitPreferencesLocked(); } } }
/** * See {@link android.webkit.WebSettings#setFantasyFontFamily}. */
See <code>android.webkit.WebSettings#setFantasyFontFamily</code>
setFantasyFontFamily
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/android_webview/java/src/org/chromium/android_webview/AwSettings.java", "license": "bsd-3-clause", "size": 65230 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,318,889
Future<Void> thenAcceptAsync(AcceptFunction<? super T> acceptFunction, Executor executor);
Future<Void> thenAcceptAsync(AcceptFunction<? super T> acceptFunction, Executor executor);
/** * Applies the accept function to the value of the future. Unlike the {@link ApplyFunction}, the * {@link AcceptFunction} does not return a value. The returned future, thus, represents only * the completion of the accept callback. * <p> * The accept function is executed asynchronously by the given executor. * * @param acceptFunction function to apply to the future's value * @param executor used to execute the given apply function asynchronously * @return future representing the completion of the accept callback */
Applies the accept function to the value of the future. Unlike the <code>ApplyFunction</code>, the <code>AcceptFunction</code> does not return a value. The returned future, thus, represents only the completion of the accept callback. The accept function is executed asynchronously by the given executor
thenAcceptAsync
{ "repo_name": "WangTaoTheTonic/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/Future.java", "license": "apache-2.0", "size": 11467 }
[ "java.util.concurrent.Executor" ]
import java.util.concurrent.Executor;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,149,811
public void setMinutes(int intMinutes) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setMinutes", intMinutes); ScriptSessions.addScript(script); }
void function(int intMinutes) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + STR, intMinutes); ScriptSessions.addScript(script); }
/** * Sets the minute value of this time picker. This method updates the view immediately. * @param intMinutes 0-59. */
Sets the minute value of this time picker. This method updates the view immediately
setMinutes
{ "repo_name": "burris/dwr", "path": "ui/gi/generated/java/jsx3/gui/TimePicker.java", "license": "apache-2.0", "size": 39659 }
[ "org.directwebremoting.ScriptBuffer", "org.directwebremoting.ScriptSessions" ]
import org.directwebremoting.ScriptBuffer; import org.directwebremoting.ScriptSessions;
import org.directwebremoting.*;
[ "org.directwebremoting" ]
org.directwebremoting;
1,199,124
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { WireFormatInfo info = (WireFormatInfo)o; info.beforeMarshall(wireFormat); int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8); rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs); return rc + 4; }
int function(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { WireFormatInfo info = (WireFormatInfo)o; info.beforeMarshall(wireFormat); int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8); rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs); return rc + 4; }
/** * Write the booleans that this object uses to a BooleanStream */
Write the booleans that this object uses to a BooleanStream
tightMarshal1
{ "repo_name": "Mark-Booth/daq-eclipse", "path": "uk.ac.diamond.org.apache.activemq/org/apache/activemq/openwire/v3/WireFormatInfoMarshaller.java", "license": "epl-1.0", "size": 5147 }
[ "java.io.IOException", "org.apache.activemq.command.WireFormatInfo", "org.apache.activemq.openwire.BooleanStream", "org.apache.activemq.openwire.OpenWireFormat" ]
import java.io.IOException; import org.apache.activemq.command.WireFormatInfo; import org.apache.activemq.openwire.BooleanStream; import org.apache.activemq.openwire.OpenWireFormat;
import java.io.*; import org.apache.activemq.command.*; import org.apache.activemq.openwire.*;
[ "java.io", "org.apache.activemq" ]
java.io; org.apache.activemq;
80,246
private String getPcepTunnelKey(TunnelId tunnelId) { for (String key : tunnelMap.keySet()) { if (tunnelMap.get(key).id() == tunnelId.id()) { return key; } } return null; }
String function(TunnelId tunnelId) { for (String key : tunnelMap.keySet()) { if (tunnelMap.get(key).id() == tunnelId.id()) { return key; } } return null; }
/** * Get the tunnel key according to the tunnelID. * * @param tunnelId tunnel id * @return corresponding a tunnel key of the tunnel id. */
Get the tunnel key according to the tunnelID
getPcepTunnelKey
{ "repo_name": "harikrushna-Huawei/hackathon", "path": "providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java", "license": "apache-2.0", "size": 87555 }
[ "org.onlab.util.Tools", "org.onosproject.incubator.net.tunnel.TunnelId" ]
import org.onlab.util.Tools; import org.onosproject.incubator.net.tunnel.TunnelId;
import org.onlab.util.*; import org.onosproject.incubator.net.tunnel.*;
[ "org.onlab.util", "org.onosproject.incubator" ]
org.onlab.util; org.onosproject.incubator;
1,727,252
void suspend(String resourceGroupName, String dedicatedCapacityName, Context context);
void suspend(String resourceGroupName, String dedicatedCapacityName, Context context);
/** * Suspends operation of the specified dedicated capacity instance. * * @param resourceGroupName The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. * This name must be at least 1 character in length, and no more than 90. * @param dedicatedCapacityName The name of the Dedicated capacity. It must be at least 3 characters in length, and * no more than 63. * @param context The context to associate with this operation. * @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. */
Suspends operation of the specified dedicated capacity instance
suspend
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/powerbidedicated/azure-resourcemanager-powerbidedicated/src/main/java/com/azure/resourcemanager/powerbidedicated/models/Capacities.java", "license": "mit", "size": 17073 }
[ "com.azure.core.util.Context" ]
import com.azure.core.util.Context;
import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
1,232,786
@Test public void testSourceMac() throws Exception { isisHeader.setSourceMac(macAddress); result1 = isisHeader.sourceMac(); assertThat(result1, is(macAddress)); }
void function() throws Exception { isisHeader.setSourceMac(macAddress); result1 = isisHeader.sourceMac(); assertThat(result1, is(macAddress)); }
/** * Tests sourceMac() getter method. */
Tests sourceMac() getter method
testSourceMac
{ "repo_name": "harikrushna-Huawei/hackathon", "path": "protocols/isis/isisio/src/test/java/org/onosproject/isis/io/isispacket/IsisHeaderTest.java", "license": "apache-2.0", "size": 8318 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
import org.hamcrest.*;
[ "org.hamcrest" ]
org.hamcrest;
1,334,097
@SkipForRepeat({ EE8_FEATURES }) @Test public void CxfSAMLWSSTemplatesTests_Saml20TokenOverSSL_httpFromClientEE7Only() throws Exception { WebClient webClient = SAMLCommonTestHelpers.getWebClient(); SAMLTestSettings updatedTestSettings = testSettings.copyTestSettings(); updatedTestSettings.updatePartnerInSettings("sp1", true); updatedTestSettings.setSpTargetApp(testSAMLServer.getHttpsString() + "/samlwsstemplatesclient/CxfWssSAMLTemplatesSvcClient"); updatedTestSettings.setCXFSettings(_testName, null, servicePort, null, "user1", "user1pwd", "WSSTemplatesService2", "WSSTemplate2", "", "False", null, null); updatedTestSettings.getCXFSettings().setTitleToCheck(SAMLConstants.CXF_SAML_TOKEN_WSS_SERVLET); genericSAML(_testName, webClient, updatedTestSettings, standardFlow, helpers.setErrorSAMLCXFExpectations(null, flowType, updatedTestSettings, SAMLConstants.CXF_SAML_TOKEN_SERVICE_HTTPS_NOT_USED)); }
@SkipForRepeat({ EE8_FEATURES }) void function() throws Exception { WebClient webClient = SAMLCommonTestHelpers.getWebClient(); SAMLTestSettings updatedTestSettings = testSettings.copyTestSettings(); updatedTestSettings.updatePartnerInSettings("sp1", true); updatedTestSettings.setSpTargetApp(testSAMLServer.getHttpsString() + STR); updatedTestSettings.setCXFSettings(_testName, null, servicePort, null, "user1", STR, STR, STR, STRFalse", null, null); updatedTestSettings.getCXFSettings().setTitleToCheck(SAMLConstants.CXF_SAML_TOKEN_WSS_SERVLET); genericSAML(_testName, webClient, updatedTestSettings, standardFlow, helpers.setErrorSAMLCXFExpectations(null, flowType, updatedTestSettings, SAMLConstants.CXF_SAML_TOKEN_SERVICE_HTTPS_NOT_USED)); }
/** * TestDescription: * Client matches server side policy (transport enabled), but * the client doesn't use https * Test should fail to accessing the server side service. * */
TestDescription: Client matches server side policy (transport enabled), but the client doesn't use https Test should fail to accessing the server side service
CxfSAMLWSSTemplatesTests_Saml20TokenOverSSL_httpFromClientEE7Only
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.wssecurity_fat.wsscxf.saml.1/fat/src/com/ibm/ws/wssecurity/fat/cxf/samltoken1/common/CxfSAMLWSSTemplatesTests.java", "license": "epl-1.0", "size": 27423 }
[ "com.gargoylesoftware.htmlunit.WebClient", "com.ibm.ws.security.saml20.fat.commonTest.SAMLCommonTestHelpers", "com.ibm.ws.security.saml20.fat.commonTest.SAMLConstants", "com.ibm.ws.security.saml20.fat.commonTest.SAMLTestSettings" ]
import com.gargoylesoftware.htmlunit.WebClient; import com.ibm.ws.security.saml20.fat.commonTest.SAMLCommonTestHelpers; import com.ibm.ws.security.saml20.fat.commonTest.SAMLConstants; import com.ibm.ws.security.saml20.fat.commonTest.SAMLTestSettings;
import com.gargoylesoftware.htmlunit.*; import com.ibm.ws.security.saml20.fat.*;
[ "com.gargoylesoftware.htmlunit", "com.ibm.ws" ]
com.gargoylesoftware.htmlunit; com.ibm.ws;
1,873,703
public VirtualNetworkGatewayIPConfiguration withSubnet(SubResource subnet) { this.subnet = subnet; return this; }
VirtualNetworkGatewayIPConfiguration function(SubResource subnet) { this.subnet = subnet; return this; }
/** * Set the reference to the subnet resource. * * @param subnet the subnet value to set * @return the VirtualNetworkGatewayIPConfiguration object itself. */
Set the reference to the subnet resource
withSubnet
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/VirtualNetworkGatewayIPConfiguration.java", "license": "mit", "size": 5272 }
[ "com.microsoft.azure.SubResource" ]
import com.microsoft.azure.SubResource;
import com.microsoft.azure.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,159,467
@Test public void testPrivateField4() { final Object result = JField.jStaticFieldX(XLString.of("com.mcleodmoores.xl4j.v1.javacode.testutils.TestObject"), XLString.of("PRIVATE_FIELD")); assertSame(result, XLError.Null); }
void function() { final Object result = JField.jStaticFieldX(XLString.of(STR), XLString.of(STR)); assertSame(result, XLError.Null); }
/** * Tests the case where the field is not visible. */
Tests the case where the field is not visible
testPrivateField4
{ "repo_name": "McLeodMoores/xl4j", "path": "xll-java/src/test/java/com/mcleodmoores/xl4j/v1/javacode/JFieldTest.java", "license": "gpl-3.0", "size": 5671 }
[ "com.mcleodmoores.xl4j.v1.api.values.XLError", "com.mcleodmoores.xl4j.v1.api.values.XLString", "org.testng.Assert" ]
import com.mcleodmoores.xl4j.v1.api.values.XLError; import com.mcleodmoores.xl4j.v1.api.values.XLString; import org.testng.Assert;
import com.mcleodmoores.xl4j.v1.api.values.*; import org.testng.*;
[ "com.mcleodmoores.xl4j", "org.testng" ]
com.mcleodmoores.xl4j; org.testng;
876,691
@Post public void upload(Representation entity) { if (entity != null) { if (MediaType.MULTIPART_FORM_DATA.equals(entity.getMediaType(), true)) { // The Apache FileUpload project parses HTTP requests which // conform to RFC 1867, "Form-based File Upload in HTML". That // is, if an HTTP request is submitted using the POST method, // and with a content type of "multipart/form-data", then // FileUpload can parse that request, and get all uploaded files // as FileItem. // 1/ Create a factory for disk-based file items DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(1000240); // 2 Create a new file upload handler based on the Restlet // FileUpload extension that will parse Restlet requests and // generates FileItems. RestletFileUpload upload = new RestletFileUpload(factory); List<FileItem> items; try { // 3. Request is parsed by the handler which generates a // list of FileItems items = upload.parseRequest(getRequest()); // Process only the uploaded item called "fileToUpload" and // save it on disk boolean found = false; FileItem fi = null; for (final Iterator<FileItem> it = items.iterator(); it.hasNext() && !found;) { fi = (FileItem) it.next(); if (fi.getFieldName().equals(FORM_TAG_FILE)) { found = true; break; } } // Once handled, the content of the uploaded file is sent // back to the client. Representation rep = null; if (found) { // Create a new representation based on disk file. // The content is arbitrarily sent as plain text. rep = new StringRepresentation(fi.getString(), MediaType.TEXT_HTML); getResponse().setEntity(rep); getResponse().setStatus(Status.SUCCESS_OK); } else { rep = new StringRepresentation("No file data found", MediaType.TEXT_HTML); getResponse().setEntity(rep); getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } } catch (Exception e) { // The message of all thrown exception is sent back to // client as simple plain text getResponse().setEntity( new StringRepresentation("Upload failed: " + e.getMessage(), MediaType.TEXT_HTML)); getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } } } else { // POST request with no entity. getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } }
void function(Representation entity) { if (entity != null) { if (MediaType.MULTIPART_FORM_DATA.equals(entity.getMediaType(), true)) { DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(1000240); RestletFileUpload upload = new RestletFileUpload(factory); List<FileItem> items; try { items = upload.parseRequest(getRequest()); boolean found = false; FileItem fi = null; for (final Iterator<FileItem> it = items.iterator(); it.hasNext() && !found;) { fi = (FileItem) it.next(); if (fi.getFieldName().equals(FORM_TAG_FILE)) { found = true; break; } } Representation rep = null; if (found) { rep = new StringRepresentation(fi.getString(), MediaType.TEXT_HTML); getResponse().setEntity(rep); getResponse().setStatus(Status.SUCCESS_OK); } else { rep = new StringRepresentation(STR, MediaType.TEXT_HTML); getResponse().setEntity(rep); getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } } catch (Exception e) { getResponse().setEntity( new StringRepresentation(STR + e.getMessage(), MediaType.TEXT_HTML)); getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } } } else { getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } }
/** * Handle POST requests for file upload * @param entity entity body information (multi-part form encoded) */
Handle POST requests for file upload
upload
{ "repo_name": "SampleSizeShop/FileSvc", "path": "src/edu/cudenver/bios/filesvc/resource/UploadResource.java", "license": "gpl-2.0", "size": 5565 }
[ "java.util.Iterator", "java.util.List", "org.apache.commons.fileupload.FileItem", "org.apache.commons.fileupload.disk.DiskFileItemFactory", "org.restlet.data.MediaType", "org.restlet.data.Status", "org.restlet.ext.fileupload.RestletFileUpload", "org.restlet.representation.Representation", "org.restlet.representation.StringRepresentation" ]
import java.util.Iterator; import java.util.List; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.restlet.data.MediaType; import org.restlet.data.Status; import org.restlet.ext.fileupload.RestletFileUpload; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation;
import java.util.*; import org.apache.commons.fileupload.*; import org.apache.commons.fileupload.disk.*; import org.restlet.data.*; import org.restlet.ext.fileupload.*; import org.restlet.representation.*;
[ "java.util", "org.apache.commons", "org.restlet.data", "org.restlet.ext", "org.restlet.representation" ]
java.util; org.apache.commons; org.restlet.data; org.restlet.ext; org.restlet.representation;
2,650,403
public ServiceFuture<VirtualHubInner> updateTagsAsync(String resourceGroupName, String virtualHubName, Map<String, String> tags, final ServiceCallback<VirtualHubInner> serviceCallback) { return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, virtualHubName, tags), serviceCallback); }
ServiceFuture<VirtualHubInner> function(String resourceGroupName, String virtualHubName, Map<String, String> tags, final ServiceCallback<VirtualHubInner> serviceCallback) { return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, virtualHubName, tags), serviceCallback); }
/** * Updates VirtualHub tags. * * @param resourceGroupName The resource group name of the VirtualHub. * @param virtualHubName The name of the VirtualHub. * @param tags Resource tags. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Updates VirtualHub tags
updateTagsAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualHubsInner.java", "license": "mit", "size": 72294 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture", "java.util.Map" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.Map;
import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.rest", "java.util" ]
com.microsoft.rest; java.util;
332,715
QDevelopmentKitTestFactory getDevelopmentKitTestFactory(); interface Literals { EClass ASSERTER = eINSTANCE.getAsserter(); EClass ASSERTION_FAILED = eINSTANCE.getAssertionFailed(); EClass ASSERTION_RESULT = eINSTANCE.getAssertionResult(); EAttribute ASSERTION_RESULT__MESSAGE = eINSTANCE.getAssertionResult_Message(); EAttribute ASSERTION_RESULT__TIME = eINSTANCE.getAssertionResult_Time(); EClass ASSERTION_SUCCESS = eINSTANCE.getAssertionSuccess(); EClass TEST_ASSERTER = eINSTANCE.getTestAsserter(); EClass TEST_MANAGER = eINSTANCE.getTestManager(); EClass TEST_RESULT = eINSTANCE.getTestResult(); EAttribute TEST_RESULT__OBJECT = eINSTANCE.getTestResult_Object(); EAttribute TEST_RESULT__RUNNER = eINSTANCE.getTestResult_Runner(); EAttribute TEST_RESULT__TIME = eINSTANCE.getTestResult_Time(); EReference TEST_RESULT__ASSERT_RESULTS = eINSTANCE.getTestResult_AssertResults(); EAttribute TEST_RESULT__CATEGORY = eINSTANCE.getTestResult_Category(); EClass TEST_RUNNER = eINSTANCE.getTestRunner(); EClass TEST_RUNNER_EVENT = eINSTANCE.getTestRunnerEvent(); EReference TEST_RUNNER_EVENT__SOURCE = eINSTANCE.getTestRunnerEvent_Source(); EAttribute TEST_RUNNER_EVENT__TYPE = eINSTANCE.getTestRunnerEvent_Type(); EClass TEST_RUNNER_LISTENER = eINSTANCE.getTestRunnerListener(); EClass TEST_RUNNER_MAKER = eINSTANCE.getTestRunnerMaker(); EClass TEST_SUITE_RUNNER = eINSTANCE.getTestSuiteRunner(); EClass TEST_SUITE_LAUNCHER = eINSTANCE.getTestSuiteLauncher(); EClass TEST_UNIT_RUNNER = eINSTANCE.getTestUnitRunner(); EClass TEST_OBJECT = eINSTANCE.getTestObject(); EAttribute TEST_OBJECT__NAME = eINSTANCE.getTestObject_Name(); EAttribute TEST_OBJECT__STRING_PROPERTY = eINSTANCE.getTestObject_StringProperty(); EAttribute TEST_OBJECT__INTEGER_PROPERTY = eINSTANCE.getTestObject_IntegerProperty(); EReference TEST_OBJECT__OBJECT_REFERENCE = eINSTANCE.getTestObject_ObjectReference(); EReference TEST_OBJECT__OBJECT_REFERENCES = eINSTANCE.getTestObject_ObjectReferences(); EClass TEST_CONTAINER = eINSTANCE.getTestContainer(); EAttribute TEST_CONTAINER__NAME = eINSTANCE.getTestContainer_Name(); EEnum ASSERTION_STATE = eINSTANCE.getAssertionState(); EEnum TEST_RUNNER_EVENT_TYPE = eINSTANCE.getTestRunnerEventType(); }
QDevelopmentKitTestFactory getDevelopmentKitTestFactory(); interface Literals { EClass ASSERTER = eINSTANCE.getAsserter(); EClass ASSERTION_FAILED = eINSTANCE.getAssertionFailed(); EClass ASSERTION_RESULT = eINSTANCE.getAssertionResult(); EAttribute ASSERTION_RESULT__MESSAGE = eINSTANCE.getAssertionResult_Message(); EAttribute ASSERTION_RESULT__TIME = eINSTANCE.getAssertionResult_Time(); EClass ASSERTION_SUCCESS = eINSTANCE.getAssertionSuccess(); EClass TEST_ASSERTER = eINSTANCE.getTestAsserter(); EClass TEST_MANAGER = eINSTANCE.getTestManager(); EClass TEST_RESULT = eINSTANCE.getTestResult(); EAttribute TEST_RESULT__OBJECT = eINSTANCE.getTestResult_Object(); EAttribute TEST_RESULT__RUNNER = eINSTANCE.getTestResult_Runner(); EAttribute TEST_RESULT__TIME = eINSTANCE.getTestResult_Time(); EReference TEST_RESULT__ASSERT_RESULTS = eINSTANCE.getTestResult_AssertResults(); EAttribute TEST_RESULT__CATEGORY = eINSTANCE.getTestResult_Category(); EClass TEST_RUNNER = eINSTANCE.getTestRunner(); EClass TEST_RUNNER_EVENT = eINSTANCE.getTestRunnerEvent(); EReference TEST_RUNNER_EVENT__SOURCE = eINSTANCE.getTestRunnerEvent_Source(); EAttribute TEST_RUNNER_EVENT__TYPE = eINSTANCE.getTestRunnerEvent_Type(); EClass TEST_RUNNER_LISTENER = eINSTANCE.getTestRunnerListener(); EClass TEST_RUNNER_MAKER = eINSTANCE.getTestRunnerMaker(); EClass TEST_SUITE_RUNNER = eINSTANCE.getTestSuiteRunner(); EClass TEST_SUITE_LAUNCHER = eINSTANCE.getTestSuiteLauncher(); EClass TEST_UNIT_RUNNER = eINSTANCE.getTestUnitRunner(); EClass TEST_OBJECT = eINSTANCE.getTestObject(); EAttribute TEST_OBJECT__NAME = eINSTANCE.getTestObject_Name(); EAttribute TEST_OBJECT__STRING_PROPERTY = eINSTANCE.getTestObject_StringProperty(); EAttribute TEST_OBJECT__INTEGER_PROPERTY = eINSTANCE.getTestObject_IntegerProperty(); EReference TEST_OBJECT__OBJECT_REFERENCE = eINSTANCE.getTestObject_ObjectReference(); EReference TEST_OBJECT__OBJECT_REFERENCES = eINSTANCE.getTestObject_ObjectReferences(); EClass TEST_CONTAINER = eINSTANCE.getTestContainer(); EAttribute TEST_CONTAINER__NAME = eINSTANCE.getTestContainer_Name(); EEnum ASSERTION_STATE = eINSTANCE.getAssertionState(); EEnum TEST_RUNNER_EVENT_TYPE = eINSTANCE.getTestRunnerEventType(); }
/** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the factory that creates the instances of the model. * @generated */
Returns the factory that creates the instances of the model.
getDevelopmentKitTestFactory
{ "repo_name": "smeup/asup", "path": "org.smeup.sys.dk.test/src/org/smeup/sys/dk/test/QDevelopmentKitTestPackage.java", "license": "epl-1.0", "size": 40251 }
[ "org.eclipse.emf.ecore.EAttribute", "org.eclipse.emf.ecore.EClass", "org.eclipse.emf.ecore.EEnum", "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
513,938
EntryWriter put(CharSequence k, Object v) throws IOException;
EntryWriter put(CharSequence k, Object v) throws IOException;
/** * Writes a key value into the map * * @param k The key * @param v The value can be any supported object */
Writes a key value into the map
put
{ "repo_name": "apache/solr", "path": "solr/solrj/src/java/org/apache/solr/common/MapWriter.java", "license": "apache-2.0", "size": 5412 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
837,196
@Override protected void writable(final SelectionKey key) { IOSession session = getSession(key); try { this.eventDispatch.outputReady(session); } catch (CancelledKeyException ex) { queueClosedSession(session); key.attach(null); } catch (RuntimeException ex) { handleRuntimeException(ex); } } /** * Verifies whether any of the sessions associated with the given selection * keys timed out by invoking the {@link #timeoutCheck(SelectionKey, long)}
void function(final SelectionKey key) { IOSession session = getSession(key); try { this.eventDispatch.outputReady(session); } catch (CancelledKeyException ex) { queueClosedSession(session); key.attach(null); } catch (RuntimeException ex) { handleRuntimeException(ex); } } /** * Verifies whether any of the sessions associated with the given selection * keys timed out by invoking the {@link #timeoutCheck(SelectionKey, long)}
/** * Processes {@link SelectionKey#OP_WRITE} event on the given selection key. * This method dispatches the event notification to the * {@link IOEventDispatch#outputReady(IOSession)} method. */
Processes <code>SelectionKey#OP_WRITE</code> event on the given selection key. This method dispatches the event notification to the <code>IOEventDispatch#outputReady(IOSession)</code> method
writable
{ "repo_name": "0x90sled/droidtowers", "path": "main/source/org/apach3/http/impl/nio/reactor/BaseIOReactor.java", "license": "mit", "size": 10181 }
[ "java.nio.channels.CancelledKeyException", "java.nio.channels.SelectionKey", "org.apach3.http.nio.reactor.IOSession" ]
import java.nio.channels.CancelledKeyException; import java.nio.channels.SelectionKey; import org.apach3.http.nio.reactor.IOSession;
import java.nio.channels.*; import org.apach3.http.nio.reactor.*;
[ "java.nio", "org.apach3.http" ]
java.nio; org.apach3.http;
1,830,368
public static int hashCodeByteBuffer(List<ByteBuffer> list) { int hash = 1; for (ByteBuffer bytes : list) { hash = 31 * hash + hashCodeByteBuffer(bytes); } return hash; } private static final int DEFAULT_BUFFER_SIZE = 4096;
static int function(List<ByteBuffer> list) { int hash = 1; for (ByteBuffer bytes : list) { hash = 31 * hash + hashCodeByteBuffer(bytes); } return hash; } private static final int DEFAULT_BUFFER_SIZE = 4096;
/** * Helper method for implementing {@link Message#hashCode()} for bytes * field. */
Helper method for implementing <code>Message#hashCode()</code> for bytes field
hashCodeByteBuffer
{ "repo_name": "danakj/chromium", "path": "third_party/protobuf/java/core/src/main/java/com/google/protobuf/Internal.java", "license": "bsd-3-clause", "size": 23877 }
[ "java.nio.ByteBuffer", "java.util.List" ]
import java.nio.ByteBuffer; import java.util.List;
import java.nio.*; import java.util.*;
[ "java.nio", "java.util" ]
java.nio; java.util;
39,143
public DuplicateOnWriteSimpleCollection<E> add(E element) { Object[] newElements = Arrays.copyOf(elements, elements.length + 1); newElements[elements.length] = element; return new DuplicateOnWriteSimpleCollection<>(newElements); }
DuplicateOnWriteSimpleCollection<E> function(E element) { Object[] newElements = Arrays.copyOf(elements, elements.length + 1); newElements[elements.length] = element; return new DuplicateOnWriteSimpleCollection<>(newElements); }
/** * Add a new element to a new collection * @param element the element to add * @return the modified collection */
Add a new element to a new collection
add
{ "repo_name": "mattunderscorechampion/tree-root", "path": "simple-collections/src/main/java/com/mattunderscore/simple/collections/DuplicateOnWriteSimpleCollection.java", "license": "bsd-3-clause", "size": 5735 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,813,300
protected boolean isSameParents(Node node1, Node node2) { return node1.getParent()==node2.getParent(); } private static final Random r = new Random();
boolean function(Node node1, Node node2) { return node1.getParent()==node2.getParent(); } private static final Random r = new Random();
/** * Compare the parents of each node for equality * * <p>To be overridden in subclasses for specific NetworkTopology * implementations, as alternative to overriding the full * {@link #isOnSameRack(Node, Node)} method. * * @param node1 the first node to compare * @param node2 the second node to compare * @return true if their parents are equal, false otherwise * * @see #isOnSameRack(Node, Node) */
Compare the parents of each node for equality To be overridden in subclasses for specific NetworkTopology implementations, as alternative to overriding the full <code>#isOnSameRack(Node, Node)</code> method
isSameParents
{ "repo_name": "Microsoft-CISL/hadoop-prototype", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java", "license": "apache-2.0", "size": 30633 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
1,623,765
public void reenqueue(ProducerBatch batch, long now) { batch.reenqueued(now); Deque<ProducerBatch> deque = getOrCreateDeque(batch.topicPartition); synchronized (deque) { deque.addFirst(batch); } }
void function(ProducerBatch batch, long now) { batch.reenqueued(now); Deque<ProducerBatch> deque = getOrCreateDeque(batch.topicPartition); synchronized (deque) { deque.addFirst(batch); } }
/** * Re-enqueue the given record batch in the accumulator to retry */
Re-enqueue the given record batch in the accumulator to retry
reenqueue
{ "repo_name": "zzwlstarby/mykafka", "path": "clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java", "license": "apache-2.0", "size": 34740 }
[ "java.util.Deque" ]
import java.util.Deque;
import java.util.*;
[ "java.util" ]
java.util;
1,248,169
private void manageControls(Set<Action> pressedKeys) { if (shootingCounter > 0) { shootingCounter -= 1; } for (Action code : pressedKeys) { if (code == Action.left) { this.rotateLeft(); } else if (code == Action.right) { this.rotateRight(); } if (code == Action.up) { this.moveUp(); } else if (code == Action.down) { this.moveDown(); } if (code == Action.decrease) { SHOOTING_DELAY -= 1; } if (code == Action.increase) { SHOOTING_DELAY += 1; } if (shootingCounter <= 0) { if (code == Action.space) { shootingCounter = SHOOTING_DELAY; if (pressedKeys.contains(Action.space)) this.shoot(); } } } }
void function(Set<Action> pressedKeys) { if (shootingCounter > 0) { shootingCounter -= 1; } for (Action code : pressedKeys) { if (code == Action.left) { this.rotateLeft(); } else if (code == Action.right) { this.rotateRight(); } if (code == Action.up) { this.moveUp(); } else if (code == Action.down) { this.moveDown(); } if (code == Action.decrease) { SHOOTING_DELAY -= 1; } if (code == Action.increase) { SHOOTING_DELAY += 1; } if (shootingCounter <= 0) { if (code == Action.space) { shootingCounter = SHOOTING_DELAY; if (pressedKeys.contains(Action.space)) this.shoot(); } } } }
/** * Determine the movement action to be done based on a list of pressed keycodes. */
Determine the movement action to be done based on a list of pressed keycodes
manageControls
{ "repo_name": "hkamran/JavaAsteroidGame", "path": "src/main/java/com/hkamran/asteroid/game/objects/Player.java", "license": "gpl-2.0", "size": 4044 }
[ "com.hkamran.asteroid.game.controls.Action", "java.util.Set" ]
import com.hkamran.asteroid.game.controls.Action; import java.util.Set;
import com.hkamran.asteroid.game.controls.*; import java.util.*;
[ "com.hkamran.asteroid", "java.util" ]
com.hkamran.asteroid; java.util;
630,992
@Column(name = "ldap_values", length = 4000) public String getLdapValues() { return ldapValues; }
@Column(name = STR, length = 4000) String function() { return ldapValues; }
/** * LDAP values as key-value-pairs, e. g. gidNumber=1000,uidNumber=1001,homeDirectory="/home/kai",shell="/bin/bash". For handling of string * values see {@link org.apache.commons.csv.writer.CSVWriter}. This field is handled by the ldap package and has no further effect in * ProjectForge's core package. * @return the ldapValues */
LDAP values as key-value-pairs, e. g. gidNumber=1000,uidNumber=1001,homeDirectory="/home/kai",shell="/bin/bash". For handling of string values see <code>org.apache.commons.csv.writer.CSVWriter</code>. This field is handled by the ldap package and has no further effect in ProjectForge's core package
getLdapValues
{ "repo_name": "micromata/projectforge-webapp", "path": "src/main/java/org/projectforge/user/PFUserDO.java", "license": "gpl-3.0", "size": 23178 }
[ "javax.persistence.Column" ]
import javax.persistence.Column;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
2,144,088
protected void transferForeignAttributes(AreaTreeObject targetArea) { Map<QName, String> atts = fobj.getForeignAttributes(); targetArea.setForeignAttributes(atts); }
void function(AreaTreeObject targetArea) { Map<QName, String> atts = fobj.getForeignAttributes(); targetArea.setForeignAttributes(atts); }
/** * Transfers foreign attributes from the formatting object to the area. * @param targetArea the area to set the attributes on */
Transfers foreign attributes from the formatting object to the area
transferForeignAttributes
{ "repo_name": "Distrotech/fop", "path": "src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java", "license": "apache-2.0", "size": 15202 }
[ "java.util.Map", "org.apache.fop.area.AreaTreeObject", "org.apache.xmlgraphics.util.QName" ]
import java.util.Map; import org.apache.fop.area.AreaTreeObject; import org.apache.xmlgraphics.util.QName;
import java.util.*; import org.apache.fop.area.*; import org.apache.xmlgraphics.util.*;
[ "java.util", "org.apache.fop", "org.apache.xmlgraphics" ]
java.util; org.apache.fop; org.apache.xmlgraphics;
2,831,998
protected boolean sendStartupMessage(StartupOperation op, boolean cancelOnTimeout) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); this.receivedStartupResponse = false; boolean ok = false; // Be sure to add ourself to the equivalencies list! Set equivs = StartupMessage.getMyAddresses(this); if (equivs == null || equivs.size() == 0) { // no network interface equivs = new HashSet(); try { equivs.add(SocketCreator.getLocalHost()); } catch (UnknownHostException e) { // can't even get localhost if (getViewMembers().size() > 1) { throw new SystemConnectException("Unable to examine network cards and other members exist"); } } } setEquivalentHosts(equivs); setEnforceUniqueZone(getConfig().getEnforceUniqueHost()); String redundancyZone = getConfig().getRedundancyZone(); if(redundancyZone != null && !redundancyZone.equals("")) { setEnforceUniqueZone(true); } setRedundancyZone(getDistributionManagerId(), redundancyZone); if (logger.isDebugEnabled()) { StringBuffer sb = new StringBuffer(); sb.append("Equivalent IPs for this host: "); Iterator it = equivs.iterator(); while (it.hasNext()) { InetAddress in = (InetAddress)it.next(); sb.append(in.toString()); if (it.hasNext()) { sb.append(", "); } } // while logger.debug(sb); } // we need to send this to everyone else; even admin vm Set allOthers = new HashSet(getViewMembers()); allOthers.remove(getDistributionManagerId()); if (allOthers.isEmpty()) { return false; // no peers, we are alone. } // ensure we have stubs for everyone else Iterator it = allOthers.iterator(); while (it.hasNext()) { InternalDistributedMember member = (InternalDistributedMember)it.next(); membershipManager.getStubForMember(member); } try { ok = op.sendStartupMessage(allOthers, STARTUP_TIMEOUT, equivs, redundancyZone, enforceUniqueZone()); } catch (Exception re) { throw new SystemConnectException(LocalizedStrings.DistributionManager_ONE_OR_MORE_PEERS_GENERATED_EXCEPTIONS_DURING_CONNECTION_ATTEMPT.toLocalizedString(), re); } if (this.rejectionMessage != null) { throw new IncompatibleSystemException(rejectionMessage); } boolean isAdminDM = getId().getVmKind() == DistributionManager.ADMIN_ONLY_DM_TYPE || getId().getVmKind() == DistributionManager.LOCATOR_DM_TYPE || DistributionManager.isDedicatedAdminVM || Boolean.getBoolean(InternalLocator.FORCE_LOCATOR_DM_TYPE); boolean receivedAny = this.receivedStartupResponse; if (!ok) { // someone didn't reply int unresponsiveCount; synchronized (unfinishedStartupsLock) { if (unfinishedStartups == null) unresponsiveCount = 0; else unresponsiveCount = unfinishedStartups.size(); if (unresponsiveCount != 0) { if (Boolean.getBoolean("DistributionManager.requireAllStartupResponses")) { throw new SystemConnectException(LocalizedStrings.DistributionManager_NO_STARTUP_REPLIES_FROM_0.toLocalizedString(unfinishedStartups)); } } } // synchronized // Bug 35887: // If there are other members, we must receive at least _one_ response if (allOthers.size() != 0) { // there exist others if (!receivedAny) { // and none responded StringBuffer sb = new StringBuffer(); Iterator itt = allOthers.iterator(); while (itt.hasNext()) { Object m = itt.next(); sb.append(m.toString()); if (itt.hasNext()) sb.append(", "); } if (DEBUG_NO_ACKNOWLEDGEMENTS) { printStacks(allOthers, false); } throw new SystemConnectException(LocalizedStrings.DistributionManager_RECEIVED_NO_CONNECTION_ACKNOWLEDGMENTS_FROM_ANY_OF_THE_0_SENIOR_CACHE_MEMBERS_1.toLocalizedString(new Object[] {Integer.toString(allOthers.size()), sb.toString()})); } // and none responded } // there exist others InternalDistributedMember e = getElderId(); if (e != null) { // an elder exists boolean unresponsiveElder; synchronized (unfinishedStartupsLock) { if (unfinishedStartups == null) unresponsiveElder = false; else unresponsiveElder = unfinishedStartups.contains(e); } if (unresponsiveElder) { logger.warn(LocalizedMessage.create( LocalizedStrings.DistributionManager_FORCING_AN_ELDER_JOIN_EVENT_SINCE_A_STARTUP_RESPONSE_WAS_NOT_RECEIVED_FROM_ELDER__0_, e)); handleManagerStartup(e, null); } } // an elder exists } // someone didn't reply return receivedAny; } private Set unfinishedStartups = null; private final Object unfinishedStartupsLock = new Object();
boolean function(StartupOperation op, boolean cancelOnTimeout) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); this.receivedStartupResponse = false; boolean ok = false; Set equivs = StartupMessage.getMyAddresses(this); if (equivs == null equivs.size() == 0) { equivs = new HashSet(); try { equivs.add(SocketCreator.getLocalHost()); } catch (UnknownHostException e) { if (getViewMembers().size() > 1) { throw new SystemConnectException(STR); } } } setEquivalentHosts(equivs); setEnforceUniqueZone(getConfig().getEnforceUniqueHost()); String redundancyZone = getConfig().getRedundancyZone(); if(redundancyZone != null && !redundancyZone.equals(STREquivalent IPs for this host: STR, STRDistributionManager.requireAllStartupResponsesSTR, "); } if (DEBUG_NO_ACKNOWLEDGEMENTS) { printStacks(allOthers, false); } throw new SystemConnectException(LocalizedStrings.DistributionManager_RECEIVED_NO_CONNECTION_ACKNOWLEDGMENTS_FROM_ANY_OF_THE_0_SENIOR_CACHE_MEMBERS_1.toLocalizedString(new Object[] {Integer.toString(allOthers.size()), sb.toString()})); } } InternalDistributedMember e = getElderId(); if (e != null) { boolean unresponsiveElder; synchronized (unfinishedStartupsLock) { if (unfinishedStartups == null) unresponsiveElder = false; else unresponsiveElder = unfinishedStartups.contains(e); } if (unresponsiveElder) { logger.warn(LocalizedMessage.create( LocalizedStrings.DistributionManager_FORCING_AN_ELDER_JOIN_EVENT_SINCE_A_STARTUP_RESPONSE_WAS_NOT_RECEIVED_FROM_ELDER__0_, e)); handleManagerStartup(e, null); } } } return receivedAny; } private Set unfinishedStartups = null; private final Object unfinishedStartupsLock = new Object();
/** * Sends a startup message and waits for a response. * Returns true if response received; false if it timed out or there are no peers. */
Sends a startup message and waits for a response. Returns true if response received; false if it timed out or there are no peers
sendStartupMessage
{ "repo_name": "fengshao0907/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java", "license": "apache-2.0", "size": 176212 }
[ "com.gemstone.gemfire.SystemConnectException", "com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember", "com.gemstone.gemfire.internal.SocketCreator", "com.gemstone.gemfire.internal.i18n.LocalizedStrings", "com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage", "java.net.UnknownHostException", "java.util.HashSet", "java.util.Set" ]
import com.gemstone.gemfire.SystemConnectException; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.internal.SocketCreator; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage; import java.net.UnknownHostException; import java.util.HashSet; import java.util.Set;
import com.gemstone.gemfire.*; import com.gemstone.gemfire.distributed.internal.membership.*; import com.gemstone.gemfire.internal.*; import com.gemstone.gemfire.internal.i18n.*; import com.gemstone.gemfire.internal.logging.log4j.*; import java.net.*; import java.util.*;
[ "com.gemstone.gemfire", "java.net", "java.util" ]
com.gemstone.gemfire; java.net; java.util;
2,508,014
@Test public void stopForegroundDoesntRemoveNotificationUnlessAsked() { Notification n = notBuilder.build(); service.startForeground(21, n); service.stopForeground(false); assertThat(nm.getNotification(21)).isSameAs(n); }
void function() { Notification n = notBuilder.build(); service.startForeground(21, n); service.stopForeground(false); assertThat(nm.getNotification(21)).isSameAs(n); }
/** * According to spec, if the foreground notification is not removed earlier, * then it will be removed when the service is destroyed. */
According to spec, if the foreground notification is not removed earlier, then it will be removed when the service is destroyed
stopForegroundDoesntRemoveNotificationUnlessAsked
{ "repo_name": "gruszczy/robolectric", "path": "robolectric/src/test/java/org/robolectric/shadows/ShadowServiceTest.java", "license": "mit", "size": 4453 }
[ "android.app.Notification", "org.assertj.core.api.Assertions" ]
import android.app.Notification; import org.assertj.core.api.Assertions;
import android.app.*; import org.assertj.core.api.*;
[ "android.app", "org.assertj.core" ]
android.app; org.assertj.core;
1,690,931
public void testQueryWithMultipleResultsFromCode() throws Exception { if (supportsStoredProcedures() && getPlatform().isMySQL()) { // SQL result set mapping for employee. SQLResultSetMapping employeeResultSetMapping = new SQLResultSetMapping("EmployeeResultSetMapping"); employeeResultSetMapping.addResult(new EntityResult(Employee.class)); // SQL result set mapping for address. SQLResultSetMapping addressResultSetMapping = new SQLResultSetMapping("AddressResultSetMapping"); addressResultSetMapping.addResult(new EntityResult(Address.class)); // SQL result set mapping for project (using inheritance and more complex result) SQLResultSetMapping projectResultSetMapping = new SQLResultSetMapping("ProjectResultSetMapping"); EntityResult projectEntityResult = new EntityResult(Project.class); projectResultSetMapping.addResult(projectEntityResult); projectEntityResult = new EntityResult(SmallProject.class); projectEntityResult.addFieldResult(new FieldResult("id", "SMALL_ID")); projectEntityResult.addFieldResult(new FieldResult("name", "SMALL_NAME")); projectEntityResult.addFieldResult(new FieldResult("description", "SMALL_DESCRIPTION")); projectEntityResult.addFieldResult(new FieldResult("teamLeader", "SMALL_TEAMLEAD")); projectEntityResult.addFieldResult(new FieldResult("version", "SMALL_VERSION")); projectEntityResult.setDiscriminatorColumn("SMALL_DESCRIM"); projectResultSetMapping.addResult(projectEntityResult); projectResultSetMapping.addResult(new ColumnResult("BUDGET_SUM")); // SQL result set mapping for employee using constructor results. SQLResultSetMapping employeeConstrustorResultSetMapping = new SQLResultSetMapping("EmployeeConstructorResultSetMapping"); ConstructorResult constructorResult = new ConstructorResult(EmployeeDetails.class); ColumnResult columnResult = new ColumnResult("EMP_ID"); columnResult.getColumn().setType(Integer.class); constructorResult.addColumnResult(columnResult); columnResult = new ColumnResult("F_NAME"); columnResult.getColumn().setType(String.class); constructorResult.addColumnResult(columnResult); columnResult = new ColumnResult("L_NAME"); columnResult.getColumn().setType(String.class); constructorResult.addColumnResult(columnResult); columnResult = new ColumnResult("R_COUNT"); columnResult.getColumn().setType(Integer.class); constructorResult.addColumnResult(columnResult); employeeConstrustorResultSetMapping.addResult(constructorResult); StoredProcedureCall call = new StoredProcedureCall(); call.setProcedureName("Read_Multiple_Result_Sets"); call.setHasMultipleResultSets(true); call.setReturnMultipleResultSetCollections(true); ResultSetMappingQuery query = new ResultSetMappingQuery(call); query.addSQLResultSetMapping(employeeResultSetMapping); query.addSQLResultSetMapping(addressResultSetMapping); query.addSQLResultSetMapping(projectResultSetMapping); query.addSQLResultSetMapping(employeeConstrustorResultSetMapping); List allResults = (List)getPersistenceUnitServerSession().executeQuery(query); assertNotNull("No results returned", allResults); assertTrue("Incorrect number of results returned", allResults.size() == 4); // Verify first result set mapping --> Employee List results0 = (List) allResults.get(0); assertNotNull("No Employee results returned", results0); assertTrue("Empty Employee results returned", results0.size() > 0); // Verify second result set mapping --> Address List results1 = (List) allResults.get(1); assertNotNull("No Address results returned", results1); assertTrue("Empty Address results returned", results1.size() > 0); // Verify third result set mapping --> Project List results2 = (List) allResults.get(2); assertNotNull("No Project results returned", results2); assertTrue("Empty Project results returned", results2.size() > 0); for (Object result2 : results2) { Object[] result2Element = (Object[]) result2; assertTrue("Failed to Return 3 items", (result2Element.length == 3)); // Using Number as Different db/drivers can return different types // e.g. Oracle with ijdbc14.jar returns BigDecimal where as Derby // with derbyclient.jar returns Double. NOTE: the order of checking // here is valid and as defined by the spec. assertTrue("Failed to return LargeProject", (result2Element[0] instanceof LargeProject)); assertTrue("Failed To Return SmallProject", (result2Element[1] instanceof SmallProject)); assertTrue("Failed to return column",(result2Element[2] instanceof Number)); assertFalse("Returned same data in both result elements",((SmallProject) result2Element[1]).getName().equals(((LargeProject) result2Element[0]).getName())); } // Verify fourth result set mapping --> Employee Constructor Result List results3 = (List) allResults.get(3); assertNotNull("No Employee constructor results returned", results3); assertTrue("Empty Employee constructor results returned", results3.size() > 0); } }
void function() throws Exception { if (supportsStoredProcedures() && getPlatform().isMySQL()) { SQLResultSetMapping employeeResultSetMapping = new SQLResultSetMapping(STR); employeeResultSetMapping.addResult(new EntityResult(Employee.class)); SQLResultSetMapping addressResultSetMapping = new SQLResultSetMapping(STR); addressResultSetMapping.addResult(new EntityResult(Address.class)); SQLResultSetMapping projectResultSetMapping = new SQLResultSetMapping(STR); EntityResult projectEntityResult = new EntityResult(Project.class); projectResultSetMapping.addResult(projectEntityResult); projectEntityResult = new EntityResult(SmallProject.class); projectEntityResult.addFieldResult(new FieldResult("id", STR)); projectEntityResult.addFieldResult(new FieldResult("name", STR)); projectEntityResult.addFieldResult(new FieldResult(STR, STR)); projectEntityResult.addFieldResult(new FieldResult(STR, STR)); projectEntityResult.addFieldResult(new FieldResult(STR, STR)); projectEntityResult.setDiscriminatorColumn(STR); projectResultSetMapping.addResult(projectEntityResult); projectResultSetMapping.addResult(new ColumnResult(STR)); SQLResultSetMapping employeeConstrustorResultSetMapping = new SQLResultSetMapping(STR); ConstructorResult constructorResult = new ConstructorResult(EmployeeDetails.class); ColumnResult columnResult = new ColumnResult(STR); columnResult.getColumn().setType(Integer.class); constructorResult.addColumnResult(columnResult); columnResult = new ColumnResult(STR); columnResult.getColumn().setType(String.class); constructorResult.addColumnResult(columnResult); columnResult = new ColumnResult(STR); columnResult.getColumn().setType(String.class); constructorResult.addColumnResult(columnResult); columnResult = new ColumnResult(STR); columnResult.getColumn().setType(Integer.class); constructorResult.addColumnResult(columnResult); employeeConstrustorResultSetMapping.addResult(constructorResult); StoredProcedureCall call = new StoredProcedureCall(); call.setProcedureName(STR); call.setHasMultipleResultSets(true); call.setReturnMultipleResultSetCollections(true); ResultSetMappingQuery query = new ResultSetMappingQuery(call); query.addSQLResultSetMapping(employeeResultSetMapping); query.addSQLResultSetMapping(addressResultSetMapping); query.addSQLResultSetMapping(projectResultSetMapping); query.addSQLResultSetMapping(employeeConstrustorResultSetMapping); List allResults = (List)getPersistenceUnitServerSession().executeQuery(query); assertNotNull(STR, allResults); assertTrue(STR, allResults.size() == 4); List results0 = (List) allResults.get(0); assertNotNull(STR, results0); assertTrue(STR, results0.size() > 0); List results1 = (List) allResults.get(1); assertNotNull(STR, results1); assertTrue(STR, results1.size() > 0); List results2 = (List) allResults.get(2); assertNotNull(STR, results2); assertTrue(STR, results2.size() > 0); for (Object result2 : results2) { Object[] result2Element = (Object[]) result2; assertTrue(STR, (result2Element.length == 3)); assertTrue(STR, (result2Element[0] instanceof LargeProject)); assertTrue(STR, (result2Element[1] instanceof SmallProject)); assertTrue(STR,(result2Element[2] instanceof Number)); assertFalse(STR,((SmallProject) result2Element[1]).getName().equals(((LargeProject) result2Element[0]).getName())); } List results3 = (List) allResults.get(3); assertNotNull(STR, results3); assertTrue(STR, results3.size() > 0); } }
/** * Test multiple result sets by setting the SQL results set mapping from code. */
Test multiple result sets by setting the SQL results set mapping from code
testQueryWithMultipleResultsFromCode
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa21/advanced/StoredProcedureQueryTestSuite.java", "license": "epl-1.0", "size": 52951 }
[ "java.util.List", "org.eclipse.persistence.queries.ColumnResult", "org.eclipse.persistence.queries.ConstructorResult", "org.eclipse.persistence.queries.EntityResult", "org.eclipse.persistence.queries.FieldResult", "org.eclipse.persistence.queries.ResultSetMappingQuery", "org.eclipse.persistence.queries.SQLResultSetMapping", "org.eclipse.persistence.queries.StoredProcedureCall", "org.eclipse.persistence.testing.models.jpa21.advanced.Address", "org.eclipse.persistence.testing.models.jpa21.advanced.Employee", "org.eclipse.persistence.testing.models.jpa21.advanced.EmployeeDetails", "org.eclipse.persistence.testing.models.jpa21.advanced.LargeProject", "org.eclipse.persistence.testing.models.jpa21.advanced.Project", "org.eclipse.persistence.testing.models.jpa21.advanced.SmallProject" ]
import java.util.List; import org.eclipse.persistence.queries.ColumnResult; import org.eclipse.persistence.queries.ConstructorResult; import org.eclipse.persistence.queries.EntityResult; import org.eclipse.persistence.queries.FieldResult; import org.eclipse.persistence.queries.ResultSetMappingQuery; import org.eclipse.persistence.queries.SQLResultSetMapping; import org.eclipse.persistence.queries.StoredProcedureCall; import org.eclipse.persistence.testing.models.jpa21.advanced.Address; import org.eclipse.persistence.testing.models.jpa21.advanced.Employee; import org.eclipse.persistence.testing.models.jpa21.advanced.EmployeeDetails; import org.eclipse.persistence.testing.models.jpa21.advanced.LargeProject; import org.eclipse.persistence.testing.models.jpa21.advanced.Project; import org.eclipse.persistence.testing.models.jpa21.advanced.SmallProject;
import java.util.*; import org.eclipse.persistence.queries.*; import org.eclipse.persistence.testing.models.jpa21.advanced.*;
[ "java.util", "org.eclipse.persistence" ]
java.util; org.eclipse.persistence;
34,459
public void showBusStops(List<BusStopViewModel> busStops, long delayMarkerVisibilityMillis, boolean animateCamera) { if (isAdded()) { clearMarkers(); // Add the bus stops as markers to the map. We're given the bounding box of all of the // markers such that we can zoom to fit all markers on the map. LatLngBounds bounds = busStopInfoWindowAdapter.showBusStopsAsMarkers(googleMap, busStops, delayMarkerVisibilityMillis); if (animateCamera) { // If we've drawn a circular "search" area, then zoom in on the map such that we fit the // entire circle within the view bounds. if (searchArea != null) { bounds = getLatLngBoundsOfCircle(searchArea.getCenter(), searchArea.getRadius()); } if (searchArea != null || busStops.size() > 1) { resetBearingAndZoomToBounds(bounds); } else { // If there's only ony marker and no search area, then we definitely don't need to // zoom to MAX. zoomToLocation(busStops.get(0).getLatLng().latitude, busStops.get(0).getLatLng().longitude, getResources().getInteger(R.integer.default_my_location_map_zoom)); } } } }
void function(List<BusStopViewModel> busStops, long delayMarkerVisibilityMillis, boolean animateCamera) { if (isAdded()) { clearMarkers(); LatLngBounds bounds = busStopInfoWindowAdapter.showBusStopsAsMarkers(googleMap, busStops, delayMarkerVisibilityMillis); if (animateCamera) { if (searchArea != null) { bounds = getLatLngBoundsOfCircle(searchArea.getCenter(), searchArea.getRadius()); } if (searchArea != null busStops.size() > 1) { resetBearingAndZoomToBounds(bounds); } else { zoomToLocation(busStops.get(0).getLatLng().latitude, busStops.get(0).getLatLng().longitude, getResources().getInteger(R.integer.default_my_location_map_zoom)); } } } }
/** * Show the list of bus stops as markers on the map. * * @param busStops The list of bus stops to show as markers. * @param delayMarkerVisibilityMillis Number of milliseconds to delay when showing a marker as * visible. * @param animateCamera If set to {@code true} then pans & zooms the camera such that it can fit * all markers on screen. */
Show the list of bus stops as markers on the map
showBusStops
{ "repo_name": "jvivanco28/PegCityTransit", "path": "app/src/main/java/jessevivanco/com/pegcitytransit/ui/fragments/TransitMapFragment.java", "license": "mit", "size": 19771 }
[ "com.google.android.gms.maps.model.LatLngBounds", "java.util.List" ]
import com.google.android.gms.maps.model.LatLngBounds; import java.util.List;
import com.google.android.gms.maps.model.*; import java.util.*;
[ "com.google.android", "java.util" ]
com.google.android; java.util;
1,934,831
interface WithDefaultMessageTTL { Update withDefaultMessageTTL(Duration ttl); }
interface WithDefaultMessageTTL { Update withDefaultMessageTTL(Duration ttl); }
/** * Specifies the duration after which the message expires. * * @param ttl time to live duration * @return the next stage of subscription update */
Specifies the duration after which the message expires
withDefaultMessageTTL
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-servicebus/src/main/java/com/azure/resourcemanager/servicebus/models/ServiceBusSubscription.java", "license": "mit", "size": 17684 }
[ "java.time.Duration" ]
import java.time.Duration;
import java.time.*;
[ "java.time" ]
java.time;
2,527,148
public void loadImageDrawable(Drawable drawable) { resetImageURL(null); super.setImageDrawable(drawable); currentDrawType = null; currentURL = null; }
void function(Drawable drawable) { resetImageURL(null); super.setImageDrawable(drawable); currentDrawType = null; currentURL = null; }
/** * Load a Drawable as an image in the View, similar to {@link ImageView#setImageDrawable(Drawable) setImageDrawable(Drawable)} but canceling the previous network load if there was any * * @param drawable The drawable to set */
Load a Drawable as an image in the View, similar to <code>ImageView#setImageDrawable(Drawable) setImageDrawable(Drawable)</code> but canceling the previous network load if there was any
loadImageDrawable
{ "repo_name": "levelup/PictureCache", "path": "library/src/com/levelup/picturecache/widget/LoadedImageView.java", "license": "apache-2.0", "size": 15630 }
[ "android.graphics.drawable.Drawable" ]
import android.graphics.drawable.Drawable;
import android.graphics.drawable.*;
[ "android.graphics" ]
android.graphics;
1,562,032
public void reAlloc() { final long newAllocationSize = allocationSizeInBytes * 2L; if (newAllocationSize > MAX_ALLOCATION_SIZE) { throw new OversizedAllocationException("Requested amount of memory is more than max allowed allocation size"); } final int curSize = (int)newAllocationSize; final ArrowBuf newBuf = allocator.buffer(curSize); newBuf.setZero(0, newBuf.capacity()); newBuf.setBytes(0, data, 0, data.capacity()); data.release(); data = newBuf; allocationSizeInBytes = curSize; } /** * {@inheritDoc}
void function() { final long newAllocationSize = allocationSizeInBytes * 2L; if (newAllocationSize > MAX_ALLOCATION_SIZE) { throw new OversizedAllocationException(STR); } final int curSize = (int)newAllocationSize; final ArrowBuf newBuf = allocator.buffer(curSize); newBuf.setZero(0, newBuf.capacity()); newBuf.setBytes(0, data, 0, data.capacity()); data.release(); data = newBuf; allocationSizeInBytes = curSize; } /** * {@inheritDoc}
/** * Allocate new buffer with double capacity, and copy data into the new buffer. Replace vector's buffer with new buffer, and release old one */
Allocate new buffer with double capacity, and copy data into the new buffer. Replace vector's buffer with new buffer, and release old one
reAlloc
{ "repo_name": "jeffknupp/arrow", "path": "java/vector/src/main/java/org/apache/arrow/vector/BitVector.java", "license": "apache-2.0", "size": 18070 }
[ "io.netty.buffer.ArrowBuf", "org.apache.arrow.vector.util.OversizedAllocationException" ]
import io.netty.buffer.ArrowBuf; import org.apache.arrow.vector.util.OversizedAllocationException;
import io.netty.buffer.*; import org.apache.arrow.vector.util.*;
[ "io.netty.buffer", "org.apache.arrow" ]
io.netty.buffer; org.apache.arrow;
1,974,217
public Collection<SemaphoreNeighborInjectMatch> getAllMatches(final Route pRoute, final Semaphore pSemaphore) { return rawGetAllMatches(new Object[]{pRoute, pSemaphore}); }
Collection<SemaphoreNeighborInjectMatch> function(final Route pRoute, final Semaphore pSemaphore) { return rawGetAllMatches(new Object[]{pRoute, pSemaphore}); }
/** * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. * @param pRoute the fixed value of pattern parameter route, or null if not bound. * @param pSemaphore the fixed value of pattern parameter semaphore, or null if not bound. * @return matches represented as a SemaphoreNeighborInjectMatch object. * */
Returns the set of all matches of the pattern that conform to the given fixed values of some parameters
getAllMatches
{ "repo_name": "FTSRG/trainbenchmark", "path": "trainbenchmark-tool-viatra-patterns/src-gen/hu/bme/mit/trainbenchmark/benchmark/viatra/SemaphoreNeighborInjectMatcher.java", "license": "epl-1.0", "size": 12391 }
[ "hu.bme.mit.trainbenchmark.benchmark.viatra.SemaphoreNeighborInjectMatch", "hu.bme.mit.trainbenchmark.railway.Route", "hu.bme.mit.trainbenchmark.railway.Semaphore", "java.util.Collection" ]
import hu.bme.mit.trainbenchmark.benchmark.viatra.SemaphoreNeighborInjectMatch; import hu.bme.mit.trainbenchmark.railway.Route; import hu.bme.mit.trainbenchmark.railway.Semaphore; import java.util.Collection;
import hu.bme.mit.trainbenchmark.benchmark.viatra.*; import hu.bme.mit.trainbenchmark.railway.*; import java.util.*;
[ "hu.bme.mit", "java.util" ]
hu.bme.mit; java.util;
306,253
public SelectableAjaxBehavior setTolerance(ToleranceEnum tolerance) { selectableBehavior.setTolerance(tolerance); return this; }
SelectableAjaxBehavior function(ToleranceEnum tolerance) { selectableBehavior.setTolerance(tolerance); return this; }
/** Set's the tolerance * <ul> * <li><b>fit</b>: draggable overlaps the droppable entirely</li> * <li><b>touch</b>: draggable overlaps the droppable any amount</li> * </ul> * @param tolerance * @return instance of the current behavior */
Set's the tolerance fit: draggable overlaps the droppable entirely touch: draggable overlaps the droppable any amount
setTolerance
{ "repo_name": "magomi/wiquery", "path": "src/main/java/org/odlabs/wiquery/ui/selectable/SelectableAjaxBehavior.java", "license": "mit", "size": 12432 }
[ "org.odlabs.wiquery.ui.selectable.SelectableBehavior" ]
import org.odlabs.wiquery.ui.selectable.SelectableBehavior;
import org.odlabs.wiquery.ui.selectable.*;
[ "org.odlabs.wiquery" ]
org.odlabs.wiquery;
107,032