method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private void drawGrid() { long time = 0; if (Profiler.ON) { time = System.currentTimeMillis(); } drawGrid(imageLayers.get(LAYER_GRID).createGraphics()); if (Profiler.ON) { Profiler.rendering(Profiler.DRAW_GRID, System.currentTimeMillis() - time); } }
void function() { long time = 0; if (Profiler.ON) { time = System.currentTimeMillis(); } drawGrid(imageLayers.get(LAYER_GRID).createGraphics()); if (Profiler.ON) { Profiler.rendering(Profiler.DRAW_GRID, System.currentTimeMillis() - time); } }
/** * Initiates (re-)drawing grid. */
Initiates (re-)drawing grid
drawGrid
{ "repo_name": "mindrunner/funCKit", "path": "workspace/funCKit/src/main/java/de/sep2011/funckit/view/EditPanel.java", "license": "gpl-3.0", "size": 37626 }
[ "de.sep2011.funckit.util.Profiler" ]
import de.sep2011.funckit.util.Profiler;
import de.sep2011.funckit.util.*;
[ "de.sep2011.funckit" ]
de.sep2011.funckit;
2,342,434
public static final byte[] getBytes(String s, String encoding, String serverEncoding, boolean parserKnowsUnicode, MySQLConnection conn, ExceptionInterceptor exceptionInterceptor) throws SQLException { try { SingleByteCharsetConverter converter = null; if (conn != null) { converter = conn.getCharsetConverter(encoding); } else { converter = SingleByteCharsetConverter.getInstance(encoding, null); } return getBytes(s, converter, encoding, serverEncoding, parserKnowsUnicode, exceptionInterceptor); } catch (UnsupportedEncodingException uee) { throw SQLError.createSQLException(Messages.getString("StringUtils.0") //$NON-NLS-1$ + encoding + Messages.getString("StringUtils.1"), SQLError.SQL_STATE_ILLEGAL_ARGUMENT, exceptionInterceptor); //$NON-NLS-1$ } }
static final byte[] function(String s, String encoding, String serverEncoding, boolean parserKnowsUnicode, MySQLConnection conn, ExceptionInterceptor exceptionInterceptor) throws SQLException { try { SingleByteCharsetConverter converter = null; if (conn != null) { converter = conn.getCharsetConverter(encoding); } else { converter = SingleByteCharsetConverter.getInstance(encoding, null); } return getBytes(s, converter, encoding, serverEncoding, parserKnowsUnicode, exceptionInterceptor); } catch (UnsupportedEncodingException uee) { throw SQLError.createSQLException(Messages.getString(STR) + encoding + Messages.getString(STR), SQLError.SQL_STATE_ILLEGAL_ARGUMENT, exceptionInterceptor); } }
/** * Returns the byte[] representation of the given string using given * encoding. * * @param s * the string to convert * @param encoding * the character encoding to use * @param parserKnowsUnicode * DOCUMENT ME! * * @return byte[] representation of the string * * @throws SQLException * if an encoding unsupported by the JVM is supplied. */
Returns the byte[] representation of the given string using given encoding
getBytes
{ "repo_name": "spullara/mysql-connector-java", "path": "src/main/java/com/mysql/jdbc/StringUtils.java", "license": "gpl-2.0", "size": 51789 }
[ "java.io.UnsupportedEncodingException", "java.sql.SQLException" ]
import java.io.UnsupportedEncodingException; import java.sql.SQLException;
import java.io.*; import java.sql.*;
[ "java.io", "java.sql" ]
java.io; java.sql;
1,628,161
public T[] value(T x) throws MathIllegalArgumentException, NullArgumentException { // safety check MathUtils.checkNotNull(x); if (abscissae.isEmpty()) { throw new MathIllegalArgumentException(LocalizedCoreFormats.EMPTY_INTERPOLATION_SAMPLE); } final T[] value = MathArrays.buildArray(x.getField(), topDiagonal.get(0).length); T valueCoeff = x.getField().getOne(); for (int i = 0; i < topDiagonal.size(); ++i) { T[] dividedDifference = topDiagonal.get(i); for (int k = 0; k < value.length; ++k) { value[k] = value[k].add(dividedDifference[k].multiply(valueCoeff)); } final T deltaX = x.subtract(abscissae.get(i)); valueCoeff = valueCoeff.multiply(deltaX); } return value; }
T[] function(T x) throws MathIllegalArgumentException, NullArgumentException { MathUtils.checkNotNull(x); if (abscissae.isEmpty()) { throw new MathIllegalArgumentException(LocalizedCoreFormats.EMPTY_INTERPOLATION_SAMPLE); } final T[] value = MathArrays.buildArray(x.getField(), topDiagonal.get(0).length); T valueCoeff = x.getField().getOne(); for (int i = 0; i < topDiagonal.size(); ++i) { T[] dividedDifference = topDiagonal.get(i); for (int k = 0; k < value.length; ++k) { value[k] = value[k].add(dividedDifference[k].multiply(valueCoeff)); } final T deltaX = x.subtract(abscissae.get(i)); valueCoeff = valueCoeff.multiply(deltaX); } return value; }
/** Interpolate value at a specified abscissa. * @param x interpolation abscissa * @return interpolated value * @exception MathIllegalArgumentException if sample is empty * @throws NullArgumentException if x is null */
Interpolate value at a specified abscissa
value
{ "repo_name": "sdinot/hipparchus", "path": "hipparchus-core/src/main/java/org/hipparchus/analysis/interpolation/FieldHermiteInterpolator.java", "license": "apache-2.0", "size": 8578 }
[ "org.hipparchus.exception.LocalizedCoreFormats", "org.hipparchus.exception.MathIllegalArgumentException", "org.hipparchus.exception.NullArgumentException", "org.hipparchus.util.MathArrays", "org.hipparchus.util.MathUtils" ]
import org.hipparchus.exception.LocalizedCoreFormats; import org.hipparchus.exception.MathIllegalArgumentException; import org.hipparchus.exception.NullArgumentException; import org.hipparchus.util.MathArrays; import org.hipparchus.util.MathUtils;
import org.hipparchus.exception.*; import org.hipparchus.util.*;
[ "org.hipparchus.exception", "org.hipparchus.util" ]
org.hipparchus.exception; org.hipparchus.util;
1,229,539
@Override public void paintComponent(Graphics f_old) { setClipZone(f_old.getClipBounds()); final Graphics2D f = (Graphics2D) f_old; DrawGraphParams params = defaultDrawParams(); drawGraph(f, params); }
void function(Graphics f_old) { setClipZone(f_old.getClipBounds()); final Graphics2D f = (Graphics2D) f_old; DrawGraphParams params = defaultDrawParams(); drawGraph(f, params); }
/** * Draws the graph. This method should only be called by the virtual * machine. * * @param f_old * the graphical context */
Draws the graph. This method should only be called by the virtual machine
paintComponent
{ "repo_name": "mdamis/unilabIDE", "path": "Unitex-Java/src/fr/umlv/unitex/graphrendering/GraphicalZone.java", "license": "lgpl-3.0", "size": 57608 }
[ "java.awt.Graphics", "java.awt.Graphics2D" ]
import java.awt.Graphics; import java.awt.Graphics2D;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,990,161
public void removeListObjectToday(ListObject listObject) { if (todayEventList.contains(listObject)) { todayEventList.remove(listObject); removeLoAssociatedCats(listObject); this.notifyDataSetChanged(); } }
void function(ListObject listObject) { if (todayEventList.contains(listObject)) { todayEventList.remove(listObject); removeLoAssociatedCats(listObject); this.notifyDataSetChanged(); } }
/** * Remove a event from today. * * @param listObject * the listObject to remove */
Remove a event from today
removeListObjectToday
{ "repo_name": "simonjrp/ESCAPE", "path": "ESCAPE/src/se/chalmers/dat255/group22/escape/adapters/CustomExpandableListAdapter.java", "license": "gpl-3.0", "size": 25615 }
[ "se.chalmers.dat255.group22.escape.objects.ListObject" ]
import se.chalmers.dat255.group22.escape.objects.ListObject;
import se.chalmers.dat255.group22.escape.objects.*;
[ "se.chalmers.dat255" ]
se.chalmers.dat255;
1,706,118
ServiceResponse<byte[]> getNullBase64UrlEncoded() throws ErrorException, IOException;
ServiceResponse<byte[]> getNullBase64UrlEncoded() throws ErrorException, IOException;
/** * Get null value that is expected to be base64url encoded. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the byte[] object wrapped in {@link ServiceResponse} if successful. */
Get null value that is expected to be base64url encoded
getNullBase64UrlEncoded
{ "repo_name": "haocs/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodystring/Strings.java", "license": "mit", "size": 16817 }
[ "com.microsoft.rest.ServiceResponse", "java.io.IOException" ]
import com.microsoft.rest.ServiceResponse; import java.io.IOException;
import com.microsoft.rest.*; import java.io.*;
[ "com.microsoft.rest", "java.io" ]
com.microsoft.rest; java.io;
2,835,747
public void start() { if (LOG_EGL) { Log.w("EglHelper", "start() tid=" + Thread.currentThread().getId()); } mEgl = (EGL10) EGLContext.getEGL(); mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); if (mEglDisplay == EGL10.EGL_NO_DISPLAY) { throw new RuntimeException("eglGetDisplay failed"); } int[] version = new int[2]; if (!mEgl.eglInitialize(mEglDisplay, version)) { throw new RuntimeException("eglInitialize failed"); } MyGLSurfaceView view = mGLSurfaceViewWeakRef.get(); if (view == null) { mEglConfig = null; mEglContext = null; } else { mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay); mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig); } if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) { mEglContext = null; throwEglException(); } if (LOG_EGL) { Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId()); } mEglSurface = null; }
void function() { if (LOG_EGL) { Log.w(STR, STR + Thread.currentThread().getId()); } mEgl = (EGL10) EGLContext.getEGL(); mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); if (mEglDisplay == EGL10.EGL_NO_DISPLAY) { throw new RuntimeException(STR); } int[] version = new int[2]; if (!mEgl.eglInitialize(mEglDisplay, version)) { throw new RuntimeException(STR); } MyGLSurfaceView view = mGLSurfaceViewWeakRef.get(); if (view == null) { mEglConfig = null; mEglContext = null; } else { mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay); mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig); } if (mEglContext == null mEglContext == EGL10.EGL_NO_CONTEXT) { mEglContext = null; throwEglException(); } if (LOG_EGL) { Log.w(STR, STR + mEglContext + STR + Thread.currentThread().getId()); } mEglSurface = null; }
/** * Initialize EGL for a given configuration spec. * * @param configSpec */
Initialize EGL for a given configuration spec
start
{ "repo_name": "nvllsvm/GZDoom-Android", "path": "doom/src/main/java/net/nullsum/doom/MyGLSurfaceView.java", "license": "gpl-2.0", "size": 78962 }
[ "android.util.Log", "javax.microedition.khronos.egl.EGLContext" ]
import android.util.Log; import javax.microedition.khronos.egl.EGLContext;
import android.util.*; import javax.microedition.khronos.egl.*;
[ "android.util", "javax.microedition" ]
android.util; javax.microedition;
281,591
protected IRecipe Wrap(IRecipe recipe, RecipeComponent[] components) { return recipe; }
IRecipe function(IRecipe recipe, RecipeComponent[] components) { return recipe; }
/** * Quick and dirty representation of a recipe wrapper * @param recipe The recipe to (potentially) wrap * @param components The components to check * @return The wrapped recipe; or the original if it didn't need wrapped. */
Quick and dirty representation of a recipe wrapper
Wrap
{ "repo_name": "legendblade/CraftingHarmonics", "path": "api/src/main/java/org/winterblade/minecraft/harmony/common/crafting/operations/BaseAddOperation.java", "license": "mit", "size": 2792 }
[ "net.minecraft.item.crafting.IRecipe", "org.winterblade.minecraft.harmony.api.crafting.components.RecipeComponent" ]
import net.minecraft.item.crafting.IRecipe; import org.winterblade.minecraft.harmony.api.crafting.components.RecipeComponent;
import net.minecraft.item.crafting.*; import org.winterblade.minecraft.harmony.api.crafting.components.*;
[ "net.minecraft.item", "org.winterblade.minecraft" ]
net.minecraft.item; org.winterblade.minecraft;
2,858,226
public List<String> getPeersJIDsFromCert() { return peersJIDsFromCert; }
List<String> function() { return peersJIDsFromCert; }
/** * Method description * * * */
Method description
getPeersJIDsFromCert
{ "repo_name": "DanielYao/tigase-server", "path": "src/main/java/tigase/net/IOService.java", "license": "agpl-3.0", "size": 37091 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,143,437
@Override public boolean doPreDeleteUser(java.lang.String username, org.wso2.carbon.user.core.UserStoreManager userStoreManager) throws org.wso2.carbon.user.core.UserStoreException { TokenMgtDAO tokenMgtDAO = new TokenMgtDAO(); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); username = (username + "@" + tenantDomain); String userStoreDomain = null; if (OAuth2Util.checkAccessTokenPartitioningEnabled() && OAuth2Util.checkUserNameAssertionEnabled()) { try { userStoreDomain = OAuth2Util.getUserStoreDomainFromUserId(username); } catch (IdentityOAuth2Exception e) { log.error("Error occurred while getting user store domain for User ID : " + username, e); return true; } } Set<String> clientIds = null; try { // get all the distinct client Ids authorized by this user clientIds = tokenMgtDAO.getAllTimeAuthorizedClientIds(username); } catch (IdentityOAuth2Exception e) { log.error("Error occurred while retrieving apps authorized by User ID : " + username, e); return true; } for (String clientId : clientIds) { Set<AccessTokenDO> accessTokenDOs = null; try { // retrieve all ACTIVE or EXPIRED access tokens for particular client authorized by this user accessTokenDOs = tokenMgtDAO.retrieveAccessTokens(clientId, username, userStoreDomain, true); } catch (IdentityOAuth2Exception e) { String errorMsg = "Error occurred while retrieving access tokens issued for " + "Client ID : " + clientId + ", User ID : " + username; log.error(errorMsg, e); return true; } for (AccessTokenDO accessTokenDO : accessTokenDOs) { //Clear cache OAuthUtil.clearOAuthCache(accessTokenDO.getConsumerKey(), accessTokenDO.getAuthzUser(), OAuth2Util.buildScopeString(accessTokenDO.getScope())); OAuthUtil.clearOAuthCache(accessTokenDO.getConsumerKey(), accessTokenDO.getAuthzUser()); OAuthUtil.clearOAuthCache(accessTokenDO.getAccessToken()); AccessTokenDO scopedToken = null; try { // retrieve latest access token for particular client, user and scope combination if its ACTIVE or EXPIRED scopedToken = tokenMgtDAO.retrieveLatestAccessToken( clientId, username, userStoreDomain, OAuth2Util.buildScopeString(accessTokenDO.getScope()), true); } catch (IdentityOAuth2Exception e) { String errorMsg = "Error occurred while retrieving latest " + "access token issued for Client ID : " + clientId + ", User ID : " + username + " and Scope : " + OAuth2Util.buildScopeString(accessTokenDO.getScope()); log.error(errorMsg, e); return true; } if (scopedToken != null) { try { //Revoking token from database tokenMgtDAO.revokeToken(scopedToken.getAccessToken()); } catch (IdentityOAuth2Exception e) { String errorMsg = "Error occurred while revoking " + "Access Token : " + scopedToken.getAccessToken(); log.error(errorMsg, e); return true; } } } } return true; }
boolean function(java.lang.String username, org.wso2.carbon.user.core.UserStoreManager userStoreManager) throws org.wso2.carbon.user.core.UserStoreException { TokenMgtDAO tokenMgtDAO = new TokenMgtDAO(); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); username = (username + "@" + tenantDomain); String userStoreDomain = null; if (OAuth2Util.checkAccessTokenPartitioningEnabled() && OAuth2Util.checkUserNameAssertionEnabled()) { try { userStoreDomain = OAuth2Util.getUserStoreDomainFromUserId(username); } catch (IdentityOAuth2Exception e) { log.error(STR + username, e); return true; } } Set<String> clientIds = null; try { clientIds = tokenMgtDAO.getAllTimeAuthorizedClientIds(username); } catch (IdentityOAuth2Exception e) { log.error(STR + username, e); return true; } for (String clientId : clientIds) { Set<AccessTokenDO> accessTokenDOs = null; try { accessTokenDOs = tokenMgtDAO.retrieveAccessTokens(clientId, username, userStoreDomain, true); } catch (IdentityOAuth2Exception e) { String errorMsg = STR + STR + clientId + STR + username; log.error(errorMsg, e); return true; } for (AccessTokenDO accessTokenDO : accessTokenDOs) { OAuthUtil.clearOAuthCache(accessTokenDO.getConsumerKey(), accessTokenDO.getAuthzUser(), OAuth2Util.buildScopeString(accessTokenDO.getScope())); OAuthUtil.clearOAuthCache(accessTokenDO.getConsumerKey(), accessTokenDO.getAuthzUser()); OAuthUtil.clearOAuthCache(accessTokenDO.getAccessToken()); AccessTokenDO scopedToken = null; try { scopedToken = tokenMgtDAO.retrieveLatestAccessToken( clientId, username, userStoreDomain, OAuth2Util.buildScopeString(accessTokenDO.getScope()), true); } catch (IdentityOAuth2Exception e) { String errorMsg = STR + STR + clientId + STR + username + STR + OAuth2Util.buildScopeString(accessTokenDO.getScope()); log.error(errorMsg, e); return true; } if (scopedToken != null) { try { tokenMgtDAO.revokeToken(scopedToken.getAccessToken()); } catch (IdentityOAuth2Exception e) { String errorMsg = STR + STR + scopedToken.getAccessToken(); log.error(errorMsg, e); return true; } } } } return true; }
/** * Deleting user from the identity database prerequisites. */
Deleting user from the identity database prerequisites
doPreDeleteUser
{ "repo_name": "laki88/carbon-identity", "path": "components/oauth/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth/listener/IdentityOathEventListener.java", "license": "apache-2.0", "size": 5676 }
[ "java.util.Set", "org.wso2.carbon.context.PrivilegedCarbonContext", "org.wso2.carbon.identity.oauth.OAuthUtil", "org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception", "org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO", "org.wso2.carbon.identity.oauth2.model.AccessTokenDO", "org.wso2.carbon.identity.oauth2.util.OAuth2Util" ]
import java.util.Set; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.oauth.OAuthUtil; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; import org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO; import org.wso2.carbon.identity.oauth2.model.AccessTokenDO; import org.wso2.carbon.identity.oauth2.util.OAuth2Util;
import java.util.*; import org.wso2.carbon.context.*; import org.wso2.carbon.identity.oauth.*; import org.wso2.carbon.identity.oauth2.*; import org.wso2.carbon.identity.oauth2.dao.*; import org.wso2.carbon.identity.oauth2.model.*; import org.wso2.carbon.identity.oauth2.util.*;
[ "java.util", "org.wso2.carbon" ]
java.util; org.wso2.carbon;
1,070,372
public void setRequestProcessorNames(List<ObjectName> requestProcessorNames) { this.requestProcessorNames = requestProcessorNames; }
void function(List<ObjectName> requestProcessorNames) { this.requestProcessorNames = requestProcessorNames; }
/** * Sets the request processor names. * * @param requestProcessorNames the new request processor names */
Sets the request processor names
setRequestProcessorNames
{ "repo_name": "dougwm/psi-probe", "path": "core/src/main/java/psiprobe/model/jmx/ThreadPoolObjectName.java", "license": "gpl-2.0", "size": 2310 }
[ "java.util.List", "javax.management.ObjectName" ]
import java.util.List; import javax.management.ObjectName;
import java.util.*; import javax.management.*;
[ "java.util", "javax.management" ]
java.util; javax.management;
1,743,902
public static java.util.Set extractCATSReferralStatusSet(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.CatsReferralStatusLiteVoCollection voCollection) { return extractCATSReferralStatusSet(domainFactory, voCollection, null, new HashMap()); }
static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.CatsReferralStatusLiteVoCollection voCollection) { return extractCATSReferralStatusSet(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.RefMan.domain.objects.CATSReferralStatus set from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.RefMan.domain.objects.CATSReferralStatus set from the value object collection
extractCATSReferralStatusSet
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/RefMan/vo/domain/CatsReferralStatusLiteVoAssembler.java", "license": "agpl-3.0", "size": 15867 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,188,237
@Test public void testThatPathsAreNormalized() throws Exception { // more info: https://www.owasp.org/index.php/Path_Traversal List<String> notFoundUris = new ArrayList<>(); notFoundUris.add("/_plugin/dummy/../../../../../log4j.properties"); notFoundUris.add("/_plugin/dummy/../../../../../%00log4j.properties"); notFoundUris.add("/_plugin/dummy/..%c0%af..%c0%af..%c0%af..%c0%af..%c0%aflog4j.properties"); notFoundUris.add("/_plugin/dummy/%2E%2E/%2E%2E/%2E%2E/%2E%2E/index.html"); notFoundUris.add("/_plugin/dummy/%2e%2e/%2e%2e/%2e%2e/%2e%2e/index.html"); notFoundUris.add("/_plugin/dummy/%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2findex.html"); notFoundUris.add("/_plugin/dummy/%2E%2E/%2E%2E/%2E%2E/%2E%2E/index.html"); notFoundUris.add("/_plugin/dummy/..\\..\\..\\..\\..\\log4j.properties"); for (String uri : notFoundUris) { HttpResponse response = httpClient().path(uri).execute(); String message = String.format(Locale.ROOT, "URI [%s] expected to be not found", uri); assertThat(message, response.getStatusCode(), equalTo(RestStatus.NOT_FOUND.getStatus())); } // using relative path inside of the plugin should work HttpResponse response = httpClient().path("/_plugin/dummy/dir1/../dir1/../index.html").execute(); assertThat(response.getStatusCode(), equalTo(RestStatus.OK.getStatus())); assertThat(response.getBody(), containsString("<title>Dummy Site Plugin</title>")); }
void function() throws Exception { List<String> notFoundUris = new ArrayList<>(); notFoundUris.add(STR); notFoundUris.add(STR); notFoundUris.add(STR); notFoundUris.add(STR); notFoundUris.add(STR); notFoundUris.add(STR); notFoundUris.add(STR); notFoundUris.add(STR); for (String uri : notFoundUris) { HttpResponse response = httpClient().path(uri).execute(); String message = String.format(Locale.ROOT, STR, uri); assertThat(message, response.getStatusCode(), equalTo(RestStatus.NOT_FOUND.getStatus())); } HttpResponse response = httpClient().path(STR).execute(); assertThat(response.getStatusCode(), equalTo(RestStatus.OK.getStatus())); assertThat(response.getBody(), containsString(STR)); }
/** * Test normalizing of path */
Test normalizing of path
testThatPathsAreNormalized
{ "repo_name": "zuoyebushiwo/ElasticSearch-Final", "path": "src/test/java/org/elasticsearch/plugins/SitePluginTests.java", "license": "apache-2.0", "size": 6467 }
[ "java.util.ArrayList", "java.util.List", "java.util.Locale", "org.elasticsearch.rest.RestStatus", "org.elasticsearch.test.rest.client.http.HttpResponse", "org.hamcrest.Matchers" ]
import java.util.ArrayList; import java.util.List; import java.util.Locale; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.rest.client.http.HttpResponse; import org.hamcrest.Matchers;
import java.util.*; import org.elasticsearch.rest.*; import org.elasticsearch.test.rest.client.http.*; import org.hamcrest.*;
[ "java.util", "org.elasticsearch.rest", "org.elasticsearch.test", "org.hamcrest" ]
java.util; org.elasticsearch.rest; org.elasticsearch.test; org.hamcrest;
1,579,645
public Map<String,Declaration> getOuterDeclarations() { return Collections.emptyMap(); }
Map<String,Declaration> function() { return Collections.emptyMap(); }
/** * It is not possible to declare and export any variables, * so always return an empty map * * @see org.kie.rule.RuleConditionElement#getOuterDeclarations() */
It is not possible to declare and export any variables, so always return an empty map
getOuterDeclarations
{ "repo_name": "bxf12315/drools", "path": "drools-core/src/main/java/org/drools/core/rule/NamedConsequence.java", "license": "apache-2.0", "size": 3506 }
[ "java.util.Collections", "java.util.Map" ]
import java.util.Collections; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,140,251
public final static String getTplPageListKey(NormalisedTitle title) { return title + ":tpages"; }
final static String function(NormalisedTitle title) { return title + STR; }
/** * Gets the key to store the list of pages using a template at. * * @param title the template title (including <tt>Template:</tt>) * * @return Scalaris key */
Gets the key to store the list of pages using a template at
getTplPageListKey
{ "repo_name": "scalaris-team/scalaris", "path": "contrib/wikipedia/src/de/zib/scalaris/examples/wikipedia/ScalarisDataHandlerNormalised.java", "license": "apache-2.0", "size": 21697 }
[ "de.zib.scalaris.examples.wikipedia.bliki.NormalisedTitle" ]
import de.zib.scalaris.examples.wikipedia.bliki.NormalisedTitle;
import de.zib.scalaris.examples.wikipedia.bliki.*;
[ "de.zib.scalaris" ]
de.zib.scalaris;
1,459,669
public void resetCards(Long[] ids) { long[] nonNew = Utils.arrayList2array(mCol.getDb().queryColumn(Long.class, String.format(Locale.US, "select id from cards where id in %s and (queue != 0 or type != 0)", Utils.ids2str(ids)), 0)); mCol.getDb().execute("update cards set reps=0, lapses=0 where id in " + Utils.ids2str(nonNew)); forgetCards(nonNew); mCol.log((Object[]) ids); }
void function(Long[] ids) { long[] nonNew = Utils.arrayList2array(mCol.getDb().queryColumn(Long.class, String.format(Locale.US, STR, Utils.ids2str(ids)), 0)); mCol.getDb().execute(STR + Utils.ids2str(nonNew)); forgetCards(nonNew); mCol.log((Object[]) ids); }
/** * Completely reset cards for export. */
Completely reset cards for export
resetCards
{ "repo_name": "agrueneberg/Anki-Android", "path": "AnkiDroid/src/main/java/com/ichi2/libanki/Sched.java", "license": "gpl-3.0", "size": 87234 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
2,586,536
public T xpath(String text, Map<String, String> namespaces) { return delegate.xpath(text, namespaces); }
T function(String text, Map<String, String> namespaces) { return delegate.xpath(text, namespaces); }
/** * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> with the specified set of namespace prefixes and URIs * * @param text the expression to be evaluated * @param namespaces the namespace prefix and URIs to use * @return the builder to continue processing the DSL */
Evaluates an XPath expression with the specified set of namespace prefixes and URIs
xpath
{ "repo_name": "dmvolod/camel", "path": "camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java", "license": "apache-2.0", "size": 39472 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,641,331
public boolean needsRedo(Transaction xact) throws StandardException { return true; } /** the default for prepared log is always null for all the operations that don't have optionalData. If an operation has optional data, the operation need to prepare the optional data for this method.
boolean function(Transaction xact) throws StandardException { return true; } /** the default for prepared log is always null for all the operations that don't have optionalData. If an operation has optional data, the operation need to prepare the optional data for this method.
/** * Check if this operation needs to be redone during recovery redo. * Returns true if this op should be redone during recovery redo, * @param xact the transaction that is doing the rollback * @return true, if this operation needs to be redone during recovery. * @exception StandardException Standard Derby error policy */
Check if this operation needs to be redone during recovery redo. Returns true if this op should be redone during recovery redo
needsRedo
{ "repo_name": "papicella/snappy-store", "path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/store/raw/data/EncryptContainerUndoOperation.java", "license": "apache-2.0", "size": 5580 }
[ "com.pivotal.gemfirexd.internal.iapi.error.StandardException", "com.pivotal.gemfirexd.internal.iapi.store.raw.Transaction" ]
import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.store.raw.Transaction;
import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.store.raw.*;
[ "com.pivotal.gemfirexd" ]
com.pivotal.gemfirexd;
1,508,380
public final void setProperty(String name, final Object value) throws PropertyException { try { switch (name) { case XML.LOCALE: { locale = (value instanceof CharSequence) ? Locales.parse(value.toString()) : (Locale) value; return; } case XML.TIMEZONE: { timezone = (value instanceof CharSequence) ? TimeZone.getTimeZone(value.toString()) : (TimeZone) value; return; } case XML.SCHEMAS: { final Map<?,?> map = (Map<?,?>) value; Map<String,String> copy = null; if (map != null) { copy = new HashMap<>(4); for (final String key : SCHEMA_KEYS) { final Object schema = map.get(key); if (schema != null) { if (!(schema instanceof String)) { throw new PropertyException(Errors.format(Errors.Keys.IllegalPropertyValueClass_2, name + "[\"" + key + "\"]", value.getClass())); } copy.put(key, (String) schema); } } copy = CollectionsExt.unmodifiableOrCopy(copy); } schemas = copy; return; } case XML.GML_VERSION: { versionGML = (value instanceof CharSequence) ? new Version(value.toString()) : (Version) value; return; } case XML.RESOLVER: { resolver = (ReferenceResolver) value; return; } case XML.CONVERTER: { converter = (ValueConverter) value; return; } case XML.STRING_SUBSTITUTES: { bitMasks &= ~(Context.SUBSTITUTE_LANGUAGE | Context.SUBSTITUTE_COUNTRY | Context.SUBSTITUTE_FILENAME | Context.SUBSTITUTE_MIMETYPE); if (value != null) { for (final CharSequence substitute : (CharSequence[]) value) { if (CharSequences.equalsIgnoreCase(substitute, "language")) { bitMasks |= Context.SUBSTITUTE_LANGUAGE; } else if (CharSequences.equalsIgnoreCase(substitute, "country")) { bitMasks |= Context.SUBSTITUTE_COUNTRY; } else if (CharSequences.equalsIgnoreCase(substitute, "filename")) { bitMasks |= Context.SUBSTITUTE_FILENAME; } else if (CharSequences.equalsIgnoreCase(substitute, "mimetype")) { bitMasks |= Context.SUBSTITUTE_MIMETYPE; } } } return; } case XML.WARNING_LISTENER: { warningListener = (WarningListener<?>) value; return; } case LegacyNamespaces.APPLY_NAMESPACE_REPLACEMENTS: { xmlnsReplaceCode = 0; if (value != null) { xmlnsReplaceCode = ((Boolean) value) ? (byte) 1 : (byte) 2; } return; } case TypeRegistration.ROOT_ADAPTERS: { rootAdapters = (TypeRegistration[]) value; // No clone for now because ROOT_ADAPTERS is not yet a public API. return; } } } catch (ClassCastException | IllformedLocaleException e) { throw new PropertyException(Errors.format( Errors.Keys.IllegalPropertyValueClass_2, name, value.getClass()), e); } if (internal) { name = Implementation.toInternal(name); } if (!initialProperties.containsKey(name) && initialProperties.put(name, getStandardProperty(name)) != null) { // Should never happen, unless on concurrent changes in a backgroung thread. throw new ConcurrentModificationException(name); } setStandardProperty(name, value); }
final void function(String name, final Object value) throws PropertyException { try { switch (name) { case XML.LOCALE: { locale = (value instanceof CharSequence) ? Locales.parse(value.toString()) : (Locale) value; return; } case XML.TIMEZONE: { timezone = (value instanceof CharSequence) ? TimeZone.getTimeZone(value.toString()) : (TimeZone) value; return; } case XML.SCHEMAS: { final Map<?,?> map = (Map<?,?>) value; Map<String,String> copy = null; if (map != null) { copy = new HashMap<>(4); for (final String key : SCHEMA_KEYS) { final Object schema = map.get(key); if (schema != null) { if (!(schema instanceof String)) { throw new PropertyException(Errors.format(Errors.Keys.IllegalPropertyValueClass_2, name + "[\"STR\"]", value.getClass())); } copy.put(key, (String) schema); } } copy = CollectionsExt.unmodifiableOrCopy(copy); } schemas = copy; return; } case XML.GML_VERSION: { versionGML = (value instanceof CharSequence) ? new Version(value.toString()) : (Version) value; return; } case XML.RESOLVER: { resolver = (ReferenceResolver) value; return; } case XML.CONVERTER: { converter = (ValueConverter) value; return; } case XML.STRING_SUBSTITUTES: { bitMasks &= ~(Context.SUBSTITUTE_LANGUAGE Context.SUBSTITUTE_COUNTRY Context.SUBSTITUTE_FILENAME Context.SUBSTITUTE_MIMETYPE); if (value != null) { for (final CharSequence substitute : (CharSequence[]) value) { if (CharSequences.equalsIgnoreCase(substitute, STR)) { bitMasks = Context.SUBSTITUTE_LANGUAGE; } else if (CharSequences.equalsIgnoreCase(substitute, STR)) { bitMasks = Context.SUBSTITUTE_COUNTRY; } else if (CharSequences.equalsIgnoreCase(substitute, STR)) { bitMasks = Context.SUBSTITUTE_FILENAME; } else if (CharSequences.equalsIgnoreCase(substitute, STR)) { bitMasks = Context.SUBSTITUTE_MIMETYPE; } } } return; } case XML.WARNING_LISTENER: { warningListener = (WarningListener<?>) value; return; } case LegacyNamespaces.APPLY_NAMESPACE_REPLACEMENTS: { xmlnsReplaceCode = 0; if (value != null) { xmlnsReplaceCode = ((Boolean) value) ? (byte) 1 : (byte) 2; } return; } case TypeRegistration.ROOT_ADAPTERS: { rootAdapters = (TypeRegistration[]) value; return; } } } catch (ClassCastException IllformedLocaleException e) { throw new PropertyException(Errors.format( Errors.Keys.IllegalPropertyValueClass_2, name, value.getClass()), e); } if (internal) { name = Implementation.toInternal(name); } if (!initialProperties.containsKey(name) && initialProperties.put(name, getStandardProperty(name)) != null) { throw new ConcurrentModificationException(name); } setStandardProperty(name, value); }
/** * A method which is common to both {@code Marshaller} and {@code Unmarshaller}. * It saves the initial state if it was not already done, but subclasses will * need to complete the work. */
A method which is common to both Marshaller and Unmarshaller. It saves the initial state if it was not already done, but subclasses will need to complete the work
setProperty
{ "repo_name": "Geomatys/sis", "path": "core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java", "license": "apache-2.0", "size": 23632 }
[ "java.util.ConcurrentModificationException", "java.util.HashMap", "java.util.IllformedLocaleException", "java.util.Locale", "java.util.Map", "java.util.TimeZone", "javax.xml.bind.PropertyException", "org.apache.sis.internal.jaxb.Context", "org.apache.sis.internal.jaxb.LegacyNamespaces", "org.apache.sis.internal.jaxb.TypeRegistration", "org.apache.sis.internal.util.CollectionsExt", "org.apache.sis.util.CharSequences", "org.apache.sis.util.Locales", "org.apache.sis.util.Version", "org.apache.sis.util.logging.WarningListener", "org.apache.sis.util.resources.Errors" ]
import java.util.ConcurrentModificationException; import java.util.HashMap; import java.util.IllformedLocaleException; import java.util.Locale; import java.util.Map; import java.util.TimeZone; import javax.xml.bind.PropertyException; import org.apache.sis.internal.jaxb.Context; import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.jaxb.TypeRegistration; import org.apache.sis.internal.util.CollectionsExt; import org.apache.sis.util.CharSequences; import org.apache.sis.util.Locales; import org.apache.sis.util.Version; import org.apache.sis.util.logging.WarningListener; import org.apache.sis.util.resources.Errors;
import java.util.*; import javax.xml.bind.*; import org.apache.sis.internal.jaxb.*; import org.apache.sis.internal.util.*; import org.apache.sis.util.*; import org.apache.sis.util.logging.*; import org.apache.sis.util.resources.*;
[ "java.util", "javax.xml", "org.apache.sis" ]
java.util; javax.xml; org.apache.sis;
1,979,407
Sentiment[] getAllSentiments();
Sentiment[] getAllSentiments();
/** * Returns an array of all sentiment classes. * * @return an array of all sentiment classes. */
Returns an array of all sentiment classes
getAllSentiments
{ "repo_name": "ckristo/AIC-WS2014-G4-T1-Sentimental-Analysis", "path": "src/main/java/at/ac/tuwien/infosys/dsg/aic/ws2014/g4/t1/service/ITwitterSentimentService.java", "license": "mit", "size": 2881 }
[ "at.ac.tuwien.infosys.dsg.aic.ws2014.g4.t1.classifier.ITwitterSentimentClassifier" ]
import at.ac.tuwien.infosys.dsg.aic.ws2014.g4.t1.classifier.ITwitterSentimentClassifier;
import at.ac.tuwien.infosys.dsg.aic.ws2014.g4.t1.classifier.*;
[ "at.ac.tuwien" ]
at.ac.tuwien;
1,787,407
void onContainerRequest(final AMRMClient.ContainerRequest... containerRequests);
void onContainerRequest(final AMRMClient.ContainerRequest... containerRequests);
/** * Enqueue a set of container requests with YARN. * * @param containerRequests set of container requests */
Enqueue a set of container requests with YARN
onContainerRequest
{ "repo_name": "markusweimer/incubator-reef", "path": "lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerRequestHandler.java", "license": "apache-2.0", "size": 1387 }
[ "org.apache.hadoop.yarn.client.api.AMRMClient" ]
import org.apache.hadoop.yarn.client.api.AMRMClient;
import org.apache.hadoop.yarn.client.api.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,812,735
public Iterator<Integer> iterator() { return new RangeIterator(); }
Iterator<Integer> function() { return new RangeIterator(); }
/** * The main puprose of a range object is to produce an Iterator. Since IntegerRange is iterable, it is useful with * the Tapestry Loop component, but also with the Java for loop! */
The main puprose of a range object is to produce an Iterator. Since IntegerRange is iterable, it is useful with the Tapestry Loop component, but also with the Java for loop
iterator
{ "repo_name": "agileowl/tapestry-5", "path": "tapestry-core/src/main/java/org/apache/tapestry5/internal/util/IntegerRange.java", "license": "apache-2.0", "size": 2967 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,518,895
public PurApLineDao getPurApLineDao() { return purApLineDao; }
PurApLineDao function() { return purApLineDao; }
/** * Gets the purApLineDao attribute. * * @return Returns the purApLineDao. */
Gets the purApLineDao attribute
getPurApLineDao
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/cab/document/service/impl/PurApLineServiceImpl.java", "license": "apache-2.0", "size": 62162 }
[ "org.kuali.kfs.module.cab.dataaccess.PurApLineDao" ]
import org.kuali.kfs.module.cab.dataaccess.PurApLineDao;
import org.kuali.kfs.module.cab.dataaccess.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
2,664,720
super.attachToRecyclerView(recyclerView); if (recyclerView != null && !(recyclerView.getLayoutManager() instanceof CardSliderLayoutManager)) { throw new InvalidParameterException("LayoutManager must be instance of CardSliderLayoutManager"); } this.recyclerView = recyclerView; }
super.attachToRecyclerView(recyclerView); if (recyclerView != null && !(recyclerView.getLayoutManager() instanceof CardSliderLayoutManager)) { throw new InvalidParameterException(STR); } this.recyclerView = recyclerView; }
/** * Attaches the {@link CardSnapHelper} to the provided RecyclerView, by calling * {@link RecyclerView#setOnFlingListener(RecyclerView.OnFlingListener)}. * You can call this method with {@code null} to detach it from the current RecyclerView. * * @param recyclerView The RecyclerView instance to which you want to add this helper or * {@code null} if you want to remove SnapHelper from the current * RecyclerView. * * @throws IllegalArgumentException if there is already a {@link RecyclerView.OnFlingListener} * attached to the provided {@link RecyclerView}. * * @throws InvalidParameterException if provided RecyclerView has LayoutManager which is not * instance of CardSliderLayoutManager * */
Attaches the <code>CardSnapHelper</code> to the provided RecyclerView, by calling <code>RecyclerView#setOnFlingListener(RecyclerView.OnFlingListener)</code>. You can call this method with null to detach it from the current RecyclerView
attachToRecyclerView
{ "repo_name": "xoodle/frost", "path": "app/src/main/java/com/studentsearch/xoodle/studentsearch/cardslider/CardSnapHelper.java", "license": "mit", "size": 4888 }
[ "java.security.InvalidParameterException" ]
import java.security.InvalidParameterException;
import java.security.*;
[ "java.security" ]
java.security;
2,158,583
public PDFormFieldAdditionalActions getActions() { COSDictionary aa = dictionary.getCOSDictionary(COSName.AA); return aa != null ? new PDFormFieldAdditionalActions(aa) : null; }
PDFormFieldAdditionalActions function() { COSDictionary aa = dictionary.getCOSDictionary(COSName.AA); return aa != null ? new PDFormFieldAdditionalActions(aa) : null; }
/** * Get the additional actions for this field. This will return null if there * are no additional actions for this field. * * @return The actions of the field. */
Get the additional actions for this field. This will return null if there are no additional actions for this field
getActions
{ "repo_name": "kalaspuffar/pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDField.java", "license": "apache-2.0", "size": 14926 }
[ "org.apache.pdfbox.cos.COSDictionary", "org.apache.pdfbox.cos.COSName", "org.apache.pdfbox.pdmodel.interactive.action.PDFormFieldAdditionalActions" ]
import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.pdmodel.interactive.action.PDFormFieldAdditionalActions;
import org.apache.pdfbox.cos.*; import org.apache.pdfbox.pdmodel.interactive.action.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
2,157,972
public Image pull(ImageReference reference, UpdateListener<PullImageUpdateEvent> listener, String registryAuth) throws IOException { Assert.notNull(reference, "Reference must not be null"); Assert.notNull(listener, "Listener must not be null"); URI createUri = buildUrl("/images/create", "fromImage", reference.toString()); DigestCaptureUpdateListener digestCapture = new DigestCaptureUpdateListener(); listener.onStart(); try { try (Response response = http().post(createUri, registryAuth)) { jsonStream().get(response.getContent(), PullImageUpdateEvent.class, (event) -> { digestCapture.onUpdate(event); listener.onUpdate(event); }); } return inspect(reference.withDigest(digestCapture.getCapturedDigest())); } finally { listener.onFinish(); } }
Image function(ImageReference reference, UpdateListener<PullImageUpdateEvent> listener, String registryAuth) throws IOException { Assert.notNull(reference, STR); Assert.notNull(listener, STR); URI createUri = buildUrl(STR, STR, reference.toString()); DigestCaptureUpdateListener digestCapture = new DigestCaptureUpdateListener(); listener.onStart(); try { try (Response response = http().post(createUri, registryAuth)) { jsonStream().get(response.getContent(), PullImageUpdateEvent.class, (event) -> { digestCapture.onUpdate(event); listener.onUpdate(event); }); } return inspect(reference.withDigest(digestCapture.getCapturedDigest())); } finally { listener.onFinish(); } }
/** * Pull an image from a registry. * @param reference the image reference to pull * @param listener a pull listener to receive update events * @param registryAuth registry authentication credentials * @return the {@link ImageApi pulled image} instance * @throws IOException on IO error */
Pull an image from a registry
pull
{ "repo_name": "jxblum/spring-boot", "path": "spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java", "license": "apache-2.0", "size": 15993 }
[ "java.io.IOException", "org.springframework.boot.buildpack.platform.docker.transport.HttpTransport", "org.springframework.boot.buildpack.platform.docker.type.Image", "org.springframework.boot.buildpack.platform.docker.type.ImageReference", "org.springframework.util.Assert" ]
import java.io.IOException; import org.springframework.boot.buildpack.platform.docker.transport.HttpTransport; import org.springframework.boot.buildpack.platform.docker.type.Image; import org.springframework.boot.buildpack.platform.docker.type.ImageReference; import org.springframework.util.Assert;
import java.io.*; import org.springframework.boot.buildpack.platform.docker.transport.*; import org.springframework.boot.buildpack.platform.docker.type.*; import org.springframework.util.*;
[ "java.io", "org.springframework.boot", "org.springframework.util" ]
java.io; org.springframework.boot; org.springframework.util;
952,651
@Override public TypedValue getZeroValue(TypeRef type) { // Don't call getTypeName; we don't need to import these. if (type.isMap()) { return TypedValue.create(new TypeName("Hash"), "{}"); } if (type.isRepeated()) { return TypedValue.create(new TypeName("Array"), "[]"); } if (PRIMITIVE_ZERO_VALUE.containsKey(type.getKind())) { return TypedValue.create(getTypeName(type), PRIMITIVE_ZERO_VALUE.get(type.getKind())); } if (type.isMessage()) { return TypedValue.create(getTypeName(type), "%s.new"); } if (type.isEnum()) { EnumValue enumValue = type.getEnumType().getValues().get(0); return TypedValue.create(getTypeName(type), "%s::" + enumValue.getSimpleName()); } return TypedValue.create(new TypeName(""), "nil"); }
TypedValue function(TypeRef type) { if (type.isMap()) { return TypedValue.create(new TypeName("Hash"), "{}"); } if (type.isRepeated()) { return TypedValue.create(new TypeName("Array"), "[]"); } if (PRIMITIVE_ZERO_VALUE.containsKey(type.getKind())) { return TypedValue.create(getTypeName(type), PRIMITIVE_ZERO_VALUE.get(type.getKind())); } if (type.isMessage()) { return TypedValue.create(getTypeName(type), STR); } if (type.isEnum()) { EnumValue enumValue = type.getEnumType().getValues().get(0); return TypedValue.create(getTypeName(type), "%s::" + enumValue.getSimpleName()); } return TypedValue.create(new TypeName(STRnil"); }
/** * Returns the Ruby representation of a zero value for that type, to be used in code sample doc. */
Returns the Ruby representation of a zero value for that type, to be used in code sample doc
getZeroValue
{ "repo_name": "saicheems/toolkit", "path": "src/main/java/com/google/api/codegen/transformer/ruby/RubyModelTypeNameConverter.java", "license": "apache-2.0", "size": 6737 }
[ "com.google.api.codegen.util.TypeName", "com.google.api.codegen.util.TypedValue", "com.google.api.tools.framework.model.EnumValue", "com.google.api.tools.framework.model.TypeRef" ]
import com.google.api.codegen.util.TypeName; import com.google.api.codegen.util.TypedValue; import com.google.api.tools.framework.model.EnumValue; import com.google.api.tools.framework.model.TypeRef;
import com.google.api.codegen.util.*; import com.google.api.tools.framework.model.*;
[ "com.google.api" ]
com.google.api;
2,388,755
public ImageReader createReaderInstance() throws IOException { return createReaderInstance(null); }
ImageReader function() throws IOException { return createReaderInstance(null); }
/** * Returns an instance of the <code>ImageReader</code> * implementation associated with this service provider. * The returned object will initially be in an initial state * as if its <code>reset</code> method had been called. * * <p> The default implementation simply returns * <code>createReaderInstance(null)</code>. * * @return an <code>ImageReader</code> instance. * * @exception IOException if an error occurs during loading, * or initialization of the reader class, or during instantiation * or initialization of the reader object. */
Returns an instance of the <code>ImageReader</code> implementation associated with this service provider. The returned object will initially be in an initial state as if its <code>reset</code> method had been called. The default implementation simply returns <code>createReaderInstance(null)</code>
createReaderInstance
{ "repo_name": "isaacl/openjdk-jdk", "path": "src/share/classes/javax/imageio/spi/ImageReaderSpi.java", "license": "gpl-2.0", "size": 18353 }
[ "java.io.IOException", "javax.imageio.ImageReader" ]
import java.io.IOException; import javax.imageio.ImageReader;
import java.io.*; import javax.imageio.*;
[ "java.io", "javax.imageio" ]
java.io; javax.imageio;
2,355,900
public boolean isSupportDtd() { return this.supportDtd; } /** * Indicates whether external XML entities are processed when unmarshalling. * <p>Default is {@code false}, meaning that external entities are not resolved. * Note that processing of external entities will only be enabled/disabled when the * {@code Source} passed to {@link #unmarshal(Source)} is a {@link SAXSource} or * {@link StreamSource}. It has no effect for {@link DOMSource} or {@link StAXSource}
boolean function() { return this.supportDtd; } /** * Indicates whether external XML entities are processed when unmarshalling. * <p>Default is {@code false}, meaning that external entities are not resolved. * Note that processing of external entities will only be enabled/disabled when the * {@code Source} passed to {@link #unmarshal(Source)} is a {@link SAXSource} or * {@link StreamSource}. It has no effect for {@link DOMSource} or {@link StAXSource}
/** * Whether DTD parsing is supported. */
Whether DTD parsing is supported
isSupportDtd
{ "repo_name": "kingtang/spring-learn", "path": "spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java", "license": "gpl-3.0", "size": 36045 }
[ "javax.xml.transform.Source", "javax.xml.transform.dom.DOMSource", "javax.xml.transform.sax.SAXSource", "javax.xml.transform.stax.StAXSource", "javax.xml.transform.stream.StreamSource" ]
import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.sax.*; import javax.xml.transform.stax.*; import javax.xml.transform.stream.*;
[ "javax.xml" ]
javax.xml;
2,824,557
public String getIdName(Field field, ID annotation);
String function(Field field, ID annotation);
/** * Return the ID/Key name to use * * @param field * the field from the bean * @param annotation * the id annotation * @return name to use for the field (cannot be null) */
Return the ID/Key name to use
getIdName
{ "repo_name": "Netflix/astyanax", "path": "astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/AnnotationSet.java", "license": "apache-2.0", "size": 1882 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,412,552
public static Note createNote(String rawJSON) throws FacebookException { try { JSONObject json = new JSONObject(rawJSON); return noteConstructor.newInstance(json); } catch (InstantiationException e) { throw new FacebookException(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException e) { throw new FacebookException(e); } catch (JSONException e) { throw new FacebookException(e); } }
static Note function(String rawJSON) throws FacebookException { try { JSONObject json = new JSONObject(rawJSON); return noteConstructor.newInstance(json); } catch (InstantiationException e) { throw new FacebookException(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException e) { throw new FacebookException(e); } catch (JSONException e) { throw new FacebookException(e); } }
/** * Constructs a Note object from rawJSON string. * * @param rawJSON raw JSON form as String * @return Note * @throws FacebookException when provided string is not a valid JSON string. */
Constructs a Note object from rawJSON string
createNote
{ "repo_name": "igorekpotworek/facebook4j", "path": "facebook4j-core/src/main/java/facebook4j/json/DataObjectFactory.java", "license": "apache-2.0", "size": 57208 }
[ "java.lang.reflect.InvocationTargetException" ]
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,594,043
public PropertyDescriptor getPropertyDescriptor(String propertyName) { final PropertyDescriptor propertyDescriptor = findPropertyDescriptor(propertyName); if (propertyDescriptor == null) { throw new PropertyNotFoundException(beanClass, propertyName); } return propertyDescriptor; }
PropertyDescriptor function(String propertyName) { final PropertyDescriptor propertyDescriptor = findPropertyDescriptor(propertyName); if (propertyDescriptor == null) { throw new PropertyNotFoundException(beanClass, propertyName); } return propertyDescriptor; }
/** * Get the property descriptor for the named property. Throws an exception if the property does not exist. * * @param propertyName property name * @return the PropertyDescriptor for the named property * @throws PropertyNotFoundException if the named property does not exist on the bean * @see #findPropertyDescriptor(String) */
Get the property descriptor for the named property. Throws an exception if the property does not exist
getPropertyDescriptor
{ "repo_name": "mistraltechnologies/smog", "path": "src/main/java/com/mistraltech/smog/core/util/PropertyDescriptorLocator.java", "license": "bsd-3-clause", "size": 2391 }
[ "com.mistraltech.smog.core.PropertyNotFoundException", "java.beans.PropertyDescriptor" ]
import com.mistraltech.smog.core.PropertyNotFoundException; import java.beans.PropertyDescriptor;
import com.mistraltech.smog.core.*; import java.beans.*;
[ "com.mistraltech.smog", "java.beans" ]
com.mistraltech.smog; java.beans;
941,053
protected static boolean isDebugModeEnabled() { return java.lang.management.ManagementFactory.getRuntimeMXBean() .getInputArguments().toString().indexOf("-agentlib:jdwp") > 0; } /** * Applies the commit string to a given Root instance * * The commit string represents a sequence of operations, jsonp style: * * <p> * / + "test": { "a": { "id": "ref:123" }, "b": { "id" : "str:123" }}
static boolean function() { return java.lang.management.ManagementFactory.getRuntimeMXBean() .getInputArguments().toString().indexOf(STR) > 0; } /** * Applies the commit string to a given Root instance * * The commit string represents a sequence of operations, jsonp style: * * <p> * / + "test": { "a": { "id": STR }, "b": { "id" : STR }}
/** * Check whether the test is running in debug mode. * * @return true if debug most is (most likely) enabled */
Check whether the test is running in debug mode
isDebugModeEnabled
{ "repo_name": "leftouterjoin/jackrabbit-oak", "path": "oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java", "license": "apache-2.0", "size": 21411 }
[ "org.apache.jackrabbit.oak.api.Root" ]
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.api.*;
[ "org.apache.jackrabbit" ]
org.apache.jackrabbit;
2,843,085
@Test public void testStandbyDispatcherJobExecution() throws Exception { try (final TestingHighAvailabilityServices haServices1 = new TestingHighAvailabilityServices(); final TestingHighAvailabilityServices haServices2 = new TestingHighAvailabilityServices(); final CuratorFramework curatorFramework = ZooKeeperUtils.startCuratorFramework(configuration)) { final ZooKeeperSubmittedJobGraphStore submittedJobGraphStore1 = ZooKeeperUtils.createSubmittedJobGraphs(curatorFramework, configuration); haServices1.setSubmittedJobGraphStore(submittedJobGraphStore1); final TestingLeaderElectionService leaderElectionService1 = new TestingLeaderElectionService(); haServices1.setDispatcherLeaderElectionService(leaderElectionService1); final ZooKeeperSubmittedJobGraphStore submittedJobGraphStore2 = ZooKeeperUtils.createSubmittedJobGraphs(curatorFramework, configuration); haServices2.setSubmittedJobGraphStore(submittedJobGraphStore2); final TestingLeaderElectionService leaderElectionService2 = new TestingLeaderElectionService(); haServices2.setDispatcherLeaderElectionService(leaderElectionService2); final CompletableFuture<JobGraph> jobGraphFuture = new CompletableFuture<>(); final CompletableFuture<ArchivedExecutionGraph> resultFuture = new CompletableFuture<>(); final TestingDispatcher dispatcher1 = createDispatcher( haServices1, new TestingJobManagerRunnerFactory(jobGraphFuture, resultFuture, CompletableFuture.completedFuture(null))); final TestingDispatcher dispatcher2 = createDispatcher( haServices2, new TestingJobManagerRunnerFactory(new CompletableFuture<>(), new CompletableFuture<>(), CompletableFuture.completedFuture(null))); try { dispatcher1.start(); dispatcher2.start(); leaderElectionService1.isLeader(UUID.randomUUID()).get(); final DispatcherGateway dispatcherGateway1 = dispatcher1.getSelfGateway(DispatcherGateway.class); final JobGraph jobGraph = DispatcherHATest.createNonEmptyJobGraph(); dispatcherGateway1.submitJob(jobGraph, TIMEOUT).get(); final CompletableFuture<JobResult> jobResultFuture = dispatcherGateway1.requestJobResult(jobGraph.getJobID(), TIMEOUT); jobGraphFuture.get(); // complete the job resultFuture.complete(new ArchivedExecutionGraphBuilder().setJobID(jobGraph.getJobID()).setState(JobStatus.FINISHED).build()); final JobResult jobResult = jobResultFuture.get(); assertThat(jobResult.isSuccess(), is(true)); // wait for the completion of the job dispatcher1.getJobTerminationFuture(jobGraph.getJobID(), TIMEOUT).get(); // change leadership leaderElectionService1.notLeader(); leaderElectionService2.isLeader(UUID.randomUUID()).get(); // Dispatcher 2 should not recover any jobs final DispatcherGateway dispatcherGateway2 = dispatcher2.getSelfGateway(DispatcherGateway.class); assertThat(dispatcherGateway2.listJobs(TIMEOUT).get(), is(empty())); } finally { RpcUtils.terminateRpcEndpoint(dispatcher1, TIMEOUT); RpcUtils.terminateRpcEndpoint(dispatcher2, TIMEOUT); } } }
void function() throws Exception { try (final TestingHighAvailabilityServices haServices1 = new TestingHighAvailabilityServices(); final TestingHighAvailabilityServices haServices2 = new TestingHighAvailabilityServices(); final CuratorFramework curatorFramework = ZooKeeperUtils.startCuratorFramework(configuration)) { final ZooKeeperSubmittedJobGraphStore submittedJobGraphStore1 = ZooKeeperUtils.createSubmittedJobGraphs(curatorFramework, configuration); haServices1.setSubmittedJobGraphStore(submittedJobGraphStore1); final TestingLeaderElectionService leaderElectionService1 = new TestingLeaderElectionService(); haServices1.setDispatcherLeaderElectionService(leaderElectionService1); final ZooKeeperSubmittedJobGraphStore submittedJobGraphStore2 = ZooKeeperUtils.createSubmittedJobGraphs(curatorFramework, configuration); haServices2.setSubmittedJobGraphStore(submittedJobGraphStore2); final TestingLeaderElectionService leaderElectionService2 = new TestingLeaderElectionService(); haServices2.setDispatcherLeaderElectionService(leaderElectionService2); final CompletableFuture<JobGraph> jobGraphFuture = new CompletableFuture<>(); final CompletableFuture<ArchivedExecutionGraph> resultFuture = new CompletableFuture<>(); final TestingDispatcher dispatcher1 = createDispatcher( haServices1, new TestingJobManagerRunnerFactory(jobGraphFuture, resultFuture, CompletableFuture.completedFuture(null))); final TestingDispatcher dispatcher2 = createDispatcher( haServices2, new TestingJobManagerRunnerFactory(new CompletableFuture<>(), new CompletableFuture<>(), CompletableFuture.completedFuture(null))); try { dispatcher1.start(); dispatcher2.start(); leaderElectionService1.isLeader(UUID.randomUUID()).get(); final DispatcherGateway dispatcherGateway1 = dispatcher1.getSelfGateway(DispatcherGateway.class); final JobGraph jobGraph = DispatcherHATest.createNonEmptyJobGraph(); dispatcherGateway1.submitJob(jobGraph, TIMEOUT).get(); final CompletableFuture<JobResult> jobResultFuture = dispatcherGateway1.requestJobResult(jobGraph.getJobID(), TIMEOUT); jobGraphFuture.get(); resultFuture.complete(new ArchivedExecutionGraphBuilder().setJobID(jobGraph.getJobID()).setState(JobStatus.FINISHED).build()); final JobResult jobResult = jobResultFuture.get(); assertThat(jobResult.isSuccess(), is(true)); dispatcher1.getJobTerminationFuture(jobGraph.getJobID(), TIMEOUT).get(); leaderElectionService1.notLeader(); leaderElectionService2.isLeader(UUID.randomUUID()).get(); final DispatcherGateway dispatcherGateway2 = dispatcher2.getSelfGateway(DispatcherGateway.class); assertThat(dispatcherGateway2.listJobs(TIMEOUT).get(), is(empty())); } finally { RpcUtils.terminateRpcEndpoint(dispatcher1, TIMEOUT); RpcUtils.terminateRpcEndpoint(dispatcher2, TIMEOUT); } } }
/** * Tests that a standby Dispatcher does not interfere with the clean up of a completed * job. */
Tests that a standby Dispatcher does not interfere with the clean up of a completed job
testStandbyDispatcherJobExecution
{ "repo_name": "mylog00/flink", "path": "flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/ZooKeeperHADispatcherTest.java", "license": "apache-2.0", "size": 13803 }
[ "java.util.UUID", "java.util.concurrent.CompletableFuture", "org.apache.curator.framework.CuratorFramework", "org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph", "org.apache.flink.runtime.highavailability.TestingHighAvailabilityServices", "org.apache.flink.runtime.jobgraph.JobGraph", "org.apache.flink.runtime.jobgraph.JobStatus", "org.apache.flink.runtime.jobmanager.ZooKeeperSubmittedJobGraphStore", "org.apache.flink.runtime.jobmaster.JobResult", "org.apache.flink.runtime.leaderelection.TestingLeaderElectionService", "org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder", "org.apache.flink.runtime.rpc.RpcUtils", "org.apache.flink.runtime.util.ZooKeeperUtils", "org.hamcrest.Matchers", "org.junit.Assert" ]
import java.util.UUID; import java.util.concurrent.CompletableFuture; import org.apache.curator.framework.CuratorFramework; import org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph; import org.apache.flink.runtime.highavailability.TestingHighAvailabilityServices; import org.apache.flink.runtime.jobgraph.JobGraph; import org.apache.flink.runtime.jobgraph.JobStatus; import org.apache.flink.runtime.jobmanager.ZooKeeperSubmittedJobGraphStore; import org.apache.flink.runtime.jobmaster.JobResult; import org.apache.flink.runtime.leaderelection.TestingLeaderElectionService; import org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder; import org.apache.flink.runtime.rpc.RpcUtils; import org.apache.flink.runtime.util.ZooKeeperUtils; import org.hamcrest.Matchers; import org.junit.Assert;
import java.util.*; import java.util.concurrent.*; import org.apache.curator.framework.*; import org.apache.flink.runtime.executiongraph.*; import org.apache.flink.runtime.highavailability.*; import org.apache.flink.runtime.jobgraph.*; import org.apache.flink.runtime.jobmanager.*; import org.apache.flink.runtime.jobmaster.*; import org.apache.flink.runtime.leaderelection.*; import org.apache.flink.runtime.rest.handler.legacy.utils.*; import org.apache.flink.runtime.rpc.*; import org.apache.flink.runtime.util.*; import org.hamcrest.*; import org.junit.*;
[ "java.util", "org.apache.curator", "org.apache.flink", "org.hamcrest", "org.junit" ]
java.util; org.apache.curator; org.apache.flink; org.hamcrest; org.junit;
158,563
@Override public boolean equals (final Object obj) { return (obj == this) ? true : (obj instanceof User) && Objects.equals (this.getUsername (), ((User) obj).getUsername ()); }
boolean function (final Object obj) { return (obj == this) ? true : (obj instanceof User) && Objects.equals (this.getUsername (), ((User) obj).getUsername ()); }
/** * Compare two <code>User</code> instances to determine if they are * equal. The <code>User</code> instances are compared based upon the * this ID number and the username. * * @param obj The <code>User</code> instance to compare to the one * represented by the called instance * @return <code>True</code> if the two <code>User</code> instances * are equal, <code>False</code> otherwise */
Compare two <code>User</code> instances to determine if they are equal. The <code>User</code> instances are compared based upon the this ID number and the username
equals
{ "repo_name": "jestark/LMSDataHarvester", "path": "src/main/java/ca/uoguelph/socs/icc/edm/domain/User.java", "license": "gpl-3.0", "size": 33949 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
900,385
@Override public void sessionClosed(IoSession session) throws Exception { try { resourceLock.lock(); if ( log.isDebugEnabled() ) { log.debug("session has been closed. "); } } finally { resourceLock.unlock(); } }
void function(IoSession session) throws Exception { try { resourceLock.lock(); if ( log.isDebugEnabled() ) { log.debug(STR); } } finally { resourceLock.unlock(); } }
/** * Session closed */
Session closed
sessionClosed
{ "repo_name": "wangqi/gameserver", "path": "server/src/main/java/com/xinqihd/sns/gameserver/transport/GameClient.java", "license": "apache-2.0", "size": 7010 }
[ "org.apache.mina.core.session.IoSession" ]
import org.apache.mina.core.session.IoSession;
import org.apache.mina.core.session.*;
[ "org.apache.mina" ]
org.apache.mina;
1,892,621
protected void putChildrenInto(StringBuilder sb) { Node node; for (SimpleNodeIterator e = children (); e.hasMoreNodes ();) { node = e.nextNode (); // eliminate virtual tags // if (!(node.getStartPosition () == node.getEndPosition ())) sb.append (node.toHtml ()); } }
void function(StringBuilder sb) { Node node; for (SimpleNodeIterator e = children (); e.hasMoreNodes ();) { node = e.nextNode (); sb.append (node.toHtml ()); } }
/** * Add the textual contents of the children of this node to the buffer. * @param sb The buffer to append to. */
Add the textual contents of the children of this node to the buffer
putChildrenInto
{ "repo_name": "bbossgroups/bbossgroups-3.5", "path": "bboss-htmlparser/src/org/htmlparser/tags/CompositeTag.java", "license": "apache-2.0", "size": 21445 }
[ "org.htmlparser.Node", "org.htmlparser.util.SimpleNodeIterator" ]
import org.htmlparser.Node; import org.htmlparser.util.SimpleNodeIterator;
import org.htmlparser.*; import org.htmlparser.util.*;
[ "org.htmlparser", "org.htmlparser.util" ]
org.htmlparser; org.htmlparser.util;
2,546,956
SimpleVersionedSerializer<CommitRecoverable> getCommitRecoverableSerializer();
SimpleVersionedSerializer<CommitRecoverable> getCommitRecoverableSerializer();
/** * The serializer for the CommitRecoverable types created in this writer. * This serializer should be used to store the CommitRecoverable in checkpoint * state or other forms of persistent state. */
The serializer for the CommitRecoverable types created in this writer. This serializer should be used to store the CommitRecoverable in checkpoint state or other forms of persistent state
getCommitRecoverableSerializer
{ "repo_name": "jinglining/flink", "path": "flink-core/src/main/java/org/apache/flink/core/fs/RecoverableWriter.java", "license": "apache-2.0", "size": 9235 }
[ "org.apache.flink.core.io.SimpleVersionedSerializer" ]
import org.apache.flink.core.io.SimpleVersionedSerializer;
import org.apache.flink.core.io.*;
[ "org.apache.flink" ]
org.apache.flink;
2,714,577
public static CacheBuilderSpec parse(String cacheBuilderSpecification) { CacheBuilderSpec spec = new CacheBuilderSpec(cacheBuilderSpecification); if (!cacheBuilderSpecification.isEmpty()) { for (String keyValuePair : KEYS_SPLITTER.split(cacheBuilderSpecification)) { List<String> keyAndValue = ImmutableList.copyOf(KEY_VALUE_SPLITTER.split(keyValuePair)); checkArgument(!keyAndValue.isEmpty(), "blank key-value pair"); checkArgument(keyAndValue.size() <= 2, "key-value pair %s with more than one equals sign", keyValuePair); // Find the ValueParser for the current key. String key = keyAndValue.get(0); ValueParser valueParser = VALUE_PARSERS.get(key); checkArgument(valueParser != null, "unknown key %s", key); String value = keyAndValue.size() == 1 ? null : keyAndValue.get(1); valueParser.parse(spec, key, value); } } return spec; }
static CacheBuilderSpec function(String cacheBuilderSpecification) { CacheBuilderSpec spec = new CacheBuilderSpec(cacheBuilderSpecification); if (!cacheBuilderSpecification.isEmpty()) { for (String keyValuePair : KEYS_SPLITTER.split(cacheBuilderSpecification)) { List<String> keyAndValue = ImmutableList.copyOf(KEY_VALUE_SPLITTER.split(keyValuePair)); checkArgument(!keyAndValue.isEmpty(), STR); checkArgument(keyAndValue.size() <= 2, STR, keyValuePair); String key = keyAndValue.get(0); ValueParser valueParser = VALUE_PARSERS.get(key); checkArgument(valueParser != null, STR, key); String value = keyAndValue.size() == 1 ? null : keyAndValue.get(1); valueParser.parse(spec, key, value); } } return spec; }
/** * Creates a CacheBuilderSpec from a string. * * @param cacheBuilderSpecification the string form */
Creates a CacheBuilderSpec from a string
parse
{ "repo_name": "trivium-io/trivium-core", "path": "src/io/trivium/dep/com/google/common/cache/CacheBuilderSpec.java", "license": "apache-2.0", "size": 17945 }
[ "io.trivium.dep.com.google.common.base.Preconditions", "io.trivium.dep.com.google.common.collect.ImmutableList", "java.util.List" ]
import io.trivium.dep.com.google.common.base.Preconditions; import io.trivium.dep.com.google.common.collect.ImmutableList; import java.util.List;
import io.trivium.dep.com.google.common.base.*; import io.trivium.dep.com.google.common.collect.*; import java.util.*;
[ "io.trivium.dep", "java.util" ]
io.trivium.dep; java.util;
205,186
private boolean fixSms(SmsToFix sms) { try { Cursor cur = findSmsInDb(sms); return updateSmsInDB(cur, sms); } catch (SmsNotFoundException se) { Log.w(TAG, "SMS not found in DB: " + se.getMessage()); SD.log("SmsTimeFixService [WorkerThread]: SMS not found in DB: " + se.getMessage()); return false; } catch (SmsFixException e) { Log.w(TAG, "Service: fix sms catched exception.", e); SD.log("SmsTimeFixService [WorkerThread]: fix sms catched an exception. " + e + ": " + e.getMessage()); return false; } }
boolean function(SmsToFix sms) { try { Cursor cur = findSmsInDb(sms); return updateSmsInDB(cur, sms); } catch (SmsNotFoundException se) { Log.w(TAG, STR + se.getMessage()); SD.log(STR + se.getMessage()); return false; } catch (SmsFixException e) { Log.w(TAG, STR, e); SD.log(STR + e + STR + e.getMessage()); return false; } }
/** * Fixes a single sms * * @param sms * @return <code>true</code> if SMS could be found and fixed, * <code>false</code> otherwise */
Fixes a single sms
fixSms
{ "repo_name": "johnzweng/SMSSentTime", "path": "src/at/zweng/smssenttimefix/SmsTimeFixService.java", "license": "gpl-3.0", "size": 19424 }
[ "android.database.Cursor", "android.util.Log" ]
import android.database.Cursor; import android.util.Log;
import android.database.*; import android.util.*;
[ "android.database", "android.util" ]
android.database; android.util;
1,611,100
protected Collection<String> getInitialObjectNames() { if (initialObjectNames == null) { initialObjectNames = new ArrayList<String>(); for (EClassifier eClassifier : graphixPackage.getEClassifiers()) { if (eClassifier instanceof EClass) { EClass eClass = (EClass)eClassifier; if (!eClass.isAbstract()) { initialObjectNames.add(eClass.getName()); } } } Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); } return initialObjectNames; }
Collection<String> function() { if (initialObjectNames == null) { initialObjectNames = new ArrayList<String>(); for (EClassifier eClassifier : graphixPackage.getEClassifiers()) { if (eClassifier instanceof EClass) { EClass eClass = (EClass)eClassifier; if (!eClass.isAbstract()) { initialObjectNames.add(eClass.getName()); } } } Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); } return initialObjectNames; }
/** * Returns the names of the types that can be created as the root object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Returns the names of the types that can be created as the root object.
getInitialObjectNames
{ "repo_name": "xpomul/cdo-xtext", "path": "examples/net.winklerweb.cdoxtext.example.graphix.editor/src/net/winklerweb/cdoxtext/example/graphix/presentation/GraphixModelWizard.java", "license": "epl-1.0", "size": 18176 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.Collections", "org.eclipse.emf.common.CommonPlugin", "org.eclipse.emf.ecore.EClass", "org.eclipse.emf.ecore.EClassifier" ]
import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import org.eclipse.emf.common.CommonPlugin; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier;
import java.util.*; import org.eclipse.emf.common.*; import org.eclipse.emf.ecore.*;
[ "java.util", "org.eclipse.emf" ]
java.util; org.eclipse.emf;
2,075,837
public static ResultSetConversionStrategy fromName(String name) { if (name == null) { return null; } if (name.equals("ALL")) { return ResultSetConversionStrategies.all(); } if (name.equals("ONE")) { return ResultSetConversionStrategies.one(); } Matcher matcher = LIMIT_NAME_PATTERN.matcher(name); if (matcher.matches()) { int limit = Integer.parseInt(matcher.group(1)); return limit(limit); } throw new IllegalArgumentException("Unknown conversion strategy " + name); }
static ResultSetConversionStrategy function(String name) { if (name == null) { return null; } if (name.equals("ALL")) { return ResultSetConversionStrategies.all(); } if (name.equals("ONE")) { return ResultSetConversionStrategies.one(); } Matcher matcher = LIMIT_NAME_PATTERN.matcher(name); if (matcher.matches()) { int limit = Integer.parseInt(matcher.group(1)); return limit(limit); } throw new IllegalArgumentException(STR + name); }
/** * Get {@link ResultSetConversionStrategy} from String */
Get <code>ResultSetConversionStrategy</code> from String
fromName
{ "repo_name": "CodeSmell/camel", "path": "components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/ResultSetConversionStrategies.java", "license": "apache-2.0", "size": 3719 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,314,782
private List<CommentRow> generateCommentRows(StudentAttributes student, InstructorAttributes instructor, String giverEmail, int totalNumOfComments, List<CommentAttributes> comments) { List<CommentRow> commentDivs = new ArrayList<CommentRow>(); for (CommentAttributes comment : comments) { String recipientDetails = student.name + " (" + student.team + ", " + student.email + ")"; String unsanitizedRecipientDetails = StringHelper.recoverFromSanitizedText(recipientDetails); CommentRow commentDiv = new CommentRow(comment, giverEmail, unsanitizedRecipientDetails); String whoCanSeeComment = getTypeOfPeopleCanViewComment(comment); commentDiv.setVisibilityIcon(whoCanSeeComment); boolean canModifyComment = COMMENT_GIVER_NAME_THAT_COMES_FIRST.equals(giverEmail) || instructor.isAllowedForPrivilege(student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS); if (canModifyComment) { commentDiv.setEditDeleteEnabled(false); } commentDiv.setNotFromCommentsPage(student.email); commentDiv.setNumComments(totalNumOfComments); commentDivs.add(commentDiv); } return commentDivs; }
List<CommentRow> function(StudentAttributes student, InstructorAttributes instructor, String giverEmail, int totalNumOfComments, List<CommentAttributes> comments) { List<CommentRow> commentDivs = new ArrayList<CommentRow>(); for (CommentAttributes comment : comments) { String recipientDetails = student.name + STR + student.team + STR + student.email + ")"; String unsanitizedRecipientDetails = StringHelper.recoverFromSanitizedText(recipientDetails); CommentRow commentDiv = new CommentRow(comment, giverEmail, unsanitizedRecipientDetails); String whoCanSeeComment = getTypeOfPeopleCanViewComment(comment); commentDiv.setVisibilityIcon(whoCanSeeComment); boolean canModifyComment = COMMENT_GIVER_NAME_THAT_COMES_FIRST.equals(giverEmail) instructor.isAllowedForPrivilege(student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS); if (canModifyComment) { commentDiv.setEditDeleteEnabled(false); } commentDiv.setNotFromCommentsPage(student.email); commentDiv.setNumComments(totalNumOfComments); commentDivs.add(commentDiv); } return commentDivs; }
/** * Generates the comment rows for a specific giver, * based on the current instructor's privilege to modify comments. * @param student * @param instructor * @param giverEmail * @param totalNumOfComments * @param comments * @return A list of comment rows for comments from giverEmail. */
Generates the comment rows for a specific giver, based on the current instructor's privilege to modify comments
generateCommentRows
{ "repo_name": "belyabl9/teammates", "path": "src/main/java/teammates/ui/controller/InstructorStudentRecordsPageData.java", "license": "gpl-2.0", "size": 6363 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
451,664
public CallHandle lookupLdapAuthExperimenter(SecurityContext ctx, long userID, AgentEventListener observer);
CallHandle function(SecurityContext ctx, long userID, AgentEventListener observer);
/** * Changes the default group of the specified user or <code>null</code>. * * @param ctx The security context. * @param userID The identifier of the user to handle. * @param observer Call-back handler. * @return A handle that can be used to cancel the call. */
Changes the default group of the specified user or <code>null</code>
lookupLdapAuthExperimenter
{ "repo_name": "dominikl/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/views/AdminView.java", "license": "gpl-2.0", "size": 9346 }
[ "org.openmicroscopy.shoola.env.event.AgentEventListener" ]
import org.openmicroscopy.shoola.env.event.AgentEventListener;
import org.openmicroscopy.shoola.env.event.*;
[ "org.openmicroscopy.shoola" ]
org.openmicroscopy.shoola;
2,784,856
public static byte[] utf8Encode(CharSequence string) { try { ByteBuffer bytes = UTF8.newEncoder().encode(CharBuffer.wrap(string)); byte[] bytesCopy = new byte[bytes.limit()]; System.arraycopy(bytes.array(), 0, bytesCopy, 0, bytes.limit()); return bytesCopy; } catch (CharacterCodingException e) { throw new RuntimeException(e); } }
static byte[] function(CharSequence string) { try { ByteBuffer bytes = UTF8.newEncoder().encode(CharBuffer.wrap(string)); byte[] bytesCopy = new byte[bytes.limit()]; System.arraycopy(bytes.array(), 0, bytesCopy, 0, bytes.limit()); return bytesCopy; } catch (CharacterCodingException e) { throw new RuntimeException(e); } }
/** * UTF-8 encoding/decoding. Using a charset rather than `String.getBytes` is less forgiving * and will raise an exception for invalid data. */
UTF-8 encoding/decoding. Using a charset rather than `String.getBytes` is less forgiving and will raise an exception for invalid data
utf8Encode
{ "repo_name": "jgrandja/spring-security-oauth", "path": "spring-security-jwt/src/main/java/org/springframework/security/jwt/codec/Codecs.java", "license": "apache-2.0", "size": 5197 }
[ "java.nio.ByteBuffer", "java.nio.CharBuffer", "java.nio.charset.CharacterCodingException" ]
import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException;
import java.nio.*; import java.nio.charset.*;
[ "java.nio" ]
java.nio;
664,341
public void setSeconds(int seconds) { setData1(Convert.toByte(seconds)); }
void function(int seconds) { setData1(Convert.toByte(seconds)); }
/** * Sets the Faderate * * @param seconds * Faderate in Seconds */
Sets the Faderate
setSeconds
{ "repo_name": "openhab/openhab", "path": "bundles/binding/org.openhab.binding.plcbus/src/main/java/org/openhab/binding/plcbus/internal/protocol/commands/Bright.java", "license": "epl-1.0", "size": 1150 }
[ "org.openhab.binding.plcbus.internal.protocol.Convert" ]
import org.openhab.binding.plcbus.internal.protocol.Convert;
import org.openhab.binding.plcbus.internal.protocol.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,809,318
List<OntologyTerm> findExcatOntologyTerms(List<String> ontologyIds, Set<String> terms, int pageSize);
List<OntologyTerm> findExcatOntologyTerms(List<String> ontologyIds, Set<String> terms, int pageSize);
/** * Finds ontology terms that are exact matches to a certain search string. * * @param ontologies * {@link Ontology}s to search in * @param search * search term * @param pageSize * number of results to return. * @return List of {@link OntologyTerm}s that match the search term. */
Finds ontology terms that are exact matches to a certain search string
findExcatOntologyTerms
{ "repo_name": "joerivandervelde/molgenis", "path": "molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/service/OntologyService.java", "license": "lgpl-3.0", "size": 2438 }
[ "java.util.List", "java.util.Set", "org.molgenis.ontology.core.model.OntologyTerm" ]
import java.util.List; import java.util.Set; import org.molgenis.ontology.core.model.OntologyTerm;
import java.util.*; import org.molgenis.ontology.core.model.*;
[ "java.util", "org.molgenis.ontology" ]
java.util; org.molgenis.ontology;
2,094,138
SysUser user = sysUserCache.getByKey(USER_KEY + username); if (user == null) { user = userService.findByUsername(username); if (user == null) { return null; } SysUser saveUser = new SysUser(); BeanCopier copier = BeanCopier.create(user.getClass(), saveUser.getClass(), false); copier.copy(user, saveUser, null); Set<SysRole> roles = user.getSysRoles(); if (roles != null && roles.size() >= 0) { Set<SysRole> saveRoles = new HashSet<SysRole>(); for (SysRole sysRole : roles) { SysRole saveRole = new SysRole(); copier = BeanCopier.create(sysRole.getClass(), saveRole.getClass(), false); copier.copy(sysRole, saveRole, null); saveRoles.add(saveRole); } saveUser.setSysRoles(saveRoles); } sysUserCache.cacheObject(USER_KEY + username, saveUser); user = saveUser; } return user; }
SysUser user = sysUserCache.getByKey(USER_KEY + username); if (user == null) { user = userService.findByUsername(username); if (user == null) { return null; } SysUser saveUser = new SysUser(); BeanCopier copier = BeanCopier.create(user.getClass(), saveUser.getClass(), false); copier.copy(user, saveUser, null); Set<SysRole> roles = user.getSysRoles(); if (roles != null && roles.size() >= 0) { Set<SysRole> saveRoles = new HashSet<SysRole>(); for (SysRole sysRole : roles) { SysRole saveRole = new SysRole(); copier = BeanCopier.create(sysRole.getClass(), saveRole.getClass(), false); copier.copy(sysRole, saveRole, null); saveRoles.add(saveRole); } saveUser.setSysRoles(saveRoles); } sysUserCache.cacheObject(USER_KEY + username, saveUser); user = saveUser; } return user; }
/** * Get user object according given user name. * * @param username * unique user name. * @return user object or null. */
Get user object according given user name
getCacheByUsername
{ "repo_name": "zpxocivuby/freetong_mobile_server", "path": "itaf-aggregator/itaf-cache/src/main/java/itaf/framework/cache/business/service/impl/EhCacheUserServiceImpl.java", "license": "gpl-3.0", "size": 2181 }
[ "java.util.HashSet", "java.util.Set", "net.sf.cglib.beans.BeanCopier" ]
import java.util.HashSet; import java.util.Set; import net.sf.cglib.beans.BeanCopier;
import java.util.*; import net.sf.cglib.beans.*;
[ "java.util", "net.sf.cglib" ]
java.util; net.sf.cglib;
814,103
public Index getIndexForColumn(Column column, boolean first) { ArrayList<Index> indexes = getIndexes(); if (indexes != null) { for (int i = 1, size = indexes.size(); i < size; i++) { Index index = indexes.get(i); if (index.canGetFirstOrLast()) { int idx = index.getColumnIndex(column); if (idx == 0) { return index; } } } } return null; }
Index function(Column column, boolean first) { ArrayList<Index> indexes = getIndexes(); if (indexes != null) { for (int i = 1, size = indexes.size(); i < size; i++) { Index index = indexes.get(i); if (index.canGetFirstOrLast()) { int idx = index.getColumnIndex(column); if (idx == 0) { return index; } } } } return null; }
/** * Get the index that has the given column as the first element. * This method returns null if no matching index is found. * * @param column the column * @param first if the min value should be returned * @return the index or null */
Get the index that has the given column as the first element. This method returns null if no matching index is found
getIndexForColumn
{ "repo_name": "titus08/frostwire-desktop", "path": "lib/jars-src/h2-1.3.164/org/h2/table/Table.java", "license": "gpl-3.0", "size": 32549 }
[ "java.util.ArrayList", "org.h2.index.Index" ]
import java.util.ArrayList; import org.h2.index.Index;
import java.util.*; import org.h2.index.*;
[ "java.util", "org.h2.index" ]
java.util; org.h2.index;
491,804
public Set<String> getAllNodesUrls() { HashSet<String> nodesUrls = new HashSet<>(size() + (extraNodes != null ? extraNodes.size() : 0)); addNodesToUrlsSet(nodesUrls, this); if (extraNodes != null) { addNodesToUrlsSet(nodesUrls, extraNodes); } return nodesUrls; }
Set<String> function() { HashSet<String> nodesUrls = new HashSet<>(size() + (extraNodes != null ? extraNodes.size() : 0)); addNodesToUrlsSet(nodesUrls, this); if (extraNodes != null) { addNodesToUrlsSet(nodesUrls, extraNodes); } return nodesUrls; }
/** * Returns a set containing all nodes urls (standard + extra) included in this node set * * @return set of urls */
Returns a set containing all nodes urls (standard + extra) included in this node set
getAllNodesUrls
{ "repo_name": "ShatalovYaroslav/scheduling", "path": "rm/rm-client/src/main/java/org/ow2/proactive/utils/NodeSet.java", "license": "agpl-3.0", "size": 4341 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,767,236
public static BindException bindAndValidate(ServletRequest request, Object object, String objectName, Validator validator) { BindException binder = bind(request, object, objectName); ValidationUtils.invokeValidator(validator, object, binder); return binder; }
static BindException function(ServletRequest request, Object object, String objectName, Validator validator) { BindException binder = bind(request, object, objectName); ValidationUtils.invokeValidator(validator, object, binder); return binder; }
/** * Bind the parameters from the given request to the given object, * invoking the given validator. * @param request request containing the parameters * @param object object to bind the parameters to * @param objectName name of the bind object * @param validator validator to be invoked, or null if no validation * @return the binder used (can be treated as Errors instance) */
Bind the parameters from the given request to the given object, invoking the given validator
bindAndValidate
{ "repo_name": "dachengxi/spring1.1.1_source", "path": "src/org/springframework/web/bind/BindUtils.java", "license": "mit", "size": 4323 }
[ "javax.servlet.ServletRequest", "org.springframework.validation.BindException", "org.springframework.validation.ValidationUtils", "org.springframework.validation.Validator" ]
import javax.servlet.ServletRequest; import org.springframework.validation.BindException; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator;
import javax.servlet.*; import org.springframework.validation.*;
[ "javax.servlet", "org.springframework.validation" ]
javax.servlet; org.springframework.validation;
1,256,529
private void checkTreeUsingPotentialNodes() throws DatabaseException { DatabaseImpl database = DbInternal.dbGetDatabaseImpl(db); Tree tree = database.getTree(); IN inAB = new IN(database, "ab".getBytes(), 4, 2); checkPotential(tree, inAB, firstLevel2IN); BIN binAB = new BIN(database, "ab".getBytes(), 4, 1); checkPotential(tree, binAB, firstLevel2IN); DIN dinA = new DIN(database, "data1".getBytes(), 4, "a".getBytes(), null, 3); checkPotential(tree, dinA, firstBIN); LN LNab = new LN("foo".getBytes()); byte[] mainKey = "ab".getBytes(); checkPotential(tree, LNab, firstBIN, mainKey, LNab.getData(), mainKey); LN LNdata = new LN("data".getBytes()); mainKey = "b".getBytes(); byte[] dupKey = LNdata.getData(); checkPotential(tree, LNdata, firstDBIN, mainKey, dupKey, dupKey); }
void function() throws DatabaseException { DatabaseImpl database = DbInternal.dbGetDatabaseImpl(db); Tree tree = database.getTree(); IN inAB = new IN(database, "ab".getBytes(), 4, 2); checkPotential(tree, inAB, firstLevel2IN); BIN binAB = new BIN(database, "ab".getBytes(), 4, 1); checkPotential(tree, binAB, firstLevel2IN); DIN dinA = new DIN(database, "data1".getBytes(), 4, "a".getBytes(), null, 3); checkPotential(tree, dinA, firstBIN); LN LNab = new LN("foo".getBytes()); byte[] mainKey = "ab".getBytes(); checkPotential(tree, LNab, firstBIN, mainKey, LNab.getData(), mainKey); LN LNdata = new LN("data".getBytes()); mainKey = "b".getBytes(); byte[] dupKey = LNdata.getData(); checkPotential(tree, LNdata, firstDBIN, mainKey, dupKey, dupKey); }
/** * Make up non-existent nodes and see where they'd fit in. This exercises * recovery type processing and cleaning. */
Make up non-existent nodes and see where they'd fit in. This exercises recovery type processing and cleaning
checkTreeUsingPotentialNodes
{ "repo_name": "nologic/nabs", "path": "client/trunk/shared/libraries/je-3.2.74/test/com/sleepycat/je/tree/GetParentNodeTest.java", "license": "gpl-2.0", "size": 16710 }
[ "com.sleepycat.je.DatabaseException", "com.sleepycat.je.DbInternal", "com.sleepycat.je.dbi.DatabaseImpl" ]
import com.sleepycat.je.DatabaseException; import com.sleepycat.je.DbInternal; import com.sleepycat.je.dbi.DatabaseImpl;
import com.sleepycat.je.*; import com.sleepycat.je.dbi.*;
[ "com.sleepycat.je" ]
com.sleepycat.je;
437,070
static TableChange addColumn( String[] fieldNames, DataType dataType, boolean isNullable, String comment, ColumnPosition position) { return new AddColumn(fieldNames, dataType, isNullable, comment, position); }
static TableChange addColumn( String[] fieldNames, DataType dataType, boolean isNullable, String comment, ColumnPosition position) { return new AddColumn(fieldNames, dataType, isNullable, comment, position); }
/** * Create a TableChange for adding a column. * <p> * If the field already exists, the change will result in an {@link IllegalArgumentException}. * If the new field is nested and its parent does not exist or is not a struct, the change will * result in an {@link IllegalArgumentException}. * * @param fieldNames field names of the new column * @param dataType the new column's data type * @param isNullable whether the new column can contain null * @param comment the new field's comment string * @param position the new columns's position * @return a TableChange for the addition */
Create a TableChange for adding a column. If the field already exists, the change will result in an <code>IllegalArgumentException</code>. If the new field is nested and its parent does not exist or is not a struct, the change will result in an <code>IllegalArgumentException</code>
addColumn
{ "repo_name": "darionyaphet/spark", "path": "sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableChange.java", "license": "apache-2.0", "size": 20108 }
[ "org.apache.spark.sql.types.DataType" ]
import org.apache.spark.sql.types.DataType;
import org.apache.spark.sql.types.*;
[ "org.apache.spark" ]
org.apache.spark;
157,760
public static synchronized void checkBouncyCastleDeprecation(Provider provider, String service, String algorithm) throws NoSuchAlgorithmException { // Applications may install their own BC provider, only the algorithms from the system // provider are deprecated. if (provider == SYSTEM_BOUNCY_CASTLE_PROVIDER) { checkBouncyCastleDeprecation(service, algorithm); } } // The set of algorithms that are deprecated. This list is created using // libcore/tools/crypto/src/java/libcore/java/security/ProviderOverlap.java. private static final Set<String> DEPRECATED_ALGORITHMS = new HashSet<String>(); static { DEPRECATED_ALGORITHMS.addAll(Arrays.asList( "KEYFACTORY.RSA" )); }
static synchronized void function(Provider provider, String service, String algorithm) throws NoSuchAlgorithmException { if (provider == SYSTEM_BOUNCY_CASTLE_PROVIDER) { checkBouncyCastleDeprecation(service, algorithm); } } private static final Set<String> DEPRECATED_ALGORITHMS = new HashSet<String>(); static { DEPRECATED_ALGORITHMS.addAll(Arrays.asList( STR )); }
/** * Checks if the given provider is the system-installed Bouncy Castle provider. If so, * throws {@code NoSuchAlgorithmException} if the algorithm being requested is deprecated * and the application targets a late-enough API level. * * @hide */
Checks if the given provider is the system-installed Bouncy Castle provider. If so, throws NoSuchAlgorithmException if the algorithm being requested is deprecated and the application targets a late-enough API level
checkBouncyCastleDeprecation
{ "repo_name": "google/desugar_jdk_libs", "path": "jdk11/src/libcore/ojluni/src/main/java/sun/security/jca/Providers.java", "license": "gpl-2.0", "size": 16234 }
[ "java.security.NoSuchAlgorithmException", "java.security.Provider", "java.util.Arrays", "java.util.HashSet", "java.util.Set" ]
import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.util.Arrays; import java.util.HashSet; import java.util.Set;
import java.security.*; import java.util.*;
[ "java.security", "java.util" ]
java.security; java.util;
860,199
public Cancellable getRollupCapabilitiesAsync(GetRollupCapsRequest request, RequestOptions options, ActionListener<GetRollupCapsResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(request, RollupRequestConverters::getRollupCaps, options, GetRollupCapsResponse::fromXContent, listener, Collections.emptySet()); }
Cancellable function(GetRollupCapsRequest request, RequestOptions options, ActionListener<GetRollupCapsResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(request, RollupRequestConverters::getRollupCaps, options, GetRollupCapsResponse::fromXContent, listener, Collections.emptySet()); }
/** * Asynchronously Get the Rollup Capabilities of a target (non-rollup) index or pattern * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-put-job.html"> * the docs</a> for more. * @param request the request * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener the listener to be notified upon request completion * @return cancellable that may be used to cancel the request */
Asynchronously Get the Rollup Capabilities of a target (non-rollup) index or pattern See the docs for more
getRollupCapabilitiesAsync
{ "repo_name": "ern/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/RollupClient.java", "license": "apache-2.0", "size": 16558 }
[ "java.util.Collections", "org.elasticsearch.action.ActionListener", "org.elasticsearch.client.rollup.GetRollupCapsRequest", "org.elasticsearch.client.rollup.GetRollupCapsResponse" ]
import java.util.Collections; import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.rollup.GetRollupCapsRequest; import org.elasticsearch.client.rollup.GetRollupCapsResponse;
import java.util.*; import org.elasticsearch.action.*; import org.elasticsearch.client.rollup.*;
[ "java.util", "org.elasticsearch.action", "org.elasticsearch.client" ]
java.util; org.elasticsearch.action; org.elasticsearch.client;
1,147,381
@Override public Schema outputSchema(Schema input){ try { Schema.FieldSchema inputFieldSchema = input.getField(0); if (inputFieldSchema.type != DataType.BAG){ throw new RuntimeException("Expected a BAG as input"); } Schema inputBagSchema = inputFieldSchema.schema; if (inputBagSchema.getField(0).type != DataType.TUPLE){ throw new RuntimeException(String.format("Expected input bag to contain a TUPLE, but instead found %s", DataType.findTypeName(inputBagSchema.getField(0).type))); } Schema inputTupleSchema = inputBagSchema.getField(0).schema; if (inputTupleSchema.getField(0).type != DataType.DOUBLE){ throw new RuntimeException(String.format("Expected first element of tuple to be a CHARARRAY, but instead found %s", DataType.findTypeName(inputTupleSchema.getField(0).type))); } if (inputTupleSchema.getField(1).type != DataType.CHARARRAY){ throw new RuntimeException(String.format("Expected first element of tuple to be a CHARARRAY, but instead found %s", DataType.findTypeName(inputTupleSchema.getField(0).type))); } if (inputTupleSchema.getField(2).type != DataType.CHARARRAY){ throw new RuntimeException(String.format("Expected first element of tuple to be a CHARARRAY, but instead found %s", DataType.findTypeName(inputTupleSchema.getField(0).type))); } Schema outputTupleSchema = new Schema(); outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); // activity ID outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); // label outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); // size, for debugging outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); // url, for debugging outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); // url, for debugging return new Schema(new Schema.FieldSchema(null,outputTupleSchema,DataType.BAG)); }catch (FrontendException e) { throw new RuntimeException(e); } }
Schema function(Schema input){ try { Schema.FieldSchema inputFieldSchema = input.getField(0); if (inputFieldSchema.type != DataType.BAG){ throw new RuntimeException(STR); } Schema inputBagSchema = inputFieldSchema.schema; if (inputBagSchema.getField(0).type != DataType.TUPLE){ throw new RuntimeException(String.format(STR, DataType.findTypeName(inputBagSchema.getField(0).type))); } Schema inputTupleSchema = inputBagSchema.getField(0).schema; if (inputTupleSchema.getField(0).type != DataType.DOUBLE){ throw new RuntimeException(String.format(STR, DataType.findTypeName(inputTupleSchema.getField(0).type))); } if (inputTupleSchema.getField(1).type != DataType.CHARARRAY){ throw new RuntimeException(String.format(STR, DataType.findTypeName(inputTupleSchema.getField(0).type))); } if (inputTupleSchema.getField(2).type != DataType.CHARARRAY){ throw new RuntimeException(String.format(STR, DataType.findTypeName(inputTupleSchema.getField(0).type))); } Schema outputTupleSchema = new Schema(); outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); outputTupleSchema.add(new Schema.FieldSchema(null, DataType.CHARARRAY)); return new Schema(new Schema.FieldSchema(null,outputTupleSchema,DataType.BAG)); }catch (FrontendException e) { throw new RuntimeException(e); } }
/** * The output schema of AEM UDF. * Bag in bag out. But the output bag elements are appended by an activityID. */
The output schema of AEM UDF. Bag in bag out. But the output bag elements are appended by an activityID
outputSchema
{ "repo_name": "caesar0301/piggybox", "path": "src/main/java/com/piggybox/omnilab/aem/LabelActivity.java", "license": "gpl-2.0", "size": 5251 }
[ "org.apache.pig.data.DataType", "org.apache.pig.impl.logicalLayer.FrontendException", "org.apache.pig.impl.logicalLayer.schema.Schema" ]
import org.apache.pig.data.DataType; import org.apache.pig.impl.logicalLayer.FrontendException; import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.data.*; import org.apache.pig.impl.*;
[ "org.apache.pig" ]
org.apache.pig;
1,991,987
public static Map<BlockStoreLocation, List<Long>> generateBlockIdOnTiers( Map<TierAlias, List<Integer>> tiersConfig) { Map<BlockStoreLocation, List<Long>> blockMap = new HashMap<>(); long blockIdStart = Long.MAX_VALUE; for (Map.Entry<TierAlias, List<Integer>> tierConfig : tiersConfig.entrySet()) { List<Integer> dirConfigs = tierConfig.getValue(); for (int i = 0; i < dirConfigs.size(); i++) { int dirNumBlocks = dirConfigs.get(i); LOG.info("Found dir on tier {} with {} blocks", tierConfig.getKey(), dirNumBlocks); BlockStoreLocation loc = new BlockStoreLocation(tierConfig.getKey().toString(), i); List<Long> blockIds = generateDecreasingNumbers(blockIdStart, dirNumBlocks); blockMap.put(loc, blockIds); blockIdStart -= dirNumBlocks; } } return blockMap; }
static Map<BlockStoreLocation, List<Long>> function( Map<TierAlias, List<Integer>> tiersConfig) { Map<BlockStoreLocation, List<Long>> blockMap = new HashMap<>(); long blockIdStart = Long.MAX_VALUE; for (Map.Entry<TierAlias, List<Integer>> tierConfig : tiersConfig.entrySet()) { List<Integer> dirConfigs = tierConfig.getValue(); for (int i = 0; i < dirConfigs.size(); i++) { int dirNumBlocks = dirConfigs.get(i); LOG.info(STR, tierConfig.getKey(), dirNumBlocks); BlockStoreLocation loc = new BlockStoreLocation(tierConfig.getKey().toString(), i); List<Long> blockIds = generateDecreasingNumbers(blockIdStart, dirNumBlocks); blockMap.put(loc, blockIds); blockIdStart -= dirNumBlocks; } } return blockMap; }
/** * Generates block IDs according to the storage tier/dir setup. * In order to avoid block ID colliding with existing blocks, this will generate IDs * decreasingly from the {@link Long#MAX_VALUE}. * * @param tiersConfig the tier/dir block counts * @return a map of location to generated block lists */
Generates block IDs according to the storage tier/dir setup. In order to avoid block ID colliding with existing blocks, this will generate IDs decreasingly from the <code>Long#MAX_VALUE</code>
generateBlockIdOnTiers
{ "repo_name": "wwjiang007/alluxio", "path": "stress/shell/src/main/java/alluxio/stress/cli/RpcBenchPreparationUtils.java", "license": "apache-2.0", "size": 8068 }
[ "java.util.HashMap", "java.util.List", "java.util.Map" ]
import java.util.HashMap; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
6,949
public static List<Object> extractRawValues(String path, Map<String, Object> map) { List<Object> values = new ArrayList<>(); String[] pathElements = path.split("\\."); if (pathElements.length == 0) { return values; } extractRawValues(values, map, pathElements, 0); return values; }
static List<Object> function(String path, Map<String, Object> map) { List<Object> values = new ArrayList<>(); String[] pathElements = path.split("\\."); if (pathElements.length == 0) { return values; } extractRawValues(values, map, pathElements, 0); return values; }
/** * Extracts raw values (string, int, and so on) based on the path provided returning all of them * as a single list. */
Extracts raw values (string, int, and so on) based on the path provided returning all of them as a single list
extractRawValues
{ "repo_name": "gingerwizard/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java", "license": "apache-2.0", "size": 19870 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map" ]
import java.util.ArrayList; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
611,837
private void ensureContent() { if (mContentContainer != null && mProgressContainer != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException("Content view not yet created"); } mProgressContainer = root.findViewById(R.id.progress_container); if (mProgressContainer == null) { throw new RuntimeException("Your content must have a ViewGroup whose id attribute is 'R.id.progress_container'"); } mContentContainer = root.findViewById(R.id.content_container); if (mContentContainer == null) { throw new RuntimeException("Your content must have a ViewGroup whose id attribute is 'R.id.content_container'"); } mEmptyView = root.findViewById(android.R.id.empty); if (mEmptyView != null) { mEmptyView.setVisibility(View.GONE); } mContentShown = true; // We are starting without a content, so assume we won't // have our data right away and start with the progress indicator. if (mContentView == null) { setContentShown(false, false); } }
void function() { if (mContentContainer != null && mProgressContainer != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException(STR); } mProgressContainer = root.findViewById(R.id.progress_container); if (mProgressContainer == null) { throw new RuntimeException(STR); } mContentContainer = root.findViewById(R.id.content_container); if (mContentContainer == null) { throw new RuntimeException(STR); } mEmptyView = root.findViewById(android.R.id.empty); if (mEmptyView != null) { mEmptyView.setVisibility(View.GONE); } mContentShown = true; if (mContentView == null) { setContentShown(false, false); } }
/** * Initialization views. */
Initialization views
ensureContent
{ "repo_name": "mthli/Geeky", "path": "src/Geeky/src/com/devspark/progressfragment/ProgressFragment.java", "license": "apache-2.0", "size": 11367 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,591,286
public void purgeChannel(Integer channelId) throws SQLException { synchronized (this) { if (channelIds.contains(channelId)) { psDeleteMessagesByChannelId.setInt(1, channelId); psDeleteMessagesByChannelId.execute(); psDeleteChannel.setInt(1, channelId); psDeleteChannel.execute(); channelIds.remove(channelId); } } }
void function(Integer channelId) throws SQLException { synchronized (this) { if (channelIds.contains(channelId)) { psDeleteMessagesByChannelId.setInt(1, channelId); psDeleteMessagesByChannelId.execute(); psDeleteChannel.setInt(1, channelId); psDeleteChannel.execute(); channelIds.remove(channelId); } } }
/** * Deletes all entries from given channelId from database. * * @param channelId * @throws SQLException */
Deletes all entries from given channelId from database
purgeChannel
{ "repo_name": "ccgreen13/zap-extensions", "path": "src/org/zaproxy/zap/extension/websocket/db/TableWebSocket.java", "license": "apache-2.0", "size": 24833 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,125,513
protected final void reportUnclosedStringLiteral() { final ISourceLocation location = getCurrentSourceLocation(0); final ICompilerProblem problem = new StringLiteralNotClosedProblem(location); getProblems().add(problem); }
final void function() { final ISourceLocation location = getCurrentSourceLocation(0); final ICompilerProblem problem = new StringLiteralNotClosedProblem(location); getProblems().add(problem); }
/** * Report syntax error: input ended before reaching the closing quotation * mark for a string literal. */
Report syntax error: input ended before reaching the closing quotation mark for a string literal
reportUnclosedStringLiteral
{ "repo_name": "adufilie/flex-falcon", "path": "compiler/src/org/apache/flex/compiler/internal/parsing/as/BaseRawASTokenizer.java", "license": "apache-2.0", "size": 10908 }
[ "org.apache.flex.compiler.common.ISourceLocation", "org.apache.flex.compiler.problems.ICompilerProblem", "org.apache.flex.compiler.problems.StringLiteralNotClosedProblem" ]
import org.apache.flex.compiler.common.ISourceLocation; import org.apache.flex.compiler.problems.ICompilerProblem; import org.apache.flex.compiler.problems.StringLiteralNotClosedProblem;
import org.apache.flex.compiler.common.*; import org.apache.flex.compiler.problems.*;
[ "org.apache.flex" ]
org.apache.flex;
45,323
public BlobContainerInner withMetadata(Map<String, String> metadata) { this.metadata = metadata; return this; }
BlobContainerInner function(Map<String, String> metadata) { this.metadata = metadata; return this; }
/** * Set a name-value pair to associate with the container as metadata. * * @param metadata the metadata value to set * @return the BlobContainerInner object itself. */
Set a name-value pair to associate with the container as metadata
withMetadata
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/BlobContainerInner.java", "license": "mit", "size": 7633 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,602,107
public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); }
void function(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); }
/** * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This implements <code>org.eclipse.jface.action.IMenuListener</code> to help fill the context menus with contributions from the Edit menu.
menuAboutToShow
{ "repo_name": "darvasd/gsoaarchitect", "path": "hu.bme.mit.inf.gs.dsl.editor/src/soamodel/presentation/SoamodelEditor.java", "license": "mit", "size": 54519 }
[ "org.eclipse.jface.action.IMenuListener", "org.eclipse.jface.action.IMenuManager" ]
import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
1,570,966
public static int insertProviderAt(Provider provider, int position) { int size = providers.size(); if ((position < 1) || (position > size)) { position = size + 1; } providers.add(position - 1, provider); providersNames.put(provider.getName(), provider); setNeedRefresh(); return position; }
static int function(Provider provider, int position) { int size = providers.size(); if ((position < 1) (position > size)) { position = size + 1; } providers.add(position - 1, provider); providersNames.put(provider.getName(), provider); setNeedRefresh(); return position; }
/** * Inserts a provider at a specified position * * @param provider * @param position * @return */
Inserts a provider at a specified position
insertProviderAt
{ "repo_name": "xdajog/samsung_sources_i927", "path": "libcore/luni/src/main/java/org/apache/harmony/security/fortress/Services.java", "license": "gpl-2.0", "size": 6748 }
[ "java.security.Provider" ]
import java.security.Provider;
import java.security.*;
[ "java.security" ]
java.security;
821,317
public static String[] getDemographicCountAllEvents(UserInfoCerealWrapper sessionInfo) { Long maleCount = 0L; Long femaleCount = 0L; Long unidentified = 0L; Long under18 = 0L; Long age18to20 = 0L; Long age21to24 = 0L; Long age25to29 = 0L; Long age30to39 = 0L; Long age40to49 = 0L; Long age50to59 = 0L; Long over60 = 0L; try { // Set up the call to the analytics api servlet Map<String, String> params = new HashMap<String, String>(); params.put(UniversalConstants.PARAM_VENDOR_ID, URLEncoder.encode(String.valueOf(sessionInfo.getVendorID()), "UTF-8")); params.put(UniversalConstants.ANALYTICS_TYPE, UniversalConstants.OVERALL_EVENT_DEMOGRAPHICS); params = createFilterParams(params); URL url = ModuleUtils.getZeppaModuleUrl("zeppa-api", "/endpoint/analytics-servlet/", params); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(false); connection.setRequestMethod("GET"); // Read the response from the call to the api servlet BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { // Read from the buffer line by line and write to the response string String responseGender = ""; while ((line = reader.readLine()) != null) { responseGender += line; } JSONParser parser = new JSONParser(); // Parse the JSON in the response, get the count of each gender JSONArray demoInfo = (JSONArray) parser.parse(responseGender); if(demoInfo.size() == 2) { // Get all of the demographic info from the json response JSONObject genderInfo = (JSONObject) demoInfo.get(0); maleCount = (Long) genderInfo.get("maleCount"); femaleCount = (Long) genderInfo.get("femaleCount"); unidentified = (Long) genderInfo.get("unidentified"); JSONObject ageInfo = (JSONObject) demoInfo.get(1); under18 = (Long) ageInfo.get("under18"); age18to20 = (Long) ageInfo.get("18to20"); age21to24 = (Long) ageInfo.get("21to24"); age25to29 = (Long) ageInfo.get("25to29"); age30to39 = (Long) ageInfo.get("30to39"); age40to49 = (Long) ageInfo.get("40to49"); age50to59 = (Long) ageInfo.get("50to59"); over60 = (Long) ageInfo.get("over60"); } } } catch (Exception e) { e.printStackTrace(); return new String[] {"", ""}; } // Create the string for chart.js for the gender pie chart String genderData = "\"none\""; if(maleCount > 0 || femaleCount > 0 || unidentified > 0) { genderData = "[" + "{" + " value: " + String.valueOf(maleCount) + "," + " color:\"#F7464A\"," + " highlight: \"#FF5A5E\"," + " label: \"Male\"" + "}," + "{" + " value: " + String.valueOf(femaleCount) + "," + " color: \"#46BFBD\"," + " highlight: \"#5AD3D1\"," + " label: \"Female\"" + "}," + "{" + " value: " + String.valueOf(unidentified) + "," + " color: \"#FDB45C\"," + " highlight: \"#FFC870\"," + " label: \"Unidentified\"" + "}" + "]"; } String ageData = "{labels: [\"under18\", \"18to20\", \"21to24\", \"25to29\", \"30to39\", \"40to49\", \"50to59\", \"over60\"]," + " datasets: [ {" + "label: \"Age dataset\"," + "fillColor: \"rgba(220,220,220,0.5)\"," + "strokeColor: \"rgba(220,220,220,0.8)\"," + "highlightFill: \"rgba(220,220,220,0.75)\"," + "highlightStroke: \"rgba(220,220,220,1)\"," + "data: ["+under18+", "+age18to20+", "+age21to24+", "+age25to29+", "+age30to39+", "+age40to49+", "+age50to59+", "+over60+"]}]}"; return new String[] {genderData, ageData}; }
static String[] function(UserInfoCerealWrapper sessionInfo) { Long maleCount = 0L; Long femaleCount = 0L; Long unidentified = 0L; Long under18 = 0L; Long age18to20 = 0L; Long age21to24 = 0L; Long age25to29 = 0L; Long age30to39 = 0L; Long age40to49 = 0L; Long age50to59 = 0L; Long over60 = 0L; try { Map<String, String> params = new HashMap<String, String>(); params.put(UniversalConstants.PARAM_VENDOR_ID, URLEncoder.encode(String.valueOf(sessionInfo.getVendorID()), "UTF-8")); params.put(UniversalConstants.ANALYTICS_TYPE, UniversalConstants.OVERALL_EVENT_DEMOGRAPHICS); params = createFilterParams(params); URL url = ModuleUtils.getZeppaModuleUrl(STR, STR, params); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(false); connection.setRequestMethod("GET"); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { String responseGender = STRmaleCountSTRfemaleCountSTRunidentifiedSTRunder18STR18to20STR21to24STR25to29STR30to39STR40to49STR50to59STRover60STRSTRSTR\"none\"STR[STR{STR value: STR,STR color:\STR,STR highlight: \STR,STR label: \"Male\"STR},STR{STR value: STR,STR color: \STR,STR highlight: \STR,STR label: \STRSTR},STR{STR value: STR,STR color: \STR,STR highlight: \STR,STR label: \STRSTR}STR]STR{labels: [\STR, \STR, \STR, \STR, \STR, \STR, \STR, \STR],STR datasets: [ {STRlabel: \STR,STRfillColor: \STR,STRstrokeColor: \STR,STRhighlightFill: \STR,STRhighlightStroke: \STR,STRdata: ["+under18+STR+age18to20+STR+age21to24+STR+age25to29+STR+age30to39+STR+age40to49+STR+age50to59+STR+over60+"]}]}"; return new String[] {genderData, ageData}; }
/** * Call the api analytics servlet to get all * gender information for the current vendor's * events * @param resultsArray * @return */
Call the api analytics servlet to get all gender information for the current vendor's events
getDemographicCountAllEvents
{ "repo_name": "pschuette22/Zeppa-AppEngine", "path": "zeppa-frontend/src/main/java/com/zeppamobile/frontend/webpages/AnalyticsServlet.java", "license": "apache-2.0", "size": 16180 }
[ "com.zeppamobile.common.UniversalConstants", "com.zeppamobile.common.cerealwrapper.UserInfoCerealWrapper", "com.zeppamobile.common.utils.ModuleUtils", "java.io.BufferedReader", "java.io.InputStreamReader", "java.net.HttpURLConnection", "java.net.URLEncoder", "java.util.HashMap", "java.util.Map" ]
import com.zeppamobile.common.UniversalConstants; import com.zeppamobile.common.cerealwrapper.UserInfoCerealWrapper; import com.zeppamobile.common.utils.ModuleUtils; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URLEncoder; import java.util.HashMap; import java.util.Map;
import com.zeppamobile.common.*; import com.zeppamobile.common.cerealwrapper.*; import com.zeppamobile.common.utils.*; import java.io.*; import java.net.*; import java.util.*;
[ "com.zeppamobile.common", "java.io", "java.net", "java.util" ]
com.zeppamobile.common; java.io; java.net; java.util;
1,137,224
private void removeDuplicateImages(Feed feed) { for (int x = 0; x < feed.getItems().size(); x++) { for (int y = x + 1; y < feed.getItems().size(); y++) { FeedItem item1 = feed.getItems().get(x); FeedItem item2 = feed.getItems().get(y); if (item1.hasItemImage() && item2.hasItemImage()) { if (TextUtils.equals(item1.getImage().getDownload_url(), item2.getImage().getDownload_url())) { item2.setImage(null); } } } } }
void function(Feed feed) { for (int x = 0; x < feed.getItems().size(); x++) { for (int y = x + 1; y < feed.getItems().size(); y++) { FeedItem item1 = feed.getItems().get(x); FeedItem item2 = feed.getItems().get(y); if (item1.hasItemImage() && item2.hasItemImage()) { if (TextUtils.equals(item1.getImage().getDownload_url(), item2.getImage().getDownload_url())) { item2.setImage(null); } } } } }
/** * Checks if the FeedItems of this feed have images that point * to the same URL. If two FeedItems have an image that points to * the same URL, the reference of the second item is removed, so that every image * reference is unique. */
Checks if the FeedItems of this feed have images that point to the same URL. If two FeedItems have an image that points to the same URL, the reference of the second item is removed, so that every image reference is unique
removeDuplicateImages
{ "repo_name": "Woogis/SisatongPodcast", "path": "core/src/main/java/net/sisatong/podcast/core/service/download/DownloadService.java", "license": "mit", "size": 46496 }
[ "android.text.TextUtils", "net.sisatong.podcast.core.feed.Feed", "net.sisatong.podcast.core.feed.FeedItem" ]
import android.text.TextUtils; import net.sisatong.podcast.core.feed.Feed; import net.sisatong.podcast.core.feed.FeedItem;
import android.text.*; import net.sisatong.podcast.core.feed.*;
[ "android.text", "net.sisatong.podcast" ]
android.text; net.sisatong.podcast;
1,132,283
public String getMessage() { return ThrowableMessageFormatter.getMessage(this); } //--------------------------------------------------------------------------- // members // protected Object[] _args = null; protected Throwable _next = null; protected boolean _isWrapper = false;
String function() { return ThrowableMessageFormatter.getMessage(this); } protected Object[] _args = null; protected Throwable _next = null; protected boolean _isWrapper = false;
/** * Implementation of the standard {@link java.lang.Throwable#getMessage} method. It * delegates the call to the central * {@link de.susebox.java.lang.ThrowableMessageFormatter#getMessage} method. * * @return the formatted throwable message * @see de.susebox.java.lang.ThrowableMessageFormatter */
Implementation of the standard <code>java.lang.Throwable#getMessage</code> method. It delegates the call to the central <code>de.susebox.java.lang.ThrowableMessageFormatter#getMessage</code> method
getMessage
{ "repo_name": "dohkoos/todolet", "path": "src/de/susebox/jtopas/TokenizerException.java", "license": "mit", "size": 7463 }
[ "de.susebox.java.lang.ThrowableMessageFormatter" ]
import de.susebox.java.lang.ThrowableMessageFormatter;
import de.susebox.java.lang.*;
[ "de.susebox.java" ]
de.susebox.java;
1,460,013
public Kuzzle unsetJwtToken() { this.jwtToken = null; for (Map<String, Room> roomSubscriptions : subscriptions.values()) { for (Room room : roomSubscriptions.values()) { room.unsubscribe(); } } return this; }
Kuzzle function() { this.jwtToken = null; for (Map<String, Room> roomSubscriptions : subscriptions.values()) { for (Room room : roomSubscriptions.values()) { room.unsubscribe(); } } return this; }
/** * Unset the authentication token and cancel all subscriptions * * @return this */
Unset the authentication token and cancel all subscriptions
unsetJwtToken
{ "repo_name": "kuzzleio/sdk-android", "path": "src/main/java/io/kuzzle/sdk/core/Kuzzle.java", "license": "apache-2.0", "size": 81564 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,498,194
public ApplicationService getApplicationService() { return applicationService; }
ApplicationService function() { return applicationService; }
/** * Returns the application remote service. * * @return the application remote service */
Returns the application remote service
getApplicationService
{ "repo_name": "fraunhoferfokus/govapps", "path": "data-portlet/src/main/java/de/fraunhofer/fokus/movepla/service/base/MultiMediaServiceBaseImpl.java", "license": "bsd-3-clause", "size": 32769 }
[ "de.fraunhofer.fokus.movepla.service.ApplicationService" ]
import de.fraunhofer.fokus.movepla.service.ApplicationService;
import de.fraunhofer.fokus.movepla.service.*;
[ "de.fraunhofer.fokus" ]
de.fraunhofer.fokus;
119,596
@Test public void testGetFilterMapping() { String newItem = "aFilter"; FilterMapping item = cut.getFilterMapping(newItem); assertNotNull(item); assertEquals(1, item.getPortletNames().size()); assertEquals("portlet362", item.getPortletNames().get(0)); }
void function() { String newItem = STR; FilterMapping item = cut.getFilterMapping(newItem); assertNotNull(item); assertEquals(1, item.getPortletNames().size()); assertEquals(STR, item.getPortletNames().get(0)); }
/** * Test method for {@link org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl#getFilterMapping(java.lang.String)}. */
Test method for <code>org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl#getFilterMapping(java.lang.String)</code>
testGetFilterMapping
{ "repo_name": "apache/portals-pluto", "path": "pluto-container/src/test/java/org/apache/pluto/container/om/portlet/impl/jsr362/JSR362PortletFilterAnnotationTest.java", "license": "apache-2.0", "size": 10503 }
[ "org.apache.pluto.container.om.portlet.FilterMapping", "org.junit.Assert" ]
import org.apache.pluto.container.om.portlet.FilterMapping; import org.junit.Assert;
import org.apache.pluto.container.om.portlet.*; import org.junit.*;
[ "org.apache.pluto", "org.junit" ]
org.apache.pluto; org.junit;
989,357
public IEdge getEdge(final INode source, final INode target, final Vector shift) { for (Iterator edges = directedEdges(source, target); edges.hasNext();) { final IEdge e = (IEdge) edges.next(); if (getShift(e).equals(shift)) { return e; } else if (source.equals(target) && getShift(e).equals(shift.negative())) { return e.reverse(); } } return null; }
IEdge function(final INode source, final INode target, final Vector shift) { for (Iterator edges = directedEdges(source, target); edges.hasNext();) { final IEdge e = (IEdge) edges.next(); if (getShift(e).equals(shift)) { return e; } else if (source.equals(target) && getShift(e).equals(shift.negative())) { return e.reverse(); } } return null; }
/** * Retrieve an edge with a given source, target and shift. * @param source the source node. * @param target the target node. * @param shift the shift vector. * @return the unique edge with this data, or null, if none exists. */
Retrieve an edge with a given source, target and shift
getEdge
{ "repo_name": "BackupTheBerlios/gavrog", "path": "src/org/gavrog/joss/pgraphs/basic/PeriodicGraph.java", "license": "apache-2.0", "size": 79927 }
[ "java.util.Iterator", "org.gavrog.joss.geometry.Vector" ]
import java.util.Iterator; import org.gavrog.joss.geometry.Vector;
import java.util.*; import org.gavrog.joss.geometry.*;
[ "java.util", "org.gavrog.joss" ]
java.util; org.gavrog.joss;
334,597
protected Item getNextItem(Item item, boolean includeChildren) { if (item == null) { return null; } if (includeChildren && getExpanded(item)) { Item[] children = getItems(item); if (children != null && children.length > 0) { return children[0]; } } // next item is either next sibling or next sibling of first // parent that has a next sibling. Item parent = getParentItem(item); if (parent == null) { return null; } Item[] siblings = getItems(parent); if (siblings != null) { if (siblings.length <= 1) { return getNextItem(parent, false); } for (int i = 0; i < siblings.length; i++) { if (siblings[i] == item && i < (siblings.length - 1)) { return siblings[i + 1]; } } } return getNextItem(parent, false); }
Item function(Item item, boolean includeChildren) { if (item == null) { return null; } if (includeChildren && getExpanded(item)) { Item[] children = getItems(item); if (children != null && children.length > 0) { return children[0]; } } Item parent = getParentItem(item); if (parent == null) { return null; } Item[] siblings = getItems(parent); if (siblings != null) { if (siblings.length <= 1) { return getNextItem(parent, false); } for (int i = 0; i < siblings.length; i++) { if (siblings[i] == item && i < (siblings.length - 1)) { return siblings[i + 1]; } } } return getNextItem(parent, false); }
/** * Returns the item after the given item in the tree, or <code>null</code> * if there is no next item. * * @param item * the item * @param includeChildren * <code>true</code> if the children are considered in * determining which item is next, and <code>false</code> if * subtrees are ignored * @return the next item, or <code>null</code> if none */
Returns the item after the given item in the tree, or <code>null</code> if there is no next item
getNextItem
{ "repo_name": "ghillairet/gef-gwt", "path": "src/main/java/org/eclipse/jface/viewers/AbstractTreeViewer.java", "license": "epl-1.0", "size": 92728 }
[ "org.eclipse.swt.widgets.Item" ]
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
436,854
ImmutableList<SchemaOrgType> getIncentivesList();
ImmutableList<SchemaOrgType> getIncentivesList();
/** * Returns the value list of property incentives. Empty list is returned if the property not set * in current object. */
Returns the value list of property incentives. Empty list is returned if the property not set in current object
getIncentivesList
{ "repo_name": "google/schemaorg-java", "path": "src/main/java/com/google/schemaorg/core/JobPosting.java", "license": "apache-2.0", "size": 13350 }
[ "com.google.common.collect.ImmutableList", "com.google.schemaorg.SchemaOrgType" ]
import com.google.common.collect.ImmutableList; import com.google.schemaorg.SchemaOrgType;
import com.google.common.collect.*; import com.google.schemaorg.*;
[ "com.google.common", "com.google.schemaorg" ]
com.google.common; com.google.schemaorg;
970,262
public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() { return new LinkedList<MemoryManagerMXBean>(getMemoryBean() .getMemoryManagerMXBeans()); }
static List<MemoryManagerMXBean> function() { return new LinkedList<MemoryManagerMXBean>(getMemoryBean() .getMemoryManagerMXBeans()); }
/** * Returns a list of all of the instances of {@link MemoryManagerMXBean}in * this virtual machine. Owing to the dynamic nature of this kind of * <code>MXBean</code>, it is possible that instances may be created or * destroyed between the invocation and return of this method. * * @return a list of all known <code>MemoryManagerMXBean</code> s in this * virtual machine. */
Returns a list of all of the instances of <code>MemoryManagerMXBean</code>in this virtual machine. Owing to the dynamic nature of this kind of <code>MXBean</code>, it is possible that instances may be created or destroyed between the invocation and return of this method
getMemoryManagerMXBeans
{ "repo_name": "freeVM/freeVM", "path": "enhanced/java/classlib/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java", "license": "apache-2.0", "size": 64134 }
[ "java.lang.management.MemoryManagerMXBean", "java.util.LinkedList", "java.util.List" ]
import java.lang.management.MemoryManagerMXBean; import java.util.LinkedList; import java.util.List;
import java.lang.management.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
659,993
BotInner innerModel(); interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } interface DefinitionStages { interface Blank extends WithLocation { }
BotInner innerModel(); interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } interface DefinitionStages { interface Blank extends WithLocation { }
/** * Gets the inner com.azure.resourcemanager.botservice.fluent.models.BotInner object. * * @return the inner object. */
Gets the inner com.azure.resourcemanager.botservice.fluent.models.BotInner object
innerModel
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/botservice/azure-resourcemanager-botservice/src/main/java/com/azure/resourcemanager/botservice/models/Bot.java", "license": "mit", "size": 9954 }
[ "com.azure.resourcemanager.botservice.fluent.models.BotInner" ]
import com.azure.resourcemanager.botservice.fluent.models.BotInner;
import com.azure.resourcemanager.botservice.fluent.models.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
1,117,196
public boolean init() { try { checkAndCreateSchema(); checkAndCreateTables(); return true; }catch(Exception ex) { logger.log(Level.SEVERE,"Exception", ex); return false; } }
boolean function() { try { checkAndCreateSchema(); checkAndCreateTables(); return true; }catch(Exception ex) { logger.log(Level.SEVERE,STR, ex); return false; } }
/** * Check required schema and tables * @return */
Check required schema and tables
init
{ "repo_name": "wgpshashank/mysql_perf_analyzer", "path": "myperf/src/main/java/com/yahoo/dba/perf/myperf/meta/MetaDB.java", "license": "apache-2.0", "size": 34052 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
506,034
public void extractHTML(String htmlText) { // System.out.println(htmlText); extractTitle(htmlText); htmlText = preProcess(htmlText); if( !isContentPage(htmlText) ) { _text = "*推测您提供的网页为非主题型网页,目前暂不处理!:-)"; return ; } //System.out.println(htmlText); List<String> lines = Arrays.asList(htmlText.split("\n")); List<Integer> indexDistribution = lineBlockDistribute(lines); List<String> textList = new ArrayList<String>(); List<Integer> textBeginList = new ArrayList<Integer>(); List<Integer> textEndList = new ArrayList<Integer>(); for (int i = 0; i < indexDistribution.size(); i++) { if (indexDistribution.get(i) > 0 ) { StringBuilder tmp = new StringBuilder(); textBeginList.add(i); while (i < indexDistribution.size() && indexDistribution.get(i) > 0) { tmp.append(lines.get(i)).append("\n"); i++; } textEndList.add(i); textList.add(tmp.toString()); } } // 如果两块只差两个空行,并且两块包含文字均较多,则进行块合并,以弥补单纯抽取最大块的缺点 for (int i=1; i < textList.size(); i++ ) { if( textBeginList.get(i) == textEndList.get(i-1)+1 && textEndList.get(i) > textBeginList.get(i)+_block && textList.get(i).replaceAll("\\s+", "").length() > 40 ) { if( textEndList.get(i-1) == textBeginList.get(i-1)+_block && textList.get(i-1).replaceAll("\\s+", "").length() < 40 ) { continue; } textList.set(i-1, textList.get(i-1) + textList.get(i)); textEndList.set(i-1, textEndList.get(i)); textList.remove(i); textBeginList.remove(i); textEndList.remove(i); --i; } } String result = ""; for (String text : textList) { //System.out.println("text:" + text + "\n" + text.replaceAll("\\s+", "").length()); if (text.replaceAll("\\s+", "").length() > result.replaceAll("\\s+", "") .length()) result = text; } // 最长块长度小于100,归为非主题型网页 if( result.replaceAll("\\s+", "").length() < 100 ) _text = "*推测您提供的网页为非主题型网页,目前暂不处理!:-)"; else _text = result; }
void function(String htmlText) { extractTitle(htmlText); htmlText = preProcess(htmlText); if( !isContentPage(htmlText) ) { _text = STR; return ; } List<String> lines = Arrays.asList(htmlText.split("\n")); List<Integer> indexDistribution = lineBlockDistribute(lines); List<String> textList = new ArrayList<String>(); List<Integer> textBeginList = new ArrayList<Integer>(); List<Integer> textEndList = new ArrayList<Integer>(); for (int i = 0; i < indexDistribution.size(); i++) { if (indexDistribution.get(i) > 0 ) { StringBuilder tmp = new StringBuilder(); textBeginList.add(i); while (i < indexDistribution.size() && indexDistribution.get(i) > 0) { tmp.append(lines.get(i)).append("\n"); i++; } textEndList.add(i); textList.add(tmp.toString()); } } for (int i=1; i < textList.size(); i++ ) { if( textBeginList.get(i) == textEndList.get(i-1)+1 && textEndList.get(i) > textBeginList.get(i)+_block && textList.get(i).replaceAll("\\s+", STR\\s+STRSTRSTR\\s+STRSTR\\s+STRSTR\\s+STR").length() < 100 ) _text = STR; else _text = result; }
/** * Extract html. * * @param htmlText the html text */
Extract html
extractHTML
{ "repo_name": "zmdevelop/spider", "path": "src/main/java/net/kernal/spiderman/worker/extract/extractor/impl/TextExtractor.java", "license": "apache-2.0", "size": 9494 }
[ "java.util.ArrayList", "java.util.Arrays", "java.util.List" ]
import java.util.ArrayList; import java.util.Arrays; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,066,931
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLine") public ModelAndView addLine(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result, HttpServletRequest request, HttpServletResponse response) { String selectedCollectionPath = uifForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH); if (StringUtils.isBlank(selectedCollectionPath)) { throw new RuntimeException("Selected collection was not set for add line action, cannot add new line"); } View view = uifForm.getPreviousView(); view.getViewHelperService().processCollectionAddLine(view, uifForm, selectedCollectionPath); return updateComponent(uifForm, result, request, response); }
@RequestMapping(method = RequestMethod.POST, params = STR) ModelAndView function(@ModelAttribute(STR) UifFormBase uifForm, BindingResult result, HttpServletRequest request, HttpServletResponse response) { String selectedCollectionPath = uifForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH); if (StringUtils.isBlank(selectedCollectionPath)) { throw new RuntimeException(STR); } View view = uifForm.getPreviousView(); view.getViewHelperService().processCollectionAddLine(view, uifForm, selectedCollectionPath); return updateComponent(uifForm, result, request, response); }
/** * Called by the add line action for a new collection line. Method * determines which collection the add action was selected for and invokes * the view helper service to add the line */
Called by the add line action for a new collection line. Method determines which collection the add action was selected for and invokes the view helper service to add the line
addLine
{ "repo_name": "sbower/kuali-rice-1", "path": "krad/krad-web-framework/src/main/java/org/kuali/rice/krad/web/controller/UifControllerBase.java", "license": "apache-2.0", "size": 32434 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.commons.lang.StringUtils", "org.kuali.rice.krad.uif.UifParameters", "org.kuali.rice.krad.uif.view.View", "org.kuali.rice.krad.web.form.UifFormBase", "org.springframework.validation.BindingResult", "org.springframework.web.bind.annotation.ModelAttribute", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.servlet.ModelAndView" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.kuali.rice.krad.uif.UifParameters; import org.kuali.rice.krad.uif.view.View; import org.kuali.rice.krad.web.form.UifFormBase; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.*; import org.apache.commons.lang.*; import org.kuali.rice.krad.uif.*; import org.kuali.rice.krad.uif.view.*; import org.kuali.rice.krad.web.form.*; import org.springframework.validation.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*;
[ "javax.servlet", "org.apache.commons", "org.kuali.rice", "org.springframework.validation", "org.springframework.web" ]
javax.servlet; org.apache.commons; org.kuali.rice; org.springframework.validation; org.springframework.web;
2,111,329
@Override public BufferedReader getRemoteFile(String filename) { return null; }
BufferedReader function(String filename) { return null; }
/** * Returns a BufferedReader to the remote file. Null if it doesn't exist. * * @param filename Name of the file, without path */
Returns a BufferedReader to the remote file. Null if it doesn't exist
getRemoteFile
{ "repo_name": "taimur97/NotePad", "path": "app/src/free/java/com/nononsenseapps/notepad/sync/orgsync/DropboxSynchronizer.java", "license": "gpl-3.0", "size": 4109 }
[ "java.io.BufferedReader" ]
import java.io.BufferedReader;
import java.io.*;
[ "java.io" ]
java.io;
834,875
public void setInput( List<SubTotalInfo> rowSubList, List<GrandTotalInfo> rowGrandList, List<SubTotalInfo> colSubList, List<GrandTotalInfo> colGrandList ) { this.rowSubList.addAll( rowSubList ); this.rowGrandList.addAll( rowGrandList ); this.colSubList.addAll( colSubList ); this.colGrandList.addAll( colGrandList ); }
void function( List<SubTotalInfo> rowSubList, List<GrandTotalInfo> rowGrandList, List<SubTotalInfo> colSubList, List<GrandTotalInfo> colGrandList ) { this.rowSubList.addAll( rowSubList ); this.rowGrandList.addAll( rowGrandList ); this.colSubList.addAll( colSubList ); this.colGrandList.addAll( colGrandList ); }
/** * Set the input * * @param subList * subtotal info list * @param grandList * grand total list info */
Set the input
setInput
{ "repo_name": "Charling-Huang/birt", "path": "xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/internal/ui/dialogs/AggregationDialog.java", "license": "epl-1.0", "size": 19445 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
708,078
public static Date parseDate(final String date) { final int semicolonIndex = date.indexOf(';'); final String trimmedDate = semicolonIndex >= 0 ? date.substring(0, semicolonIndex) : date; ParsePosition pp = new ParsePosition(0); SimpleDateFormat dateFormat = RFC1123_PATTERN_FORMAT.get(); dateFormat.setTimeZone(GMT_ZONE); Date val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(RFC1036_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(ASCITIME_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } return null; }
static Date function(final String date) { final int semicolonIndex = date.indexOf(';'); final String trimmedDate = semicolonIndex >= 0 ? date.substring(0, semicolonIndex) : date; ParsePosition pp = new ParsePosition(0); SimpleDateFormat dateFormat = RFC1123_PATTERN_FORMAT.get(); dateFormat.setTimeZone(GMT_ZONE); Date val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(RFC1036_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(ASCITIME_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } return null; }
/** * Attempts to pass a HTTP date. * * @param date The date to parse * @return The parsed date, or null if parsing failed */
Attempts to pass a HTTP date
parseDate
{ "repo_name": "yonglehou/undertow", "path": "core/src/main/java/io/undertow/util/DateUtils.java", "license": "apache-2.0", "size": 9386 }
[ "java.text.ParsePosition", "java.text.SimpleDateFormat", "java.util.Date" ]
import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
897,125
public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image) { if (image == null) { throw new IllegalArgumentException("image == null!"); } if (image instanceof BufferedImage) { int bufferedImageType = ((BufferedImage)image).getType(); if (bufferedImageType != BufferedImage.TYPE_CUSTOM) { return getSpecifier(bufferedImageType); } } return new ImageTypeSpecifier(image); }
static ImageTypeSpecifier function(RenderedImage image) { if (image == null) { throw new IllegalArgumentException(STR); } if (image instanceof BufferedImage) { int bufferedImageType = ((BufferedImage)image).getType(); if (bufferedImageType != BufferedImage.TYPE_CUSTOM) { return getSpecifier(bufferedImageType); } } return new ImageTypeSpecifier(image); }
/** * Returns an <code>ImageTypeSpecifier</code> that encodes the * layout of a <code>RenderedImage</code> (which may be a * <code>BufferedImage</code>). * * @param image a <code>RenderedImage</code>. * * @return an <code>ImageTypeSpecifier</code> with the desired * characteristics. * * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. */
Returns an <code>ImageTypeSpecifier</code> that encodes the layout of a <code>RenderedImage</code> (which may be a <code>BufferedImage</code>)
createFromRenderedImage
{ "repo_name": "wangsongpeng/jdk-src", "path": "src/main/java/javax/imageio/ImageTypeSpecifier.java", "license": "apache-2.0", "size": 47775 }
[ "java.awt.image.BufferedImage", "java.awt.image.RenderedImage" ]
import java.awt.image.BufferedImage; import java.awt.image.RenderedImage;
import java.awt.image.*;
[ "java.awt" ]
java.awt;
167,288
@Override protected String doExecute() { String result; AbstractImageContainer cont; ImageSInt16 input; ConfigHoughPolar config; DetectLineHoughPolar detector; List<LineParametric2D_F32> found; SpreadSheet sheet; Row row; result = null; try { cont = (AbstractImageContainer) m_InputToken.getPayload(); input = (ImageSInt16) BoofCVHelper.toBoofCVImage(cont, BoofCVImageType.SIGNED_INT_16); config = new ConfigHoughPolar( m_LocalMaxRadius, m_MinCounts, m_ResolutionRange, m_ResolutionAngle, m_EdgeThreshold, m_MaxLines); detector = FactoryDetectLineAlgs.houghPolar( config, ImageSInt16.class, ImageSInt16.class); found = detector.detect(input); sheet = new DefaultSpreadSheet(); row = sheet.getHeaderRow(); row.addCell("I").setContent("Index"); row.addCell("SX").setContent("Slope X"); row.addCell("SY").setContent("Slope Y"); row.addCell("X").setContent("X"); row.addCell("Y").setContent("Y"); row.addCell("A").setContent("Angle"); for (LineParametric2D_F32 line: found) { row = sheet.addRow(); row.addCell("I").setContent(sheet.getRowCount()); row.addCell("SX").setContent(line.getSlopeX()); row.addCell("SY").setContent(line.getSlopeY()); row.addCell("X").setContent(line.getX()); row.addCell("Y").setContent(line.getY()); row.addCell("A").setContent(line.getAngle()); } m_OutputToken = new Token(sheet); } catch (Exception e) { result = handleException("Failed to detect lines", e); } return result; }
String function() { String result; AbstractImageContainer cont; ImageSInt16 input; ConfigHoughPolar config; DetectLineHoughPolar detector; List<LineParametric2D_F32> found; SpreadSheet sheet; Row row; result = null; try { cont = (AbstractImageContainer) m_InputToken.getPayload(); input = (ImageSInt16) BoofCVHelper.toBoofCVImage(cont, BoofCVImageType.SIGNED_INT_16); config = new ConfigHoughPolar( m_LocalMaxRadius, m_MinCounts, m_ResolutionRange, m_ResolutionAngle, m_EdgeThreshold, m_MaxLines); detector = FactoryDetectLineAlgs.houghPolar( config, ImageSInt16.class, ImageSInt16.class); found = detector.detect(input); sheet = new DefaultSpreadSheet(); row = sheet.getHeaderRow(); row.addCell("I").setContent("Index"); row.addCell("SX").setContent(STR); row.addCell("SY").setContent(STR); row.addCell("X").setContent("X"); row.addCell("Y").setContent("Y"); row.addCell("A").setContent("Angle"); for (LineParametric2D_F32 line: found) { row = sheet.addRow(); row.addCell("I").setContent(sheet.getRowCount()); row.addCell("SX").setContent(line.getSlopeX()); row.addCell("SY").setContent(line.getSlopeY()); row.addCell("X").setContent(line.getX()); row.addCell("Y").setContent(line.getY()); row.addCell("A").setContent(line.getAngle()); } m_OutputToken = new Token(sheet); } catch (Exception e) { result = handleException(STR, e); } return result; }
/** * Executes the flow item. * * @return null if everything is fine, otherwise error message */
Executes the flow item
doExecute
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-imaging-boofcv/src/main/java/adams/flow/transformer/BoofCVDetectLines.java", "license": "gpl-3.0", "size": 12718 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,442,890
public static String getDefaultSchema(Db db) { if (isDerby(db)) { // Derby sets default schema name to username return "SA"; } else if (isMySQL(db)) { // MySQL does not have schemas return null; } else if (isSQLite(db)) { // SQLite does not have schemas return null; } return "PUBLIC"; }
static String function(Db db) { if (isDerby(db)) { return "SA"; } else if (isMySQL(db)) { return null; } else if (isSQLite(db)) { return null; } return STR; }
/** * Gets the default schema of the underlying database engine. * * @param db * @return the default schema */
Gets the default schema of the underlying database engine
getDefaultSchema
{ "repo_name": "gitblit/iciql", "path": "src/test/java/com/iciql/test/IciqlSuite.java", "license": "apache-2.0", "size": 26574 }
[ "com.iciql.Db" ]
import com.iciql.Db;
import com.iciql.*;
[ "com.iciql" ]
com.iciql;
2,271,361
private static void coverLinefeedValues() throws XMPException { writeMajorLabel ("Test CR and LF in values"); String valueWithCR = "ASCII \r CR"; String valueWithLF = "ASCII \n LF"; String valueWithCRLF = "ASCII \r\n CRLF"; XMPMeta meta = XMPMetaFactory.parseFromString(NEWLINE_RDF); meta.setProperty (NS2, "HasCR", valueWithCR); meta.setProperty (NS2, "HasLF", valueWithLF); meta.setProperty (NS2, "HasCRLF", valueWithCRLF); String result = XMPMetaFactory.serializeToString(meta, new SerializeOptions() .setOmitPacketWrapper(true)); println(result); String hasCR = meta.getPropertyString (NS1, "HasCR"); String hasCR2 = meta.getPropertyString (NS2, "HasCR"); String hasLF = meta.getPropertyString (NS1, "HasLF"); String hasLF2 = meta.getPropertyString (NS2, "HasLF"); String hasCRLF = meta.getPropertyString (NS1, "HasCRLF"); String hasCRLF2 = meta.getPropertyString (NS2, "HasCRLF"); if (hasCR.equals(valueWithCR) && hasCR2.equals(valueWithCR) && hasLF.equals(valueWithLF) && hasLF2.equals(valueWithLF) && hasCRLF.equals(valueWithCRLF) && hasCRLF2.equals(valueWithCRLF)) { println(); println("\n## HasCR and HasLF and HasCRLF correctly retrieved\n"); } }
static void function() throws XMPException { writeMajorLabel (STR); String valueWithCR = STR; String valueWithLF = STR; String valueWithCRLF = STR; XMPMeta meta = XMPMetaFactory.parseFromString(NEWLINE_RDF); meta.setProperty (NS2, "HasCR", valueWithCR); meta.setProperty (NS2, "HasLF", valueWithLF); meta.setProperty (NS2, STR, valueWithCRLF); String result = XMPMetaFactory.serializeToString(meta, new SerializeOptions() .setOmitPacketWrapper(true)); println(result); String hasCR = meta.getPropertyString (NS1, "HasCR"); String hasCR2 = meta.getPropertyString (NS2, "HasCR"); String hasLF = meta.getPropertyString (NS1, "HasLF"); String hasLF2 = meta.getPropertyString (NS2, "HasLF"); String hasCRLF = meta.getPropertyString (NS1, STR); String hasCRLF2 = meta.getPropertyString (NS2, STR); if (hasCR.equals(valueWithCR) && hasCR2.equals(valueWithCR) && hasLF.equals(valueWithLF) && hasLF2.equals(valueWithLF) && hasCRLF.equals(valueWithCRLF) && hasCRLF2.equals(valueWithCRLF)) { println(); println(STR); } }
/** * Test CR and LF in values. * @throws XMPException Forwards exceptions */
Test CR and LF in values
coverLinefeedValues
{ "repo_name": "k3b/APhotoManager", "path": "fotolib2/src/test/java/com/adobe/xmp/demo/XMPCoreCoverage.java", "license": "gpl-3.0", "size": 35838 }
[ "com.adobe.xmp.XMPException", "com.adobe.xmp.XMPMeta", "com.adobe.xmp.XMPMetaFactory", "com.adobe.xmp.options.SerializeOptions" ]
import com.adobe.xmp.XMPException; import com.adobe.xmp.XMPMeta; import com.adobe.xmp.XMPMetaFactory; import com.adobe.xmp.options.SerializeOptions;
import com.adobe.xmp.*; import com.adobe.xmp.options.*;
[ "com.adobe.xmp" ]
com.adobe.xmp;
2,907,327
public Datatype get(int pColumn, int pRow);
Datatype function(int pColumn, int pRow);
/** * Liefert den Wert der im Ergebnis in der Zeile pRow und der Spalte pColumn steht * @param pColumn Spalte aus der das Ergebnis zurückgeliefert werden soll * @param pRow Reihe aus der das Ergebnis zurückgeliefert werden soll * @return Wert im Ergebnis in der Reihe pRow und der Spalte pColumn */
Liefert den Wert der im Ergebnis in der Zeile pRow und der Spalte pColumn steht
get
{ "repo_name": "marcofranke/SE-SEMed", "path": "ReasoningMediator/src/de/biba/mediator/ISolutionIterator.java", "license": "gpl-3.0", "size": 2359 }
[ "de.biba.ontology.datatypes.Datatype" ]
import de.biba.ontology.datatypes.Datatype;
import de.biba.ontology.datatypes.*;
[ "de.biba.ontology" ]
de.biba.ontology;
395,801
public void testInvalidType() { NumberConverter converter = makeConverter(); try { converter.convert(Object.class, numbers[0]); fail("Invalid type test, expected ConversionException"); } catch (ConversionException e) { // expected result } }
void function() { NumberConverter converter = makeConverter(); try { converter.convert(Object.class, numbers[0]); fail(STR); } catch (ConversionException e) { } }
/** * Test specifying an invalid type. */
Test specifying an invalid type
testInvalidType
{ "repo_name": "vorburger/apache-commons-beanutils", "path": "src/test/java/org/apache/commons/beanutils/converters/NumberConverterTestBase.java", "license": "apache-2.0", "size": 14128 }
[ "org.apache.commons.beanutils.ConversionException" ]
import org.apache.commons.beanutils.ConversionException;
import org.apache.commons.beanutils.*;
[ "org.apache.commons" ]
org.apache.commons;
2,157,275
public GridIoManager io();
GridIoManager function();
/** * Gets communication manager. * * @return Communication manager. */
Gets communication manager
io
{ "repo_name": "leveyj/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java", "license": "apache-2.0", "size": 16870 }
[ "org.apache.ignite.internal.managers.communication.GridIoManager" ]
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.communication.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,669,487
public static void setProperties(CamelContext context, Object bean, Map<String, Object> parameters) throws Exception { IntrospectionSupport.setProperties(context.getTypeConverter(), bean, parameters); } /** * Sets the reference properties on the given bean * <p/> * This is convention over configuration, setting all reference parameters (using {@link #isReferenceParameter(String)}
static void function(CamelContext context, Object bean, Map<String, Object> parameters) throws Exception { IntrospectionSupport.setProperties(context.getTypeConverter(), bean, parameters); } /** * Sets the reference properties on the given bean * <p/> * This is convention over configuration, setting all reference parameters (using {@link #isReferenceParameter(String)}
/** * Sets the regular properties on the given bean * * @param context the camel context * @param bean the bean * @param parameters parameters * @throws Exception is thrown if setting property fails */
Sets the regular properties on the given bean
setProperties
{ "repo_name": "onders86/camel", "path": "camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java", "license": "apache-2.0", "size": 20667 }
[ "java.util.Map", "org.apache.camel.CamelContext" ]
import java.util.Map; import org.apache.camel.CamelContext;
import java.util.*; import org.apache.camel.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
634,412
@Override public String toString() { TextSerializationFactory factory = new TextSerializationFactory(); StringBuilder sb = new StringBuilder(); for (FeatureInfo feature : addedFeatures) { String path = feature.getPath(); sb.append("A\t" + path + "\t" + feature.getFeatureType().getId() + "\n"); ObjectWriter<RevObject> writer = factory.createObjectWriter(TYPE.FEATURE); ByteArrayOutputStream output = new ByteArrayOutputStream(); RevFeature revFeature = new RevFeatureBuilder().build(feature.getFeature()); try { writer.write(revFeature, output); } catch (IOException e) { } sb.append(output.toString()); sb.append("\n"); } for (FeatureInfo feature : removedFeatures) { String path = feature.getPath(); sb.append("R\t" + path + "\t" + feature.getFeatureType().getId() + "\n"); ObjectWriter<RevObject> writer = factory.createObjectWriter(TYPE.FEATURE); ByteArrayOutputStream output = new ByteArrayOutputStream(); RevFeature revFeature = new RevFeatureBuilder().build(feature.getFeature()); try { writer.write(revFeature, output); } catch (IOException e) { } sb.append(output.toString()); sb.append("\n"); } for (FeatureDiff diff : modifiedFeatures) { sb.append("M\t" + diff.getPath() + "\n"); sb.append(diff.toString() + "\n"); } for (FeatureTypeDiff diff : alteredTrees) { sb.append(featureTypeDiffAsString(diff) + "\n"); } return sb.toString(); }
String function() { TextSerializationFactory factory = new TextSerializationFactory(); StringBuilder sb = new StringBuilder(); for (FeatureInfo feature : addedFeatures) { String path = feature.getPath(); sb.append("A\t" + path + "\t" + feature.getFeatureType().getId() + "\n"); ObjectWriter<RevObject> writer = factory.createObjectWriter(TYPE.FEATURE); ByteArrayOutputStream output = new ByteArrayOutputStream(); RevFeature revFeature = new RevFeatureBuilder().build(feature.getFeature()); try { writer.write(revFeature, output); } catch (IOException e) { } sb.append(output.toString()); sb.append("\n"); } for (FeatureInfo feature : removedFeatures) { String path = feature.getPath(); sb.append("R\t" + path + "\t" + feature.getFeatureType().getId() + "\n"); ObjectWriter<RevObject> writer = factory.createObjectWriter(TYPE.FEATURE); ByteArrayOutputStream output = new ByteArrayOutputStream(); RevFeature revFeature = new RevFeatureBuilder().build(feature.getFeature()); try { writer.write(revFeature, output); } catch (IOException e) { } sb.append(output.toString()); sb.append("\n"); } for (FeatureDiff diff : modifiedFeatures) { sb.append("M\t" + diff.getPath() + "\n"); sb.append(diff.toString() + "\n"); } for (FeatureTypeDiff diff : alteredTrees) { sb.append(featureTypeDiffAsString(diff) + "\n"); } return sb.toString(); }
/** * This method is not intended to serialize the patch, as it misses some needed information. To * serialize the patch, use the {@link PatchSerializer} class instead. Use this method to show * patch content in a human-readable format */
This method is not intended to serialize the patch, as it misses some needed information. To serialize the patch, use the <code>PatchSerializer</code> class instead. Use this method to show patch content in a human-readable format
toString
{ "repo_name": "rouault/GeoGit", "path": "src/core/src/main/java/org/geogit/api/plumbing/diff/Patch.java", "license": "bsd-3-clause", "size": 10875 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "org.geogit.api.FeatureInfo", "org.geogit.api.RevFeature", "org.geogit.api.RevFeatureBuilder", "org.geogit.api.RevObject", "org.geogit.storage.ObjectWriter", "org.geogit.storage.text.TextSerializationFactory" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import org.geogit.api.FeatureInfo; import org.geogit.api.RevFeature; import org.geogit.api.RevFeatureBuilder; import org.geogit.api.RevObject; import org.geogit.storage.ObjectWriter; import org.geogit.storage.text.TextSerializationFactory;
import java.io.*; import org.geogit.api.*; import org.geogit.storage.*; import org.geogit.storage.text.*;
[ "java.io", "org.geogit.api", "org.geogit.storage" ]
java.io; org.geogit.api; org.geogit.storage;
1,265,279
public Observable<ServiceResponseWithHeaders<Void, LROsDeleteAsyncNoHeaderInRetryHeaders>> deleteAsyncNoHeaderInRetryWithServiceResponseAsync() { Observable<Response<ResponseBody>> observable = service.deleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken<Void>() { }.getType(), LROsDeleteAsyncNoHeaderInRetryHeaders.class); }
Observable<ServiceResponseWithHeaders<Void, LROsDeleteAsyncNoHeaderInRetryHeaders>> function() { Observable<Response<ResponseBody>> observable = service.deleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken<Void>() { }.getType(), LROsDeleteAsyncNoHeaderInRetryHeaders.class); }
/** * Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. * * @return the observable for the request */
Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header
deleteAsyncNoHeaderInRetryWithServiceResponseAsync
{ "repo_name": "yugangw-msft/autorest", "path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/lro/implementation/LROsImpl.java", "license": "mit", "size": 358789 }
[ "com.google.common.reflect.TypeToken", "com.microsoft.rest.ServiceResponseWithHeaders" ]
import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponseWithHeaders;
import com.google.common.reflect.*; import com.microsoft.rest.*;
[ "com.google.common", "com.microsoft.rest" ]
com.google.common; com.microsoft.rest;
2,687,327
@Generated @Selector("remapValuesToCurveWithControlPoints:") public native void remapValuesToCurveWithControlPoints( NSDictionary<? extends NSNumber, ? extends NSNumber> controlPoints);
@Selector(STR) native void function( NSDictionary<? extends NSNumber, ? extends NSNumber> controlPoints);
/** * Remaps all noise values to a smooth curve that passes through the specified control points. * * @param controlPoints Pairs of 'input : output' values to use as control points for the smooth remapping curve. * Duplicate input values are not permitted. */
Remaps all noise values to a smooth curve that passes through the specified control points
remapValuesToCurveWithControlPoints
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/gameplaykit/GKNoise.java", "license": "apache-2.0", "size": 14043 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
2,636,374
@Test public void testSearchForFoodNextTo() { final Sheep meh = new Sheep(); final StendhalRPZone zone = new StendhalRPZone("testzone", 10, 10); zone.add(meh); final RPObject foodobject = new RPObject(); foodobject.put("amount", 1); final SheepFood food = new SheepFood(foodobject); assertTrue(food.getAmount() > 0); zone.add(food); assertTrue(meh.searchForFood()); assertEquals("eat", meh.getIdea()); }
void function() { final Sheep meh = new Sheep(); final StendhalRPZone zone = new StendhalRPZone(STR, 10, 10); zone.add(meh); final RPObject foodobject = new RPObject(); foodobject.put(STR, 1); final SheepFood food = new SheepFood(foodobject); assertTrue(food.getAmount() > 0); zone.add(food); assertTrue(meh.searchForFood()); assertEquals("eat", meh.getIdea()); }
/** * Tests for searchForFoodNextTo. */
Tests for searchForFoodNextTo
testSearchForFoodNextTo
{ "repo_name": "AntumDeluge/arianne-stendhal", "path": "tests/games/stendhal/server/entity/creature/SheepTest.java", "license": "gpl-2.0", "size": 9134 }
[ "games.stendhal.server.core.engine.StendhalRPZone", "games.stendhal.server.entity.mapstuff.spawner.SheepFood", "org.junit.Assert" ]
import games.stendhal.server.core.engine.StendhalRPZone; import games.stendhal.server.entity.mapstuff.spawner.SheepFood; import org.junit.Assert;
import games.stendhal.server.core.engine.*; import games.stendhal.server.entity.mapstuff.spawner.*; import org.junit.*;
[ "games.stendhal.server", "org.junit" ]
games.stendhal.server; org.junit;
2,060,802
@Override public String getSystemDisplayName(File f) { String displayName = super.getSystemDisplayName(f); return f.isDirectory() ? displayName.toUpperCase() : displayName. toLowerCase(); }
String function(File f) { String displayName = super.getSystemDisplayName(f); return f.isDirectory() ? displayName.toUpperCase() : displayName. toLowerCase(); }
/** * Returns a string that represents a directory or a file in the FileChooser component. * A string with all upper case letters is returned for a directory. * A string with all lower case letters is returned for a file. */
Returns a string that represents a directory or a file in the FileChooser component. A string with all upper case letters is returned for a directory. A string with all lower case letters is returned for a file
getSystemDisplayName
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileSystemView.java", "license": "mit", "size": 3245 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
598,435
public void setSeriesPaint(Paint paint) { this.seriesPaint = paint; notifyListeners(new PlotChangeEvent(this)); }
void function(Paint paint) { this.seriesPaint = paint; notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the paint for ALL series in the plot. If this is set to</code> null * </code>, then a list of paints is used instead (to allow different colors * to be used for each series of the radar group). * * @param paint the paint (<code>null</code> permitted). * * @see #getSeriesPaint() */
Sets the paint for ALL series in the plot. If this is set to</code> null </code>, then a list of paints is used instead (to allow different colors to be used for each series of the radar group)
setSeriesPaint
{ "repo_name": "ibestvina/multithread-centiscape", "path": "CentiScaPe2.1/src/main/java/org/jfree/chart/plot/SpiderWebPlot.java", "license": "mit", "size": 54986 }
[ "java.awt.Paint", "org.jfree.chart.event.PlotChangeEvent" ]
import java.awt.Paint; import org.jfree.chart.event.PlotChangeEvent;
import java.awt.*; import org.jfree.chart.event.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
346,229
public static String versionFromId(final String id){ if(id == null) return IAttributes.EMPTY_STRING; int pos = id.indexOf('.'); // find first separator if(pos > 0 ) { pos = id.indexOf('.', pos+1); // find second separator if(pos > 0 ) return id.substring(pos+1); // the rest is version (is any) } return IAttributes.EMPTY_STRING; }
static String function(final String id){ if(id == null) return IAttributes.EMPTY_STRING; int pos = id.indexOf('.'); if(pos > 0 ) { pos = id.indexOf('.', pos+1); if(pos > 0 ) return id.substring(pos+1); } return IAttributes.EMPTY_STRING; }
/** * Extracts version from id string * @param id Pack ID string * @return version string if found, null otherwise */
Extracts version from id string
versionFromId
{ "repo_name": "borayildiz/cmsis-pack-eclipse", "path": "com.arm.cmsis.pack/src/com/arm/cmsis/pack/data/CpPack.java", "license": "apache-2.0", "size": 5750 }
[ "com.arm.cmsis.pack.generic.IAttributes" ]
import com.arm.cmsis.pack.generic.IAttributes;
import com.arm.cmsis.pack.generic.*;
[ "com.arm.cmsis" ]
com.arm.cmsis;
322,647
@Test public void testMultiUpdate() throws IOException { final String moreRecordsString = ResourceUtil .loadResourceAsString("org/auscope/portal/core/test/responses/csw/cswRecordResponse.xml"); final String noMoreRecordsString = ResourceUtil .loadResourceAsString("org/auscope/portal/core/test/responses/csw/cswRecordResponse_NoMoreRecords.xml"); final Sequence t1Sequence = context.sequence("t1Sequence"); final Sequence t2Sequence = context.sequence("t2Sequence"); final Sequence t3Sequence = context.sequence("t3Sequence"); final int totalRequestsMade = CONCURRENT_THREADS_TO_RUN + 2; try (final HttpClientInputStream t1r1 = new HttpClientInputStream(new ByteArrayInputStream(moreRecordsString.getBytes()), null); final HttpClientInputStream t1r2 = new HttpClientInputStream(new ByteArrayInputStream(noMoreRecordsString.getBytes()), null); final HttpClientInputStream t2r1 = new HttpClientInputStream(new ByteArrayInputStream(noMoreRecordsString.getBytes()), null); final HttpClientInputStream t3r1 = new HttpClientInputStream(new ByteArrayInputStream(moreRecordsString.getBytes()), null); final HttpClientInputStream t3r2 = new HttpClientInputStream( new ByteArrayInputStream(noMoreRecordsString.getBytes()), null)) { context.checking(new Expectations() { { // Thread 1 will make 2 requests oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 1), null))); inSequence(t1Sequence); will(returnValue(t1r1)); oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 1), null))); inSequence(t1Sequence); will(returnValue(t1r2)); // Thread 2 will make 1 requests oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 2), null))); inSequence(t2Sequence); will(returnValue(t2r1)); // Thread 3 will make 2 requests oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 3), null))); inSequence(t3Sequence); will(returnValue(t3r1)); oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 3), null))); inSequence(t3Sequence); will(returnValue(t3r2)); } }); // Start our updating and wait for our threads to finish Assert.assertTrue(this.cswCacheService.updateCache()); try { Thread.sleep(50); } catch (InterruptedException e) { Assert.fail("Test sleep interrupted. Test aborted."); } try { threadExecutor.getExecutorService().shutdown(); threadExecutor.getExecutorService().awaitTermination(180, TimeUnit.SECONDS); } catch (Exception ex) { threadExecutor.getExecutorService().shutdownNow(); Assert.fail("Exception whilst waiting for update to finish " + ex.getMessage()); } // Check our expected responses Assert.assertEquals(totalRequestsMade * RECORD_COUNT_TOTAL, this.cswCacheService.getRecordCache().size()); Assert.assertEquals(totalRequestsMade * RECORD_COUNT_WMS, this.cswCacheService.getWMSRecords().size()); Assert.assertEquals(totalRequestsMade * RECORD_COUNT_WFS, this.cswCacheService.getWFSRecords().size()); Assert.assertEquals(totalRequestsMade * RECORD_COUNT_ERMINE_RECORDS, this.cswCacheService.getWCSRecords() .size()); // Ensure that our internal state is set to NOT RUNNING AN UPDATE Assert.assertFalse(this.cswCacheService.updateRunning); } }
void function() throws IOException { final String moreRecordsString = ResourceUtil .loadResourceAsString(STR); final String noMoreRecordsString = ResourceUtil .loadResourceAsString(STR); final Sequence t1Sequence = context.sequence(STR); final Sequence t2Sequence = context.sequence(STR); final Sequence t3Sequence = context.sequence(STR); final int totalRequestsMade = CONCURRENT_THREADS_TO_RUN + 2; try (final HttpClientInputStream t1r1 = new HttpClientInputStream(new ByteArrayInputStream(moreRecordsString.getBytes()), null); final HttpClientInputStream t1r2 = new HttpClientInputStream(new ByteArrayInputStream(noMoreRecordsString.getBytes()), null); final HttpClientInputStream t2r1 = new HttpClientInputStream(new ByteArrayInputStream(noMoreRecordsString.getBytes()), null); final HttpClientInputStream t3r1 = new HttpClientInputStream(new ByteArrayInputStream(moreRecordsString.getBytes()), null); final HttpClientInputStream t3r2 = new HttpClientInputStream( new ByteArrayInputStream(noMoreRecordsString.getBytes()), null)) { context.checking(new Expectations() { { oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 1), null))); inSequence(t1Sequence); will(returnValue(t1r1)); oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 1), null))); inSequence(t1Sequence); will(returnValue(t1r2)); oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 2), null))); inSequence(t2Sequence); will(returnValue(t2r1)); oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 3), null))); inSequence(t3Sequence); will(returnValue(t3r1)); oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 3), null))); inSequence(t3Sequence); will(returnValue(t3r2)); } }); Assert.assertTrue(this.cswCacheService.updateCache()); try { Thread.sleep(50); } catch (InterruptedException e) { Assert.fail(STR); } try { threadExecutor.getExecutorService().shutdown(); threadExecutor.getExecutorService().awaitTermination(180, TimeUnit.SECONDS); } catch (Exception ex) { threadExecutor.getExecutorService().shutdownNow(); Assert.fail(STR + ex.getMessage()); } Assert.assertEquals(totalRequestsMade * RECORD_COUNT_TOTAL, this.cswCacheService.getRecordCache().size()); Assert.assertEquals(totalRequestsMade * RECORD_COUNT_WMS, this.cswCacheService.getWMSRecords().size()); Assert.assertEquals(totalRequestsMade * RECORD_COUNT_WFS, this.cswCacheService.getWFSRecords().size()); Assert.assertEquals(totalRequestsMade * RECORD_COUNT_ERMINE_RECORDS, this.cswCacheService.getWCSRecords() .size()); Assert.assertFalse(this.cswCacheService.updateRunning); } }
/** * Tests a regular update goes through and makes multiple requests over multiple threads * @throws IOException */
Tests a regular update goes through and makes multiple requests over multiple threads
testMultiUpdate
{ "repo_name": "joshvote/portal-core", "path": "src/test/java/org/auscope/portal/core/services/TestCSWCacheService.java", "license": "gpl-3.0", "size": 43226 }
[ "java.io.ByteArrayInputStream", "java.io.IOException", "java.util.concurrent.TimeUnit", "org.auscope.portal.core.server.http.HttpClientInputStream", "org.auscope.portal.core.test.ResourceUtil", "org.auscope.portal.core.test.jmock.HttpMethodBaseMatcher", "org.jmock.Expectations", "org.jmock.Sequence", "org.junit.Assert" ]
import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.auscope.portal.core.server.http.HttpClientInputStream; import org.auscope.portal.core.test.ResourceUtil; import org.auscope.portal.core.test.jmock.HttpMethodBaseMatcher; import org.jmock.Expectations; import org.jmock.Sequence; import org.junit.Assert;
import java.io.*; import java.util.concurrent.*; import org.auscope.portal.core.server.http.*; import org.auscope.portal.core.test.*; import org.auscope.portal.core.test.jmock.*; import org.jmock.*; import org.junit.*;
[ "java.io", "java.util", "org.auscope.portal", "org.jmock", "org.junit" ]
java.io; java.util; org.auscope.portal; org.jmock; org.junit;
2,619,731
@Override public String getText(Object object) { String label = ((ProductionCapability)object).getName(); return label == null || label.length() == 0 ? getString("_UI_ProductionCapability_type") : getString("_UI_ProductionCapability_type") + " " + label; }
String function(Object object) { String label = ((ProductionCapability)object).getName(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; }
/** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This returns the label text for the adapted class.
getText
{ "repo_name": "BaSys-PC1/models", "path": "de.dfki.iui.basys.model.domain.edit/src/de/dfki/iui/basys/model/domain/capability/provider/ProductionCapabilityItemProvider.java", "license": "epl-1.0", "size": 2731 }
[ "de.dfki.iui.basys.model.domain.capability.ProductionCapability" ]
import de.dfki.iui.basys.model.domain.capability.ProductionCapability;
import de.dfki.iui.basys.model.domain.capability.*;
[ "de.dfki.iui" ]
de.dfki.iui;
838,213
Dependency testFixtures(Object notation);
Dependency testFixtures(Object notation);
/** * Declares a dependency on the test fixtures of a component. * @param notation the coordinates of the component to use test fixtures for * * @since 5.6 */
Declares a dependency on the test fixtures of a component
testFixtures
{ "repo_name": "gradle/gradle", "path": "subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/DependencyHandler.java", "license": "apache-2.0", "size": 27329 }
[ "org.gradle.api.artifacts.Dependency" ]
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.*;
[ "org.gradle.api" ]
org.gradle.api;
1,078,565
public EReference getPEExtension_RootNodes() { return (EReference)peExtensionEClass.getEStructuralFeatures().get(1); }
EReference function() { return (EReference)peExtensionEClass.getEStructuralFeatures().get(1); }
/** * Returns the meta object for the reference list '{@link org.mar9000.pe.ecore.PEExtension#getRootNodes <em>Root Nodes</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference list '<em>Root Nodes</em>'. * @see org.mar9000.pe.ecore.PEExtension#getRootNodes() * @see #getPEExtension() * @generated */
Returns the meta object for the reference list '<code>org.mar9000.pe.ecore.PEExtension#getRootNodes Root Nodes</code>'.
getPEExtension_RootNodes
{ "repo_name": "mar9000/pe", "path": "src-gen/org/mar9000/pe/ecore/impl/EcorePackageImpl.java", "license": "apache-2.0", "size": 100111 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
251,375