method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public final void initialize() { fPropertyNamesColor= getTokenProperties(); int length= fPropertyNamesColor.length; fPropertyNamesBold= new String[length]; fPropertyNamesItalic= new String[length]; fPropertyNamesStrikethrough= new String[length]; fPropertyNamesUnderline= new String[length]; for (int i= 0; i < length; i++) { fPropertyNamesBold[i]= getBoldKey(fPropertyNamesColor[i]); fPropertyNamesItalic[i]= getItalicKey(fPropertyNamesColor[i]); fPropertyNamesStrikethrough[i]= getStrikethroughKey(fPropertyNamesColor[i]); fPropertyNamesUnderline[i]= getUnderlineKey(fPropertyNamesColor[i]); } fNeedsLazyColorLoading= Display.getCurrent() == null; for (int i= 0; i < length; i++) { if (fNeedsLazyColorLoading) addTokenWithProxyAttribute(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); else addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } initializeRules(); }
final void function() { fPropertyNamesColor= getTokenProperties(); int length= fPropertyNamesColor.length; fPropertyNamesBold= new String[length]; fPropertyNamesItalic= new String[length]; fPropertyNamesStrikethrough= new String[length]; fPropertyNamesUnderline= new String[length]; for (int i= 0; i < length; i++) { fPropertyNamesBold[i]= getBoldKey(fPropertyNamesColor[i]); fPropertyNamesItalic[i]= getItalicKey(fPropertyNamesColor[i]); fPropertyNamesStrikethrough[i]= getStrikethroughKey(fPropertyNamesColor[i]); fPropertyNamesUnderline[i]= getUnderlineKey(fPropertyNamesColor[i]); } fNeedsLazyColorLoading= Display.getCurrent() == null; for (int i= 0; i < length; i++) { if (fNeedsLazyColorLoading) addTokenWithProxyAttribute(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); else addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } initializeRules(); }
/** * Must be called after the constructor has been called. */
Must be called after the constructor has been called
initialize
{ "repo_name": "boniatillo-com/PhaserEditor", "path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/AbstractJavaScanner.java", "license": "epl-1.0", "size": 12312 }
[ "org.eclipse.swt.widgets.Display" ]
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,333,593
static public ObjectName register(String serviceName, String nameName, Object theMbean) { return register(serviceName, nameName, Collections.emptyMap(), theMbean); }
static ObjectName function(String serviceName, String nameName, Object theMbean) { return register(serviceName, nameName, Collections.emptyMap(), theMbean); }
/** * Register the MBean using our standard MBeanName format * "hadoop:service={@literal <serviceName>,name=<nameName>}" * Where the {@literal <serviceName> and <nameName>} are the supplied * parameters. * * @param serviceName * @param nameName * @param theMbean - the MBean to register * @return the named used to register the MBean */
Register the MBean using our standard MBeanName format "hadoop:service=,name=" Where the and are the supplied parameters
register
{ "repo_name": "JingchengDu/hadoop", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MBeans.java", "license": "apache-2.0", "size": 6134 }
[ "java.util.Collections", "javax.management.ObjectName" ]
import java.util.Collections; import javax.management.ObjectName;
import java.util.*; import javax.management.*;
[ "java.util", "javax.management" ]
java.util; javax.management;
726,124
void addKeyReadInCommand(Object key, InternalGMUCacheEntry entry);
void addKeyReadInCommand(Object key, InternalGMUCacheEntry entry);
/** * add the key to a map between key and {@link InternalGMUCacheEntry}. This entry has all the information needed to calculate * the new transaction version. This is a temporary map and should be clear before (or after) each command * * @param entry the entry read */
add the key to a map between key and <code>InternalGMUCacheEntry</code>. This entry has all the information needed to calculate the new transaction version. This is a temporary map and should be clear before (or after) each command
addKeyReadInCommand
{ "repo_name": "nmldiegues/stibt", "path": "infinispan/core/src/main/java/org/infinispan/context/InvocationContext.java", "license": "apache-2.0", "size": 5788 }
[ "org.infinispan.container.entries.gmu.InternalGMUCacheEntry" ]
import org.infinispan.container.entries.gmu.InternalGMUCacheEntry;
import org.infinispan.container.entries.gmu.*;
[ "org.infinispan.container" ]
org.infinispan.container;
2,133,159
public Observable<ServiceResponse<VolumeInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (poolName == null) { throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); } if (volumeName == null) { throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); } if (body == null) { throw new IllegalArgumentException("Parameter body is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(body); Observable<Response<ResponseBody>> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<VolumeInner>() { }.getType()); }
Observable<ServiceResponse<VolumeInner>> function(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (accountName == null) { throw new IllegalArgumentException(STR); } if (poolName == null) { throw new IllegalArgumentException(STR); } if (volumeName == null) { throw new IllegalArgumentException(STR); } if (body == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } Validator.validate(body); Observable<Response<ResponseBody>> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<VolumeInner>() { }.getType()); }
/** * Create or update a volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param poolName The name of the capacity pool * @param volumeName The name of the volume * @param body Volume object supplied in the body of the operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */
Create or update a volume
createOrUpdateWithServiceResponseAsync
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/netapp/mgmt-v2017_08_15/src/main/java/com/microsoft/azure/management/netapp/v2017_08_15/implementation/VolumesInner.java", "license": "mit", "size": 44578 }
[ "com.google.common.reflect.TypeToken", "com.microsoft.rest.ServiceResponse", "com.microsoft.rest.Validator" ]
import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator;
import com.google.common.reflect.*; import com.microsoft.rest.*;
[ "com.google.common", "com.microsoft.rest" ]
com.google.common; com.microsoft.rest;
316,189
void addIdentity(JSch jsch) throws JSchException;
void addIdentity(JSch jsch) throws JSchException;
/** * Add this identity to the given JSch. * * @param jsch Target JSch. * @throws JSchException If I/O error occurs. */
Add this identity to the given JSch
addIdentity
{ "repo_name": "apache/commons-vfs", "path": "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityProvider.java", "license": "apache-2.0", "size": 1228 }
[ "com.jcraft.jsch.JSch", "com.jcraft.jsch.JSchException" ]
import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.*;
[ "com.jcraft.jsch" ]
com.jcraft.jsch;
1,260,809
protected void addPreferencePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_WorkstepSkill_preference_feature"), getString("_UI_PropertyDescriptor_description", "_UI_WorkstepSkill_preference_feature", "_UI_WorkstepSkill_type"), StaffPackage.Literals.WORKSTEP_SKILL__PREFERENCE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), StaffPackage.Literals.WORKSTEP_SKILL__PREFERENCE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Preference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Preference feature.
addPreferencePropertyDescriptor
{ "repo_name": "BaSys-PC1/models", "path": "de.dfki.iui.basys.model.domain.edit/src/de/dfki/iui/basys/model/domain/staff/provider/WorkstepSkillItemProvider.java", "license": "epl-1.0", "size": 5897 }
[ "de.dfki.iui.basys.model.domain.staff.StaffPackage", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import de.dfki.iui.basys.model.domain.staff.StaffPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import de.dfki.iui.basys.model.domain.staff.*; import org.eclipse.emf.edit.provider.*;
[ "de.dfki.iui", "org.eclipse.emf" ]
de.dfki.iui; org.eclipse.emf;
2,075,831
private PyStatement prepareStatement(PyObject sql, PyObject maxRows, boolean prepared) { PyStatement stmt = null; if (sql == Py.None) { return null; } try { if (sql instanceof PyStatement) { stmt = (PyStatement)sql; } else { Statement sqlStatement = null; String sqlString = sql instanceof PyUnicode ? sql.toString() : sql.__str__().toString(); if (sqlString.trim().length() == 0) { return null; } boolean normal = (this.rsType == Py.None && this.rsConcur == Py.None); if (normal) { if (prepared) { sqlStatement = this.connection.connection.prepareStatement(sqlString); } else { sqlStatement = this.connection.connection.createStatement(); } } else { int t = this.rsType.asInt(); int c = this.rsConcur.asInt(); if (prepared) { sqlStatement = this.connection.connection.prepareStatement(sqlString, t, c); } else { sqlStatement = this.connection.connection.createStatement(t, c); } } int style = prepared ? PyStatement.STATEMENT_PREPARED : PyStatement.STATEMENT_STATIC; stmt = new PyStatement(sqlStatement, sqlString, style); } if (maxRows != Py.None) { stmt.statement.setMaxRows(maxRows.asInt()); } } catch (AbstractMethodError e) { throw zxJDBC.makeException(zxJDBC.NotSupportedError, zxJDBC.getString("nodynamiccursors")); } catch (PyException e) { throw e; } catch (Throwable e) { throw zxJDBC.makeException(e); } return stmt; }
PyStatement function(PyObject sql, PyObject maxRows, boolean prepared) { PyStatement stmt = null; if (sql == Py.None) { return null; } try { if (sql instanceof PyStatement) { stmt = (PyStatement)sql; } else { Statement sqlStatement = null; String sqlString = sql instanceof PyUnicode ? sql.toString() : sql.__str__().toString(); if (sqlString.trim().length() == 0) { return null; } boolean normal = (this.rsType == Py.None && this.rsConcur == Py.None); if (normal) { if (prepared) { sqlStatement = this.connection.connection.prepareStatement(sqlString); } else { sqlStatement = this.connection.connection.createStatement(); } } else { int t = this.rsType.asInt(); int c = this.rsConcur.asInt(); if (prepared) { sqlStatement = this.connection.connection.prepareStatement(sqlString, t, c); } else { sqlStatement = this.connection.connection.createStatement(t, c); } } int style = prepared ? PyStatement.STATEMENT_PREPARED : PyStatement.STATEMENT_STATIC; stmt = new PyStatement(sqlStatement, sqlString, style); } if (maxRows != Py.None) { stmt.statement.setMaxRows(maxRows.asInt()); } } catch (AbstractMethodError e) { throw zxJDBC.makeException(zxJDBC.NotSupportedError, zxJDBC.getString(STR)); } catch (PyException e) { throw e; } catch (Throwable e) { throw zxJDBC.makeException(e); } return stmt; }
/** * Prepare a statement ready for executing. * * @param sql the sql to execute or a prepared statement * @param maxRows max number of rows to be returned * @param prepared if true, prepare the statement, otherwise create a normal statement * * @return PyStatement */
Prepare a statement ready for executing
prepareStatement
{ "repo_name": "alvin319/CarnotKE", "path": "jyhton/src/com/ziclix/python/sql/PyCursor.java", "license": "apache-2.0", "size": 36242 }
[ "java.sql.Statement", "org.python.core.Py", "org.python.core.PyException", "org.python.core.PyObject", "org.python.core.PyUnicode" ]
import java.sql.Statement; import org.python.core.Py; import org.python.core.PyException; import org.python.core.PyObject; import org.python.core.PyUnicode;
import java.sql.*; import org.python.core.*;
[ "java.sql", "org.python.core" ]
java.sql; org.python.core;
111,556
void setClasses(List<Classes> classes) { this.classes = classes; }
void setClasses(List<Classes> classes) { this.classes = classes; }
/** * set the list of classes * @param classes */
set the list of classes
setClasses
{ "repo_name": "semanticchess/semanticchess", "path": "src/main/java/de/daug/semanticchess/Parser/Parser.java", "license": "gpl-3.0", "size": 40047 }
[ "de.daug.semanticchess.Parser", "java.util.List" ]
import de.daug.semanticchess.Parser; import java.util.List;
import de.daug.semanticchess.*; import java.util.*;
[ "de.daug.semanticchess", "java.util" ]
de.daug.semanticchess; java.util;
516,313
public ServiceFuture<TroubleshootingResultInner> getTroubleshootingAsync(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters, final ServiceCallback<TroubleshootingResultInner> serviceCallback) { return ServiceFuture.fromResponse(getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters), serviceCallback); }
ServiceFuture<TroubleshootingResultInner> function(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters, final ServiceCallback<TroubleshootingResultInner> serviceCallback) { return ServiceFuture.fromResponse(getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters), serviceCallback); }
/** * Initiate troubleshooting on a specified resource. * * @param resourceGroupName The name of the resource group. * @param networkWatcherName The name of the network watcher resource. * @param parameters Parameters that define the resource to troubleshoot. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Initiate troubleshooting on a specified resource
getTroubleshootingAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java", "license": "mit", "size": 171166 }
[ "com.microsoft.azure.management.network.v2017_10_01.TroubleshootingParameters", "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.azure.management.network.v2017_10_01.TroubleshootingParameters; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.azure.management.network.v2017_10_01.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,168,627
public Result hasNoInfoMessage() { return hasNoFeedbackMessage(FeedbackMessage.INFO); }
Result function() { return hasNoFeedbackMessage(FeedbackMessage.INFO); }
/** * Asserts no info-level feedback messages. * * @return a <code>Result</code> * @see #hasNoFeedbackMessage(int) */
Asserts no info-level feedback messages
hasNoInfoMessage
{ "repo_name": "AlienQueen/wicket", "path": "wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java", "license": "apache-2.0", "size": 83429 }
[ "org.apache.wicket.feedback.FeedbackMessage" ]
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.feedback.*;
[ "org.apache.wicket" ]
org.apache.wicket;
1,281,170
public void disableResponder(ResponderCallback callback) { if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } validateChannel(); int key = removeListener(callback); if (key == INVALID_KEY) { Log.e(TAG, "responder not enabled yet"); return; } mAsyncChannel.sendMessage(CMD_OP_DISABLE_RESPONDER, 0, key); } public static class ResponderConfig implements Parcelable { // TODO: make all fields final once we can get mac address from responder HAL APIs. public String macAddress = ""; public int frequency; public int centerFreq0; public int centerFreq1; public int channelWidth; public int preamble;
void function(ResponderCallback callback) { if (callback == null) { throw new IllegalArgumentException(STR); } validateChannel(); int key = removeListener(callback); if (key == INVALID_KEY) { Log.e(TAG, STR); return; } mAsyncChannel.sendMessage(CMD_OP_DISABLE_RESPONDER, 0, key); } public static class ResponderConfig implements Parcelable { public String macAddress = ""; public int frequency; public int centerFreq0; public int centerFreq1; public int channelWidth; public int preamble;
/** * Disable Wi-Fi RTT responder mode on the device. The {@code callback} needs to be the * same one used in {@link #enableResponder(ResponderCallback)}. * <p> * Calling this method when responder isn't enabled won't have any effect. The callback can be * reused for enabling responder after this method is called. * * @param callback The same callback used for enabling responder. * @throws IllegalArgumentException If {@code callback} is null. */
Disable Wi-Fi RTT responder mode on the device. The callback needs to be the same one used in <code>#enableResponder(ResponderCallback)</code>. Calling this method when responder isn't enabled won't have any effect. The callback can be reused for enabling responder after this method is called
disableResponder
{ "repo_name": "xorware/android_frameworks_base", "path": "wifi/java/android/net/wifi/RttManager.java", "license": "apache-2.0", "size": 50089 }
[ "android.os.Parcelable", "android.util.Log" ]
import android.os.Parcelable; import android.util.Log;
import android.os.*; import android.util.*;
[ "android.os", "android.util" ]
android.os; android.util;
641,836
private void savePicture(){ FileOutputStream out; try { out = new FileOutputStream( String.format("/sdcard/%d.jpg", System.currentTimeMillis())); tempBM.compress(Bitmap.CompressFormat.JPEG, 90, out); if (tempBM != null) { tempBM.recycle(); tempBM = null; } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } //Calls reset method to reboot picture mode: resetPictureStatus(); }
void function(){ FileOutputStream out; try { out = new FileOutputStream( String.format(STR, System.currentTimeMillis())); tempBM.compress(Bitmap.CompressFormat.JPEG, 90, out); if (tempBM != null) { tempBM.recycle(); tempBM = null; } } catch (FileNotFoundException e) { e.printStackTrace(); } resetPictureStatus(); }
/** * Saves the picture into the SD card. * @param byte[] (picture data) * @return void * @author ajuarez@tanukiteam.com */
Saves the picture into the SD card
savePicture
{ "repo_name": "agustinjuarez/android-camera-api", "path": "Camera API/src/com/tanukiteam/camera/CameraAPIActivity.java", "license": "unlicense", "size": 39614 }
[ "android.graphics.Bitmap", "java.io.FileNotFoundException", "java.io.FileOutputStream" ]
import android.graphics.Bitmap; import java.io.FileNotFoundException; import java.io.FileOutputStream;
import android.graphics.*; import java.io.*;
[ "android.graphics", "java.io" ]
android.graphics; java.io;
569,242
private Area getWorldMapClipArea(Rectangle baseRectangle) { final Widget overview = client.getWidget(WidgetInfo.WORLD_MAP_OVERVIEW_MAP); final Widget surfaceSelector = client.getWidget(WidgetInfo.WORLD_MAP_SURFACE_SELECTOR); Area clipArea = new Area(baseRectangle); if (overview != null && !overview.isHidden()) { clipArea.subtract(new Area(overview.getBounds())); } if (surfaceSelector != null && !surfaceSelector.isHidden()) { clipArea.subtract(new Area(surfaceSelector.getBounds())); } return clipArea; }
Area function(Rectangle baseRectangle) { final Widget overview = client.getWidget(WidgetInfo.WORLD_MAP_OVERVIEW_MAP); final Widget surfaceSelector = client.getWidget(WidgetInfo.WORLD_MAP_SURFACE_SELECTOR); Area clipArea = new Area(baseRectangle); if (overview != null && !overview.isHidden()) { clipArea.subtract(new Area(overview.getBounds())); } if (surfaceSelector != null && !surfaceSelector.isHidden()) { clipArea.subtract(new Area(surfaceSelector.getBounds())); } return clipArea; }
/** * Gets a clip area which excludes the area of widgets which overlay the world map. * * @param baseRectangle The base area to clip from * @return An {@link Area} representing <code>baseRectangle</code>, with the area * of visible widgets overlaying the world map clipped from it. */
Gets a clip area which excludes the area of widgets which overlay the world map
getWorldMapClipArea
{ "repo_name": "abelbriggs1/runelite", "path": "runelite-client/src/main/java/net/runelite/client/ui/overlay/worldmap/WorldMapOverlay.java", "license": "bsd-2-clause", "size": 10213 }
[ "java.awt.Rectangle", "java.awt.geom.Area", "net.runelite.api.widgets.Widget", "net.runelite.api.widgets.WidgetInfo" ]
import java.awt.Rectangle; import java.awt.geom.Area; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo;
import java.awt.*; import java.awt.geom.*; import net.runelite.api.widgets.*;
[ "java.awt", "net.runelite.api" ]
java.awt; net.runelite.api;
564,911
private ContainerState checkContainer(ContainerAccessType accessType) throws StorageException, AzureException { synchronized (containerStateLock) { if (isOkContainerState(accessType)) { return currentKnownContainerState; } if (currentKnownContainerState == ContainerState.ExistsAtWrongVersion) { String containerVersion = retrieveVersionAttribute(container); throw wrongVersionException(containerVersion); } // This means I didn't check it before or it didn't exist or // we need to stamp the version. Since things may have changed by // other machines since then, do the check again and don't depend // on past information. // Sanity check: we don't expect this at this point. if (currentKnownContainerState == ContainerState.ExistsAtRightVersion) { throw new AssertionError("Unexpected state: " + currentKnownContainerState); } // Download the attributes - doubles as an existence check with just // one service call try { container.downloadAttributes(getInstrumentedContext()); currentKnownContainerState = ContainerState.Unknown; } catch (StorageException ex) { if (ex.getErrorCode().equals( StorageErrorCode.RESOURCE_NOT_FOUND.toString())) { currentKnownContainerState = ContainerState.DoesntExist; } else { throw ex; } } if (currentKnownContainerState == ContainerState.DoesntExist) { // If the container doesn't exist and we intend to write to it, // create it now. if (needToCreateContainer(accessType)) { storeVersionAttribute(container); container.create(getInstrumentedContext()); currentKnownContainerState = ContainerState.ExistsAtRightVersion; } } else { // The container exists, check the version. String containerVersion = retrieveVersionAttribute(container); if (containerVersion != null) { if (containerVersion.equals(FIRST_WASB_VERSION)) { // It's the version from when WASB was called ASV, just // fix the version attribute if needed and proceed. // We should be good otherwise. if (needToStampVersion(accessType)) { storeVersionAttribute(container); container.uploadMetadata(getInstrumentedContext()); } } else if (!containerVersion.equals(CURRENT_WASB_VERSION)) { // Don't know this version - throw. currentKnownContainerState = ContainerState.ExistsAtWrongVersion; throw wrongVersionException(containerVersion); } else { // It's our correct version. currentKnownContainerState = ContainerState.ExistsAtRightVersion; } } else { // No version info exists. currentKnownContainerState = ContainerState.ExistsNoVersion; if (needToStampVersion(accessType)) { // Need to stamp the version storeVersionAttribute(container); container.uploadMetadata(getInstrumentedContext()); currentKnownContainerState = ContainerState.ExistsAtRightVersion; } } } return currentKnownContainerState; } }
ContainerState function(ContainerAccessType accessType) throws StorageException, AzureException { synchronized (containerStateLock) { if (isOkContainerState(accessType)) { return currentKnownContainerState; } if (currentKnownContainerState == ContainerState.ExistsAtWrongVersion) { String containerVersion = retrieveVersionAttribute(container); throw wrongVersionException(containerVersion); } if (currentKnownContainerState == ContainerState.ExistsAtRightVersion) { throw new AssertionError(STR + currentKnownContainerState); } try { container.downloadAttributes(getInstrumentedContext()); currentKnownContainerState = ContainerState.Unknown; } catch (StorageException ex) { if (ex.getErrorCode().equals( StorageErrorCode.RESOURCE_NOT_FOUND.toString())) { currentKnownContainerState = ContainerState.DoesntExist; } else { throw ex; } } if (currentKnownContainerState == ContainerState.DoesntExist) { if (needToCreateContainer(accessType)) { storeVersionAttribute(container); container.create(getInstrumentedContext()); currentKnownContainerState = ContainerState.ExistsAtRightVersion; } } else { String containerVersion = retrieveVersionAttribute(container); if (containerVersion != null) { if (containerVersion.equals(FIRST_WASB_VERSION)) { if (needToStampVersion(accessType)) { storeVersionAttribute(container); container.uploadMetadata(getInstrumentedContext()); } } else if (!containerVersion.equals(CURRENT_WASB_VERSION)) { currentKnownContainerState = ContainerState.ExistsAtWrongVersion; throw wrongVersionException(containerVersion); } else { currentKnownContainerState = ContainerState.ExistsAtRightVersion; } } else { currentKnownContainerState = ContainerState.ExistsNoVersion; if (needToStampVersion(accessType)) { storeVersionAttribute(container); container.uploadMetadata(getInstrumentedContext()); currentKnownContainerState = ContainerState.ExistsAtRightVersion; } } } return currentKnownContainerState; } }
/** * This should be called from any method that does any modifications to the * underlying container: it makes sure to put the WASB current version in the * container's metadata if it's not already there. */
This should be called from any method that does any modifications to the underlying container: it makes sure to put the WASB current version in the container's metadata if it's not already there
checkContainer
{ "repo_name": "NJUJYB/disYarn", "path": "hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java", "license": "apache-2.0", "size": 103496 }
[ "com.microsoft.azure.storage.StorageErrorCode", "com.microsoft.azure.storage.StorageException" ]
import com.microsoft.azure.storage.StorageErrorCode; import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,920,103
checkColumnBounds(columnIndex); String fieldEncoding = this.fields[columnIndex - 1].getCharacterSet(); if (fieldEncoding == null || !fieldEncoding.equals("UTF-8")) { throw new SQLException( "Can not call getNCharacterStream() when field's charset isn't UTF-8"); } return getCharacterStream(columnIndex); }
checkColumnBounds(columnIndex); String fieldEncoding = this.fields[columnIndex - 1].getCharacterSet(); if (fieldEncoding == null !fieldEncoding.equals("UTF-8")) { throw new SQLException( STR); } return getCharacterStream(columnIndex); }
/** * JDBC 4.0 * * <p> * Get the value of a column in the current row as a java.io.Reader. * </p> * * @param columnIndex * the column to get the value from * * @return the value in the column as a java.io.Reader. * * @throws SQLException * if an error occurs */
JDBC 4.0 Get the value of a column in the current row as a java.io.Reader.
getNCharacterStream
{ "repo_name": "google-code/blufeedme", "path": "material/BDs/mysql-connector-java-5.1.13/src/com/mysql/jdbc/JDBC4ResultSet.java", "license": "gpl-3.0", "size": 17141 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,810,195
public void onRecordAfterUpdate(final ORecord iRecord) { }
void function(final ORecord iRecord) { }
/** * It's called just after the iRecord is updated. * * @param iRecord * The iRecord just updated */
It's called just after the iRecord is updated
onRecordAfterUpdate
{ "repo_name": "sanyaade-g2g-repos/orientdb", "path": "core/src/main/java/com/orientechnologies/orient/core/hook/ORecordHookAbstract.java", "license": "apache-2.0", "size": 6282 }
[ "com.orientechnologies.orient.core.record.ORecord" ]
import com.orientechnologies.orient.core.record.ORecord;
import com.orientechnologies.orient.core.record.*;
[ "com.orientechnologies.orient" ]
com.orientechnologies.orient;
573,273
public static void startActivityForResult(@NonNull final Fragment fragment, @NonNull final Intent intent, final int requestCode, @AnimRes final int enterAnim, @AnimRes final int exitAnim) { startActivityForResult(intent, fragment, requestCode, getOptionsBundle(fragment, enterAnim, exitAnim)); }
static void function(@NonNull final Fragment fragment, @NonNull final Intent intent, final int requestCode, @AnimRes final int enterAnim, @AnimRes final int exitAnim) { startActivityForResult(intent, fragment, requestCode, getOptionsBundle(fragment, enterAnim, exitAnim)); }
/** * Start the activity for result. * * @param fragment The fragment. * @param intent The description of the activity to start. * @param requestCode if &gt;= 0, this code will be returned in * onActivityResult() when the activity exits. * @param enterAnim A resource ID of the animation resource to use for the * incoming activity. * @param exitAnim A resource ID of the animation resource to use for the * outgoing activity. */
Start the activity for result
startActivityForResult
{ "repo_name": "didi/DoraemonKit", "path": "Android/dokit-util/src/main/java/com/didichuxing/doraemonkit/util/ActivityUtils.java", "license": "apache-2.0", "size": 90700 }
[ "android.app.Fragment", "android.content.Intent", "androidx.annotation.AnimRes", "androidx.annotation.NonNull", "androidx.fragment.app.Fragment" ]
import android.app.Fragment; import android.content.Intent; import androidx.annotation.AnimRes; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment;
import android.app.*; import android.content.*; import androidx.annotation.*; import androidx.fragment.app.*;
[ "android.app", "android.content", "androidx.annotation", "androidx.fragment" ]
android.app; android.content; androidx.annotation; androidx.fragment;
2,638,896
public List<FakeTrackSelection> getSelectedTrackSelections() { return selectedTrackSelections; }
List<FakeTrackSelection> function() { return selectedTrackSelections; }
/** * Returns list of all {@link FakeTrackSelection}s that this track selector has made so far. */
Returns list of all <code>FakeTrackSelection</code>s that this track selector has made so far
getSelectedTrackSelections
{ "repo_name": "KiminRyu/ExoPlayer", "path": "testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTrackSelector.java", "license": "apache-2.0", "size": 3340 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
133,493
public UpdateResponse addBeans(Collection<?> beans ) throws SolrServerException, IOException { return addBeans(beans, -1); }
UpdateResponse function(Collection<?> beans ) throws SolrServerException, IOException { return addBeans(beans, -1); }
/** * Adds a collection of beans * @param beans the collection of beans * @throws SolrServerException * @throws IOException */
Adds a collection of beans
addBeans
{ "repo_name": "Lythimus/lptv", "path": "apache-solr-3.6.0/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java", "license": "gpl-2.0", "size": 12363 }
[ "java.io.IOException", "java.util.Collection", "org.apache.solr.client.solrj.response.UpdateResponse" ]
import java.io.IOException; import java.util.Collection; import org.apache.solr.client.solrj.response.UpdateResponse;
import java.io.*; import java.util.*; import org.apache.solr.client.solrj.response.*;
[ "java.io", "java.util", "org.apache.solr" ]
java.io; java.util; org.apache.solr;
698,022
public static final void extractJAR(File zFile, String extractDir) throws IOException { File extractFile = new File(extractDir); if ( !extractFile.exists() ) { extractFile.mkdirs(); } if ( !zFile.exists() ) { throw new IOException(zFile + " does not exist."); } ZipFile zipFile = new ZipFile(zFile); try { Enumeration<? extends ZipEntry> entries = zipFile.entries(); byte[] buf = new byte[BUFFER_LENGTH]; while ( entries.hasMoreElements() ) { ZipEntry entry = entries.nextElement(); String entryName = entry.getName(); if ( entryName.startsWith("META-INF") ) { continue; } File entryFile = new File(extractDir, entryName); //Is a directory? if ( entry.isDirectory() ) { entryFile.mkdirs(); continue; } //Make sure the dir path is ready entryFile.getParentFile().mkdirs(); FileOutputStream fos = null; try { fos = new FileOutputStream(entryFile); int len; InputStream is = zipFile.getInputStream(entry); while ( (len=is.read(buf, 0, BUFFER_LENGTH)) > -1 ) { fos.write(buf, 0, len); } } finally { fos.close(); } } } finally { zipFile.close(); } }
static final void function(File zFile, String extractDir) throws IOException { File extractFile = new File(extractDir); if ( !extractFile.exists() ) { extractFile.mkdirs(); } if ( !zFile.exists() ) { throw new IOException(zFile + STR); } ZipFile zipFile = new ZipFile(zFile); try { Enumeration<? extends ZipEntry> entries = zipFile.entries(); byte[] buf = new byte[BUFFER_LENGTH]; while ( entries.hasMoreElements() ) { ZipEntry entry = entries.nextElement(); String entryName = entry.getName(); if ( entryName.startsWith(STR) ) { continue; } File entryFile = new File(extractDir, entryName); if ( entry.isDirectory() ) { entryFile.mkdirs(); continue; } entryFile.getParentFile().mkdirs(); FileOutputStream fos = null; try { fos = new FileOutputStream(entryFile); int len; InputStream is = zipFile.getInputStream(entry); while ( (len=is.read(buf, 0, BUFFER_LENGTH)) > -1 ) { fos.write(buf, 0, len); } } finally { fos.close(); } } } finally { zipFile.close(); } }
/** * Extract the jar file content from given stream to the extract dir. * @param jarStream * @param extractDir */
Extract the jar file content from given stream to the extract dir
extractJAR
{ "repo_name": "wangqi/gameserver", "path": "bootstrap/src/main/java/com/xinqihd/sns/gameserver/util/IOUtil.java", "license": "apache-2.0", "size": 11737 }
[ "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.io.InputStream", "java.util.Enumeration", "java.util.zip.ZipEntry", "java.util.zip.ZipFile" ]
import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile;
import java.io.*; import java.util.*; import java.util.zip.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,330,165
void setHoursViewHeaderFormat(DateTimeFormat hoursViewHeaderFormat);
void setHoursViewHeaderFormat(DateTimeFormat hoursViewHeaderFormat);
/** * Set format of header on hours view. * * @param hoursViewHeaderFormat format of header on hours view. */
Set format of header on hours view
setHoursViewHeaderFormat
{ "repo_name": "gwt-DateTimeBox/gwt-DateTimeBox", "path": "datetimepicker/src/main/java/com/github/gwt/user/client/ui/DateTimePickerSpecification.java", "license": "apache-2.0", "size": 3558 }
[ "com.google.gwt.i18n.client.DateTimeFormat" ]
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.*;
[ "com.google.gwt" ]
com.google.gwt;
1,001,182
public static void assertContainerHasVolumes(InspectContainerResponse inspectContainerResponse, Volume ... expectedVolumes) { VolumeBind[] volumeBinds = inspectContainerResponse.getVolumes(); LOG.info("Inspect .Volumes = [{}]", Joiner.on(", ").join(volumeBinds)); List<Volume> volumes = new ArrayList<Volume>(); for (VolumeBind bind : volumeBinds) { volumes.add(new Volume(bind.getContainerPath())); } assertThat(volumes, contains(expectedVolumes)); }
static void function(InspectContainerResponse inspectContainerResponse, Volume ... expectedVolumes) { VolumeBind[] volumeBinds = inspectContainerResponse.getVolumes(); LOG.info(STR, Joiner.on(STR).join(volumeBinds)); List<Volume> volumes = new ArrayList<Volume>(); for (VolumeBind bind : volumeBinds) { volumes.add(new Volume(bind.getContainerPath())); } assertThat(volumes, contains(expectedVolumes)); }
/** * Asserts that {@link InspectContainerResponse#getVolumes()} (<code>.Volumes</code>) * has {@link VolumeBind}s for the given {@link Volume}s */
Asserts that <code>InspectContainerResponse#getVolumes()</code> (<code>.Volumes</code>) has <code>VolumeBind</code>s for the given <code>Volume</code>s
assertContainerHasVolumes
{ "repo_name": "hermeswaldemarin/docker-java", "path": "src/test/java/com/github/dockerjava/client/AbstractDockerClientTest.java", "license": "apache-2.0", "size": 5347 }
[ "com.github.dockerjava.api.command.InspectContainerResponse", "com.github.dockerjava.api.model.Volume", "com.github.dockerjava.api.model.VolumeBind", "com.google.common.base.Joiner", "java.util.ArrayList", "java.util.List", "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers" ]
import com.github.dockerjava.api.command.InspectContainerResponse; import com.github.dockerjava.api.model.Volume; import com.github.dockerjava.api.model.VolumeBind; import com.google.common.base.Joiner; import java.util.ArrayList; import java.util.List; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
import com.github.dockerjava.api.command.*; import com.github.dockerjava.api.model.*; import com.google.common.base.*; import java.util.*; import org.hamcrest.*;
[ "com.github.dockerjava", "com.google.common", "java.util", "org.hamcrest" ]
com.github.dockerjava; com.google.common; java.util; org.hamcrest;
2,822,464
public IObjectStore getObjectStore() { return this.objectStore; }
IObjectStore function() { return this.objectStore; }
/** * Get the object store of the synchronised folder. * <b>Note</b>: This method may return null before the node is connected. * * @return The Object Store of the synchronised folder */
Get the object store of the synchronised folder. Note: This method may return null before the node is connected
getObjectStore
{ "repo_name": "p2p-sync/sync", "path": "src/main/java/org/rmatil/sync/core/Sync.java", "license": "apache-2.0", "size": 17999 }
[ "org.rmatil.sync.version.api.IObjectStore" ]
import org.rmatil.sync.version.api.IObjectStore;
import org.rmatil.sync.version.api.*;
[ "org.rmatil.sync" ]
org.rmatil.sync;
1,892,818
Optional<byte[]> getByteArray(String path);
Optional<byte[]> getByteArray(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
getByteArray
{ "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,135
public static boolean isSameDay(final Date date1, final Date date2, final TimeZone timeZone) { final Calendar cal1 = new GregorianCalendar(timeZone); cal1.setTime(date1); final Calendar cal2 = new GregorianCalendar(timeZone); cal2.setTime(date2); return isSameDay(cal1, cal2); }
static boolean function(final Date date1, final Date date2, final TimeZone timeZone) { final Calendar cal1 = new GregorianCalendar(timeZone); cal1.setTime(date1); final Calendar cal2 = new GregorianCalendar(timeZone); cal2.setTime(date2); return isSameDay(cal1, cal2); }
/** * Check if two dates are in the same day in given time zone * * @param date1 * the first date * @param date2 * the first date * @param timeZone * the time zone * @return true if two dates are in the same day in given time zone */
Check if two dates are in the same day in given time zone
isSameDay
{ "repo_name": "thexman/commons", "path": "src/main/java/com/a9ski/utils/DateUtils.java", "license": "apache-2.0", "size": 24945 }
[ "java.util.Calendar", "java.util.Date", "java.util.GregorianCalendar", "java.util.TimeZone" ]
import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone;
import java.util.*;
[ "java.util" ]
java.util;
2,412,203
private SetupNetworksParameters createParametersForBond(VdsNetworkInterface bond, List<VdsNetworkInterface> bondedIfaces) { SetupNetworksParameters parameters = new SetupNetworksParameters(); parameters.getInterfaces().add(bond); for (VdsNetworkInterface iface : bondedIfaces) { parameters.getInterfaces().add(enslaveOrReleaseNIC(iface, bond.getName())); } return parameters; }
SetupNetworksParameters function(VdsNetworkInterface bond, List<VdsNetworkInterface> bondedIfaces) { SetupNetworksParameters parameters = new SetupNetworksParameters(); parameters.getInterfaces().add(bond); for (VdsNetworkInterface iface : bondedIfaces) { parameters.getInterfaces().add(enslaveOrReleaseNIC(iface, bond.getName())); } return parameters; }
/** * Create parameters for the given bond over the given interfaces. * * @param bond * The bond to use in parameters. * @param bondedIfaces * The interfaces to use as bond slaves. * @return Parameters that define a bond over 2 interfaces. */
Create parameters for the given bond over the given interfaces
createParametersForBond
{ "repo_name": "jbeecham/ovirt-engine", "path": "backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/SetupNetworksHelperTest.java", "license": "apache-2.0", "size": 50252 }
[ "java.util.List", "org.ovirt.engine.core.common.action.SetupNetworksParameters", "org.ovirt.engine.core.common.businessentities.VdsNetworkInterface" ]
import java.util.List; import org.ovirt.engine.core.common.action.SetupNetworksParameters; import org.ovirt.engine.core.common.businessentities.VdsNetworkInterface;
import java.util.*; import org.ovirt.engine.core.common.action.*; import org.ovirt.engine.core.common.businessentities.*;
[ "java.util", "org.ovirt.engine" ]
java.util; org.ovirt.engine;
2,101,979
protected Color getDisabledTextColor() { return disabledTextColor; }
Color function() { return disabledTextColor; }
/** * Returns the color for the text label of disabled buttons. The value * is initialised in the {@link #installDefaults(AbstractButton)} method * by reading the <code>ToggleButton.disabledText</code> item from the UI * defaults. * * @return The color for the text label of disabled buttons. */
Returns the color for the text label of disabled buttons. The value is initialised in the <code>#installDefaults(AbstractButton)</code> method by reading the <code>ToggleButton.disabledText</code> item from the UI defaults
getDisabledTextColor
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java", "license": "gpl-2.0", "size": 7035 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,208,805
public OutputStream getOutputStream(String name) throws IOException { return this.getOutputStream(name, null); }
OutputStream function(String name) throws IOException { return this.getOutputStream(name, null); }
/** * Returns the output stream for the given configuration file in the given world. * * @param name The name of the configuration file. * @return The OutputStream to write data into. * @throws IOException If an IO-Operation fails. */
Returns the output stream for the given configuration file in the given world
getOutputStream
{ "repo_name": "StuxSoftware/SimpleDev", "path": "Configuration/src/main/java/net/stuxcrystal/simpledev/configuration/storage/ModuleConfigurationLoader.java", "license": "apache-2.0", "size": 14613 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,725,233
public static void generate(InterchangeWriter<InterchangeMasterSchedule> iWriter) { // InterchangeMasterSchedule interchange = new InterchangeMasterSchedule(); // List<ComplexObjectType> interchangeObjects = interchange.getCourseOfferingOrSectionOrBellSchedule(); writeEntitiesToInterchange(iWriter); // return interchange; }
static void function(InterchangeWriter<InterchangeMasterSchedule> iWriter) { writeEntitiesToInterchange(iWriter); }
/** * Sets up a new Master Schedule Interchange and populates it * * @return */
Sets up a new Master Schedule Interchange and populates it
generate
{ "repo_name": "inbloom/secure-data-service", "path": "tools/data-tools/src/org/slc/sli/test/generators/interchange/InterchangeMasterScheduleGenerator.java", "license": "apache-2.0", "size": 4319 }
[ "org.slc.sli.test.edfi.entities.InterchangeMasterSchedule", "org.slc.sli.test.utils.InterchangeWriter" ]
import org.slc.sli.test.edfi.entities.InterchangeMasterSchedule; import org.slc.sli.test.utils.InterchangeWriter;
import org.slc.sli.test.edfi.entities.*; import org.slc.sli.test.utils.*;
[ "org.slc.sli" ]
org.slc.sli;
908,392
public Class<? extends ResourceStateMachine> type() { return type; }
Class<? extends ResourceStateMachine> function() { return type; }
/** * Returns the resource state machine class. * * @return The resource state machine class. */
Returns the resource state machine class
type
{ "repo_name": "madjam/copycat", "path": "manager/src/main/java/io/atomix/manager/CreateResource.java", "license": "apache-2.0", "size": 2427 }
[ "io.atomix.resource.ResourceStateMachine" ]
import io.atomix.resource.ResourceStateMachine;
import io.atomix.resource.*;
[ "io.atomix.resource" ]
io.atomix.resource;
1,985,606
@Test public void whenDivFourDivideTwoThenTwo() { Calculator calc = new Calculator(); calc.add(4D, 2D); double result = calc.getResult(); double expected = 2D; assertThat(result, is(expected)); }
void function() { Calculator calc = new Calculator(); calc.add(4D, 2D); double result = calc.getResult(); double expected = 2D; assertThat(result, is(expected)); }
/** * Test Divide. */
Test Divide
whenDivFourDivideTwoThenTwo
{ "repo_name": "EvgeniyVinnitskiy/evinnitskiy", "path": "chapter_001/src/test/java/ru/job4j/calculator/CalculatorTest.java", "license": "apache-2.0", "size": 1396 }
[ "org.hamcrest.core.Is", "org.junit.Assert" ]
import org.hamcrest.core.Is; import org.junit.Assert;
import org.hamcrest.core.*; import org.junit.*;
[ "org.hamcrest.core", "org.junit" ]
org.hamcrest.core; org.junit;
1,148,924
protected void addIsAutonomousPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Module_isAutonomous_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Module_isAutonomous_feature", "_UI_Module_type"), DtmcPackage.Literals.MODULE__IS_AUTONOMOUS, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), DtmcPackage.Literals.MODULE__IS_AUTONOMOUS, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Is Autonomous feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Is Autonomous feature.
addIsAutonomousPropertyDescriptor
{ "repo_name": "aciancone/klapersuite", "path": "klapersuite.metamodel.dtmc.edit/src/dtmc/provider/ModuleItemProvider.java", "license": "epl-1.0", "size": 6254 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,914,669
public static void incr( final char[][] array, final long index ) { array[ segment( index ) ][ displacement( index ) ]++; }
static void function( final char[][] array, final long index ) { array[ segment( index ) ][ displacement( index ) ]++; }
/** Increments the element of the given big array of specified index. * * @param array a big array. * @param index a position in the big array. */
Increments the element of the given big array of specified index
incr
{ "repo_name": "karussell/fastutil", "path": "src/it/unimi/dsi/fastutil/chars/CharBigArrays.java", "license": "apache-2.0", "size": 50859 }
[ "it.unimi.dsi.fastutil.BigArrays" ]
import it.unimi.dsi.fastutil.BigArrays;
import it.unimi.dsi.fastutil.*;
[ "it.unimi.dsi" ]
it.unimi.dsi;
1,983,581
public static FileStatus[] listChildren(FileSystem fileSystem, Path path) throws IOException { FileStatus[] entries = fileSystem.listStatus(path); if (entries.length == 1 && path.equals(entries[0].getPath())) { // this is the path: ignore return new FileStatus[]{}; } else { return entries; } }
static FileStatus[] function(FileSystem fileSystem, Path path) throws IOException { FileStatus[] entries = fileSystem.listStatus(path); if (entries.length == 1 && path.equals(entries[0].getPath())) { return new FileStatus[]{}; } else { return entries; } }
/** * List all children of a path, but not the path itself in the case * that the path refers to a file or empty directory. * @param fileSystem FS * @param path path * @return a list of children, and never the path itself. * @throws IOException problem in the list process */
List all children of a path, but not the path itself in the case that the path refers to a file or empty directory
listChildren
{ "repo_name": "huafengw/hadoop", "path": "hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/ContractTestUtils.java", "license": "apache-2.0", "size": 54281 }
[ "java.io.IOException", "org.apache.hadoop.fs.FileStatus", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path" ]
import java.io.IOException; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;
import java.io.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,298,204
public void setEndpoint( Endpoint endpoint) { this.srEndpoint = endpoint; } }
void function( Endpoint endpoint) { this.srEndpoint = endpoint; } }
/** * Sets the endpoint. * @param endpoint the endpoint. */
Sets the endpoint
setEndpoint
{ "repo_name": "ChetnaChaudhari/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/dns/BaseServiceRecordProcessor.java", "license": "apache-2.0", "size": 13749 }
[ "org.apache.hadoop.registry.client.types.Endpoint" ]
import org.apache.hadoop.registry.client.types.Endpoint;
import org.apache.hadoop.registry.client.types.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
970,826
protected boolean isSavedUserValid(HttpServletRequest request, Principal savedUser) { return true; }
boolean function(HttpServletRequest request, Principal savedUser) { return true; }
/** * Returns the non-authenticated principal for the user request */
Returns the non-authenticated principal for the user request
isSavedUserValid
{ "repo_name": "WelcomeHUME/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/security/AbstractLogin.java", "license": "gpl-2.0", "size": 20066 }
[ "java.security.Principal", "javax.servlet.http.HttpServletRequest" ]
import java.security.Principal; import javax.servlet.http.HttpServletRequest;
import java.security.*; import javax.servlet.http.*;
[ "java.security", "javax.servlet" ]
java.security; javax.servlet;
1,019,849
private boolean isEmbeddedDriverRegistered() { String clientDriverName = getClientDriverName(); for (Enumeration<Driver> e = DriverManager.getDrivers(); e.hasMoreElements(); ) { Driver d = e.nextElement(); String driverClass = d.getClass().getName(); if (!driverClass.startsWith("org.apache.derby.")) continue; if (driverClass.equals( clientDriverName )) continue; println( "Found " + driverClass ); // Some form of Derby embedded driver seems to be registered. return true; } return false; }
boolean function() { String clientDriverName = getClientDriverName(); for (Enumeration<Driver> e = DriverManager.getDrivers(); e.hasMoreElements(); ) { Driver d = e.nextElement(); String driverClass = d.getClass().getName(); if (!driverClass.startsWith(STR)) continue; if (driverClass.equals( clientDriverName )) continue; println( STR + driverClass ); return true; } return false; }
/** * Return true if there appears to be a Derby embedded * driver registered with the DriverManager. * @return true if there appears to be a Derby embedded driver registered */
Return true if there appears to be a Derby embedded driver registered with the DriverManager
isEmbeddedDriverRegistered
{ "repo_name": "apache/derby", "path": "java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java", "license": "apache-2.0", "size": 27219 }
[ "java.sql.Driver", "java.sql.DriverManager", "java.util.Enumeration" ]
import java.sql.Driver; import java.sql.DriverManager; import java.util.Enumeration;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
1,196,968
public static DB parseList( Ptg[] dbrange ) { int prevCol = -1; int nCols = 0; int nRows = 0; int maxRows = 0; // allocate the empty table for the dbrange for( Ptg aDbrange1 : dbrange ) { if( aDbrange1 instanceof PtgRef ) { PtgRef pref = (PtgRef) aDbrange1; int[] loc = pref.getIntLocation(); // TODO: check rc sanity here if( loc[1] != prevCol ) { // count # cols prevCol = loc[1]; nCols++; nRows = 0; } else { // count # rows nRows++; maxRows = Math.max( nRows, maxRows ); } } else { return null; } } // now populate the table DB dblist = new DB( nCols, maxRows ); prevCol = -1; nCols = -1; nRows = -1; for( Ptg aDbrange : dbrange ) { PtgRef db1 = (PtgRef) aDbrange; int[] loc = db1.getIntLocation(); Object vs = null; // 20081120 KSC: Must distinguish between blanks and 0's if( !db1.isBlank() ) { vs = db1.getValue(); } // column headers if( loc[1] != prevCol ) { if( vs != null ) { dblist.colHeaders[++nCols] = vs.toString(); } prevCol = loc[1]; nRows = 0; } else { // get value Ptgs try { dblist.rows[nRows++][nCols] = db1; } catch( ArrayIndexOutOfBoundsException e ) { ; // possible nCols==-1 } } } return dblist; } } class Criteria extends DB { private static final Logger log = LoggerFactory.getLogger( Criteria.class ); public Criteria( int nCols, int nRows ) { super( nCols, nRows ); }
static DB function( Ptg[] dbrange ) { int prevCol = -1; int nCols = 0; int nRows = 0; int maxRows = 0; for( Ptg aDbrange1 : dbrange ) { if( aDbrange1 instanceof PtgRef ) { PtgRef pref = (PtgRef) aDbrange1; int[] loc = pref.getIntLocation(); if( loc[1] != prevCol ) { prevCol = loc[1]; nCols++; nRows = 0; } else { nRows++; maxRows = Math.max( nRows, maxRows ); } } else { return null; } } DB dblist = new DB( nCols, maxRows ); prevCol = -1; nCols = -1; nRows = -1; for( Ptg aDbrange : dbrange ) { PtgRef db1 = (PtgRef) aDbrange; int[] loc = db1.getIntLocation(); Object vs = null; if( !db1.isBlank() ) { vs = db1.getValue(); } if( loc[1] != prevCol ) { if( vs != null ) { dblist.colHeaders[++nCols] = vs.toString(); } prevCol = loc[1]; nRows = 0; } else { try { dblist.rows[nRows++][nCols] = db1; } catch( ArrayIndexOutOfBoundsException e ) { ; } } } return dblist; } } class Criteria extends DB { private static final Logger log = LoggerFactory.getLogger( Criteria.class ); public Criteria( int nCols, int nRows ) { super( nCols, nRows ); }
/** * Write some documentation here please... thanks! -jm * * @param dbrange * @return */
Write some documentation here please... thanks! -jm
parseList
{ "repo_name": "Maxels88/openxls", "path": "src/main/java/org/openxls/formats/XLS/formulas/DatabaseCalculator.java", "license": "gpl-3.0", "size": 36823 }
[ "org.slf4j.Logger", "org.slf4j.LoggerFactory" ]
import org.slf4j.Logger; import org.slf4j.LoggerFactory;
import org.slf4j.*;
[ "org.slf4j" ]
org.slf4j;
644,578
public boolean isRowData() { return token == TDS_ROW_TOKEN || token == TDS_ALTROW; } } private static class TableMetaData { String catalog; String schema; String name; } // // Package private constants // public static final int MIN_PKT_SIZE = 512; public static final int DEFAULT_MIN_PKT_SIZE_TDS70 = 4096; public static final int MAX_PKT_SIZE = 32768; public static final int PKT_HDR_LEN = 8; public static final byte QUERY_PKT = 1; public static final byte LOGIN_PKT = 2; public static final byte RPC_PKT = 3; public static final byte REPLY_PKT = 4; public static final byte CANCEL_PKT = 6; public static final byte MSDTC_PKT = 14; public static final byte SYBQUERY_PKT = 15; public static final byte MSLOGIN_PKT = 16; public static final byte NTLMAUTH_PKT = 17; public static final byte PRELOGIN_PKT = 18; public static final int SSL_ENCRYPT_LOGIN = 0; public static final int SSL_CLIENT_FORCE_ENCRYPT = 1; public static final int SSL_NO_ENCRYPT = 2; public static final int SSL_SERVER_FORCE_ENCRYPT = 3; // // Sub packet types // private static final byte TDS5_PARAMFMT2_TOKEN = (byte) 32; // 0x20 private static final byte TDS_LANG_TOKEN = (byte) 33; // 0x21 private static final byte TDS5_WIDE_RESULT = (byte) 97; // 0x61 private static final byte TDS_CLOSE_TOKEN = (byte) 113; // 0x71 private static final byte TDS_OFFSETS_TOKEN = (byte) 120; // 0x78 private static final byte TDS_RETURNSTATUS_TOKEN= (byte) 121; // 0x79 private static final byte TDS_PROCID = (byte) 124; // 0x7C private static final byte TDS7_RESULT_TOKEN = (byte) 129; // 0x81 private static final byte ALTMETADATA_TOKEN = (byte) 136; // 0x88 private static final byte TDS_COLNAME_TOKEN = (byte) 160; // 0xA0 private static final byte TDS_COLFMT_TOKEN = (byte) 161; // 0xA1 private static final byte TDS_TABNAME_TOKEN = (byte) 164; // 0xA4 private static final byte TDS_COLINFO_TOKEN = (byte) 165; // 0xA5 private static final byte TDS_ALT_NAMES_TOKEN = (byte) 167; // 0xA7 private static final byte TDS_ALT_RESULT_TOKEN = (byte) 168; // 0xA8 private static final byte TDS_ORDER_TOKEN = (byte) 169; // 0xA9 private static final byte TDS_ERROR_TOKEN = (byte) 170; // 0xAA private static final byte TDS_INFO_TOKEN = (byte) 171; // 0xAB private static final byte TDS_PARAM_TOKEN = (byte) 172; // 0xAC private static final byte TDS_LOGINACK_TOKEN = (byte) 173; // 0xAD private static final byte TDS_CONTROL_TOKEN = (byte) 174; // 0xAE private static final byte TDS_ROW_TOKEN = (byte) 209; // 0xD1 private static final byte TDS_ALTROW = (byte) 211; // 0xD3 private static final byte TDS5_PARAMS_TOKEN = (byte) 215; // 0xD7 private static final byte TDS_CAP_TOKEN = (byte) 226; // 0xE2 private static final byte TDS_ENVCHANGE_TOKEN = (byte) 227; // 0xE3 private static final byte TDS_MSG50_TOKEN = (byte) 229; // 0xE5 private static final byte TDS_DBRPC_TOKEN = (byte) 230; // 0xE6 private static final byte TDS5_DYNAMIC_TOKEN = (byte) 231; // 0xE7 private static final byte TDS5_PARAMFMT_TOKEN = (byte) 236; // 0xEC private static final byte TDS_AUTH_TOKEN = (byte) 237; // 0xED private static final byte TDS_RESULT_TOKEN = (byte) 238; // 0xEE private static final byte TDS_DONE_TOKEN = (byte) 253; // 0xFD DONE private static final byte TDS_DONEPROC_TOKEN = (byte) 254; // 0xFE DONEPROC private static final byte TDS_DONEINPROC_TOKEN = (byte) 255; // 0xFF DONEINPROC // // Environment change payload codes // private static final byte TDS_ENV_DATABASE = (byte) 1; private static final byte TDS_ENV_LANG = (byte) 2; private static final byte TDS_ENV_CHARSET = (byte) 3; private static final byte TDS_ENV_PACKSIZE = (byte) 4; private static final byte TDS_ENV_LCID = (byte) 5; private static final byte TDS_ENV_SQLCOLLATION = (byte) 7; // TDS8 Collation // // Static variables used only for performance // private static final ParamInfo[] EMPTY_PARAMETER_INFO = new ParamInfo[0]; // // End token status bytes // private static final byte DONE_MORE_RESULTS = (byte) 0x01; private static final byte DONE_ERROR = (byte) 0x02; private static final byte DONE_ROW_COUNT = (byte) 0x10; static final byte DONE_CANCEL = (byte) 0x20; private static final byte DONE_END_OF_RESPONSE = (byte) 0x80; // // Prepared SQL types // public static final int UNPREPARED = 0; public static final int TEMPORARY_STORED_PROCEDURES = 1; public static final int EXECUTE_SQL = 2; public static final int PREPARE = 3; // // Sybase capability flags // static final int SYB_LONGDATA = 1; static final int SYB_DATETIME = 2; static final int SYB_BITNULL = 4; static final int SYB_EXTCOLINFO = 8; static final int SYB_UNICODE = 16; static final int SYB_UNITEXT = 32; static final int SYB_BIGINT = 64; private final static int ASYNC_CANCEL = 0; private final static int TIMEOUT_CANCEL = 1; private static HashMap tds8SpNames = new HashMap(); static { tds8SpNames.put("sp_cursor", new Integer(1)); tds8SpNames.put("sp_cursoropen", new Integer(2)); tds8SpNames.put("sp_cursorprepare", new Integer(3)); tds8SpNames.put("sp_cursorexecute", new Integer(4)); tds8SpNames.put("sp_cursorprepexec", new Integer(5)); tds8SpNames.put("sp_cursorunprepare", new Integer(6)); tds8SpNames.put("sp_cursorfetch", new Integer(7)); tds8SpNames.put("sp_cursoroption", new Integer(8)); tds8SpNames.put("sp_cursorclose", new Integer(9)); tds8SpNames.put("sp_executesql", new Integer(10)); tds8SpNames.put("sp_prepare", new Integer(11)); tds8SpNames.put("sp_execute", new Integer(12)); tds8SpNames.put("sp_prepexec", new Integer(13)); tds8SpNames.put("sp_prepexecrpc", new Integer(14)); tds8SpNames.put("sp_unprepare", new Integer(15)); } // // Class variables // private static String hostName; private static SSPIJNIClient sspiJNIClient; // // Instance variables // private final JtdsConnection connection; private int tdsVersion; private final int serverType; private final SharedSocket socket; private final RequestStream out; private final ResponseStream in; private boolean endOfResponse = true; private boolean endOfResults = true; private ColInfo[] columns; private ColInfo[] computedColumns; private Object[] rowData; private Object[] computedRowData; private TableMetaData[] tables; private final TdsToken currentToken = new TdsToken(); private Integer returnStatus; private ParamInfo returnParam; private ParamInfo[] parameters; private int nextParam = -1; private final SQLDiagnostic messages; private boolean isClosed; private boolean ntlmAuthSSO; private boolean fatalError; private Semaphore connectionLock; private boolean inBatch; private int sslMode = SSL_NO_ENCRYPT; private boolean cancelPending; private final int[] cancelMonitor = new int[1]; private boolean _ErrorReceived; byte[] nonce; byte[] ntlmMessage; byte[] ntlmTarget; private GSSContext _gssContext; TdsCore(JtdsConnection connection, SQLDiagnostic messages) { this.connection = connection; socket = connection.getSocket(); this.messages = messages; serverType = connection.getServerType(); tdsVersion = socket.getTdsVersion(); out = socket.getRequestStream(connection.getNetPacketSize(), connection.getMaxPrecision()); in = socket.getResponseStream(out, connection.getNetPacketSize()); }
boolean function() { return token == TDS_ROW_TOKEN token == TDS_ALTROW; } } private static class TableMetaData { String catalog; String schema; String name; } public static final int MIN_PKT_SIZE = 512; public static final int DEFAULT_MIN_PKT_SIZE_TDS70 = 4096; public static final int MAX_PKT_SIZE = 32768; public static final int PKT_HDR_LEN = 8; public static final byte QUERY_PKT = 1; public static final byte LOGIN_PKT = 2; public static final byte RPC_PKT = 3; public static final byte REPLY_PKT = 4; public static final byte CANCEL_PKT = 6; public static final byte MSDTC_PKT = 14; public static final byte SYBQUERY_PKT = 15; public static final byte MSLOGIN_PKT = 16; public static final byte NTLMAUTH_PKT = 17; public static final byte PRELOGIN_PKT = 18; public static final int SSL_ENCRYPT_LOGIN = 0; public static final int SSL_CLIENT_FORCE_ENCRYPT = 1; public static final int SSL_NO_ENCRYPT = 2; public static final int SSL_SERVER_FORCE_ENCRYPT = 3; private static final byte TDS5_PARAMFMT2_TOKEN = (byte) 32; private static final byte TDS_LANG_TOKEN = (byte) 33; private static final byte TDS5_WIDE_RESULT = (byte) 97; private static final byte TDS_CLOSE_TOKEN = (byte) 113; private static final byte TDS_OFFSETS_TOKEN = (byte) 120; private static final byte TDS_RETURNSTATUS_TOKEN= (byte) 121; private static final byte TDS_PROCID = (byte) 124; private static final byte TDS7_RESULT_TOKEN = (byte) 129; private static final byte ALTMETADATA_TOKEN = (byte) 136; private static final byte TDS_COLNAME_TOKEN = (byte) 160; private static final byte TDS_COLFMT_TOKEN = (byte) 161; private static final byte TDS_TABNAME_TOKEN = (byte) 164; private static final byte TDS_COLINFO_TOKEN = (byte) 165; private static final byte TDS_ALT_NAMES_TOKEN = (byte) 167; private static final byte TDS_ALT_RESULT_TOKEN = (byte) 168; private static final byte TDS_ORDER_TOKEN = (byte) 169; private static final byte TDS_ERROR_TOKEN = (byte) 170; private static final byte TDS_INFO_TOKEN = (byte) 171; private static final byte TDS_PARAM_TOKEN = (byte) 172; private static final byte TDS_LOGINACK_TOKEN = (byte) 173; private static final byte TDS_CONTROL_TOKEN = (byte) 174; private static final byte TDS_ROW_TOKEN = (byte) 209; private static final byte TDS_ALTROW = (byte) 211; private static final byte TDS5_PARAMS_TOKEN = (byte) 215; private static final byte TDS_CAP_TOKEN = (byte) 226; private static final byte TDS_ENVCHANGE_TOKEN = (byte) 227; private static final byte TDS_MSG50_TOKEN = (byte) 229; private static final byte TDS_DBRPC_TOKEN = (byte) 230; private static final byte TDS5_DYNAMIC_TOKEN = (byte) 231; private static final byte TDS5_PARAMFMT_TOKEN = (byte) 236; private static final byte TDS_AUTH_TOKEN = (byte) 237; private static final byte TDS_RESULT_TOKEN = (byte) 238; private static final byte TDS_DONE_TOKEN = (byte) 253; private static final byte TDS_DONEPROC_TOKEN = (byte) 254; private static final byte TDS_DONEINPROC_TOKEN = (byte) 255; private static final byte TDS_ENV_DATABASE = (byte) 1; private static final byte TDS_ENV_LANG = (byte) 2; private static final byte TDS_ENV_CHARSET = (byte) 3; private static final byte TDS_ENV_PACKSIZE = (byte) 4; private static final byte TDS_ENV_LCID = (byte) 5; private static final byte TDS_ENV_SQLCOLLATION = (byte) 7; private static final ParamInfo[] EMPTY_PARAMETER_INFO = new ParamInfo[0]; private static final byte DONE_MORE_RESULTS = (byte) 0x01; private static final byte DONE_ERROR = (byte) 0x02; private static final byte DONE_ROW_COUNT = (byte) 0x10; static final byte DONE_CANCEL = (byte) 0x20; private static final byte DONE_END_OF_RESPONSE = (byte) 0x80; public static final int UNPREPARED = 0; public static final int TEMPORARY_STORED_PROCEDURES = 1; public static final int EXECUTE_SQL = 2; public static final int PREPARE = 3; static final int SYB_LONGDATA = 1; static final int SYB_DATETIME = 2; static final int SYB_BITNULL = 4; static final int SYB_EXTCOLINFO = 8; static final int SYB_UNICODE = 16; static final int SYB_UNITEXT = 32; static final int SYB_BIGINT = 64; private final static int ASYNC_CANCEL = 0; private final static int TIMEOUT_CANCEL = 1; private static HashMap tds8SpNames = new HashMap(); static { tds8SpNames.put(STR, new Integer(1)); tds8SpNames.put(STR, new Integer(2)); tds8SpNames.put(STR, new Integer(3)); tds8SpNames.put(STR, new Integer(4)); tds8SpNames.put(STR, new Integer(5)); tds8SpNames.put(STR, new Integer(6)); tds8SpNames.put(STR, new Integer(7)); tds8SpNames.put(STR, new Integer(8)); tds8SpNames.put(STR, new Integer(9)); tds8SpNames.put(STR, new Integer(10)); tds8SpNames.put(STR, new Integer(11)); tds8SpNames.put(STR, new Integer(12)); tds8SpNames.put(STR, new Integer(13)); tds8SpNames.put(STR, new Integer(14)); tds8SpNames.put(STR, new Integer(15)); } private static String hostName; private static SSPIJNIClient sspiJNIClient; private final JtdsConnection connection; private int tdsVersion; private final int serverType; private final SharedSocket socket; private final RequestStream out; private final ResponseStream in; private boolean endOfResponse = true; private boolean endOfResults = true; private ColInfo[] columns; private ColInfo[] computedColumns; private Object[] rowData; private Object[] computedRowData; private TableMetaData[] tables; private final TdsToken currentToken = new TdsToken(); private Integer returnStatus; private ParamInfo returnParam; private ParamInfo[] parameters; private int nextParam = -1; private final SQLDiagnostic messages; private boolean isClosed; private boolean ntlmAuthSSO; private boolean fatalError; private Semaphore connectionLock; private boolean inBatch; private int sslMode = SSL_NO_ENCRYPT; private boolean cancelPending; private final int[] cancelMonitor = new int[1]; private boolean _ErrorReceived; byte[] nonce; byte[] ntlmMessage; byte[] ntlmTarget; private GSSContext _gssContext; TdsCore(JtdsConnection connection, SQLDiagnostic messages) { this.connection = connection; socket = connection.getSocket(); this.messages = messages; serverType = connection.getServerType(); tdsVersion = socket.getTdsVersion(); out = socket.getRequestStream(connection.getNetPacketSize(), connection.getMaxPrecision()); in = socket.getResponseStream(out, connection.getNetPacketSize()); }
/** * Retrieve the row data status. * * @return * <code>true</code> if the current token is a result row. */
Retrieve the row data status
isRowData
{ "repo_name": "milesibastos/jTDS", "path": "src/main/net/sourceforge/jtds/jdbc/TdsCore.java", "license": "lgpl-2.1", "size": 168782 }
[ "java.util.HashMap", "net.sourceforge.jtds.util.SSPIJNIClient", "org.ietf.jgss.GSSContext" ]
import java.util.HashMap; import net.sourceforge.jtds.util.SSPIJNIClient; import org.ietf.jgss.GSSContext;
import java.util.*; import net.sourceforge.jtds.util.*; import org.ietf.jgss.*;
[ "java.util", "net.sourceforge.jtds", "org.ietf.jgss" ]
java.util; net.sourceforge.jtds; org.ietf.jgss;
2,294,514
public float getFloatProperty(final String name) throws JMSException { if (ActiveMQRAMessage.trace) { ActiveMQRALogger.LOGGER.trace("getFloatProperty(" + name + ")"); } return message.getFloatProperty(name); }
float function(final String name) throws JMSException { if (ActiveMQRAMessage.trace) { ActiveMQRALogger.LOGGER.trace(STR + name + ")"); } return message.getFloatProperty(name); }
/** * Get property * * @param name The name * @return The value * @throws JMSException Thrown if an error occurs */
Get property
getFloatProperty
{ "repo_name": "jbertram/activemq-artemis-old", "path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java", "license": "apache-2.0", "size": 21155 }
[ "javax.jms.JMSException" ]
import javax.jms.JMSException;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
1,917,925
public XSElementDeclaration getElementDeclaration() { return fDeclaration; }
XSElementDeclaration function() { return fDeclaration; }
/** * An item isomorphic to the element declaration used to validate * this element. * * @return an element declaration */
An item isomorphic to the element declaration used to validate this element
getElementDeclaration
{ "repo_name": "AaronZhangL/SplitCharater", "path": "xerces-2_11_0/src/org/apache/xerces/impl/xs/ElementPSVImpl.java", "license": "gpl-2.0", "size": 9772 }
[ "org.apache.xerces.xs.XSElementDeclaration" ]
import org.apache.xerces.xs.XSElementDeclaration;
import org.apache.xerces.xs.*;
[ "org.apache.xerces" ]
org.apache.xerces;
1,273,505
public void checkRightParen() throws MessagingException { Token token = next(); if (token.getType() != ')') { throw new ResponseFormatException("Missing ')' in response"); } }
void function() throws MessagingException { Token token = next(); if (token.getType() != ')') { throw new ResponseFormatException(STR); } }
/** * Ensure that the next token in the parsed response is a * ')' character. * * @exception ResponseFormatException */
Ensure that the next token in the parsed response is a ')' character
checkRightParen
{ "repo_name": "apache/geronimo-javamail", "path": "geronimo-javamail_1.6/geronimo-javamail_1.6_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java", "license": "apache-2.0", "size": 48453 }
[ "javax.mail.MessagingException", "org.apache.geronimo.javamail.util.ResponseFormatException" ]
import javax.mail.MessagingException; import org.apache.geronimo.javamail.util.ResponseFormatException;
import javax.mail.*; import org.apache.geronimo.javamail.util.*;
[ "javax.mail", "org.apache.geronimo" ]
javax.mail; org.apache.geronimo;
1,185,952
public static RuntimeService getRuntimeService() { return getProcessEngine().getRuntimeService(); }
static RuntimeService function() { return getProcessEngine().getRuntimeService(); }
/** * Returns The process service. * * @return The process service */
Returns The process service
getRuntimeService
{ "repo_name": "adbrucker/SecureBPMN", "path": "runtime/src/modules/activiti-webapp-rest2/src/main/java/org/activiti/rest/api/ActivitiUtil.java", "license": "apache-2.0", "size": 2927 }
[ "org.activiti.engine.RuntimeService" ]
import org.activiti.engine.RuntimeService;
import org.activiti.engine.*;
[ "org.activiti.engine" ]
org.activiti.engine;
1,204,109
public void desactivar(){ if(!this.validateDesactivar()){ return; } this.setEstado(Estado.INACTIVO.getId()); GdeDAOFactory.getEtapaProcesalDAO().update(this); }
void function(){ if(!this.validateDesactivar()){ return; } this.setEstado(Estado.INACTIVO.getId()); GdeDAOFactory.getEtapaProcesalDAO().update(this); }
/** * Desactiva el EtapaProcesal. Previamente valida la desactivacion. * */
Desactiva el EtapaProcesal. Previamente valida la desactivacion
desactivar
{ "repo_name": "avdata99/SIAT", "path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/gde/buss/bean/EtapaProcesal.java", "license": "gpl-3.0", "size": 4101 }
[ "ar.gov.rosario.siat.gde.buss.dao.GdeDAOFactory", "coop.tecso.demoda.iface.model.Estado" ]
import ar.gov.rosario.siat.gde.buss.dao.GdeDAOFactory; import coop.tecso.demoda.iface.model.Estado;
import ar.gov.rosario.siat.gde.buss.dao.*; import coop.tecso.demoda.iface.model.*;
[ "ar.gov.rosario", "coop.tecso.demoda" ]
ar.gov.rosario; coop.tecso.demoda;
1,992,200
public static void close() { synchronized (INSTANCE_LOCK) { if (INSTANCE != null) { Logger innerLogger = INSTANCE.logger; // remove any existing handlers cleanupLogger(innerLogger); } // make singleton null INSTANCE = null; } }
static void function() { synchronized (INSTANCE_LOCK) { if (INSTANCE != null) { Logger innerLogger = INSTANCE.logger; cleanupLogger(innerLogger); } INSTANCE = null; } }
/** * Closes the current LogWrapper. */
Closes the current LogWrapper
close
{ "repo_name": "smanvi-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/management/internal/cli/LogWrapper.java", "license": "apache-2.0", "size": 11318 }
[ "java.util.logging.Logger" ]
import java.util.logging.Logger;
import java.util.logging.*;
[ "java.util" ]
java.util;
1,639,533
public interface ExportSink { void write(SnapshotRecord... records) throws IOException; }
interface ExportSink { void function(SnapshotRecord... records) throws IOException; }
/** * Writes snapshot data to the destination sink. * * @param records the snapshot records * @throws IOException error writing records */
Writes snapshot data to the destination sink
write
{ "repo_name": "PurelyApplied/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java", "license": "apache-2.0", "size": 20775 }
[ "java.io.IOException", "org.apache.geode.internal.cache.snapshot.SnapshotPacket" ]
import java.io.IOException; import org.apache.geode.internal.cache.snapshot.SnapshotPacket;
import java.io.*; import org.apache.geode.internal.cache.snapshot.*;
[ "java.io", "org.apache.geode" ]
java.io; org.apache.geode;
525,691
public void setDependencies(List<Dependency> dependencies) { this.dependencies = dependencies; }
void function(List<Dependency> dependencies) { this.dependencies = dependencies; }
/** * Sets the list of dependencies to scan. * * @param dependencies new value of dependencies */
Sets the list of dependencies to scan
setDependencies
{ "repo_name": "jeremylong/DependencyCheck", "path": "core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java", "license": "apache-2.0", "size": 33221 }
[ "java.util.List", "org.owasp.dependencycheck.dependency.Dependency" ]
import java.util.List; import org.owasp.dependencycheck.dependency.Dependency;
import java.util.*; import org.owasp.dependencycheck.dependency.*;
[ "java.util", "org.owasp.dependencycheck" ]
java.util; org.owasp.dependencycheck;
2,791,001
@Test public void testGetAddDifferent() throws Exception { //add load List<ListenableFuture<Integer>> futures = put(folder);
void function() throws Exception { List<ListenableFuture<Integer>> futures = put(folder);
/** * Put and retrieve different files concurrently. * @throws Exception */
Put and retrieve different files concurrently
testGetAddDifferent
{ "repo_name": "meggermo/jackrabbit-oak", "path": "oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/blob/UploadStagingCacheTest.java", "license": "apache-2.0", "size": 23563 }
[ "com.google.common.util.concurrent.ListenableFuture", "java.util.List" ]
import com.google.common.util.concurrent.ListenableFuture; import java.util.List;
import com.google.common.util.concurrent.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,942,888
public static String getSqlString(Query<?> query, Session session) { final QueryTranslatorFactory ast = new ASTQueryTranslatorFactory(); SessionFactory sessionFactory = session.getSessionFactory(); final QueryTranslatorImpl qt = (QueryTranslatorImpl) ast.createQueryTranslator("id", query.getQueryString(), Maps.newHashMap(), (SessionFactoryImplementor) sessionFactory, null); qt.compile(null, false); return qt.getSQLString(); }
static String function(Query<?> query, Session session) { final QueryTranslatorFactory ast = new ASTQueryTranslatorFactory(); SessionFactory sessionFactory = session.getSessionFactory(); final QueryTranslatorImpl qt = (QueryTranslatorImpl) ast.createQueryTranslator("id", query.getQueryString(), Maps.newHashMap(), (SessionFactoryImplementor) sessionFactory, null); qt.compile(null, false); return qt.getSQLString(); }
/** * Get the SQL query string from HQL Query. * * @param query * HQL query to convert to SQL * @return SQL query string from HQL */
Get the SQL query string from HQL Query
getSqlString
{ "repo_name": "EHJ-52n/SOS", "path": "hibernate/session-factory/src/main/java/org/n52/sos/ds/hibernate/util/HibernateHelper.java", "license": "gpl-2.0", "size": 8364 }
[ "com.google.common.collect.Maps", "org.hibernate.Session", "org.hibernate.SessionFactory", "org.hibernate.engine.spi.SessionFactoryImplementor", "org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory", "org.hibernate.hql.internal.ast.QueryTranslatorImpl", "org.hibernate.hql.spi.QueryTranslatorFactory", "org.hibernate.query.Query" ]
import com.google.common.collect.Maps; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory; import org.hibernate.hql.internal.ast.QueryTranslatorImpl; import org.hibernate.hql.spi.QueryTranslatorFactory; import org.hibernate.query.Query;
import com.google.common.collect.*; import org.hibernate.*; import org.hibernate.engine.spi.*; import org.hibernate.hql.internal.ast.*; import org.hibernate.hql.spi.*; import org.hibernate.query.*;
[ "com.google.common", "org.hibernate", "org.hibernate.engine", "org.hibernate.hql", "org.hibernate.query" ]
com.google.common; org.hibernate; org.hibernate.engine; org.hibernate.hql; org.hibernate.query;
438,185
protected boolean checkDuplicateIncidentDate(AssetRepairHistory assetRepairHistory, Set<Date> incidentDateSet) { boolean success = true; if (!incidentDateSet.add(assetRepairHistory.getIncidentDate())) { GlobalVariables.getMessageMap().putError(CamsPropertyConstants.AssetRepairHistory.INCIDENT_DATE, CamsKeyConstants.AssetRepairHistory.ERROR_DUPLICATE_INCIDENT_DATE); success &= false; } return success; }
boolean function(AssetRepairHistory assetRepairHistory, Set<Date> incidentDateSet) { boolean success = true; if (!incidentDateSet.add(assetRepairHistory.getIncidentDate())) { GlobalVariables.getMessageMap().putError(CamsPropertyConstants.AssetRepairHistory.INCIDENT_DATE, CamsKeyConstants.AssetRepairHistory.ERROR_DUPLICATE_INCIDENT_DATE); success &= false; } return success; }
/** * Check for duplicate incident dates within the Repair History section * * @param assetRepairHistory * @param incidentDateSet * @return boolean */
Check for duplicate incident dates within the Repair History section
checkDuplicateIncidentDate
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/cam/document/validation/impl/AssetRule.java", "license": "apache-2.0", "size": 35816 }
[ "java.util.Date", "java.util.Set", "org.kuali.kfs.module.cam.CamsKeyConstants", "org.kuali.kfs.module.cam.CamsPropertyConstants", "org.kuali.kfs.module.cam.businessobject.AssetRepairHistory", "org.kuali.rice.krad.util.GlobalVariables" ]
import java.util.Date; import java.util.Set; import org.kuali.kfs.module.cam.CamsKeyConstants; import org.kuali.kfs.module.cam.CamsPropertyConstants; import org.kuali.kfs.module.cam.businessobject.AssetRepairHistory; import org.kuali.rice.krad.util.GlobalVariables;
import java.util.*; import org.kuali.kfs.module.cam.*; import org.kuali.kfs.module.cam.businessobject.*; import org.kuali.rice.krad.util.*;
[ "java.util", "org.kuali.kfs", "org.kuali.rice" ]
java.util; org.kuali.kfs; org.kuali.rice;
2,910,434
public static void main(String[] args) { // The following commented lines of code are for debugging purposes: //args = new String[]{"run", "SPADE", "C:\\Users\\ph\\Desktop\\SPMF\\test_files\\contextPrefixSpan.txt", "output.txt", "50%", "100"}; //C:\Users\ph\Desktop\SPMF\test_files // System.out.println("Command " + Arrays.toString(args)); // If there are command line arguments, we don't launch // the user interface. It means that the user is using // the command line. if (args.length != 0) { processCommandLineArguments(args); // process command line arguments. } else { // Else, we launch the graphical user interface. EventQueue.invokeLater(new Runnable() {
static void function(String[] args) { if (args.length != 0) { processCommandLineArguments(args); } else { EventQueue.invokeLater(new Runnable() {
/** * Method to launch the software. If there are command line arguments, it * means that the software is launched from the command line. Otherwise, * this method launches the graphical user interface. * * @param args command line arguments. */
Method to launch the software. If there are command line arguments, it means that the software is launched from the command line. Otherwise, this method launches the graphical user interface
main
{ "repo_name": "pommedeterresautee/spmf", "path": "ca/pfv/spmf/gui/MainWindow.java", "license": "gpl-3.0", "size": 143042 }
[ "java.awt.EventQueue" ]
import java.awt.EventQueue;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,780,472
public IgniteConfiguration setClusterStateOnStart(ClusterState state) { this.clusterStateOnStart = state; return this; } /** * Gets flag indicating whether cache sanity check is enabled. If enabled, then Ignite * will perform the following checks and throw an exception if check fails: * <ul> * <li>Cache entry is not externally locked with {@code lock(...)} or {@code lockAsync(...)}
IgniteConfiguration function(ClusterState state) { this.clusterStateOnStart = state; return this; } /** * Gets flag indicating whether cache sanity check is enabled. If enabled, then Ignite * will perform the following checks and throw an exception if check fails: * <ul> * <li>Cache entry is not externally locked with {@code lock(...)} or {@code lockAsync(...)}
/** * Sets state of cluster on start. * * @param state New cluster state on start. * @return {@code this} for chaining. * @see #getClusterStateOnStart() */
Sets state of cluster on start
setClusterStateOnStart
{ "repo_name": "nizhikov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java", "license": "apache-2.0", "size": 125128 }
[ "org.apache.ignite.cluster.ClusterState" ]
import org.apache.ignite.cluster.ClusterState;
import org.apache.ignite.cluster.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,224,769
@CanIgnoreReturnValue public long writeFrom(InputStream input) throws IOException { checkNotNull(input); Closer closer = Closer.create(); try { OutputStream out = closer.register(openStream()); long written = ByteStreams.copy(input, out); out.flush(); // https://code.google.com/p/guava-libraries/issues/detail?id=1330 return written; } catch (Throwable e) { throw closer.rethrow(e); } finally { closer.close(); } } private final class AsCharSink extends CharSink { private final Charset charset; private AsCharSink(Charset charset) { this.charset = checkNotNull(charset); }
long function(InputStream input) throws IOException { checkNotNull(input); Closer closer = Closer.create(); try { OutputStream out = closer.register(openStream()); long written = ByteStreams.copy(input, out); out.flush(); return written; } catch (Throwable e) { throw closer.rethrow(e); } finally { closer.close(); } } private final class AsCharSink extends CharSink { private final Charset charset; private AsCharSink(Charset charset) { this.charset = checkNotNull(charset); }
/** * Writes all the bytes from the given {@code InputStream} to this sink. Does not close * {@code input}. * * @return the number of bytes written * @throws IOException if an I/O occurs in the process of reading from {@code input} or writing to * this sink */
Writes all the bytes from the given InputStream to this sink. Does not close input
writeFrom
{ "repo_name": "tli2/guava", "path": "guava/src/com/google/common/io/ByteSink.java", "license": "apache-2.0", "size": 5549 }
[ "com.google.common.base.Preconditions", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream", "java.nio.charset.Charset" ]
import com.google.common.base.Preconditions; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.Charset;
import com.google.common.base.*; import java.io.*; import java.nio.charset.*;
[ "com.google.common", "java.io", "java.nio" ]
com.google.common; java.io; java.nio;
2,275,895
public String putDocuments(DataBundle dataBundle) { // query the entity in db first to get the actual data and create document for actual entity Map<String, StudentAttributes> students = dataBundle.students; for (StudentAttributes student : students.values()) { StudentAttributes studentInDb = studentsDb.getStudentForEmail(student.course, student.email); studentsDb.putDocument(studentInDb); } Map<String, InstructorAttributes> instructors = dataBundle.instructors; for (InstructorAttributes instructor : instructors.values()) { InstructorAttributes instructorInDb = instructorsDb.getInstructorForEmail(instructor.courseId, instructor.email); instructorsDb.putDocument(instructorInDb); } Map<String, FeedbackResponseCommentAttributes> responseComments = dataBundle.feedbackResponseComments; for (FeedbackResponseCommentAttributes responseComment : responseComments.values()) { FeedbackResponseCommentAttributes fcInDb = fcDb.getFeedbackResponseComment( responseComment.courseId, responseComment.createdAt, responseComment.giverEmail); fcDb.putDocument(fcInDb); } Map<String, CommentAttributes> comments = dataBundle.comments; for (CommentAttributes comment : comments.values()) { CommentAttributes commentInDb = commentsDb.getComment(comment); commentsDb.putDocument(commentInDb); } return Const.StatusCodes.BACKDOOR_STATUS_SUCCESS; }
String function(DataBundle dataBundle) { Map<String, StudentAttributes> students = dataBundle.students; for (StudentAttributes student : students.values()) { StudentAttributes studentInDb = studentsDb.getStudentForEmail(student.course, student.email); studentsDb.putDocument(studentInDb); } Map<String, InstructorAttributes> instructors = dataBundle.instructors; for (InstructorAttributes instructor : instructors.values()) { InstructorAttributes instructorInDb = instructorsDb.getInstructorForEmail(instructor.courseId, instructor.email); instructorsDb.putDocument(instructorInDb); } Map<String, FeedbackResponseCommentAttributes> responseComments = dataBundle.feedbackResponseComments; for (FeedbackResponseCommentAttributes responseComment : responseComments.values()) { FeedbackResponseCommentAttributes fcInDb = fcDb.getFeedbackResponseComment( responseComment.courseId, responseComment.createdAt, responseComment.giverEmail); fcDb.putDocument(fcInDb); } Map<String, CommentAttributes> comments = dataBundle.comments; for (CommentAttributes comment : comments.values()) { CommentAttributes commentInDb = commentsDb.getComment(comment); commentsDb.putDocument(commentInDb); } return Const.StatusCodes.BACKDOOR_STATUS_SUCCESS; }
/** * create document for entities that have document--searchable * @param dataBundle * @return status of the request in the form 'status meassage'+'additional * info (if any)' e.g., "[BACKEND_STATUS_SUCCESS]" e.g., * "[BACKEND_STATUS_FAILURE]NullPointerException at ..." */
create document for entities that have document--searchable
putDocuments
{ "repo_name": "karthikaacharya/teammates", "path": "src/main/java/teammates/logic/backdoor/BackDoorLogic.java", "license": "gpl-2.0", "size": 20995 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,911,340
private void setChildAdditionalData(final IJsonBackedObject serializedObject, final JsonObject rawJson) { // Use reflection to iterate through fields for eligible Graph children if(rawJson != null) { for (java.lang.reflect.Field field : serializedObject.getClass().getFields()) { try { if(field != null) { final Object fieldObject = field.get(serializedObject); if (fieldObject instanceof HashMap) { // If the object is a HashMap, iterate through its children @SuppressWarnings("unchecked") final HashMap<String, Object> serializableChildren = (HashMap<String, Object>) fieldObject; for (Entry<String, Object> pair : serializableChildren.entrySet()) { final Object child = pair.getValue(); // If the item is a valid Graph object, set its additional data if (child instanceof IJsonBackedObject) { final AdditionalDataManager childAdditionalDataManager = ((IJsonBackedObject) child).additionalDataManager(); final JsonElement fieldElement = rawJson.get(field.getName()); if (fieldElement != null && fieldElement.isJsonObject() && fieldElement.getAsJsonObject().get(pair.getKey()) != null && fieldElement.getAsJsonObject().get(pair.getKey()).isJsonObject()) { childAdditionalDataManager.setAdditionalData(fieldElement.getAsJsonObject().get(pair.getKey()).getAsJsonObject()); setChildAdditionalData((IJsonBackedObject) child, fieldElement.getAsJsonObject().get(pair.getKey()).getAsJsonObject()); } } } } // If the object is a list of Graph objects, iterate through elements else if (fieldObject instanceof List) { final JsonElement collectionJson = rawJson.get(field.getName()); final List<?> fieldObjectList = (List<?>) fieldObject; if (collectionJson != null && collectionJson.isJsonArray()) { final JsonArray rawJsonArray = (JsonArray) collectionJson; final int fieldObjectListSize = fieldObjectList.size(); final int rawJsonArraySize = rawJsonArray.size(); for (int i = 0; i < fieldObjectListSize && i < rawJsonArraySize; i++) { final Object element = fieldObjectList.get(i); if (element instanceof IJsonBackedObject) { final JsonElement elementRawJson = rawJsonArray.get(i); if(elementRawJson != null) { setChildAdditionalData((IJsonBackedObject) element, elementRawJson.getAsJsonObject()); } } } if (rawJsonArraySize != fieldObjectListSize) logger.logDebug("rawJsonArray has a size of " + rawJsonArraySize + " and fieldObjectList of " + fieldObjectListSize); } } // If the object is a valid Graph object, set its additional data else if (fieldObject instanceof IJsonBackedObject) { final IJsonBackedObject serializedChild = (IJsonBackedObject) fieldObject; final AdditionalDataManager childAdditionalDataManager = serializedChild.additionalDataManager(); final JsonElement fieldElement = rawJson.get(field.getName()); if(fieldElement != null && fieldElement.isJsonObject()) { childAdditionalDataManager.setAdditionalData(fieldElement.getAsJsonObject()); setChildAdditionalData((IJsonBackedObject) fieldObject,fieldElement.getAsJsonObject()); } } } } catch (IllegalArgumentException | IllegalAccessException e) { //Not throwing the IllegalArgumentException as the Serialized Object would still be usable even if the additional data is not set. logger.logError("Unable to set child fields of " + serializedObject.getClass().getSimpleName(), e); logger.logDebug(rawJson.getAsString()); } } } }
void function(final IJsonBackedObject serializedObject, final JsonObject rawJson) { if(rawJson != null) { for (java.lang.reflect.Field field : serializedObject.getClass().getFields()) { try { if(field != null) { final Object fieldObject = field.get(serializedObject); if (fieldObject instanceof HashMap) { @SuppressWarnings(STR) final HashMap<String, Object> serializableChildren = (HashMap<String, Object>) fieldObject; for (Entry<String, Object> pair : serializableChildren.entrySet()) { final Object child = pair.getValue(); if (child instanceof IJsonBackedObject) { final AdditionalDataManager childAdditionalDataManager = ((IJsonBackedObject) child).additionalDataManager(); final JsonElement fieldElement = rawJson.get(field.getName()); if (fieldElement != null && fieldElement.isJsonObject() && fieldElement.getAsJsonObject().get(pair.getKey()) != null && fieldElement.getAsJsonObject().get(pair.getKey()).isJsonObject()) { childAdditionalDataManager.setAdditionalData(fieldElement.getAsJsonObject().get(pair.getKey()).getAsJsonObject()); setChildAdditionalData((IJsonBackedObject) child, fieldElement.getAsJsonObject().get(pair.getKey()).getAsJsonObject()); } } } } else if (fieldObject instanceof List) { final JsonElement collectionJson = rawJson.get(field.getName()); final List<?> fieldObjectList = (List<?>) fieldObject; if (collectionJson != null && collectionJson.isJsonArray()) { final JsonArray rawJsonArray = (JsonArray) collectionJson; final int fieldObjectListSize = fieldObjectList.size(); final int rawJsonArraySize = rawJsonArray.size(); for (int i = 0; i < fieldObjectListSize && i < rawJsonArraySize; i++) { final Object element = fieldObjectList.get(i); if (element instanceof IJsonBackedObject) { final JsonElement elementRawJson = rawJsonArray.get(i); if(elementRawJson != null) { setChildAdditionalData((IJsonBackedObject) element, elementRawJson.getAsJsonObject()); } } } if (rawJsonArraySize != fieldObjectListSize) logger.logDebug(STR + rawJsonArraySize + STR + fieldObjectListSize); } } else if (fieldObject instanceof IJsonBackedObject) { final IJsonBackedObject serializedChild = (IJsonBackedObject) fieldObject; final AdditionalDataManager childAdditionalDataManager = serializedChild.additionalDataManager(); final JsonElement fieldElement = rawJson.get(field.getName()); if(fieldElement != null && fieldElement.isJsonObject()) { childAdditionalDataManager.setAdditionalData(fieldElement.getAsJsonObject()); setChildAdditionalData((IJsonBackedObject) fieldObject,fieldElement.getAsJsonObject()); } } } } catch (IllegalArgumentException IllegalAccessException e) { logger.logError(STR + serializedObject.getClass().getSimpleName(), e); logger.logDebug(rawJson.getAsString()); } } } }
/** * Recursively sets additional data for each child object * * @param serializedObject the parent object whose children will be iterated to set additional data * @param rawJson the raw json */
Recursively sets additional data for each child object
setChildAdditionalData
{ "repo_name": "microsoftgraph/msgraph-sdk-java-core", "path": "src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java", "license": "mit", "size": 15641 }
[ "com.google.gson.JsonArray", "com.google.gson.JsonElement", "com.google.gson.JsonObject", "java.lang.reflect.Field", "java.util.HashMap", "java.util.List", "java.util.Map" ]
import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import java.lang.reflect.Field; import java.util.HashMap; import java.util.List; import java.util.Map;
import com.google.gson.*; import java.lang.reflect.*; import java.util.*;
[ "com.google.gson", "java.lang", "java.util" ]
com.google.gson; java.lang; java.util;
2,211,832
public List<PDFCmd> getCommands() { return this.commands; }
List<PDFCmd> function() { return this.commands; }
/** * get all the commands in the current page */
get all the commands in the current page
getCommands
{ "repo_name": "oswetto/PDFrenderer", "path": "src/com/sun/pdfview/PDFPage.java", "license": "lgpl-2.1", "size": 28724 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,769,696
private FactType getDeclaredFactType(String packageName, String className) { try { return m_kieBase.getFactType(packageName, className); } catch (Exception e) { // Any objects that are not declared in drl will throw exception. } return null; }
FactType function(String packageName, String className) { try { return m_kieBase.getFactType(packageName, className); } catch (Exception e) { } return null; }
/** * This checks if fact is declared in drl. * Facts which are inserted in the session will throw exception. * Currently, there is no better way to find if the fact is a declared fact or not. */
This checks if fact is declared in drl. Facts which are inserted in the session will throw exception. Currently, there is no better way to find if the fact is a declared fact or not
getDeclaredFactType
{ "repo_name": "jeffgdotorg/opennms", "path": "opennms-correlation/drools-correlation-engine/src/main/java/org/opennms/netmgt/correlation/drools/DroolsCorrelationEngine.java", "license": "gpl-2.0", "size": 22078 }
[ "org.kie.api.definition.type.FactType" ]
import org.kie.api.definition.type.FactType;
import org.kie.api.definition.type.*;
[ "org.kie.api" ]
org.kie.api;
2,635,504
public static void createDownloadableExport(List<DSpaceObject> dsObjects, Context context, boolean migrate) throws Exception { EPerson eperson = context.getCurrentUser(); processDownloadableExport(dsObjects, context, eperson == null ? null : eperson.getEmail(), migrate); }
static void function(List<DSpaceObject> dsObjects, Context context, boolean migrate) throws Exception { EPerson eperson = context.getCurrentUser(); processDownloadableExport(dsObjects, context, eperson == null ? null : eperson.getEmail(), migrate); }
/** * Convenience method to export a List of dspace objects (Community, * Collection or Item) * * @param dsObjects * - List containing dspace objects * @param context * - the dspace context * @throws Exception */
Convenience method to export a List of dspace objects (Community, Collection or Item)
createDownloadableExport
{ "repo_name": "mdiggory/dryad-repo", "path": "dspace-api/src/main/java/org/dspace/app/itemexport/ItemExport.java", "license": "bsd-3-clause", "size": 51938 }
[ "java.util.List", "org.dspace.content.DSpaceObject", "org.dspace.core.Context", "org.dspace.eperson.EPerson" ]
import java.util.List; import org.dspace.content.DSpaceObject; import org.dspace.core.Context; import org.dspace.eperson.EPerson;
import java.util.*; import org.dspace.content.*; import org.dspace.core.*; import org.dspace.eperson.*;
[ "java.util", "org.dspace.content", "org.dspace.core", "org.dspace.eperson" ]
java.util; org.dspace.content; org.dspace.core; org.dspace.eperson;
1,206,182
private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.TITLE, mTitle); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.IS_DRM, mIsDrm); String resolution = null; if (mWidth > 0 && mHeight > 0) { map.put(MediaStore.MediaColumns.WIDTH, mWidth); map.put(MediaStore.MediaColumns.HEIGHT, mHeight); resolution = mWidth + "x" + mHeight; } if (!mNoMedia) { if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.ARTIST, (mArtist != null && mArtist.length() > 0 ? mArtist : MediaStore.UNKNOWN_STRING)); map.put(Video.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0 ? mAlbum : MediaStore.UNKNOWN_STRING)); map.put(Video.Media.DURATION, mDuration); if (resolution != null) { map.put(Video.Media.RESOLUTION, resolution); } } else if (MediaFile.isImageFileType(mFileType)) { // FIXME - add DESCRIPTION } else if (MediaFile.isAudioFileType(mFileType)) { map.put(Audio.Media.ARTIST, (mArtist != null && mArtist.length() > 0) ? mArtist : MediaStore.UNKNOWN_STRING); map.put(Audio.Media.ALBUM_ARTIST, (mAlbumArtist != null && mAlbumArtist.length() > 0) ? mAlbumArtist : null); map.put(Audio.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0) ? mAlbum : MediaStore.UNKNOWN_STRING); map.put(Audio.Media.COMPOSER, mComposer); map.put(Audio.Media.GENRE, mGenre); if (mYear != 0) { map.put(Audio.Media.YEAR, mYear); } map.put(Audio.Media.TRACK, mTrack); map.put(Audio.Media.DURATION, mDuration); map.put(Audio.Media.COMPILATION, mCompilation); } } return map; }
ContentValues function() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.TITLE, mTitle); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.IS_DRM, mIsDrm); String resolution = null; if (mWidth > 0 && mHeight > 0) { map.put(MediaStore.MediaColumns.WIDTH, mWidth); map.put(MediaStore.MediaColumns.HEIGHT, mHeight); resolution = mWidth + "x" + mHeight; } if (!mNoMedia) { if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.ARTIST, (mArtist != null && mArtist.length() > 0 ? mArtist : MediaStore.UNKNOWN_STRING)); map.put(Video.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0 ? mAlbum : MediaStore.UNKNOWN_STRING)); map.put(Video.Media.DURATION, mDuration); if (resolution != null) { map.put(Video.Media.RESOLUTION, resolution); } } else if (MediaFile.isImageFileType(mFileType)) { } else if (MediaFile.isAudioFileType(mFileType)) { map.put(Audio.Media.ARTIST, (mArtist != null && mArtist.length() > 0) ? mArtist : MediaStore.UNKNOWN_STRING); map.put(Audio.Media.ALBUM_ARTIST, (mAlbumArtist != null && mAlbumArtist.length() > 0) ? mAlbumArtist : null); map.put(Audio.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0) ? mAlbum : MediaStore.UNKNOWN_STRING); map.put(Audio.Media.COMPOSER, mComposer); map.put(Audio.Media.GENRE, mGenre); if (mYear != 0) { map.put(Audio.Media.YEAR, mYear); } map.put(Audio.Media.TRACK, mTrack); map.put(Audio.Media.DURATION, mDuration); map.put(Audio.Media.COMPILATION, mCompilation); } } return map; }
/** * Formats the data into a values array suitable for use with the Media * Content Provider. * * @return a map of values */
Formats the data into a values array suitable for use with the Media Content Provider
toValues
{ "repo_name": "haikuowuya/android_system_code", "path": "src/android/media/MediaScanner.java", "license": "apache-2.0", "size": 75181 }
[ "android.content.ContentValues", "android.provider.MediaStore" ]
import android.content.ContentValues; import android.provider.MediaStore;
import android.content.*; import android.provider.*;
[ "android.content", "android.provider" ]
android.content; android.provider;
1,379,379
protected Map<QName, Serializable> getDefaultProperties(ClassDefinition classDefinition) { PropertyMap properties = new PropertyMap(); for (Map.Entry<QName, Serializable> entry : classDefinition.getDefaultValues().entrySet()) { Serializable value = entry.getValue(); // Check the type of the default property PropertyDefinition prop = this.dictionaryService.getProperty(entry.getKey()); if (prop == null) { // dictionary doesn't have a default value present continue; } // TODO: what other conversions are necessary here for other types of default values ? // ensure that we deliver the property in the correct form if (DataTypeDefinition.BOOLEAN.equals(prop.getDataType().getName()) == true) { if (value instanceof String) { if (((String)value).toUpperCase().equals("TRUE") == true) { value = Boolean.TRUE; } else if (((String)value).toUpperCase().equals("FALSE") == true) { value = Boolean.FALSE; } } } // Set the default value of the property properties.put(entry.getKey(), value); } return properties; }
Map<QName, Serializable> function(ClassDefinition classDefinition) { PropertyMap properties = new PropertyMap(); for (Map.Entry<QName, Serializable> entry : classDefinition.getDefaultValues().entrySet()) { Serializable value = entry.getValue(); PropertyDefinition prop = this.dictionaryService.getProperty(entry.getKey()); if (prop == null) { continue; } if (DataTypeDefinition.BOOLEAN.equals(prop.getDataType().getName()) == true) { if (value instanceof String) { if (((String)value).toUpperCase().equals("TRUE") == true) { value = Boolean.TRUE; } else if (((String)value).toUpperCase().equals("FALSE") == true) { value = Boolean.FALSE; } } } properties.put(entry.getKey(), value); } return properties; }
/** * Sets the default property values * * @param classDefinition the model type definition for which to get defaults */
Sets the default property values
getDefaultProperties
{ "repo_name": "Kast0rTr0y/community-edition", "path": "projects/repository/source/java/org/alfresco/repo/node/AbstractNodeServiceImpl.java", "license": "lgpl-3.0", "size": 35789 }
[ "java.io.Serializable", "java.util.Map", "org.alfresco.service.cmr.dictionary.ClassDefinition", "org.alfresco.service.cmr.dictionary.DataTypeDefinition", "org.alfresco.service.cmr.dictionary.PropertyDefinition", "org.alfresco.service.namespace.QName", "org.alfresco.util.PropertyMap" ]
import java.io.Serializable; import java.util.Map; import org.alfresco.service.cmr.dictionary.ClassDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.namespace.QName; import org.alfresco.util.PropertyMap;
import java.io.*; import java.util.*; import org.alfresco.service.cmr.dictionary.*; import org.alfresco.service.namespace.*; import org.alfresco.util.*;
[ "java.io", "java.util", "org.alfresco.service", "org.alfresco.util" ]
java.io; java.util; org.alfresco.service; org.alfresco.util;
1,150,782
public byte[] getLsaBodyAsByteArray() throws Exception { List<Byte> bodyLst = new ArrayList<>(); if (this.opaqueId() == 1) { for (TopLevelTlv tlv : this.topLevelValues) { //Check the sub type of lsa and build bytes accordingly if (tlv instanceof RouterTlv) { RouterTlv routerTlv = (RouterTlv) tlv; bodyLst.addAll(Bytes.asList(routerTlv.asBytes())); } else if (tlv instanceof LinkTlv) { LinkTlv linkTlv = (LinkTlv) tlv; bodyLst.addAll(Bytes.asList(linkTlv.asBytes())); } } } else { return opaqueInfo; } return Bytes.toArray(bodyLst); }
byte[] function() throws Exception { List<Byte> bodyLst = new ArrayList<>(); if (this.opaqueId() == 1) { for (TopLevelTlv tlv : this.topLevelValues) { if (tlv instanceof RouterTlv) { RouterTlv routerTlv = (RouterTlv) tlv; bodyLst.addAll(Bytes.asList(routerTlv.asBytes())); } else if (tlv instanceof LinkTlv) { LinkTlv linkTlv = (LinkTlv) tlv; bodyLst.addAll(Bytes.asList(linkTlv.asBytes())); } } } else { return opaqueInfo; } return Bytes.toArray(bodyLst); }
/** * Gets the LSA body as byte array. * * @return the lsa body as byte array * @throws Exception might throws exception while parsing packet */
Gets the LSA body as byte array
getLsaBodyAsByteArray
{ "repo_name": "sonu283304/onos", "path": "protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/types/OpaqueLsa10.java", "license": "apache-2.0", "size": 7558 }
[ "com.google.common.primitives.Bytes", "java.util.ArrayList", "java.util.List", "org.onosproject.ospf.protocol.lsa.tlvtypes.LinkTlv", "org.onosproject.ospf.protocol.lsa.tlvtypes.RouterTlv" ]
import com.google.common.primitives.Bytes; import java.util.ArrayList; import java.util.List; import org.onosproject.ospf.protocol.lsa.tlvtypes.LinkTlv; import org.onosproject.ospf.protocol.lsa.tlvtypes.RouterTlv;
import com.google.common.primitives.*; import java.util.*; import org.onosproject.ospf.protocol.lsa.tlvtypes.*;
[ "com.google.common", "java.util", "org.onosproject.ospf" ]
com.google.common; java.util; org.onosproject.ospf;
585,976
private void setScrollOffset(Object scroll, float yOffset) { //do not re-scroll the source if (scroll != null && yOffset >= 0) { scrollTo(scroll, yOffset); //save the current yOffset of the scrollable on the yOffsets hashmap yOffsets.put(scroll, (int) yOffset); } }
void function(Object scroll, float yOffset) { if (scroll != null && yOffset >= 0) { scrollTo(scroll, yOffset); yOffsets.put(scroll, (int) yOffset); } }
/** * When notified for scroll, dispatch it to all registered scrollables * * @param scroll * @param yOffset */
When notified for scroll, dispatch it to all registered scrollables
setScrollOffset
{ "repo_name": "farrywen/MaterialViewPager", "path": "materialviewpager/src/main/java/com/github/florent37/materialviewpager/MaterialViewPagerAnimator.java", "license": "apache-2.0", "size": 25090 }
[ "com.github.florent37.materialviewpager.Utils" ]
import com.github.florent37.materialviewpager.Utils;
import com.github.florent37.materialviewpager.*;
[ "com.github.florent37" ]
com.github.florent37;
2,450,275
private Api getApiInternal(String apiOrgId, String apiId, String apiVersion) { String key = getApiIndex(apiOrgId, apiId, apiVersion); Api api; synchronized (mutex) { api = (Api) getMap().get(key); } return api; }
Api function(String apiOrgId, String apiId, String apiVersion) { String key = getApiIndex(apiOrgId, apiId, apiVersion); Api api; synchronized (mutex) { api = (Api) getMap().get(key); } return api; }
/** * Gets an API by its unique identifying info (orgid, id, version). * @param apiOrgId * @param apiId * @param apiVersion * @return an Api or null if not found */
Gets an API by its unique identifying info (orgid, id, version)
getApiInternal
{ "repo_name": "msavy/apiman", "path": "gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java", "license": "apache-2.0", "size": 14612 }
[ "io.apiman.gateway.engine.beans.Api" ]
import io.apiman.gateway.engine.beans.Api;
import io.apiman.gateway.engine.beans.*;
[ "io.apiman.gateway" ]
io.apiman.gateway;
629,946
public Builder addAllPhase(List<Phase> elements) { if (this.phases == null) { this.phases = new ArrayList<>(); } this.phases.addAll(elements); return this; }
Builder function(List<Phase> elements) { if (this.phases == null) { this.phases = new ArrayList<>(); } this.phases.addAll(elements); return this; }
/** * Add all elements to `phases` list. A list is initialized for the first `add/addAll` call, and * subsequent calls adds additional elements to the original list. See {@link * SubscriptionScheduleCreateParams#phases} for the field documentation. */
Add all elements to `phases` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See <code>SubscriptionScheduleCreateParams#phases</code> for the field documentation
addAllPhase
{ "repo_name": "stripe/stripe-java", "path": "src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java", "license": "mit", "size": 107599 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
543,922
EventQueue.invokeLater(new Runnable() {
EventQueue.invokeLater(new Runnable() {
/** * Launch the application. */
Launch the application
main
{ "repo_name": "Mattie432/Batch-Regex-File-Renamer", "path": "JavaProject/src/About/AboutJava.java", "license": "mit", "size": 9466 }
[ "java.awt.EventQueue" ]
import java.awt.EventQueue;
import java.awt.*;
[ "java.awt" ]
java.awt;
359,445
private void resetStateForGridTop() { // Reset mItemTops and mItemBottoms final int colCount = mColCount; if (mItemTops == null || mItemTops.length != colCount) { mItemTops = new int[colCount]; mItemBottoms = new int[colCount]; } final int top = getPaddingTop(); Arrays.fill(mItemTops, top); Arrays.fill(mItemBottoms, top); // Reset the first visible position in the grid to be item 0 mFirstPosition = 0; if(mRestoreOffsets!=null) Arrays.fill(mRestoreOffsets, 0); }
void function() { final int colCount = mColCount; if (mItemTops == null mItemTops.length != colCount) { mItemTops = new int[colCount]; mItemBottoms = new int[colCount]; } final int top = getPaddingTop(); Arrays.fill(mItemTops, top); Arrays.fill(mItemBottoms, top); mFirstPosition = 0; if(mRestoreOffsets!=null) Arrays.fill(mRestoreOffsets, 0); }
/** * Reset all internal state to be at the top of the grid. */
Reset all internal state to be at the top of the grid
resetStateForGridTop
{ "repo_name": "GMAndroidTeam/Android-PullToRefresh", "path": "library/src/main/java/com/handmark/pulltorefresh/library/internal/StaggeredGridView.java", "license": "apache-2.0", "size": 92730 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
2,553,490
mBytes = bytes; invalidate(); } /** * Pass FFT data to the visualizer. Typically this will be obtained from the * Android Visualizer.OnDataCaptureListener call back. See * {@link Visualizer.OnDataCaptureListener#onFftDataCapture }
mBytes = bytes; invalidate(); } /** * Pass FFT data to the visualizer. Typically this will be obtained from the * Android Visualizer.OnDataCaptureListener call back. See * {@link Visualizer.OnDataCaptureListener#onFftDataCapture }
/** * Pass data to the visualizer. Typically this will be obtained from the * Android Visualizer.OnDataCaptureListener call back. See * {@link Visualizer.OnDataCaptureListener#onWaveFormDataCapture } * @param bytes */
Pass data to the visualizer. Typically this will be obtained from the Android Visualizer.OnDataCaptureListener call back. See <code>Visualizer.OnDataCaptureListener#onWaveFormDataCapture </code>
updateVisualizer
{ "repo_name": "liufeiit/itmarry", "path": "source/Apollo/Apollo/src/com/andrew/apolloMod/ui/widgets/VisualizerView.java", "license": "mit", "size": 3900 }
[ "android.media.audiofx.Visualizer" ]
import android.media.audiofx.Visualizer;
import android.media.audiofx.*;
[ "android.media" ]
android.media;
2,797,144
@Cacheable(value = "listHonorRoll") public List<HonorRoll> listHonorRollByZoneWithCache(Zone zone, LocalDate bucket, int limit) { final String sql = "" + " SELECT * " + " FROM HonorRoll " + " WHERE zone = ? " + " AND bucket = ? " + " ORDER BY (articleUpVoted + debateUpVoted - debateDownVoted) DESC, username ASC " + " LIMIT ? "; return jdbc().query(sql, honorRollRowMapper, zone.value(), bucket.toString(), limit); }
@Cacheable(value = STR) List<HonorRoll> function(Zone zone, LocalDate bucket, int limit) { final String sql = STR SELECT * STR FROM HonorRoll STR WHERE zone = ? STR AND bucket = ? STR ORDER BY (articleUpVoted + debateUpVoted - debateDownVoted) DESC, username ASC STR LIMIT ? "; return jdbc().query(sql, honorRollRowMapper, zone.value(), bucket.toString(), limit); }
/** * see {@link #listHonorRollWithCache(java.time.LocalDate, int)} for why leak bucket to outside */
see <code>#listHonorRollWithCache(java.time.LocalDate, int)</code> for why leak bucket to outside
listHonorRollByZoneWithCache
{ "repo_name": "kaif-open/kaif", "path": "kaif-web/src/main/java/io/kaif/model/vote/HonorRollDao.java", "license": "apache-2.0", "size": 5656 }
[ "io.kaif.model.zone.Zone", "java.time.LocalDate", "java.util.List", "org.springframework.cache.annotation.Cacheable" ]
import io.kaif.model.zone.Zone; import java.time.LocalDate; import java.util.List; import org.springframework.cache.annotation.Cacheable;
import io.kaif.model.zone.*; import java.time.*; import java.util.*; import org.springframework.cache.annotation.*;
[ "io.kaif.model", "java.time", "java.util", "org.springframework.cache" ]
io.kaif.model; java.time; java.util; org.springframework.cache;
236,969
private void readTrailer(final GZIPArchive.ReadEntry entry) throws IOException { // CRC32 entry.crc32 = readLEInt(input); if (LOGGER.isTraceEnabled()) LOGGER.trace("CRC read from stream {}", Integer.valueOf(entry.crc32)); // ISIZE final int iSize = readLEInt(input); if (entry.uncompressedSkipLength != iSize) throw new GZIPArchive.FormatException("Length mismatch between (warc) extra gzip fields uncompressed-skip-length (" + entry.uncompressedSkipLength + ") and ISIZE (" + iSize + ")"); }
void function(final GZIPArchive.ReadEntry entry) throws IOException { entry.crc32 = readLEInt(input); if (LOGGER.isTraceEnabled()) LOGGER.trace(STR, Integer.valueOf(entry.crc32)); final int iSize = readLEInt(input); if (entry.uncompressedSkipLength != iSize) throw new GZIPArchive.FormatException(STR + entry.uncompressedSkipLength + STR + iSize + ")"); }
/** Reads the GZIP entry trailer (populating the entry CRC metadata). * * @param entry the entry where to store the CRC of the entry. * */
Reads the GZIP entry trailer (populating the entry CRC metadata)
readTrailer
{ "repo_name": "LAW-Unimi/BUbiNG", "path": "src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveReader.java", "license": "apache-2.0", "size": 9088 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
423,881
private boolean checkConnection() { boolean flag = true; try { flag = this.connection.isClosed(); } catch (SQLException e) { logger.error(e.getMessage(), e); } return flag; }
boolean function() { boolean flag = true; try { flag = this.connection.isClosed(); } catch (SQLException e) { logger.error(e.getMessage(), e); } return flag; }
/** * * Check connection for available * * @return connection status */
Check connection for available
checkConnection
{ "repo_name": "kgobunov/Java", "path": "SMTP/src/main/java/db/dataBaseHelper.java", "license": "gpl-2.0", "size": 7062 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,638,064
private void setLastTargetQuery(final String tenant, final long currentTimeMillis, final List<String> chunk) { final Map<String, String> paramMapping = Maps.newHashMapWithExpectedSize(chunk.size()); for (int i = 0; i < chunk.size(); i++) { paramMapping.put("cid" + i, chunk.get(i)); } final Query updateQuery = entityManager.createNativeQuery( "UPDATE sp_target t SET t.last_target_query = #last_target_query WHERE t.controller_id IN (" + formatQueryInStatementParams(paramMapping.keySet()) + ") AND t.tenant = #tenant"); paramMapping.entrySet().forEach(entry -> updateQuery.setParameter(entry.getKey(), entry.getValue())); updateQuery.setParameter("last_target_query", currentTimeMillis); updateQuery.setParameter("tenant", tenant); final int updated = updateQuery.executeUpdate(); if (updated < chunk.size()) { LOG.error("Targets polls could not be applied completely ({} instead of {}).", updated, chunk.size()); } }
void function(final String tenant, final long currentTimeMillis, final List<String> chunk) { final Map<String, String> paramMapping = Maps.newHashMapWithExpectedSize(chunk.size()); for (int i = 0; i < chunk.size(); i++) { paramMapping.put("cid" + i, chunk.get(i)); } final Query updateQuery = entityManager.createNativeQuery( STR + formatQueryInStatementParams(paramMapping.keySet()) + STR); paramMapping.entrySet().forEach(entry -> updateQuery.setParameter(entry.getKey(), entry.getValue())); updateQuery.setParameter(STR, currentTimeMillis); updateQuery.setParameter(STR, tenant); final int updated = updateQuery.executeUpdate(); if (updated < chunk.size()) { LOG.error(STR, updated, chunk.size()); } }
/** * Sets {@link Target#getLastTargetQuery()} by native SQL in order to avoid * raising opt lock revision as this update is not mission critical and in * fact only written by {@link ControllerManagement}, i.e. the target * itself. */
Sets <code>Target#getLastTargetQuery()</code> by native SQL in order to avoid raising opt lock revision as this update is not mission critical and in fact only written by <code>ControllerManagement</code>, i.e. the target itself
setLastTargetQuery
{ "repo_name": "stormc/hawkbit", "path": "hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java", "license": "epl-1.0", "size": 31273 }
[ "com.google.common.collect.Maps", "java.util.List", "java.util.Map", "javax.persistence.Query" ]
import com.google.common.collect.Maps; import java.util.List; import java.util.Map; import javax.persistence.Query;
import com.google.common.collect.*; import java.util.*; import javax.persistence.*;
[ "com.google.common", "java.util", "javax.persistence" ]
com.google.common; java.util; javax.persistence;
1,117,270
private boolean isOnlyNotificationWithGroupKey(final StatusBarNotification notification, final List<StatusBarNotification> allNotifications) { if (TextUtils.isEmpty(notification.getGroupKey())) { return true; } for (final StatusBarNotification singleNotification : allNotifications) { if (!notification.equals(singleNotification) && notification.getGroupKey().equals(singleNotification.getGroupKey())) { if ((singleNotification.getNotification().visibility == Notification.VISIBILITY_PUBLIC || singleNotification.getNotification().publicVersion != null)) { return false; } } } return true; }
boolean function(final StatusBarNotification notification, final List<StatusBarNotification> allNotifications) { if (TextUtils.isEmpty(notification.getGroupKey())) { return true; } for (final StatusBarNotification singleNotification : allNotifications) { if (!notification.equals(singleNotification) && notification.getGroupKey().equals(singleNotification.getGroupKey())) { if ((singleNotification.getNotification().visibility == Notification.VISIBILITY_PUBLIC singleNotification.getNotification().publicVersion != null)) { return false; } } } return true; }
/** * Check if there isn't a public notification with the same group key * * @param notification The notification to find a public version for * @param allNotifications The list of all notifications * @return True if there is no public version of the notification */
Check if there isn't a public notification with the same group key
isOnlyNotificationWithGroupKey
{ "repo_name": "tobsinger/dreamy", "path": "app/src/main/java/de/dreamy/DreamyDaydream.java", "license": "mit", "size": 14060 }
[ "android.app.Notification", "android.service.notification.StatusBarNotification", "android.text.TextUtils", "java.util.List" ]
import android.app.Notification; import android.service.notification.StatusBarNotification; import android.text.TextUtils; import java.util.List;
import android.app.*; import android.service.notification.*; import android.text.*; import java.util.*;
[ "android.app", "android.service", "android.text", "java.util" ]
android.app; android.service; android.text; java.util;
1,299,216
protected String toJSONFragment() { StringBuffer json = new StringBuffer(); boolean first = true; if (isSetType()) { if (!first) json.append(", "); json.append("\"Type\" : ["); java.util.List<String> typeList = getType(); for (String type : typeList) { if (typeList.indexOf(type) > 0) json.append(", "); json.append(quoteJSON(type)); } json.append("]"); first = false; } return json.toString(); }
String function() { StringBuffer json = new StringBuffer(); boolean first = true; if (isSetType()) { if (!first) json.append(STR); json.append("\"Type\STR); java.util.List<String> typeList = getType(); for (String type : typeList) { if (typeList.indexOf(type) > 0) json.append(STR); json.append(quoteJSON(type)); } json.append("]"); first = false; } return json.toString(); }
/** * * JSON fragment representation of this object * * @return JSON fragment for this object. Name for outer * object expected to be set by calling method. This fragment * returns inner properties representation only * */
JSON fragment representation of this object
toJSONFragment
{ "repo_name": "VDuda/SyncRunner-Pub", "path": "src/API/amazon/mws/feeds/model/TypeList.java", "license": "mit", "size": 6265 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
299,411
public void requestSetFailedNode(int nodeId) { this.enqueue(new ReplaceFailedNodeMessageClass().doRequest(nodeId)); }
void function(int nodeId) { this.enqueue(new ReplaceFailedNodeMessageClass().doRequest(nodeId)); }
/** * Marks a node as failed * * @param nodeId * The address of the node to set failed */
Marks a node as failed
requestSetFailedNode
{ "repo_name": "mickey4u/new_mart", "path": "addons/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/ZWaveController.java", "license": "epl-1.0", "size": 56021 }
[ "org.openhab.binding.zwave.internal.protocol.serialmessage.ReplaceFailedNodeMessageClass" ]
import org.openhab.binding.zwave.internal.protocol.serialmessage.ReplaceFailedNodeMessageClass;
import org.openhab.binding.zwave.internal.protocol.serialmessage.*;
[ "org.openhab.binding" ]
org.openhab.binding;
238,602
private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks) { GlStateManager.disableLighting(); TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_0"); TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_1"); GlStateManager.pushMatrix(); GlStateManager.translate((float) x, (float) y, (float) z); float f = entity.width * 1.4F; GlStateManager.scale(f, f, f); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); float f1 = 0.5F; float f2 = 0.0F; float f3 = entity.height / f; float f4 = (float) (entity.posY - entity.getEntityBoundingBox().minY); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.0F, 0.0F, -0.3F + (float) ((int) f3) * 0.02F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f5 = 0.0F; int i = 0; worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); while (f3 > 0.0F) { TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1; this.bindTexture(TextureMap.locationBlocksTexture); float f6 = textureatlassprite2.getMinU(); float f7 = textureatlassprite2.getMinV(); float f8 = textureatlassprite2.getMaxU(); float f9 = textureatlassprite2.getMaxV(); if (i / 2 % 2 == 0) { float f10 = f8; f8 = f6; f6 = f10; } worldrenderer.pos((double) (f1 - f2), (double) (0.0F - f4), (double) f5).tex((double) f8, (double) f9) .endVertex(); worldrenderer.pos((double) (-f1 - f2), (double) (0.0F - f4), (double) f5).tex((double) f6, (double) f9) .endVertex(); worldrenderer.pos((double) (-f1 - f2), (double) (1.4F - f4), (double) f5).tex((double) f6, (double) f7) .endVertex(); worldrenderer.pos((double) (f1 - f2), (double) (1.4F - f4), (double) f5).tex((double) f8, (double) f7) .endVertex(); f3 -= 0.45F; f4 -= 0.45F; f1 *= 0.9F; f5 += 0.03F; ++i; } tessellator.draw(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); }
void function(Entity entity, double x, double y, double z, float partialTicks) { GlStateManager.disableLighting(); TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite(STR); TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite(STR); GlStateManager.pushMatrix(); GlStateManager.translate((float) x, (float) y, (float) z); float f = entity.width * 1.4F; GlStateManager.scale(f, f, f); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); float f1 = 0.5F; float f2 = 0.0F; float f3 = entity.height / f; float f4 = (float) (entity.posY - entity.getEntityBoundingBox().minY); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.0F, 0.0F, -0.3F + (float) ((int) f3) * 0.02F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f5 = 0.0F; int i = 0; worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); while (f3 > 0.0F) { TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1; this.bindTexture(TextureMap.locationBlocksTexture); float f6 = textureatlassprite2.getMinU(); float f7 = textureatlassprite2.getMinV(); float f8 = textureatlassprite2.getMaxU(); float f9 = textureatlassprite2.getMaxV(); if (i / 2 % 2 == 0) { float f10 = f8; f8 = f6; f6 = f10; } worldrenderer.pos((double) (f1 - f2), (double) (0.0F - f4), (double) f5).tex((double) f8, (double) f9) .endVertex(); worldrenderer.pos((double) (-f1 - f2), (double) (0.0F - f4), (double) f5).tex((double) f6, (double) f9) .endVertex(); worldrenderer.pos((double) (-f1 - f2), (double) (1.4F - f4), (double) f5).tex((double) f6, (double) f7) .endVertex(); worldrenderer.pos((double) (f1 - f2), (double) (1.4F - f4), (double) f5).tex((double) f8, (double) f7) .endVertex(); f3 -= 0.45F; f4 -= 0.45F; f1 *= 0.9F; f5 += 0.03F; ++i; } tessellator.draw(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); }
/** * Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime */
Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime
renderEntityOnFire
{ "repo_name": "SkidJava/BaseClient", "path": "new_1.8.8/net/minecraft/client/renderer/entity/Render.java", "license": "gpl-2.0", "size": 16967 }
[ "net.minecraft.client.Minecraft", "net.minecraft.client.renderer.GlStateManager", "net.minecraft.client.renderer.Tessellator", "net.minecraft.client.renderer.WorldRenderer", "net.minecraft.client.renderer.texture.TextureAtlasSprite", "net.minecraft.client.renderer.texture.TextureMap", "net.minecraft.client.renderer.vertex.DefaultVertexFormats", "net.minecraft.entity.Entity" ]
import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity;
import net.minecraft.client.*; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.texture.*; import net.minecraft.client.renderer.vertex.*; import net.minecraft.entity.*;
[ "net.minecraft.client", "net.minecraft.entity" ]
net.minecraft.client; net.minecraft.entity;
2,873,961
private Vector parseRawEntry(String target, String raw){ if(target == null){ return null; } return null; }
Vector function(String target, String raw){ if(target == null){ return null; } return null; }
/** * This method parses the given html tagged line from * www.wordweb.com to remove all the unnecessary tags and * return a vector of either thesaurus of dictionaryentry * objects * * @param target - String target word * @param raw - String raw html tagged line * @return - Vector of thesaurus / dictionary objects */
This method parses the given html tagged line from www.wordweb.com to remove all the unnecessary tags and return a vector of either thesaurus of dictionaryentry objects
parseRawEntry
{ "repo_name": "ssomnath/GRE_WordLookup", "path": "AutoWordLookup5.5/src/dictionaries/Longman.java", "license": "gpl-2.0", "size": 5204 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
2,376,017
SCMRegisteredCmdResponseProto register(DatanodeDetailsProto datanodeDetails, String[] scmAddresses) throws IOException;
SCMRegisteredCmdResponseProto register(DatanodeDetailsProto datanodeDetails, String[] scmAddresses) throws IOException;
/** * Register Datanode. * @param datanodeDetails - Datanode Details. * @param scmAddresses - List of SCMs this datanode is configured to * communicate. * @return SCM Command. */
Register Datanode
register
{ "repo_name": "ChetnaChaudhari/hadoop", "path": "hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerDatanodeProtocol.java", "license": "apache-2.0", "size": 3919 }
[ "java.io.IOException", "org.apache.hadoop.hdds.protocol.proto.HddsProtos" ]
import java.io.IOException; import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
import java.io.*; import org.apache.hadoop.hdds.protocol.proto.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,300,061
public void add(Number value, Paint paint) { add(value.doubleValue(), paint); }
void function(Number value, Paint paint) { add(value.doubleValue(), paint); }
/** * Adds an entry to the lookup table. Any values from <code>n</code> up * to but not including the next value in the table take on the specified * <code>paint</code>. * * @param value the data value (<code>null</code> not permitted). * @param paint the paint. * * @deprecated Use {@link #add(double, Paint)}. */
Adds an entry to the lookup table. Any values from <code>n</code> up to but not including the next value in the table take on the specified <code>paint</code>
add
{ "repo_name": "apetresc/JFreeChart", "path": "src/main/java/org/jfree/chart/renderer/LookupPaintScale.java", "license": "lgpl-2.1", "size": 11827 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,739,619
public void setAsynchronous( boolean async ) throws IOException;
void function( boolean async ) throws IOException;
/** * For a non-blocking tracker the construction of the response can be completed asynchronously * by setting async=true and then, when complete, setting it to false * @param async */
For a non-blocking tracker the construction of the response can be completed asynchronously by setting async=true and then, when complete, setting it to false
setAsynchronous
{ "repo_name": "BiglySoftware/BiglyBT", "path": "core/src/com/biglybt/pif/tracker/web/TrackerWebPageResponse.java", "license": "gpl-2.0", "size": 2665 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,529,436
boolean trackMotionScroll( int deltaX, int incrementalDeltaX ) { final int childCount = getChildCount(); if ( childCount == 0 ) { return true; } final int firstLeft = getChildAt( 0 ).getLeft(); final int lastRight = getChildAt( childCount - 1 ).getRight(); final Rect listPadding = mListPadding; // "effective padding" In this case is the amount of padding that affects // how much space should not be filled by items. If we don't clip to padding // there is no effective padding. int effectivePaddingLeft = 0; int effectivePaddingRight = 0; // FIXME account for grid vertical spacing too? final int spaceBefore = effectivePaddingLeft - firstLeft; final int end = getWidth() - effectivePaddingRight; final int spaceAfter = lastRight - end; final int width = getWidth() - getPaddingRight() - getPaddingLeft(); if ( deltaX < 0 ) { deltaX = Math.max( -( width - 1 ), deltaX ); } else { deltaX = Math.min( width - 1, deltaX ); } if ( incrementalDeltaX < 0 ) { incrementalDeltaX = Math.max( -( width - 1 ), incrementalDeltaX ); } else { incrementalDeltaX = Math.min( width - 1, incrementalDeltaX ); } final int firstPosition = mFirstPosition; // Update our guesses for where the first and last views are if ( firstPosition == 0 ) { mFirstPositionDistanceGuess = firstLeft - listPadding.left; } else { mFirstPositionDistanceGuess += incrementalDeltaX; } if ( firstPosition + childCount == mItemCount ) { mLastPositionDistanceGuess = lastRight + listPadding.right; } else { mLastPositionDistanceGuess += incrementalDeltaX; } final boolean cannotScrollRight = ( firstPosition == 0 && firstLeft >= listPadding.left && incrementalDeltaX >= 0 ); final boolean cannotScrollLeft = ( firstPosition + childCount == mItemCount && lastRight <= getWidth() - listPadding.right && incrementalDeltaX <= 0 ); if ( cannotScrollRight || cannotScrollLeft ) { return incrementalDeltaX != 0; } final boolean down = incrementalDeltaX < 0; final boolean inTouchMode = isInTouchMode(); if ( inTouchMode ) { hideSelector(); } final int headerViewsCount = getHeaderViewsCount(); final int footerViewsStart = mItemCount - getFooterViewsCount(); int start = 0; int count = 0; if ( down ) { int top = -incrementalDeltaX; for ( int i = 0; i < childCount; i++ ) { final View child = getChildAt( i ); if ( child.getRight() >= top ) { break; } else { count++; int position = firstPosition + i; if ( position >= headerViewsCount && position < footerViewsStart ) { mRecycler.addScrapView( child, position ); } } } } else { int bottom = getWidth() - incrementalDeltaX; for ( int i = childCount - 1; i >= 0; i-- ) { final View child = getChildAt( i ); if ( child.getLeft() <= bottom ) { break; } else { start = i; count++; int position = firstPosition + i; if ( position >= headerViewsCount && position < footerViewsStart ) { mRecycler.addScrapView( child, position ); } } } } mMotionViewNewLeft = mMotionViewOriginalLeft + deltaX; mBlockLayoutRequests = true; if ( count > 0 ) { detachViewsFromParent( start, count ); mRecycler.removeSkippedScrap(); } // invalidate before moving the children to avoid unnecessary invalidate // calls to bubble up from the children all the way to the top if ( !awakenScrollBars() ) { invalidate(); } offsetChildrenLeftAndRight( incrementalDeltaX ); if ( down ) { mFirstPosition += count; } final int absIncrementalDeltaX = Math.abs( incrementalDeltaX ); if ( spaceBefore < absIncrementalDeltaX || spaceAfter < absIncrementalDeltaX ) { fillGap( down ); } if ( !inTouchMode && mSelectedPosition != INVALID_POSITION ) { final int childIndex = mSelectedPosition - mFirstPosition; if ( childIndex >= 0 && childIndex < getChildCount() ) { positionSelector( mSelectedPosition, getChildAt( childIndex ) ); } } else if ( mSelectorPosition != INVALID_POSITION ) { final int childIndex = mSelectorPosition - mFirstPosition; if ( childIndex >= 0 && childIndex < getChildCount() ) { positionSelector( INVALID_POSITION, getChildAt( childIndex ) ); } } else { mSelectorRect.setEmpty(); } mBlockLayoutRequests = false; invokeOnItemScrollListener(); return false; }
boolean trackMotionScroll( int deltaX, int incrementalDeltaX ) { final int childCount = getChildCount(); if ( childCount == 0 ) { return true; } final int firstLeft = getChildAt( 0 ).getLeft(); final int lastRight = getChildAt( childCount - 1 ).getRight(); final Rect listPadding = mListPadding; int effectivePaddingLeft = 0; int effectivePaddingRight = 0; final int spaceBefore = effectivePaddingLeft - firstLeft; final int end = getWidth() - effectivePaddingRight; final int spaceAfter = lastRight - end; final int width = getWidth() - getPaddingRight() - getPaddingLeft(); if ( deltaX < 0 ) { deltaX = Math.max( -( width - 1 ), deltaX ); } else { deltaX = Math.min( width - 1, deltaX ); } if ( incrementalDeltaX < 0 ) { incrementalDeltaX = Math.max( -( width - 1 ), incrementalDeltaX ); } else { incrementalDeltaX = Math.min( width - 1, incrementalDeltaX ); } final int firstPosition = mFirstPosition; if ( firstPosition == 0 ) { mFirstPositionDistanceGuess = firstLeft - listPadding.left; } else { mFirstPositionDistanceGuess += incrementalDeltaX; } if ( firstPosition + childCount == mItemCount ) { mLastPositionDistanceGuess = lastRight + listPadding.right; } else { mLastPositionDistanceGuess += incrementalDeltaX; } final boolean cannotScrollRight = ( firstPosition == 0 && firstLeft >= listPadding.left && incrementalDeltaX >= 0 ); final boolean cannotScrollLeft = ( firstPosition + childCount == mItemCount && lastRight <= getWidth() - listPadding.right && incrementalDeltaX <= 0 ); if ( cannotScrollRight cannotScrollLeft ) { return incrementalDeltaX != 0; } final boolean down = incrementalDeltaX < 0; final boolean inTouchMode = isInTouchMode(); if ( inTouchMode ) { hideSelector(); } final int headerViewsCount = getHeaderViewsCount(); final int footerViewsStart = mItemCount - getFooterViewsCount(); int start = 0; int count = 0; if ( down ) { int top = -incrementalDeltaX; for ( int i = 0; i < childCount; i++ ) { final View child = getChildAt( i ); if ( child.getRight() >= top ) { break; } else { count++; int position = firstPosition + i; if ( position >= headerViewsCount && position < footerViewsStart ) { mRecycler.addScrapView( child, position ); } } } } else { int bottom = getWidth() - incrementalDeltaX; for ( int i = childCount - 1; i >= 0; i-- ) { final View child = getChildAt( i ); if ( child.getLeft() <= bottom ) { break; } else { start = i; count++; int position = firstPosition + i; if ( position >= headerViewsCount && position < footerViewsStart ) { mRecycler.addScrapView( child, position ); } } } } mMotionViewNewLeft = mMotionViewOriginalLeft + deltaX; mBlockLayoutRequests = true; if ( count > 0 ) { detachViewsFromParent( start, count ); mRecycler.removeSkippedScrap(); } if ( !awakenScrollBars() ) { invalidate(); } offsetChildrenLeftAndRight( incrementalDeltaX ); if ( down ) { mFirstPosition += count; } final int absIncrementalDeltaX = Math.abs( incrementalDeltaX ); if ( spaceBefore < absIncrementalDeltaX spaceAfter < absIncrementalDeltaX ) { fillGap( down ); } if ( !inTouchMode && mSelectedPosition != INVALID_POSITION ) { final int childIndex = mSelectedPosition - mFirstPosition; if ( childIndex >= 0 && childIndex < getChildCount() ) { positionSelector( mSelectedPosition, getChildAt( childIndex ) ); } } else if ( mSelectorPosition != INVALID_POSITION ) { final int childIndex = mSelectorPosition - mFirstPosition; if ( childIndex >= 0 && childIndex < getChildCount() ) { positionSelector( INVALID_POSITION, getChildAt( childIndex ) ); } } else { mSelectorRect.setEmpty(); } mBlockLayoutRequests = false; invokeOnItemScrollListener(); return false; }
/** * Track a motion scroll * * @param deltaY * Amount to offset mMotionView. This is the accumulated delta since the motion began. Positive numbers mean the user's * finger is moving down the screen. * @param incrementalDeltaY * Change in deltaY from the previous event. * @return true if we're already at the beginning/end of the list and have nothing to do. */
Track a motion scroll
trackMotionScroll
{ "repo_name": "jonathangerbaud/Klyph", "path": "Klyph/libs_ext/HorizontalVariableListView-master/HorizontalVariableListView/src/it/sephiroth/android/library/widget/AbsHListView.java", "license": "mit", "size": 175073 }
[ "android.graphics.Rect", "android.view.View" ]
import android.graphics.Rect; import android.view.View;
import android.graphics.*; import android.view.*;
[ "android.graphics", "android.view" ]
android.graphics; android.view;
2,072,800
public ContentPackage getContentPackageByResourceId(String resourceId) throws ResourceStorageException;
ContentPackage function(String resourceId) throws ResourceStorageException;
/** * Gets the content package by the resource its represents * @param resourceId * @return * @throws ResourceStorageException */
Gets the content package by the resource its represents
getContentPackageByResourceId
{ "repo_name": "marktriggs/nyu-sakai-10.4", "path": "scorm/scorm-api/src/java/org/sakaiproject/scorm/service/api/ScormContentService.java", "license": "apache-2.0", "size": 3435 }
[ "org.sakaiproject.scorm.exceptions.ResourceStorageException", "org.sakaiproject.scorm.model.api.ContentPackage" ]
import org.sakaiproject.scorm.exceptions.ResourceStorageException; import org.sakaiproject.scorm.model.api.ContentPackage;
import org.sakaiproject.scorm.exceptions.*; import org.sakaiproject.scorm.model.api.*;
[ "org.sakaiproject.scorm" ]
org.sakaiproject.scorm;
813,061
@Override protected IdmScriptType toType(IdmScriptDto dto) { IdmScriptType type = new IdmScriptType(); if (dto == null) { return type; } // transform DTO to type type.setCode(dto.getCode()); type.setName(dto.getName()); // parameter isn't implemented yet // type.setParameters(dto.getParameter()); type.setBody(dto.getScript()); type.setCategory(dto.getCategory()); type.setDescription(dto.getDescription()); type.setType(SCRIPT_DEFAULT_TYPE); // if (dto.getId() == null) { return type; } IdmScriptAuthorityFilter filter = new IdmScriptAuthorityFilter(); filter.setScriptId(dto.getId()); List<IdmScriptAuthorityDto> authorities = scriptAuthorityService .find( filter, PageRequest.of( 0, Integer.MAX_VALUE, Sort.by( IdmScriptAuthority_.type.getName(), IdmScriptAuthority_.service.getName(), IdmScriptAuthority_.className.getName() ) ) ) .getContent(); if (authorities.isEmpty()) { return type; } // List<IdmScriptAllowClassType> classes = new ArrayList<>(); List<IdmScriptServiceType> services = new ArrayList<>(); for (IdmScriptAuthorityDto auth : authorities) { if (auth.getType() == ScriptAuthorityType.CLASS_NAME) { IdmScriptAllowClassType classType = new IdmScriptAllowClassType(); classType.setClassName(auth.getClassName()); classes.add(classType); } else { IdmScriptServiceType service = new IdmScriptServiceType(); service.setClassName(auth.getClassName()); service.setName(auth.getService()); services.add(service); } } if (!classes.isEmpty()) { type.setAllowClasses(new IdmScriptAllowClassesType()); type.getAllowClasses().setAllowClasses(classes); } if (!services.isEmpty()) { type.setServices(new IdmScriptServicesType()); type.getServices().setServices(services); } // return type; }
IdmScriptType function(IdmScriptDto dto) { IdmScriptType type = new IdmScriptType(); if (dto == null) { return type; } type.setCode(dto.getCode()); type.setName(dto.getName()); type.setBody(dto.getScript()); type.setCategory(dto.getCategory()); type.setDescription(dto.getDescription()); type.setType(SCRIPT_DEFAULT_TYPE); return type; } IdmScriptAuthorityFilter filter = new IdmScriptAuthorityFilter(); filter.setScriptId(dto.getId()); List<IdmScriptAuthorityDto> authorities = scriptAuthorityService .find( filter, PageRequest.of( 0, Integer.MAX_VALUE, Sort.by( IdmScriptAuthority_.type.getName(), IdmScriptAuthority_.service.getName(), IdmScriptAuthority_.className.getName() ) ) ) .getContent(); if (authorities.isEmpty()) { return type; } List<IdmScriptServiceType> services = new ArrayList<>(); for (IdmScriptAuthorityDto auth : authorities) { if (auth.getType() == ScriptAuthorityType.CLASS_NAME) { IdmScriptAllowClassType classType = new IdmScriptAllowClassType(); classType.setClassName(auth.getClassName()); classes.add(classType); } else { IdmScriptServiceType service = new IdmScriptServiceType(); service.setClassName(auth.getClassName()); service.setName(auth.getService()); services.add(service); } } if (!classes.isEmpty()) { type.setAllowClasses(new IdmScriptAllowClassesType()); type.getAllowClasses().setAllowClasses(classes); } if (!services.isEmpty()) { type.setServices(new IdmScriptServicesType()); type.getServices().setServices(services); } }
/** * Transform dto to type. * * @param dto * @return */
Transform dto to type
toType
{ "repo_name": "bcvsolutions/CzechIdMng", "path": "Realization/backend/core/core-impl/src/main/java/eu/bcvsolutions/idm/core/model/service/impl/DefaultIdmScriptService.java", "license": "mit", "size": 16823 }
[ "eu.bcvsolutions.idm.core.api.domain.ScriptAuthorityType", "eu.bcvsolutions.idm.core.api.dto.IdmScriptAuthorityDto", "eu.bcvsolutions.idm.core.api.dto.IdmScriptDto", "eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptAuthorityFilter", "eu.bcvsolutions.idm.core.model.jaxb.IdmScriptAllowClassType", "eu.bcvsolutions.idm.core.model.jaxb.IdmScriptAllowClassesType", "eu.bcvsolutions.idm.core.model.jaxb.IdmScriptServiceType", "eu.bcvsolutions.idm.core.model.jaxb.IdmScriptServicesType", "eu.bcvsolutions.idm.core.model.jaxb.IdmScriptType", "java.util.ArrayList", "java.util.List", "org.springframework.data.domain.PageRequest", "org.springframework.data.domain.Sort" ]
import eu.bcvsolutions.idm.core.api.domain.ScriptAuthorityType; import eu.bcvsolutions.idm.core.api.dto.IdmScriptAuthorityDto; import eu.bcvsolutions.idm.core.api.dto.IdmScriptDto; import eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptAuthorityFilter; import eu.bcvsolutions.idm.core.model.jaxb.IdmScriptAllowClassType; import eu.bcvsolutions.idm.core.model.jaxb.IdmScriptAllowClassesType; import eu.bcvsolutions.idm.core.model.jaxb.IdmScriptServiceType; import eu.bcvsolutions.idm.core.model.jaxb.IdmScriptServicesType; import eu.bcvsolutions.idm.core.model.jaxb.IdmScriptType; import java.util.ArrayList; import java.util.List; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort;
import eu.bcvsolutions.idm.core.api.domain.*; import eu.bcvsolutions.idm.core.api.dto.*; import eu.bcvsolutions.idm.core.api.dto.filter.*; import eu.bcvsolutions.idm.core.model.jaxb.*; import java.util.*; import org.springframework.data.domain.*;
[ "eu.bcvsolutions.idm", "java.util", "org.springframework.data" ]
eu.bcvsolutions.idm; java.util; org.springframework.data;
770,327
public static SecurityPolicyResolver makeStaticSecurityPolicyResolver( SecurityPolicyRule... rules) { return makeStaticSecurityPolicyResolver(makeBasicSecurityPolicy(rules)); }
static SecurityPolicyResolver function( SecurityPolicyRule... rules) { return makeStaticSecurityPolicyResolver(makeBasicSecurityPolicy(rules)); }
/** * Make a static security-policy resolver that resolves to a given policy. * * @param rules The policy rules that comprise the returned policy. * @return A security-policy resolver that resolves to the given policy. */
Make a static security-policy resolver that resolves to a given policy
makeStaticSecurityPolicyResolver
{ "repo_name": "dweidenfeld/library", "path": "src/com/google/enterprise/adaptor/secmgr/saml/OpenSamlUtil.java", "license": "apache-2.0", "size": 43010 }
[ "org.opensaml.ws.security.SecurityPolicyResolver", "org.opensaml.ws.security.SecurityPolicyRule" ]
import org.opensaml.ws.security.SecurityPolicyResolver; import org.opensaml.ws.security.SecurityPolicyRule;
import org.opensaml.ws.security.*;
[ "org.opensaml.ws" ]
org.opensaml.ws;
2,398,052
public void requestStillImage() { if (gpsLogger.isTracking()) { File imageFile = pushImageFile(); if (null != imageFile) { Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile)); startActivityForResult(cameraIntent, TrackLogger.REQCODE_IMAGE_CAPTURE); } else { Toast.makeText(getBaseContext(), getResources().getString(R.string.error_externalstorage_not_writable), Toast.LENGTH_SHORT).show(); } } }
void function() { if (gpsLogger.isTracking()) { File imageFile = pushImageFile(); if (null != imageFile) { Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile)); startActivityForResult(cameraIntent, TrackLogger.REQCODE_IMAGE_CAPTURE); } else { Toast.makeText(getBaseContext(), getResources().getString(R.string.error_externalstorage_not_writable), Toast.LENGTH_SHORT).show(); } } }
/** * Request a still picture from the camera application, saving the file in * the current track directory */
Request a still picture from the camera application, saving the file in the current track directory
requestStillImage
{ "repo_name": "janastu/BaaApp", "path": "src/janastu/android/followsheep/activity/TrackLogger.java", "license": "gpl-3.0", "size": 16990 }
[ "android.content.Intent", "android.net.Uri", "android.provider.MediaStore", "android.widget.Toast", "java.io.File" ]
import android.content.Intent; import android.net.Uri; import android.provider.MediaStore; import android.widget.Toast; import java.io.File;
import android.content.*; import android.net.*; import android.provider.*; import android.widget.*; import java.io.*;
[ "android.content", "android.net", "android.provider", "android.widget", "java.io" ]
android.content; android.net; android.provider; android.widget; java.io;
128,548
public void setDbStoredFunctionReturnType(DatabaseType dbStoredFunctionReturnType) { this.dbStoredFunctionReturnType = dbStoredFunctionReturnType; }
void function(DatabaseType dbStoredFunctionReturnType) { this.dbStoredFunctionReturnType = dbStoredFunctionReturnType; }
/** * Set the DatabaseType of the stored function's return argument. * * @param dbStoredFunctionReturnType */
Set the DatabaseType of the stored function's return argument
setDbStoredFunctionReturnType
{ "repo_name": "gameduell/eclipselink.runtime", "path": "utils/org.eclipse.persistence.dbws.builder/src/org/eclipse/persistence/tools/dbws/ProcedureOperationModel.java", "license": "epl-1.0", "size": 6884 }
[ "org.eclipse.persistence.internal.helper.DatabaseType" ]
import org.eclipse.persistence.internal.helper.DatabaseType;
import org.eclipse.persistence.internal.helper.*;
[ "org.eclipse.persistence" ]
org.eclipse.persistence;
1,233,029
public IBasicExpression createExpression (Element element) throws BadQueryException { IBasicExpression result = null; if (element == null) { result = new EmptyExpression(getRequestedResourcePool()); } else { String namespace = element.getNamespace().getURI(); String name = element.getName(); if (namespace.equals (NamespaceCache.DEFAULT_URI)) { result = createDAVExpression(element); } else if (namespace.equals (NamespaceCache.SLIDE_URI)) { result = createNonDAVExpression(element, namespace); } else { throw new InvalidQueryException ("operator <" + namespace + ":" + name + "> is an unprocessable entity"); } } if (result != null) result.setFactory(this); return result; }
IBasicExpression function (Element element) throws BadQueryException { IBasicExpression result = null; if (element == null) { result = new EmptyExpression(getRequestedResourcePool()); } else { String namespace = element.getNamespace().getURI(); String name = element.getName(); if (namespace.equals (NamespaceCache.DEFAULT_URI)) { result = createDAVExpression(element); } else if (namespace.equals (NamespaceCache.SLIDE_URI)) { result = createNonDAVExpression(element, namespace); } else { throw new InvalidQueryException (STR + namespace + ":" + name + STR); } } if (result != null) result.setFactory(this); return result; }
/** * Creates a (non-merge) expression (compare...) for the given Element. * * @param element an Element describing the expression. * * @return an IBasicExpression * * @throws BadQueryException * */
Creates a (non-merge) expression (compare...) for the given Element
createExpression
{ "repo_name": "integrated/jakarta-slide-server", "path": "maven/jakarta-slide-kernel/src/main/java/org/apache/slide/search/basic/BasicExpressionFactory.java", "license": "apache-2.0", "size": 11988 }
[ "org.apache.slide.content.NodeProperty", "org.apache.slide.search.BadQueryException", "org.apache.slide.search.InvalidQueryException", "org.apache.slide.search.basic.expression.EmptyExpression", "org.jdom.Element" ]
import org.apache.slide.content.NodeProperty; import org.apache.slide.search.BadQueryException; import org.apache.slide.search.InvalidQueryException; import org.apache.slide.search.basic.expression.EmptyExpression; import org.jdom.Element;
import org.apache.slide.content.*; import org.apache.slide.search.*; import org.apache.slide.search.basic.expression.*; import org.jdom.*;
[ "org.apache.slide", "org.jdom" ]
org.apache.slide; org.jdom;
2,673,660
public void display() { Iterator i = getKeys(); while (i.hasNext()) { String key = (String) i.next(); Object value = get(key); System.out.println(key + " => " + value); } }
void function() { Iterator i = getKeys(); while (i.hasNext()) { String key = (String) i.next(); Object value = get(key); System.out.println(key + STR + value); } }
/** * Display the configuration for debugging purposes to System.out. */
Display the configuration for debugging purposes to System.out
display
{ "repo_name": "sabob/ratel", "path": "ratel/src/org/apache/commons/collections/ExtendedProperties.java", "license": "apache-2.0", "size": 58798 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,517,763
private void clearLogTable( int index ) { TransHistoryLogTab model = models[index]; LogTableInterface logTable = model.logTable; if ( logTable.isDefined() ) { String schemaTable = logTable.getQuotedSchemaTableCombination(); DatabaseMeta databaseMeta = logTable.getDatabaseMeta(); MessageBox mb = new MessageBox( transGraph.getShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION ); mb.setMessage( BaseMessages.getString( PKG, "TransGraph.Dialog.AreYouSureYouWantToRemoveAllLogEntries.Message", schemaTable ) ); // Nothing found that matches your criteria, sorry! mb.setText( BaseMessages.getString( PKG, "TransGraph.Dialog.AreYouSureYouWantToRemoveAllLogEntries.Title" ) ); if ( mb.open() == SWT.YES ) { Database database = new Database( loggingObject, databaseMeta ); try { database.connect(); database.truncateTable( schemaTable ); } catch ( Exception e ) { new ErrorDialog( transGraph.getShell(), BaseMessages.getString( PKG, "TransGraph.Dialog.ErrorClearningLoggingTable.Title" ), BaseMessages.getString( PKG, "TransGraph.Dialog.ErrorClearningLoggingTable.Message" ), e ); } finally { database.disconnect(); refreshHistory(); if ( model.logDisplayText != null ) { model.logDisplayText.setText( "" ); } } } } }
void function( int index ) { TransHistoryLogTab model = models[index]; LogTableInterface logTable = model.logTable; if ( logTable.isDefined() ) { String schemaTable = logTable.getQuotedSchemaTableCombination(); DatabaseMeta databaseMeta = logTable.getDatabaseMeta(); MessageBox mb = new MessageBox( transGraph.getShell(), SWT.YES SWT.NO SWT.ICON_QUESTION ); mb.setMessage( BaseMessages.getString( PKG, STR, schemaTable ) ); mb.setText( BaseMessages.getString( PKG, STR ) ); if ( mb.open() == SWT.YES ) { Database database = new Database( loggingObject, databaseMeta ); try { database.connect(); database.truncateTable( schemaTable ); } catch ( Exception e ) { new ErrorDialog( transGraph.getShell(), BaseMessages.getString( PKG, STR ), BaseMessages.getString( PKG, STR ), e ); } finally { database.disconnect(); refreshHistory(); if ( model.logDisplayText != null ) { model.logDisplayText.setText( "" ); } } } } }
/** * User requested to clear the log table.<br> * Better ask confirmation */
User requested to clear the log table. Better ask confirmation
clearLogTable
{ "repo_name": "emartin-pentaho/pentaho-kettle", "path": "ui/src/main/java/org/pentaho/di/ui/spoon/trans/TransHistoryDelegate.java", "license": "apache-2.0", "size": 27926 }
[ "org.eclipse.swt.widgets.MessageBox", "org.pentaho.di.core.database.Database", "org.pentaho.di.core.database.DatabaseMeta", "org.pentaho.di.core.logging.LogTableInterface", "org.pentaho.di.i18n.BaseMessages", "org.pentaho.di.ui.core.dialog.ErrorDialog" ]
import org.eclipse.swt.widgets.MessageBox; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.logging.LogTableInterface; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.ui.core.dialog.ErrorDialog;
import org.eclipse.swt.widgets.*; import org.pentaho.di.core.database.*; import org.pentaho.di.core.logging.*; import org.pentaho.di.i18n.*; import org.pentaho.di.ui.core.dialog.*;
[ "org.eclipse.swt", "org.pentaho.di" ]
org.eclipse.swt; org.pentaho.di;
399,811
public void CheckLinks(AgentModel am) { ListIterator<Plan> li; li = _planConstruction.listIterator(); while(li.hasNext()) { ((Plan) li.next()).UpdatePlan(am); } if(this._subIntention != null) { this._subIntention.CheckLinks(am); } }
void function(AgentModel am) { ListIterator<Plan> li; li = _planConstruction.listIterator(); while(li.hasNext()) { ((Plan) li.next()).UpdatePlan(am); } if(this._subIntention != null) { this._subIntention.CheckLinks(am); } }
/** * Updates all the plans for the intention according to the new * state of the world. Supports continuous planning. */
Updates all the plans for the intention according to the new state of the world. Supports continuous planning
CheckLinks
{ "repo_name": "nurv/lirec", "path": "AgentMind/trunk/AgentMind/FAtiMA/src/FAtiMA/deliberativeLayer/Intention.java", "license": "gpl-3.0", "size": 13555 }
[ "java.util.ListIterator" ]
import java.util.ListIterator;
import java.util.*;
[ "java.util" ]
java.util;
1,427,497
@Override public void Execute(QueryContext queryContext, Predicate nextPredicate) throws GeneralFailureException, OperationFailedException, CacheException { java.util.ArrayList keyList = null; pattern = (String) generator.Evaluate(((MemberFunction) functor).getMemberName(), queryContext.getAttributeValues()); pattern = tangible.DotNetToJavaStringHelper.trim(pattern, '\''); AttributeIndex index = queryContext.getIndex(); IIndexStore store = ((MemberFunction) functor).GetStore(index); if (store != null) { if (getInverse()) { keyList = store.GetData(pattern, ComparisonType.NOT_LIKE); } else { keyList = store.GetData(pattern, ComparisonType.LIKE); } if (keyList != null && keyList.size() > 0) { java.util.Iterator keyListEnum = keyList.iterator(); if (queryContext.getPopulateTree()) { queryContext.getTree().setRightList(keyList); queryContext.setPopulateTree(false); } else { while (keyListEnum.hasNext()) { if (queryContext.getTree().getLeftList().contains(keyListEnum.next())) { queryContext.getTree().Shift(keyListEnum.next()); } } } } } else { { throw new AttributeIndexNotDefined("Index is not defined for attribute '" + ((MemberFunction) functor).getMemberName() + "'"); } } }
void function(QueryContext queryContext, Predicate nextPredicate) throws GeneralFailureException, OperationFailedException, CacheException { java.util.ArrayList keyList = null; pattern = (String) generator.Evaluate(((MemberFunction) functor).getMemberName(), queryContext.getAttributeValues()); pattern = tangible.DotNetToJavaStringHelper.trim(pattern, '\''); AttributeIndex index = queryContext.getIndex(); IIndexStore store = ((MemberFunction) functor).GetStore(index); if (store != null) { if (getInverse()) { keyList = store.GetData(pattern, ComparisonType.NOT_LIKE); } else { keyList = store.GetData(pattern, ComparisonType.LIKE); } if (keyList != null && keyList.size() > 0) { java.util.Iterator keyListEnum = keyList.iterator(); if (queryContext.getPopulateTree()) { queryContext.getTree().setRightList(keyList); queryContext.setPopulateTree(false); } else { while (keyListEnum.hasNext()) { if (queryContext.getTree().getLeftList().contains(keyListEnum.next())) { queryContext.getTree().Shift(keyListEnum.next()); } } } } } else { { throw new AttributeIndexNotDefined(STR + ((MemberFunction) functor).getMemberName() + "'"); } } }
/** * See attribute-level indexes can't be used in this predicate. * * @param queryContext */
See attribute-level indexes can't be used in this predicate
Execute
{ "repo_name": "Alachisoft/TayzGrid", "path": "src/tgcache/src/com/alachisoft/tayzgrid/caching/queries/filters/FunctorLikePatternPredicate.java", "license": "apache-2.0", "size": 5089 }
[ "com.alachisoft.tayzgrid.caching.queries.AttributeIndex", "com.alachisoft.tayzgrid.caching.queries.ComparisonType", "com.alachisoft.tayzgrid.caching.queries.IIndexStore", "com.alachisoft.tayzgrid.caching.queries.QueryContext", "com.alachisoft.tayzgrid.parser.AttributeIndexNotDefined", "com.alachisoft.tayzgrid.runtime.exceptions.CacheException", "com.alachisoft.tayzgrid.runtime.exceptions.GeneralFailureException", "com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException" ]
import com.alachisoft.tayzgrid.caching.queries.AttributeIndex; import com.alachisoft.tayzgrid.caching.queries.ComparisonType; import com.alachisoft.tayzgrid.caching.queries.IIndexStore; import com.alachisoft.tayzgrid.caching.queries.QueryContext; import com.alachisoft.tayzgrid.parser.AttributeIndexNotDefined; import com.alachisoft.tayzgrid.runtime.exceptions.CacheException; import com.alachisoft.tayzgrid.runtime.exceptions.GeneralFailureException; import com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException;
import com.alachisoft.tayzgrid.caching.queries.*; import com.alachisoft.tayzgrid.parser.*; import com.alachisoft.tayzgrid.runtime.exceptions.*;
[ "com.alachisoft.tayzgrid" ]
com.alachisoft.tayzgrid;
1,033,716
long timeNanos = System.nanoTime() - mStartTimeNanos; return Time.of(timeNanos, TimeUnit.NANOSECONDS); }
long timeNanos = System.nanoTime() - mStartTimeNanos; return Time.of(timeNanos, TimeUnit.NANOSECONDS); }
/** * {@inheritDoc} * <p> * The returned timestamp is a time difference between the current time and the time at which the * current instance was created. * </p> */
The returned timestamp is a time difference between the current time and the time at which the current instance was created.
currentTime
{ "repo_name": "Flash3388/FlashLib", "path": "flashlib.core/src/main/java/com/flash3388/flashlib/time/SystemNanoClock.java", "license": "bsd-3-clause", "size": 735 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,325,990
private void assertNoWebContents() { Assert.assertNull(getPanelWebContents()); }
void function() { Assert.assertNull(getPanelWebContents()); }
/** * Asserts that the Panel's WebContents is not created. */
Asserts that the Panel's WebContents is not created
assertNoWebContents
{ "repo_name": "chromium/chromium", "path": "chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java", "license": "bsd-3-clause", "size": 109454 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,314,884
@SuppressWarnings("deprecation") public void createWithPermissions(Path dir, FsPermission clusterPerms) throws IOException, BadClusterStateException { if (fileSystem.isFile(dir)) { // HADOOP-9361 shows some filesystems don't correctly fail here throw new BadClusterStateException( "Cannot create a directory over a file %s", dir); } log.debug("mkdir {} with perms {}", dir, clusterPerms); //no mask whatoever fileSystem.getConf().set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "000"); fileSystem.mkdirs(dir, clusterPerms); //and force set it anyway just to make sure fileSystem.setPermission(dir, clusterPerms); }
@SuppressWarnings(STR) void function(Path dir, FsPermission clusterPerms) throws IOException, BadClusterStateException { if (fileSystem.isFile(dir)) { throw new BadClusterStateException( STR, dir); } log.debug(STR, dir, clusterPerms); fileSystem.getConf().set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "000"); fileSystem.mkdirs(dir, clusterPerms); fileSystem.setPermission(dir, clusterPerms); }
/** * Create a directory with the given permissions. * * @param dir directory * @param clusterPerms cluster permissions * @throws IOException IO problem * @throws BadClusterStateException any cluster state problem */
Create a directory with the given permissions
createWithPermissions
{ "repo_name": "dennishuo/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/CoreFileSystem.java", "license": "apache-2.0", "size": 19228 }
[ "java.io.IOException", "org.apache.hadoop.fs.CommonConfigurationKeys", "org.apache.hadoop.fs.Path", "org.apache.hadoop.fs.permission.FsPermission", "org.apache.hadoop.yarn.service.exceptions.BadClusterStateException" ]
import java.io.IOException; import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.yarn.service.exceptions.BadClusterStateException;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.yarn.service.exceptions.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,452,882
public Timestamp getItemServiceDate() { return itemServiceDate; }
Timestamp function() { return itemServiceDate; }
/** * Gets the itemServiceDate attribute. * * @return Returns the itemServiceDate. */
Gets the itemServiceDate attribute
getItemServiceDate
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-core/src/main/java/org/kuali/kfs/fp/businessobject/InternalBillingItem.java", "license": "agpl-3.0", "size": 5793 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,402,405
private void CheckVersionCollection(String expectedVersionLabel, long beforeVersionTime, Collection<Version> versions) { for (Version version : versions) { // Get the frozen id from the version String frozenNodeId = null; // Switch VersionStore depending on configured impl if (versionService.getVersionStoreReference().getIdentifier().equals(Version2Model.STORE_ID)) { // V2 version store (eg. workspace://version2Store) frozenNodeId = ((NodeRef)version.getVersionProperty(Version2Model.PROP_FROZEN_NODE_REF)).getId(); } else if (versionService.getVersionStoreReference().getIdentifier().equals(VersionModel.STORE_ID)) { // Deprecated V1 version store (eg. workspace://lightWeightVersionStore) frozenNodeId = (String)version.getVersionProperty(VersionModel.PROP_FROZEN_NODE_ID); } assertNotNull("Unable to retrieve the frozen node id from the created version.", frozenNodeId); // Get the origional node ref (based on the forzen node) NodeRef originalNodeRef = this.versionableNodes.get(frozenNodeId); assertNotNull("The versionable node ref that relates to the frozen node id can not be found.", originalNodeRef); // Check the new version checkNewVersion(beforeVersionTime, expectedVersionLabel, version, originalNodeRef); } }
void function(String expectedVersionLabel, long beforeVersionTime, Collection<Version> versions) { for (Version version : versions) { String frozenNodeId = null; if (versionService.getVersionStoreReference().getIdentifier().equals(Version2Model.STORE_ID)) { frozenNodeId = ((NodeRef)version.getVersionProperty(Version2Model.PROP_FROZEN_NODE_REF)).getId(); } else if (versionService.getVersionStoreReference().getIdentifier().equals(VersionModel.STORE_ID)) { frozenNodeId = (String)version.getVersionProperty(VersionModel.PROP_FROZEN_NODE_ID); } assertNotNull(STR, frozenNodeId); NodeRef originalNodeRef = this.versionableNodes.get(frozenNodeId); assertNotNull(STR, originalNodeRef); checkNewVersion(beforeVersionTime, expectedVersionLabel, version, originalNodeRef); } }
/** * Helper method to check the validity of the list of newly created versions. * * @param beforeVersionTime the time before the versions where created * @param versions the collection of version objects */
Helper method to check the validity of the list of newly created versions
CheckVersionCollection
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/repository/source/test-java/org/alfresco/repo/version/VersionServiceImplTest.java", "license": "lgpl-3.0", "size": 117920 }
[ "java.util.Collection", "org.alfresco.service.cmr.repository.NodeRef", "org.alfresco.service.cmr.version.Version" ]
import java.util.Collection; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.version.Version;
import java.util.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.service.cmr.version.*;
[ "java.util", "org.alfresco.service" ]
java.util; org.alfresco.service;
1,425,232
public Map<Double, Double> getPercentiles() { return percentiles; }
Map<Double, Double> function() { return percentiles; }
/** * Gets the Map of percentile values for each given in query percentage of sample. * @return Map of percentile values for each given in query percentage of sample. */
Gets the Map of percentile values for each given in query percentage of sample
getPercentiles
{ "repo_name": "RBMHTechnology/vind", "path": "api/src/main/java/com/rbmhtechnology/vind/api/result/facet/StatsFacetResult.java", "license": "apache-2.0", "size": 5615 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
273,731
@Test public void verifyNexusReportsAsHealthyAndCorrect() { final NexusStatus nexusStatus = client().getStatus(); assertThat(nexusStatus, is(notNullValue())); assertThat(nexusStatus.isFirstStart(), is(true)); // should be true assertThat(nexusStatus.isInstanceUpgraded(), is(false)); // should be false // TODO: Need a generic way to detect the version of the bundle being runned. // This below would work with parametrized coordinates, but does not work with "normal" use // when DM is used as I have no version it seems, and it's known only in the moment of // resolving Nexus GA, but it's seems it's not stored/exposed anywhere. // final Artifact nexusBundleArtifact = new DefaultArtifact( nexusBundleCoordinates ); // assertThat( nexusStatus.getVersion(), is( nexus().getConfiguration(). nexusBundleArtifact.getBaseVersion() ) ); // version assertThat(nexusStatus.getEditionShort(), equalTo("OSS")); }
void function() { final NexusStatus nexusStatus = client().getStatus(); assertThat(nexusStatus, is(notNullValue())); assertThat(nexusStatus.isFirstStart(), is(true)); assertThat(nexusStatus.isInstanceUpgraded(), is(false)); assertThat(nexusStatus.getEditionShort(), equalTo("OSS")); }
/** * Test that only verifies that Nexus reports itself (the status resource actually, used by {@link NexusClient}) as * expected. */
Test that only verifies that Nexus reports itself (the status resource actually, used by <code>NexusClient</code>) as expected
verifyNexusReportsAsHealthyAndCorrect
{ "repo_name": "scmod/nexus-public", "path": "testsuite/modern-testsuite/src/test/java/org/sonatype/nexus/testsuite/SmokeIT.java", "license": "epl-1.0", "size": 2630 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.sonatype.nexus.client.core.NexusStatus" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.sonatype.nexus.client.core.NexusStatus;
import org.hamcrest.*; import org.sonatype.nexus.client.core.*;
[ "org.hamcrest", "org.sonatype.nexus" ]
org.hamcrest; org.sonatype.nexus;
831,005
public synchronized final Map<K, V> snapshot() { return new LinkedHashMap<K, V>(map); }
synchronized final Map<K, V> function() { return new LinkedHashMap<K, V>(map); }
/** * Returns a copy of the current contents of the cache, ordered from least * recently accessed to most recently accessed. */
Returns a copy of the current contents of the cache, ordered from least recently accessed to most recently accessed
snapshot
{ "repo_name": "jdkoren/squidb", "path": "squidb-ios/src/com/yahoo/android/sqlite/LruCache.java", "license": "apache-2.0", "size": 12620 }
[ "java.util.LinkedHashMap", "java.util.Map" ]
import java.util.LinkedHashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,770,269
public short getShort(String parameterName) throws SQLException { throw Util.notImplemented(); }
short function(String parameterName) throws SQLException { throw Util.notImplemented(); }
/** * JDBC 3.0 * * Retrieves the value of a JDBC SMALLINT parameter as a short in the Java * programming language. * * @param parameterName - the name of the parameter * @return the parameter value. If the value is SQL NULL, the result is 0. * @exception SQLException Feature not implemented for now. */
JDBC 3.0 Retrieves the value of a JDBC SMALLINT parameter as a short in the Java programming language
getShort
{ "repo_name": "splicemachine/spliceengine", "path": "db-engine/src/main/java/com/splicemachine/db/impl/jdbc/EmbedCallableStatement20.java", "license": "agpl-3.0", "size": 37363 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,798,986
public String shortDesc(){ String res = "" + myIndex; return res; } public LinkedList getBindings(){ return bindings; }
String function(){ String res = "" + myIndex; return res; } public LinkedList getBindings(){ return bindings; }
/** * Returns a shorter description that toSting(). * Actually, it returns the unique index in String form. */
Returns a shorter description that toSting(). Actually, it returns the unique index in String form
shortDesc
{ "repo_name": "liuhongchao/GATE_Developer_7.0", "path": "src/gate/fsm/Transition.java", "license": "lgpl-3.0", "size": 6464 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
19,284