method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public static void applyStyle(View v, int resId){ applyStyle(v, null, 0, resId); }
static void function(View v, int resId){ applyStyle(v, null, 0, resId); }
/** * Apply any View style attributes to a view. * @param v The view is applied. * @param resId The style resourceId. */
Apply any View style attributes to a view
applyStyle
{ "repo_name": "XhinLiang/MDPreference", "path": "material/src/main/java/com/rey/material/util/ViewUtil.java", "license": "apache-2.0", "size": 33946 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
828,387
@Test public void testQ1Y1900Next() { Quarter next = (Quarter) this.q1Y1900.next(); assertEquals(this.q2Y1900, next); }
void function() { Quarter next = (Quarter) this.q1Y1900.next(); assertEquals(this.q2Y1900, next); }
/** * Set up a quarter equal to Q1 1900. Request the next quarter, it should * be Q2 1900. */
Set up a quarter equal to Q1 1900. Request the next quarter, it should be Q2 1900
testQ1Y1900Next
{ "repo_name": "simon04/jfreechart", "path": "src/test/java/org/jfree/data/time/QuarterTest.java", "license": "lgpl-2.1", "size": 13050 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
373,564
public DataPort getOutputPort(int index) { if (index < 0 || index >= this.outputPorts.size()) { String message = "index has to be possitive and less than " + this.outputPorts.size(); throw new IllegalArgumentException(message); } return this.outputPorts.get(index); }
DataPort function(int index) { if (index < 0 index >= this.outputPorts.size()) { String message = STR + this.outputPorts.size(); throw new IllegalArgumentException(message); } return this.outputPorts.get(index); }
/** * Returns the output port of the specified index. * * @param index * The specified index * @return the uses port of the specified index */
Returns the output port of the specified index
getOutputPort
{ "repo_name": "glahiru/airavata", "path": "modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/impl/NodeImpl.java", "license": "apache-2.0", "size": 20769 }
[ "org.apache.airavata.workflow.model.graph.DataPort" ]
import org.apache.airavata.workflow.model.graph.DataPort;
import org.apache.airavata.workflow.model.graph.*;
[ "org.apache.airavata" ]
org.apache.airavata;
496,753
public void initialize(String id, ConfigMap properties) { super.initialize(id, properties); if (properties == null || properties.size() == 0) return; // General poll props. pollingEnabled = properties.getPropertyAsBoolean(POLLING_ENABLED, false); pollingIntervalMillis = properties.getPropertyAsLong(POLLING_INTERVAL_MILLIS, -1); long pollingIntervalSeconds = properties.getPropertyAsLong(POLLING_INTERVAL_SECONDS, -1); // Deprecated if (pollingIntervalSeconds > -1) pollingIntervalMillis = pollingIntervalSeconds * 1000; // Piggybacking props. piggybackingEnabled = properties.getPropertyAsBoolean(ConfigurationConstants.PIGGYBACKING_ENABLED_ELEMENT, false); // HTTP poll wait props. maxWaitingPollRequests = properties.getPropertyAsInt(MAX_WAITING_POLL_REQUESTS, 0); waitInterval = properties.getPropertyAsLong(WAIT_INTERVAL_MILLIS, 0); clientWaitInterval = properties.getPropertyAsInt(CLIENT_WAIT_INTERVAL_MILLIS, 0); // User Agent props. UserAgentManager.setupUserAgentManager(properties, userAgentManager); // Set initial state for the canWait flag based on whether we allow waits or not. if (maxWaitingPollRequests > 0 && (waitInterval == -1 || waitInterval > 0)) { waitEnabled = true; canWait = true; } } //-------------------------------------------------------------------------- // // Variables // //-------------------------------------------------------------------------- private volatile boolean canWait; protected final Object lock = new Object(); private boolean waitEnabled; protected int waitingPollRequestsCount; private ConcurrentHashMap currentWaitedRequests; //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // clientWaitInterval //---------------------------------- protected int clientWaitInterval = 0;
void function(String id, ConfigMap properties) { super.initialize(id, properties); if (properties == null properties.size() == 0) return; pollingEnabled = properties.getPropertyAsBoolean(POLLING_ENABLED, false); pollingIntervalMillis = properties.getPropertyAsLong(POLLING_INTERVAL_MILLIS, -1); long pollingIntervalSeconds = properties.getPropertyAsLong(POLLING_INTERVAL_SECONDS, -1); if (pollingIntervalSeconds > -1) pollingIntervalMillis = pollingIntervalSeconds * 1000; piggybackingEnabled = properties.getPropertyAsBoolean(ConfigurationConstants.PIGGYBACKING_ENABLED_ELEMENT, false); maxWaitingPollRequests = properties.getPropertyAsInt(MAX_WAITING_POLL_REQUESTS, 0); waitInterval = properties.getPropertyAsLong(WAIT_INTERVAL_MILLIS, 0); clientWaitInterval = properties.getPropertyAsInt(CLIENT_WAIT_INTERVAL_MILLIS, 0); UserAgentManager.setupUserAgentManager(properties, userAgentManager); if (maxWaitingPollRequests > 0 && (waitInterval == -1 waitInterval > 0)) { waitEnabled = true; canWait = true; } } private volatile boolean canWait; protected final Object lock = new Object(); private boolean waitEnabled; protected int waitingPollRequestsCount; private ConcurrentHashMap currentWaitedRequests; protected int clientWaitInterval = 0;
/** * Initializes the <code>Endpoint</code> with the properties. * If subclasses override, they must call <code>super.initialize()</code>. * * @param id Id of the <code>Endpoint</code>. * @param properties Properties for the <code>Endpoint</code>. */
Initializes the <code>Endpoint</code> with the properties. If subclasses override, they must call <code>super.initialize()</code>
initialize
{ "repo_name": "SOASTA/BlazeDS", "path": "modules/core/src/java/flex/messaging/endpoints/BasePollingHTTPEndpoint.java", "license": "lgpl-3.0", "size": 24463 }
[ "java.util.concurrent.ConcurrentHashMap" ]
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
840,963
public void registerDeviceStateListener(DeviceStatusListener deviceStatuslistener);
void function(DeviceStatusListener deviceStatuslistener);
/** * Register a {@link DeviceStatusListener} to this {@link Device}. * * @param deviceStatuslistener */
Register a <code>DeviceStatusListener</code> to this <code>Device</code>
registerDeviceStateListener
{ "repo_name": "vkolotov/smarthome", "path": "extensions/binding/org.eclipse.smarthome.binding.digitalstrom/src/main/java/org/eclipse/smarthome/binding/digitalstrom/internal/lib/structure/devices/Device.java", "license": "epl-1.0", "size": 18559 }
[ "org.eclipse.smarthome.binding.digitalstrom.internal.lib.listener.DeviceStatusListener" ]
import org.eclipse.smarthome.binding.digitalstrom.internal.lib.listener.DeviceStatusListener;
import org.eclipse.smarthome.binding.digitalstrom.internal.lib.listener.*;
[ "org.eclipse.smarthome" ]
org.eclipse.smarthome;
1,107,900
@Test public void testCountNodes() { final Factory<Tree> factory = new ExampleTreeFactory(); Tree tree = null; try { tree = factory.createObject(); } catch (final InitializationException exception) { TestUtils.fail(exception); } final double epsilon = 0; assertEquals(Math.pow(2, AbstractTreeFactory.DEFAULT_MAX_DEPTH) - 1, Util.countNodes(tree), epsilon); }
void function() { final Factory<Tree> factory = new ExampleTreeFactory(); Tree tree = null; try { tree = factory.createObject(); } catch (final InitializationException exception) { TestUtils.fail(exception); } final double epsilon = 0; assertEquals(Math.pow(2, AbstractTreeFactory.DEFAULT_MAX_DEPTH) - 1, Util.countNodes(tree), epsilon); }
/** * Test method for {@link jmona.test.Util#countNodes(jmona.gp.Tree)}. */
Test method for <code>jmona.test.Util#countNodes(jmona.gp.Tree)</code>
testCountNodes
{ "repo_name": "jfinkels/jmona", "path": "jmona-model/src/test/java/jmona/test/UtilTester.java", "license": "gpl-3.0", "size": 4415 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,275,686
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { }
void function(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { }
/** * Spawns this Block's drops into the World as EntityItems. */
Spawns this Block's drops into the World as EntityItems
dropBlockAsItemWithChance
{ "repo_name": "TheGreatAndPowerfulWeegee/wipunknown", "path": "build/tmp/recompileMc/sources/net/minecraft/block/BlockBarrier.java", "license": "gpl-3.0", "size": 1449 }
[ "net.minecraft.block.state.IBlockState", "net.minecraft.util.math.BlockPos", "net.minecraft.world.World" ]
import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World;
import net.minecraft.block.state.*; import net.minecraft.util.math.*; import net.minecraft.world.*;
[ "net.minecraft.block", "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.block; net.minecraft.util; net.minecraft.world;
316,722
@Override public void endAttributes() throws JspParseException { _fragmentCode = _gen.uniqueId(); _fragmentName = "_jsp_fragment_" + _fragmentCode; }
void function() throws JspParseException { _fragmentCode = _gen.uniqueId(); _fragmentName = STR + _fragmentCode; }
/** * Called after all the attributes from the tag. */
Called after all the attributes from the tag
endAttributes
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/jsp/java/JspFragmentNode.java", "license": "gpl-2.0", "size": 8398 }
[ "com.caucho.jsp.JspParseException" ]
import com.caucho.jsp.JspParseException;
import com.caucho.jsp.*;
[ "com.caucho.jsp" ]
com.caucho.jsp;
2,907,262
private void uploadPartsInParallel(UploadPartRequestFactory requestFactory, String uploadId) { Map<Integer,PartSummary> partNumbers = identifyExistingPartsForResume(uploadId); while (requestFactory.hasMoreRequests()) { if (threadPool.isShutdown()) throw new CancellationException("TransferManager has been shutdown"); UploadPartRequest request = requestFactory.getNextUploadPartRequest(); if (partNumbers.containsKey(request.getPartNumber())) { PartSummary summary = partNumbers.get(request.getPartNumber()); eTagsToSkip.add(new PartETag(request.getPartNumber(), summary .getETag())); transferProgress.updateProgress(summary.getSize()); continue; } futures.add(threadPool.submit(new UploadPartCallable(s3, request))); } }
void function(UploadPartRequestFactory requestFactory, String uploadId) { Map<Integer,PartSummary> partNumbers = identifyExistingPartsForResume(uploadId); while (requestFactory.hasMoreRequests()) { if (threadPool.isShutdown()) throw new CancellationException(STR); UploadPartRequest request = requestFactory.getNextUploadPartRequest(); if (partNumbers.containsKey(request.getPartNumber())) { PartSummary summary = partNumbers.get(request.getPartNumber()); eTagsToSkip.add(new PartETag(request.getPartNumber(), summary .getETag())); transferProgress.updateProgress(summary.getSize()); continue; } futures.add(threadPool.submit(new UploadPartCallable(s3, request))); } }
/** * Submits a callable for each part to upload to our thread pool and records its corresponding Future. */
Submits a callable for each part to upload to our thread pool and records its corresponding Future
uploadPartsInParallel
{ "repo_name": "galaxynut/aws-sdk-java", "path": "aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/UploadCallable.java", "license": "apache-2.0", "size": 14713 }
[ "com.amazonaws.services.s3.model.PartETag", "com.amazonaws.services.s3.model.PartSummary", "com.amazonaws.services.s3.model.UploadPartRequest", "java.util.Map", "java.util.concurrent.CancellationException" ]
import com.amazonaws.services.s3.model.PartETag; import com.amazonaws.services.s3.model.PartSummary; import com.amazonaws.services.s3.model.UploadPartRequest; import java.util.Map; import java.util.concurrent.CancellationException;
import com.amazonaws.services.s3.model.*; import java.util.*; import java.util.concurrent.*;
[ "com.amazonaws.services", "java.util" ]
com.amazonaws.services; java.util;
2,874,626
public void loadFromXML(Attributes attrib) { indexName = attrib.getValue("name"); }
void function(Attributes attrib) { indexName = attrib.getValue("name"); }
/** * Imports index from an XML specification * * @param attrib the xml attributes */
Imports index from an XML specification
loadFromXML
{ "repo_name": "besom/bbossgroups-mvn", "path": "bboss_persistent/src/main/java/com/frameworkset/orm/engine/model/Index.java", "license": "apache-2.0", "size": 6467 }
[ "org.xml.sax.Attributes" ]
import org.xml.sax.Attributes;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
1,303,146
@ServiceMethod(returns = ReturnType.SINGLE) Response<DataMaskingRuleInner> createOrUpdateWithResponse( String resourceGroupName, String workspaceName, String sqlPoolName, String dataMaskingRuleName, DataMaskingRuleInner parameters, Context context);
@ServiceMethod(returns = ReturnType.SINGLE) Response<DataMaskingRuleInner> createOrUpdateWithResponse( String resourceGroupName, String workspaceName, String sqlPoolName, String dataMaskingRuleName, DataMaskingRuleInner parameters, Context context);
/** * Creates or updates a Sql pool data masking rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. * @param sqlPoolName SQL pool name. * @param dataMaskingRuleName The name of the data masking rule. * @param parameters The required parameters for creating or updating a data masking rule. * @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 represents a Sql pool data masking rule along with {@link Response}. */
Creates or updates a Sql pool data masking rule
createOrUpdateWithResponse
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/fluent/DataMaskingRulesClient.java", "license": "mit", "size": 6502 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.synapse.fluent.models.DataMaskingRuleInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.synapse.fluent.models.DataMaskingRuleInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.synapse.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
445,893
protected SSLEngineResult handshakeUnwrap(boolean doread) throws IOException { if (netInBuffer.position() == netInBuffer.limit()) { //clear the buffer if we have emptied it out on data netInBuffer.clear(); } if ( doread ) { //if we have data to read, read it int read = sc.read(netInBuffer); if (read == -1) throw new IOException("EOF encountered during handshake."); } SSLEngineResult result; boolean cont = false; //loop while we can perform pure SSLEngine data do { //prepare the buffer with the incoming data netInBuffer.flip(); //call unwrap result = sslEngine.unwrap(netInBuffer, bufHandler.getReadBuffer()); //compact the buffer, this is an optional method, wonder what would happen if we didn't netInBuffer.compact(); //read in the status handshakeStatus = result.getHandshakeStatus(); if ( result.getStatus() == SSLEngineResult.Status.OK && result.getHandshakeStatus() == HandshakeStatus.NEED_TASK ) { //execute tasks if we need to handshakeStatus = tasks(); } //perform another unwrap? cont = result.getStatus() == SSLEngineResult.Status.OK && handshakeStatus == HandshakeStatus.NEED_UNWRAP; }while ( cont ); return result; }
SSLEngineResult function(boolean doread) throws IOException { if (netInBuffer.position() == netInBuffer.limit()) { netInBuffer.clear(); } if ( doread ) { int read = sc.read(netInBuffer); if (read == -1) throw new IOException(STR); } SSLEngineResult result; boolean cont = false; do { netInBuffer.flip(); result = sslEngine.unwrap(netInBuffer, bufHandler.getReadBuffer()); netInBuffer.compact(); handshakeStatus = result.getHandshakeStatus(); if ( result.getStatus() == SSLEngineResult.Status.OK && result.getHandshakeStatus() == HandshakeStatus.NEED_TASK ) { handshakeStatus = tasks(); } cont = result.getStatus() == SSLEngineResult.Status.OK && handshakeStatus == HandshakeStatus.NEED_UNWRAP; }while ( cont ); return result; }
/** * Perform handshake unwrap * @param doread boolean * @return SSLEngineResult * @throws IOException */
Perform handshake unwrap
handshakeUnwrap
{ "repo_name": "pistolove/sourcecode4junit", "path": "Source4Tomcat/src/org/apache/tomcat/util/net/SecureNioChannel.java", "license": "apache-2.0", "size": 23853 }
[ "java.io.IOException", "javax.net.ssl.SSLEngineResult" ]
import java.io.IOException; import javax.net.ssl.SSLEngineResult;
import java.io.*; import javax.net.ssl.*;
[ "java.io", "javax.net" ]
java.io; javax.net;
2,010,734
public static void assertTrue(boolean condition, String pattern, Object... arguments) { if (!condition) { throw new IllegalStateException(MessageFormat.format(pattern, arguments)); } }
static void function(boolean condition, String pattern, Object... arguments) { if (!condition) { throw new IllegalStateException(MessageFormat.format(pattern, arguments)); } }
/** * Checks and ensures that a specific condition is met. * <p> * The {@linkplain MessageFormat} class is used to format an exception message in case the check fails. * * @param condition the condition to check. * @param pattern the exception message pattern to use in case the check fails. * @param arguments the exception message arguments to use in case the check fails. * @throws IllegalStateException if the condition is not met. */
Checks and ensures that a specific condition is met. The MessageFormat class is used to format an exception message in case the check fails
assertTrue
{ "repo_name": "hdecarne/java-default", "path": "src/main/java/de/carne/util/Check.java", "license": "gpl-3.0", "size": 6070 }
[ "java.text.MessageFormat" ]
import java.text.MessageFormat;
import java.text.*;
[ "java.text" ]
java.text;
1,703,791
private void showSelectedDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Set Location Manually"); alert.setMessage("Enter the closest city"); final EditText input = new EditText(this); alert.setView(input);
void function() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(STR); alert.setMessage(STR); final EditText input = new EditText(this); alert.setView(input);
/** * the dialog allow user to type in the city manually */
the dialog allow user to type in the city manually
showSelectedDialog
{ "repo_name": "CMPUT301F14T06/Team06MapleSyrup", "path": "App/src/ca/ualberta/app/activity/CreateAnswerReplyActivity.java", "license": "apache-2.0", "size": 10850 }
[ "android.app.AlertDialog", "android.widget.EditText" ]
import android.app.AlertDialog; import android.widget.EditText;
import android.app.*; import android.widget.*;
[ "android.app", "android.widget" ]
android.app; android.widget;
2,827,669
public ServiceFuture<SubnetInner> beginCreateOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String subnetName, SubnetInner subnetParameters, final ServiceCallback<SubnetInner> serviceCallback) { return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, subnetParameters), serviceCallback); }
ServiceFuture<SubnetInner> function(String resourceGroupName, String virtualNetworkName, String subnetName, SubnetInner subnetParameters, final ServiceCallback<SubnetInner> serviceCallback) { return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, subnetParameters), serviceCallback); }
/** * Creates or updates a subnet in the specified virtual network. * * @param resourceGroupName The name of the resource group. * @param virtualNetworkName The name of the virtual network. * @param subnetName The name of the subnet. * @param subnetParameters Parameters supplied to the create or update subnet operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Creates or updates a subnet in the specified virtual network
beginCreateOrUpdateAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/SubnetsInner.java", "license": "mit", "size": 48775 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,439,705
protected void onLongClickNext(){ if(up_button.isPressed()){ elementPickedPerformed(OnPickerEventListener.Cause.ON_NEXT_LONG_CLICK); this.setIndex(index+1, false); this.up_button.getHandler().postDelayed(up_long_click, this.long_click_refresh_delay); } }
void function(){ if(up_button.isPressed()){ elementPickedPerformed(OnPickerEventListener.Cause.ON_NEXT_LONG_CLICK); this.setIndex(index+1, false); this.up_button.getHandler().postDelayed(up_long_click, this.long_click_refresh_delay); } }
/** * Called when up button is long clicked. Posts on handler onNext() while * button is pressed. */
Called when up button is long clicked. Posts on handler onNext() while button is pressed
onLongClickNext
{ "repo_name": "GuillermoBlasco/AndViewUtil", "path": "src/com/andviewutil/picker/Picker.java", "license": "gpl-3.0", "size": 9754 }
[ "com.andviewutil.picker.OnPickerEventListener" ]
import com.andviewutil.picker.OnPickerEventListener;
import com.andviewutil.picker.*;
[ "com.andviewutil.picker" ]
com.andviewutil.picker;
2,235,625
@Override public List<GenericEntity> getSectionsForNonEducator(String token, Map<String, String> params) { List<GenericEntity> sections = this.getSections(token, params); // Enrich sections with session details enrichSectionsWithSessionDetails(token, null, sections); // Enable filtering sections = filterCurrentSections(sections, true); return sections; }
List<GenericEntity> function(String token, Map<String, String> params) { List<GenericEntity> sections = this.getSections(token, params); enrichSectionsWithSessionDetails(token, null, sections); sections = filterCurrentSections(sections, true); return sections; }
/** * Get all sections for a non-Educator * * @param token * @param params * @return */
Get all sections for a non-Educator
getSectionsForNonEducator
{ "repo_name": "inbloom/APP-dashboard", "path": "src/main/java/org/slc/sli/dashboard/client/SDKAPIClient.java", "license": "apache-2.0", "size": 64356 }
[ "java.util.List", "java.util.Map", "org.slc.sli.dashboard.entity.GenericEntity" ]
import java.util.List; import java.util.Map; import org.slc.sli.dashboard.entity.GenericEntity;
import java.util.*; import org.slc.sli.dashboard.entity.*;
[ "java.util", "org.slc.sli" ]
java.util; org.slc.sli;
1,381,517
@NotNull static Collection<String> getSubDirRelativePaths() { return Arrays.asList(slash(BRANCHHEADS), slash(MERGE)); }
static Collection<String> getSubDirRelativePaths() { return Arrays.asList(slash(BRANCHHEADS), slash(MERGE)); }
/** * Returns subdirectories of .hg which we are interested in - they should be watched by VFS. */
Returns subdirectories of .hg which we are interested in - they should be watched by VFS
getSubDirRelativePaths
{ "repo_name": "mdanielwork/intellij-community", "path": "plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryFiles.java", "license": "apache-2.0", "size": 5087 }
[ "java.util.Arrays", "java.util.Collection" ]
import java.util.Arrays; import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,630,577
public void handleMouseInput() throws IOException { super.handleMouseInput(); this.field_152311_g.func_178039_p(); }
void function() throws IOException { super.handleMouseInput(); this.field_152311_g.func_178039_p(); }
/** * Handles mouse input. */
Handles mouse input
handleMouseInput
{ "repo_name": "Hexeption/Youtube-Hacked-Client-1.8", "path": "minecraft/net/minecraft/client/gui/stream/GuiIngestServers.java", "license": "mit", "size": 6515 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
205,992
// TODO StyleListFieldEditor has an edit button, the // lower one has an import dialog which is irrelevant for this // but could be useful in general addField(new StyleListFieldEditor( TexlipseProperties.STYLE_COMPLETION_SETTINGS, TexlipsePlugin.getResourceString("preferenceStyleLabel"), getFieldEditorParent())); // addField(new KeyValueListFieldEditor( // TexlipseProperties.STYLE_COMPLETION_SETTINGS, // TexlipsePlugin.getResourceString("preferenceSmartKeyLabel"), // getFieldEditorParent())); }
addField(new StyleListFieldEditor( TexlipseProperties.STYLE_COMPLETION_SETTINGS, TexlipsePlugin.getResourceString(STR), getFieldEditorParent())); }
/** * Creates the property editing UI components of this page. */
Creates the property editing UI components of this page
createFieldEditors
{ "repo_name": "kolovos/texlipse", "path": "net.sourceforge.texlipse/src/net/sourceforge/texlipse/properties/editor/StyleCompletionPreferencePage.java", "license": "epl-1.0", "size": 2064 }
[ "net.sourceforge.texlipse.TexlipsePlugin", "net.sourceforge.texlipse.properties.TexlipseProperties" ]
import net.sourceforge.texlipse.TexlipsePlugin; import net.sourceforge.texlipse.properties.TexlipseProperties;
import net.sourceforge.texlipse.*; import net.sourceforge.texlipse.properties.*;
[ "net.sourceforge.texlipse" ]
net.sourceforge.texlipse;
1,610,892
PerProvincia provincia; String queryString = "from PerProvincia t where t.codProvincia = :codigo"; Session session = SiatHibernateUtil.currentSession(); Query query = session.createQuery(queryString).setString("codigo", codigo); provincia = (PerProvincia) query.uniqueResult(); return provincia; }
PerProvincia provincia; String queryString = STR; Session session = SiatHibernateUtil.currentSession(); Query query = session.createQuery(queryString).setString(STR, codigo); provincia = (PerProvincia) query.uniqueResult(); return provincia; }
/** * Obtiene un Provincia por su codigo */
Obtiene un Provincia por su codigo
getByCodigo
{ "repo_name": "avdata99/SIAT", "path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/per/buss/dao/PerProvinciaDAO.java", "license": "gpl-3.0", "size": 1086 }
[ "ar.gov.rosario.siat.base.buss.dao.SiatHibernateUtil", "ar.gov.rosario.siat.per.buss.bean.PerProvincia", "org.hibernate.Query", "org.hibernate.classic.Session" ]
import ar.gov.rosario.siat.base.buss.dao.SiatHibernateUtil; import ar.gov.rosario.siat.per.buss.bean.PerProvincia; import org.hibernate.Query; import org.hibernate.classic.Session;
import ar.gov.rosario.siat.base.buss.dao.*; import ar.gov.rosario.siat.per.buss.bean.*; import org.hibernate.*; import org.hibernate.classic.*;
[ "ar.gov.rosario", "org.hibernate", "org.hibernate.classic" ]
ar.gov.rosario; org.hibernate; org.hibernate.classic;
140,678
public void unregisterForDisplayInfo(Handler h) { mDisplayInfoRegistrants.remove(h); }
void function(Handler h) { mDisplayInfoRegistrants.remove(h); }
/** * Unregisters for display information notifications. * Extraneous calls are tolerated silently * * @param h Handler to be removed from the registrant list. */
Unregisters for display information notifications. Extraneous calls are tolerated silently
unregisterForDisplayInfo
{ "repo_name": "mateor/pdroid", "path": "android-4.0.3_r1/trunk/frameworks/base/telephony/java/com/android/internal/telephony/CallManager.java", "license": "gpl-3.0", "size": 66119 }
[ "android.os.Handler" ]
import android.os.Handler;
import android.os.*;
[ "android.os" ]
android.os;
102,161
public static void logp(final Object caller, final Level arg0, final String arg1, final String arg2, final String arg3, final Object[] arg4) { Logger.resolveLogger(caller).logp(arg0, arg1, arg2, arg3, arg4); }
static void function(final Object caller, final Level arg0, final String arg1, final String arg2, final String arg3, final Object[] arg4) { Logger.resolveLogger(caller).logp(arg0, arg1, arg2, arg3, arg4); }
/** * Logs a message, with associated parameter and class information * * @param caller the object calling the logger * @param arg0 the log level * @param arg1 the source class * @param arg2 the method information * @param arg3 the message * @param arg4 the parameters */
Logs a message, with associated parameter and class information
logp
{ "repo_name": "krevelen/coala", "path": "coala-adapters/coala-dsol2-adapter/src/main/java/nl/tudelft/simulation/logger/Logger.java", "license": "apache-2.0", "size": 19181 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
647,539
public MultipleCurrencyAmount presentValueFromYield( final BondTransaction<? extends BondSecurity<? extends Payment, ? extends Coupon>> bond, final IssuerProviderInterface issuerMulticurves, final double yield) { ArgumentChecker.notNull(bond, "Bond"); ArgumentChecker.isTrue(bond instanceof BondFixedTransaction, "Present value from clean price only for fixed coupon bond"); final Currency ccy = bond.getBondTransaction().getCurrency(); final MulticurveProviderInterface multicurvesDecorated = new MulticurveProviderDiscountingDecoratedIssuer( issuerMulticurves, ccy, bond.getBondTransaction().getIssuerEntity()); final BondFixedTransaction bondFixed = (BondFixedTransaction) bond; final double dfSettle = issuerMulticurves.getMulticurveProvider(). getDiscountFactor(ccy, bondFixed.getBondStandard().getSettlementTime()); final double dirtyPrice = METHOD_BOND_SECURITY.dirtyPriceFromYield(bondFixed.getBondStandard(), yield); final MultipleCurrencyAmount pvPriceStandard = MultipleCurrencyAmount.of(ccy, dirtyPrice * dfSettle); final MultipleCurrencyAmount pvNominalStandard = bond.getBondStandard().getNominal().accept(PVDC, multicurvesDecorated); final MultipleCurrencyAmount pvCouponStandard = bond.getBondStandard().getCoupon().accept(PVDC, multicurvesDecorated); final MultipleCurrencyAmount pvDiscountingStandard = pvNominalStandard.plus(pvCouponStandard); final MultipleCurrencyAmount pvNominalTransaction = bond.getBondTransaction().getNominal().accept(PVDC, multicurvesDecorated); final MultipleCurrencyAmount pvCouponTransaction = bond.getBondTransaction().getCoupon().accept(PVDC, multicurvesDecorated); final MultipleCurrencyAmount pvDiscountingTransaction = pvNominalTransaction.plus(pvCouponTransaction); double settlementAmount = -bond.getTransactionPrice() * bond.getBondTransaction().getCoupon().getNthPayment(0).getNotional(); if (bond.getBondTransaction() instanceof BondFixedSecurity) { settlementAmount -= ((BondFixedSecurity) bond.getBondTransaction()).getAccruedInterest(); } settlementAmount *= bond.getQuantity(); final PaymentFixed settlement = new PaymentFixed(bond.getBondTransaction().getCurrency(), bond.getBondTransaction().getSettlementTime(), settlementAmount); final MultipleCurrencyAmount pvSettlement = settlement.accept(PVDC, issuerMulticurves.getMulticurveProvider()); return (pvDiscountingTransaction.plus(pvDiscountingStandard.multipliedBy(-1d)).plus(pvPriceStandard)). multipliedBy(bond.getQuantity()).plus(pvSettlement); }
MultipleCurrencyAmount function( final BondTransaction<? extends BondSecurity<? extends Payment, ? extends Coupon>> bond, final IssuerProviderInterface issuerMulticurves, final double yield) { ArgumentChecker.notNull(bond, "Bond"); ArgumentChecker.isTrue(bond instanceof BondFixedTransaction, STR); final Currency ccy = bond.getBondTransaction().getCurrency(); final MulticurveProviderInterface multicurvesDecorated = new MulticurveProviderDiscountingDecoratedIssuer( issuerMulticurves, ccy, bond.getBondTransaction().getIssuerEntity()); final BondFixedTransaction bondFixed = (BondFixedTransaction) bond; final double dfSettle = issuerMulticurves.getMulticurveProvider(). getDiscountFactor(ccy, bondFixed.getBondStandard().getSettlementTime()); final double dirtyPrice = METHOD_BOND_SECURITY.dirtyPriceFromYield(bondFixed.getBondStandard(), yield); final MultipleCurrencyAmount pvPriceStandard = MultipleCurrencyAmount.of(ccy, dirtyPrice * dfSettle); final MultipleCurrencyAmount pvNominalStandard = bond.getBondStandard().getNominal().accept(PVDC, multicurvesDecorated); final MultipleCurrencyAmount pvCouponStandard = bond.getBondStandard().getCoupon().accept(PVDC, multicurvesDecorated); final MultipleCurrencyAmount pvDiscountingStandard = pvNominalStandard.plus(pvCouponStandard); final MultipleCurrencyAmount pvNominalTransaction = bond.getBondTransaction().getNominal().accept(PVDC, multicurvesDecorated); final MultipleCurrencyAmount pvCouponTransaction = bond.getBondTransaction().getCoupon().accept(PVDC, multicurvesDecorated); final MultipleCurrencyAmount pvDiscountingTransaction = pvNominalTransaction.plus(pvCouponTransaction); double settlementAmount = -bond.getTransactionPrice() * bond.getBondTransaction().getCoupon().getNthPayment(0).getNotional(); if (bond.getBondTransaction() instanceof BondFixedSecurity) { settlementAmount -= ((BondFixedSecurity) bond.getBondTransaction()).getAccruedInterest(); } settlementAmount *= bond.getQuantity(); final PaymentFixed settlement = new PaymentFixed(bond.getBondTransaction().getCurrency(), bond.getBondTransaction().getSettlementTime(), settlementAmount); final MultipleCurrencyAmount pvSettlement = settlement.accept(PVDC, issuerMulticurves.getMulticurveProvider()); return (pvDiscountingTransaction.plus(pvDiscountingStandard.multipliedBy(-1d)).plus(pvPriceStandard)). multipliedBy(bond.getQuantity()).plus(pvSettlement); }
/** * Compute the present value of a bond transaction from its conventional yield. * @param bond The bond transaction. * @param issuerMulticurves The issuer and multi-curves provider. * @param yield The bond conventional yield (in the bond convention). * @return The present value. */
Compute the present value of a bond transaction from its conventional yield
presentValueFromYield
{ "repo_name": "jeorme/OG-Platform", "path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/interestrate/bond/provider/BondTransactionDiscountingMethod.java", "license": "apache-2.0", "size": 21771 }
[ "com.opengamma.analytics.financial.interestrate.bond.definition.BondFixedSecurity", "com.opengamma.analytics.financial.interestrate.bond.definition.BondFixedTransaction", "com.opengamma.analytics.financial.interestrate.bond.definition.BondSecurity", "com.opengamma.analytics.financial.interestrate.bond.definition.BondTransaction", "com.opengamma.analytics.financial.interestrate.payments.derivative.Coupon", "com.opengamma.analytics.financial.interestrate.payments.derivative.Payment", "com.opengamma.analytics.financial.interestrate.payments.derivative.PaymentFixed", "com.opengamma.analytics.financial.provider.description.interestrate.IssuerProviderInterface", "com.opengamma.analytics.financial.provider.description.interestrate.MulticurveProviderDiscountingDecoratedIssuer", "com.opengamma.analytics.financial.provider.description.interestrate.MulticurveProviderInterface", "com.opengamma.util.ArgumentChecker", "com.opengamma.util.money.Currency", "com.opengamma.util.money.MultipleCurrencyAmount" ]
import com.opengamma.analytics.financial.interestrate.bond.definition.BondFixedSecurity; import com.opengamma.analytics.financial.interestrate.bond.definition.BondFixedTransaction; import com.opengamma.analytics.financial.interestrate.bond.definition.BondSecurity; import com.opengamma.analytics.financial.interestrate.bond.definition.BondTransaction; import com.opengamma.analytics.financial.interestrate.payments.derivative.Coupon; import com.opengamma.analytics.financial.interestrate.payments.derivative.Payment; import com.opengamma.analytics.financial.interestrate.payments.derivative.PaymentFixed; import com.opengamma.analytics.financial.provider.description.interestrate.IssuerProviderInterface; import com.opengamma.analytics.financial.provider.description.interestrate.MulticurveProviderDiscountingDecoratedIssuer; import com.opengamma.analytics.financial.provider.description.interestrate.MulticurveProviderInterface; import com.opengamma.util.ArgumentChecker; import com.opengamma.util.money.Currency; import com.opengamma.util.money.MultipleCurrencyAmount;
import com.opengamma.analytics.financial.interestrate.bond.definition.*; import com.opengamma.analytics.financial.interestrate.payments.derivative.*; import com.opengamma.analytics.financial.provider.description.interestrate.*; import com.opengamma.util.*; import com.opengamma.util.money.*;
[ "com.opengamma.analytics", "com.opengamma.util" ]
com.opengamma.analytics; com.opengamma.util;
941,628
@GET @Path("{organizationId}/applications/{applicationId}/versions/{version}/policies/{policyId}") @Produces(MediaType.APPLICATION_JSON) public PolicyBean getAppPolicy(@PathParam("organizationId") String organizationId, @PathParam("applicationId") String applicationId, @PathParam("version") String version, @PathParam("policyId") long policyId) throws OrganizationNotFoundException, ApplicationVersionNotFoundException, PolicyNotFoundException, NotAuthorizedException;
@Path(STR) @Produces(MediaType.APPLICATION_JSON) PolicyBean function(@PathParam(STR) String organizationId, @PathParam(STR) String applicationId, @PathParam(STR) String version, @PathParam(STR) long policyId) throws OrganizationNotFoundException, ApplicationVersionNotFoundException, PolicyNotFoundException, NotAuthorizedException;
/** * Use this endpoint to get information about a single Policy in the Application version. * @summary Get Application Policy * @param organizationId The Organization ID. * @param applicationId The Application ID. * @param version The Application version. * @param policyId The Policy ID. * @statuscode 200 If the Policy is successfully returned. * @statuscode 404 If the Application does not exist. * @return Full information about the Policy. * @throws OrganizationNotFoundException when trying to get, update, or delete an organization that does not exist * @throws ApplicationVersionNotFoundException when trying to get, update, or delete a application version that does not exist * @throws PolicyNotFoundException when trying to get, update, or delete a policy that does not exist * @throws NotAuthorizedException when the user attempts to do or see something that they are not authorized (do not have permission) to */
Use this endpoint to get information about a single Policy in the Application version
getAppPolicy
{ "repo_name": "kunallimaye/apiman", "path": "manager/api/rest/src/main/java/io/apiman/manager/api/rest/contract/IOrganizationResource.java", "license": "apache-2.0", "size": 111368 }
[ "io.apiman.manager.api.beans.policies.PolicyBean", "io.apiman.manager.api.rest.contract.exceptions.ApplicationVersionNotFoundException", "io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException", "io.apiman.manager.api.rest.contract.exceptions.OrganizationNotFoundException", "io.apiman.manager.api.rest.contract.exceptions.PolicyNotFoundException", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType" ]
import io.apiman.manager.api.beans.policies.PolicyBean; import io.apiman.manager.api.rest.contract.exceptions.ApplicationVersionNotFoundException; import io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException; import io.apiman.manager.api.rest.contract.exceptions.OrganizationNotFoundException; import io.apiman.manager.api.rest.contract.exceptions.PolicyNotFoundException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType;
import io.apiman.manager.api.beans.policies.*; import io.apiman.manager.api.rest.contract.exceptions.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "io.apiman.manager", "javax.ws" ]
io.apiman.manager; javax.ws;
820,418
protected boolean handleGet(Request request, Response response) throws IOException { if (logger.isLoggable(Level.FINER)) { logger.finer(log.entry("handleGet", request, response)); } MessageHeader header = request.getHeader(RtspHeaderName.ACCEPT); if (header == null || !header.getValue().equals(TUNNEL_CONTENT_TYPE)) { RequestException.create(request.getProtocolVersion(), RtspStatusCode.MethodNotAllowed, "HTTP GET request must specify acceptable content type is "+TUNNEL_CONTENT_TYPE).setResponse(response); } header = request.getHeader(TUNNEL_SESSION_COOKIE_HEADER_NAME); if (header == null) { RequestException.create(request.getProtocolVersion(), RtspStatusCode.BadRequest, "HTTP tunneling request is missing x-sessioncookie header").setResponse(response); return true; } String sessionCookie = header.getValue(); Connection outputConnection = request.getConnection(); if (logger.isLoggable(Level.FINER)) { logger.finer(log.msg("received HTTP GET tunneling request session-cookie="+sessionCookie+" connection="+Logging.identify(outputConnection))); } this.outputConnections.put(sessionCookie, outputConnection); // Add headers required by HTTP tunneling protocol response.setHeader(new SimpleMessageHeader(Entity.CONTENT_TYPE, TUNNEL_CONTENT_TYPE)); response.setHeader(new SimpleMessageHeader(HttpHeaderName.CACHE_CONTROL,"no-store")); response.setHeader(new SimpleMessageHeader(HttpHeaderName.PRAGMA,"no-cache")); response.setHeader(new SimpleMessageHeader(RtspHeaderName.CONNECTION,"close")); response.setStatus(RtspStatusCode.OK); return true; }
boolean function(Request request, Response response) throws IOException { if (logger.isLoggable(Level.FINER)) { logger.finer(log.entry(STR, request, response)); } MessageHeader header = request.getHeader(RtspHeaderName.ACCEPT); if (header == null !header.getValue().equals(TUNNEL_CONTENT_TYPE)) { RequestException.create(request.getProtocolVersion(), RtspStatusCode.MethodNotAllowed, STR+TUNNEL_CONTENT_TYPE).setResponse(response); } header = request.getHeader(TUNNEL_SESSION_COOKIE_HEADER_NAME); if (header == null) { RequestException.create(request.getProtocolVersion(), RtspStatusCode.BadRequest, STR).setResponse(response); return true; } String sessionCookie = header.getValue(); Connection outputConnection = request.getConnection(); if (logger.isLoggable(Level.FINER)) { logger.finer(log.msg(STR+sessionCookie+STR+Logging.identify(outputConnection))); } this.outputConnections.put(sessionCookie, outputConnection); response.setHeader(new SimpleMessageHeader(Entity.CONTENT_TYPE, TUNNEL_CONTENT_TYPE)); response.setHeader(new SimpleMessageHeader(HttpHeaderName.CACHE_CONTROL,STR)); response.setHeader(new SimpleMessageHeader(HttpHeaderName.PRAGMA,STR)); response.setHeader(new SimpleMessageHeader(RtspHeaderName.CONNECTION,"close")); response.setStatus(RtspStatusCode.OK); return true; }
/** * See http://developer.apple.com/quicktime/icefloe/dispatch028.html * @param request * @param response * @return * @throws IOException */
See HREF
handleGet
{ "repo_name": "chenxiuheng/js4ms", "path": "js4ms-jsdk/rtsp/src/main/java/org/js4ms/rtsp/server/RtspTransactionHandler.java", "license": "apache-2.0", "size": 18410 }
[ "java.io.IOException", "java.util.logging.Level", "org.js4ms.common.util.logging.Logging", "org.js4ms.http.message.HttpHeaderName", "org.js4ms.rest.common.RequestException", "org.js4ms.rest.entity.Entity", "org.js4ms.rest.header.SimpleMessageHeader", "org.js4ms.rest.message.MessageHeader", "org.js4ms.rest.message.Request", "org.js4ms.rest.message.Response", "org.js4ms.rtsp.message.RtspHeaderName", "org.js4ms.rtsp.message.RtspStatusCode", "org.js4ms.server.Connection" ]
import java.io.IOException; import java.util.logging.Level; import org.js4ms.common.util.logging.Logging; import org.js4ms.http.message.HttpHeaderName; import org.js4ms.rest.common.RequestException; import org.js4ms.rest.entity.Entity; import org.js4ms.rest.header.SimpleMessageHeader; import org.js4ms.rest.message.MessageHeader; import org.js4ms.rest.message.Request; import org.js4ms.rest.message.Response; import org.js4ms.rtsp.message.RtspHeaderName; import org.js4ms.rtsp.message.RtspStatusCode; import org.js4ms.server.Connection;
import java.io.*; import java.util.logging.*; import org.js4ms.common.util.logging.*; import org.js4ms.http.message.*; import org.js4ms.rest.common.*; import org.js4ms.rest.entity.*; import org.js4ms.rest.header.*; import org.js4ms.rest.message.*; import org.js4ms.rtsp.message.*; import org.js4ms.server.*;
[ "java.io", "java.util", "org.js4ms.common", "org.js4ms.http", "org.js4ms.rest", "org.js4ms.rtsp", "org.js4ms.server" ]
java.io; java.util; org.js4ms.common; org.js4ms.http; org.js4ms.rest; org.js4ms.rtsp; org.js4ms.server;
1,709,966
public void addTag(ConceptNameTag tag) { if (tags == null) { tags = new HashSet<ConceptNameTag>(); } if (!tags.contains(tag)) { tags.add(tag); } }
void function(ConceptNameTag tag) { if (tags == null) { tags = new HashSet<ConceptNameTag>(); } if (!tags.contains(tag)) { tags.add(tag); } }
/** * Attaches a tag to the concept name. * * @see Concept#setPreferredName(ConceptName) * @see Concept#setFullySpecifiedName(ConceptName) * @see Concept#setShortName(ConceptName) * @param tag the tag to add */
Attaches a tag to the concept name
addTag
{ "repo_name": "MitchellBot/openmrs-core", "path": "api/src/main/java/org/openmrs/ConceptName.java", "license": "mpl-2.0", "size": 15366 }
[ "java.util.HashSet" ]
import java.util.HashSet;
import java.util.*;
[ "java.util" ]
java.util;
1,483,083
@SuppressWarnings("unused") public static boolean isThisMainThread() { return Looper.getMainLooper().getThread() == Thread.currentThread(); } /** * Checks whether the app is currently on the system white-list, i.e. if the OS would allow execution even when in Doze mode. * Note that it makes sense to check this only on API 23 (Android 6.0) because the battery optimization API is not available in previous versions. * For all pre-Marshmallow APIs, this method will return {@code true}. * * @param context Which context to use to check * @return The value of {@link PowerManager#isIgnoringBatteryOptimizations(String)}
@SuppressWarnings(STR) static boolean function() { return Looper.getMainLooper().getThread() == Thread.currentThread(); } /** * Checks whether the app is currently on the system white-list, i.e. if the OS would allow execution even when in Doze mode. * Note that it makes sense to check this only on API 23 (Android 6.0) because the battery optimization API is not available in previous versions. * For all pre-Marshmallow APIs, this method will return {@code true}. * * @param context Which context to use to check * @return The value of {@link PowerManager#isIgnoringBatteryOptimizations(String)}
/** * Checks if this call is executed on the app's main (UI) thread. * * @return {@code True} if execution is currently on the main thread, {@code false} otherwise */
Checks if this call is executed on the app's main (UI) thread
isThisMainThread
{ "repo_name": "milosmns/silly-android", "path": "sillyandroid/src/main/java/me/angrybyte/sillyandroid/SillyAndroid.java", "license": "apache-2.0", "size": 34840 }
[ "android.os.Looper", "android.os.PowerManager" ]
import android.os.Looper; import android.os.PowerManager;
import android.os.*;
[ "android.os" ]
android.os;
757,099
public void testLastDitchSettingsLoad() throws Exception { when(mockSettingsSpiCall.invoke(any(SettingsRequest.class), eq(true))).thenReturn(null); final JSONObject expiredCachedSettingsJson = new JSONObject(); when(mockCachedSettingsIo.readCachedSettings()).thenReturn(expiredCachedSettingsJson); when(mockCurrentTimeProvider.getCurrentTimeMillis()) .thenReturn(Long.valueOf(EXPIRED_CURRENT_TIME_MILLIS)); final SettingsData expiredCachedSettings = new TestSettingsData(); when(mockSettingsJsonParser.parseSettingsJson(expiredCachedSettingsJson)) .thenReturn(expiredCachedSettings); TaskCompletionSource<Void> dataCollectionPermission = new TaskCompletionSource<>(); when(mockDataCollectionArbiter.waitForDataCollectionPermission(any(Executor.class))) .thenReturn(dataCollectionPermission.getTask()); final SettingsRequest requestData = buildSettingsRequest(); final SettingsController controller = newSettingsController( requestData, mockCurrentTimeProvider, mockSettingsJsonParser, mockCachedSettingsIo, mockSettingsSpiCall, mockDataCollectionArbiter, false); Task<Void> loadFinished = controller.loadSettingsData(SettingsCacheBehavior.SKIP_CACHE_LOOKUP, networkExecutor); assertEquals(expiredCachedSettings, controller.getSettings()); assertEquals(expiredCachedSettings.appData, await(controller.getAppSettings())); dataCollectionPermission.trySetResult(null); await(loadFinished); assertEquals(expiredCachedSettings.appData, await(controller.getAppSettings())); assertEquals(expiredCachedSettings, controller.getSettings()); verify(mockSettingsSpiCall).invoke(any(SettingsRequest.class), eq(true)); verify(mockCachedSettingsIo).readCachedSettings(); verify(mockSettingsJsonParser).parseSettingsJson(expiredCachedSettingsJson); verify(mockCurrentTimeProvider, times(2)).getCurrentTimeMillis(); }
void function() throws Exception { when(mockSettingsSpiCall.invoke(any(SettingsRequest.class), eq(true))).thenReturn(null); final JSONObject expiredCachedSettingsJson = new JSONObject(); when(mockCachedSettingsIo.readCachedSettings()).thenReturn(expiredCachedSettingsJson); when(mockCurrentTimeProvider.getCurrentTimeMillis()) .thenReturn(Long.valueOf(EXPIRED_CURRENT_TIME_MILLIS)); final SettingsData expiredCachedSettings = new TestSettingsData(); when(mockSettingsJsonParser.parseSettingsJson(expiredCachedSettingsJson)) .thenReturn(expiredCachedSettings); TaskCompletionSource<Void> dataCollectionPermission = new TaskCompletionSource<>(); when(mockDataCollectionArbiter.waitForDataCollectionPermission(any(Executor.class))) .thenReturn(dataCollectionPermission.getTask()); final SettingsRequest requestData = buildSettingsRequest(); final SettingsController controller = newSettingsController( requestData, mockCurrentTimeProvider, mockSettingsJsonParser, mockCachedSettingsIo, mockSettingsSpiCall, mockDataCollectionArbiter, false); Task<Void> loadFinished = controller.loadSettingsData(SettingsCacheBehavior.SKIP_CACHE_LOOKUP, networkExecutor); assertEquals(expiredCachedSettings, controller.getSettings()); assertEquals(expiredCachedSettings.appData, await(controller.getAppSettings())); dataCollectionPermission.trySetResult(null); await(loadFinished); assertEquals(expiredCachedSettings.appData, await(controller.getAppSettings())); assertEquals(expiredCachedSettings, controller.getSettings()); verify(mockSettingsSpiCall).invoke(any(SettingsRequest.class), eq(true)); verify(mockCachedSettingsIo).readCachedSettings(); verify(mockSettingsJsonParser).parseSettingsJson(expiredCachedSettingsJson); verify(mockCurrentTimeProvider, times(2)).getCurrentTimeMillis(); }
/** * Test loading settings in the scenario that initial cache lookup is skipped and the remote call * returns null. Should attempt another cache lookup, this time forcing use of an expired cache * result. * * @throws Exception */
Test loading settings in the scenario that initial cache lookup is skipped and the remote call returns null. Should attempt another cache lookup, this time forcing use of an expired cache result
testLastDitchSettingsLoad
{ "repo_name": "firebase/firebase-android-sdk", "path": "firebase-crashlytics/src/androidTest/java/com/google/firebase/crashlytics/internal/settings/DefaultSettingsControllerTest.java", "license": "apache-2.0", "size": 17342 }
[ "com.google.android.gms.tasks.Task", "com.google.android.gms.tasks.TaskCompletionSource", "com.google.firebase.crashlytics.internal.settings.model.SettingsData", "com.google.firebase.crashlytics.internal.settings.model.SettingsRequest", "java.util.concurrent.Executor", "org.json.JSONObject", "org.mockito.ArgumentMatchers", "org.mockito.Mockito" ]
import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.TaskCompletionSource; import com.google.firebase.crashlytics.internal.settings.model.SettingsData; import com.google.firebase.crashlytics.internal.settings.model.SettingsRequest; import java.util.concurrent.Executor; import org.json.JSONObject; import org.mockito.ArgumentMatchers; import org.mockito.Mockito;
import com.google.android.gms.tasks.*; import com.google.firebase.crashlytics.internal.settings.model.*; import java.util.concurrent.*; import org.json.*; import org.mockito.*;
[ "com.google.android", "com.google.firebase", "java.util", "org.json", "org.mockito" ]
com.google.android; com.google.firebase; java.util; org.json; org.mockito;
218,889
protected void writePlaceNames(GameModule module) { // write prototype PrototypesContainer container = module.getAllDescendantComponentsOf(PrototypesContainer.class).iterator().next(); PrototypeDefinition def = new PrototypeDefinition(); insertComponent(def, container); def.setConfigureName(PLACE_NAMES); GamePiece gp = new BasicPiece(); SequenceEncoder se = new SequenceEncoder(','); se.append(ADC2Utils.TYPE); gp = new Marker(Marker.ID + se.getValue(), gp); gp.setProperty(ADC2Utils.TYPE, PLACE_NAME); gp = new Immobilized(gp, Immobilized.ID + "n;V"); def.setPiece(gp); // write place names as pieces with no image. getMainMap(); final Point offset = getCenterOffset(); final HashSet<String> set = new HashSet<String>(); final Board board = getBoard(); for (PlaceName pn : placeNames) { String name = pn.getText(); Point p = pn.getPosition(); if (p == null) continue; if (set.contains(name)) continue; set.add(name); SetupStack stack = new SetupStack(); insertComponent(stack, getMainMap()); p.translate(offset.x, offset.y); String location = getMainMap().locationName(p); stack.setAttribute(SetupStack.NAME, name); stack.setAttribute(SetupStack.OWNING_BOARD, board.getConfigureName()); MapGrid mg = board.getGrid(); Zone z = null; if (mg instanceof ZonedGrid) z = ((ZonedGrid) mg).findZone(p); stack.setAttribute(SetupStack.X_POSITION, Integer.toString(p.x)); stack.setAttribute(SetupStack.Y_POSITION, Integer.toString(p.y)); if (z != null) { try { if (mg.getLocation(location) != null) { assert(mg.locationName(mg.getLocation(location)).equals(location)); stack.setAttribute(SetupStack.USE_GRID_LOCATION, true); stack.setAttribute(SetupStack.LOCATION, location); } } catch(BadCoords e) {} } BasicPiece bp = new BasicPiece(); se = new SequenceEncoder(BasicPiece.ID, ';'); se.append("").append("").append("").append(name); bp.mySetType(se.getValue()); se = new SequenceEncoder(UsePrototype.ID.replaceAll(";", ""), ';'); se.append(PLACE_NAMES); gp = new UsePrototype(se.getValue(), bp); PieceSlot ps = new PieceSlot(gp); insertComponent(ps, stack); } }
void function(GameModule module) { PrototypesContainer container = module.getAllDescendantComponentsOf(PrototypesContainer.class).iterator().next(); PrototypeDefinition def = new PrototypeDefinition(); insertComponent(def, container); def.setConfigureName(PLACE_NAMES); GamePiece gp = new BasicPiece(); SequenceEncoder se = new SequenceEncoder(','); se.append(ADC2Utils.TYPE); gp = new Marker(Marker.ID + se.getValue(), gp); gp.setProperty(ADC2Utils.TYPE, PLACE_NAME); gp = new Immobilized(gp, Immobilized.ID + "n;V"); def.setPiece(gp); getMainMap(); final Point offset = getCenterOffset(); final HashSet<String> set = new HashSet<String>(); final Board board = getBoard(); for (PlaceName pn : placeNames) { String name = pn.getText(); Point p = pn.getPosition(); if (p == null) continue; if (set.contains(name)) continue; set.add(name); SetupStack stack = new SetupStack(); insertComponent(stack, getMainMap()); p.translate(offset.x, offset.y); String location = getMainMap().locationName(p); stack.setAttribute(SetupStack.NAME, name); stack.setAttribute(SetupStack.OWNING_BOARD, board.getConfigureName()); MapGrid mg = board.getGrid(); Zone z = null; if (mg instanceof ZonedGrid) z = ((ZonedGrid) mg).findZone(p); stack.setAttribute(SetupStack.X_POSITION, Integer.toString(p.x)); stack.setAttribute(SetupStack.Y_POSITION, Integer.toString(p.y)); if (z != null) { try { if (mg.getLocation(location) != null) { assert(mg.locationName(mg.getLocation(location)).equals(location)); stack.setAttribute(SetupStack.USE_GRID_LOCATION, true); stack.setAttribute(SetupStack.LOCATION, location); } } catch(BadCoords e) {} } BasicPiece bp = new BasicPiece(); se = new SequenceEncoder(BasicPiece.ID, ';'); se.append(STRSTRSTR;STR"), ';'); se.append(PLACE_NAMES); gp = new UsePrototype(se.getValue(), bp); PieceSlot ps = new PieceSlot(gp); insertComponent(ps, stack); } }
/** * Write out place name information as non-stackable pieces which can be searched via * the piece inventory. * * @param module - Game module to write to. */
Write out place name information as non-stackable pieces which can be searched via the piece inventory
writePlaceNames
{ "repo_name": "rzymek/vassal-src", "path": "src/VASSAL/tools/imports/adc2/MapBoard.java", "license": "lgpl-2.1", "size": 95356 }
[ "java.awt.Point", "java.util.HashSet" ]
import java.awt.Point; import java.util.HashSet;
import java.awt.*; import java.util.*;
[ "java.awt", "java.util" ]
java.awt; java.util;
2,015,164
public void notifyInterestChanged(Channel channel) { if(channel.isWritable()){ synchronized (writeLock) { // Channel is writable again, write if there are any messages pending MessageBatch pending = batcher.drain(); flushMessages(channel, pending); } } }
void function(Channel channel) { if(channel.isWritable()){ synchronized (writeLock) { MessageBatch pending = batcher.drain(); flushMessages(channel, pending); } } }
/** * Called by Netty thread on change in channel interest * @param channel */
Called by Netty thread on change in channel interest
notifyInterestChanged
{ "repo_name": "dke-knu/i2am", "path": "rdma-based-storm/storm-core/src/jvm/org/apache/storm/messaging/netty/Client.java", "license": "apache-2.0", "size": 23638 }
[ "org.jboss.netty.channel.Channel" ]
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.*;
[ "org.jboss.netty" ]
org.jboss.netty;
2,487,824
@Override public Request<ModifyReservedInstancesRequest> getDryRunRequest() { Request<ModifyReservedInstancesRequest> request = new ModifyReservedInstancesRequestMarshaller().marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; }
Request<ModifyReservedInstancesRequest> function() { Request<ModifyReservedInstancesRequest> request = new ModifyReservedInstancesRequestMarshaller().marshall(this); request.addParameter(STR, Boolean.toString(true)); return request; }
/** * This method is intended for internal use only. Returns the marshaled request configured with additional * parameters to enable operation dry-run. */
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run
getDryRunRequest
{ "repo_name": "jentfoo/aws-sdk-java", "path": "aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifyReservedInstancesRequest.java", "license": "apache-2.0", "size": 12521 }
[ "com.amazonaws.Request", "com.amazonaws.services.ec2.model.transform.ModifyReservedInstancesRequestMarshaller" ]
import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.ModifyReservedInstancesRequestMarshaller;
import com.amazonaws.*; import com.amazonaws.services.ec2.model.transform.*;
[ "com.amazonaws", "com.amazonaws.services" ]
com.amazonaws; com.amazonaws.services;
1,160,865
@ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<RouteInner>, RouteInner> beginCreateOrUpdate( String resourceGroupName, String routeTableName, String routeName, RouteInner routeParameters, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, routeTableName, routeName, routeParameters, context) .getSyncPoller(); }
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<RouteInner>, RouteInner> function( String resourceGroupName, String routeTableName, String routeName, RouteInner routeParameters, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, routeTableName, routeName, routeParameters, context) .getSyncPoller(); }
/** * Creates or updates a route in the specified route table. * * @param resourceGroupName The name of the resource group. * @param routeTableName The name of the route table. * @param routeName The name of the route. * @param routeParameters Parameters supplied to the create or update route operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return route resource. */
Creates or updates a route in the specified route table
beginCreateOrUpdate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/RoutesClientImpl.java", "license": "mit", "size": 52647 }
[ "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.RouteInner" ]
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.RouteInner;
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;
456,036
protected void registerListeners() { // Register statically specified listeners first. for (ApplicationListener<?> listener : getApplicationListeners()) { getApplicationEventMulticaster().addApplicationListener(listener); } // Do not initialize FactoryBeans here: We need to leave all regular beans // uninitialized to let post-processors apply to them! String[] listenerBeanNames = getBeanNamesForType(ApplicationListener.class, true, false); for (String listenerBeanName : listenerBeanNames) { getApplicationEventMulticaster().addApplicationListenerBean(listenerBeanName); } // Publish early application events now that we finally have a multicaster... Set<ApplicationEvent> earlyEventsToProcess = this.earlyApplicationEvents; this.earlyApplicationEvents = null; if (earlyEventsToProcess != null) { for (ApplicationEvent earlyEvent : earlyEventsToProcess) { getApplicationEventMulticaster().multicastEvent(earlyEvent); } } }
void function() { for (ApplicationListener<?> listener : getApplicationListeners()) { getApplicationEventMulticaster().addApplicationListener(listener); } String[] listenerBeanNames = getBeanNamesForType(ApplicationListener.class, true, false); for (String listenerBeanName : listenerBeanNames) { getApplicationEventMulticaster().addApplicationListenerBean(listenerBeanName); } Set<ApplicationEvent> earlyEventsToProcess = this.earlyApplicationEvents; this.earlyApplicationEvents = null; if (earlyEventsToProcess != null) { for (ApplicationEvent earlyEvent : earlyEventsToProcess) { getApplicationEventMulticaster().multicastEvent(earlyEvent); } } }
/** * Add beans that implement ApplicationListener as listeners. * Doesn't affect other listeners, which can be added without being beans. */
Add beans that implement ApplicationListener as listeners. Doesn't affect other listeners, which can be added without being beans
registerListeners
{ "repo_name": "qobel/esoguproject", "path": "spring-framework/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java", "license": "apache-2.0", "size": 47683 }
[ "java.util.Set", "org.springframework.context.ApplicationEvent", "org.springframework.context.ApplicationListener" ]
import java.util.Set; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener;
import java.util.*; import org.springframework.context.*;
[ "java.util", "org.springframework.context" ]
java.util; org.springframework.context;
2,564,312
void updateInstanceFromMap(T instance, Map<String, Object> map, JsonParserContext context);
void updateInstanceFromMap(T instance, Map<String, Object> map, JsonParserContext context);
/** * Update {@code instance} so that the fields are set with new values from the {@link Map}. The * map should be treated as if it were a json object that is being parsed to create an object of * type {@code T}. * * @param instance The object to update. * @param map The Map from which to get the updated values. */
Update instance so that the fields are set with new values from the <code>Map</code>. The map should be treated as if it were a json object that is being parsed to create an object of type T
updateInstanceFromMap
{ "repo_name": "Workday/autoparse-json", "path": "core/src/main/java/com/workday/autoparse/json/updater/InstanceUpdater.java", "license": "mit", "size": 2734 }
[ "com.workday.autoparse.json.context.JsonParserContext", "java.util.Map" ]
import com.workday.autoparse.json.context.JsonParserContext; import java.util.Map;
import com.workday.autoparse.json.context.*; import java.util.*;
[ "com.workday.autoparse", "java.util" ]
com.workday.autoparse; java.util;
1,805,472
public static ScheduledExecutorService getDefaultScheduledExecutorService(final int nThreads) { return Executors.newScheduledThreadPool(nThreads); }
static ScheduledExecutorService function(final int nThreads) { return Executors.newScheduledThreadPool(nThreads); }
/** * Get a default implementation of a ScheduledExecutorService as used by the autoscaler. * @param nThreads the number of threads to make available in the thread pool * @return the default instance of a ScheduledExecutorService as used by the autoscale application */
Get a default implementation of a ScheduledExecutorService as used by the autoscaler
getDefaultScheduledExecutorService
{ "repo_name": "Autoscaler/autoscaler", "path": "autoscale-core/src/main/java/com/github/autoscaler/core/AutoscaleApplication.java", "license": "apache-2.0", "size": 7725 }
[ "java.util.concurrent.Executors", "java.util.concurrent.ScheduledExecutorService" ]
import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,201,292
EReference getOclExpression_InitializedVariable();
EReference getOclExpression_InitializedVariable();
/** * Returns the meta object for the container reference '{@link anatlyzer.atlext.OCL.OclExpression#getInitializedVariable <em>Initialized Variable</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the container reference '<em>Initialized Variable</em>'. * @see anatlyzer.atlext.OCL.OclExpression#getInitializedVariable() * @see #getOclExpression() * @generated */
Returns the meta object for the container reference '<code>anatlyzer.atlext.OCL.OclExpression#getInitializedVariable Initialized Variable</code>'.
getOclExpression_InitializedVariable
{ "repo_name": "jesusc/anatlyzer", "path": "plugins/anatlyzer.atl.typing/src-gen/anatlyzer/atlext/OCL/OCLPackage.java", "license": "epl-1.0", "size": 484377 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,621,530
public ArrayList<String> toArrayList(final ArrayList<String> lore) { // Variables final ArrayList<RpgCapacityType> types = new ArrayList<RpgCapacityType>(); // Get types in the correct order. for (final Type key : RpgCore.getInstance().getCapacityManager().getSortedTypes()) { // If we have it. if (map.containsKey(key)) { types.add((RpgCapacityType) key); } } // Loop for (final RpgCapacityType type : types) { // Variables final RpgCapacity capacity = map.get(type); // Skip null or zero if (type == null || capacity == null || capacity.getMax() <= 0) { continue; } // Add Capacity lore.add(String.format("%s%s%s: %s%d%s/%s%d", RpgCapacity.FLAG, ChatColor.YELLOW, type.getName(), ChatColor.GRAY, capacity.getCurrent(), ChatColor.YELLOW, ChatColor.GRAY, capacity.getMax())); } // Return return lore; }
ArrayList<String> function(final ArrayList<String> lore) { final ArrayList<RpgCapacityType> types = new ArrayList<RpgCapacityType>(); for (final Type key : RpgCore.getInstance().getCapacityManager().getSortedTypes()) { if (map.containsKey(key)) { types.add((RpgCapacityType) key); } } for (final RpgCapacityType type : types) { final RpgCapacity capacity = map.get(type); if (type == null capacity == null capacity.getMax() <= 0) { continue; } lore.add(String.format(STR, RpgCapacity.FLAG, ChatColor.YELLOW, type.getName(), ChatColor.GRAY, capacity.getCurrent(), ChatColor.YELLOW, ChatColor.GRAY, capacity.getMax())); } return lore; }
/** * Adds lore to an existing ArrayList. * * @param lore * The ArrayList we're adding to. * @return The resultant ArrayList * @author HomieDion * @since 1.0.0 */
Adds lore to an existing ArrayList
toArrayList
{ "repo_name": "homiedion/RpgCore", "path": "src/main/java/com/homiedion/rpgcore/container/capacity/RpgCapacityContainer.java", "license": "mit", "size": 9032 }
[ "com.homiedion.aeoncore.type.Type", "com.homiedion.rpgcore.RpgCore", "java.util.ArrayList", "org.bukkit.ChatColor" ]
import com.homiedion.aeoncore.type.Type; import com.homiedion.rpgcore.RpgCore; import java.util.ArrayList; import org.bukkit.ChatColor;
import com.homiedion.aeoncore.type.*; import com.homiedion.rpgcore.*; import java.util.*; import org.bukkit.*;
[ "com.homiedion.aeoncore", "com.homiedion.rpgcore", "java.util", "org.bukkit" ]
com.homiedion.aeoncore; com.homiedion.rpgcore; java.util; org.bukkit;
1,551,166
private void checkDatabaseBooted(Database database, String operation, String dbname) throws SQLException { if (database == null) { // Do not clear the TransactionResource context. It will // be restored as part of the finally clause of the constructor. this.setInactive(); throw newSQLException(SQLState.REPLICATION_DB_NOT_BOOTED, operation, dbname); } } /** Examine the attributes set provided for illegal boot combinations and determine if this is a create boot. @return true iff the attribute <em>create=true</em> is provided. This means create a standard database. In other cases, returns false. @param p the attribute set. @exception SQLException Throw if more than one of <em>create</em>, <em>createFrom</em>, <em>restoreFrom</em> and <em>rollForwardRecoveryFrom</em> is used simultaneously. <br> Also, throw if (re)encryption is attempted with one of <em>createFrom</em>, <em>restoreFrom</em> and <em>rollForwardRecoveryFrom</em>.
void function(Database database, String operation, String dbname) throws SQLException { if (database == null) { this.setInactive(); throw newSQLException(SQLState.REPLICATION_DB_NOT_BOOTED, operation, dbname); } } /** Examine the attributes set provided for illegal boot combinations and determine if this is a create boot. @return true iff the attribute <em>create=true</em> is provided. This means create a standard database. In other cases, returns false. @param p the attribute set. @exception SQLException Throw if more than one of <em>create</em>, <em>createFrom</em>, <em>restoreFrom</em> and <em>rollForwardRecoveryFrom</em> is used simultaneously. <br> Also, throw if (re)encryption is attempted with one of <em>createFrom</em>, <em>restoreFrom</em> and <em>rollForwardRecoveryFrom</em>.
/** * Check that a database has already been booted. Throws an exception * otherwise * * @param database The database that should have been booted * @param operation The operation that requires that the database has * already been booted, used in the exception message if not booted * @param dbname The name of the database that should have been booted, * used in the exception message if not booted * @throws java.sql.SQLException thrown if database is not booted */
Check that a database has already been booted. Throws an exception otherwise
checkDatabaseBooted
{ "repo_name": "trejkaz/derby", "path": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "license": "apache-2.0", "size": 142130 }
[ "java.sql.SQLException", "org.apache.derby.iapi.db.Database", "org.apache.derby.iapi.reference.SQLState" ]
import java.sql.SQLException; import org.apache.derby.iapi.db.Database; import org.apache.derby.iapi.reference.SQLState;
import java.sql.*; import org.apache.derby.iapi.db.*; import org.apache.derby.iapi.reference.*;
[ "java.sql", "org.apache.derby" ]
java.sql; org.apache.derby;
1,463,591
@Deprecated @Override public StringBuffer format(final Calendar calendar, final StringBuffer buf) { return printer.format(calendar, buf); }
StringBuffer function(final Calendar calendar, final StringBuffer buf) { return printer.format(calendar, buf); }
/** * <p>Formats a {@code Calendar} object into the * supplied {@code StringBuffer}.</p> * * @param calendar the calendar to format * @param buf the buffer to format into * @return the specified string buffer * @deprecated Use {{@link #format(Calendar, Appendable)}. */
Formats a Calendar object into the supplied StringBuffer
format
{ "repo_name": "hsjawanda/gae-objectify-utils", "path": "src/main/java/com/hsjawanda/gaeobjectify/repackaged/commons/lang3/time/FastDateFormat.java", "license": "apache-2.0", "size": 24220 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
2,004,230
@Nullable public static <A extends Annotation> A obtainAnnotationFrom(@NonNull Class<A> classOfAnnotation, @NonNull Class<?> fromClass) { return obtainAnnotationFrom(classOfAnnotation, fromClass, null); }
static <A extends Annotation> A function(@NonNull Class<A> classOfAnnotation, @NonNull Class<?> fromClass) { return obtainAnnotationFrom(classOfAnnotation, fromClass, null); }
/** * Same as {@link #obtainAnnotationFrom(Class, Class, Class)} with no <var>maxSuperClass</var> * specified so the requested annotation will be obtained only from the given class (if presented). */
Same as <code>#obtainAnnotationFrom(Class, Class, Class)</code> with no maxSuperClass specified so the requested annotation will be obtained only from the given class (if presented)
obtainAnnotationFrom
{ "repo_name": "android-libraries/android_utils", "path": "library/src/main/java/com/albedinsky/android/util/Annotations.java", "license": "apache-2.0", "size": 6247 }
[ "android.support.annotation.NonNull", "java.lang.annotation.Annotation" ]
import android.support.annotation.NonNull; import java.lang.annotation.Annotation;
import android.support.annotation.*; import java.lang.annotation.*;
[ "android.support", "java.lang" ]
android.support; java.lang;
124,318
public void setFeeMethodService(FeeMethodService feeMethodService) { this.feeMethodService = feeMethodService; }
void function(FeeMethodService feeMethodService) { this.feeMethodService = feeMethodService; }
/** * Sets the feeMethodService attribute value. * * @param feeMethodService The feeMethodService to set. */
Sets the feeMethodService attribute value
setFeeMethodService
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/endow/batch/service/impl/ProcessFeeTransactionsServiceImpl.java", "license": "apache-2.0", "size": 71214 }
[ "org.kuali.kfs.module.endow.document.service.FeeMethodService" ]
import org.kuali.kfs.module.endow.document.service.FeeMethodService;
import org.kuali.kfs.module.endow.document.service.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
1,799,457
public void deleteDocumentDrafts(List<String> documentIds) throws Exception { deleteDocumentDrafts( documentIds, null); }
void function(List<String> documentIds) throws Exception { deleteDocumentDrafts( documentIds, null); }
/** * * <p><pre><code> * DocumentDraftSummary documentdraftsummary = new DocumentDraftSummary(); * documentdraftsummary.deleteDocumentDrafts( documentIds); * </code></pre></p> * @param documentIds Unique identifiers of the documents to delete. * @return * @see string */
<code><code> DocumentDraftSummary documentdraftsummary = new DocumentDraftSummary(); documentdraftsummary.deleteDocumentDrafts( documentIds); </code></code>
deleteDocumentDrafts
{ "repo_name": "Mozu/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/resources/content/DocumentDraftSummaryResource.java", "license": "mit", "size": 5839 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,334,170
public void setConcurrency(int concurrency) { String property = "concurrency"; switch (concurrency) { case ResultSet.CONCUR_READ_ONLY: break; case ResultSet.CONCUR_UPDATABLE: break; default: throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); } Integer oldValue = new Integer(concurrency_); Integer newValue = new Integer(concurrency); concurrency_ = concurrency; changes_.firePropertyChange(property, oldValue, newValue); createNewStatement_ = true; if (JDTrace.isTraceOn()) JDTrace.logProperty (this, "concurrency", concurrency); }
void function(int concurrency) { String property = STR; switch (concurrency) { case ResultSet.CONCUR_READ_ONLY: break; case ResultSet.CONCUR_UPDATABLE: break; default: throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); } Integer oldValue = new Integer(concurrency_); Integer newValue = new Integer(concurrency); concurrency_ = concurrency; changes_.firePropertyChange(property, oldValue, newValue); createNewStatement_ = true; if (JDTrace.isTraceOn()) JDTrace.logProperty (this, STR, concurrency); }
/** * Sets the concurrency type for the result set. * Valid values include: * <ul> * <li>ResultSet.CONCUR_READ_ONLY <LI>ResultSet.CONCUR_UPDATABLE * </ul> * @param concurrency The concurrency type. **/
Sets the concurrency type for the result set. Valid values include: ResultSet.CONCUR_READ_ONLY ResultSet.CONCUR_UPDATABLE
setConcurrency
{ "repo_name": "piguangming/jt400", "path": "src/com/ibm/as400/access/AS400JDBCRowSet.java", "license": "epl-1.0", "size": 312066 }
[ "java.sql.ResultSet" ]
import java.sql.ResultSet;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,436,149
private DefaultModuleInfo readExternalModule(final ReaderHelper reader) throws IOException { final DefaultModuleInfo mi = new DefaultModuleInfo(); while (reader.hasNext()) { final String lastLineRead = reader.next(); if (Character.isWhitespace(lastLineRead.charAt(0)) == false) { // break if the current character is no whitespace ... reader.pushBack(lastLineRead); return mi; } final String line = lastLineRead.trim(); final String key = parseKey(line); if (key != null) { final String b = readValue(reader, parseValue(line)); if (key.equals("module")) { mi.setModuleClass(b); } else if (key.equals("version.major")) { mi.setMajorVersion(b); } else if (key.equals("version.minor")) { mi.setMinorVersion(b); } else if (key.equals("version.patchlevel")) { mi.setPatchLevel(b); } } } return mi; }
DefaultModuleInfo function(final ReaderHelper reader) throws IOException { final DefaultModuleInfo mi = new DefaultModuleInfo(); while (reader.hasNext()) { final String lastLineRead = reader.next(); if (Character.isWhitespace(lastLineRead.charAt(0)) == false) { reader.pushBack(lastLineRead); return mi; } final String line = lastLineRead.trim(); final String key = parseKey(line); if (key != null) { final String b = readValue(reader, parseValue(line)); if (key.equals(STR)) { mi.setModuleClass(b); } else if (key.equals(STR)) { mi.setMajorVersion(b); } else if (key.equals(STR)) { mi.setMinorVersion(b); } else if (key.equals(STR)) { mi.setPatchLevel(b); } } } return mi; }
/** * Reads an external module description. This describes either an optional or * a required module. * * @param reader the reader from where to read the module * @return the read module, never null * @throws IOException if an error occures. */
Reads an external module description. This describes either an optional or a required module
readExternalModule
{ "repo_name": "nologic/nabs", "path": "client/trunk/shared/libraries/jcommon-1.0.10/source/org/jfree/base/modules/AbstractModule.java", "license": "gpl-2.0", "size": 20754 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,487,611
public String pauseJob(String jid) throws PASchedulerException, RemoteException;
String function(String jid) throws PASchedulerException, RemoteException;
/** * pauses the given job * @return a string containing the result of the action * @throws org.ow2.proactive.scheduler.ext.matsci.client.common.exception.PASchedulerException if an error occurred while contacting the scheduler * @throws java.rmi.RemoteException */
pauses the given job
pauseJob
{ "repo_name": "lpellegr/connector-matlab-scilab", "path": "common/matsci-common-data/src/main/java/org/ow2/proactive/scheduler/ext/matsci/client/common/MatSciEnvironment.java", "license": "agpl-3.0", "size": 12763 }
[ "java.rmi.RemoteException", "org.ow2.proactive.scheduler.ext.matsci.client.common.exception.PASchedulerException" ]
import java.rmi.RemoteException; import org.ow2.proactive.scheduler.ext.matsci.client.common.exception.PASchedulerException;
import java.rmi.*; import org.ow2.proactive.scheduler.ext.matsci.client.common.exception.*;
[ "java.rmi", "org.ow2.proactive" ]
java.rmi; org.ow2.proactive;
1,002,371
@Test public void testTransitParams() throws Exception { DirectionsRoute[] routes = DirectionsApi.newRequest(context) .origin("Fisherman's Wharf, San Francisco") .destination("Union Square, San Francisco") .mode(TravelMode.TRANSIT) .transitMode(TransitMode.BUS, TransitMode.TRAM) .transitRoutingPreference(TransitRoutingPreference.LESS_WALKING) .await(); assertTrue(routes.length > 0); }
void function() throws Exception { DirectionsRoute[] routes = DirectionsApi.newRequest(context) .origin(STR) .destination(STR) .mode(TravelMode.TRANSIT) .transitMode(TransitMode.BUS, TransitMode.TRAM) .transitRoutingPreference(TransitRoutingPreference.LESS_WALKING) .await(); assertTrue(routes.length > 0); }
/** * Test the extended transit parameters: mode and routing preference. */
Test the extended transit parameters: mode and routing preference
testTransitParams
{ "repo_name": "GabrielApG/google-maps-services-java", "path": "src/test/java/com/google/maps/DirectionsApiTest.java", "license": "apache-2.0", "size": 11593 }
[ "com.google.maps.model.DirectionsRoute", "com.google.maps.model.TransitMode", "com.google.maps.model.TransitRoutingPreference", "com.google.maps.model.TravelMode", "org.junit.Assert" ]
import com.google.maps.model.DirectionsRoute; import com.google.maps.model.TransitMode; import com.google.maps.model.TransitRoutingPreference; import com.google.maps.model.TravelMode; import org.junit.Assert;
import com.google.maps.model.*; import org.junit.*;
[ "com.google.maps", "org.junit" ]
com.google.maps; org.junit;
1,396,903
public static void main(String[] args) { JFrame frame = new JFrame("FindCardsByPlayerNamePanel Test"); frame.add(new FindCardsByPlayerNamePanel(null)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 425); frame.setVisible(true); }
static void function(String[] args) { JFrame frame = new JFrame(STR); frame.add(new FindCardsByPlayerNamePanel(null)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 425); frame.setVisible(true); }
/** * This is a test function for {@link FindCardsByPlayerNamePanel}. It simply * creates a {@link javax.swing.JFrame} in which to display the panel. * * @param args Command-line arguments. (ignored) */
This is a test function for <code>FindCardsByPlayerNamePanel</code>. It simply creates a <code>javax.swing.JFrame</code> in which to display the panel
main
{ "repo_name": "BaseballCardTracker/bbct", "path": "swing/src/main/java/bbct/swing/gui/FindCardsByPlayerNamePanel.java", "license": "gpl-3.0", "size": 5343 }
[ "javax.swing.JFrame" ]
import javax.swing.JFrame;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,029,655
remove(e); // Entity can only belong to one group. Bag<Entity> entities = entitiesByGroup.get(group); if(entities == null) { entities = new Bag<Entity>(); entitiesByGroup.put(group, entities); } entities.add(e); groupByEntity.set(e.getId(), group); }
remove(e); Bag<Entity> entities = entitiesByGroup.get(group); if(entities == null) { entities = new Bag<Entity>(); entitiesByGroup.put(group, entities); } entities.add(e); groupByEntity.set(e.getId(), group); }
/** * Set the group of the entity. * * @param group group to set the entity into. * @param e entity to set into the group. */
Set the group of the entity
set
{ "repo_name": "whoshuu/artbox", "path": "artbox/src/main/java/com/whoshuu/artbox/artemis/GroupManager.java", "license": "mit", "size": 2917 }
[ "com.whoshuu.artbox.artemis.utils.Bag" ]
import com.whoshuu.artbox.artemis.utils.Bag;
import com.whoshuu.artbox.artemis.utils.*;
[ "com.whoshuu.artbox" ]
com.whoshuu.artbox;
1,100,275
public void compact(boolean major) throws IOException { getMiniHBaseCluster().compact(major); }
void function(boolean major) throws IOException { getMiniHBaseCluster().compact(major); }
/** * Compact all regions in the mini hbase cluster * @throws IOException */
Compact all regions in the mini hbase cluster
compact
{ "repo_name": "HubSpot/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 173926 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,069,395
public boolean addLinkToContentlet(Contentlet contentlet, String linkInode, String relationName, User user, boolean respectFrontendRoles);
boolean function(Contentlet contentlet, String linkInode, String relationName, User user, boolean respectFrontendRoles);
/** * Adds a relationship to a contentlet * @param contentlet * @param linkInode * @param relationName * @param user * @param respectFrontendRoles */
Adds a relationship to a contentlet
addLinkToContentlet
{ "repo_name": "zhiqinghuang/core", "path": "src/com/dotmarketing/portlets/contentlet/business/ContentletAPIPreHook.java", "license": "gpl-3.0", "size": 46827 }
[ "com.dotmarketing.portlets.contentlet.model.Contentlet", "com.liferay.portal.model.User" ]
import com.dotmarketing.portlets.contentlet.model.Contentlet; import com.liferay.portal.model.User;
import com.dotmarketing.portlets.contentlet.model.*; import com.liferay.portal.model.*;
[ "com.dotmarketing.portlets", "com.liferay.portal" ]
com.dotmarketing.portlets; com.liferay.portal;
2,319,868
public void loadHtmlIntoWebView (WebView wv) { loadHtmlIntoWebView (wv, getHtml ()); }
void function (WebView wv) { loadHtmlIntoWebView (wv, getHtml ()); }
/** * Given a web view, loads html returned by getHtml into it. * Only valid after successful parse. * @param wv */
Given a web view, loads html returned by getHtml into it. Only valid after successful parse
loadHtmlIntoWebView
{ "repo_name": "iiordanov/WiktionaryLookup", "path": "src/com/iiordanov/wiktionarylookup/WikiDici/WikiSimpleParser.java", "license": "gpl-3.0", "size": 5470 }
[ "android.webkit.WebView" ]
import android.webkit.WebView;
import android.webkit.*;
[ "android.webkit" ]
android.webkit;
2,065,076
private static boolean parseMsAcmCodecPrivate(ParsableByteArray buffer) throws ParserException { try { int formatTag = buffer.readLittleEndianUnsignedShort(); if (formatTag == WAVE_FORMAT_PCM) { return true; } else if (formatTag == WAVE_FORMAT_EXTENSIBLE) { buffer.setPosition(WAVE_FORMAT_SIZE + 6); // unionSamples(2), channelMask(4) return buffer.readLong() == WAVE_SUBFORMAT_PCM.getMostSignificantBits() && buffer.readLong() == WAVE_SUBFORMAT_PCM.getLeastSignificantBits(); } else { return false; } } catch (ArrayIndexOutOfBoundsException e) { throw new ParserException("Error parsing MS/ACM codec private"); } } }
static boolean function(ParsableByteArray buffer) throws ParserException { try { int formatTag = buffer.readLittleEndianUnsignedShort(); if (formatTag == WAVE_FORMAT_PCM) { return true; } else if (formatTag == WAVE_FORMAT_EXTENSIBLE) { buffer.setPosition(WAVE_FORMAT_SIZE + 6); return buffer.readLong() == WAVE_SUBFORMAT_PCM.getMostSignificantBits() && buffer.readLong() == WAVE_SUBFORMAT_PCM.getLeastSignificantBits(); } else { return false; } } catch (ArrayIndexOutOfBoundsException e) { throw new ParserException(STR); } } }
/** * Parses an MS/ACM codec private, returning whether it indicates PCM audio. * * @return Whether the codec private indicates PCM audio. * @throws ParserException If a parsing error occurs. */
Parses an MS/ACM codec private, returning whether it indicates PCM audio
parseMsAcmCodecPrivate
{ "repo_name": "barbarian/ExoPlayer", "path": "library/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java", "license": "apache-2.0", "size": 65895 }
[ "com.google.android.exoplayer2.ParserException", "com.google.android.exoplayer2.util.ParsableByteArray" ]
import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.util.ParsableByteArray;
import com.google.android.exoplayer2.*; import com.google.android.exoplayer2.util.*;
[ "com.google.android" ]
com.google.android;
1,622,275
@Override public OutputStream receiveUpload(final String fileName, final String mimeType) { aborted = false; failureReason = null; this.fileName = fileName; this.mimeType = mimeType; // reset has directory flag before upload view.setHasDirectory(false); try { if (view.checkIfSoftwareModuleIsSelected() && !view.checkForDuplicate(fileName, selectedSwForUpload)) { view.increaseNumberOfFileUploadsExpected(); final OutputStream saveUploadedFileDetails = view.saveUploadedFileDetails(fileName, 0, mimeType, selectedSwForUpload); eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.RECEIVE_UPLOAD, new UploadFileStatus(fileName, 0, -1, selectedSwForUpload))); return saveUploadedFileDetails; } } catch (final ArtifactUploadFailedException e) { LOG.error("Atifact upload failed {} ", e); failureReason = e.getMessage(); upload.interruptUpload(); uploadInterrupted = true; } // if final validation fails ,final no upload ,return NullOutputStream return new NullOutputStream(); }
OutputStream function(final String fileName, final String mimeType) { aborted = false; failureReason = null; this.fileName = fileName; this.mimeType = mimeType; view.setHasDirectory(false); try { if (view.checkIfSoftwareModuleIsSelected() && !view.checkForDuplicate(fileName, selectedSwForUpload)) { view.increaseNumberOfFileUploadsExpected(); final OutputStream saveUploadedFileDetails = view.saveUploadedFileDetails(fileName, 0, mimeType, selectedSwForUpload); eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.RECEIVE_UPLOAD, new UploadFileStatus(fileName, 0, -1, selectedSwForUpload))); return saveUploadedFileDetails; } } catch (final ArtifactUploadFailedException e) { LOG.error(STR, e); failureReason = e.getMessage(); upload.interruptUpload(); uploadInterrupted = true; } return new NullOutputStream(); }
/** * Create stream for {@link Upload} variant. * * @see com.vaadin.ui.Upload.Receiver#receiveUpload(java.lang.String, * java.lang.String) */
Create stream for <code>Upload</code> variant
receiveUpload
{ "repo_name": "StBurcher/hawkbit", "path": "hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadHandler.java", "license": "epl-1.0", "size": 15395 }
[ "java.io.OutputStream", "org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException", "org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus", "org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent" ]
import java.io.OutputStream; import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException; import org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus; import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent;
import java.io.*; import org.eclipse.hawkbit.repository.exception.*; import org.eclipse.hawkbit.ui.artifacts.event.*;
[ "java.io", "org.eclipse.hawkbit" ]
java.io; org.eclipse.hawkbit;
1,191,032
private void populateCache() { if (fContributionCache == null || fIdCache == null) { fContributionCache = new HashMap(32); fIdCache = new HashMap(32); Map<String, String> contributions = CheRefactoringContributions.getRefactoringContributions(); contributions.forEach( (id, clazz) -> { try { final Object implementation = CheRefactoringContributions.createExecutableExtension(clazz); if (implementation instanceof RefactoringContribution) { if (fContributionCache.get(id) != null) RefactoringCorePlugin.logErrorMessage( Messages.format( RefactoringCoreMessages.RefactoringCorePlugin_duplicate_warning, new String[] {id, clazz})); fContributionCache.put(id, implementation); fIdCache.put(implementation, id); } else RefactoringCorePlugin.logErrorMessage( Messages.format( RefactoringCoreMessages.RefactoringCorePlugin_creation_error, new String[] {id, clazz})); } catch (CoreException exception) { RefactoringCorePlugin.log(exception); } }); // final IConfigurationElement[] elements= Platform.getExtensionRegistry().getConfigurationElementsFor(RefactoringCore.ID_PLUGIN, // REFACTORING_CONTRIBUTIONS_EXTENSION_POINT); // for (int index= 0; index < elements.length; index++) { // final IConfigurationElement element= elements[index]; // final String attributeId= element.getAttribute(ATTRIBUTE_ID); // final String point= RefactoringCore.ID_PLUGIN + "." + REFACTORING_CONTRIBUTIONS_EXTENSION_POINT; //$NON-NLS-1$ // if (attributeId != null && !"".equals(attributeId)) { //$NON-NLS-1$ // final String className= element.getAttribute(ATTRIBUTE_CLASS); // if (className != null && !"".equals(className)) { //$NON-NLS-1$ // try { // final Object implementation= element.createExecutableExtension(ATTRIBUTE_CLASS); // if (implementation instanceof RefactoringContribution) { // if (fContributionCache.get(attributeId) != null) // RefactoringCorePlugin.logErrorMessage(Messages.format(RefactoringCoreMessages // .RefactoringCorePlugin_duplicate_warning, new String[] { attributeId, point})); // fContributionCache.put(attributeId, implementation); // fIdCache.put(implementation, attributeId); // } else // RefactoringCorePlugin.logErrorMessage(Messages.format(RefactoringCoreMessages.RefactoringCorePlugin_creation_error, new String[] { point, attributeId})); // } catch (CoreException exception) { // RefactoringCorePlugin.log(exception); // } // } else // RefactoringCorePlugin.logErrorMessage(Messages.format(RefactoringCoreMessages.RefactoringCorePlugin_missing_class_attribute, new String[] { point, attributeId, ATTRIBUTE_CLASS})); // } else // RefactoringCorePlugin.logErrorMessage(Messages.format(RefactoringCoreMessages.RefactoringCorePlugin_missing_attribute, new String[] { point, ATTRIBUTE_ID})); // } } }
void function() { if (fContributionCache == null fIdCache == null) { fContributionCache = new HashMap(32); fIdCache = new HashMap(32); Map<String, String> contributions = CheRefactoringContributions.getRefactoringContributions(); contributions.forEach( (id, clazz) -> { try { final Object implementation = CheRefactoringContributions.createExecutableExtension(clazz); if (implementation instanceof RefactoringContribution) { if (fContributionCache.get(id) != null) RefactoringCorePlugin.logErrorMessage( Messages.format( RefactoringCoreMessages.RefactoringCorePlugin_duplicate_warning, new String[] {id, clazz})); fContributionCache.put(id, implementation); fIdCache.put(implementation, id); } else RefactoringCorePlugin.logErrorMessage( Messages.format( RefactoringCoreMessages.RefactoringCorePlugin_creation_error, new String[] {id, clazz})); } catch (CoreException exception) { RefactoringCorePlugin.log(exception); } }); } }
/** * Populates the refactoring contribution cache if necessary. * * @since 3.3 */
Populates the refactoring contribution cache if necessary
populateCache
{ "repo_name": "TypeFox/che", "path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-ltk-core-refactoring/src/main/java/org/eclipse/ltk/internal/core/refactoring/history/RefactoringContributionManager.java", "license": "epl-1.0", "size": 8884 }
[ "java.util.HashMap", "java.util.Map", "org.eclipse.che.ltk.core.refactoring.CheRefactoringContributions", "org.eclipse.core.runtime.CoreException", "org.eclipse.ltk.core.refactoring.RefactoringContribution", "org.eclipse.ltk.internal.core.refactoring.Messages", "org.eclipse.ltk.internal.core.refactoring.RefactoringCoreMessages", "org.eclipse.ltk.internal.core.refactoring.RefactoringCorePlugin" ]
import java.util.HashMap; import java.util.Map; import org.eclipse.che.ltk.core.refactoring.CheRefactoringContributions; import org.eclipse.core.runtime.CoreException; import org.eclipse.ltk.core.refactoring.RefactoringContribution; import org.eclipse.ltk.internal.core.refactoring.Messages; import org.eclipse.ltk.internal.core.refactoring.RefactoringCoreMessages; import org.eclipse.ltk.internal.core.refactoring.RefactoringCorePlugin;
import java.util.*; import org.eclipse.che.ltk.core.refactoring.*; import org.eclipse.core.runtime.*; import org.eclipse.ltk.core.refactoring.*; import org.eclipse.ltk.internal.core.refactoring.*;
[ "java.util", "org.eclipse.che", "org.eclipse.core", "org.eclipse.ltk" ]
java.util; org.eclipse.che; org.eclipse.core; org.eclipse.ltk;
941,484
public void delete(List<?> entities) { try { entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entities); Key[] nativeKeys = new Key[entities.size()]; for (int i = 0; i < entities.size(); i++) { nativeKeys[i] = Marshaller.marshalKey(entityManager, entities.get(i)); } nativeWriter.delete(nativeKeys); entityManager.executeEntityListeners(CallbackType.POST_DELETE, entities); } catch (DatastoreException exp) { throw DatastoreUtils.wrap(exp); } }
void function(List<?> entities) { try { entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entities); Key[] nativeKeys = new Key[entities.size()]; for (int i = 0; i < entities.size(); i++) { nativeKeys[i] = Marshaller.marshalKey(entityManager, entities.get(i)); } nativeWriter.delete(nativeKeys); entityManager.executeEntityListeners(CallbackType.POST_DELETE, entities); } catch (DatastoreException exp) { throw DatastoreUtils.wrap(exp); } }
/** * Deletes the given entities from the Cloud Datastore. * * @param entities * the entities to delete. The entities must have it ID set for the deletion to succeed. * @throws EntityManagerException * if any error occurs while deleting. */
Deletes the given entities from the Cloud Datastore
delete
{ "repo_name": "sai-pullabhotla/catatumbo", "path": "src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java", "license": "apache-2.0", "size": 20518 }
[ "com.google.cloud.datastore.DatastoreException", "com.google.cloud.datastore.Key", "java.util.List" ]
import com.google.cloud.datastore.DatastoreException; import com.google.cloud.datastore.Key; import java.util.List;
import com.google.cloud.datastore.*; import java.util.*;
[ "com.google.cloud", "java.util" ]
com.google.cloud; java.util;
2,223,777
public static ASN1OctetString getInstance( Object obj) { if (obj == null || obj instanceof ASN1OctetString) { return (ASN1OctetString)obj; } else if (obj instanceof byte[]) { try { return ASN1OctetString.getInstance(ASN1Primitive.fromByteArray((byte[])obj)); } catch (IOException e) { throw new IllegalArgumentException("failed to construct OCTET STRING from byte[]: " + e.getMessage()); } } else if (obj instanceof ASN1Encodable) { ASN1Primitive primitive = ((ASN1Encodable)obj).toASN1Primitive(); if (primitive instanceof ASN1OctetString) { return (ASN1OctetString)primitive; } } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); } public ASN1OctetString( byte[] string) { if (string == null) { throw new NullPointerException("string cannot be null"); } this.string = string; }
static ASN1OctetString function( Object obj) { if (obj == null obj instanceof ASN1OctetString) { return (ASN1OctetString)obj; } else if (obj instanceof byte[]) { try { return ASN1OctetString.getInstance(ASN1Primitive.fromByteArray((byte[])obj)); } catch (IOException e) { throw new IllegalArgumentException(STR + e.getMessage()); } } else if (obj instanceof ASN1Encodable) { ASN1Primitive primitive = ((ASN1Encodable)obj).toASN1Primitive(); if (primitive instanceof ASN1OctetString) { return (ASN1OctetString)primitive; } } throw new IllegalArgumentException(STR + obj.getClass().getName()); } public ASN1OctetString( byte[] string) { if (string == null) { throw new NullPointerException(STR); } this.string = string; }
/** * return an Octet String from the given object. * * @param obj the object we want converted. * @exception IllegalArgumentException if the object cannot be converted. */
return an Octet String from the given object
getInstance
{ "repo_name": "thedrummeraki/Aki-SSL", "path": "src/org/bouncycastle/asn1/ASN1OctetString.java", "license": "apache-2.0", "size": 7719 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,458,965
void exitParamValue(@NotNull ParamsParser.ParamValueContext ctx);
void exitParamValue(@NotNull ParamsParser.ParamValueContext ctx);
/** * Exit a parse tree produced by {@link ParamsParser#paramValue}. * * @param ctx * the parse tree */
Exit a parse tree produced by <code>ParamsParser#paramValue</code>
exitParamValue
{ "repo_name": "tzbee/ansa-bot", "path": "src/com/touzbi/ansa/antlrgrammar/ParamsListener.java", "license": "mit", "size": 3062 }
[ "com.sun.istack.internal.NotNull" ]
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.*;
[ "com.sun.istack" ]
com.sun.istack;
381,319
public static boolean deleteWithoutEvents(IContext context, List<IMendixObject> objects, boolean useDeleteBehavior) { return component.core().deleteWithoutEvents(context, objects, useDeleteBehavior); }
static boolean function(IContext context, List<IMendixObject> objects, boolean useDeleteBehavior) { return component.core().deleteWithoutEvents(context, objects, useDeleteBehavior); }
/** * Deletes the given objects from the database and server cache (synchronously) without events * This action is executed in a transaction. * @param context the context. * @param objects the objects to delete. * @return returns whether the delete succeeded. */
Deletes the given objects from the database and server cache (synchronously) without events This action is executed in a transaction
deleteWithoutEvents
{ "repo_name": "mrgroen/qzIndustryPrinting", "path": "test/javasource/com/mendix/core/Core.java", "license": "apache-2.0", "size": 71337 }
[ "com.mendix.systemwideinterfaces.core.IContext", "com.mendix.systemwideinterfaces.core.IMendixObject", "java.util.List" ]
import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.systemwideinterfaces.core.IMendixObject; import java.util.List;
import com.mendix.systemwideinterfaces.core.*; import java.util.*;
[ "com.mendix.systemwideinterfaces", "java.util" ]
com.mendix.systemwideinterfaces; java.util;
1,871,616
protected List<? extends Itemset> frequentItemsets(List<? extends Itemset> candidates, Relation<BitVector> relation, int needed, DBIDs ids, ArrayModifiableDBIDs survivors, int length) { if(candidates.isEmpty()) { return Collections.emptyList(); } Itemset first = candidates.get(0); // We have an optimized codepath for large and sparse itemsets. // It probably pays off when #cands >> (avlen choose length) but we do not // currently have the average number of items. These thresholds yield // 2700, 6400, 12500, ... and thus will almost always be met until the // number of frequent itemsets is about to break down to 0. if(candidates.size() > length * length * length * 100 && first instanceof SparseItemset) { // Assume that all itemsets are sparse itemsets! @SuppressWarnings("unchecked") List<SparseItemset> sparsecand = (List<SparseItemset>) candidates; return frequentItemsetsSparse(sparsecand, relation, needed, ids, survivors, length); } for(DBIDIter iditer = ids.iter(); iditer.valid(); iditer.advance()) { BitVector bv = relation.get(iditer); // TODO: exploit that the candidate set it sorted? int lives = 0; for(Itemset candidate : candidates) { if(candidate.containedIn(bv)) { candidate.increaseSupport(); ++lives; } } if(lives > length) { survivors.add(iditer); } } // Retain only those with minimum support: List<Itemset> frequent = new ArrayList<>(candidates.size()); for(Iterator<? extends Itemset> iter = candidates.iterator(); iter.hasNext();) { final Itemset candidate = iter.next(); if(candidate.getSupport() >= needed) { frequent.add(candidate); } } return frequent; }
List<? extends Itemset> function(List<? extends Itemset> candidates, Relation<BitVector> relation, int needed, DBIDs ids, ArrayModifiableDBIDs survivors, int length) { if(candidates.isEmpty()) { return Collections.emptyList(); } Itemset first = candidates.get(0); if(candidates.size() > length * length * length * 100 && first instanceof SparseItemset) { @SuppressWarnings(STR) List<SparseItemset> sparsecand = (List<SparseItemset>) candidates; return frequentItemsetsSparse(sparsecand, relation, needed, ids, survivors, length); } for(DBIDIter iditer = ids.iter(); iditer.valid(); iditer.advance()) { BitVector bv = relation.get(iditer); int lives = 0; for(Itemset candidate : candidates) { if(candidate.containedIn(bv)) { candidate.increaseSupport(); ++lives; } } if(lives > length) { survivors.add(iditer); } } List<Itemset> frequent = new ArrayList<>(candidates.size()); for(Iterator<? extends Itemset> iter = candidates.iterator(); iter.hasNext();) { final Itemset candidate = iter.next(); if(candidate.getSupport() >= needed) { frequent.add(candidate); } } return frequent; }
/** * Returns the frequent BitSets out of the given BitSets with respect to the * given database. * * @param candidates the candidates to be evaluated * @param relation the database to evaluate the candidates on * @param needed Minimum support needed * @param ids Objects to process * @param survivors Output: objects that had at least two 1-frequent items. * @param length Itemset length * @return Itemsets with sufficient support */
Returns the frequent BitSets out of the given BitSets with respect to the given database
frequentItemsets
{ "repo_name": "elki-project/elki", "path": "elki-itemsets/src/main/java/elki/itemsetmining/APRIORI.java", "license": "agpl-3.0", "size": 22561 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.Iterator", "java.util.List" ]
import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,645,439
public void put(DatanodeID dnId, Peer peer) { Preconditions.checkNotNull(dnId); Preconditions.checkNotNull(peer); if (peer.isClosed()) return; if (capacity <= 0) { // Cache disabled. IOUtils.cleanup(LOG, peer); return; } putInternal(dnId, peer); }
void function(DatanodeID dnId, Peer peer) { Preconditions.checkNotNull(dnId); Preconditions.checkNotNull(peer); if (peer.isClosed()) return; if (capacity <= 0) { IOUtils.cleanup(LOG, peer); return; } putInternal(dnId, peer); }
/** * Give an unused socket to the cache. */
Give an unused socket to the cache
put
{ "repo_name": "oza/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/PeerCache.java", "license": "apache-2.0", "size": 7743 }
[ "com.google.common.base.Preconditions", "org.apache.hadoop.hdfs.net.Peer", "org.apache.hadoop.hdfs.protocol.DatanodeID", "org.apache.hadoop.io.IOUtils" ]
import com.google.common.base.Preconditions; import org.apache.hadoop.hdfs.net.Peer; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.io.IOUtils;
import com.google.common.base.*; import org.apache.hadoop.hdfs.net.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.io.*;
[ "com.google.common", "org.apache.hadoop" ]
com.google.common; org.apache.hadoop;
387,617
private void undoOperation(IUIContext ui) throws Exception { ui.keyClick(WT.CTRL, 'z'); }
void function(IUIContext ui) throws Exception { ui.keyClick(WT.CTRL, 'z'); }
/** * Undo the last operation. * * @param ui * @throws Exception */
Undo the last operation
undoOperation
{ "repo_name": "debabratahazra/OptimaLA", "path": "Optima/com.ose.ui.tests/src/com/ose/ui/tests/logmanager/TestEventActionEditor.java", "license": "epl-1.0", "size": 30079 }
[ "com.windowtester.runtime.IUIContext" ]
import com.windowtester.runtime.IUIContext;
import com.windowtester.runtime.*;
[ "com.windowtester.runtime" ]
com.windowtester.runtime;
2,291,599
public static Subject fromSecurityIdentity(final SecurityIdentity securityIdentity) { Assert.checkNotNullParam("securityIdentity", securityIdentity); Subject subject = new Subject(); subject.getPrincipals().add(securityIdentity.getPrincipal()); // add the 'Roles' group to the subject containing the identity's mapped roles. Group rolesGroup = new SimpleGroup("Roles"); for (String role : securityIdentity.getRoles()) { rolesGroup.addMember(new NamePrincipal(role)); } subject.getPrincipals().add(rolesGroup); // add a 'CallerPrincipal' group containing the identity's principal. Group callerPrincipalGroup = new SimpleGroup("CallerPrincipal"); callerPrincipalGroup.addMember(securityIdentity.getPrincipal()); subject.getPrincipals().add(callerPrincipalGroup); // process the identity's public and private credentials. for (Credential credential : securityIdentity.getPublicCredentials()) { if (credential instanceof PublicKeyCredential) { subject.getPublicCredentials().add(credential.castAs(PublicKeyCredential.class).getPublicKey()); } else if (credential instanceof X509CertificateChainPublicCredential) { subject.getPublicCredentials().add(credential.castAs(X509CertificateChainPublicCredential.class).getCertificateChain()); } else { subject.getPublicCredentials().add(credential); } } for (Credential credential : securityIdentity.getPrivateCredentials()) { if (credential instanceof PasswordCredential) { addPrivateCredential(subject, credential.castAs(PasswordCredential.class).getPassword()); } else if (credential instanceof SecretKeyCredential) { addPrivateCredential(subject, credential.castAs(SecretKeyCredential.class).getSecretKey()); } else if (credential instanceof KeyPairCredential) { addPrivateCredential(subject, credential.castAs(KeyPairCredential.class).getKeyPair()); } else if (credential instanceof X509CertificateChainPrivateCredential) { addPrivateCredential(subject, credential.castAs(X509CertificateChainPrivateCredential.class).getCertificateChain()); } else { addPrivateCredential(subject, credential); } } // add the identity itself as a private credential - integration code can interact with the SI instead of the Subject if desired. addPrivateCredential(subject, securityIdentity); return subject; }
static Subject function(final SecurityIdentity securityIdentity) { Assert.checkNotNullParam(STR, securityIdentity); Subject subject = new Subject(); subject.getPrincipals().add(securityIdentity.getPrincipal()); Group rolesGroup = new SimpleGroup("Roles"); for (String role : securityIdentity.getRoles()) { rolesGroup.addMember(new NamePrincipal(role)); } subject.getPrincipals().add(rolesGroup); Group callerPrincipalGroup = new SimpleGroup(STR); callerPrincipalGroup.addMember(securityIdentity.getPrincipal()); subject.getPrincipals().add(callerPrincipalGroup); for (Credential credential : securityIdentity.getPublicCredentials()) { if (credential instanceof PublicKeyCredential) { subject.getPublicCredentials().add(credential.castAs(PublicKeyCredential.class).getPublicKey()); } else if (credential instanceof X509CertificateChainPublicCredential) { subject.getPublicCredentials().add(credential.castAs(X509CertificateChainPublicCredential.class).getCertificateChain()); } else { subject.getPublicCredentials().add(credential); } } for (Credential credential : securityIdentity.getPrivateCredentials()) { if (credential instanceof PasswordCredential) { addPrivateCredential(subject, credential.castAs(PasswordCredential.class).getPassword()); } else if (credential instanceof SecretKeyCredential) { addPrivateCredential(subject, credential.castAs(SecretKeyCredential.class).getSecretKey()); } else if (credential instanceof KeyPairCredential) { addPrivateCredential(subject, credential.castAs(KeyPairCredential.class).getKeyPair()); } else if (credential instanceof X509CertificateChainPrivateCredential) { addPrivateCredential(subject, credential.castAs(X509CertificateChainPrivateCredential.class).getCertificateChain()); } else { addPrivateCredential(subject, credential); } } addPrivateCredential(subject, securityIdentity); return subject; }
/** * Converts the supplied {@link SecurityIdentity} into a {@link Subject}. * * @param securityIdentity the {@link SecurityIdentity} to be converted. * @return the constructed {@link Subject} instance. */
Converts the supplied <code>SecurityIdentity</code> into a <code>Subject</code>
fromSecurityIdentity
{ "repo_name": "sguilhen/wildfly-elytron", "path": "src/main/java/org/wildfly/security/auth/server/SubjectUtil.java", "license": "apache-2.0", "size": 6147 }
[ "java.security.acl.Group", "javax.security.auth.Subject", "org.wildfly.common.Assert", "org.wildfly.security.auth.principal.NamePrincipal", "org.wildfly.security.credential.Credential", "org.wildfly.security.credential.KeyPairCredential", "org.wildfly.security.credential.PasswordCredential", "org.wildfly.security.credential.PublicKeyCredential", "org.wildfly.security.credential.SecretKeyCredential", "org.wildfly.security.credential.X509CertificateChainPrivateCredential", "org.wildfly.security.credential.X509CertificateChainPublicCredential" ]
import java.security.acl.Group; import javax.security.auth.Subject; import org.wildfly.common.Assert; import org.wildfly.security.auth.principal.NamePrincipal; import org.wildfly.security.credential.Credential; import org.wildfly.security.credential.KeyPairCredential; import org.wildfly.security.credential.PasswordCredential; import org.wildfly.security.credential.PublicKeyCredential; import org.wildfly.security.credential.SecretKeyCredential; import org.wildfly.security.credential.X509CertificateChainPrivateCredential; import org.wildfly.security.credential.X509CertificateChainPublicCredential;
import java.security.acl.*; import javax.security.auth.*; import org.wildfly.common.*; import org.wildfly.security.auth.principal.*; import org.wildfly.security.credential.*;
[ "java.security", "javax.security", "org.wildfly.common", "org.wildfly.security" ]
java.security; javax.security; org.wildfly.common; org.wildfly.security;
1,400,298
public static Map<String, RequestBody> makeMediaItemUploadMap(Media media, File file) { Map<String, RequestBody> map = new HashMap<>(); map.put(Media.JSON_FIELD_TITLE, toRequestBody(media.getTitle().getRendered())); if (Validate.notNull(media.getCaption())) { map.put(Media.JSON_FIELD_CAPTION, toRequestBody(media.getCaption())); } if (Validate.notNull(media.getAltText())) { map.put(Media.JSON_FIELD_ALT_TEXT, toRequestBody(media.getAltText())); } if (Validate.notNull(media.getDescription())) { map.put(Media.JSON_FIELD_DESCRIPTION, toRequestBody(media.getDescription())); } String ext = ContentUtil.getImageMimeType(file.getName()); RequestBody fileBody = RequestBody.create(MediaType.parse(ext), file); map.put("file\"; filename=\"" + file.getName() + "\"", fileBody); return map; }
static Map<String, RequestBody> function(Media media, File file) { Map<String, RequestBody> map = new HashMap<>(); map.put(Media.JSON_FIELD_TITLE, toRequestBody(media.getTitle().getRendered())); if (Validate.notNull(media.getCaption())) { map.put(Media.JSON_FIELD_CAPTION, toRequestBody(media.getCaption())); } if (Validate.notNull(media.getAltText())) { map.put(Media.JSON_FIELD_ALT_TEXT, toRequestBody(media.getAltText())); } if (Validate.notNull(media.getDescription())) { map.put(Media.JSON_FIELD_DESCRIPTION, toRequestBody(media.getDescription())); } String ext = ContentUtil.getImageMimeType(file.getName()); RequestBody fileBody = RequestBody.create(MediaType.parse(ext), file); map.put("file\"; filename=\STR\"", fileBody); return map; }
/** * Helper method to construct Map used to upload Media item to WordPress. * * @param media Media item details * @param file File to upload * @return Map containing all relevant Media info needed for upload */
Helper method to construct Map used to upload Media item to WordPress
makeMediaItemUploadMap
{ "repo_name": "hihiwjc/XJBlog", "path": "app/src/main/java/cn/hihiwjc/app/xjblog/biz/util/ContentUtil.java", "license": "gpl-3.0", "size": 6595 }
[ "cn.hihiwjc.app.xjblog.biz.mod.Media", "java.io.File", "java.util.HashMap", "java.util.Map" ]
import cn.hihiwjc.app.xjblog.biz.mod.Media; import java.io.File; import java.util.HashMap; import java.util.Map;
import cn.hihiwjc.app.xjblog.biz.mod.*; import java.io.*; import java.util.*;
[ "cn.hihiwjc.app", "java.io", "java.util" ]
cn.hihiwjc.app; java.io; java.util;
201,774
@Override public void onAccuracyChanged(Sensor sensor, int accuracy) { //nothing to do here return; }
void function(Sensor sensor, int accuracy) { return; }
/** * Called when the accuracy of the sensor has changed. */
Called when the accuracy of the sensor has changed
onAccuracyChanged
{ "repo_name": "jacobpaine/PaineWalks", "path": "plugins/cordova-plugin-pedometer/src/android/PedoListener.java", "license": "mit", "size": 8983 }
[ "android.hardware.Sensor" ]
import android.hardware.Sensor;
import android.hardware.*;
[ "android.hardware" ]
android.hardware;
2,691,174
@Test() public void testDecodeAsSet() throws Exception { ASN1Element[] elements = { new ASN1OctetString("foo"), new ASN1OctetString("bar") }; ASN1Set s = new ASN1Set(elements); ASN1Element e = ASN1Element.decode(s.encode()); assertEquals(e.decodeAsSet().elements().length, 2); }
@Test() void function() throws Exception { ASN1Element[] elements = { new ASN1OctetString("foo"), new ASN1OctetString("bar") }; ASN1Set s = new ASN1Set(elements); ASN1Element e = ASN1Element.decode(s.encode()); assertEquals(e.decodeAsSet().elements().length, 2); }
/** * Tests the {@code decodeAsSet} method. * * @throws Exception If an unexpected problem occurs. */
Tests the decodeAsSet method
testDecodeAsSet
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/asn1/ASN1ElementTestCase.java", "license": "gpl-2.0", "size": 23932 }
[ "org.testng.annotations.Test" ]
import org.testng.annotations.Test;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
2,545,524
public String getRandomPassword(final Optional<Integer> length) { return RandomWebObjectFactory.randomPassword(length); }
String function(final Optional<Integer> length) { return RandomWebObjectFactory.randomPassword(length); }
/** * Gets a random password. * * @param length * the length * @return the new secure random password */
Gets a random password
getRandomPassword
{ "repo_name": "astrapi69/mystic-crypt", "path": "src/main/java/io/github/astrapi69/crypto/pw/PasswordEncryptor.java", "license": "mit", "size": 8208 }
[ "io.github.astrapi69.random.object.RandomWebObjectFactory", "java.util.Optional" ]
import io.github.astrapi69.random.object.RandomWebObjectFactory; import java.util.Optional;
import io.github.astrapi69.random.object.*; import java.util.*;
[ "io.github.astrapi69", "java.util" ]
io.github.astrapi69; java.util;
1,705,650
@Override public void showNotification(String caption, String message) { if (caption == null) { caption = "Notification"; } new Notification(caption, message, Type.TRAY_NOTIFICATION).show(Page.getCurrent()); }
void function(String caption, String message) { if (caption == null) { caption = STR; } new Notification(caption, message, Type.TRAY_NOTIFICATION).show(Page.getCurrent()); }
/** * Show a notification to the user. This notification is a tray notification * provided by Vaadin, shown in the lower right of the main window. * * @param caption A custom caption. * @param message The message to show. */
Show a notification to the user. This notification is a tray notification provided by Vaadin, shown in the lower right of the main window
showNotification
{ "repo_name": "kit-data-manager/base", "path": "UserInterface/UICommons7/src/main/java/edu/kit/dama/ui/commons/AbstractApplication.java", "license": "apache-2.0", "size": 6612 }
[ "com.vaadin.server.Page", "com.vaadin.ui.Notification" ]
import com.vaadin.server.Page; import com.vaadin.ui.Notification;
import com.vaadin.server.*; import com.vaadin.ui.*;
[ "com.vaadin.server", "com.vaadin.ui" ]
com.vaadin.server; com.vaadin.ui;
2,421,839
@Test public void testGetLibrariesReferredByTypeLTNewObj() { String folderConstant = "populateRegistryWithTypeLibraries/1"; setEnvironment(folderConstant); m_soaTypeRegistry = SOAGlobalRegistryFactory.getSOATypeRegistryInstance(); try { LibraryType type = new LibraryType(); Set<String> librariesRefered = m_soaTypeRegistry.getLibrariesReferredByType(type); boolean flag = librariesRefered.isEmpty(); assertTrue("Invalid working of getLibrariesReferredByType(LibraryType typeName)", flag); } catch (Exception ex) { ex.printStackTrace(); String exceptionMessage = "Input LibraryType's name is either null or empty."; String exceptionClassName = "org.ebayopensource.turmeric.tools.codegen.exception.BadInputValueException"; assertTrue("Exception class is invalid. \n Actual:" + ex.getClass().getName() + " \n Expected:" + exceptionClassName, ex.getClass().getName().equals(exceptionClassName)); assertTrue("Exception message is Invalid. \n Actual:" + ex.getMessage() + "\n Expected:" + exceptionMessage, ex.getMessage().contains(exceptionMessage)); } }
void function() { String folderConstant = STR; setEnvironment(folderConstant); m_soaTypeRegistry = SOAGlobalRegistryFactory.getSOATypeRegistryInstance(); try { LibraryType type = new LibraryType(); Set<String> librariesRefered = m_soaTypeRegistry.getLibrariesReferredByType(type); boolean flag = librariesRefered.isEmpty(); assertTrue(STR, flag); } catch (Exception ex) { ex.printStackTrace(); String exceptionMessage = STR; String exceptionClassName = STR; assertTrue(STR + ex.getClass().getName() + STR + exceptionClassName, ex.getClass().getName().equals(exceptionClassName)); assertTrue(STR + ex.getMessage() + STR + exceptionMessage, ex.getMessage().contains(exceptionMessage)); } }
/** * Validate the working of getLibrariesReferredByType(LibraryType typeName) for new * LibraryType object. */
Validate the working of getLibrariesReferredByType(LibraryType typeName) for new LibraryType object
testGetLibrariesReferredByTypeLTNewObj
{ "repo_name": "vthangathurai/SOA-Runtime", "path": "codegen/codegen-tools/src/test/java/org/ebayopensource/turmeric/tools/library/SOAGlobalRegistryQETest.java", "license": "apache-2.0", "size": 86836 }
[ "java.util.Set", "org.ebayopensource.turmeric.common.config.LibraryType", "org.junit.Assert" ]
import java.util.Set; import org.ebayopensource.turmeric.common.config.LibraryType; import org.junit.Assert;
import java.util.*; import org.ebayopensource.turmeric.common.config.*; import org.junit.*;
[ "java.util", "org.ebayopensource.turmeric", "org.junit" ]
java.util; org.ebayopensource.turmeric; org.junit;
736,512
public static String getShortName(final Step step, final int maxLength) { final String name = step.toString(); if (name.length() > maxLength) return name.substring(0, maxLength - 3) + "..."; return name; }
static String function(final Step step, final int maxLength) { final String name = step.toString(); if (name.length() > maxLength) return name.substring(0, maxLength - 3) + "..."; return name; }
/** * Returns the name of <i>step</i> truncated to <i>maxLength</i>. An ellipses is appended when the name exceeds * <i>maxLength</i>. * * @param step * @param maxLength Includes the 3 "..." characters that will be appended when the length of the name exceeds * maxLength. * @return short step name. */
Returns the name of step truncated to maxLength. An ellipses is appended when the name exceeds maxLength
getShortName
{ "repo_name": "jorgebay/tinkerpop", "path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java", "license": "apache-2.0", "size": 33065 }
[ "org.apache.tinkerpop.gremlin.process.traversal.Step" ]
import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.*;
[ "org.apache.tinkerpop" ]
org.apache.tinkerpop;
1,056,852
public History exec() { validateConfig(); return sd.fit(trainingData, epochs, validationData, validationFrequency, listeners.toArray(new Listener[0])); }
History function() { validateConfig(); return sd.fit(trainingData, epochs, validationData, validationFrequency, listeners.toArray(new Listener[0])); }
/** * Do the training. * * @return a {@link History} object containing the history information for this training operation * (evaluations specified in the {@link TrainingConfig}, loss values, and timing information). */
Do the training
exec
{ "repo_name": "deeplearning4j/deeplearning4j", "path": "nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/config/FitConfig.java", "license": "apache-2.0", "size": 5316 }
[ "org.nd4j.autodiff.listeners.Listener", "org.nd4j.autodiff.listeners.records.History" ]
import org.nd4j.autodiff.listeners.Listener; import org.nd4j.autodiff.listeners.records.History;
import org.nd4j.autodiff.listeners.*; import org.nd4j.autodiff.listeners.records.*;
[ "org.nd4j.autodiff" ]
org.nd4j.autodiff;
1,559,839
public List<Friend> get(String[] extras, boolean pretty, boolean sandboxed, boolean strict) throws SmugMugException{ logger.debug("get() called"); FriendsResponse requestToken = SMResponse.callMethod(this.smugmug,FriendsResponse.class, "smugmug.friends.get", null, extras, pretty, sandboxed, strict, false); logger.debug("get() result: "+(requestToken == null ? "null" : requestToken.toString())); return requestToken.getFriends(); }
List<Friend> function(String[] extras, boolean pretty, boolean sandboxed, boolean strict) throws SmugMugException{ logger.debug(STR); FriendsResponse requestToken = SMResponse.callMethod(this.smugmug,FriendsResponse.class, STR, null, extras, pretty, sandboxed, strict, false); logger.debug(STR+(requestToken == null ? "null" : requestToken.toString())); return requestToken.getFriends(); }
/** * Retrieve a list of friends for a user. * * @param extras array of extra fields to be populated. * @param pretty return formatted JSON that is easier to read * @param sandboxed Forces URLs to a location with a crossdomain.xml file. * @param strict Enable strict error handling. * @return * @throws SmugMugException */
Retrieve a list of friends for a user
get
{ "repo_name": "jkschoen/jsma", "path": "src/main/java/com/github/jkschoen/jsma/FriendsAPI.java", "license": "mit", "size": 3791 }
[ "com.github.jkschoen.jsma.misc.SmugMugException", "com.github.jkschoen.jsma.model.Friend", "com.github.jkschoen.jsma.response.FriendsResponse", "com.github.jkschoen.jsma.response.SMResponse", "java.util.List" ]
import com.github.jkschoen.jsma.misc.SmugMugException; import com.github.jkschoen.jsma.model.Friend; import com.github.jkschoen.jsma.response.FriendsResponse; import com.github.jkschoen.jsma.response.SMResponse; import java.util.List;
import com.github.jkschoen.jsma.misc.*; import com.github.jkschoen.jsma.model.*; import com.github.jkschoen.jsma.response.*; import java.util.*;
[ "com.github.jkschoen", "java.util" ]
com.github.jkschoen; java.util;
1,740,678
private void updatePartitionFullMap(AffinityTopologyVersion resTopVer, GridDhtPartitionsFullMessage msg) { cctx.versions().onExchange(msg.lastVersion().order()); assert partHistSuppliers.isEmpty(); partHistSuppliers.putAll(msg.partitionHistorySuppliers()); for (Map.Entry<Integer, GridDhtPartitionFullMap> entry : msg.partitions().entrySet()) { Integer grpId = entry.getKey(); CacheGroupContext grp = cctx.cache().cacheGroup(grpId); if (grp != null) { CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId, grp.topology().partitions()); grp.topology().update(resTopVer, entry.getValue(), cntrMap, msg.partsToReload(cctx.localNodeId(), grpId), null); } else { ClusterNode oldest = cctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE); if (oldest != null && oldest.isLocal()) { GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId, events().discoveryCache()); CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId, top.partitions()); top.update(resTopVer, entry.getValue(), cntrMap, Collections.<Integer>emptySet(), null); } } } }
void function(AffinityTopologyVersion resTopVer, GridDhtPartitionsFullMessage msg) { cctx.versions().onExchange(msg.lastVersion().order()); assert partHistSuppliers.isEmpty(); partHistSuppliers.putAll(msg.partitionHistorySuppliers()); for (Map.Entry<Integer, GridDhtPartitionFullMap> entry : msg.partitions().entrySet()) { Integer grpId = entry.getKey(); CacheGroupContext grp = cctx.cache().cacheGroup(grpId); if (grp != null) { CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId, grp.topology().partitions()); grp.topology().update(resTopVer, entry.getValue(), cntrMap, msg.partsToReload(cctx.localNodeId(), grpId), null); } else { ClusterNode oldest = cctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE); if (oldest != null && oldest.isLocal()) { GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId, events().discoveryCache()); CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId, top.partitions()); top.update(resTopVer, entry.getValue(), cntrMap, Collections.<Integer>emptySet(), null); } } } }
/** * Updates partition map in all caches. * * @param resTopVer Result topology version. * @param msg Partitions full messages. */
Updates partition map in all caches
updatePartitionFullMap
{ "repo_name": "WilliamDo/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java", "license": "apache-2.0", "size": 122910 }
[ "java.util.Collections", "java.util.Map", "org.apache.ignite.cluster.ClusterNode", "org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion", "org.apache.ignite.internal.processors.cache.CacheGroupContext", "org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology" ]
import java.util.Collections; import java.util.Map; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.CacheGroupContext; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import java.util.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.processors.affinity.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
2,658,941
public static Set<MinimalReflection> generateRareSubpositions(EvalStrategy strategy, List<MeValue> pvs) { log.info("Starting generateRareSubpositions()"); final int[][] countSlices = new int[64][strategy.nCoefficientIndices()]; final Set<MinimalReflection> original = new HashSet<>(); for (MeValue pv : pvs) { original.add(new MinimalReflection(pv.mover, pv.enemy)); } log.info(String.format("collected source positions. %,d distinct positions from %,d pvs", original.size(), pvs.size())); final ProgressUpdater progressMonitor = new ProgressUpdater("Generate rare subpositions", pvs.size()); final HashSet<MinimalReflection> mrs = new HashSet<>(); int nextProgressReport = 25000; for (int i = 0; i < pvs.size(); i++) { final MeValue pv = pvs.get(i); final MinimalReflection mr = new MinimalReflection(pv.mover, pv.enemy); final Collection<MinimalReflection> subs = mr.subPositions(); for (MinimalReflection sub : subs) { if (!original.contains(sub) && !mrs.contains(sub)) { final PositionElement element = strategy.coefficientIndices(mr.mover, mr.enemy, 0); final int[] counts = countSlices[mr.nEmpty()]; if (element.isRare(counts, 10)) { mrs.add(sub); element.updateHistogram(counts); } } } if (i >= nextProgressReport) { progressMonitor.setProgress(i); log.info((i >> 10) + "k pvs processed; " + (mrs.size() >> 10) + "k rare positions generated"); nextProgressReport *= 2; } } log.info("A total of " + (mrs.size() >> 10) + "k rare positions were created."); progressMonitor.close(); return mrs; }
static Set<MinimalReflection> function(EvalStrategy strategy, List<MeValue> pvs) { log.info(STR); final int[][] countSlices = new int[64][strategy.nCoefficientIndices()]; final Set<MinimalReflection> original = new HashSet<>(); for (MeValue pv : pvs) { original.add(new MinimalReflection(pv.mover, pv.enemy)); } log.info(String.format(STR, original.size(), pvs.size())); final ProgressUpdater progressMonitor = new ProgressUpdater(STR, pvs.size()); final HashSet<MinimalReflection> mrs = new HashSet<>(); int nextProgressReport = 25000; for (int i = 0; i < pvs.size(); i++) { final MeValue pv = pvs.get(i); final MinimalReflection mr = new MinimalReflection(pv.mover, pv.enemy); final Collection<MinimalReflection> subs = mr.subPositions(); for (MinimalReflection sub : subs) { if (!original.contains(sub) && !mrs.contains(sub)) { final PositionElement element = strategy.coefficientIndices(mr.mover, mr.enemy, 0); final int[] counts = countSlices[mr.nEmpty()]; if (element.isRare(counts, 10)) { mrs.add(sub); element.updateHistogram(counts); } } } if (i >= nextProgressReport) { progressMonitor.setProgress(i); log.info((i >> 10) + STR + (mrs.size() >> 10) + STR); nextProgressReport *= 2; } } log.info(STR + (mrs.size() >> 10) + STR); progressMonitor.close(); return mrs; }
/** * Generate a set containing minimal reflections of all Mes that are * (a) subpositions of a position in positionValues * (b) rare, and * (c) not in positionValues * * @return set of minimal reflections */
Generate a set containing minimal reflections of all Mes that are (a) subpositions of a position in positionValues (b) rare, and (c) not in positionValues
generateRareSubpositions
{ "repo_name": "weltyc/novello", "path": "src/com/welty/novello/coca/RarePositionMrSource.java", "license": "gpl-3.0", "size": 4030 }
[ "com.orbanova.common.gui.ProgressUpdater", "com.welty.novello.core.MeValue", "com.welty.novello.core.MinimalReflection", "com.welty.novello.eval.EvalStrategy", "com.welty.novello.eval.PositionElement", "java.util.Collection", "java.util.HashSet", "java.util.List", "java.util.Set" ]
import com.orbanova.common.gui.ProgressUpdater; import com.welty.novello.core.MeValue; import com.welty.novello.core.MinimalReflection; import com.welty.novello.eval.EvalStrategy; import com.welty.novello.eval.PositionElement; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set;
import com.orbanova.common.gui.*; import com.welty.novello.core.*; import com.welty.novello.eval.*; import java.util.*;
[ "com.orbanova.common", "com.welty.novello", "java.util" ]
com.orbanova.common; com.welty.novello; java.util;
1,153,126
public void writeDispose() throws CommonException{ try { writer.writeDispose(writerModel.getData()); } catch (CMException e) { throw new CommonException(e.getMessage()); } }
void function() throws CommonException{ try { writer.writeDispose(writerModel.getData()); } catch (CMException e) { throw new CommonException(e.getMessage()); } }
/** * WriteDisposes the supplied data with the Writer of the model. * * @param data The data to writeDispose. * @throws CommonException Thrown when the Writer is not available. */
WriteDisposes the supplied data with the Writer of the model
writeDispose
{ "repo_name": "PrismTech/opensplice", "path": "src/tools/cm/common/code/org/opensplice/common/model/sample/ReaderWriterDetailSampleModel.java", "license": "gpl-3.0", "size": 10096 }
[ "org.opensplice.cm.CMException", "org.opensplice.common.CommonException" ]
import org.opensplice.cm.CMException; import org.opensplice.common.CommonException;
import org.opensplice.cm.*; import org.opensplice.common.*;
[ "org.opensplice.cm", "org.opensplice.common" ]
org.opensplice.cm; org.opensplice.common;
2,091,355
String stdOut = runFlywayCommandLine(0, "largeTest.properties", "migrate"); assertTrue(stdOut.contains("Successfully applied 4 migrations")); }
String stdOut = runFlywayCommandLine(0, STR, STR); assertTrue(stdOut.contains(STR)); }
/** * Execute 1 (SQL), 1.1 (SQL) & 1.3 (Jdbc). 1.2 (Spring Jdbc) is not picked up. */
Execute 1 (SQL), 1.1 (SQL) & 1.3 (Jdbc). 1.2 (Spring Jdbc) is not picked up
migrate
{ "repo_name": "mpage23/flyway", "path": "flyway-commandline-largetest/src/test/java/org/flywaydb/commandline/largetest/CommandLineLargeTest.java", "license": "apache-2.0", "size": 7414 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,003,873
@Test public void testFetchFirstDfsCmds() throws Exception { String wareHouseDir = conf.get(HiveConf.ConfVars.METASTOREWAREHOUSE.varname); execFetchFirst("dfs -ls " + wareHouseDir, DfsProcessor.DFS_RESULT_HEADER, false); }
void function() throws Exception { String wareHouseDir = conf.get(HiveConf.ConfVars.METASTOREWAREHOUSE.varname); execFetchFirst(STR + wareHouseDir, DfsProcessor.DFS_RESULT_HEADER, false); }
/** * Test for cursor repositioning to start of resultset for non-sql commands * @throws Exception */
Test for cursor repositioning to start of resultset for non-sql commands
testFetchFirstDfsCmds
{ "repo_name": "b-slim/hive", "path": "itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java", "license": "apache-2.0", "size": 119749 }
[ "java.lang.Exception", "java.lang.String", "org.apache.hadoop.hive.conf.HiveConf", "org.apache.hadoop.hive.ql.processors.DfsProcessor" ]
import java.lang.Exception; import java.lang.String; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.ql.processors.DfsProcessor;
import java.lang.*; import org.apache.hadoop.hive.conf.*; import org.apache.hadoop.hive.ql.processors.*;
[ "java.lang", "org.apache.hadoop" ]
java.lang; org.apache.hadoop;
1,856,031
public void setDest(File dest) { destFile = dest; }
void function(File dest) { destFile = dest; }
/** * Set the destination file. * @param dest the destination file. */
Set the destination file
setDest
{ "repo_name": "Mayo-WE01051879/mayosapp", "path": "Build/src/main/org/apache/tools/ant/taskdefs/Copyfile.java", "license": "mit", "size": 3436 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,340,082
static void testHighlightingConfiguration( I_CmsSearchConfigurationHighlighting expectedConfig, I_CmsSearchConfigurationHighlighting actualConfig) { if (null == expectedConfig) { assertNull(actualConfig); return; } assertNotNull(actualConfig); assertEquals(expectedConfig.getAlternateHighlightField(), actualConfig.getAlternateHighlightField()); assertEquals(expectedConfig.getFormatter(), actualConfig.getFormatter()); assertEquals(expectedConfig.getFragmenter(), actualConfig.getFragmenter()); assertEquals(expectedConfig.getFragSize(), actualConfig.getFragSize()); assertEquals(expectedConfig.getHightlightField(), actualConfig.getHightlightField()); assertEquals( expectedConfig.getMaxAlternateHighlightFieldLength(), actualConfig.getMaxAlternateHighlightFieldLength()); assertEquals(expectedConfig.getSimplePost(), actualConfig.getSimplePost()); assertEquals(expectedConfig.getSimplePre(), actualConfig.getSimplePre()); assertEquals(expectedConfig.getSnippetsCount(), actualConfig.getSnippetsCount()); assertEquals(expectedConfig.getUseFastVectorHighlighting(), actualConfig.getUseFastVectorHighlighting()); }
static void testHighlightingConfiguration( I_CmsSearchConfigurationHighlighting expectedConfig, I_CmsSearchConfigurationHighlighting actualConfig) { if (null == expectedConfig) { assertNull(actualConfig); return; } assertNotNull(actualConfig); assertEquals(expectedConfig.getAlternateHighlightField(), actualConfig.getAlternateHighlightField()); assertEquals(expectedConfig.getFormatter(), actualConfig.getFormatter()); assertEquals(expectedConfig.getFragmenter(), actualConfig.getFragmenter()); assertEquals(expectedConfig.getFragSize(), actualConfig.getFragSize()); assertEquals(expectedConfig.getHightlightField(), actualConfig.getHightlightField()); assertEquals( expectedConfig.getMaxAlternateHighlightFieldLength(), actualConfig.getMaxAlternateHighlightFieldLength()); assertEquals(expectedConfig.getSimplePost(), actualConfig.getSimplePost()); assertEquals(expectedConfig.getSimplePre(), actualConfig.getSimplePre()); assertEquals(expectedConfig.getSnippetsCount(), actualConfig.getSnippetsCount()); assertEquals(expectedConfig.getUseFastVectorHighlighting(), actualConfig.getUseFastVectorHighlighting()); }
/** * Tests if expected and actual configuration are identically. * * @param expectedConfig the expected configuration * @param actualConfig the actual configuration */
Tests if expected and actual configuration are identically
testHighlightingConfiguration
{ "repo_name": "alkacon/opencms-core", "path": "test/org/opencms/jsp/search/config/parser/ConfigurationTester.java", "license": "lgpl-2.1", "size": 15912 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
771,291
@Override protected T doSwitch(int classifierID, EObject theEObject) { switch (classifierID) { case IntegersPackage.HLPN_NUMBER: { HLPNNumber hlpnNumber = (HLPNNumber) theEObject; T result = caseHLPNNumber(hlpnNumber); if (result == null) result = caseBuiltInSort(hlpnNumber); if (result == null) result = caseSort(hlpnNumber); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.NATURAL: { Natural natural = (Natural) theEObject; T result = caseNatural(natural); if (result == null) result = caseHLPNNumber(natural); if (result == null) result = caseBuiltInSort(natural); if (result == null) result = caseSort(natural); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.POSITIVE: { Positive positive = (Positive) theEObject; T result = casePositive(positive); if (result == null) result = caseHLPNNumber(positive); if (result == null) result = caseBuiltInSort(positive); if (result == null) result = caseSort(positive); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.HL_INTEGER: { HLInteger hlInteger = (HLInteger) theEObject; T result = caseHLInteger(hlInteger); if (result == null) result = caseHLPNNumber(hlInteger); if (result == null) result = caseBuiltInSort(hlInteger); if (result == null) result = caseSort(hlInteger); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.NUMBER_CONSTANT: { NumberConstant numberConstant = (NumberConstant) theEObject; T result = caseNumberConstant(numberConstant); if (result == null) result = caseBuiltInConstant(numberConstant); if (result == null) result = caseOperator(numberConstant); if (result == null) result = caseTerm(numberConstant); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.INTEGER_OPERATOR: { IntegerOperator integerOperator = (IntegerOperator) theEObject; T result = caseIntegerOperator(integerOperator); if (result == null) result = caseBuiltInOperator(integerOperator); if (result == null) result = caseOperator(integerOperator); if (result == null) result = caseTerm(integerOperator); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.ADDITION: { Addition addition = (Addition) theEObject; T result = caseAddition(addition); if (result == null) result = caseIntegerOperator(addition); if (result == null) result = caseBuiltInOperator(addition); if (result == null) result = caseOperator(addition); if (result == null) result = caseTerm(addition); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.SUBTRACTION: { Subtraction subtraction = (Subtraction) theEObject; T result = caseSubtraction(subtraction); if (result == null) result = caseIntegerOperator(subtraction); if (result == null) result = caseBuiltInOperator(subtraction); if (result == null) result = caseOperator(subtraction); if (result == null) result = caseTerm(subtraction); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.MULTIPLICATION: { Multiplication multiplication = (Multiplication) theEObject; T result = caseMultiplication(multiplication); if (result == null) result = caseIntegerOperator(multiplication); if (result == null) result = caseBuiltInOperator(multiplication); if (result == null) result = caseOperator(multiplication); if (result == null) result = caseTerm(multiplication); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.DIVISION: { Division division = (Division) theEObject; T result = caseDivision(division); if (result == null) result = caseIntegerOperator(division); if (result == null) result = caseBuiltInOperator(division); if (result == null) result = caseOperator(division); if (result == null) result = caseTerm(division); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.MODULO: { Modulo modulo = (Modulo) theEObject; T result = caseModulo(modulo); if (result == null) result = caseIntegerOperator(modulo); if (result == null) result = caseBuiltInOperator(modulo); if (result == null) result = caseOperator(modulo); if (result == null) result = caseTerm(modulo); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.GREATER_THAN: { GreaterThan greaterThan = (GreaterThan) theEObject; T result = caseGreaterThan(greaterThan); if (result == null) result = caseIntegerOperator(greaterThan); if (result == null) result = caseBuiltInOperator(greaterThan); if (result == null) result = caseOperator(greaterThan); if (result == null) result = caseTerm(greaterThan); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.GREATER_THAN_OR_EQUAL: { GreaterThanOrEqual greaterThanOrEqual = (GreaterThanOrEqual) theEObject; T result = caseGreaterThanOrEqual(greaterThanOrEqual); if (result == null) result = caseIntegerOperator(greaterThanOrEqual); if (result == null) result = caseBuiltInOperator(greaterThanOrEqual); if (result == null) result = caseOperator(greaterThanOrEqual); if (result == null) result = caseTerm(greaterThanOrEqual); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.LESS_THAN: { LessThan lessThan = (LessThan) theEObject; T result = caseLessThan(lessThan); if (result == null) result = caseIntegerOperator(lessThan); if (result == null) result = caseBuiltInOperator(lessThan); if (result == null) result = caseOperator(lessThan); if (result == null) result = caseTerm(lessThan); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.LESS_THAN_OR_EQUAL: { LessThanOrEqual lessThanOrEqual = (LessThanOrEqual) theEObject; T result = caseLessThanOrEqual(lessThanOrEqual); if (result == null) result = caseIntegerOperator(lessThanOrEqual); if (result == null) result = caseBuiltInOperator(lessThanOrEqual); if (result == null) result = caseOperator(lessThanOrEqual); if (result == null) result = caseTerm(lessThanOrEqual); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } }
T function(int classifierID, EObject theEObject) { switch (classifierID) { case IntegersPackage.HLPN_NUMBER: { HLPNNumber hlpnNumber = (HLPNNumber) theEObject; T result = caseHLPNNumber(hlpnNumber); if (result == null) result = caseBuiltInSort(hlpnNumber); if (result == null) result = caseSort(hlpnNumber); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.NATURAL: { Natural natural = (Natural) theEObject; T result = caseNatural(natural); if (result == null) result = caseHLPNNumber(natural); if (result == null) result = caseBuiltInSort(natural); if (result == null) result = caseSort(natural); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.POSITIVE: { Positive positive = (Positive) theEObject; T result = casePositive(positive); if (result == null) result = caseHLPNNumber(positive); if (result == null) result = caseBuiltInSort(positive); if (result == null) result = caseSort(positive); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.HL_INTEGER: { HLInteger hlInteger = (HLInteger) theEObject; T result = caseHLInteger(hlInteger); if (result == null) result = caseHLPNNumber(hlInteger); if (result == null) result = caseBuiltInSort(hlInteger); if (result == null) result = caseSort(hlInteger); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.NUMBER_CONSTANT: { NumberConstant numberConstant = (NumberConstant) theEObject; T result = caseNumberConstant(numberConstant); if (result == null) result = caseBuiltInConstant(numberConstant); if (result == null) result = caseOperator(numberConstant); if (result == null) result = caseTerm(numberConstant); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.INTEGER_OPERATOR: { IntegerOperator integerOperator = (IntegerOperator) theEObject; T result = caseIntegerOperator(integerOperator); if (result == null) result = caseBuiltInOperator(integerOperator); if (result == null) result = caseOperator(integerOperator); if (result == null) result = caseTerm(integerOperator); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.ADDITION: { Addition addition = (Addition) theEObject; T result = caseAddition(addition); if (result == null) result = caseIntegerOperator(addition); if (result == null) result = caseBuiltInOperator(addition); if (result == null) result = caseOperator(addition); if (result == null) result = caseTerm(addition); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.SUBTRACTION: { Subtraction subtraction = (Subtraction) theEObject; T result = caseSubtraction(subtraction); if (result == null) result = caseIntegerOperator(subtraction); if (result == null) result = caseBuiltInOperator(subtraction); if (result == null) result = caseOperator(subtraction); if (result == null) result = caseTerm(subtraction); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.MULTIPLICATION: { Multiplication multiplication = (Multiplication) theEObject; T result = caseMultiplication(multiplication); if (result == null) result = caseIntegerOperator(multiplication); if (result == null) result = caseBuiltInOperator(multiplication); if (result == null) result = caseOperator(multiplication); if (result == null) result = caseTerm(multiplication); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.DIVISION: { Division division = (Division) theEObject; T result = caseDivision(division); if (result == null) result = caseIntegerOperator(division); if (result == null) result = caseBuiltInOperator(division); if (result == null) result = caseOperator(division); if (result == null) result = caseTerm(division); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.MODULO: { Modulo modulo = (Modulo) theEObject; T result = caseModulo(modulo); if (result == null) result = caseIntegerOperator(modulo); if (result == null) result = caseBuiltInOperator(modulo); if (result == null) result = caseOperator(modulo); if (result == null) result = caseTerm(modulo); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.GREATER_THAN: { GreaterThan greaterThan = (GreaterThan) theEObject; T result = caseGreaterThan(greaterThan); if (result == null) result = caseIntegerOperator(greaterThan); if (result == null) result = caseBuiltInOperator(greaterThan); if (result == null) result = caseOperator(greaterThan); if (result == null) result = caseTerm(greaterThan); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.GREATER_THAN_OR_EQUAL: { GreaterThanOrEqual greaterThanOrEqual = (GreaterThanOrEqual) theEObject; T result = caseGreaterThanOrEqual(greaterThanOrEqual); if (result == null) result = caseIntegerOperator(greaterThanOrEqual); if (result == null) result = caseBuiltInOperator(greaterThanOrEqual); if (result == null) result = caseOperator(greaterThanOrEqual); if (result == null) result = caseTerm(greaterThanOrEqual); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.LESS_THAN: { LessThan lessThan = (LessThan) theEObject; T result = caseLessThan(lessThan); if (result == null) result = caseIntegerOperator(lessThan); if (result == null) result = caseBuiltInOperator(lessThan); if (result == null) result = caseOperator(lessThan); if (result == null) result = caseTerm(lessThan); if (result == null) result = defaultCase(theEObject); return result; } case IntegersPackage.LESS_THAN_OR_EQUAL: { LessThanOrEqual lessThanOrEqual = (LessThanOrEqual) theEObject; T result = caseLessThanOrEqual(lessThanOrEqual); if (result == null) result = caseIntegerOperator(lessThanOrEqual); if (result == null) result = caseBuiltInOperator(lessThanOrEqual); if (result == null) result = caseOperator(lessThanOrEqual); if (result == null) result = caseTerm(lessThanOrEqual); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } }
/** * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */
Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
doSwitch
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/integers/util/IntegersSwitch.java", "license": "epl-1.0", "size": 22808 }
[ "fr.lip6.move.pnml.hlpn.integers.Addition", "fr.lip6.move.pnml.hlpn.integers.Division", "fr.lip6.move.pnml.hlpn.integers.GreaterThan", "fr.lip6.move.pnml.hlpn.integers.GreaterThanOrEqual", "fr.lip6.move.pnml.hlpn.integers.HLInteger", "fr.lip6.move.pnml.hlpn.integers.HLPNNumber", "fr.lip6.move.pnml.hlpn.integers.IntegerOperator", "fr.lip6.move.pnml.hlpn.integers.IntegersPackage", "fr.lip6.move.pnml.hlpn.integers.LessThan", "fr.lip6.move.pnml.hlpn.integers.LessThanOrEqual", "fr.lip6.move.pnml.hlpn.integers.Modulo", "fr.lip6.move.pnml.hlpn.integers.Multiplication", "fr.lip6.move.pnml.hlpn.integers.Natural", "fr.lip6.move.pnml.hlpn.integers.NumberConstant", "fr.lip6.move.pnml.hlpn.integers.Positive", "fr.lip6.move.pnml.hlpn.integers.Subtraction", "org.eclipse.emf.ecore.EObject" ]
import fr.lip6.move.pnml.hlpn.integers.Addition; import fr.lip6.move.pnml.hlpn.integers.Division; import fr.lip6.move.pnml.hlpn.integers.GreaterThan; import fr.lip6.move.pnml.hlpn.integers.GreaterThanOrEqual; import fr.lip6.move.pnml.hlpn.integers.HLInteger; import fr.lip6.move.pnml.hlpn.integers.HLPNNumber; import fr.lip6.move.pnml.hlpn.integers.IntegerOperator; import fr.lip6.move.pnml.hlpn.integers.IntegersPackage; import fr.lip6.move.pnml.hlpn.integers.LessThan; import fr.lip6.move.pnml.hlpn.integers.LessThanOrEqual; import fr.lip6.move.pnml.hlpn.integers.Modulo; import fr.lip6.move.pnml.hlpn.integers.Multiplication; import fr.lip6.move.pnml.hlpn.integers.Natural; import fr.lip6.move.pnml.hlpn.integers.NumberConstant; import fr.lip6.move.pnml.hlpn.integers.Positive; import fr.lip6.move.pnml.hlpn.integers.Subtraction; import org.eclipse.emf.ecore.EObject;
import fr.lip6.move.pnml.hlpn.integers.*; import org.eclipse.emf.ecore.*;
[ "fr.lip6.move", "org.eclipse.emf" ]
fr.lip6.move; org.eclipse.emf;
708,735
private void setTaskStagingDir() { if (this.jobState.contains(ConfigurationKeys.WRITER_STAGING_DIR)) { LOG.warn(String.format("Property %s is deprecated. No need to use it if %s is specified.", ConfigurationKeys.WRITER_STAGING_DIR, ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY)); } else { String workingDir = this.jobState.getProp(ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY); this.jobState .setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(workingDir, TASK_STAGING_DIR_NAME).toString()); LOG.info(String.format("Writer Staging Directory is set to %s.", this.jobState.getProp(ConfigurationKeys.WRITER_STAGING_DIR))); } }
void function() { if (this.jobState.contains(ConfigurationKeys.WRITER_STAGING_DIR)) { LOG.warn(String.format(STR, ConfigurationKeys.WRITER_STAGING_DIR, ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY)); } else { String workingDir = this.jobState.getProp(ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY); this.jobState .setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(workingDir, TASK_STAGING_DIR_NAME).toString()); LOG.info(String.format(STR, this.jobState.getProp(ConfigurationKeys.WRITER_STAGING_DIR))); } }
/** * If {@link ConfigurationKeys#WRITER_STAGING_DIR} (which is deprecated) is specified, use its value. * * Otherwise, if {@link ConfigurationKeys#TASK_DATA_ROOT_DIR_KEY} is specified, use its value * plus {@link #TASK_STAGING_DIR_NAME}. */
If <code>ConfigurationKeys#WRITER_STAGING_DIR</code> (which is deprecated) is specified, use its value. Otherwise, if <code>ConfigurationKeys#TASK_DATA_ROOT_DIR_KEY</code> is specified, use its value plus <code>#TASK_STAGING_DIR_NAME</code>
setTaskStagingDir
{ "repo_name": "arjun4084346/gobblin", "path": "gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobContext.java", "license": "apache-2.0", "size": 22821 }
[ "org.apache.gobblin.configuration.ConfigurationKeys", "org.apache.hadoop.fs.Path" ]
import org.apache.gobblin.configuration.ConfigurationKeys; import org.apache.hadoop.fs.Path;
import org.apache.gobblin.configuration.*; import org.apache.hadoop.fs.*;
[ "org.apache.gobblin", "org.apache.hadoop" ]
org.apache.gobblin; org.apache.hadoop;
15,439
public FutureTask<Object> logicalPlanModification(List<LogicalPlanRequest> requests) throws Exception { // delegate processing to dispatch thread FutureTask<Object> future = new FutureTask<>(new LogicalPlanChangeRunnable(requests)); dispatch(future); //LOG.info("Scheduled plan changes: {}", requests); return future; } private class LogicalPlanChangeRunnable implements java.util.concurrent.Callable<Object> { final List<LogicalPlanRequest> requests; private LogicalPlanChangeRunnable(List<LogicalPlanRequest> requests) { this.requests = requests; }
FutureTask<Object> function(List<LogicalPlanRequest> requests) throws Exception { FutureTask<Object> future = new FutureTask<>(new LogicalPlanChangeRunnable(requests)); dispatch(future); return future; } private class LogicalPlanChangeRunnable implements java.util.concurrent.Callable<Object> { final List<LogicalPlanRequest> requests; private LogicalPlanChangeRunnable(List<LogicalPlanRequest> requests) { this.requests = requests; }
/** * Asynchronously process the logical, physical plan and execution layer changes. * Caller can use the returned future to block until processing is complete. * * @param requests * @return future * @throws Exception */
Asynchronously process the logical, physical plan and execution layer changes. Caller can use the returned future to block until processing is complete
logicalPlanModification
{ "repo_name": "devtagare/incubator-apex-core", "path": "engine/src/main/java/com/datatorrent/stram/StreamingContainerManager.java", "license": "apache-2.0", "size": 133279 }
[ "com.datatorrent.stram.plan.logical.requests.LogicalPlanRequest", "java.util.List", "java.util.concurrent.Callable", "java.util.concurrent.FutureTask" ]
import com.datatorrent.stram.plan.logical.requests.LogicalPlanRequest; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.FutureTask;
import com.datatorrent.stram.plan.logical.requests.*; import java.util.*; import java.util.concurrent.*;
[ "com.datatorrent.stram", "java.util" ]
com.datatorrent.stram; java.util;
722,987
void setMessage(Player player, String message, float percent);
void setMessage(Player player, String message, float percent);
/** * Sends a message with the bar willed in percent % * * @param player the player * @param message the message * @param percent percent */
Sends a message with the bar willed in percent %
setMessage
{ "repo_name": "MarcinWieczorek/NovaGuilds", "path": "src/main/java/co/marcin/novaguilds/api/util/IBossBarUtils.java", "license": "gpl-3.0", "size": 2593 }
[ "org.bukkit.entity.Player" ]
import org.bukkit.entity.Player;
import org.bukkit.entity.*;
[ "org.bukkit.entity" ]
org.bukkit.entity;
900,355
void setAriaMultiselectableProperty(Element element, boolean value);
void setAriaMultiselectableProperty(Element element, boolean value);
/** * Sets the <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> * aria-multiselectable</a> attribute for the {@code element} to the given {@code value}. */
Sets the aria-multiselectable attribute for the element to the given value
setAriaMultiselectableProperty
{ "repo_name": "gwtproject/gwt-aria", "path": "gwt-aria/src/main/java/org/gwtproject/aria/client/TreeRole.java", "license": "apache-2.0", "size": 2629 }
[ "org.gwtproject.dom.client.Element" ]
import org.gwtproject.dom.client.Element;
import org.gwtproject.dom.client.*;
[ "org.gwtproject.dom" ]
org.gwtproject.dom;
1,678,076
@Override public void exitTopLevelDecl(@NotNull GolangParser.TopLevelDeclContext ctx) { }
@Override public void exitTopLevelDecl(@NotNull GolangParser.TopLevelDeclContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterTopLevelDecl
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/GolangBaseListener.java", "license": "gpl-3.0", "size": 35571 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
726,686
protected static byte[] getImageData(Base64Binary imgBase64Data) throws XPathException { //decode the base64 image data Base64Decoder dec = new Base64Decoder(); dec.translate(imgBase64Data.getStringValue()); //return the raw binary data return dec.getByteArray(); }
static byte[] function(Base64Binary imgBase64Data) throws XPathException { Base64Decoder dec = new Base64Decoder(); dec.translate(imgBase64Data.getStringValue()); return dec.getByteArray(); }
/** * Get's an the raw binary data from base64 binary encoded image data * * @param imgBase64Data The base64 encoded image data * * @return The raw binary data */
Get's an the raw binary data from base64 binary encoded image data
getImageData
{ "repo_name": "orbeon/eXist-1.4.x", "path": "extensions/modules/src/org/exist/xquery/modules/image/ImageModule.java", "license": "lgpl-2.1", "size": 5408 }
[ "org.exist.util.Base64Decoder", "org.exist.xquery.XPathException", "org.exist.xquery.value.Base64Binary" ]
import org.exist.util.Base64Decoder; import org.exist.xquery.XPathException; import org.exist.xquery.value.Base64Binary;
import org.exist.util.*; import org.exist.xquery.*; import org.exist.xquery.value.*;
[ "org.exist.util", "org.exist.xquery" ]
org.exist.util; org.exist.xquery;
2,188,487
public Invitation getInvitation(int senderId, int receiverId) { Connection connection = null; try { connection = getConnection(); return invitationDao.getInvitation(connection, senderId, receiverId); } catch (Exception ex) { SilverTrace.error("Silverpeas.Bus.SocialNetwork.Invitation", "InvitationService.ignoreInvitation", "", ex); } finally { DBUtil.close(connection); } return null; }
Invitation function(int senderId, int receiverId) { Connection connection = null; try { connection = getConnection(); return invitationDao.getInvitation(connection, senderId, receiverId); } catch (Exception ex) { SilverTrace.error(STR, STR, "", ex); } finally { DBUtil.close(connection); } return null; }
/** * rturn invitation between 2 users * @param senderId * @param receiverId * @return Invitation */
rturn invitation between 2 users
getInvitation
{ "repo_name": "NicolasEYSSERIC/Silverpeas-Core", "path": "lib-core/src/main/java/com/silverpeas/socialnetwork/invitation/InvitationService.java", "license": "agpl-3.0", "size": 8823 }
[ "com.stratelia.silverpeas.silvertrace.SilverTrace", "com.stratelia.webactiv.util.DBUtil", "java.sql.Connection" ]
import com.stratelia.silverpeas.silvertrace.SilverTrace; import com.stratelia.webactiv.util.DBUtil; import java.sql.Connection;
import com.stratelia.silverpeas.silvertrace.*; import com.stratelia.webactiv.util.*; import java.sql.*;
[ "com.stratelia.silverpeas", "com.stratelia.webactiv", "java.sql" ]
com.stratelia.silverpeas; com.stratelia.webactiv; java.sql;
1,233,225
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<Boolean> getSubscriptionExists(String topicName, String subscriptionName) { return getSubscriptionExistsWithResponse(topicName, subscriptionName).map(Response::getValue); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Boolean> function(String topicName, String subscriptionName) { return getSubscriptionExistsWithResponse(topicName, subscriptionName).map(Response::getValue); }
/** * Gets whether or not a subscription within a topic exists. * * @param topicName Name of topic associated with subscription. * @param subscriptionName Name of the subscription. * * @return A Mono that completes indicating whether or not the subscription exists. * @throws ClientAuthenticationException if the client's credentials do not have access to modify the * namespace. * @throws HttpResponseException If error occurred processing the request. * @throws IllegalArgumentException if {@code subscriptionName} is an empty string. * @throws NullPointerException if {@code subscriptionName} is null. */
Gets whether or not a subscription within a topic exists
getSubscriptionExists
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClient.java", "license": "mit", "size": 144140 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*;
[ "com.azure.core" ]
com.azure.core;
2,726,340
@SuppressWarnings("removal") private Enumeration<URL> findResourcesOnClassPath(String name) { if (hasClassPath()) { if (System.getSecurityManager() == null) { return ucp.findResources(name, false); } else { PrivilegedAction<Enumeration<URL>> pa; pa = () -> ucp.findResources(name, false); return AccessController.doPrivileged(pa); } } else { // no class path return Collections.emptyEnumeration(); } } // -- finding/loading classes
@SuppressWarnings(STR) Enumeration<URL> function(String name) { if (hasClassPath()) { if (System.getSecurityManager() == null) { return ucp.findResources(name, false); } else { PrivilegedAction<Enumeration<URL>> pa; pa = () -> ucp.findResources(name, false); return AccessController.doPrivileged(pa); } } else { return Collections.emptyEnumeration(); } }
/** * Returns the URLs of all resources of the given name on the class path. */
Returns the URLs of all resources of the given name on the class path
findResourcesOnClassPath
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/jdk/internal/loader/BuiltinClassLoader.java", "license": "apache-2.0", "size": 38210 }
[ "java.security.AccessController", "java.security.PrivilegedAction", "java.util.Collections", "java.util.Enumeration" ]
import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Collections; import java.util.Enumeration;
import java.security.*; import java.util.*;
[ "java.security", "java.util" ]
java.security; java.util;
1,710,175
public Map<String, Object> getBulk(String... keys) { return getBulk(Arrays.asList(keys), transcoder); }
Map<String, Object> function(String... keys) { return getBulk(Arrays.asList(keys), transcoder); }
/** * Get the values for multiple keys from the cache. * * @param keys the keys * @return a map of the values (for each value that exists) * @throws OperationTimeoutException if the global operation timeout is * exceeded * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */
Get the values for multiple keys from the cache
getBulk
{ "repo_name": "zjjxxl/java-memcached-client", "path": "src/main/java/net/spy/memcached/MemcachedClient.java", "license": "mit", "size": 54244 }
[ "java.util.Arrays", "java.util.Map" ]
import java.util.Arrays; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,346,151
private String[] getBasicData0(String select_) { PreparedStatement pstmt = null; ResultSet rs = null; String[] list = null; try { // Prepare the statement. pstmt = _conn.prepareStatement(select_); // Get the list. rs = pstmt.executeQuery(); Vector<String> data = new Vector<String>(); while (rs.next()) { data.add(rs.getString(1)); } list = new String[data.size()]; for (int i = 0; i < list.length; ++i) { list[i] = data.get(i); } } catch (SQLException ex) { // Bad... _errorCode = DBAlertUtil.getSQLErrorCode(ex); _errorMsg = _errorCode + ": " + select_ + "\n\n" + ex.toString(); _logger.error(_errorMsg); } finally { closeCursors(pstmt, rs); } return (list != null && list.length > 0) ? list : null; }
String[] function(String select_) { PreparedStatement pstmt = null; ResultSet rs = null; String[] list = null; try { pstmt = _conn.prepareStatement(select_); rs = pstmt.executeQuery(); Vector<String> data = new Vector<String>(); while (rs.next()) { data.add(rs.getString(1)); } list = new String[data.size()]; for (int i = 0; i < list.length; ++i) { list[i] = data.get(i); } } catch (SQLException ex) { _errorCode = DBAlertUtil.getSQLErrorCode(ex); _errorMsg = _errorCode + STR + select_ + "\n\n" + ex.toString(); _logger.error(_errorMsg); } finally { closeCursors(pstmt, rs); } return (list != null && list.length > 0) ? list : null; }
/** * Do a basic search with a single column result. * * @param select_ the SQL select * @return the array of results */
Do a basic search with a single column result
getBasicData0
{ "repo_name": "NCIP/cadsr-sentinel", "path": "software/src/java/gov/nih/nci/cadsr/sentinel/database/DBAlertOracle.java", "license": "bsd-3-clause", "size": 324316 }
[ "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.util.Vector" ]
import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Vector;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
777,533
public Path getSystemDir() throws IOException, InterruptedException { if (sysDir == null) { sysDir = new Path(client.getSystemDir()); } return sysDir; }
Path function() throws IOException, InterruptedException { if (sysDir == null) { sysDir = new Path(client.getSystemDir()); } return sysDir; }
/** * Grab the jobtracker system directory path where * job-specific files will be placed. * * @return the system directory where job-specific files are to be placed. */
Grab the jobtracker system directory path where job-specific files will be placed
getSystemDir
{ "repo_name": "jaypatil/hadoop", "path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java", "license": "gpl-3.0", "size": 14569 }
[ "java.io.IOException", "org.apache.hadoop.fs.Path" ]
import java.io.IOException; import org.apache.hadoop.fs.Path;
import java.io.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
978,036
public void setAttribute(AttributeKey key, Object newValue) { super.setAttribute(key, newValue); }
void function(AttributeKey key, Object newValue) { super.setAttribute(key, newValue); }
/** * Overridden to set the value of the transform. * @see #setAttribute(AttributeKey, Object) */
Overridden to set the value of the transform
setAttribute
{ "repo_name": "emilroz/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/drawingtools/figures/EllipseTextFigure.java", "license": "gpl-2.0", "size": 12423 }
[ "org.jhotdraw.draw.AttributeKey" ]
import org.jhotdraw.draw.AttributeKey;
import org.jhotdraw.draw.*;
[ "org.jhotdraw.draw" ]
org.jhotdraw.draw;
1,176,256
private SysSystemAttributeMappingDto getAttributeMappingForPasswordFilter(SysSystemDto system) { SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter(); filter.setSystemId(system.getId()); filter.setPasswordAttribute(Boolean.TRUE); filter.setPasswordFilter(Boolean.TRUE); List<SysSystemAttributeMappingDto> content = systemAttributeMappingService.find(filter, null).getContent(); if (content.isEmpty()) { throw new ResultCodeException(AccResultCode.PASSWORD_FILTER_DEFINITION_NOT_FOUND, ImmutableMap.of("systemId", system.getId())); } // Attribute with password filter may be only one! return content.get(0); }
SysSystemAttributeMappingDto function(SysSystemDto system) { SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter(); filter.setSystemId(system.getId()); filter.setPasswordAttribute(Boolean.TRUE); filter.setPasswordFilter(Boolean.TRUE); List<SysSystemAttributeMappingDto> content = systemAttributeMappingService.find(filter, null).getContent(); if (content.isEmpty()) { throw new ResultCodeException(AccResultCode.PASSWORD_FILTER_DEFINITION_NOT_FOUND, ImmutableMap.of(STR, system.getId())); } return content.get(0); }
/** * Get {@link SysSystemAttributeMappingDto} that define configuration for password filter. * * @param system * @return */
Get <code>SysSystemAttributeMappingDto</code> that define configuration for password filter
getAttributeMappingForPasswordFilter
{ "repo_name": "bcvsolutions/CzechIdMng", "path": "Realization/backend/acc/src/main/java/eu/bcvsolutions/idm/acc/service/impl/DefaultPasswordFilterManager.java", "license": "mit", "size": 30427 }
[ "com.google.common.collect.ImmutableMap", "eu.bcvsolutions.idm.acc.domain.AccResultCode", "eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto", "eu.bcvsolutions.idm.acc.dto.SysSystemDto", "eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter", "eu.bcvsolutions.idm.core.api.exception.ResultCodeException", "java.util.List" ]
import com.google.common.collect.ImmutableMap; import eu.bcvsolutions.idm.acc.domain.AccResultCode; import eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto; import eu.bcvsolutions.idm.acc.dto.SysSystemDto; import eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter; import eu.bcvsolutions.idm.core.api.exception.ResultCodeException; import java.util.List;
import com.google.common.collect.*; import eu.bcvsolutions.idm.acc.domain.*; import eu.bcvsolutions.idm.acc.dto.*; import eu.bcvsolutions.idm.acc.dto.filter.*; import eu.bcvsolutions.idm.core.api.exception.*; import java.util.*;
[ "com.google.common", "eu.bcvsolutions.idm", "java.util" ]
com.google.common; eu.bcvsolutions.idm; java.util;
1,681,710
EAttribute getExternalLoad_Type();
EAttribute getExternalLoad_Type();
/** * Returns the meta object for the attribute '{@link uk.ac.kcl.inf.robotics.rigidBodies.ExternalLoad#getType <em>Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Type</em>'. * @see uk.ac.kcl.inf.robotics.rigidBodies.ExternalLoad#getType() * @see #getExternalLoad() * @generated */
Returns the meta object for the attribute '<code>uk.ac.kcl.inf.robotics.rigidBodies.ExternalLoad#getType Type</code>'.
getExternalLoad_Type
{ "repo_name": "szschaler/RigidBodies", "path": "uk.ac.kcl.inf.robotics.rigid_bodies/src-gen/uk/ac/kcl/inf/robotics/rigidBodies/RigidBodiesPackage.java", "license": "mit", "size": 163741 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
842,738
public void writePacketData(PacketBuffer buf) throws IOException { buf.writeVarIntToBuffer(this.key); }
void function(PacketBuffer buf) throws IOException { buf.writeVarIntToBuffer(this.key); }
/** * Writes the raw packet data to the data stream. */
Writes the raw packet data to the data stream
writePacketData
{ "repo_name": "danielyc/test-1.9.4", "path": "build/tmp/recompileMc/sources/net/minecraft/network/play/client/CPacketKeepAlive.java", "license": "gpl-3.0", "size": 1198 }
[ "java.io.IOException", "net.minecraft.network.PacketBuffer" ]
import java.io.IOException; import net.minecraft.network.PacketBuffer;
import java.io.*; import net.minecraft.network.*;
[ "java.io", "net.minecraft.network" ]
java.io; net.minecraft.network;
1,649,191
void mergeFrom(T message, byte[] data, int position, int limit, Registers registers) throws IOException;
void mergeFrom(T message, byte[] data, int position, int limit, Registers registers) throws IOException;
/** * Like the above but parses from a byte[] without extensions. Entry point of fast path. Note that * this method may throw IndexOutOfBoundsException if the input data is not valid protobuf wire * format. Protobuf public API methods should catch and convert that exception to * InvalidProtocolBufferException. */
Like the above but parses from a byte[] without extensions. Entry point of fast path. Note that this method may throw IndexOutOfBoundsException if the input data is not valid protobuf wire format. Protobuf public API methods should catch and convert that exception to InvalidProtocolBufferException
mergeFrom
{ "repo_name": "endlessm/chromium-browser", "path": "third_party/protobuf/java/core/src/main/java/com/google/protobuf/Schema.java", "license": "bsd-3-clause", "size": 3622 }
[ "com.google.protobuf.ArrayDecoders", "java.io.IOException" ]
import com.google.protobuf.ArrayDecoders; import java.io.IOException;
import com.google.protobuf.*; import java.io.*;
[ "com.google.protobuf", "java.io" ]
com.google.protobuf; java.io;
2,823,944
public static <V extends Object> Queue<V> getQueue(String queueName) { return getInstance().impl.getQueue(queueName); }
static <V extends Object> Queue<V> function(String queueName) { return getInstance().impl.getQueue(queueName); }
/** * This method provides an implementation of distributed queue. All the nodes * on the cluster shares this instance. * @param queueName Name of the queue. * @param <V> Type of the queue's values. * @return Return the instance of the distributed queue. */
This method provides an implementation of distributed queue. All the nodes on the cluster shares this instance
getQueue
{ "repo_name": "nojustiniano/HolandaCatalinaFw", "path": "src/main/java/org/hcjf/cloud/Cloud.java", "license": "apache-2.0", "size": 6342 }
[ "java.util.Queue" ]
import java.util.Queue;
import java.util.*;
[ "java.util" ]
java.util;
2,017,756
@NotNull List<IntentionAction> getAvailableIntentions(@NonNls String... filePaths);
List<IntentionAction> getAvailableIntentions(@NonNls String... filePaths);
/** * Collects available intentions at caret position. * * @param filePaths the first file is tested only; the others are just copied along with the first. * @return available intentions. * @see #CARET_MARKER */
Collects available intentions at caret position
getAvailableIntentions
{ "repo_name": "android-ia/platform_tools_idea", "path": "platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java", "license": "apache-2.0", "size": 18792 }
[ "com.intellij.codeInsight.intention.IntentionAction", "java.util.List", "org.jetbrains.annotations.NonNls" ]
import com.intellij.codeInsight.intention.IntentionAction; import java.util.List; import org.jetbrains.annotations.NonNls;
import com.intellij.*; import java.util.*; import org.jetbrains.annotations.*;
[ "com.intellij", "java.util", "org.jetbrains.annotations" ]
com.intellij; java.util; org.jetbrains.annotations;
2,161,955
static Node emptyNode(String resourceName, int lineNumber) { return new Cons(resourceName, lineNumber, ImmutableList.<Node>of()); }
static Node emptyNode(String resourceName, int lineNumber) { return new Cons(resourceName, lineNumber, ImmutableList.<Node>of()); }
/** * Returns an empty node in the parse tree. This is used for example to represent the trivial * "else" part of an {@code #if} that does not have an explicit {@code #else}. */
Returns an empty node in the parse tree. This is used for example to represent the trivial "else" part of an #if that does not have an explicit #else
emptyNode
{ "repo_name": "MaTriXy/auto", "path": "value/src/main/java/com/google/auto/value/processor/escapevelocity/Node.java", "license": "apache-2.0", "size": 3868 }
[ "com.google.common.collect.ImmutableList" ]
import com.google.common.collect.ImmutableList;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
2,060,028