method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
@UiThread
private static void initializeStrictModeWatch(
ThreadStrictModeInterceptor.Builder threadInterceptor) {
threadInterceptor.setCustomPenalty(violation -> {
if (Math.random() < UPLOAD_PROBABILITY) {
// Ensure that we do not upload too many StrictMode violations in any single
// session. To prevent races, we allow sNumUploads to increase beyond the limit, but
// just skip actually uploading the stack trace then.
if (sNumUploads.getAndAdd(1) < MAX_UPLOADS_PER_SESSION) {
sCachedViolations.add(violation);
}
}
});
sNumUploads.set(0);
// Delay handling StrictMode violations during initialization until the main loop is idle.
Looper.myQueue().addIdleHandler(() -> {
// Will retry if the native library has not been initialized.
if (!LibraryLoader.getInstance().isInitialized()) return true;
// Check again next time if no more cached stack traces to upload, and we have not
// reached the max number of uploads for this session.
if (sCachedViolations.isEmpty()) {
// TODO(wnwen): Add UMA count when this happens.
// In case of races, continue checking an extra time (equal condition).
return sNumUploads.get() <= MAX_UPLOADS_PER_SESSION;
}
// Since this is the only place we are removing elements, no need for additional
// synchronization to ensure it is still non-empty.
reportStrictModeViolation(sCachedViolations.remove(0));
return true;
});
}
|
static void function( ThreadStrictModeInterceptor.Builder threadInterceptor) { threadInterceptor.setCustomPenalty(violation -> { if (Math.random() < UPLOAD_PROBABILITY) { if (sNumUploads.getAndAdd(1) < MAX_UPLOADS_PER_SESSION) { sCachedViolations.add(violation); } } }); sNumUploads.set(0); Looper.myQueue().addIdleHandler(() -> { if (!LibraryLoader.getInstance().isInitialized()) return true; if (sCachedViolations.isEmpty()) { return sNumUploads.get() <= MAX_UPLOADS_PER_SESSION; } reportStrictModeViolation(sCachedViolations.remove(0)); return true; }); }
|
/**
* Add custom {@link ThreadStrictModeInterceptor} penalty which records strict mode violations.
* Set up an idle handler so StrictMode violations that occur on startup are not ignored.
*/
|
Add custom <code>ThreadStrictModeInterceptor</code> penalty which records strict mode violations. Set up an idle handler so StrictMode violations that occur on startup are not ignored
|
initializeStrictModeWatch
|
{
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/chrome/android/java/src/org/chromium/chrome/browser/ChromeStrictMode.java",
"license": "bsd-3-clause",
"size": 11984
}
|
[
"android.os.Looper",
"org.chromium.base.library_loader.LibraryLoader",
"org.chromium.components.strictmode.ThreadStrictModeInterceptor"
] |
import android.os.Looper; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.components.strictmode.ThreadStrictModeInterceptor;
|
import android.os.*; import org.chromium.base.library_loader.*; import org.chromium.components.strictmode.*;
|
[
"android.os",
"org.chromium.base",
"org.chromium.components"
] |
android.os; org.chromium.base; org.chromium.components;
| 514,999
|
return methodParameter.getParameterType().equals(UserRole.class) && null != methodParameter.getParameterAnnotation(
ActiveRole.class);
}
|
return methodParameter.getParameterType().equals(UserRole.class) && null != methodParameter.getParameterAnnotation( ActiveRole.class); }
|
/**
* Returns TRUE if method argument is {@link UserRole} and annotated by
* {@link ActiveRole} annotation
*/
|
Returns TRUE if method argument is <code>UserRole</code> and annotated by <code>ActiveRole</code> annotation
|
supportsParameter
|
{
"repo_name": "reportportal/service-api",
"path": "src/main/java/com/epam/ta/reportportal/ws/resolver/ActiveUserWebArgumentResolver.java",
"license": "apache-2.0",
"size": 2815
}
|
[
"com.epam.ta.reportportal.entity.user.UserRole"
] |
import com.epam.ta.reportportal.entity.user.UserRole;
|
import com.epam.ta.reportportal.entity.user.*;
|
[
"com.epam.ta"
] |
com.epam.ta;
| 166,268
|
private JMenu createFileMenu()
{
JMenu file = new JMenu("File");
file.setMnemonic(KeyEvent.VK_F);
file.add(buttons[EXIT_MI]);
return file;
}
|
JMenu function() { JMenu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); file.add(buttons[EXIT_MI]); return file; }
|
/**
* Helper method to create the file menu.
*
* @return The file menu.
*/
|
Helper method to create the file menu
|
createFileMenu
|
{
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/ui/TaskBarView.java",
"license": "gpl-2.0",
"size": 20703
}
|
[
"java.awt.event.KeyEvent",
"javax.swing.JMenu"
] |
import java.awt.event.KeyEvent; import javax.swing.JMenu;
|
import java.awt.event.*; import javax.swing.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 2,883,056
|
@Override
public CloudServiceOperationStatusResponse getOperationStatus(String requestId) throws IOException, ServiceException, ParserConfigurationException, SAXException {
// Validate
if (requestId == null) {
throw new NullPointerException("requestId");
}
// Tracing
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
tracingParameters.put("requestId", requestId);
CloudTracing.enter(invocationId, this, "getOperationStatusAsync", tracingParameters);
}
// Construct URL
String url = (this.getCredentials().getSubscriptionId() != null ? this.getCredentials().getSubscriptionId().trim() : "") + "/operations/" + requestId.trim();
String baseUrl = this.getBaseUri().toString();
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
}
if (url.charAt(0) == '/') {
url = url.substring(1);
}
url = baseUrl + "/" + url;
url = url.replace(" ", "%20");
// Create HTTP transport objects
HttpGet httpRequest = new HttpGet(url);
// Set Headers
httpRequest.setHeader("x-ms-version", "2013-03-01");
// Send Request
HttpResponse httpResponse = null;
try {
if (shouldTrace) {
CloudTracing.sendRequest(invocationId, httpRequest);
}
httpResponse = this.getHttpClient().execute(httpRequest);
if (shouldTrace) {
CloudTracing.receiveResponse(invocationId, httpResponse);
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
}
// Create Result
CloudServiceOperationStatusResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new CloudServiceOperationStatusResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element operationElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Operation");
if (operationElement != null) {
Element idElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "ID");
if (idElement != null) {
String idInstance;
idInstance = idElement.getTextContent();
result.setId(idInstance);
}
Element statusElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Status");
if (statusElement != null) {
CloudServiceOperationStatus statusInstance;
statusInstance = CloudServiceOperationStatus.valueOf(statusElement.getTextContent());
result.setStatus(statusInstance);
}
Element httpStatusCodeElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "HttpStatusCode");
if (httpStatusCodeElement != null) {
Integer httpStatusCodeInstance;
httpStatusCodeInstance = Integer.valueOf(httpStatusCodeElement.getTextContent());
result.setHttpStatusCode(httpStatusCodeInstance);
}
Element errorElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Error");
if (errorElement != null) {
CloudServiceOperationStatusResponse.ErrorDetails errorInstance = new CloudServiceOperationStatusResponse.ErrorDetails();
result.setError(errorInstance);
Element codeElement = XmlUtility.getElementByTagNameNS(errorElement, "http://schemas.microsoft.com/windowsazure", "Code");
if (codeElement != null) {
String codeInstance;
codeInstance = codeElement.getTextContent();
errorInstance.setCode(codeInstance);
}
Element messageElement = XmlUtility.getElementByTagNameNS(errorElement, "http://schemas.microsoft.com/windowsazure", "Message");
if (messageElement != null) {
String messageInstance;
messageInstance = messageElement.getTextContent();
errorInstance.setMessage(messageInstance);
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (httpResponse != null && httpResponse.getEntity() != null) {
httpResponse.getEntity().getContent().close();
}
}
}
|
CloudServiceOperationStatusResponse function(String requestId) throws IOException, ServiceException, ParserConfigurationException, SAXException { if (requestId == null) { throw new NullPointerException(STR); } boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put(STR, requestId); CloudTracing.enter(invocationId, this, STR, tracingParameters); } String url = (this.getCredentials().getSubscriptionId() != null ? this.getCredentials().getSubscriptionId().trim() : STR/operations/STR/STR STR%20STRx-ms-versionSTR2013-03-01STRhttp: if (operationElement != null) { Element idElement = XmlUtility.getElementByTagNameNS(operationElement, STRhttp: if (statusElement != null) { CloudServiceOperationStatus statusInstance; statusInstance = CloudServiceOperationStatus.valueOf(statusElement.getTextContent()); result.setStatus(statusInstance); } Element httpStatusCodeElement = XmlUtility.getElementByTagNameNS(operationElement, STRhttp: if (errorElement != null) { CloudServiceOperationStatusResponse.ErrorDetails errorInstance = new CloudServiceOperationStatusResponse.ErrorDetails(); result.setError(errorInstance); Element codeElement = XmlUtility.getElementByTagNameNS(errorElement, STRhttp: if (messageElement != null) { String messageInstance; messageInstance = messageElement.getTextContent(); errorInstance.setMessage(messageInstance); } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders(STR).length > 0) { result.setRequestId(httpResponse.getFirstHeader(STR).getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
|
/**
* The Get Operation Status operation returns the status of thespecified
* operation. After calling an asynchronous operation, you can call Get
* Operation Status to determine whether the operation has succeeded,
* failed, or is still in progress. (see
* http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx for
* more information)
*
* @param requestId Required. The request ID for the request you wish to
* track. The request ID is returned in the x-ms-request-id response header
* for every request.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @return The response body contains the status of the specified
* asynchronous operation, indicating whether it has succeeded, is
* inprogress, or has failed. Note that this status is distinct from the
* HTTP status code returned for the Get Operation Status operation itself.
* If the asynchronous operation succeeded, the response body includes the
* HTTP status code for the successful request. If the asynchronous
* operation failed, the response body includes the HTTP status code for
* the failed request, and also includes error information regarding the
* failure.
*/
|
The Get Operation Status operation returns the status of thespecified operation. After calling an asynchronous operation, you can call Get Operation Status to determine whether the operation has succeeded, failed, or is still in progress. (see HREF for more information)
|
getOperationStatus
|
{
"repo_name": "manikandan-palaniappan/azure-sdk-for-java",
"path": "management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/CloudServiceManagementClientImpl.java",
"license": "apache-2.0",
"size": 27187
}
|
[
"com.microsoft.windowsazure.core.utils.XmlUtility",
"com.microsoft.windowsazure.exception.ServiceException",
"com.microsoft.windowsazure.management.scheduler.models.CloudServiceOperationStatus",
"com.microsoft.windowsazure.management.scheduler.models.CloudServiceOperationStatusResponse",
"com.microsoft.windowsazure.tracing.CloudTracing",
"java.io.IOException",
"java.util.HashMap",
"javax.xml.parsers.ParserConfigurationException",
"org.w3c.dom.Element",
"org.xml.sax.SAXException"
] |
import com.microsoft.windowsazure.core.utils.XmlUtility; import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.management.scheduler.models.CloudServiceOperationStatus; import com.microsoft.windowsazure.management.scheduler.models.CloudServiceOperationStatusResponse; import com.microsoft.windowsazure.tracing.CloudTracing; import java.io.IOException; import java.util.HashMap; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Element; import org.xml.sax.SAXException;
|
import com.microsoft.windowsazure.core.utils.*; import com.microsoft.windowsazure.exception.*; import com.microsoft.windowsazure.management.scheduler.models.*; import com.microsoft.windowsazure.tracing.*; import java.io.*; import java.util.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*;
|
[
"com.microsoft.windowsazure",
"java.io",
"java.util",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] |
com.microsoft.windowsazure; java.io; java.util; javax.xml; org.w3c.dom; org.xml.sax;
| 1,877,311
|
public String beginGenerateVpnProfile(String resourceGroupName, String virtualNetworkGatewayName, VpnClientParameters parameters) {
return beginGenerateVpnProfileWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().single().body();
}
|
String function(String resourceGroupName, String virtualNetworkGatewayName, VpnClientParameters parameters) { return beginGenerateVpnProfileWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().single().body(); }
|
/**
* Generates VPN profile for P2S client of the virtual network gateway in the specified resource group. Used for IKEV2 and radius based authentication.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayName The name of the virtual network gateway.
* @param parameters Parameters supplied to the generate virtual network gateway VPN client package operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the String object if successful.
*/
|
Generates VPN profile for P2S client of the virtual network gateway in the specified resource group. Used for IKEV2 and radius based authentication
|
beginGenerateVpnProfile
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewaysInner.java",
"license": "mit",
"size": 230879
}
|
[
"com.microsoft.azure.management.network.v2018_08_01.VpnClientParameters"
] |
import com.microsoft.azure.management.network.v2018_08_01.VpnClientParameters;
|
import com.microsoft.azure.management.network.v2018_08_01.*;
|
[
"com.microsoft.azure"
] |
com.microsoft.azure;
| 2,578,482
|
public CategoryItemRendererState initialise(Graphics2D g2,
Rectangle2D dataArea,
CategoryPlot plot,
int rendererIndex,
PlotRenderingInfo info) {
Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX(),
dataArea.getY() + getYOffset(), dataArea.getWidth()
- getXOffset(), dataArea.getHeight() - getYOffset());
CategoryItemRendererState state = super.initialise(g2, adjusted, plot,
rendererIndex, info);
return state;
}
|
CategoryItemRendererState function(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info) { Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX(), dataArea.getY() + getYOffset(), dataArea.getWidth() - getXOffset(), dataArea.getHeight() - getYOffset()); CategoryItemRendererState state = super.initialise(g2, adjusted, plot, rendererIndex, info); return state; }
|
/**
* Initialises the renderer and returns a state object that will be passed
* to subsequent calls to the drawItem method. This method gets called
* once at the start of the process of drawing a chart.
*
* @param g2 the graphics device.
* @param dataArea the area in which the data is to be plotted.
* @param plot the plot.
* @param rendererIndex the renderer index.
* @param info collects chart rendering information for return to caller.
*
* @return The renderer state.
*/
|
Initialises the renderer and returns a state object that will be passed to subsequent calls to the drawItem method. This method gets called once at the start of the process of drawing a chart
|
initialise
|
{
"repo_name": "SOCR/HTML5_WebSite",
"path": "SOCR2.8/src/jfreechart/org/jfree/chart/renderer/category/BarRenderer3D.java",
"license": "lgpl-3.0",
"size": 29511
}
|
[
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D",
"org.jfree.chart.plot.CategoryPlot",
"org.jfree.chart.plot.PlotRenderingInfo"
] |
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotRenderingInfo;
|
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.plot.*;
|
[
"java.awt",
"org.jfree.chart"
] |
java.awt; org.jfree.chart;
| 1,322,891
|
protected void addRepresentsPropertyDescriptorGen(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Lifeline_represents_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Lifeline_represents_feature", "_UI_Lifeline_type"),
RamPackage.Literals.LIFELINE__REPRESENTS,
true,
false,
true,
null,
null,
null));
}
|
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), RamPackage.Literals.LIFELINE__REPRESENTS, true, false, true, null, null, null)); }
|
/**
* This adds a property descriptor for the Represents feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
|
This adds a property descriptor for the Represents feature.
|
addRepresentsPropertyDescriptorGen
|
{
"repo_name": "sacooper/ECSE-429-Project-Group1",
"path": "ca.mcgill.sel.ram.edit/src/ca/mcgill/sel/ram/provider/LifelineItemProvider.java",
"license": "gpl-2.0",
"size": 24611
}
|
[
"ca.mcgill.sel.ram.RamPackage",
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory"
] |
import ca.mcgill.sel.ram.RamPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
|
import ca.mcgill.sel.ram.*; import org.eclipse.emf.edit.provider.*;
|
[
"ca.mcgill.sel",
"org.eclipse.emf"
] |
ca.mcgill.sel; org.eclipse.emf;
| 2,348,426
|
public boolean registrarIncidencia(){
// crear el mapa
HashMap<String,Object> datos = new HashMap<String,Object>();
// llenar los datos
datos.put("tipo", tipo);
datos.put("importancia", importancia);
datos.put("descripcion", descripcion);
datos.put("idusuario", idUsuario);
datos.put("nombre", nombreCliente);
datos.put("apellido",apellido);
datos.put("direccion", direccion);
datos.put("edad", edad);
datos.put("telefono", telefono);
datos.put("fecha", fecha);
datos.put("correo", correo);
// guardar los datos en el servidor
return remoteIncidencia.registrarIncidencia(datos);
}
|
boolean function(){ HashMap<String,Object> datos = new HashMap<String,Object>(); datos.put("tipo", tipo); datos.put(STR, importancia); datos.put(STR, descripcion); datos.put(STR, idUsuario); datos.put(STR, nombreCliente); datos.put(STR,apellido); datos.put(STR, direccion); datos.put("edad", edad); datos.put(STR, telefono); datos.put("fecha", fecha); datos.put(STR, correo); return remoteIncidencia.registrarIncidencia(datos); }
|
/**
* registra una incidencia con los atributos de esta clase
* @return true si la operacion fue correcta
*/
|
registra una incidencia con los atributos de esta clase
|
registrarIncidencia
|
{
"repo_name": "lokiteitor/ProyectosUPSLP",
"path": "CallCenterClient/src/main/java/mx/edu/upslp/callcenterclient/gui/datos/Incidencia.java",
"license": "gpl-3.0",
"size": 11995
}
|
[
"java.util.HashMap"
] |
import java.util.HashMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,406,802
|
Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange version, String type,
String classifier, String scope, boolean optional );
|
Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange version, String type, String classifier, String scope, boolean optional );
|
/**
* Shorthand method for <code>getArtifactFactory().createDependencyArtifact(...)</code>.
*
* @param groupId The group id.
* @param artifactId The artifact id.
* @param version The version (possibly a range)
* @param type The type.
* @param classifier The classifier.
* @param scope The scope.
* @param optional If optional or not.
* @return The corresponding dependency artifact.
* @since 1.0-alpha-3
*/
|
Shorthand method for <code>getArtifactFactory().createDependencyArtifact(...)</code>
|
createDependencyArtifact
|
{
"repo_name": "prostagma/versions-maven-plugin",
"path": "src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java",
"license": "apache-2.0",
"size": 11691
}
|
[
"org.apache.maven.artifact.Artifact",
"org.apache.maven.artifact.versioning.VersionRange"
] |
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.versioning.VersionRange;
|
import org.apache.maven.artifact.*; import org.apache.maven.artifact.versioning.*;
|
[
"org.apache.maven"
] |
org.apache.maven;
| 1,961,962
|
private BufferedImage readImage()
throws IOException {
BufferedImage bi = null;
if ( source.getClass() == File.class ) {
String s = ( (File) source ).getName();
String tmp = s.toLowerCase();
if ( tmp.startsWith( "file:" ) ) {
tmp = s.substring( 6, s.length() );
bi = ImageUtils.loadImage( new java.io.File( tmp ) );
} else if ( tmp.startsWith( "http:" ) ) {
bi = ImageUtils.loadImage( new URL( s ) );
} else {
bi = ImageUtils.loadImage( new java.io.File( s ) );
}
} else {
bi = ImageUtils.loadImage( (InputStream) source );
}
return bi;
}
|
BufferedImage function() throws IOException { BufferedImage bi = null; if ( source.getClass() == File.class ) { String s = ( (File) source ).getName(); String tmp = s.toLowerCase(); if ( tmp.startsWith( "file:" ) ) { tmp = s.substring( 6, s.length() ); bi = ImageUtils.loadImage( new java.io.File( tmp ) ); } else if ( tmp.startsWith( "http:" ) ) { bi = ImageUtils.loadImage( new URL( s ) ); } else { bi = ImageUtils.loadImage( new java.io.File( s ) ); } } else { bi = ImageUtils.loadImage( (InputStream) source ); } return bi; }
|
/**
* reads an image from its source
*
* @throws IOException
*/
|
reads an image from its source
|
readImage
|
{
"repo_name": "lat-lon/deegree2-base",
"path": "deegree2-core/src/main/java/org/deegree/model/coverage/grid/ImageGridCoverageReader.java",
"license": "lgpl-2.1",
"size": 16015
}
|
[
"java.awt.image.BufferedImage",
"java.io.IOException",
"java.io.InputStream",
"org.deegree.framework.util.ImageUtils",
"org.deegree.ogcwebservices.wcs.configuration.File"
] |
import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import org.deegree.framework.util.ImageUtils; import org.deegree.ogcwebservices.wcs.configuration.File;
|
import java.awt.image.*; import java.io.*; import org.deegree.framework.util.*; import org.deegree.ogcwebservices.wcs.configuration.*;
|
[
"java.awt",
"java.io",
"org.deegree.framework",
"org.deegree.ogcwebservices"
] |
java.awt; java.io; org.deegree.framework; org.deegree.ogcwebservices;
| 1,257,056
|
public void setPropertiesPersister(PropertiesPersister propertiesPersister) {
this.propertiesPersister =
(propertiesPersister != null ? propertiesPersister : new DefaultPropertiesPersister());
}
|
void function(PropertiesPersister propertiesPersister) { this.propertiesPersister = (propertiesPersister != null ? propertiesPersister : new DefaultPropertiesPersister()); }
|
/**
* Set the PropertiesPersister to use for parsing properties files.
* <p>The default is a DefaultPropertiesPersister.
* @see org.springframework.util.DefaultPropertiesPersister
*/
|
Set the PropertiesPersister to use for parsing properties files. The default is a DefaultPropertiesPersister
|
setPropertiesPersister
|
{
"repo_name": "lamsfoundation/lams",
"path": "3rdParty_sources/spring/org/springframework/context/support/ReloadableResourceBundleMessageSource.java",
"license": "gpl-2.0",
"size": 22006
}
|
[
"org.springframework.util.DefaultPropertiesPersister",
"org.springframework.util.PropertiesPersister"
] |
import org.springframework.util.DefaultPropertiesPersister; import org.springframework.util.PropertiesPersister;
|
import org.springframework.util.*;
|
[
"org.springframework.util"
] |
org.springframework.util;
| 1,266,588
|
public static void writeClass(String fileName, byte[] bytes) throws IOException {
try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
out.write(bytes);
}
}
|
static void function(String fileName, byte[] bytes) throws IOException { try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) { out.write(bytes); } }
|
/**
* Write all class bytes to a file.
*
* @param fileName file where the bytes will be written
* @param bytes bytes representing the class
* @throws IOException if we fail to write the class
*/
|
Write all class bytes to a file
|
writeClass
|
{
"repo_name": "easymock/objenesis",
"path": "exotic/src/main/java/org/objenesis/instantiator/exotic/util/ClassDefinitionUtils.java",
"license": "apache-2.0",
"size": 5921
}
|
[
"java.io.BufferedOutputStream",
"java.io.FileOutputStream",
"java.io.IOException"
] |
import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 706,914
|
public PrivacyState getTradePrivacy() {
return tradePrivacy;
}
|
PrivacyState function() { return tradePrivacy; }
|
/**
* Gets the trade {@link PrivacyState}.
*
* @return The privacy state.
*/
|
Gets the trade <code>PrivacyState</code>
|
getTradePrivacy
|
{
"repo_name": "Major-/apollo",
"path": "game/src/main/org/apollo/game/message/impl/PrivacyOptionMessage.java",
"license": "isc",
"size": 1692
}
|
[
"org.apollo.game.model.entity.setting.PrivacyState"
] |
import org.apollo.game.model.entity.setting.PrivacyState;
|
import org.apollo.game.model.entity.setting.*;
|
[
"org.apollo.game"
] |
org.apollo.game;
| 1,480,781
|
public void addParam(Property p) {
params.add(p);
}
|
void function(Property p) { params.add(p); }
|
/**
* Corresponds to <code><antcall></code>'s nested
* <code><param></code> element.
*
* @param p Property
*/
|
Corresponds to <code><antcall></code>'s nested <code><param></code> element
|
addParam
|
{
"repo_name": "antlibs/ant-contrib",
"path": "src/main/java/net/sf/antcontrib/logic/ForEach.java",
"license": "apache-2.0",
"size": 12912
}
|
[
"org.apache.tools.ant.taskdefs.Property"
] |
import org.apache.tools.ant.taskdefs.Property;
|
import org.apache.tools.ant.taskdefs.*;
|
[
"org.apache.tools"
] |
org.apache.tools;
| 1,005,055
|
public void setAppSearchData(Bundle appSearchData) {
mAppSearchData = appSearchData;
}
|
void function(Bundle appSearchData) { mAppSearchData = appSearchData; }
|
/**
* Sets the APP_DATA for legacy SearchDialog use.
* @param appSearchData bundle provided by the app when launching the search dialog
* @hide
*/
|
Sets the APP_DATA for legacy SearchDialog use
|
setAppSearchData
|
{
"repo_name": "JSDemos/android-sdk-20",
"path": "src/android/support/v7/widget/SearchView.java",
"license": "apache-2.0",
"size": 68684
}
|
[
"android.os.Bundle"
] |
import android.os.Bundle;
|
import android.os.*;
|
[
"android.os"
] |
android.os;
| 1,833,939
|
public List<League> getLeagueEntryBySummonerId(Long summonerId) {
return getLeagueEntryBySummonerId(new Long[]{summonerId}).get(summonerId.toString());
}
/**
* Queries for leagues of each team ID provided. A maximum of 10 team IDs can be provided.
*
* @param teamIds the IDs of the teams to lookup
* @return a {@link java.util.Map} containing a {@link java.util.List} of each {@link dto.league.League}
|
List<League> function(Long summonerId) { return getLeagueEntryBySummonerId(new Long[]{summonerId}).get(summonerId.toString()); } /** * Queries for leagues of each team ID provided. A maximum of 10 team IDs can be provided. * * @param teamIds the IDs of the teams to lookup * @return a {@link java.util.Map} containing a {@link java.util.List} of each {@link dto.league.League}
|
/**
* Helper function for the {@link #getLeagueEntryBySummonerId(Long...) getLeagueEntryBySummonerId} method when
* only a single summoner ID is provided.
*
* @param summonerId the ID of the summoner to lookup
* @return a {@link java.util.List} of each {@link dto.league.League} the summoner is a part of, only containing
* a {@link dto.league.LeagueEntry} for the summoner
*/
|
Helper function for the <code>#getLeagueEntryBySummonerId(Long...) getLeagueEntryBySummonerId</code> method when only a single summoner ID is provided
|
getLeagueEntryBySummonerId
|
{
"repo_name": "a64adam/ulti",
"path": "src/main/java/api/Ulti.java",
"license": "mit",
"size": 36883
}
|
[
"java.util.List",
"java.util.Map"
] |
import java.util.List; import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 715,315
|
public static Boolean getStereo(final Intent request) {
return parseBoolean(request, PARAM_STEREO);
}
|
static Boolean function(final Intent request) { return parseBoolean(request, PARAM_STEREO); }
|
/**
* Gets flag of Stereo mode from the specified request.
* @param request Request data
* @return flag of Stereo mode
*/
|
Gets flag of Stereo mode from the specified request
|
getStereo
|
{
"repo_name": "Onuzimoyr/dAndroid",
"path": "dConnectDevicePlugin/dConnectDeviceTheta/app/src/main/java/org/deviceconnect/android/profile/OmnidirectionalImageProfile.java",
"license": "mit",
"size": 10705
}
|
[
"android.content.Intent"
] |
import android.content.Intent;
|
import android.content.*;
|
[
"android.content"
] |
android.content;
| 785,703
|
Optional<SimpleStockTransaction> stockTransaction();
|
Optional<SimpleStockTransaction> stockTransaction();
|
/**
* An optional stockTransaction, if the unit is in motion.
*
* @return the optional stock transaction.
*/
|
An optional stockTransaction, if the unit is in motion
|
stockTransaction
|
{
"repo_name": "gg-net/dwoss",
"path": "api/stock/src/main/java/eu/ggnet/dwoss/stock/api/SimpleStockUnit.java",
"license": "gpl-3.0",
"size": 2126
}
|
[
"java.util.Optional"
] |
import java.util.Optional;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 306,742
|
@Override
public boolean hasNewUnorderedItem(LineItemReceivingDocument rlDoc){
boolean itemAdded = false;
for(LineItemReceivingItem rlItem: (List<LineItemReceivingItem>)rlDoc.getItems()){
if( PurapConstants.ItemTypeCodes.ITEM_TYPE_UNORDERED_ITEM_CODE.equals(rlItem.getItemTypeCode()) &&
!StringUtils.isEmpty(rlItem.getItemReasonAddedCode()) ){
itemAdded = true;
break;
}
}
return itemAdded;
}
|
boolean function(LineItemReceivingDocument rlDoc){ boolean itemAdded = false; for(LineItemReceivingItem rlItem: (List<LineItemReceivingItem>)rlDoc.getItems()){ if( PurapConstants.ItemTypeCodes.ITEM_TYPE_UNORDERED_ITEM_CODE.equals(rlItem.getItemTypeCode()) && !StringUtils.isEmpty(rlItem.getItemReasonAddedCode()) ){ itemAdded = true; break; } } return itemAdded; }
|
/**
* Checks the item list for newly added items.
*
* @param rlDoc
* @return
*/
|
Checks the item list for newly added items
|
hasNewUnorderedItem
|
{
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/purap/document/service/impl/ReceivingServiceImpl.java",
"license": "apache-2.0",
"size": 45711
}
|
[
"java.util.List",
"org.apache.commons.lang.StringUtils",
"org.kuali.kfs.module.purap.PurapConstants",
"org.kuali.kfs.module.purap.businessobject.LineItemReceivingItem",
"org.kuali.kfs.module.purap.document.LineItemReceivingDocument"
] |
import java.util.List; import org.apache.commons.lang.StringUtils; import org.kuali.kfs.module.purap.PurapConstants; import org.kuali.kfs.module.purap.businessobject.LineItemReceivingItem; import org.kuali.kfs.module.purap.document.LineItemReceivingDocument;
|
import java.util.*; import org.apache.commons.lang.*; import org.kuali.kfs.module.purap.*; import org.kuali.kfs.module.purap.businessobject.*; import org.kuali.kfs.module.purap.document.*;
|
[
"java.util",
"org.apache.commons",
"org.kuali.kfs"
] |
java.util; org.apache.commons; org.kuali.kfs;
| 2,610,548
|
@SystemApi
public void removeBlockedRating(TvContentRating rating) {
if (rating == null) {
throw new IllegalArgumentException("rating cannot be null");
}
try {
mService.removeBlockedRating(rating.flattenToString(), mUserId);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
}
|
void function(TvContentRating rating) { if (rating == null) { throw new IllegalArgumentException(STR); } try { mService.removeBlockedRating(rating.flattenToString(), mUserId); } catch (RemoteException e) { throw new RuntimeException(e); } }
|
/**
* Removes a user blocked content rating.
*
* @param rating The content rating to unblock.
* @see #isRatingBlocked
* @see #addBlockedRating
* @hide
*/
|
Removes a user blocked content rating
|
removeBlockedRating
|
{
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/base/media/java/android/media/tv/TvInputManager.java",
"license": "gpl-3.0",
"size": 72558
}
|
[
"android.os.RemoteException"
] |
import android.os.RemoteException;
|
import android.os.*;
|
[
"android.os"
] |
android.os;
| 1,604,179
|
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
MessagePull info = (MessagePull) o;
super.looseMarshal(wireFormat, o, dataOut);
looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
looseMarshalString(info.getCorrelationId(), dataOut);
looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
}
|
void function(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessagePull info = (MessagePull) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalLong(wireFormat, info.getTimeout(), dataOut); looseMarshalString(info.getCorrelationId(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut); }
|
/**
* Write the booleans that this object uses to a BooleanStream
*/
|
Write the booleans that this object uses to a BooleanStream
|
looseMarshal
|
{
"repo_name": "apache/activemq-openwire",
"path": "openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessagePullMarshaller.java",
"license": "apache-2.0",
"size": 5862
}
|
[
"java.io.DataOutput",
"java.io.IOException",
"org.apache.activemq.openwire.codec.OpenWireFormat",
"org.apache.activemq.openwire.commands.MessagePull"
] |
import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.MessagePull;
|
import java.io.*; import org.apache.activemq.openwire.codec.*; import org.apache.activemq.openwire.commands.*;
|
[
"java.io",
"org.apache.activemq"
] |
java.io; org.apache.activemq;
| 380,657
|
public static void show(
final Activity activity,
final String groupId) {
new JoinAppGroupDialog(activity).show(groupId);
}
|
static void function( final Activity activity, final String groupId) { new JoinAppGroupDialog(activity).show(groupId); }
|
/**
* Shows an {@link JoinAppGroupDialog} to join a group with the passed in Id, using
* the passed in activity. No callback will be invoked.
*
* @param activity Activity hosting the dialog
* @param groupId Id of the group to join
*/
|
Shows an <code>JoinAppGroupDialog</code> to join a group with the passed in Id, using the passed in activity. No callback will be invoked
|
show
|
{
"repo_name": "carlesls2/sitappandroidv1",
"path": "prova/facebook/src/com/facebook/share/widget/JoinAppGroupDialog.java",
"license": "lgpl-3.0",
"size": 5970
}
|
[
"android.app.Activity"
] |
import android.app.Activity;
|
import android.app.*;
|
[
"android.app"
] |
android.app;
| 1,188,420
|
public void doData(StaplerResponse rsp) throws IOException {
rsp.setContentType("application/javascript");
rsp.getWriter().println("downloadService.post('test',{'hello':"+hashCode()+"})");
}
|
void function(StaplerResponse rsp) throws IOException { rsp.setContentType(STR); rsp.getWriter().println(STR+hashCode()+"})"); }
|
/**
* This is where the browser should hit to retrieve data.
*/
|
This is where the browser should hit to retrieve data
|
doData
|
{
"repo_name": "ErikVerheul/jenkins",
"path": "test/src/test/java/hudson/model/DownloadServiceTest.java",
"license": "mit",
"size": 8245
}
|
[
"java.io.IOException",
"org.kohsuke.stapler.StaplerResponse"
] |
import java.io.IOException; import org.kohsuke.stapler.StaplerResponse;
|
import java.io.*; import org.kohsuke.stapler.*;
|
[
"java.io",
"org.kohsuke.stapler"
] |
java.io; org.kohsuke.stapler;
| 2,085,675
|
public final void enforceAutoCommit(boolean autoCommit) throws SQLException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "enforceAutoCommit", autoCommit);
// Only set values if the requested value is different from the current value,
// or if required as a workaround.
if (autoCommit != currentAutoCommit || helper.alwaysSetAutoCommit())
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc,
"currentAutoCommit: " + currentAutoCommit + " --> " + autoCommit);
sqlConn.setAutoCommit(autoCommit);
currentAutoCommit = autoCommit;
}
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(this, tc, "enforceAutoCommit");
}
}
|
final void function(boolean autoCommit) throws SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, STR, autoCommit); if (autoCommit != currentAutoCommit helper.alwaysSetAutoCommit()) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, STR + currentAutoCommit + STR + autoCommit); sqlConn.setAutoCommit(autoCommit); currentAutoCommit = autoCommit; } if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(this, tc, STR); } }
|
/**
* Enforce the autoCommit setting in the underlying database and update the current value
* on the MC. This method must be invoked by the Connection handle before doing any work
* on the database.
*
* @param autoCommit Indicates if the autoCommit is true or false.
*
* @throws SQLException if an error occurs setting the AutoCommit. This exception
* is not mapped. Any mapping required is the caller's responsibility.
*/
|
Enforce the autoCommit setting in the underlying database and update the current value on the MC. This method must be invoked by the Connection handle before doing any work on the database
|
enforceAutoCommit
|
{
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java",
"license": "epl-1.0",
"size": 206781
}
|
[
"com.ibm.websphere.ras.Tr",
"com.ibm.websphere.ras.TraceComponent",
"java.sql.SQLException"
] |
import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent; import java.sql.SQLException;
|
import com.ibm.websphere.ras.*; import java.sql.*;
|
[
"com.ibm.websphere",
"java.sql"
] |
com.ibm.websphere; java.sql;
| 991,663
|
final int NUM_MASTERS = 3;
final int NUM_RS = 3;
// Create config to use for this cluster
Configuration conf = HBaseConfiguration.create();
// Start the cluster
HBaseTestingUtility htu = new HBaseTestingUtility(conf);
htu.startMiniCluster(NUM_MASTERS, NUM_RS);
MiniHBaseCluster cluster = htu.getHBaseCluster();
// get all the master threads
List<MasterThread> masterThreads = cluster.getMasterThreads();
// wait for each to come online
for (MasterThread mt : masterThreads) {
assertTrue(mt.isAlive());
}
// find the active master
HMaster active = null;
for (int i = 0; i < masterThreads.size(); i++) {
if (masterThreads.get(i).getMaster().isActiveMaster()) {
active = masterThreads.get(i).getMaster();
break;
}
}
assertNotNull(active);
// make sure the other two are backup masters
ClusterStatus status = active.getClusterStatus();
assertEquals(2, status.getBackupMastersSize());
assertEquals(2, status.getBackupMasters().size());
// tell the active master to shutdown the cluster
active.shutdown();
for (int i = NUM_MASTERS - 1; i >= 0 ;--i) {
cluster.waitOnMaster(i);
}
// make sure all the masters properly shutdown
assertEquals(0, masterThreads.size());
htu.shutdownMiniCluster();
}
|
final int NUM_MASTERS = 3; final int NUM_RS = 3; Configuration conf = HBaseConfiguration.create(); HBaseTestingUtility htu = new HBaseTestingUtility(conf); htu.startMiniCluster(NUM_MASTERS, NUM_RS); MiniHBaseCluster cluster = htu.getHBaseCluster(); List<MasterThread> masterThreads = cluster.getMasterThreads(); for (MasterThread mt : masterThreads) { assertTrue(mt.isAlive()); } HMaster active = null; for (int i = 0; i < masterThreads.size(); i++) { if (masterThreads.get(i).getMaster().isActiveMaster()) { active = masterThreads.get(i).getMaster(); break; } } assertNotNull(active); ClusterStatus status = active.getClusterStatus(); assertEquals(2, status.getBackupMastersSize()); assertEquals(2, status.getBackupMasters().size()); active.shutdown(); for (int i = NUM_MASTERS - 1; i >= 0 ;--i) { cluster.waitOnMaster(i); } assertEquals(0, masterThreads.size()); htu.shutdownMiniCluster(); }
|
/**
* Simple test of shutdown.
* <p>
* Starts with three masters. Tells the active master to shutdown the cluster.
* Verifies that all masters are properly shutdown.
* @throws Exception
*/
|
Simple test of shutdown. Starts with three masters. Tells the active master to shutdown the cluster. Verifies that all masters are properly shutdown
|
testMasterShutdown
|
{
"repo_name": "juwi/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java",
"license": "apache-2.0",
"size": 5509
}
|
[
"java.util.List",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.ClusterStatus",
"org.apache.hadoop.hbase.HBaseConfiguration",
"org.apache.hadoop.hbase.HBaseTestingUtility",
"org.apache.hadoop.hbase.MiniHBaseCluster",
"org.apache.hadoop.hbase.util.JVMClusterUtil",
"org.junit.Assert"
] |
import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.ClusterStatus; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.util.JVMClusterUtil; import org.junit.Assert;
|
import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
|
[
"java.util",
"org.apache.hadoop",
"org.junit"
] |
java.util; org.apache.hadoop; org.junit;
| 1,972,627
|
public void deleteComment(WorkflowComment comment) throws DotDataException;
|
void function(WorkflowComment comment) throws DotDataException;
|
/**
* deletes a specific comment on a workflow item
*
* @param comment
* @throws DotDataException
*/
|
deletes a specific comment on a workflow item
|
deleteComment
|
{
"repo_name": "zhiqinghuang/core",
"path": "src/com/dotmarketing/portlets/workflows/business/WorkflowAPI.java",
"license": "gpl-3.0",
"size": 9608
}
|
[
"com.dotmarketing.exception.DotDataException",
"com.dotmarketing.portlets.workflows.model.WorkflowComment"
] |
import com.dotmarketing.exception.DotDataException; import com.dotmarketing.portlets.workflows.model.WorkflowComment;
|
import com.dotmarketing.exception.*; import com.dotmarketing.portlets.workflows.model.*;
|
[
"com.dotmarketing.exception",
"com.dotmarketing.portlets"
] |
com.dotmarketing.exception; com.dotmarketing.portlets;
| 1,164,238
|
private boolean isContextual(Method method) {
Class[] list = method.getParameterTypes();
if(list.length == 1) {
return Map.class.equals(list[0]);
}
return false;
}
|
boolean function(Method method) { Class[] list = method.getParameterTypes(); if(list.length == 1) { return Map.class.equals(list[0]); } return false; }
|
/**
* This is used to determine whether the annotated method takes a
* contextual object. If the method takes a <code>Map</code> then
* this returns true, otherwise it returns false.
*
* @param method this is the method to check the parameters of
*
* @return this returns true if the method takes a map object
*/
|
This is used to determine whether the annotated method takes a contextual object. If the method takes a <code>Map</code> then this returns true, otherwise it returns false
|
isContextual
|
{
"repo_name": "glorycloud/GloryMail",
"path": "CloudyMail/lib_src/org/simpleframework/xml/core/ClassScanner.java",
"license": "apache-2.0",
"size": 19862
}
|
[
"java.lang.reflect.Method",
"java.util.Map"
] |
import java.lang.reflect.Method; import java.util.Map;
|
import java.lang.reflect.*; import java.util.*;
|
[
"java.lang",
"java.util"
] |
java.lang; java.util;
| 1,500,515
|
public static Intent createIntent(final Repository repository,
final String base, final String head) {
Builder builder = new Builder("commits.compare.VIEW");
builder.add(EXTRA_BASE, base);
builder.add(EXTRA_HEAD, head);
builder.repo(repository);
return builder.toIntent();
}
private Repository repository;
@Inject
private AvatarLoader avatars;
private Fragment fragment;
|
static Intent function(final Repository repository, final String base, final String head) { Builder builder = new Builder(STR); builder.add(EXTRA_BASE, base); builder.add(EXTRA_HEAD, head); builder.repo(repository); return builder.toIntent(); } private Repository repository; private AvatarLoader avatars; private Fragment fragment;
|
/**
* Create intent for this activity
*
* @param repository
* @param base
* @param head
* @return intent
*/
|
Create intent for this activity
|
createIntent
|
{
"repo_name": "Yifei0727/GitHub-Client-md",
"path": "app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java",
"license": "apache-2.0",
"size": 3525
}
|
[
"android.content.Intent",
"android.support.v4.app.Fragment",
"com.github.mobile.Intents",
"com.github.mobile.util.AvatarLoader",
"org.eclipse.egit.github.core.Repository"
] |
import android.content.Intent; import android.support.v4.app.Fragment; import com.github.mobile.Intents; import com.github.mobile.util.AvatarLoader; import org.eclipse.egit.github.core.Repository;
|
import android.content.*; import android.support.v4.app.*; import com.github.mobile.*; import com.github.mobile.util.*; import org.eclipse.egit.github.core.*;
|
[
"android.content",
"android.support",
"com.github.mobile",
"org.eclipse.egit"
] |
android.content; android.support; com.github.mobile; org.eclipse.egit;
| 1,012,050
|
public String encrypt() throws BlobCrypterException {
Map<String, String> values = buildValuesMap();
return container + ':' + crypter.wrap(values);
}
|
String function() throws BlobCrypterException { Map<String, String> values = buildValuesMap(); return container + ':' + crypter.wrap(values); }
|
/**
* Encrypt and sign the token. The returned value is *not* web safe, it should be URL
* encoded before being used as a form parameter.
*/
|
Encrypt and sign the token. The returned value is *not* web safe, it should be URL encoded before being used as a form parameter
|
encrypt
|
{
"repo_name": "inevo/shindig-1.1-BETA5-incubating",
"path": "java/common/src/main/java/org/apache/shindig/auth/BlobCrypterSecurityToken.java",
"license": "apache-2.0",
"size": 6211
}
|
[
"java.util.Map",
"org.apache.shindig.common.crypto.BlobCrypterException"
] |
import java.util.Map; import org.apache.shindig.common.crypto.BlobCrypterException;
|
import java.util.*; import org.apache.shindig.common.crypto.*;
|
[
"java.util",
"org.apache.shindig"
] |
java.util; org.apache.shindig;
| 1,895,388
|
public static void appendStringToFile(final String text, final String fileName,
final int bufSize, final Charset charset) {
checkFileName(fileName);
final File file = new File(fileName);
if (!file.isFile()) { // does not exist
try {
file.createNewFile();
} catch (final Exception e) {
throw new RuntimeException("Cannot create file: " + fileName + LS + e);
}
}
try (BufferedWriter bw = openBufferedWriter(file, bufSize, true, charset);
PrintWriter out = new PrintWriter(bw);) {
out.print(text);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
|
static void function(final String text, final String fileName, final int bufSize, final Charset charset) { checkFileName(fileName); final File file = new File(fileName); if (!file.isFile()) { try { file.createNewFile(); } catch (final Exception e) { throw new RuntimeException(STR + fileName + LS + e); } } try (BufferedWriter bw = openBufferedWriter(file, bufSize, true, charset); PrintWriter out = new PrintWriter(bw);) { out.print(text); } catch (final IOException e) { throw new RuntimeException(e); } }
|
/**
* Appends a String to a file using a BufferedWriter, bufSize and Charset. If
* fileName does not exist, this creates a new empty file of that name. This
* closes the file after appending.
*
* @param text is the source String.
* @param fileName the given fileName
* @param bufSize if less than 8192 it defaults to 8192.
* @param charset The Charset to use when converting the source string
* (UTF-16) to a sequence of encoded bytes of the Charset.
* @throws RuntimeException if IOException or SecurityException occurs, or if
* fileName is null or empty.
*/
|
Appends a String to a file using a BufferedWriter, bufSize and Charset. If fileName does not exist, this creates a new empty file of that name. This closes the file after appending
|
appendStringToFile
|
{
"repo_name": "DataSketches/DataSketches.github.io",
"path": "src/main/java/org/apache/datasketches/Files.java",
"license": "apache-2.0",
"size": 37488
}
|
[
"java.io.BufferedWriter",
"java.io.File",
"java.io.IOException",
"java.io.PrintWriter",
"java.nio.charset.Charset"
] |
import java.io.BufferedWriter; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.Charset;
|
import java.io.*; import java.nio.charset.*;
|
[
"java.io",
"java.nio"
] |
java.io; java.nio;
| 1,832,602
|
public List<CoordinatePair> placeShip(int x, int y, Ship s, Direction dir) {
boolean placementOK = true;
x = x+1;
y = y+1;
List<CoordinatePair> liste = new ArrayList<CoordinatePair>();
System.out.println("placing ship");
if (dir == Direction.HORIZONTAL) // Left to Right
{
for (int i = x; i < x+s.getFields(); i++) {
if (!checkSurrounding(i, y))
System.out.println("checking "+i+","+y);
placementOK = false;
}
if (placementOK) {
for (int i = x,j = 0; i < x+s.getFields(); i++,j++) {
_fields[i][y] = s;
System.out.println("adding coord at horiz"+j);
liste.add( new CoordinatePair(i, y));
}
}
} else // top to bottom
{
for (int i = y; i < y+s.getFields(); i++) {
if (!checkSurrounding(x, i))
System.out.println("checking "+i+","+y);
placementOK = false;
}
if (placementOK) {
for (int i = y,j=0; i < y+s.getFields(); i++,j++) {
_fields[x][i] = s;
liste.add(new CoordinatePair(x, i));
System.out.println("adding coord at vert"+j);
}
}
}
System.out.println("placement ok? "+placementOK);
if (!placementOK)
return null;
else
return liste;
}
|
List<CoordinatePair> function(int x, int y, Ship s, Direction dir) { boolean placementOK = true; x = x+1; y = y+1; List<CoordinatePair> liste = new ArrayList<CoordinatePair>(); System.out.println(STR); if (dir == Direction.HORIZONTAL) { for (int i = x; i < x+s.getFields(); i++) { if (!checkSurrounding(i, y)) System.out.println(STR+i+","+y); placementOK = false; } if (placementOK) { for (int i = x,j = 0; i < x+s.getFields(); i++,j++) { _fields[i][y] = s; System.out.println(STR+j); liste.add( new CoordinatePair(i, y)); } } } else { for (int i = y; i < y+s.getFields(); i++) { if (!checkSurrounding(x, i)) System.out.println(STR+i+","+y); placementOK = false; } if (placementOK) { for (int i = y,j=0; i < y+s.getFields(); i++,j++) { _fields[x][i] = s; liste.add(new CoordinatePair(x, i)); System.out.println(STR+j); } } } System.out.println(STR+placementOK); if (!placementOK) return null; else return liste; }
|
/**
* Places a Ship on the Board
* Returns false if not placeable
* @param x
* @param y
* @param s
* @param dir
* @return
*/
|
Places a Ship on the Board Returns false if not placeable
|
placeShip
|
{
"repo_name": "guusdk/Spark",
"path": "plugins/battleships/src/main/java/battleship/logic/GameBoard.java",
"license": "apache-2.0",
"size": 3831
}
|
[
"java.util.ArrayList",
"java.util.List"
] |
import java.util.ArrayList; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,494,653
|
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
this.fontRendererObj.drawString(this.inventory.getInventoryName(), this.xSize / 3 - this.fontRendererObj.getStringWidth(this.inventory.getInventoryName()) / 2, 4, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
|
void function(int p_146979_1_, int p_146979_2_) { this.fontRendererObj.drawString(this.inventory.getInventoryName(), this.xSize / 3 - this.fontRendererObj.getStringWidth(this.inventory.getInventoryName()) / 2, 4, 4210752); this.fontRendererObj.drawString(I18n.format(STR, new Object[0]), 8, this.ySize - 96 + 2, 4210752); }
|
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
|
Draw the foreground layer for the GuiContainer (everything in front of the items)
|
drawGuiContainerForegroundLayer
|
{
"repo_name": "Sudwood/AdvancedUtilities",
"path": "java/com/sudwood/advancedutilities/client/gui/GuiBag.java",
"license": "mit",
"size": 2430
}
|
[
"net.minecraft.client.resources.I18n"
] |
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.*;
|
[
"net.minecraft.client"
] |
net.minecraft.client;
| 635,213
|
@Test(enabled = true, dataProvider = "QueryTests", groups = { "api","noproxy" })
@QueryFile(list = {})
public void testRESTExternalPUT(String query) throws YADAResponseException, YADAQueryConfigurationException, YADAExecutionException
{
Service svc = prepareTest(query);
YADARequest yadaReq = svc.getYADARequest();
yadaReq.setMethod(new String[] {YADARequest.METHOD_PUT});
String result = svc.execute();
Assert.assertTrue(validateThirdPartyJSONResult(result) , "Data invalid for query: "+query);
}
|
@Test(enabled = true, dataProvider = STR, groups = { "api",STR }) @QueryFile(list = {}) void function(String query) throws YADAResponseException, YADAQueryConfigurationException, YADAExecutionException { Service svc = prepareTest(query); YADARequest yadaReq = svc.getYADARequest(); yadaReq.setMethod(new String[] {YADARequest.METHOD_PUT}); String result = svc.execute(); Assert.assertTrue(validateThirdPartyJSONResult(result) , STR+query); }
|
/**
* Tests execution of a REST query using YADA as a proxy, and using HTTP PUT
*
* @param query the query to execute
* @throws YADAQueryConfigurationException when request creation fails
* @throws JSONException when the result does not conform
* @throws YADAResponseException when the test result is invalid
* @throws YADAExecutionException when the test execution fails
*/
|
Tests execution of a REST query using YADA as a proxy, and using HTTP PUT
|
testRESTExternalPUT
|
{
"repo_name": "Novartis/YADA",
"path": "yada-api/src/test/java/com/novartis/opensource/yada/test/ServiceTest.java",
"license": "apache-2.0",
"size": 90877
}
|
[
"com.novartis.opensource.yada.Service",
"com.novartis.opensource.yada.YADAExecutionException",
"com.novartis.opensource.yada.YADAQueryConfigurationException",
"com.novartis.opensource.yada.YADARequest",
"com.novartis.opensource.yada.format.YADAResponseException",
"org.testng.Assert",
"org.testng.annotations.Test"
] |
import com.novartis.opensource.yada.Service; import com.novartis.opensource.yada.YADAExecutionException; import com.novartis.opensource.yada.YADAQueryConfigurationException; import com.novartis.opensource.yada.YADARequest; import com.novartis.opensource.yada.format.YADAResponseException; import org.testng.Assert; import org.testng.annotations.Test;
|
import com.novartis.opensource.yada.*; import com.novartis.opensource.yada.format.*; import org.testng.*; import org.testng.annotations.*;
|
[
"com.novartis.opensource",
"org.testng",
"org.testng.annotations"
] |
com.novartis.opensource; org.testng; org.testng.annotations;
| 1,976,986
|
public void init(ApplicationConnection connection,
PushConfigurationState pushConfigurationState,
CommunicationErrorHandler errorHandler);
|
void function(ApplicationConnection connection, PushConfigurationState pushConfigurationState, CommunicationErrorHandler errorHandler);
|
/**
* Two-phase construction to allow using GWT.create().
*
* @param connection
* The ApplicationConnection
*/
|
Two-phase construction to allow using GWT.create()
|
init
|
{
"repo_name": "Flamenco/vaadin",
"path": "client/src/com/vaadin/client/communication/PushConnection.java",
"license": "apache-2.0",
"size": 3923
}
|
[
"com.vaadin.client.ApplicationConnection",
"com.vaadin.shared.ui.ui.UIState"
] |
import com.vaadin.client.ApplicationConnection; import com.vaadin.shared.ui.ui.UIState;
|
import com.vaadin.client.*; import com.vaadin.shared.ui.ui.*;
|
[
"com.vaadin.client",
"com.vaadin.shared"
] |
com.vaadin.client; com.vaadin.shared;
| 2,158,341
|
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ResourceSkuInner> listAsync(String filter) {
return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink));
}
|
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ResourceSkuInner> function(String filter) { return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); }
|
/**
* Gets the list of Microsoft.Compute SKUs available for your Subscription.
*
* @param filter The filter to apply on the operation. Only **location** filter is supported currently.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of Microsoft.Compute SKUs available for your Subscription.
*/
|
Gets the list of Microsoft.Compute SKUs available for your Subscription
|
listAsync
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/ResourceSkusClientImpl.java",
"license": "mit",
"size": 14877
}
|
[
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.compute.fluent.models.ResourceSkuInner"
] |
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.compute.fluent.models.ResourceSkuInner;
|
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.compute.fluent.models.*;
|
[
"com.azure.core",
"com.azure.resourcemanager"
] |
com.azure.core; com.azure.resourcemanager;
| 379,062
|
protected PlanningSet getFragmentsHelper(Collection<DrillbitEndpoint> activeEndpoints, Fragment rootFragment) throws ExecutionSetupException {
PlanningSet planningSet = new PlanningSet();
initFragmentWrappers(rootFragment, planningSet);
final Set<Wrapper> leafFragments = constructFragmentDependencyGraph(planningSet);
// Start parallelizing from leaf fragments
for (Wrapper wrapper : leafFragments) {
parallelizeFragment(wrapper, planningSet, activeEndpoints);
}
return planningSet;
}
|
PlanningSet function(Collection<DrillbitEndpoint> activeEndpoints, Fragment rootFragment) throws ExecutionSetupException { PlanningSet planningSet = new PlanningSet(); initFragmentWrappers(rootFragment, planningSet); final Set<Wrapper> leafFragments = constructFragmentDependencyGraph(planningSet); for (Wrapper wrapper : leafFragments) { parallelizeFragment(wrapper, planningSet, activeEndpoints); } return planningSet; }
|
/**
* Helper method to reuse the code for QueryWorkUnit(s) generation
* @param activeEndpoints
* @param rootFragment
* @return
* @throws ExecutionSetupException
*/
|
Helper method to reuse the code for QueryWorkUnit(s) generation
|
getFragmentsHelper
|
{
"repo_name": "shakamunyi/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/SimpleParallelizer.java",
"license": "apache-2.0",
"size": 16028
}
|
[
"java.util.Collection",
"java.util.Set",
"org.apache.drill.common.exceptions.ExecutionSetupException",
"org.apache.drill.exec.proto.CoordinationProtos"
] |
import java.util.Collection; import java.util.Set; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.proto.CoordinationProtos;
|
import java.util.*; import org.apache.drill.common.exceptions.*; import org.apache.drill.exec.proto.*;
|
[
"java.util",
"org.apache.drill"
] |
java.util; org.apache.drill;
| 1,170,961
|
public static String getPathForBranch(State state, String path, int numBranches, int branchId) {
Preconditions.checkNotNull(state);
Preconditions.checkNotNull(path);
Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative");
Preconditions.checkArgument(branchId >= 0, "The branch id is expected to be non-negative");
return numBranches > 1 ? path
+ Path.SEPARATOR
+ state.getProp(ConfigurationKeys.FORK_BRANCH_NAME_KEY + "." + branchId,
ConfigurationKeys.DEFAULT_FORK_BRANCH_NAME + branchId) : path;
}
|
static String function(State state, String path, int numBranches, int branchId) { Preconditions.checkNotNull(state); Preconditions.checkNotNull(path); Preconditions.checkArgument(numBranches >= 0, STR); Preconditions.checkArgument(branchId >= 0, STR); return numBranches > 1 ? path + Path.SEPARATOR + state.getProp(ConfigurationKeys.FORK_BRANCH_NAME_KEY + "." + branchId, ConfigurationKeys.DEFAULT_FORK_BRANCH_NAME + branchId) : path; }
|
/**
* Get a new path with the given branch name as a sub directory.
*
* @param numBranches number of branches (non-negative)
* @param branchId branch id (non-negative)
* @return a new path
*/
|
Get a new path with the given branch name as a sub directory
|
getPathForBranch
|
{
"repo_name": "liyinan926/gobblin",
"path": "gobblin-utility/src/main/java/gobblin/util/ForkOperatorUtils.java",
"license": "apache-2.0",
"size": 4342
}
|
[
"com.google.common.base.Preconditions",
"org.apache.hadoop.fs.Path"
] |
import com.google.common.base.Preconditions; import org.apache.hadoop.fs.Path;
|
import com.google.common.base.*; import org.apache.hadoop.fs.*;
|
[
"com.google.common",
"org.apache.hadoop"
] |
com.google.common; org.apache.hadoop;
| 2,078,906
|
protected void processLog() throws IOException {
final List tempFiles = new LinkedList();
try {
// check if it's a directory
if (!super.agent.pathIsFile(fullyQualifiedResultPath)) {
reportLogPathIsNotFile();
return;
}
// get log and make an archive copy
final String archiveFileName = archiveManager.makeNewLogFileNameOnly(); // just a file name, w/o path
final File archiveFile = archiveManager.fileNameToLogPath(archiveFileName);
agent.readFile(super.fullyQualifiedResultPath, archiveFile);
// check if any
if (!archiveFile.exists()) {
return;
}
// save log info in the db if necessary
// parse
if (log.isDebugEnabled()) {
log.debug("parse ");
}
final SAXReader reader = new SAXReader();
final Document checkstyle = reader.read(archiveFile);
// get and save
if (log.isDebugEnabled()) {
log.debug("get statistics ");
}
final int problemFileCount = XMLUtils.intValueOf(checkstyle, "count(/checkstyle/file[count(error) > 0])");
final int fileCount = XMLUtils.intValueOf(checkstyle, "count(/checkstyle/file)");
final int problemCount = XMLUtils.intValueOf(checkstyle, "count(/checkstyle/file/error)");
cm.addStepStatistics(super.stepRunID, StepRunAttribute.ATTR_CHECKSTYLE_ERRORS, problemCount);
cm.addStepStatistics(super.stepRunID, StepRunAttribute.ATTR_CHECKSTYLE_FILES_WITH_PROBLEMS, problemFileCount);
cm.addStepStatistics(super.stepRunID, StepRunAttribute.ATTR_CHECKSTYLE_FILES, fileCount);
cm.addRunStatistics(buildRunID, BuildRunAttribute.ATTR_CHECKSTYLE_ERRORS, problemCount);
cm.addRunStatistics(buildRunID, BuildRunAttribute.ATTR_CHECKSTYLE_FILES_WITH_PROBLEMS, problemFileCount);
cm.addRunStatistics(buildRunID, BuildRunAttribute.ATTR_CHECKSTYLE_FILES, fileCount);
// save log info
final StepLog stepLog = new StepLog();
stepLog.setStepRunID(super.stepRunID);
stepLog.setDescription(super.logConfig.getDescription());
stepLog.setPath(resolvedResultPath);
stepLog.setArchiveFileName(archiveFileName);
stepLog.setType(StepLog.TYPE_CUSTOM);
stepLog.setPathType(StepLog.PATH_TYPE_CHECKSTYLE_XML); // path type is file
stepLog.setFound((byte) 1);
cm.save(stepLog);
} catch (Exception e) {
throw IoUtils.createIOException(StringUtils.toString(e), e);
} finally {
IoUtils.deleteFilesHard(tempFiles);
}
}
|
void function() throws IOException { final List tempFiles = new LinkedList(); try { if (!super.agent.pathIsFile(fullyQualifiedResultPath)) { reportLogPathIsNotFile(); return; } final String archiveFileName = archiveManager.makeNewLogFileNameOnly(); final File archiveFile = archiveManager.fileNameToLogPath(archiveFileName); agent.readFile(super.fullyQualifiedResultPath, archiveFile); if (!archiveFile.exists()) { return; } if (log.isDebugEnabled()) { log.debug(STR); } final SAXReader reader = new SAXReader(); final Document checkstyle = reader.read(archiveFile); if (log.isDebugEnabled()) { log.debug(STR); } final int problemFileCount = XMLUtils.intValueOf(checkstyle, STR); final int fileCount = XMLUtils.intValueOf(checkstyle, STR); final int problemCount = XMLUtils.intValueOf(checkstyle, STR); cm.addStepStatistics(super.stepRunID, StepRunAttribute.ATTR_CHECKSTYLE_ERRORS, problemCount); cm.addStepStatistics(super.stepRunID, StepRunAttribute.ATTR_CHECKSTYLE_FILES_WITH_PROBLEMS, problemFileCount); cm.addStepStatistics(super.stepRunID, StepRunAttribute.ATTR_CHECKSTYLE_FILES, fileCount); cm.addRunStatistics(buildRunID, BuildRunAttribute.ATTR_CHECKSTYLE_ERRORS, problemCount); cm.addRunStatistics(buildRunID, BuildRunAttribute.ATTR_CHECKSTYLE_FILES_WITH_PROBLEMS, problemFileCount); cm.addRunStatistics(buildRunID, BuildRunAttribute.ATTR_CHECKSTYLE_FILES, fileCount); final StepLog stepLog = new StepLog(); stepLog.setStepRunID(super.stepRunID); stepLog.setDescription(super.logConfig.getDescription()); stepLog.setPath(resolvedResultPath); stepLog.setArchiveFileName(archiveFileName); stepLog.setType(StepLog.TYPE_CUSTOM); stepLog.setPathType(StepLog.PATH_TYPE_CHECKSTYLE_XML); stepLog.setFound((byte) 1); cm.save(stepLog); } catch (Exception e) { throw IoUtils.createIOException(StringUtils.toString(e), e); } finally { IoUtils.deleteFilesHard(tempFiles); } }
|
/**
* Concrete processing.
*
* @throws IOException
*/
|
Concrete processing
|
processLog
|
{
"repo_name": "simeshev/parabuild-ci",
"path": "src/org/parabuild/ci/build/log/CheckstyleLogHandler.java",
"license": "lgpl-3.0",
"size": 5298
}
|
[
"java.io.File",
"java.io.IOException",
"java.util.LinkedList",
"java.util.List",
"org.dom4j.Document",
"org.dom4j.io.SAXReader",
"org.parabuild.ci.common.IoUtils",
"org.parabuild.ci.common.StringUtils",
"org.parabuild.ci.common.XMLUtils",
"org.parabuild.ci.object.BuildRunAttribute",
"org.parabuild.ci.object.StepLog",
"org.parabuild.ci.object.StepRunAttribute"
] |
import java.io.File; import java.io.IOException; import java.util.LinkedList; import java.util.List; import org.dom4j.Document; import org.dom4j.io.SAXReader; import org.parabuild.ci.common.IoUtils; import org.parabuild.ci.common.StringUtils; import org.parabuild.ci.common.XMLUtils; import org.parabuild.ci.object.BuildRunAttribute; import org.parabuild.ci.object.StepLog; import org.parabuild.ci.object.StepRunAttribute;
|
import java.io.*; import java.util.*; import org.dom4j.*; import org.dom4j.io.*; import org.parabuild.ci.common.*; import org.parabuild.ci.object.*;
|
[
"java.io",
"java.util",
"org.dom4j",
"org.dom4j.io",
"org.parabuild.ci"
] |
java.io; java.util; org.dom4j; org.dom4j.io; org.parabuild.ci;
| 251,296
|
public static void privateEndpointConnectionsList(
com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager) {
manager
.iotDpsResources()
.listPrivateEndpointConnectionsWithResponse("myResourceGroup", "myFirstProvisioningService", Context.NONE);
}
|
static void function( com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager) { manager .iotDpsResources() .listPrivateEndpointConnectionsWithResponse(STR, STR, Context.NONE); }
|
/**
* Sample code: PrivateEndpointConnections_List.
*
* @param manager Entry point to IotDpsManager.
*/
|
Sample code: PrivateEndpointConnections_List
|
privateEndpointConnectionsList
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/samples/java/com/azure/resourcemanager/deviceprovisioningservices/generated/IotDpsResourceListPrivateEndpointConnectionsSamples.java",
"license": "mit",
"size": 1034
}
|
[
"com.azure.core.util.Context"
] |
import com.azure.core.util.Context;
|
import com.azure.core.util.*;
|
[
"com.azure.core"
] |
com.azure.core;
| 175,340
|
private void putTimePropertiesInContext(Context context, SessionState state, String timeName,
String month, String day, String year, String hour, String min) {
// get the submission level of close date setting
context.put("name_" + timeName + "Month", month);
context.put("name_" + timeName + "Day", day);
context.put("name_" + timeName + "Year", year);
context.put("name_" + timeName + "Hour", hour);
context.put("name_" + timeName + "Min", min);
context.put("value_" + timeName + "Month", (Integer) state.getAttribute(month));
context.put("value_" + timeName + "Day", (Integer) state.getAttribute(day));
context.put("value_" + timeName + "Year", (Integer) state.getAttribute(year));
context.put("value_" + timeName + "Hour", (Integer) state.getAttribute(hour));
context.put("value_" + timeName + "Min", (Integer) state.getAttribute(min));
}
|
void function(Context context, SessionState state, String timeName, String month, String day, String year, String hour, String min) { context.put("name_" + timeName + "Month", month); context.put("name_" + timeName + "Day", day); context.put("name_" + timeName + "Year", year); context.put("name_" + timeName + "Hour", hour); context.put("name_" + timeName + "Min", min); context.put(STR + timeName + "Month", (Integer) state.getAttribute(month)); context.put(STR + timeName + "Day", (Integer) state.getAttribute(day)); context.put(STR + timeName + "Year", (Integer) state.getAttribute(year)); context.put(STR + timeName + "Hour", (Integer) state.getAttribute(hour)); context.put(STR + timeName + "Min", (Integer) state.getAttribute(min)); }
|
/**
* put related time information into context variable
* @param context
* @param state
* @param timeName
* @param month
* @param day
* @param year
* @param hour
* @param min
*/
|
put related time information into context variable
|
putTimePropertiesInContext
|
{
"repo_name": "lorenamgUMU/sakai",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 677150
}
|
[
"org.sakaiproject.cheftool.Context",
"org.sakaiproject.event.api.SessionState"
] |
import org.sakaiproject.cheftool.Context; import org.sakaiproject.event.api.SessionState;
|
import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*;
|
[
"org.sakaiproject.cheftool",
"org.sakaiproject.event"
] |
org.sakaiproject.cheftool; org.sakaiproject.event;
| 868,536
|
Call<ResponseBody> patch302Async(Boolean booleanValue, final ServiceCallback<Void> serviceCallback);
|
Call<ResponseBody> patch302Async(Boolean booleanValue, final ServiceCallback<Void> serviceCallback);
|
/**
* Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation
*
* @param booleanValue Simple boolean value true
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/
|
Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation
|
patch302Async
|
{
"repo_name": "BretJohnson/autorest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirects.java",
"license": "mit",
"size": 11914
}
|
[
"com.microsoft.rest.ServiceCallback",
"com.squareup.okhttp.ResponseBody"
] |
import com.microsoft.rest.ServiceCallback; import com.squareup.okhttp.ResponseBody;
|
import com.microsoft.rest.*; import com.squareup.okhttp.*;
|
[
"com.microsoft.rest",
"com.squareup.okhttp"
] |
com.microsoft.rest; com.squareup.okhttp;
| 1,907,920
|
public TrimResult trimFields(
LogicalTableFunctionScan tabFun,
ImmutableBitSet fieldsUsed,
Set<RelDataTypeField> extraFields) {
final RelDataType rowType = tabFun.getRowType();
final int fieldCount = rowType.getFieldCount();
final List<RelNode> newInputs = new ArrayList<>();
for (RelNode input : tabFun.getInputs()) {
final int inputFieldCount = input.getRowType().getFieldCount();
ImmutableBitSet inputFieldsUsed = ImmutableBitSet.range(inputFieldCount);
// Create input with trimmed columns.
final Set<RelDataTypeField> inputExtraFields =
Collections.emptySet();
TrimResult trimResult =
trimChildRestore(
tabFun, input, inputFieldsUsed, inputExtraFields);
assert trimResult.right.isIdentity();
newInputs.add(trimResult.left);
}
LogicalTableFunctionScan newTabFun = tabFun;
if (!tabFun.getInputs().equals(newInputs)) {
newTabFun = tabFun.copy(tabFun.getTraitSet(), newInputs,
tabFun.getCall(), tabFun.getElementType(), tabFun.getRowType(),
tabFun.getColumnMappings());
}
assert newTabFun.getClass() == tabFun.getClass();
// Always project all fields.
Mapping mapping = Mappings.createIdentity(fieldCount);
return result(newTabFun, mapping);
}
|
TrimResult function( LogicalTableFunctionScan tabFun, ImmutableBitSet fieldsUsed, Set<RelDataTypeField> extraFields) { final RelDataType rowType = tabFun.getRowType(); final int fieldCount = rowType.getFieldCount(); final List<RelNode> newInputs = new ArrayList<>(); for (RelNode input : tabFun.getInputs()) { final int inputFieldCount = input.getRowType().getFieldCount(); ImmutableBitSet inputFieldsUsed = ImmutableBitSet.range(inputFieldCount); final Set<RelDataTypeField> inputExtraFields = Collections.emptySet(); TrimResult trimResult = trimChildRestore( tabFun, input, inputFieldsUsed, inputExtraFields); assert trimResult.right.isIdentity(); newInputs.add(trimResult.left); } LogicalTableFunctionScan newTabFun = tabFun; if (!tabFun.getInputs().equals(newInputs)) { newTabFun = tabFun.copy(tabFun.getTraitSet(), newInputs, tabFun.getCall(), tabFun.getElementType(), tabFun.getRowType(), tabFun.getColumnMappings()); } assert newTabFun.getClass() == tabFun.getClass(); Mapping mapping = Mappings.createIdentity(fieldCount); return result(newTabFun, mapping); }
|
/**
* Variant of {@link #trimFields(RelNode, ImmutableBitSet, Set)} for
* {@link org.apache.calcite.rel.logical.LogicalTableFunctionScan}.
*/
|
Variant of <code>#trimFields(RelNode, ImmutableBitSet, Set)</code> for <code>org.apache.calcite.rel.logical.LogicalTableFunctionScan</code>
|
trimFields
|
{
"repo_name": "apache/calcite",
"path": "core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java",
"license": "apache-2.0",
"size": 50751
}
|
[
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"java.util.Set",
"org.apache.calcite.rel.RelNode",
"org.apache.calcite.rel.logical.LogicalTableFunctionScan",
"org.apache.calcite.rel.type.RelDataType",
"org.apache.calcite.rel.type.RelDataTypeField",
"org.apache.calcite.util.ImmutableBitSet",
"org.apache.calcite.util.mapping.Mapping",
"org.apache.calcite.util.mapping.Mappings"
] |
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.logical.LogicalTableFunctionScan; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.util.ImmutableBitSet; import org.apache.calcite.util.mapping.Mapping; import org.apache.calcite.util.mapping.Mappings;
|
import java.util.*; import org.apache.calcite.rel.*; import org.apache.calcite.rel.logical.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.util.*; import org.apache.calcite.util.mapping.*;
|
[
"java.util",
"org.apache.calcite"
] |
java.util; org.apache.calcite;
| 91,276
|
public void verifyAndCreateRemoteLogDir() {
boolean logPermError = true;
// Checking the existence of the TLD
FileSystem remoteFS = null;
try {
remoteFS = getFileSystem(conf);
} catch (IOException e) {
throw new YarnRuntimeException(
"Unable to get Remote FileSystem instance", e);
}
boolean remoteExists = true;
Path remoteRootLogDir = getRemoteRootLogDir();
try {
FsPermission perms =
remoteFS.getFileStatus(remoteRootLogDir).getPermission();
if (!perms.equals(TLDIR_PERMISSIONS) && logPermError) {
LOG.warn("Remote Root Log Dir [" + remoteRootLogDir
+ "] already exist, but with incorrect permissions. "
+ "Expected: [" + TLDIR_PERMISSIONS + "], Found: [" + perms
+ "]." + " The cluster may have problems with multiple users.");
logPermError = false;
} else {
logPermError = true;
}
} catch (FileNotFoundException e) {
remoteExists = false;
} catch (IOException e) {
throw new YarnRuntimeException(
"Failed to check permissions for dir ["
+ remoteRootLogDir + "]", e);
}
if (!remoteExists) {
LOG.warn("Remote Root Log Dir [" + remoteRootLogDir
+ "] does not exist. Attempting to create it.");
try {
Path qualified =
remoteRootLogDir.makeQualified(remoteFS.getUri(),
remoteFS.getWorkingDirectory());
remoteFS.mkdirs(qualified, new FsPermission(TLDIR_PERMISSIONS));
remoteFS.setPermission(qualified, new FsPermission(TLDIR_PERMISSIONS));
UserGroupInformation loginUser = UserGroupInformation.getLoginUser();
String primaryGroupName = null;
try {
primaryGroupName = loginUser.getPrimaryGroupName();
} catch (IOException e) {
LOG.warn("No primary group found. The remote root log directory" +
" will be created with the HDFS superuser being its group " +
"owner. JobHistoryServer may be unable to read the directory.");
}
// set owner on the remote directory only if the primary group exists
if (primaryGroupName != null) {
remoteFS.setOwner(qualified,
loginUser.getShortUserName(), primaryGroupName);
}
} catch (IOException e) {
throw new YarnRuntimeException("Failed to create remoteLogDir ["
+ remoteRootLogDir + "]", e);
}
}
}
|
void function() { boolean logPermError = true; FileSystem remoteFS = null; try { remoteFS = getFileSystem(conf); } catch (IOException e) { throw new YarnRuntimeException( STR, e); } boolean remoteExists = true; Path remoteRootLogDir = getRemoteRootLogDir(); try { FsPermission perms = remoteFS.getFileStatus(remoteRootLogDir).getPermission(); if (!perms.equals(TLDIR_PERMISSIONS) && logPermError) { LOG.warn(STR + remoteRootLogDir + STR + STR + TLDIR_PERMISSIONS + STR + perms + "]." + STR); logPermError = false; } else { logPermError = true; } } catch (FileNotFoundException e) { remoteExists = false; } catch (IOException e) { throw new YarnRuntimeException( STR + remoteRootLogDir + "]", e); } if (!remoteExists) { LOG.warn(STR + remoteRootLogDir + STR); try { Path qualified = remoteRootLogDir.makeQualified(remoteFS.getUri(), remoteFS.getWorkingDirectory()); remoteFS.mkdirs(qualified, new FsPermission(TLDIR_PERMISSIONS)); remoteFS.setPermission(qualified, new FsPermission(TLDIR_PERMISSIONS)); UserGroupInformation loginUser = UserGroupInformation.getLoginUser(); String primaryGroupName = null; try { primaryGroupName = loginUser.getPrimaryGroupName(); } catch (IOException e) { LOG.warn(STR + STR + STR); } if (primaryGroupName != null) { remoteFS.setOwner(qualified, loginUser.getShortUserName(), primaryGroupName); } } catch (IOException e) { throw new YarnRuntimeException(STR + remoteRootLogDir + "]", e); } } }
|
/**
* Verify and create the remote log directory.
*/
|
Verify and create the remote log directory
|
verifyAndCreateRemoteLogDir
|
{
"repo_name": "szegedim/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/LogAggregationFileController.java",
"license": "apache-2.0",
"size": 18253
}
|
[
"java.io.FileNotFoundException",
"java.io.IOException",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.fs.permission.FsPermission",
"org.apache.hadoop.security.UserGroupInformation",
"org.apache.hadoop.yarn.exceptions.YarnRuntimeException"
] |
import java.io.FileNotFoundException; import java.io.IOException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.security.*; import org.apache.hadoop.yarn.exceptions.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 2,313,764
|
public static boolean isForServiceNamespace(Service s, Operation op) {
return s.hasOption(ServiceOption.URI_NAMESPACE_OWNER)
&& !op.getUri().getPath().equals(s.getSelfLink());
}
|
static boolean function(Service s, Operation op) { return s.hasOption(ServiceOption.URI_NAMESPACE_OWNER) && !op.getUri().getPath().equals(s.getSelfLink()); }
|
/**
* Returns value indicating whether the request targets the service itself,
* or, if ServiceOption.URI_NAMESPACE_OWNER is set, and does not match the self link,
* targets portion the name space
*/
|
Returns value indicating whether the request targets the service itself, or, if ServiceOption.URI_NAMESPACE_OWNER is set, and does not match the self link, targets portion the name space
|
isForServiceNamespace
|
{
"repo_name": "toliaqat/xenon",
"path": "xenon-common/src/main/java/com/vmware/xenon/common/ServiceHost.java",
"license": "apache-2.0",
"size": 246752
}
|
[
"com.vmware.xenon.common.Service"
] |
import com.vmware.xenon.common.Service;
|
import com.vmware.xenon.common.*;
|
[
"com.vmware.xenon"
] |
com.vmware.xenon;
| 2,030,968
|
@Adaptive
ObjectInput deserialize(URL url, InputStream input) throws IOException;
|
ObjectInput deserialize(URL url, InputStream input) throws IOException;
|
/**
* create deserializer
* @param url
* @param input
* @return deserializer
* @throws IOException
*/
|
create deserializer
|
deserialize
|
{
"repo_name": "nince-wyj/jahhan",
"path": "frameworkx/dubbo-common/src/main/java/net/jahhan/spi/Serialization.java",
"license": "apache-2.0",
"size": 1812
}
|
[
"java.io.IOException",
"java.io.InputStream",
"net.jahhan.com.alibaba.dubbo.common.serialize.ObjectInput"
] |
import java.io.IOException; import java.io.InputStream; import net.jahhan.com.alibaba.dubbo.common.serialize.ObjectInput;
|
import java.io.*; import net.jahhan.com.alibaba.dubbo.common.serialize.*;
|
[
"java.io",
"net.jahhan.com"
] |
java.io; net.jahhan.com;
| 1,045,008
|
public Scheduler getScheduler() throws SchedulerException {
if (cfg == null) {
initialize();
}
SchedulerRepository schedRep = SchedulerRepository.getInstance();
Scheduler sched = schedRep.lookup(getSchedulerName());
if (sched != null) {
if (sched.isShutdown()) {
schedRep.remove(getSchedulerName());
} else {
return sched;
}
}
sched = instantiate();
return sched;
}
|
Scheduler function() throws SchedulerException { if (cfg == null) { initialize(); } SchedulerRepository schedRep = SchedulerRepository.getInstance(); Scheduler sched = schedRep.lookup(getSchedulerName()); if (sched != null) { if (sched.isShutdown()) { schedRep.remove(getSchedulerName()); } else { return sched; } } sched = instantiate(); return sched; }
|
/**
* <p>
* Returns a handle to the Scheduler produced by this factory.
* </p>
*
* <p>
* If one of the <code>initialize</code> methods has not be previously
* called, then the default (no-arg) <code>initialize()</code> method
* will be called by this method.
* </p>
*/
|
Returns a handle to the Scheduler produced by this factory. If one of the <code>initialize</code> methods has not be previously called, then the default (no-arg) <code>initialize()</code> method will be called by this method.
|
getScheduler
|
{
"repo_name": "zhongfuhua/tsp-quartz",
"path": "tsp-quartz-parent/tsp-quartz-core/src/main/java/org/quartz/impl/StdSchedulerFactory.java",
"license": "apache-2.0",
"size": 65309
}
|
[
"org.quartz.Scheduler",
"org.quartz.SchedulerException"
] |
import org.quartz.Scheduler; import org.quartz.SchedulerException;
|
import org.quartz.*;
|
[
"org.quartz"
] |
org.quartz;
| 1,618,978
|
private void setupEventBusCommandPublisher(String topic) {
if (StringUtils.isBlank(topic)) {
logger.trace("No topic defined for Event Bus Command Publisher");
return;
}
try {
logger.debug("Setting up Event Bus Command Publisher for topic {}", topic);
commandPublisher = new MqttMessagePublisher(brokerName + ":" + topic + ":command:*:default");
mqttService.registerMessageProducer(brokerName, commandPublisher);
} catch (Exception e) {
logger.warn("Could not create event bus command publisher: {}", e.getMessage(), e);
}
}
|
void function(String topic) { if (StringUtils.isBlank(topic)) { logger.trace(STR); return; } try { logger.debug(STR, topic); commandPublisher = new MqttMessagePublisher(brokerName + ":" + topic + STR); mqttService.registerMessageProducer(brokerName, commandPublisher); } catch (Exception e) { logger.warn(STR, e.getMessage(), e); } }
|
/**
* Initialize publisher which publishes all openHAB commands to the given
* MQTT topic.
*
* @param topic
* to subscribe to
*/
|
Initialize publisher which publishes all openHAB commands to the given MQTT topic
|
setupEventBusCommandPublisher
|
{
"repo_name": "falkena/openhab",
"path": "bundles/binding/org.openhab.binding.mqtt/src/main/java/org/openhab/binding/mqtt/internal/MqttEventBusBinding.java",
"license": "epl-1.0",
"size": 12842
}
|
[
"org.apache.commons.lang.StringUtils"
] |
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 145,746
|
private XrefType createXRef(String database, String id) {
XrefType xref = new XrefType();
DbReferenceType primaryRef = new DbReferenceType();
primaryRef.setDb(database);
primaryRef.setId(id);
xref.setPrimaryRef(primaryRef);
return xref;
}
|
XrefType function(String database, String id) { XrefType xref = new XrefType(); DbReferenceType primaryRef = new DbReferenceType(); primaryRef.setDb(database); primaryRef.setId(id); xref.setPrimaryRef(primaryRef); return xref; }
|
/**
* Creates a Primary Reference.
*
* @param database Database.
* @param id ID String.
* @return Castor XRef object
*/
|
Creates a Primary Reference
|
createXRef
|
{
"repo_name": "cytoscape/psi-mi",
"path": "impl/src/main/java/org/cytoscape/psi_mi/internal/data_mapper/MapInteractionsToPsiOne.java",
"license": "lgpl-2.1",
"size": 15359
}
|
[
"org.cytoscape.psi_mi.internal.schema.mi1.DbReferenceType",
"org.cytoscape.psi_mi.internal.schema.mi1.XrefType"
] |
import org.cytoscape.psi_mi.internal.schema.mi1.DbReferenceType; import org.cytoscape.psi_mi.internal.schema.mi1.XrefType;
|
import org.cytoscape.psi_mi.internal.schema.mi1.*;
|
[
"org.cytoscape.psi_mi"
] |
org.cytoscape.psi_mi;
| 2,218,870
|
public static void exit(int errorCode) {
boolean testMode = Boolean.getBoolean(PropertiesConfig.TEST_MODE);
if (testMode)
addErrorCode(errorCode);
else
System.exit(errorCode);
}
|
static void function(int errorCode) { boolean testMode = Boolean.getBoolean(PropertiesConfig.TEST_MODE); if (testMode) addErrorCode(errorCode); else System.exit(errorCode); }
|
/**
* Wrapper to call system exit making class easier to test.
* @param errorCode
*/
|
Wrapper to call system exit making class easier to test
|
exit
|
{
"repo_name": "afshinhm-ericsson/eiffel-remrem-generate",
"path": "src/main/java/com/ericsson/eiffel/remrem/generate/cli/CLIOptions.java",
"license": "apache-2.0",
"size": 6404
}
|
[
"com.ericsson.eiffel.remrem.generate.config.PropertiesConfig"
] |
import com.ericsson.eiffel.remrem.generate.config.PropertiesConfig;
|
import com.ericsson.eiffel.remrem.generate.config.*;
|
[
"com.ericsson.eiffel"
] |
com.ericsson.eiffel;
| 676,207
|
public static FormulaAst op(String opName, List<FormulaAst> children) {
return new FormulaAst(Type.OP, children, opName);
}
|
static FormulaAst function(String opName, List<FormulaAst> children) { return new FormulaAst(Type.OP, children, opName); }
|
/**
* An OP node representing the given operator/function with the given
* arguments.
*
* @param opName the name of the operator/function
* @param children the node children
* @return the new node
*/
|
An OP node representing the given operator/function with the given arguments
|
op
|
{
"repo_name": "diirt/diirt",
"path": "pvmanager/datasource-formula/src/main/java/org/diirt/datasource/formula/FormulaAst.java",
"license": "mit",
"size": 12231
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 780,953
|
public AccountInfo getAccountInfo() throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException;
|
AccountInfo function() throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException;
|
/**
* Get account info
*
* @return the AccountInfo object, null if some sort of error occurred. Implementers should log the error.
* @throws ExchangeException - Indication that the exchange reported some kind of error with the request or response
* @throws NotAvailableFromExchangeException - Indication that the exchange does not support the requested function or data
* @throws NotYetImplementedForExchangeException - Indication that the exchange supports the requested function or data, but it has not yet been
* implemented
* @throws IOException - Indication that a networking error occurred while fetching JSON data
*/
|
Get account info
|
getAccountInfo
|
{
"repo_name": "sutra/XChange",
"path": "xchange-core/src/main/java/com/xeiam/xchange/service/polling/account/PollingAccountService.java",
"license": "mit",
"size": 3852
}
|
[
"com.xeiam.xchange.dto.account.AccountInfo",
"com.xeiam.xchange.exceptions.ExchangeException",
"com.xeiam.xchange.exceptions.NotAvailableFromExchangeException",
"com.xeiam.xchange.exceptions.NotYetImplementedForExchangeException",
"java.io.IOException"
] |
import com.xeiam.xchange.dto.account.AccountInfo; import com.xeiam.xchange.exceptions.ExchangeException; import com.xeiam.xchange.exceptions.NotAvailableFromExchangeException; import com.xeiam.xchange.exceptions.NotYetImplementedForExchangeException; import java.io.IOException;
|
import com.xeiam.xchange.dto.account.*; import com.xeiam.xchange.exceptions.*; import java.io.*;
|
[
"com.xeiam.xchange",
"java.io"
] |
com.xeiam.xchange; java.io;
| 2,456,382
|
public boolean hasLinksTo() {
return Base.has(this.model, this.getResource(), LINKSTO);
}
|
boolean function() { return Base.has(this.model, this.getResource(), LINKSTO); }
|
/**
* Check if org.ontoware.rdfreactor.generator.java.JProperty@3764253e has at
* least one value set
*
* @return true if this property has at least one value
*
* [Generated from RDFReactor template rule #get0has-dynamic]
*/
|
Check if org.ontoware.rdfreactor.generator.java.JProperty@3764253e has at least one value set
|
hasLinksTo
|
{
"repo_name": "m0ep/master-thesis",
"path": "source/apis/rdf2go/rdf2go-sioc/src/main/java/org/rdfs/sioc/Thing.java",
"license": "mit",
"size": 317844
}
|
[
"org.ontoware.rdfreactor.runtime.Base"
] |
import org.ontoware.rdfreactor.runtime.Base;
|
import org.ontoware.rdfreactor.runtime.*;
|
[
"org.ontoware.rdfreactor"
] |
org.ontoware.rdfreactor;
| 1,083,783
|
TeleportType getTeleportType();
interface TeleporterCauseBuilder<T extends TeleportCause, B extends TeleporterCauseBuilder<T, B>> extends ResettableBuilder<T, B> {
|
TeleportType getTeleportType(); interface TeleporterCauseBuilder<T extends TeleportCause, B extends TeleporterCauseBuilder<T, B>> extends ResettableBuilder<T, B> {
|
/**
* Gets the type of the teleport.
*
* @return The type of teleport
*/
|
Gets the type of the teleport
|
getTeleportType
|
{
"repo_name": "JBYoshi/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/event/cause/entity/teleport/TeleportCause.java",
"license": "mit",
"size": 2577
}
|
[
"org.spongepowered.api.util.ResettableBuilder"
] |
import org.spongepowered.api.util.ResettableBuilder;
|
import org.spongepowered.api.util.*;
|
[
"org.spongepowered.api"
] |
org.spongepowered.api;
| 1,802,740
|
private String editProfileFilterCli(ControlApiCliThriftClient cli, String profileFilterId, String profileSchemaId, String applicationName, String tenantName, String endpointGroupId, boolean createOut) throws UnsupportedEncodingException {
cliOut.reset();
boolean create = strIsEmpty(profileFilterId);
int result = -1;
if (create) {
if (strIsEmpty(profileSchemaId) || strIsEmpty(endpointGroupId)) {
String applicationId = editApplicationCli(cli, null, applicationName, null, tenantName, false);
profileSchemaId = editProfileSchemaCli(cli, null, applicationId, applicationName, tenantName, false);
cliOut.reset();
endpointGroupId = editEndpointGroupCli(cli, null, applicationId, applicationName, tenantName, "10", false);
cliOut.reset();
}
String cmdLine = "createProfileFilter -f " + getTestFile("testProfileFilter.json") + " -s " + profileSchemaId + " -e " + endpointGroupId;
if (createOut) {
cmdLine += " -o dummy.out";
}
result = cli.processLine(cmdLine);
}
else {
result = cli.processLine("editProfileFilter -f " + getTestFile("testProfileFilterUpdated.json") + " -i " + profileFilterId);
}
Assert.assertEquals(result, 0);
String output = cliOut.toString("UTF-8");
if (create) {
String id = output.trim().substring("Created new Profile Filter with id: ".length()).trim();
return id;
}
else if (profileFilterId.equals(FAKE_SQL_ID)) {
Assert.assertTrue(output.trim().startsWith("Profile Filter with id " + FAKE_SQL_ID + " not found!"));
return profileFilterId;
}
else {
Assert.assertTrue(output.trim().startsWith("Profile Filter updated."));
return profileFilterId;
}
}
|
String function(ControlApiCliThriftClient cli, String profileFilterId, String profileSchemaId, String applicationName, String tenantName, String endpointGroupId, boolean createOut) throws UnsupportedEncodingException { cliOut.reset(); boolean create = strIsEmpty(profileFilterId); int result = -1; if (create) { if (strIsEmpty(profileSchemaId) strIsEmpty(endpointGroupId)) { String applicationId = editApplicationCli(cli, null, applicationName, null, tenantName, false); profileSchemaId = editProfileSchemaCli(cli, null, applicationId, applicationName, tenantName, false); cliOut.reset(); endpointGroupId = editEndpointGroupCli(cli, null, applicationId, applicationName, tenantName, "10", false); cliOut.reset(); } String cmdLine = STR + getTestFile(STR) + STR + profileSchemaId + STR + endpointGroupId; if (createOut) { cmdLine += STR; } result = cli.processLine(cmdLine); } else { result = cli.processLine(STR + getTestFile(STR) + STR + profileFilterId); } Assert.assertEquals(result, 0); String output = cliOut.toString("UTF-8"); if (create) { String id = output.trim().substring(STR.length()).trim(); return id; } else if (profileFilterId.equals(FAKE_SQL_ID)) { Assert.assertTrue(output.trim().startsWith(STR + FAKE_SQL_ID + STR)); return profileFilterId; } else { Assert.assertTrue(output.trim().startsWith(STR)); return profileFilterId; } }
|
/**
* Edits/Creates the profile filter from cli.
*
* @param cli the control cli client
* @param profileFilterId the profile filter id (if null new profile filter will be created)
* @param profileSchemaId the profile schema id
* @param endpointGroupId the endpoint group Id
* @param createOut create output file with object id
* @return the profileFilterId
* @throws UnsupportedEncodingException the unsupported encoding exception
*/
|
Edits/Creates the profile filter from cli
|
editProfileFilterCli
|
{
"repo_name": "vzhukovskyi/kaa",
"path": "server/control/src/test/java/org/kaaproject/kaa/server/control/cli/ControlServerCliIT.java",
"license": "apache-2.0",
"size": 86146
}
|
[
"java.io.UnsupportedEncodingException",
"org.junit.Assert"
] |
import java.io.UnsupportedEncodingException; import org.junit.Assert;
|
import java.io.*; import org.junit.*;
|
[
"java.io",
"org.junit"
] |
java.io; org.junit;
| 1,356,434
|
public Observable<ServiceResponse<Page<ProductInner>>> getOdataMultiplePagesNextSinglePageAsync(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
Validator.validate(pagingGetOdataMultiplePagesOptions);
Integer maxresults = null;
if (pagingGetOdataMultiplePagesOptions != null) {
maxresults = pagingGetOdataMultiplePagesOptions.maxresults();
}
Integer timeout = null;
if (pagingGetOdataMultiplePagesOptions != null) {
timeout = pagingGetOdataMultiplePagesOptions.timeout();
}
|
Observable<ServiceResponse<Page<ProductInner>>> function(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); } Validator.validate(pagingGetOdataMultiplePagesOptions); Integer maxresults = null; if (pagingGetOdataMultiplePagesOptions != null) { maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetOdataMultiplePagesOptions != null) { timeout = pagingGetOdataMultiplePagesOptions.timeout(); }
|
/**
* A paging operation that includes a nextLink in odata format that has 10 pages.
*
ServiceResponse<PageImpl1<ProductInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
ServiceResponse<PageImpl1<ProductInner>> * @param clientRequestId the String value
ServiceResponse<PageImpl1<ProductInner>> * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
* @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful.
*/
|
A paging operation that includes a nextLink in odata format that has 10 pages
|
getOdataMultiplePagesNextSinglePageAsync
|
{
"repo_name": "tbombach/autorest",
"path": "src/generator/AutoRest.Java.Azure.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingsInner.java",
"license": "mit",
"size": 168428
}
|
[
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse",
"com.microsoft.rest.Validator"
] |
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator;
|
import com.microsoft.azure.*; import com.microsoft.rest.*;
|
[
"com.microsoft.azure",
"com.microsoft.rest"
] |
com.microsoft.azure; com.microsoft.rest;
| 1,192,935
|
public List getOOXMLObjects()
{
return ooxmlObjects;
}
|
List function() { return ooxmlObjects; }
|
/**
* returns the list of OOXML objects which are external or auxillary to the main workbook
* e.g. theme, doc properties
*
* @return
*/
|
returns the list of OOXML objects which are external or auxillary to the main workbook e.g. theme, doc properties
|
getOOXMLObjects
|
{
"repo_name": "Maxels88/openxls",
"path": "src/main/java/org/openxls/formats/XLS/WorkBook.java",
"license": "gpl-3.0",
"size": 107715
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 14,060
|
public Future<CommandResult> getApsTxUcastSuccessAsync() {
return read(attributes.get(ATTR_APSTXUCASTSUCCESS));
}
|
Future<CommandResult> function() { return read(attributes.get(ATTR_APSTXUCASTSUCCESS)); }
|
/**
* Get the <i>APSTxUcastSuccess</i> attribute [attribute ID <b>265</b>].
* <p>
* The attribute is of type {@link Integer}.
* <p>
* The implementation of this attribute by a device is MANDATORY
*
* @return the {@link Future<CommandResult>} command result future
*/
|
Get the APSTxUcastSuccess attribute [attribute ID 265]. The attribute is of type <code>Integer</code>. The implementation of this attribute by a device is MANDATORY
|
getApsTxUcastSuccessAsync
|
{
"repo_name": "cschwer/com.zsmartsystems.zigbee",
"path": "com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclDiagnosticsCluster.java",
"license": "epl-1.0",
"size": 61548
}
|
[
"com.zsmartsystems.zigbee.CommandResult",
"java.util.concurrent.Future"
] |
import com.zsmartsystems.zigbee.CommandResult; import java.util.concurrent.Future;
|
import com.zsmartsystems.zigbee.*; import java.util.concurrent.*;
|
[
"com.zsmartsystems.zigbee",
"java.util"
] |
com.zsmartsystems.zigbee; java.util;
| 2,554,922
|
public LayoutAnimationController getLayoutAnimation() {
return mLayoutAnimationController;
}
|
LayoutAnimationController function() { return mLayoutAnimationController; }
|
/**
* Returns the layout animation controller used to animate the group's
* children.
*
* @return the current animation controller
*/
|
Returns the layout animation controller used to animate the group's children
|
getLayoutAnimation
|
{
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/base/core/java/android/view/ViewGroup.java",
"license": "gpl-3.0",
"size": 275692
}
|
[
"android.view.animation.LayoutAnimationController"
] |
import android.view.animation.LayoutAnimationController;
|
import android.view.animation.*;
|
[
"android.view"
] |
android.view;
| 729,374
|
static PropertyType fromRawValue(int rawValue) {
for (PropertyType type : PropertyType.values()) {
if (type.m_rawValue == rawValue) {
return type;
}
}
throw new IllegalArgumentException("unexptected raw value: " +
rawValue);
}
private PropertyType(int rawValue) {
m_rawValue = rawValue;
}
private final int m_rawValue;
}
public static final class Property {
Property(String key, int semantic, int index, int type,
Object data) {
m_key = key;
m_semantic = semantic;
m_index = index;
m_type = PropertyType.fromRawValue(type);
m_data = data;
}
Property(String key, int semantic, int index, int type,
int dataLen) {
m_key = key;
m_semantic = semantic;
m_index = index;
m_type = PropertyType.fromRawValue(type);
ByteBuffer b = ByteBuffer.allocateDirect(dataLen);
b.order(ByteOrder.nativeOrder());
m_data = b;
}
|
static PropertyType fromRawValue(int rawValue) { for (PropertyType type : PropertyType.values()) { if (type.m_rawValue == rawValue) { return type; } } throw new IllegalArgumentException(STR + rawValue); } private PropertyType(int rawValue) { m_rawValue = rawValue; } private final int m_rawValue; } public static final class Property { Property(String key, int semantic, int index, int type, Object data) { m_key = key; m_semantic = semantic; m_index = index; m_type = PropertyType.fromRawValue(type); m_data = data; } Property(String key, int semantic, int index, int type, int dataLen) { m_key = key; m_semantic = semantic; m_index = index; m_type = PropertyType.fromRawValue(type); ByteBuffer b = ByteBuffer.allocateDirect(dataLen); b.order(ByteOrder.nativeOrder()); m_data = b; }
|
/**
* Utility method for converting from c/c++ based integer enums to java
* enums.<p>
*
* This method is intended to be used from JNI and my change based on
* implementation needs.
*
* @param rawValue an integer based enum value (as defined by assimp)
* @return the enum value corresponding to rawValue
*/
|
Utility method for converting from c/c++ based integer enums to java enums. This method is intended to be used from JNI and my change based on implementation needs
|
fromRawValue
|
{
"repo_name": "ivansoban/ILEngine",
"path": "thirdparty/assimp/port/jassimp/jassimp/src/jassimp/AiMaterial.java",
"license": "mit",
"size": 33891
}
|
[
"java.nio.ByteBuffer",
"java.nio.ByteOrder"
] |
import java.nio.ByteBuffer; import java.nio.ByteOrder;
|
import java.nio.*;
|
[
"java.nio"
] |
java.nio;
| 907,537
|
public Constructor getConstructor() {
return ctor;
}
|
Constructor function() { return ctor; }
|
/**
* The constructor
* @return
*/
|
The constructor
|
getConstructor
|
{
"repo_name": "gijsleussink/ceylon",
"path": "compiler-java/src/com/redhat/ceylon/compiler/java/codegen/CtorDelegation.java",
"license": "apache-2.0",
"size": 4731
}
|
[
"com.redhat.ceylon.model.typechecker.model.Constructor"
] |
import com.redhat.ceylon.model.typechecker.model.Constructor;
|
import com.redhat.ceylon.model.typechecker.model.*;
|
[
"com.redhat.ceylon"
] |
com.redhat.ceylon;
| 2,057,493
|
@Test
public void structured_extra_end() throws Exception {
//@formatter:off
String string =
"BEGIN:COMP1\r\n" +
"PROP:value\r\n" +
"END:COMP2\r\n" +
"END:COMP1\r\n";
//@formatter:on
for (SyntaxStyle style : SyntaxStyle.values()) {
VObjectReader reader = reader(string, style);
VObjectDataListenerMock listener = spy(new VObjectDataListenerMock());
reader.parse(listener);
InOrder inorder = inOrder(listener);
inorder.verify(listener).onComponentBegin(eq("COMP1"), any(Context.class));
inorder.verify(listener).onProperty(eq(property().name("PROP").value("value").build()), any(Context.class));
inorder.verify(listener).onWarning(eq(Warning.UNMATCHED_END), isNull(VObjectProperty.class), isNull(Exception.class), any(Context.class));
inorder.verify(listener).onComponentEnd(eq("COMP1"), any(Context.class));
//@formatter:off
String lines[] = string.split("\r\n");
int line = 0;
assertContexts(listener,
context(lines[line], ++line),
context(asList("COMP1"), lines[line], ++line),
context(asList("COMP1"), lines[line], ++line),
context(lines[line], ++line)
);
//@formatter:on
}
}
|
void function() throws Exception { String string = STR + STR + STR + STR; for (SyntaxStyle style : SyntaxStyle.values()) { VObjectReader reader = reader(string, style); VObjectDataListenerMock listener = spy(new VObjectDataListenerMock()); reader.parse(listener); InOrder inorder = inOrder(listener); inorder.verify(listener).onComponentBegin(eq("COMP1"), any(Context.class)); inorder.verify(listener).onProperty(eq(property().name("PROP").value("value").build()), any(Context.class)); inorder.verify(listener).onWarning(eq(Warning.UNMATCHED_END), isNull(VObjectProperty.class), isNull(Exception.class), any(Context.class)); inorder.verify(listener).onComponentEnd(eq("COMP1"), any(Context.class)); String lines[] = string.split("\r\n"); int line = 0; assertContexts(listener, context(lines[line], ++line), context(asList("COMP1"), lines[line], ++line), context(asList("COMP1"), lines[line], ++line), context(lines[line], ++line) ); } }
|
/**
* Asserts that a warning should be thrown when an unmatched END property is
* found.
*/
|
Asserts that a warning should be thrown when an unmatched END property is found
|
structured_extra_end
|
{
"repo_name": "mangstadt/vinnie",
"path": "src/test/java/com/github/mangstadt/vinnie/io/VObjectReaderTest.java",
"license": "apache-2.0",
"size": 58280
}
|
[
"com.github.mangstadt.vinnie.SyntaxStyle",
"com.github.mangstadt.vinnie.VObjectProperty",
"org.mockito.InOrder",
"org.mockito.Matchers",
"org.mockito.Mockito"
] |
import com.github.mangstadt.vinnie.SyntaxStyle; import com.github.mangstadt.vinnie.VObjectProperty; import org.mockito.InOrder; import org.mockito.Matchers; import org.mockito.Mockito;
|
import com.github.mangstadt.vinnie.*; import org.mockito.*;
|
[
"com.github.mangstadt",
"org.mockito"
] |
com.github.mangstadt; org.mockito;
| 1,910,950
|
public static DataCastManager getInstance() throws CastException {
if (null == sInstance) {
LOGE(TAG, "No DataCastManager instance was initialized, you need to " +
"call initialize() first");
throw new CastException();
}
return sInstance;
}
/**
* Returns the initialized instance of this class. If it is not initialized yet, a
* {@link CastException} will be thrown. The {@link Context} that is passed as the argument will
* be used to update the context. The main purpose of updating context is to enable the library
* to provide {@link Context} related functionalities, e.g. it can create an error dialog if
* needed. This method is preferred over the similar one without a context argument.
*
* @see {@link initialize()}, {@link setContext()}
|
static DataCastManager function() throws CastException { if (null == sInstance) { LOGE(TAG, STR + STR); throw new CastException(); } return sInstance; } /** * Returns the initialized instance of this class. If it is not initialized yet, a * {@link CastException} will be thrown. The {@link Context} that is passed as the argument will * be used to update the context. The main purpose of updating context is to enable the library * to provide {@link Context} related functionalities, e.g. it can create an error dialog if * needed. This method is preferred over the similar one without a context argument. * * @see {@link initialize()}, {@link setContext()}
|
/**
* Returns the initialized instance of this class. If it is not initialized yet, a
* {@link CastException} will be thrown.
*
* @see initialze()
* @return
* @throws CastException
*/
|
Returns the initialized instance of this class. If it is not initialized yet, a <code>CastException</code> will be thrown
|
getInstance
|
{
"repo_name": "leonelfolmer/CastAndroid",
"path": "CastCompanionLibrary/src/com/google/sample/castcompanionlibrary/cast/DataCastManager.java",
"license": "mit",
"size": 23539
}
|
[
"android.content.Context",
"com.google.sample.castcompanionlibrary.cast.exceptions.CastException"
] |
import android.content.Context; import com.google.sample.castcompanionlibrary.cast.exceptions.CastException;
|
import android.content.*; import com.google.sample.castcompanionlibrary.cast.exceptions.*;
|
[
"android.content",
"com.google.sample"
] |
android.content; com.google.sample;
| 373,824
|
public Model createAndSetModel() {
Model newValue = new Model();
this.setModel(newValue);
return newValue;
}
|
Model function() { Model newValue = new Model(); this.setModel(newValue); return newValue; }
|
/**
* Creates a new instance of {@link Model} and set it to model.
*
* This method is a short version for:
* <code>
* Model model = new Model();
* this.setModel(model); </code>
*
*
*/
|
Creates a new instance of <code>Model</code> and set it to model. This method is a short version for: <code> Model model = new Model(); this.setModel(model); </code>
|
createAndSetModel
|
{
"repo_name": "micromata/javaapiforkml",
"path": "src/main/java/de/micromata/opengis/kml/v_2_2_0/gx/Track.java",
"license": "bsd-3-clause",
"size": 18468
}
|
[
"de.micromata.opengis.kml.v_2_2_0.Model"
] |
import de.micromata.opengis.kml.v_2_2_0.Model;
|
import de.micromata.opengis.kml.v_2_2_0.*;
|
[
"de.micromata.opengis"
] |
de.micromata.opengis;
| 529,132
|
@Override
protected List<T> readData() {
List<T> result;
Properties props;
result = new ArrayList<>();
// loads properties
try {
props = new Properties();
props.load(m_Input.getAbsolutePath());
}
catch (Exception e) {
getLogger().log(Level.SEVERE, "Failed to read data from " + m_Input, e);
props = new Properties();
}
// transfer properties into report
result.add((T) Report.parseProperties(props));
return result;
}
|
List<T> function() { List<T> result; Properties props; result = new ArrayList<>(); try { props = new Properties(); props.load(m_Input.getAbsolutePath()); } catch (Exception e) { getLogger().log(Level.SEVERE, STR + m_Input, e); props = new Properties(); } result.add((T) Report.parseProperties(props)); return result; }
|
/**
* Performs the actual reading.
*
* @return the reports that were read
*/
|
Performs the actual reading
|
readData
|
{
"repo_name": "waikato-datamining/adams-base",
"path": "adams-core/src/main/java/adams/data/io/input/AbstractSimpleReportReader.java",
"license": "gpl-3.0",
"size": 3200
}
|
[
"java.util.ArrayList",
"java.util.List",
"java.util.logging.Level"
] |
import java.util.ArrayList; import java.util.List; import java.util.logging.Level;
|
import java.util.*; import java.util.logging.*;
|
[
"java.util"
] |
java.util;
| 2,385,866
|
public String getKeyForNode(MemcachedNode node, int repetition) {
// Carrried over from the DefaultKetamaNodeLocatorConfiguration:
// Internal Using the internal map retrieve the socket addresses
// for given nodes.
// I'm aware that this code is inherently thread-unsafe as
// I'm using a HashMap implementation of the map, but the worst
// case ( I believe) is we're slightly in-efficient when
// a node has never been seen before concurrently on two different
// threads, so it the socketaddress will be requested multiple times!
// all other cases should be as fast as possible.
String nodeKey = nodeKeys.get(node);
if (nodeKey == null) {
switch(this.format) {
case LIBMEMCACHED:
InetSocketAddress address = (InetSocketAddress)node.getSocketAddress();
nodeKey = address.getHostName();
if (address.getPort() != 11211) {
nodeKey += ":" + address.getPort();
}
break;
case SPYMEMCACHED:
nodeKey = String.valueOf(node.getSocketAddress());
if (nodeKey.startsWith("/")) {
nodeKey = nodeKey.substring(1);
}
break;
default:
assert false;
}
nodeKeys.put(node, nodeKey);
}
return nodeKey + "-" + repetition;
}
|
String function(MemcachedNode node, int repetition) { String nodeKey = nodeKeys.get(node); if (nodeKey == null) { switch(this.format) { case LIBMEMCACHED: InetSocketAddress address = (InetSocketAddress)node.getSocketAddress(); nodeKey = address.getHostName(); if (address.getPort() != 11211) { nodeKey += ":" + address.getPort(); } break; case SPYMEMCACHED: nodeKey = String.valueOf(node.getSocketAddress()); if (nodeKey.startsWith("/")) { nodeKey = nodeKey.substring(1); } break; default: assert false; } nodeKeys.put(node, nodeKey); } return nodeKey + "-" + repetition; }
|
/**
* Returns a uniquely identifying key, suitable for hashing by the
* KetamaNodeLocator algorithm.
*
* @param node The MemcachedNode to use to form the unique identifier
* @param repetition The repetition number for the particular node in question
* (0 is the first repetition)
* @return The key that represents the specific repetition of the node
*/
|
Returns a uniquely identifying key, suitable for hashing by the KetamaNodeLocator algorithm
|
getKeyForNode
|
{
"repo_name": "HubSpot/java-memcached-client",
"path": "src/main/java/net/spy/memcached/KetamaNodeKeyFormatter.java",
"license": "mit",
"size": 5167
}
|
[
"java.net.InetSocketAddress"
] |
import java.net.InetSocketAddress;
|
import java.net.*;
|
[
"java.net"
] |
java.net;
| 937,129
|
InsnList pushReturnValue();
|
InsnList pushReturnValue();
|
/**
* Generate code to capture the current stack as a return value into the thread. Expects thread on the stack.
*/
|
Generate code to capture the current stack as a return value into the thread. Expects thread on the stack
|
pushReturnValue
|
{
"repo_name": "markusheiden/serialthreads",
"path": "src/main/java/org/serialthreads/transformer/code/IValueCode.java",
"license": "gpl-3.0",
"size": 3921
}
|
[
"org.objectweb.asm.tree.InsnList"
] |
import org.objectweb.asm.tree.InsnList;
|
import org.objectweb.asm.tree.*;
|
[
"org.objectweb.asm"
] |
org.objectweb.asm;
| 1,313,391
|
public final int doFinal(byte[] input, int inOff, int inLen, byte[] output,
int outOff) throws ShortBufferException, IllegalBlockSizeException,
BadPaddingException {
if (output.length < getOutputSize(inLen)) {
throw new ShortBufferException("Output buffer too short.");
}
byte[] out = doFinal(input, inOff, inLen);
System.arraycopy(out, 0, output, outOff, out.length);
return out.length;
}
|
final int function(byte[] input, int inOff, int inLen, byte[] output, int outOff) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException { if (output.length < getOutputSize(inLen)) { throw new ShortBufferException(STR); } byte[] out = doFinal(input, inOff, inLen); System.arraycopy(out, 0, output, outOff, out.length); return out.length; }
|
/**
* Finish a multiple-part encryption or decryption operation (depending on
* how this cipher was initialized).
*
* @param input
* the input buffer
* @param inOff
* the offset where the input starts
* @param inLen
* the input length
* @param output
* the buffer for the result
* @param outOff
* the offset where the result is stored
* @return the output length
* @throws de.flexiprovider.api.exceptions.ShortBufferException
* if the output buffer is too small to hold the result.
* @throws de.flexiprovider.api.exceptions.IllegalBlockSizeException
* if the plaintext or ciphertext size is too large.
* @throws de.flexiprovider.api.exceptions.BadPaddingException
* if the ciphertext is invalid.
*/
|
Finish a multiple-part encryption or decryption operation (depending on how this cipher was initialized)
|
doFinal
|
{
"repo_name": "sharebookproject/AndroidPQCrypto",
"path": "MCElieceProject/Flexiprovider/src/main/java/de/flexiprovider/api/AsymmetricBlockCipher.java",
"license": "gpl-3.0",
"size": 21203
}
|
[
"de.flexiprovider.api.exceptions.BadPaddingException",
"de.flexiprovider.api.exceptions.IllegalBlockSizeException",
"de.flexiprovider.api.exceptions.ShortBufferException"
] |
import de.flexiprovider.api.exceptions.BadPaddingException; import de.flexiprovider.api.exceptions.IllegalBlockSizeException; import de.flexiprovider.api.exceptions.ShortBufferException;
|
import de.flexiprovider.api.exceptions.*;
|
[
"de.flexiprovider.api"
] |
de.flexiprovider.api;
| 2,617,095
|
public Set<String> getPlannedNodes() {
return plannedNodes;
}
|
Set<String> function() { return plannedNodes; }
|
/**
* Get cluster nodes to include in job planning. Services not in the set should not be included in job planning,
* with a null value indicating that all nodes should be included in planning.
*
* @return Cluster nodes to be included in job planning.
*/
|
Get cluster nodes to include in job planning. Services not in the set should not be included in job planning, with a null value indicating that all nodes should be included in planning
|
getPlannedNodes
|
{
"repo_name": "awholegunch/loom",
"path": "server/src/main/java/com/continuuity/loom/scheduler/task/ClusterJob.java",
"license": "apache-2.0",
"size": 8823
}
|
[
"java.util.Set"
] |
import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 179,831
|
public static String lookupConstantFieldValue(Class<?> clazz, String name) {
if (clazz == null) {
return null;
}
// remove leading dots
if (name.startsWith(",")) {
name = name.substring(1);
}
for (Field field : clazz.getFields()) {
if (field.getName().equals(name)) {
try {
Object v = field.get(null);
return v.toString();
} catch (IllegalAccessException e) {
// ignore
return null;
}
}
}
return null;
}
|
static String function(Class<?> clazz, String name) { if (clazz == null) { return null; } if (name.startsWith(",")) { name = name.substring(1); } for (Field field : clazz.getFields()) { if (field.getName().equals(name)) { try { Object v = field.get(null); return v.toString(); } catch (IllegalAccessException e) { return null; } } } return null; }
|
/**
* Lookup the constant field on the given class with the given name
*
* @param clazz the class
* @param name the name of the field to lookup
* @return the value of the constant field, or <tt>null</tt> if not found
*/
|
Lookup the constant field on the given class with the given name
|
lookupConstantFieldValue
|
{
"repo_name": "RohanHart/camel",
"path": "camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java",
"license": "apache-2.0",
"size": 73945
}
|
[
"java.lang.reflect.Field"
] |
import java.lang.reflect.Field;
|
import java.lang.reflect.*;
|
[
"java.lang"
] |
java.lang;
| 1,675,506
|
public static KeyValue createFirstOnRow(final byte [] row,
final int roffset, final int rlength, final byte [] family,
final int foffset, final int flength, final byte [] qualifier,
final int qoffset, final int qlength) {
return new KeyValue(row, roffset, rlength, family,
foffset, flength, qualifier, qoffset, qlength,
HConstants.LATEST_TIMESTAMP, Type.Maximum, null, 0, 0);
}
|
static KeyValue function(final byte [] row, final int roffset, final int rlength, final byte [] family, final int foffset, final int flength, final byte [] qualifier, final int qoffset, final int qlength) { return new KeyValue(row, roffset, rlength, family, foffset, flength, qualifier, qoffset, qlength, HConstants.LATEST_TIMESTAMP, Type.Maximum, null, 0, 0); }
|
/**
* Create a KeyValue for the specified row, family and qualifier that would be
* smaller than all other possible KeyValues that have the same row,
* family, qualifier.
* Used for seeking.
* @param row row key
* @param roffset row offset
* @param rlength row length
* @param family family name
* @param foffset family offset
* @param flength family length
* @param qualifier column qualifier
* @param qoffset qualifier offset
* @param qlength qualifier length
* @return First possible key on passed Row, Family, Qualifier.
*/
|
Create a KeyValue for the specified row, family and qualifier that would be smaller than all other possible KeyValues that have the same row, family, qualifier. Used for seeking
|
createFirstOnRow
|
{
"repo_name": "JingchengDu/hbase",
"path": "hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java",
"license": "apache-2.0",
"size": 25785
}
|
[
"org.apache.hadoop.hbase.KeyValue"
] |
import org.apache.hadoop.hbase.KeyValue;
|
import org.apache.hadoop.hbase.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 1,825,188
|
public String getSubject()
{
return annot.getString( COSName.SUBJ );
}
|
String function() { return annot.getString( COSName.SUBJ ); }
|
/**
* Get the description of the annotation.
*
* @return The subject of the annotation.
*/
|
Get the description of the annotation
|
getSubject
|
{
"repo_name": "myrridin/qz-print",
"path": "pdfbox_1.8.4_qz/src/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java",
"license": "lgpl-2.1",
"size": 15414
}
|
[
"org.apache.pdfbox.cos.COSName"
] |
import org.apache.pdfbox.cos.COSName;
|
import org.apache.pdfbox.cos.*;
|
[
"org.apache.pdfbox"
] |
org.apache.pdfbox;
| 992,228
|
public void setLogWriter(PrintWriter out) throws ResourceException
{
logwriter = out;
}
|
void function(PrintWriter out) throws ResourceException { logwriter = out; }
|
/**
* Sets the log writer for this ManagedConnection instance.
*
* @param out Character Output stream to be associated
* @throws ResourceException generic exception if operation fails
*/
|
Sets the log writer for this ManagedConnection instance
|
setLogWriter
|
{
"repo_name": "jandsu/ironjacamar",
"path": "testsuite/src/test/java/org/ironjacamar/rars/txlog/TxLogManagedConnection.java",
"license": "epl-1.0",
"size": 15134
}
|
[
"java.io.PrintWriter",
"javax.resource.ResourceException"
] |
import java.io.PrintWriter; import javax.resource.ResourceException;
|
import java.io.*; import javax.resource.*;
|
[
"java.io",
"javax.resource"
] |
java.io; javax.resource;
| 2,725,689
|
@Test void testAliasUnnestMultipleArrays() {
// for accessing a field in STRUCT type unnested from array
sql("select e.ENAME\n"
+ "from dept_nested_expanded as d CROSS JOIN\n"
+ " UNNEST(d.employees) as t(e)")
.withConformance(SqlConformanceEnum.PRESTO).columnType("VARCHAR(10) NOT NULL");
// for unnesting multiple arrays at the same time
sql("select d.deptno, e, k.empno, l.\"unit\", l.\"X\" * l.\"Y\"\n"
+ "from dept_nested_expanded as d CROSS JOIN\n"
+ " UNNEST(d.admins, d.employees, d.offices) as t(e, k, l)")
.withConformance(SqlConformanceEnum.PRESTO).ok();
// Make sure validation fails properly given illegal select items
sql("select d.deptno, ^e^.some_column, k.empno\n"
+ "from dept_nested_expanded as d CROSS JOIN\n"
+ " UNNEST(d.admins, d.employees) as t(e, k)")
.withConformance(SqlConformanceEnum.PRESTO)
.fails("Table 'E' not found");
sql("select d.deptno, e.detail, ^unknown^.detail\n"
+ "from dept_nested_expanded as d CROSS JOIN\n"
+ " UNNEST(d.employees) as t(e)")
.withConformance(SqlConformanceEnum.PRESTO).fails("Incompatible types");
// Make sure validation fails without PRESTO conformance
sql("select e.ENAME\n"
+ "from dept_nested_expanded as d CROSS JOIN\n"
+ " UNNEST(d.employees) as t(^e^)")
.fails("List of column aliases must have same degree as table; table has 3 columns "
+ "\\('EMPNO', 'ENAME', 'DETAIL'\\), whereas alias list has 1 columns");
}
|
@Test void testAliasUnnestMultipleArrays() { sql(STR + STR + STR) .withConformance(SqlConformanceEnum.PRESTO).columnType(STR); sql(STRunit\STRX\STRY\"\n" + STR + STR) .withConformance(SqlConformanceEnum.PRESTO).ok(); sql(STR + STR + STR) .withConformance(SqlConformanceEnum.PRESTO) .fails(STR); sql(STR + STR + STR) .withConformance(SqlConformanceEnum.PRESTO).fails(STR); sql(STR + STR + STR) .fails(STR + STR); }
|
/**
* Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-3789">[CALCITE-3789]
* Support validation of UNNEST multiple array columns like Presto</a>.
*/
|
Test case for [CALCITE-3789] Support validation of UNNEST multiple array columns like Presto
|
testAliasUnnestMultipleArrays
|
{
"repo_name": "apache/calcite",
"path": "core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java",
"license": "apache-2.0",
"size": 521238
}
|
[
"org.apache.calcite.sql.validate.SqlConformanceEnum",
"org.junit.jupiter.api.Test"
] |
import org.apache.calcite.sql.validate.SqlConformanceEnum; import org.junit.jupiter.api.Test;
|
import org.apache.calcite.sql.validate.*; import org.junit.jupiter.api.*;
|
[
"org.apache.calcite",
"org.junit.jupiter"
] |
org.apache.calcite; org.junit.jupiter;
| 196,453
|
public boolean putAndMoveToFirst( final K k, final boolean v ) {
final K key[] = this.key;
final boolean used[] = this.used;
final int mask = this.mask;
// The starting point.
int pos = ( it.unimi.dsi.fastutil.HashCommon.murmurHash3( strategy.hashCode( (K) (k)) ) ) & mask;
// There's always an unused entry.
while( used[ pos ] ) {
if ( ( strategy.equals( (k), (K) (key[ pos ]) ) ) ) {
final boolean oldValue = value[ pos ];
value[ pos ] = v;
moveIndexToFirst( pos );
return oldValue;
}
pos = ( pos + 1 ) & mask;
}
used[ pos ] = true;
key[ pos ] = k;
value[ pos ] = v;
if ( size == 0 ) {
first = last = pos;
// Special case of SET_UPPER_LOWER( link[ pos ], -1, -1 );
link[ pos ] = -1L;
}
else {
link[ first ] ^= ( ( link[ first ] ^ ( ( pos & 0xFFFFFFFFL ) << 32 ) ) & 0xFFFFFFFF00000000L );
link[ pos ] = ( ( -1 & 0xFFFFFFFFL ) << 32 ) | ( first & 0xFFFFFFFFL );
first = pos;
}
if ( ++size >= maxFill ) rehash( arraySize( size, f ) );
if ( ASSERTS ) checkTable();
return defRetValue;
}
|
boolean function( final K k, final boolean v ) { final K key[] = this.key; final boolean used[] = this.used; final int mask = this.mask; int pos = ( it.unimi.dsi.fastutil.HashCommon.murmurHash3( strategy.hashCode( (K) (k)) ) ) & mask; while( used[ pos ] ) { if ( ( strategy.equals( (k), (K) (key[ pos ]) ) ) ) { final boolean oldValue = value[ pos ]; value[ pos ] = v; moveIndexToFirst( pos ); return oldValue; } pos = ( pos + 1 ) & mask; } used[ pos ] = true; key[ pos ] = k; value[ pos ] = v; if ( size == 0 ) { first = last = pos; link[ pos ] = -1L; } else { link[ first ] ^= ( ( link[ first ] ^ ( ( pos & 0xFFFFFFFFL ) << 32 ) ) & 0xFFFFFFFF00000000L ); link[ pos ] = ( ( -1 & 0xFFFFFFFFL ) << 32 ) ( first & 0xFFFFFFFFL ); first = pos; } if ( ++size >= maxFill ) rehash( arraySize( size, f ) ); if ( ASSERTS ) checkTable(); return defRetValue; }
|
/** Adds a pair to the map; if the key is already present, it is moved to the first position of the iteration order.
*
* @param k the key.
* @param v the value.
* @return the old value, or the {@linkplain #defaultReturnValue() default return value} if no value was present for the given key.
*/
|
Adds a pair to the map; if the key is already present, it is moved to the first position of the iteration order
|
putAndMoveToFirst
|
{
"repo_name": "karussell/fastutil",
"path": "src/it/unimi/dsi/fastutil/objects/Object2BooleanLinkedOpenCustomHashMap.java",
"license": "apache-2.0",
"size": 48113
}
|
[
"it.unimi.dsi.fastutil.HashCommon"
] |
import it.unimi.dsi.fastutil.HashCommon;
|
import it.unimi.dsi.fastutil.*;
|
[
"it.unimi.dsi"
] |
it.unimi.dsi;
| 2,116,109
|
void saveReport( ModuleHandle moduleHandle, Object element,
IProgressMonitor monitor );
|
void saveReport( ModuleHandle moduleHandle, Object element, IProgressMonitor monitor );
|
/**
* Save moduleHandle to the orginal input.
*
* @param moduleHandle
* @param element
* input element.
* @param monitor
*/
|
Save moduleHandle to the orginal input
|
saveReport
|
{
"repo_name": "Charling-Huang/birt",
"path": "UI/org.eclipse.birt.report.designer.ui.editors/src/org/eclipse/birt/report/designer/ui/editors/IReportProvider.java",
"license": "epl-1.0",
"size": 3069
}
|
[
"org.eclipse.birt.report.model.api.ModuleHandle",
"org.eclipse.core.runtime.IProgressMonitor"
] |
import org.eclipse.birt.report.model.api.ModuleHandle; import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.birt.report.model.api.*; import org.eclipse.core.runtime.*;
|
[
"org.eclipse.birt",
"org.eclipse.core"
] |
org.eclipse.birt; org.eclipse.core;
| 2,234,714
|
public void sendImageToAllClients(BufferedImage img) {
Debug.out(Type.INFO, CLASS, "Everyone is trying to download a level!");
for(int i = 0; i < connectedPlayers.size() - 1; i++) {
try{
if(imageSocketServer == null) {
imageSocketServer = new ServerSocket(9714);
}
imageSocket = imageSocketServer.accept();
ImageIO.write(img, "PNG", imageSocket.getOutputStream());
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
|
void function(BufferedImage img) { Debug.out(Type.INFO, CLASS, STR); for(int i = 0; i < connectedPlayers.size() - 1; i++) { try{ if(imageSocketServer == null) { imageSocketServer = new ServerSocket(9714); } imageSocket = imageSocketServer.accept(); ImageIO.write(img, "PNG", imageSocket.getOutputStream()); } catch(Exception ex){ ex.printStackTrace(); } } }
|
/**
* Image sent to all the clients.
* @param img BufferedImage image.
*/
|
Image sent to all the clients
|
sendImageToAllClients
|
{
"repo_name": "RedInquisitive/Project-Tanks",
"path": "Project Shields/Client/game/net/GameServer.java",
"license": "gpl-3.0",
"size": 24516
}
|
[
"java.awt.image.BufferedImage",
"java.net.ServerSocket",
"javax.imageio.ImageIO"
] |
import java.awt.image.BufferedImage; import java.net.ServerSocket; import javax.imageio.ImageIO;
|
import java.awt.image.*; import java.net.*; import javax.imageio.*;
|
[
"java.awt",
"java.net",
"javax.imageio"
] |
java.awt; java.net; javax.imageio;
| 1,814,881
|
private void buildUpdateMap() {
DSCAlarmBindingConfig config;
for (DSCAlarmBindingProvider prov : providers) {
if (!prov.getItemNames().isEmpty()) {
itemCount = prov.getItemNames().size();
dscAlarmUpdateMap.clear();
for (String iName : prov.getItemNames()) {
config = prov.getDSCAlarmBindingConfig(iName);
if (config != null) {
dscAlarmUpdateMap.put(iName, config);
}
}
}
}
}
|
void function() { DSCAlarmBindingConfig config; for (DSCAlarmBindingProvider prov : providers) { if (!prov.getItemNames().isEmpty()) { itemCount = prov.getItemNames().size(); dscAlarmUpdateMap.clear(); for (String iName : prov.getItemNames()) { config = prov.getDSCAlarmBindingConfig(iName); if (config != null) { dscAlarmUpdateMap.put(iName, config); } } } } }
|
/**
* Build the Update Items Map
*/
|
Build the Update Items Map
|
buildUpdateMap
|
{
"repo_name": "mvolaart/openhab",
"path": "bundles/binding/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/DSCAlarmActiveBinding.java",
"license": "epl-1.0",
"size": 49642
}
|
[
"org.openhab.binding.dscalarm.DSCAlarmBindingConfig",
"org.openhab.binding.dscalarm.DSCAlarmBindingProvider"
] |
import org.openhab.binding.dscalarm.DSCAlarmBindingConfig; import org.openhab.binding.dscalarm.DSCAlarmBindingProvider;
|
import org.openhab.binding.dscalarm.*;
|
[
"org.openhab.binding"
] |
org.openhab.binding;
| 1,442,192
|
public void rollback(final Set<String> graphSourceNamesToCloseTxOn);
|
void function(final Set<String> graphSourceNamesToCloseTxOn);
|
/**
* Selectively rollback transactions on the specified graphs or the graphs of traversal sources.
*/
|
Selectively rollback transactions on the specified graphs or the graphs of traversal sources
|
rollback
|
{
"repo_name": "apache/tinkerpop",
"path": "gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java",
"license": "apache-2.0",
"size": 4870
}
|
[
"java.util.Set"
] |
import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,541,866
|
Optional<Long> getLong(String path);
|
Optional<Long> getLong(String path);
|
/**
* Reads from the given path. If the path does not exist, or if the type at the path is not
* compatible then {@link Optional#absent()} will be returned instead.
*
* @param path The path to read from
* @return The data
*/
|
Reads from the given path. If the path does not exist, or if the type at the path is not compatible then <code>Optional#absent()</code> will be returned instead
|
getLong
|
{
"repo_name": "Featherblade/VoxelGunsmith",
"path": "src/main/java/com/voxelplugineering/voxelsniper/service/persistence/DataView.java",
"license": "mit",
"size": 6642
}
|
[
"com.google.common.base.Optional"
] |
import com.google.common.base.Optional;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 1,866,138
|
public DocumentPropertiesResponse GetDocumentProperties (String name, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/tasks/{name}/documentproperties/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (DocumentPropertiesResponse) ApiInvoker.deserialize(response, "", DocumentPropertiesResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
|
DocumentPropertiesResponse function (String name, String storage, String folder) { Object postBody = null; if(name == null ) { throw new ApiException(400, STR); } String resourcePath = STR; resourcePath = resourcePath.replaceAll("\\*", STR&STR&STR/?STR?STRtoFormat={toFormat}STRformat={format}STR{STRnameSTR}STR[&?]name.*?(?=& \\? $)STRSTR{STRstorageSTR}STR[&?]storage.*?(?=& \\? $)STRSTR{STRfolderSTR}STR[&?]folder.*?(?=& \\? $)STRSTRapplication/jsonSTRapplication/jsonSTRGETSTRSTR"); } else { throw ex; } } }
|
/**
* GetDocumentProperties
* Read document properties.
* @param name String The document name.
* @param storage String The document storage.
* @param folder String The document folder.
* @return DocumentPropertiesResponse
*/
|
GetDocumentProperties Read document properties
|
GetDocumentProperties
|
{
"repo_name": "asposetaskscloud/Aspose.Tasks_Cloud_SDK_For_Java",
"path": "src/main/java/com/aspose/tasks/api/TasksApi.java",
"license": "mit",
"size": 107115
}
|
[
"com.aspose.tasks.client.ApiException",
"com.aspose.tasks.model.DocumentPropertiesResponse"
] |
import com.aspose.tasks.client.ApiException; import com.aspose.tasks.model.DocumentPropertiesResponse;
|
import com.aspose.tasks.client.*; import com.aspose.tasks.model.*;
|
[
"com.aspose.tasks"
] |
com.aspose.tasks;
| 1,379,784
|
private static void exists() {
if(!newVersion()) return;
Logger.getLogger(Config.class.getName()).log(Level.INFO, "Creando nueva configuración");
f = new File(basePath);
FileManager.deleteFolder(f);
//Crea todos los ficheros base
create(basePath);
create(pathAllDTD);
create(pathTemp);
create(pathShortCuts.replace("atajos.xml", ""));
// Comprueba que existan los ficheros, en caso contrario los copia
f = new File(pathConfig);
if(!f.exists()) {
ClassLoader cLoader = Config.class.getClassLoader();
try {
String[] names = {"BOPA", "DSPA", "DSCA", "DSCB", "DSSA"};
String[] extensions = {".dtd", ".css", ".xsl", "_config.xml"};
String path, dir;
for (String name : names) {
create(pathAllDTD + name + "/images");
dir = name + "/" + name;
path = "Assets/dtd/" + dir;
for (String ext : extensions) {
Files.copy(cLoader.getResourceAsStream(path + ext), Paths.get(pathAllDTD + dir + ext));
}
Files.copy(cLoader.getResourceAsStream("Assets/dtd/" + name + "/images/title.png"),
Paths.get(pathAllDTD + name + "/" + "images/title.png"));
}
Files.copy(cLoader.getResourceAsStream("Assets/config.xml"), Paths.get(pathConfig));
Files.copy(cLoader.getResourceAsStream("Assets/shortcuts/atajos.xml"), Paths.get(pathShortCuts));
} catch (Exception ex) {
Logger.getLogger(Config.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
|
static void function() { if(!newVersion()) return; Logger.getLogger(Config.class.getName()).log(Level.INFO, STR); f = new File(basePath); FileManager.deleteFolder(f); create(basePath); create(pathAllDTD); create(pathTemp); create(pathShortCuts.replace(STR, STRBOPASTRDSPASTRDSCASTRDSCBSTRDSSASTR.dtdSTR.cssSTR.xslSTR_config.xmlSTR/imagesSTR/STRAssets/dtd/STRAssets/dtd/STR/images/title.pngSTR/STRimages/title.pngSTRAssets/config.xmlSTRAssets/shortcuts/atajos.xml"), Paths.get(pathShortCuts)); } catch (Exception ex) { Logger.getLogger(Config.class.getName()).log(Level.SEVERE, null, ex); } } }
|
/**
* Comprueba que existen todos los ficheros y directorios necesarios para el
* uso del programa y los crea en caso contrario.
*/
|
Comprueba que existen todos los ficheros y directorios necesarios para el uso del programa y los crea en caso contrario
|
exists
|
{
"repo_name": "Elirova/TranscriptorPA",
"path": "source/Config/Config.java",
"license": "gpl-3.0",
"size": 12254
}
|
[
"java.io.File",
"java.nio.file.Paths",
"java.util.logging.Level",
"java.util.logging.Logger"
] |
import java.io.File; import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger;
|
import java.io.*; import java.nio.file.*; import java.util.logging.*;
|
[
"java.io",
"java.nio",
"java.util"
] |
java.io; java.nio; java.util;
| 1,130,165
|
public Vector<RecordElement> getRecordElements() {
return this.records;
}
|
Vector<RecordElement> function() { return this.records; }
|
/**
* Return INTERNAL Vector containing RecordElements. To get a copy of the actual LogRecords use
* getRecordArray().
*
* @return
*/
|
Return INTERNAL Vector containing RecordElements. To get a copy of the actual LogRecords use getRecordArray()
|
getRecordElements
|
{
"repo_name": "NLeSC/Platinum",
"path": "ptk-core/src/main/java/nl/esciencecenter/ptk/util/logging/RecordingLogHandler.java",
"license": "apache-2.0",
"size": 7834
}
|
[
"java.util.Vector"
] |
import java.util.Vector;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,883,566
|
public static StringValue chr(Env env, long value)
{
if (! env.isUnicodeSemantics())
value = value & 0xFF;
StringValue sb = env.createUnicodeBuilder();
sb.append((char) value);
return sb;
}
|
static StringValue function(Env env, long value) { if (! env.isUnicodeSemantics()) value = value & 0xFF; StringValue sb = env.createUnicodeBuilder(); sb.append((char) value); return sb; }
|
/**
* converts a number to its character equivalent
*
* @param value the integer value
*
* @return the string equivalent
*/
|
converts a number to its character equivalent
|
chr
|
{
"repo_name": "TheApacheCats/quercus",
"path": "com/caucho/quercus/lib/string/StringModule.java",
"license": "gpl-2.0",
"size": 152070
}
|
[
"com.caucho.quercus.env.Env",
"com.caucho.quercus.env.StringValue"
] |
import com.caucho.quercus.env.Env; import com.caucho.quercus.env.StringValue;
|
import com.caucho.quercus.env.*;
|
[
"com.caucho.quercus"
] |
com.caucho.quercus;
| 1,275,556
|
public void DISABLEDtestCompressFull() throws Exception {
assertEquals(339, testTrailerComp.length);
assertEquals(632, testTrailerDecomp.length);
// Compress it using our engine
HDGFLZW lzw = new HDGFLZW();
byte[] comp = lzw.compress(new ByteArrayInputStream(testTrailerDecomp));
// Now decompress it again
byte[] decomp = lzw.decompress(new ByteArrayInputStream(comp));
// for(int i=0; i<comp.length; i++) {
// System.err.println(i + "\t" + comp[i] + "\t" + testTrailerComp[i]);
// }
// First up, check the round tripping
// assertEquals(632, decomp.length);
for(int i=0; i<decomp.length; i++) {
assertEquals("Wrong at " + i, decomp[i], testTrailerDecomp[i]);
}
// Now check the compressed intermediate version
assertEquals(339, comp.length);
for(int i=0; i<comp.length; i++) {
assertEquals("Wrong at " + i, comp[i], testTrailerComp[i]);
}
}
|
void function() throws Exception { assertEquals(339, testTrailerComp.length); assertEquals(632, testTrailerDecomp.length); HDGFLZW lzw = new HDGFLZW(); byte[] comp = lzw.compress(new ByteArrayInputStream(testTrailerDecomp)); byte[] decomp = lzw.decompress(new ByteArrayInputStream(comp)); for(int i=0; i<decomp.length; i++) { assertEquals(STR + i, decomp[i], testTrailerDecomp[i]); } assertEquals(339, comp.length); for(int i=0; i<comp.length; i++) { assertEquals(STR + i, comp[i], testTrailerComp[i]); } }
|
/**
* Gets 160 bytes through then starts going wrong...
* TODO Fix this
*/
|
Gets 160 bytes through then starts going wrong... TODO Fix this
|
DISABLEDtestCompressFull
|
{
"repo_name": "lvweiwolf/poi-3.16",
"path": "src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java",
"license": "apache-2.0",
"size": 10520
}
|
[
"java.io.ByteArrayInputStream"
] |
import java.io.ByteArrayInputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 608,873
|
public static void setVmType( SearchResultRow row ) throws EucalyptusServiceException {
VmType input = deserializeVmType( row );
if ( input == null ) {
throw new EucalyptusServiceException( "Invalid input" );
}
Set<VmType> newVms = Sets.newTreeSet( );
for ( VmType v : VmTypes.list( ) ) {
if ( v.getName( ).equals( input.getName( ) ) ) {
newVms.add( input );
} else {
newVms.add( v );
}
}
try {
for ( VmType newVm : newVms ) {
VmType vmType = VmTypes.lookup( newVm.getName( ) );
if ( !vmType.equals( newVm ) ) {
vmType.setDisk( newVm.getDisk( ) );
vmType.setCpu( newVm.getCpu( ) );
vmType.setMemory( newVm.getMemory( ) );
VmTypes.update( vmType );
}
}
} catch ( NoSuchMetadataException e ) {
LOG.error( "Failed to update VmType for row " + row, e );
throw new EucalyptusServiceException( e.getMessage( ), e );
}
}
|
static void function( SearchResultRow row ) throws EucalyptusServiceException { VmType input = deserializeVmType( row ); if ( input == null ) { throw new EucalyptusServiceException( STR ); } Set<VmType> newVms = Sets.newTreeSet( ); for ( VmType v : VmTypes.list( ) ) { if ( v.getName( ).equals( input.getName( ) ) ) { newVms.add( input ); } else { newVms.add( v ); } } try { for ( VmType newVm : newVms ) { VmType vmType = VmTypes.lookup( newVm.getName( ) ); if ( !vmType.equals( newVm ) ) { vmType.setDisk( newVm.getDisk( ) ); vmType.setCpu( newVm.getCpu( ) ); vmType.setMemory( newVm.getMemory( ) ); VmTypes.update( vmType ); } } } catch ( NoSuchMetadataException e ) { LOG.error( STR + row, e ); throw new EucalyptusServiceException( e.getMessage( ), e ); } }
|
/**
* Update VmType by UI input.
*
* @param row
* @throws EucalyptusServiceException
*/
|
Update VmType by UI input
|
setVmType
|
{
"repo_name": "grze/parentheses",
"path": "clc/modules/www/src/main/java/com/eucalyptus/webui/server/VmTypeWebBackend.java",
"license": "gpl-3.0",
"size": 7988
}
|
[
"com.eucalyptus.cloud.util.NoSuchMetadataException",
"com.eucalyptus.vmtypes.VmType",
"com.eucalyptus.vmtypes.VmTypes",
"com.eucalyptus.webui.client.service.EucalyptusServiceException",
"com.eucalyptus.webui.client.service.SearchResultRow",
"com.google.common.collect.Sets",
"java.util.Set"
] |
import com.eucalyptus.cloud.util.NoSuchMetadataException; import com.eucalyptus.vmtypes.VmType; import com.eucalyptus.vmtypes.VmTypes; import com.eucalyptus.webui.client.service.EucalyptusServiceException; import com.eucalyptus.webui.client.service.SearchResultRow; import com.google.common.collect.Sets; import java.util.Set;
|
import com.eucalyptus.cloud.util.*; import com.eucalyptus.vmtypes.*; import com.eucalyptus.webui.client.service.*; import com.google.common.collect.*; import java.util.*;
|
[
"com.eucalyptus.cloud",
"com.eucalyptus.vmtypes",
"com.eucalyptus.webui",
"com.google.common",
"java.util"
] |
com.eucalyptus.cloud; com.eucalyptus.vmtypes; com.eucalyptus.webui; com.google.common; java.util;
| 379,553
|
private void sendNotification(String errorResp, String status, String message,
String acUrl, HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException {
String redirectURL = IdentityUtil.getServerURL(SAMLSSOConstants.NOTIFICATION_ENDPOINT);
//TODO Send status codes rather than full messages in the GET request
String queryParams = "?" + SAMLSSOConstants.STATUS + "=" + URLEncoder.encode(status, "UTF-8") +
"&" + SAMLSSOConstants.STATUS_MSG + "=" + URLEncoder.encode(message, "UTF-8");
if (errorResp != null) {
queryParams += "&" + SAMLSSOConstants.SAML_RESP + "=" + URLEncoder.encode(errorResp, "UTF-8");
}
if (acUrl != null) {
queryParams += "&" + SAMLSSOConstants.ASSRTN_CONSUMER_URL + "=" + URLEncoder.encode(acUrl, "UTF-8");
}
resp.sendRedirect(redirectURL + queryParams);
}
|
void function(String errorResp, String status, String message, String acUrl, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String redirectURL = IdentityUtil.getServerURL(SAMLSSOConstants.NOTIFICATION_ENDPOINT); String queryParams = "?" + SAMLSSOConstants.STATUS + "=" + URLEncoder.encode(status, "UTF-8") + "&" + SAMLSSOConstants.STATUS_MSG + "=" + URLEncoder.encode(message, "UTF-8"); if (errorResp != null) { queryParams += "&" + SAMLSSOConstants.SAML_RESP + "=" + URLEncoder.encode(errorResp, "UTF-8"); } if (acUrl != null) { queryParams += "&" + SAMLSSOConstants.ASSRTN_CONSUMER_URL + "=" + URLEncoder.encode(acUrl, "UTF-8"); } resp.sendRedirect(redirectURL + queryParams); }
|
/**
* Prompts user a notification with the status and message
*
* @param req
* @param resp
* @throws ServletException
* @throws IOException
*/
|
Prompts user a notification with the status and message
|
sendNotification
|
{
"repo_name": "kasungayan/carbon-identity",
"path": "components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/servlet/SAMLSSOProviderServlet.java",
"license": "apache-2.0",
"size": 44994
}
|
[
"java.io.IOException",
"java.net.URLEncoder",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.wso2.carbon.identity.core.util.IdentityUtil",
"org.wso2.carbon.identity.sso.saml.SAMLSSOConstants"
] |
import java.io.IOException; import java.net.URLEncoder; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.wso2.carbon.identity.core.util.IdentityUtil; import org.wso2.carbon.identity.sso.saml.SAMLSSOConstants;
|
import java.io.*; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; import org.wso2.carbon.identity.core.util.*; import org.wso2.carbon.identity.sso.saml.*;
|
[
"java.io",
"java.net",
"javax.servlet",
"org.wso2.carbon"
] |
java.io; java.net; javax.servlet; org.wso2.carbon;
| 1,475,834
|
static byte[] toIntegerBytes(BigInteger bigInt) {
int bitlen = bigInt.bitLength();
// round bitlen
bitlen = ((bitlen + 7) >> 3) << 3;
byte[] bigBytes = bigInt.toByteArray();
if (((bigInt.bitLength() % 8) != 0) && (((bigInt.bitLength() / 8) + 1) == (bitlen / 8))) {
return bigBytes;
}
// set up params for copying everything but sign bit
int startSrc = 0;
int len = bigBytes.length;
// if bigInt is exactly byte-aligned, just skip signbit in copy
if ((bigInt.bitLength() % 8) == 0) {
startSrc = 1;
len--;
}
int startDst = bitlen / 8 - len; // to pad w/ nulls as per spec
byte[] resizedBytes = new byte[bitlen / 8];
System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len);
return resizedBytes;
}
|
static byte[] toIntegerBytes(BigInteger bigInt) { int bitlen = bigInt.bitLength(); bitlen = ((bitlen + 7) >> 3) << 3; byte[] bigBytes = bigInt.toByteArray(); if (((bigInt.bitLength() % 8) != 0) && (((bigInt.bitLength() / 8) + 1) == (bitlen / 8))) { return bigBytes; } int startSrc = 0; int len = bigBytes.length; if ((bigInt.bitLength() % 8) == 0) { startSrc = 1; len--; } int startDst = bitlen / 8 - len; byte[] resizedBytes = new byte[bitlen / 8]; System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len); return resizedBytes; }
|
/**
* Returns a byte-array representation of a <code>BigInteger</code> without sign bit.
*
* @param bigInt
* <code>BigInteger</code> to be converted
* @return a byte array representation of the BigInteger parameter
*/
|
Returns a byte-array representation of a <code>BigInteger</code> without sign bit
|
toIntegerBytes
|
{
"repo_name": "pperboires/PocDrools",
"path": "drools-core/src/main/java/org/drools/util/codec/Base64.java",
"license": "apache-2.0",
"size": 40495
}
|
[
"java.math.BigInteger"
] |
import java.math.BigInteger;
|
import java.math.*;
|
[
"java.math"
] |
java.math;
| 2,277,277
|
public TreeNode parseXMLDocument(String uri, InputSource is)
throws AraneaRuntimeException {
Document document = null;
// Perform an XML parse of this document, via JAXP
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(validating);
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setEntityResolver(entityResolver);
builder.setErrorHandler(errorHandler);
document = builder.parse(is);
} catch (ParserConfigurationException ex) {
throw new AraneaRuntimeException
("jsp.error.parse.xml", ex);
} catch (SAXParseException ex) {
throw new AraneaRuntimeException
("jsp.error.parse.xml.line", ex);
} catch (SAXException sx) {
throw new AraneaRuntimeException
("jsp.error.parse.xml", sx);
} catch (IOException io) {
throw new AraneaRuntimeException
("jsp.error.parse.xml", io);
}
// Convert the resulting document to a graph of TreeNodes
return (convert(null, document.getDocumentElement()));
}
|
TreeNode function(String uri, InputSource is) throws AraneaRuntimeException { Document document = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(validating); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(entityResolver); builder.setErrorHandler(errorHandler); document = builder.parse(is); } catch (ParserConfigurationException ex) { throw new AraneaRuntimeException (STR, ex); } catch (SAXParseException ex) { throw new AraneaRuntimeException (STR, ex); } catch (SAXException sx) { throw new AraneaRuntimeException (STR, sx); } catch (IOException io) { throw new AraneaRuntimeException (STR, io); } return (convert(null, document.getDocumentElement())); }
|
/**
* Parse the specified XML document, and return a <code>TreeNode</code>
* that corresponds to the root node of the document tree.
*
* @param uri URI of the XML document being parsed
* @param is Input source containing the deployment descriptor
*
* @exception AraneaRuntimeException if an input/output error occurs
* @exception AraneaRuntimeException if a parsing error occurs
*/
|
Parse the specified XML document, and return a <code>TreeNode</code> that corresponds to the root node of the document tree
|
parseXMLDocument
|
{
"repo_name": "nortal/araneaframework",
"path": "src/org/araneaframework/http/support/ParserUtils.java",
"license": "apache-2.0",
"size": 7102
}
|
[
"java.io.IOException",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.parsers.ParserConfigurationException",
"org.araneaframework.core.AraneaRuntimeException",
"org.w3c.dom.Document",
"org.xml.sax.InputSource",
"org.xml.sax.SAXException",
"org.xml.sax.SAXParseException"
] |
import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.araneaframework.core.AraneaRuntimeException; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException;
|
import java.io.*; import javax.xml.parsers.*; import org.araneaframework.core.*; import org.w3c.dom.*; import org.xml.sax.*;
|
[
"java.io",
"javax.xml",
"org.araneaframework.core",
"org.w3c.dom",
"org.xml.sax"
] |
java.io; javax.xml; org.araneaframework.core; org.w3c.dom; org.xml.sax;
| 2,646,373
|
@Test
public void testMountTableEntriesCacheUpdatedAfterUpdateAPICall()
throws IOException {
// add
String srcPath = "/updatePathSrc";
String dstPath = "/updatePathDest";
String nameServiceId = "ns0";
MountTable newEntry = MountTable.newInstance(srcPath,
Collections.singletonMap("ns0", "/updatePathDest"), Time.now(),
Time.now());
addMountTableEntry(mountTableManager, newEntry);
// When add entry is done, all the routers must have updated its mount table
// entry
List<RouterContext> routers = getRouters();
for (RouterContext rc : routers) {
List<MountTable> result =
getMountTableEntries(rc.getAdminClient().getMountTableManager());
assertEquals(1, result.size());
MountTable mountTableResult = result.get(0);
assertEquals(srcPath, mountTableResult.getSourcePath());
assertEquals(nameServiceId,
mountTableResult.getDestinations().get(0).getNameserviceId());
assertEquals(dstPath,
mountTableResult.getDestinations().get(0).getDest());
}
// update
String key = "ns1";
String value = "/updatePathDest2";
MountTable upateEntry = MountTable.newInstance(srcPath,
Collections.singletonMap(key, value), Time.now(), Time.now());
UpdateMountTableEntryResponse updateMountTableEntry =
mountTableManager.updateMountTableEntry(
UpdateMountTableEntryRequest.newInstance(upateEntry));
assertTrue(updateMountTableEntry.getStatus());
MountTable updatedMountTable = getMountTableEntry(srcPath);
assertNotNull("Updated mount table entrty cannot be null",
updatedMountTable);
// When update entry is done, all the routers must have updated its mount
// table entry
routers = getRouters();
for (RouterContext rc : routers) {
List<MountTable> result =
getMountTableEntries(rc.getAdminClient().getMountTableManager());
assertEquals(1, result.size());
MountTable mountTableResult = result.get(0);
assertEquals(srcPath, mountTableResult.getSourcePath());
assertEquals(key, updatedMountTable.getDestinations().get(0)
.getNameserviceId());
assertEquals(value, updatedMountTable.getDestinations().get(0).getDest());
}
}
|
void function() throws IOException { String srcPath = STR; String dstPath = STR; String nameServiceId = "ns0"; MountTable newEntry = MountTable.newInstance(srcPath, Collections.singletonMap("ns0", STR), Time.now(), Time.now()); addMountTableEntry(mountTableManager, newEntry); List<RouterContext> routers = getRouters(); for (RouterContext rc : routers) { List<MountTable> result = getMountTableEntries(rc.getAdminClient().getMountTableManager()); assertEquals(1, result.size()); MountTable mountTableResult = result.get(0); assertEquals(srcPath, mountTableResult.getSourcePath()); assertEquals(nameServiceId, mountTableResult.getDestinations().get(0).getNameserviceId()); assertEquals(dstPath, mountTableResult.getDestinations().get(0).getDest()); } String key = "ns1"; String value = STR; MountTable upateEntry = MountTable.newInstance(srcPath, Collections.singletonMap(key, value), Time.now(), Time.now()); UpdateMountTableEntryResponse updateMountTableEntry = mountTableManager.updateMountTableEntry( UpdateMountTableEntryRequest.newInstance(upateEntry)); assertTrue(updateMountTableEntry.getStatus()); MountTable updatedMountTable = getMountTableEntry(srcPath); assertNotNull(STR, updatedMountTable); routers = getRouters(); for (RouterContext rc : routers) { List<MountTable> result = getMountTableEntries(rc.getAdminClient().getMountTableManager()); assertEquals(1, result.size()); MountTable mountTableResult = result.get(0); assertEquals(srcPath, mountTableResult.getSourcePath()); assertEquals(key, updatedMountTable.getDestinations().get(0) .getNameserviceId()); assertEquals(value, updatedMountTable.getDestinations().get(0).getDest()); } }
|
/**
* updateMountTableEntry API should internally update the cache on all the
* routers.
*/
|
updateMountTableEntry API should internally update the cache on all the routers
|
testMountTableEntriesCacheUpdatedAfterUpdateAPICall
|
{
"repo_name": "apurtell/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefreshSecure.java",
"license": "apache-2.0",
"size": 13680
}
|
[
"java.io.IOException",
"java.util.Collections",
"java.util.List",
"org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster",
"org.apache.hadoop.hdfs.server.federation.store.protocol.UpdateMountTableEntryRequest",
"org.apache.hadoop.hdfs.server.federation.store.protocol.UpdateMountTableEntryResponse",
"org.apache.hadoop.hdfs.server.federation.store.records.MountTable",
"org.apache.hadoop.util.Time",
"org.junit.Assert"
] |
import java.io.IOException; import java.util.Collections; import java.util.List; import org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster; import org.apache.hadoop.hdfs.server.federation.store.protocol.UpdateMountTableEntryRequest; import org.apache.hadoop.hdfs.server.federation.store.protocol.UpdateMountTableEntryResponse; import org.apache.hadoop.hdfs.server.federation.store.records.MountTable; import org.apache.hadoop.util.Time; import org.junit.Assert;
|
import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.server.federation.*; import org.apache.hadoop.hdfs.server.federation.store.protocol.*; import org.apache.hadoop.hdfs.server.federation.store.records.*; import org.apache.hadoop.util.*; import org.junit.*;
|
[
"java.io",
"java.util",
"org.apache.hadoop",
"org.junit"
] |
java.io; java.util; org.apache.hadoop; org.junit;
| 1,222,797
|
public ServletRegistration.Dynamic dynamicServletAdded(Wrapper wrapper) {
Servlet s = wrapper.getServlet();
if (s != null && createdServlets.contains(s)) {
// Mark the wrapper to indicate annotations need to be scanned
wrapper.setServletSecurityAnnotationScanRequired(true);
}
return new ApplicationServletRegistration(wrapper, this);
}
|
ServletRegistration.Dynamic function(Wrapper wrapper) { Servlet s = wrapper.getServlet(); if (s != null && createdServlets.contains(s)) { wrapper.setServletSecurityAnnotationScanRequired(true); } return new ApplicationServletRegistration(wrapper, this); }
|
/**
* hook to register that we need to scan for security annotations.
* @param wrapper The wrapper for the Servlet that was added
*/
|
hook to register that we need to scan for security annotations
|
dynamicServletAdded
|
{
"repo_name": "WhiteBearSolutions/WBSAirback",
"path": "packages/wbsairback-tomcat/wbsairback-tomcat-7.0.22/java/org/apache/catalina/core/StandardContext.java",
"license": "apache-2.0",
"size": 198551
}
|
[
"javax.servlet.Servlet",
"javax.servlet.ServletRegistration",
"org.apache.catalina.Wrapper"
] |
import javax.servlet.Servlet; import javax.servlet.ServletRegistration; import org.apache.catalina.Wrapper;
|
import javax.servlet.*; import org.apache.catalina.*;
|
[
"javax.servlet",
"org.apache.catalina"
] |
javax.servlet; org.apache.catalina;
| 1,555,199
|
public PaddingCallback getPaddingCallback() {
return paddingCallback;
}
|
PaddingCallback function() { return paddingCallback; }
|
/**
* Returns the padding callback, if set, otherwise <code>null</code>.
*
* @return the padding callback, if set, otherwise <code>null</code>.
*/
|
Returns the padding callback, if set, otherwise <code>null</code>
|
getPaddingCallback
|
{
"repo_name": "pepstock-org/Charba",
"path": "src/org/pepstock/charba/client/sankey/SankeyDataset.java",
"license": "apache-2.0",
"size": 34482
}
|
[
"org.pepstock.charba.client.sankey.callbacks.PaddingCallback"
] |
import org.pepstock.charba.client.sankey.callbacks.PaddingCallback;
|
import org.pepstock.charba.client.sankey.callbacks.*;
|
[
"org.pepstock.charba"
] |
org.pepstock.charba;
| 1,529,762
|
protected void doTestStartupWithOldVersion(String igniteVer, boolean compactFooter) throws Exception {
boolean prev = this.compactFooter;
try {
this.compactFooter = compactFooter;
startGrid(1, igniteVer, new ConfigurationClosure(compactFooter), new PostStartupClosure());
stopAllGrids();
IgniteEx ignite = startGrid(0);
assertEquals(1, ignite.context().discovery().topologyVersion());
ignite.active(true);
validateResultingCacheData(ignite.cache(TEST_CACHE_NAME));
}
finally {
stopAllGrids();
this.compactFooter = prev;
}
}
|
void function(String igniteVer, boolean compactFooter) throws Exception { boolean prev = this.compactFooter; try { this.compactFooter = compactFooter; startGrid(1, igniteVer, new ConfigurationClosure(compactFooter), new PostStartupClosure()); stopAllGrids(); IgniteEx ignite = startGrid(0); assertEquals(1, ignite.context().discovery().topologyVersion()); ignite.active(true); validateResultingCacheData(ignite.cache(TEST_CACHE_NAME)); } finally { stopAllGrids(); this.compactFooter = prev; } }
|
/**
* Tests opportunity to read data from previous Ignite DB version.
*
* @param igniteVer 3-digits version of ignite
* @throws Exception If failed.
*/
|
Tests opportunity to read data from previous Ignite DB version
|
doTestStartupWithOldVersion
|
{
"repo_name": "nizhikov/ignite",
"path": "modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java",
"license": "apache-2.0",
"size": 13663
}
|
[
"org.apache.ignite.internal.IgniteEx"
] |
import org.apache.ignite.internal.IgniteEx;
|
import org.apache.ignite.internal.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 1,522,115
|
public SortedSet<Pair<T, Integer>> sorted() {
// TODO (jon) change to use an array and Arrays.sort();
|
SortedSet<Pair<T, Integer>> function() {
|
/**
* Returns the histogram in frequency sorted order
*
* @return
*/
|
Returns the histogram in frequency sorted order
|
sorted
|
{
"repo_name": "anuragphadke/Flume-Hive",
"path": "src/java/com/cloudera/util/Histogram.java",
"license": "apache-2.0",
"size": 3817
}
|
[
"java.util.SortedSet"
] |
import java.util.SortedSet;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 548,806
|
public final List listOfImplementedFields(
final IFirstClassEntity firstClassEntity) {
final List results = new ArrayList();
final Iterator iterator =
firstClassEntity.getIteratorOnConstituents(IField.class);
while (iterator.hasNext()) {
final IField field = (IField) iterator.next();
results.add(field);
}
return results;
}
|
final List function( final IFirstClassEntity firstClassEntity) { final List results = new ArrayList(); final Iterator iterator = firstClassEntity.getIteratorOnConstituents(IField.class); while (iterator.hasNext()) { final IField field = (IField) iterator.next(); results.add(field); } return results; }
|
/**
* Returns the attributes defined directly in the class body
*
* @param firstClassEntity
* @return the attributes defined directly in the class body
*/
|
Returns the attributes defined directly in the class body
|
listOfImplementedFields
|
{
"repo_name": "ptidej/SmellDetectionCaller",
"path": "POM/src/pom/primitives/ClassPrimitives.java",
"license": "gpl-2.0",
"size": 15595
}
|
[
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List"
] |
import java.util.ArrayList; import java.util.Iterator; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,119,242
|
void removeInputPort(Port port);
|
void removeInputPort(Port port);
|
/**
* Removes a {@link Port} from this ProcessGroup's list of Input Ports.
*
* @param port the Port to remove
* @throws NullPointerException if <code>port</code> is null
* @throws IllegalStateException if port is not an Input Port for this
* ProcessGroup
*/
|
Removes a <code>Port</code> from this ProcessGroup's list of Input Ports
|
removeInputPort
|
{
"repo_name": "InspurUSA/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/groups/ProcessGroup.java",
"license": "apache-2.0",
"size": 33748
}
|
[
"org.apache.nifi.connectable.Port"
] |
import org.apache.nifi.connectable.Port;
|
import org.apache.nifi.connectable.*;
|
[
"org.apache.nifi"
] |
org.apache.nifi;
| 2,821,265
|
public Observable<ServiceResponse<DiagnosticAnalysisInner>> getSiteAnalysisWithServiceResponseAsync(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (siteName == null) {
throw new IllegalArgumentException("Parameter siteName is required and cannot be null.");
}
if (diagnosticCategory == null) {
throw new IllegalArgumentException("Parameter diagnosticCategory is required and cannot be null.");
}
if (analysisName == null) {
throw new IllegalArgumentException("Parameter analysisName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
|
Observable<ServiceResponse<DiagnosticAnalysisInner>> function(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (siteName == null) { throw new IllegalArgumentException(STR); } if (diagnosticCategory == null) { throw new IllegalArgumentException(STR); } if (analysisName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); }
|
/**
* Get Site Analysis.
* Get Site Analysis.
*
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param siteName Site Name
* @param diagnosticCategory Diagnostic Category
* @param analysisName Analysis Name
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the DiagnosticAnalysisInner object
*/
|
Get Site Analysis. Get Site Analysis
|
getSiteAnalysisWithServiceResponseAsync
|
{
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/appservice/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java",
"license": "mit",
"size": 295384
}
|
[
"com.microsoft.rest.ServiceResponse"
] |
import com.microsoft.rest.ServiceResponse;
|
import com.microsoft.rest.*;
|
[
"com.microsoft.rest"
] |
com.microsoft.rest;
| 1,904,760
|
public void handleSetSlot(S2FPacketSetSlot packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
if (packetIn.func_149175_c() == -1)
{
entityplayer.inventory.setItemStack(packetIn.func_149174_e());
}
else
{
boolean flag = false;
if (this.gameController.currentScreen instanceof GuiContainerCreative)
{
GuiContainerCreative guicontainercreative = (GuiContainerCreative)this.gameController.currentScreen;
flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.tabInventory.getTabIndex();
}
if (packetIn.func_149175_c() == 0 && packetIn.func_149173_d() >= 36 && packetIn.func_149173_d() < 45)
{
ItemStack itemstack = entityplayer.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack();
if (packetIn.func_149174_e() != null && (itemstack == null || itemstack.stackSize < packetIn.func_149174_e().stackSize))
{
packetIn.func_149174_e().animationsToGo = 5;
}
entityplayer.inventoryContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e());
}
else if (packetIn.func_149175_c() == entityplayer.openContainer.windowId && (packetIn.func_149175_c() != 0 || !flag))
{
entityplayer.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e());
}
}
}
|
void function(S2FPacketSetSlot packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); EntityPlayer entityplayer = this.gameController.thePlayer; if (packetIn.func_149175_c() == -1) { entityplayer.inventory.setItemStack(packetIn.func_149174_e()); } else { boolean flag = false; if (this.gameController.currentScreen instanceof GuiContainerCreative) { GuiContainerCreative guicontainercreative = (GuiContainerCreative)this.gameController.currentScreen; flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.tabInventory.getTabIndex(); } if (packetIn.func_149175_c() == 0 && packetIn.func_149173_d() >= 36 && packetIn.func_149173_d() < 45) { ItemStack itemstack = entityplayer.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack(); if (packetIn.func_149174_e() != null && (itemstack == null itemstack.stackSize < packetIn.func_149174_e().stackSize)) { packetIn.func_149174_e().animationsToGo = 5; } entityplayer.inventoryContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); } else if (packetIn.func_149175_c() == entityplayer.openContainer.windowId && (packetIn.func_149175_c() != 0 !flag)) { entityplayer.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); } } }
|
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container
*/
|
Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container
|
handleSetSlot
|
{
"repo_name": "tomtomtom09/CampCraft",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/network/NetHandlerPlayClient.java",
"license": "gpl-3.0",
"size": 95487
}
|
[
"net.minecraft.client.gui.inventory.GuiContainerCreative",
"net.minecraft.creativetab.CreativeTabs",
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.item.ItemStack",
"net.minecraft.network.PacketThreadUtil",
"net.minecraft.network.play.server.S2FPacketSetSlot"
] |
import net.minecraft.client.gui.inventory.GuiContainerCreative; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketThreadUtil; import net.minecraft.network.play.server.S2FPacketSetSlot;
|
import net.minecraft.client.gui.inventory.*; import net.minecraft.creativetab.*; import net.minecraft.entity.player.*; import net.minecraft.item.*; import net.minecraft.network.*; import net.minecraft.network.play.server.*;
|
[
"net.minecraft.client",
"net.minecraft.creativetab",
"net.minecraft.entity",
"net.minecraft.item",
"net.minecraft.network"
] |
net.minecraft.client; net.minecraft.creativetab; net.minecraft.entity; net.minecraft.item; net.minecraft.network;
| 2,106,806
|
public List<TPstateBean> loadByProjectTypeAndIssueTypes(Integer projectType, List<Integer> issueTypes);
|
List<TPstateBean> function(Integer projectType, List<Integer> issueTypes);
|
/**
* Load TPstateBeans by project types and issueTypes
* @param projectType
* @param issueTypes
* issueTypes
*/
|
Load TPstateBeans by project types and issueTypes
|
loadByProjectTypeAndIssueTypes
|
{
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/dao/PStatusDAO.java",
"license": "gpl-3.0",
"size": 2517
}
|
[
"com.aurel.track.beans.TPstateBean",
"java.util.List"
] |
import com.aurel.track.beans.TPstateBean; import java.util.List;
|
import com.aurel.track.beans.*; import java.util.*;
|
[
"com.aurel.track",
"java.util"
] |
com.aurel.track; java.util;
| 2,105,967
|
public boolean getVerbose() {
return verbose;
}
public ClassEnhancer(Set<String> packageNames) {
if (packageNames != null) {
packagePrefixes = new HashSet<String>();
for (String name : packageNames) {
packagePrefixes.add(name + '.');
}
}
}
|
boolean function() { return verbose; } public ClassEnhancer(Set<String> packageNames) { if (packageNames != null) { packagePrefixes = new HashSet<String>(); for (String name : packageNames) { packagePrefixes.add(name + '.'); } } }
|
/**
* Gets verbose mode.
*
* @see #setVerbose
*/
|
Gets verbose mode
|
getVerbose
|
{
"repo_name": "djsedulous/namecoind",
"path": "libs/db-4.7.25.NC/java/src/com/sleepycat/persist/model/ClassEnhancer.java",
"license": "mit",
"size": 10812
}
|
[
"java.util.HashSet",
"java.util.Set"
] |
import java.util.HashSet; import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,260,463
|
public final Charset charset() {
return cs;
}
/**
* This is a facade method for the decoding operation.
* <p>
* This method decodes the remaining byte sequence of the given byte buffer
* into a new character buffer. This method performs a complete decoding
* operation, resets at first, then decodes, and flushes at last.
* <p>
* This method should not be invoked while another {@code decode} operation
* is ongoing.
*
* @param in
* the input buffer.
* @return a new <code>CharBuffer</code> containing the the characters
* produced by this decoding operation. The buffer's limit will be
* the position of the last character in the buffer, and the
* position will be zero.
* @throws IllegalStateException
* if another decoding operation is ongoing.
* @throws MalformedInputException
* if an illegal input byte sequence for this charset was
* encountered, and the action for malformed error is
* {@link CodingErrorAction#REPORT CodingErrorAction.REPORT}
|
final Charset function() { return cs; } /** * This is a facade method for the decoding operation. * <p> * This method decodes the remaining byte sequence of the given byte buffer * into a new character buffer. This method performs a complete decoding * operation, resets at first, then decodes, and flushes at last. * <p> * This method should not be invoked while another {@code decode} operation * is ongoing. * * @param in * the input buffer. * @return a new <code>CharBuffer</code> containing the the characters * produced by this decoding operation. The buffer's limit will be * the position of the last character in the buffer, and the * position will be zero. * @throws IllegalStateException * if another decoding operation is ongoing. * @throws MalformedInputException * if an illegal input byte sequence for this charset was * encountered, and the action for malformed error is * {@link CodingErrorAction#REPORT CodingErrorAction.REPORT}
|
/**
* Returns the {@link Charset} which this decoder uses.
*/
|
Returns the <code>Charset</code> which this decoder uses
|
charset
|
{
"repo_name": "rex-xxx/mt6572_x201",
"path": "libcore/luni/src/main/java/java/nio/charset/CharsetDecoder.java",
"license": "gpl-2.0",
"size": 28393
}
|
[
"java.nio.CharBuffer"
] |
import java.nio.CharBuffer;
|
import java.nio.*;
|
[
"java.nio"
] |
java.nio;
| 2,855,273
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.