method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
@Override
public CacheEntry Remove(Object key, String group, ItemRemoveReason ir, boolean notify, Object lockId, long version, LockAccessType accessType, OperationContext operationContext) throws OperationFailedException, LockingException, GeneralFailureException, CacheException {
if (ServerMonitor.getMonitorActivity()) {
ServerMonitor.LogClientActivity("PrtCache.Remove", "");
}
_statusLatch.WaitForAny(NodeStatus.Running);
boolean suspectedErrorOccured = false;
Address targetNode = null;
CacheEntry entry = null;
if (_internalCache == null) {
throw new UnsupportedOperationException();
}
Object actualKey = key;
DataSourceUpdateOptions updateOptions = DataSourceUpdateOptions.None;
CallbackEntry cbEntry = null;
String providerName = null;
if (key instanceof Object[]) {
Object[] package_Renamed = (Object[]) ((key instanceof Object[]) ? key : null);
actualKey = package_Renamed[0];
updateOptions = (DataSourceUpdateOptions) package_Renamed[1];
cbEntry = (CallbackEntry) ((package_Renamed[2] instanceof CallbackEntry) ? package_Renamed[2] : null);
if (package_Renamed.length > 3) {
providerName = (String) ((package_Renamed[3] instanceof String) ? package_Renamed[3] : null);
}
}
String taskId = null;
if (updateOptions == DataSourceUpdateOptions.WriteBehind) {
taskId = getCluster().getLocalAddress().toString() + ":" + (new Integer(NextSequence())).toString();
}
while (true) {
try {
targetNode = GetNextNode(actualKey, group);
if (targetNode != null) {
if (targetNode.compareTo(getLocalAddress()) == 0) {
entry = Local_Remove(actualKey, ir, getCluster().getLocalAddress(), cbEntry, taskId, providerName, notify, lockId, version, accessType, operationContext);
} else {
entry = Clustered_Remove(targetNode, actualKey, ir, cbEntry, taskId, providerName, notify, lockId, version, accessType, operationContext);
}
}
break;
} catch (SuspectedException se) {
suspectedErrorOccured = true;
//we redo the operation
if (getCacheLog().getIsInfoEnabled()) {
getCacheLog().Info("PartitionedServerCache.Remove", targetNode + " left while addition. Error: " + se.toString());
}
continue;
} catch (TimeoutException te) {
if (getCacheLog().getIsInfoEnabled()) {
getCacheLog().Info("PartitionedServerCache.Remove", targetNode + " operation timed out. Error: " + te.toString());
}
if (suspectedErrorOccured) {
suspectedErrorOccured = false;
continue;
} else {
throw new GeneralFailureException(te.getMessage(), te);
}
} catch (com.alachisoft.tayzgrid.caching.exceptions.StateTransferException se) {
_distributionMgr.Wait(actualKey, group);
}
}
if (notify && entry != null) {
Object value = entry.getValue();
if (value instanceof CallbackEntry) {
RaiseCustomRemoveCalbackNotifier(actualKey, entry, ir);
}
}
return entry;
} | CacheEntry function(Object key, String group, ItemRemoveReason ir, boolean notify, Object lockId, long version, LockAccessType accessType, OperationContext operationContext) throws OperationFailedException, LockingException, GeneralFailureException, CacheException { if (ServerMonitor.getMonitorActivity()) { ServerMonitor.LogClientActivity(STR, STR:STRPartitionedServerCache.RemoveSTR left while addition. Error: STRPartitionedServerCache.RemoveSTR operation timed out. Error: " + te.toString()); } if (suspectedErrorOccured) { suspectedErrorOccured = false; continue; } else { throw new GeneralFailureException(te.getMessage(), te); } } catch (com.alachisoft.tayzgrid.caching.exceptions.StateTransferException se) { _distributionMgr.Wait(actualKey, group); } } if (notify && entry != null) { Object value = entry.getValue(); if (value instanceof CallbackEntry) { RaiseCustomRemoveCalbackNotifier(actualKey, entry, ir); } } return entry; } | /**
* Removes the object and key pair from the cache. The key is specified as
* parameter.
*
* @param key key of the entry.
* @return cache entry.
*
* This method invokes <see cref="handleRemove"/> on every server node in
* the cluster. In a partition only one node can remove an item (due to
* partitioning of data). Therefore the <see cref="OnItemsRemoved"/> handler
* of the node actually removing the item is responsible for triggering a
* cluster-wide Item removed notification.
* <p>
* <b>Note:</b>
* Evictions and Expirations are also handled through the <see
* cref="OnItemsRemoved"/> handler. </p>
*
*/ | Removes the object and key pair from the cache. The key is specified as parameter | Remove | {
"repo_name": "Alachisoft/TayzGrid",
"path": "src/tgcache/src/com/alachisoft/tayzgrid/caching/topologies/clustered/PartitionedServerCache.java",
"license": "apache-2.0",
"size": 225795
} | [
"com.alachisoft.tayzgrid.caching.CacheEntry",
"com.alachisoft.tayzgrid.caching.CallbackEntry",
"com.alachisoft.tayzgrid.caching.ItemRemoveReason",
"com.alachisoft.tayzgrid.caching.LockAccessType",
"com.alachisoft.tayzgrid.caching.OperationContext",
"com.alachisoft.tayzgrid.caching.exceptions.StateTransferException",
"com.alachisoft.tayzgrid.common.monitoring.ServerMonitor",
"com.alachisoft.tayzgrid.runtime.exceptions.CacheException",
"com.alachisoft.tayzgrid.runtime.exceptions.GeneralFailureException",
"com.alachisoft.tayzgrid.runtime.exceptions.LockingException",
"com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException"
] | import com.alachisoft.tayzgrid.caching.CacheEntry; import com.alachisoft.tayzgrid.caching.CallbackEntry; import com.alachisoft.tayzgrid.caching.ItemRemoveReason; import com.alachisoft.tayzgrid.caching.LockAccessType; import com.alachisoft.tayzgrid.caching.OperationContext; import com.alachisoft.tayzgrid.caching.exceptions.StateTransferException; import com.alachisoft.tayzgrid.common.monitoring.ServerMonitor; import com.alachisoft.tayzgrid.runtime.exceptions.CacheException; import com.alachisoft.tayzgrid.runtime.exceptions.GeneralFailureException; import com.alachisoft.tayzgrid.runtime.exceptions.LockingException; import com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException; | import com.alachisoft.tayzgrid.caching.*; import com.alachisoft.tayzgrid.caching.exceptions.*; import com.alachisoft.tayzgrid.common.monitoring.*; import com.alachisoft.tayzgrid.runtime.exceptions.*; | [
"com.alachisoft.tayzgrid"
] | com.alachisoft.tayzgrid; | 1,650,983 |
private static String resolveCdaPropertyName(Property property) {
Property cdaProperty = transformToCDAProperty(property);
String propertyCdaName = null;
if (cdaProperty != null) {
propertyCdaName = getCDAName(cdaProperty);
} else {
propertyCdaName = getCDAElementName(property);
}
return propertyCdaName;
} | static String function(Property property) { Property cdaProperty = transformToCDAProperty(property); String propertyCdaName = null; if (cdaProperty != null) { propertyCdaName = getCDAName(cdaProperty); } else { propertyCdaName = getCDAElementName(property); } return propertyCdaName; } | /**
* Fully resolve the CDA Name of a property.
*
* Note that this may not necessarily be the UML name of the property
* as in redefined and subsets properties, so go looking for the correct name
*
* @param property
* the name to be resolved
* @return string property name as it would appear in CDA
*/ | Fully resolve the CDA Name of a property. Note that this may not necessarily be the UML name of the property as in redefined and subsets properties, so go looking for the correct name | resolveCdaPropertyName | {
"repo_name": "drbgfc/mdht",
"path": "cda/plugins/org.openhealthtools.mdht.uml.cda.core/src/org/openhealthtools/mdht/uml/cda/core/util/CDAModelUtil.java",
"license": "epl-1.0",
"size": 93292
} | [
"org.eclipse.uml2.uml.Property"
] | import org.eclipse.uml2.uml.Property; | import org.eclipse.uml2.uml.*; | [
"org.eclipse.uml2"
] | org.eclipse.uml2; | 2,213,629 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<GalleryApplicationVersionInner>> getWithResponseAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
String galleryApplicationVersionName,
ReplicationStatusTypes expand) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
if (galleryApplicationVersionName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter galleryApplicationVersionName is required and cannot be null."));
}
final String apiVersion = "2019-12-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
galleryApplicationVersionName,
expand,
apiVersion,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<GalleryApplicationVersionInner>> function( String resourceGroupName, String galleryName, String galleryApplicationName, String galleryApplicationVersionName, ReplicationStatusTypes expand) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (galleryName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (galleryApplicationName == null) { return Mono .error( new IllegalArgumentException(STR)); } if (galleryApplicationVersionName == null) { return Mono .error( new IllegalArgumentException( STR)); } final String apiVersion = STR; final String accept = STR; return FluxUtil .withContext( context -> service .get( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand, apiVersion, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Retrieves information about a gallery Application Version.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition resides.
* @param galleryApplicationName The name of the gallery Application Definition in which the Application Version
* resides.
* @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved.
* @param expand The expand expression to apply on the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Version that you want to create or update.
*/ | Retrieves information about a gallery Application Version | getWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/GalleryApplicationVersionsClientImpl.java",
"license": "mit",
"size": 101642
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.compute.fluent.models.GalleryApplicationVersionInner",
"com.azure.resourcemanager.compute.models.ReplicationStatusTypes"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.compute.fluent.models.GalleryApplicationVersionInner; import com.azure.resourcemanager.compute.models.ReplicationStatusTypes; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.compute.fluent.models.*; import com.azure.resourcemanager.compute.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 870,041 |
private void showReplyDialog() {
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment prev = getFragmentManager().findFragmentByTag("dialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
ReplyDialogFragment reply = ReplyDialogFragment.newInstance(messageDraft, messageSubject);
reply.setTargetFragment(this, 0);
reply.show(ft, "dialog");
} | void function() { FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag(STR); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); ReplyDialogFragment reply = ReplyDialogFragment.newInstance(messageDraft, messageSubject); reply.setTargetFragment(this, 0); reply.show(ft, STR); } | /**
* Display the compose reply dialog so the user can write their response
*/ | Display the compose reply dialog so the user can write their response | showReplyDialog | {
"repo_name": "stuxo/PTHAndroid",
"path": "PTHAndroid/src/main/java/me/passtheheadphones/profile/ProfileFragment.java",
"license": "bsd-2-clause",
"size": 26324
} | [
"android.support.v4.app.Fragment",
"android.support.v4.app.FragmentTransaction",
"me.passtheheadphones.forums.thread.ReplyDialogFragment"
] | import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import me.passtheheadphones.forums.thread.ReplyDialogFragment; | import android.support.v4.app.*; import me.passtheheadphones.forums.thread.*; | [
"android.support",
"me.passtheheadphones.forums"
] | android.support; me.passtheheadphones.forums; | 2,304,982 |
public SelectorBuilder greaterThanEquals(EntityField field, long propertyValue) {
return this.greaterThanEquals(field.name(), propertyValue);
} | SelectorBuilder function(EntityField field, long propertyValue) { return this.greaterThanEquals(field.name(), propertyValue); } | /**
* Adds the predicate <b>greater than equals</b> to the selector for the given field and value.
*
* @param propertyValue the property value as a String independently of the field type. The caller
* should take care of the formatting if it is necessary
*/ | Adds the predicate greater than equals to the selector for the given field and value | greaterThanEquals | {
"repo_name": "gawkermedia/googleads-java-lib",
"path": "modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/utils/v201509/SelectorBuilder.java",
"license": "apache-2.0",
"size": 24189
} | [
"com.google.api.ads.adwords.lib.selectorfields.EntityField"
] | import com.google.api.ads.adwords.lib.selectorfields.EntityField; | import com.google.api.ads.adwords.lib.selectorfields.*; | [
"com.google.api"
] | com.google.api; | 1,027,897 |
public void setIntersectionType(String val) {
if ( intersectionType == null ) {
intersectionType = (SFString)getField( "intersectionType" );
}
intersectionType.setValue( val );
} | void function(String val) { if ( intersectionType == null ) { intersectionType = (SFString)getField( STR ); } intersectionType.setValue( val ); } | /** Set the intersectionType field.
* @param val The String to set. */ | Set the intersectionType field | setIntersectionType | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/xj3d/sai/internal/node/pickingsensor/SAIPrimitivePicker.java",
"license": "gpl-2.0",
"size": 6633
} | [
"org.web3d.x3d.sai.SFString"
] | import org.web3d.x3d.sai.SFString; | import org.web3d.x3d.sai.*; | [
"org.web3d.x3d"
] | org.web3d.x3d; | 208,438 |
private synchronized InputMethodLocator getPreferredInputMethod(Locale locale) {
InputMethodLocator preferredLocator = null;
if (!hasMultipleInputMethods()) {
// No need to look for a preferred Java input method
return null;
}
// look for the cached preference first.
preferredLocator = preferredLocatorCache.get(locale.toString().intern());
if (preferredLocator != null) {
return preferredLocator;
}
// look for the preference in the user preference tree
String nodePath = findPreferredInputMethodNode(locale);
String descriptorName = readPreferredInputMethod(nodePath);
Locale advertised;
// get the locator object
if (descriptorName != null) {
// check for the host adapter first
if (hostAdapterLocator != null &&
hostAdapterLocator.getDescriptor().getClass().getName().equals(descriptorName)) {
advertised = getAdvertisedLocale(hostAdapterLocator, locale);
if (advertised != null) {
preferredLocator = hostAdapterLocator.deriveLocator(advertised);
preferredLocatorCache.put(locale.toString().intern(), preferredLocator);
}
return preferredLocator;
}
// look for Java input methods
for (int i = 0; i < javaInputMethodLocatorList.size(); i++) {
InputMethodLocator locator = javaInputMethodLocatorList.get(i);
InputMethodDescriptor descriptor = locator.getDescriptor();
if (descriptor.getClass().getName().equals(descriptorName)) {
advertised = getAdvertisedLocale(locator, locale);
if (advertised != null) {
preferredLocator = locator.deriveLocator(advertised);
preferredLocatorCache.put(locale.toString().intern(), preferredLocator);
}
return preferredLocator;
}
}
// maybe preferred input method information is bogus.
writePreferredInputMethod(nodePath, null);
}
return null;
} | synchronized InputMethodLocator function(Locale locale) { InputMethodLocator preferredLocator = null; if (!hasMultipleInputMethods()) { return null; } preferredLocator = preferredLocatorCache.get(locale.toString().intern()); if (preferredLocator != null) { return preferredLocator; } String nodePath = findPreferredInputMethodNode(locale); String descriptorName = readPreferredInputMethod(nodePath); Locale advertised; if (descriptorName != null) { if (hostAdapterLocator != null && hostAdapterLocator.getDescriptor().getClass().getName().equals(descriptorName)) { advertised = getAdvertisedLocale(hostAdapterLocator, locale); if (advertised != null) { preferredLocator = hostAdapterLocator.deriveLocator(advertised); preferredLocatorCache.put(locale.toString().intern(), preferredLocator); } return preferredLocator; } for (int i = 0; i < javaInputMethodLocatorList.size(); i++) { InputMethodLocator locator = javaInputMethodLocatorList.get(i); InputMethodDescriptor descriptor = locator.getDescriptor(); if (descriptor.getClass().getName().equals(descriptorName)) { advertised = getAdvertisedLocale(locator, locale); if (advertised != null) { preferredLocator = locator.deriveLocator(advertised); preferredLocatorCache.put(locale.toString().intern(), preferredLocator); } return preferredLocator; } } writePreferredInputMethod(nodePath, null); } return null; } | /**
* Returns a InputMethodLocator object that the
* user prefers for the given locale.
*
* @param locale Locale for which the user prefers the input method.
*/ | Returns a InputMethodLocator object that the user prefers for the given locale | getPreferredInputMethod | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/sun/awt/im/ExecutableInputMethodManager.java",
"license": "mit",
"size": 23185
} | [
"java.awt.im.spi.InputMethodDescriptor",
"java.util.Locale"
] | import java.awt.im.spi.InputMethodDescriptor; import java.util.Locale; | import java.awt.im.spi.*; import java.util.*; | [
"java.awt",
"java.util"
] | java.awt; java.util; | 2,096,488 |
public IParameters setData(Data data); | IParameters function(Data data); | /**
* Set data which is used to put in network.
*
* @param data used to put in network
* @return it-self (builder pattern)
*/ | Set data which is used to put in network | setData | {
"repo_name": "Hive2Hive/Hive2Hive",
"path": "org.hive2hive.core/src/main/java/org/hive2hive/core/network/data/parameters/IParameters.java",
"license": "mit",
"size": 3975
} | [
"net.tomp2p.storage.Data"
] | import net.tomp2p.storage.Data; | import net.tomp2p.storage.*; | [
"net.tomp2p.storage"
] | net.tomp2p.storage; | 614,950 |
public void onShutDownComplete(int statusCode) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(statusCode);
mRemote.transact(Stub.TRANSACTION_onShutDownComplete, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
}
static final int TRANSACTION_onShutDownComplete = (IBinder.FIRST_CALL_TRANSACTION + 0);
} | void function(int statusCode) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeInt(statusCode); mRemote.transact(Stub.TRANSACTION_onShutDownComplete, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } } static final int TRANSACTION_onShutDownComplete = (IBinder.FIRST_CALL_TRANSACTION + 0); } | /**
* This method is called when the shutdown of MountService
* completed.
*
* @param statusCode indicates success or failure of the shutdown.
*/ | This method is called when the shutdown of MountService completed | onShutDownComplete | {
"repo_name": "JuudeDemos/android-sdk-20",
"path": "src/android/os/storage/IMountShutdownObserver.java",
"license": "apache-2.0",
"size": 4325
} | [
"android.os.IBinder",
"android.os.Parcel",
"android.os.RemoteException"
] | import android.os.IBinder; import android.os.Parcel; import android.os.RemoteException; | import android.os.*; | [
"android.os"
] | android.os; | 1,145,250 |
String random = UUID.randomUUID().toString();
random = random.replace("/", "_");
random = random.replace("=", "a");
random = random.replace("+", "f");
return random;
} | String random = UUID.randomUUID().toString(); random = random.replace("/", "_"); random = random.replace("=", "a"); random = random.replace("+", "f"); return random; } | /**
* Generate UUID.
*
* @return UUID as a string.
*/ | Generate UUID | generateUUID | {
"repo_name": "wso2/carbon-identity-mgt",
"path": "components/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/impl/util/IdentityUserMgtUtil.java",
"license": "apache-2.0",
"size": 4590
} | [
"java.util.UUID"
] | import java.util.UUID; | import java.util.*; | [
"java.util"
] | java.util; | 2,405,456 |
public void setChmod(String chmod) throws Exception {
if (ObjectHelper.isNotEmpty(chmod) && chmodPermissionsAreValid(chmod)) {
this.chmod = chmod.trim();
} else {
throw new IllegalArgumentException("chmod option [" + chmod + "] is not valid");
}
} | void function(String chmod) throws Exception { if (ObjectHelper.isNotEmpty(chmod) && chmodPermissionsAreValid(chmod)) { this.chmod = chmod.trim(); } else { throw new IllegalArgumentException(STR + chmod + STR); } } | /**
* Specify the file permissions which is sent by the producer, the chmod value must be between 000 and 777;
* If there is a leading digit like in 0755 we will ignore it.
*/ | Specify the file permissions which is sent by the producer, the chmod value must be between 000 and 777; If there is a leading digit like in 0755 we will ignore it | setChmod | {
"repo_name": "rparree/camel",
"path": "camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java",
"license": "apache-2.0",
"size": 59098
} | [
"org.apache.camel.util.ObjectHelper"
] | import org.apache.camel.util.ObjectHelper; | import org.apache.camel.util.*; | [
"org.apache.camel"
] | org.apache.camel; | 763,379 |
public ByteBuffer decodeBufferToByteBuffer(String inputString)
throws IOException {
return ByteBuffer.wrap(decodeBuffer(inputString));
} | ByteBuffer function(String inputString) throws IOException { return ByteBuffer.wrap(decodeBuffer(inputString)); } | /**
* Decode the contents of the String into a ByteBuffer.
*/ | Decode the contents of the String into a ByteBuffer | decodeBufferToByteBuffer | {
"repo_name": "universsky/openjdk",
"path": "jdk/src/java.base/share/classes/sun/misc/CharacterDecoder.java",
"license": "gpl-2.0",
"size": 8297
} | [
"java.io.IOException",
"java.nio.ByteBuffer"
] | import java.io.IOException; import java.nio.ByteBuffer; | import java.io.*; import java.nio.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 754,240 |
boolean isObjectSubTypeCompatible(List<String> financialObjectSubTypeCode); | boolean isObjectSubTypeCompatible(List<String> financialObjectSubTypeCode); | /**
* This will check if the list of financial object sub type code are compatible with each other.
* <li> return TRUE if all Object sub type code are compatible with each other.
* <li> return FALSE if any non copatible object sub type code are found.
*
* @param financialObjectSubTypeCode
* @return
*/ | This will check if the list of financial object sub type code are compatible with each other. return TRUE if all Object sub type code are compatible with each other. return FALSE if any non copatible object sub type code are found | isObjectSubTypeCompatible | {
"repo_name": "bhutchinson/kfs",
"path": "kfs-cam/src/main/java/org/kuali/kfs/module/cam/document/service/AssetService.java",
"license": "agpl-3.0",
"size": 6651
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,242,243 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<QuotasGetResponse> getWithResponseAsync(String resourceName, String scope, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.get(this.client.getEndpoint(), resourceName, this.client.getApiVersion(), scope, accept, context);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<QuotasGetResponse> function(String resourceName, String scope, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (scope == null) { return Mono.error(new IllegalArgumentException(STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .get(this.client.getEndpoint(), resourceName, this.client.getApiVersion(), scope, accept, context); } | /**
* Get the quota limit of a resource. The response can be used to determine the remaining quota to calculate a new
* quota limit that can be submitted with a PUT request.
*
* @param resourceName Resource name for a given resource provider. For example: - SKU name for Microsoft.Compute -
* SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses.
* @param scope The target Azure resource URI. For example,
* `/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`.
* This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added after
* `/quotas`, then it's the target Azure resource URI in the GET operation for the specific resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the quota limit of a resource.
*/ | Get the quota limit of a resource. The response can be used to determine the remaining quota to calculate a new quota limit that can be submitted with a PUT request | getWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotasClientImpl.java",
"license": "mit",
"size": 74571
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.util.Context",
"com.azure.resourcemanager.quota.models.QuotasGetResponse"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.resourcemanager.quota.models.QuotasGetResponse; | import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.resourcemanager.quota.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 27,965 |
void showSettingsFragment(MenuTag menuTag, Bundle extras, boolean addToStack, String gameId); | void showSettingsFragment(MenuTag menuTag, Bundle extras, boolean addToStack, String gameId); | /**
* Show a new SettingsFragment.
*
* @param menuTag Identifier for the settings group that should be displayed.
* @param addToStack Whether or not this fragment should replace a previous one.
*/ | Show a new SettingsFragment | showSettingsFragment | {
"repo_name": "stenzek/dolphin",
"path": "Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityView.java",
"license": "gpl-2.0",
"size": 3982
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 1,481,504 |
public static void copy(AsciiString src, int srcIdx, ByteBuf dst, int length) {
if (isOutOfBounds(srcIdx, length, src.length())) {
throw new IndexOutOfBoundsException("expected: " + "0 <= srcIdx(" + srcIdx + ") <= srcIdx + length("
+ length + ") <= srcLen(" + src.length() + ')');
}
checkNotNull(dst, "dst").writeBytes(src.array(), srcIdx + src.arrayOffset(), length);
} | static void function(AsciiString src, int srcIdx, ByteBuf dst, int length) { if (isOutOfBounds(srcIdx, length, src.length())) { throw new IndexOutOfBoundsException(STR + STR + srcIdx + STR + length + STR + src.length() + ')'); } checkNotNull(dst, "dst").writeBytes(src.array(), srcIdx + src.arrayOffset(), length); } | /**
* Copies the content of {@code src} to a {@link ByteBuf} using {@link ByteBuf#writeBytes(byte[], int, int)}.
* @param src The source of the data to copy.
* @param srcIdx the starting offset of characters to copy.
* @param dst the destination byte array.
* @param length the number of characters to copy.
*/ | Copies the content of src to a <code>ByteBuf</code> using <code>ByteBuf#writeBytes(byte[], int, int)</code> | copy | {
"repo_name": "maliqq/netty",
"path": "buffer/src/main/java/io/netty/buffer/ByteBufUtil.java",
"license": "apache-2.0",
"size": 49167
} | [
"io.netty.util.AsciiString",
"io.netty.util.internal.ObjectUtil"
] | import io.netty.util.AsciiString; import io.netty.util.internal.ObjectUtil; | import io.netty.util.*; import io.netty.util.internal.*; | [
"io.netty.util"
] | io.netty.util; | 1,951,158 |
public boolean removeItem(GenericTypesystemContext context, long typeId, long id) {
return persistence.removeItem(context, typeId, id);
} | boolean function(GenericTypesystemContext context, long typeId, long id) { return persistence.removeItem(context, typeId, id); } | /**
* Deletes the item as defined by {@link PersistenceService#removeItem(GenericTypesystemContext, long, long)}.
*
* @param context
* current context
* @param typeId
* type id
* @param id
* item id
* @return true if successful, false otherwise
*/ | Deletes the item as defined by <code>PersistenceService#removeItem(GenericTypesystemContext, long, long)</code> | removeItem | {
"repo_name": "christiangroth/generic-typesystem",
"path": "src/main/java/de/chrgroth/generictypesystem/GenericTypesystemService.java",
"license": "apache-2.0",
"size": 19187
} | [
"de.chrgroth.generictypesystem.context.GenericTypesystemContext"
] | import de.chrgroth.generictypesystem.context.GenericTypesystemContext; | import de.chrgroth.generictypesystem.context.*; | [
"de.chrgroth.generictypesystem"
] | de.chrgroth.generictypesystem; | 762,154 |
public void flipPlayer(EntityPlayer playerIn)
{
playerIn.rotationYaw = -180.0F;
} | void function(EntityPlayer playerIn) { playerIn.rotationYaw = -180.0F; } | /**
* Flips the player around.
*/ | Flips the player around | flipPlayer | {
"repo_name": "aebert1/BigTransport",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/multiplayer/PlayerControllerMP.java",
"license": "gpl-3.0",
"size": 26369
} | [
"net.minecraft.entity.player.EntityPlayer"
] | import net.minecraft.entity.player.EntityPlayer; | import net.minecraft.entity.player.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 231,348 |
@Override
public boolean onChildClick(final ExpandableListView parent, final View v, final int groupPosition, final int childPosition, final long id){
return false;
} | boolean function(final ExpandableListView parent, final View v, final int groupPosition, final int childPosition, final long id){ return false; } | /**
* Override this for receiving callbacks when a child has been clicked.
* Callback method to be invoked when a child in this expandable list has been clicked.
*
* @param parent The ExpandableListView where the click happened
* @param v The view within the expandable list/ListView that was clicked
* @param groupPosition The group position that contains the child that was clicked
* @param childPosition The child position within the group
* @param id The row id of the child that was clicked
*/ | Override this for receiving callbacks when a child has been clicked. Callback method to be invoked when a child in this expandable list has been clicked | onChildClick | {
"repo_name": "wada811/AndroidLibrary-wada811",
"path": "AndroidLibrary@wada811/src/at/wada811/app/fragment/ExpandableListFragment.java",
"license": "apache-2.0",
"size": 17543
} | [
"android.view.View",
"android.widget.ExpandableListView"
] | import android.view.View; import android.widget.ExpandableListView; | import android.view.*; import android.widget.*; | [
"android.view",
"android.widget"
] | android.view; android.widget; | 2,724,975 |
@Nullable private static Map<Integer, Long> readSharedGroupCacheSizes(PageSupport pageMem, int grpId,
long cntrsPageId) throws IgniteCheckedException {
if (cntrsPageId == 0L)
return null;
Map<Integer, Long> cacheSizes = new HashMap<>();
long nextId = cntrsPageId;
while (true) {
final long curId = nextId;
final long curPage = pageMem.acquirePage(grpId, curId);
try {
final long curAddr = pageMem.readLock(grpId, curId, curPage);
assert curAddr != 0;
try {
PagePartitionCountersIO cntrsIO = PageIO.getPageIO(curAddr);
if (cntrsIO.readCacheSizes(curAddr, cacheSizes))
break;
nextId = cntrsIO.getNextCountersPageId(curAddr);
assert nextId != 0;
}
finally {
pageMem.readUnlock(grpId, curId, curPage);
}
}
finally {
pageMem.releasePage(grpId, curId, curPage);
}
}
return cacheSizes;
} | @Nullable static Map<Integer, Long> function(PageSupport pageMem, int grpId, long cntrsPageId) throws IgniteCheckedException { if (cntrsPageId == 0L) return null; Map<Integer, Long> cacheSizes = new HashMap<>(); long nextId = cntrsPageId; while (true) { final long curId = nextId; final long curPage = pageMem.acquirePage(grpId, curId); try { final long curAddr = pageMem.readLock(grpId, curId, curPage); assert curAddr != 0; try { PagePartitionCountersIO cntrsIO = PageIO.getPageIO(curAddr); if (cntrsIO.readCacheSizes(curAddr, cacheSizes)) break; nextId = cntrsIO.getNextCountersPageId(curAddr); assert nextId != 0; } finally { pageMem.readUnlock(grpId, curId, curPage); } } finally { pageMem.releasePage(grpId, curId, curPage); } } return cacheSizes; } | /**
* Loads cache sizes for all caches in shared group.
*
* @param pageMem page memory to perform operations on pages.
* @param grpId Cache group ID.
* @param cntrsPageId Counters page ID, if zero is provided that means no counters page exist.
* @return Cache sizes if store belongs to group containing multiple caches and sizes are available in memory. May
* return null if counter page does not exist.
* @throws IgniteCheckedException If page memory operation failed.
*/ | Loads cache sizes for all caches in shared group | readSharedGroupCacheSizes | {
"repo_name": "irudyak/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java",
"license": "apache-2.0",
"size": 66499
} | [
"java.util.HashMap",
"java.util.Map",
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.pagemem.PageSupport",
"org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO",
"org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionCountersIO",
"org.jetbrains.annotations.Nullable"
] | import java.util.HashMap; import java.util.Map; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.pagemem.PageSupport; import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; import org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionCountersIO; import org.jetbrains.annotations.Nullable; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.internal.pagemem.*; import org.apache.ignite.internal.processors.cache.persistence.tree.io.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.util; org.apache.ignite; org.jetbrains.annotations; | 1,302,208 |
public HashMap<String, String> getHisUpdates(BufferedReader buffer)
throws TextFileException, TextFileExtractionException {
logger.info("... Parsing text data HIS update section ...");
logger.debug("... Continue Text Data parsing for VistA updates... ");
HashMap<String, String> hisChanges=null;
hisChanges = this.parseHisUpdates(buffer);
try {
buffer.close();
}
catch(IOException io){
logger.error("Cannot close Text Stream Buffer.");
throw new TextFileExtractionException();
}
return (hisChanges);
} | HashMap<String, String> function(BufferedReader buffer) throws TextFileException, TextFileExtractionException { logger.info(STR); logger.debug(STR); HashMap<String, String> hisChanges=null; hisChanges = this.parseHisUpdates(buffer); try { buffer.close(); } catch(IOException io){ logger.error(STR); throw new TextFileExtractionException(); } return (hisChanges); } | /**
* Invoke method to extract HIS updates from an open Text data stream.
*
* @param buffer represents the stream of VistA Imaging TXT data.
* @return HashMap of DICOm tag-value pairs to be updated in DICOM DataSet.
* @throws TextFileExtractionException
*/ | Invoke method to extract HIS updates from an open Text data stream | getHisUpdates | {
"repo_name": "VHAINNOVATIONS/Telepathology",
"path": "Source/Java/ImagingDicomDCFUtilities/src/java/gov/va/med/imaging/dicom/dcftoolkit/utilities/reconstitution/LegacyTextFileParser.java",
"license": "apache-2.0",
"size": 50426
} | [
"gov.va.med.imaging.exceptions.TextFileException",
"gov.va.med.imaging.exceptions.TextFileExtractionException",
"java.io.BufferedReader",
"java.io.IOException",
"java.util.HashMap"
] | import gov.va.med.imaging.exceptions.TextFileException; import gov.va.med.imaging.exceptions.TextFileExtractionException; import java.io.BufferedReader; import java.io.IOException; import java.util.HashMap; | import gov.va.med.imaging.exceptions.*; import java.io.*; import java.util.*; | [
"gov.va.med",
"java.io",
"java.util"
] | gov.va.med; java.io; java.util; | 2,141,084 |
public Throwable getError(Serializer serializer) {
if (success) {
return null;
}
return (Throwable) deserializeResult(serializer);
} | Throwable function(Serializer serializer) { if (success) { return null; } return (Throwable) deserializeResult(serializer); } | /**
* Returns the error of the command processing. If {@link #isSuccess()} return <code>true</code>, this
* method returns <code>null</code>.
*
* @param serializer The serializer to deserialize the result with
* @return The exception thrown during command processing
*/ | Returns the error of the command processing. If <code>#isSuccess()</code> return <code>true</code>, this method returns <code>null</code> | getError | {
"repo_name": "oiavorskyi/AxonFramework",
"path": "distributed-commandbus/src/main/java/org/axonframework/commandhandling/distributed/jgroups/ReplyMessage.java",
"license": "apache-2.0",
"size": 6456
} | [
"org.axonframework.serializer.Serializer"
] | import org.axonframework.serializer.Serializer; | import org.axonframework.serializer.*; | [
"org.axonframework.serializer"
] | org.axonframework.serializer; | 1,324,565 |
private IDataQueryDefinition getQuery( String queryId )
{
return (IDataQueryDefinition) queryId2QueryMapping.get( queryId );
} | IDataQueryDefinition function( String queryId ) { return (IDataQueryDefinition) queryId2QueryMapping.get( queryId ); } | /**
* get the query defintion from the query id
*
* @param queryId
* @return
*/ | get the query defintion from the query id | getQuery | {
"repo_name": "sguan-actuate/birt",
"path": "engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/DataExtractionTaskV1.java",
"license": "epl-1.0",
"size": 42623
} | [
"org.eclipse.birt.data.engine.api.IDataQueryDefinition"
] | import org.eclipse.birt.data.engine.api.IDataQueryDefinition; | import org.eclipse.birt.data.engine.api.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 540,892 |
public void insertFromFile(final String sFile, final int iType) {
try {
CinderLog.logDebug("JFCP_IFF:" + sFile);
final XmlInputReader xir = new XmlInputReader();
switch (iType) {
case FILE_LOCAL:
xir.readFromLocalFile(sFile);
break;
case FILE_WORKSPACE:
xir.readFromWorkspaceFile(sFile);
break;
default:
xir.readFromUri(sFile);
break;
}
final Collection<IItem> coll = xir.getItems();
CinderLog.logDebug("JFCP_IFF:" + coll.size());
for (IItem item : coll) {
manager.add(item);
}
cView.getViewer().refresh();
} catch (Exception e) {
CinderLog.logError(e);
}
}
| void function(final String sFile, final int iType) { try { CinderLog.logDebug(STR + sFile); final XmlInputReader xir = new XmlInputReader(); switch (iType) { case FILE_LOCAL: xir.readFromLocalFile(sFile); break; case FILE_WORKSPACE: xir.readFromWorkspaceFile(sFile); break; default: xir.readFromUri(sFile); break; } final Collection<IItem> coll = xir.getItems(); CinderLog.logDebug(STR + coll.size()); for (IItem item : coll) { manager.add(item); } cView.getViewer().refresh(); } catch (Exception e) { CinderLog.logError(e); } } | /**
* Inserts findings from a file
*
* @param sFile
*/ | Inserts findings from a file | insertFromFile | {
"repo_name": "winks/cinder",
"path": "src/org/art_core/dev/cinder/controller/MainController.java",
"license": "bsd-3-clause",
"size": 13280
} | [
"java.util.Collection",
"org.art_core.dev.cinder.CinderLog",
"org.art_core.dev.cinder.input.XmlInputReader",
"org.art_core.dev.cinder.model.IItem"
] | import java.util.Collection; import org.art_core.dev.cinder.CinderLog; import org.art_core.dev.cinder.input.XmlInputReader; import org.art_core.dev.cinder.model.IItem; | import java.util.*; import org.art_core.dev.cinder.*; import org.art_core.dev.cinder.input.*; import org.art_core.dev.cinder.model.*; | [
"java.util",
"org.art_core.dev"
] | java.util; org.art_core.dev; | 1,956,823 |
@Test (timeout=30000)
public void testFailedSaveNamespaceWithRecovery() throws Exception {
doTestFailedSaveNamespace(true);
} | @Test (timeout=30000) void function() throws Exception { doTestFailedSaveNamespace(true); } | /**
* Test case where saveNamespace fails in all directories, but then
* the operator restores the directories and calls it again.
* This should leave the NN in a clean state for next start.
*/ | Test case where saveNamespace fails in all directories, but then the operator restores the directories and calls it again. This should leave the NN in a clean state for next start | testFailedSaveNamespaceWithRecovery | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestSaveNamespace.java",
"license": "apache-2.0",
"size": 28505
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,433,368 |
public boolean setOptions(String[] options) throws Exception {
ArgumentParser parser;
Namespace ns;
parser = ArgumentParsers.newArgumentParser(Weka.class.getName());
parser.addArgument("--java-home")
.type(Arguments.fileType().verifyExists().verifyIsDirectory())
.dest("javahome")
.required(true)
.help("The java home directory of the JDK that includes the jdeps binary, default is taken from JAVA_HOME environment variable.");
parser.addArgument("--ant-home")
.type(Arguments.fileType().verifyExists().verifyIsDirectory())
.dest("anthome")
.required(false)
.setDefault(new File("."))
.help("The ant home directory (above the 'bin' directory), if not on PATH.");
parser.addArgument("--classes")
.type(Arguments.fileType().verifyExists().verifyIsFile().verifyCanRead())
.dest("classes")
.required(true)
.help("The file containing the classes to determine the dependencies for. Empty lines and lines starting with # get ignored.");
parser.addArgument("--additional")
.type(Arguments.fileType())
.setDefault(new File("."))
.required(false)
.dest("additional")
.help("The file with additional class names to just include.");
parser.addArgument("--input")
.type(Arguments.fileType())
.setDefault(new File("."))
.required(true)
.dest("input")
.help("The directory with the pristing build environment in.");
parser.addArgument("--output")
.type(Arguments.fileType().verifyIsDirectory().verifyExists())
.setDefault(new File("."))
.required(true)
.dest("output")
.help("The directory for storing the minified build environment in.");
parser.addArgument("--test")
.action(Arguments.storeTrue())
.required(false)
.dest("test")
.help("Optional testing of the minified build environment.");
parser.addArgument("package")
.dest("packages")
.required(true)
.nargs("+")
.help("The packages to keep, eg 'weka'.");
try {
ns = parser.parseArgs(options);
}
catch (ArgumentParserException e) {
parser.handleError(e);
return false;
}
setJavaHome(ns.get("javahome"));
setAntHome(ns.get("anthome"));
setClassesFile(ns.get("classes"));
setAdditionalFile(ns.get("additional"));
setInput(ns.get("input"));
setPackages(ns.getList("packages"));
setOutput(ns.get("output"));
setTest( ns.getBoolean("test"));
return true;
} | boolean function(String[] options) throws Exception { ArgumentParser parser; Namespace ns; parser = ArgumentParsers.newArgumentParser(Weka.class.getName()); parser.addArgument(STR) .type(Arguments.fileType().verifyExists().verifyIsDirectory()) .dest(STR) .required(true) .help(STR); parser.addArgument(STR) .type(Arguments.fileType().verifyExists().verifyIsDirectory()) .dest(STR) .required(false) .setDefault(new File(".")) .help(STR); parser.addArgument(STR) .type(Arguments.fileType().verifyExists().verifyIsFile().verifyCanRead()) .dest(STR) .required(true) .help(STR); parser.addArgument(STR) .type(Arguments.fileType()) .setDefault(new File(".")) .required(false) .dest(STR) .help(STR); parser.addArgument(STR) .type(Arguments.fileType()) .setDefault(new File(".")) .required(true) .dest("input") .help(STR); parser.addArgument(STR) .type(Arguments.fileType().verifyIsDirectory().verifyExists()) .setDefault(new File(".")) .required(true) .dest(STR) .help(STR); parser.addArgument(STR) .action(Arguments.storeTrue()) .required(false) .dest("test") .help(STR); parser.addArgument(STR) .dest(STR) .required(true) .nargs("+") .help(STR); try { ns = parser.parseArgs(options); } catch (ArgumentParserException e) { parser.handleError(e); return false; } setJavaHome(ns.get(STR)); setAntHome(ns.get(STR)); setClassesFile(ns.get(STR)); setAdditionalFile(ns.get(STR)); setInput(ns.get("input")); setPackages(ns.getList(STR)); setOutput(ns.get(STR)); setTest( ns.getBoolean("test")); return true; } | /**
* Sets the commandline options.
*
* @param options the options to use
* @return true if successful
* @throws Exception in case of an invalid option
*/ | Sets the commandline options | setOptions | {
"repo_name": "fracpete/minify-weka",
"path": "src/main/java/com/github/fracpete/minify/Weka.java",
"license": "gpl-3.0",
"size": 19546
} | [
"java.io.File",
"net.sourceforge.argparse4j.ArgumentParsers",
"net.sourceforge.argparse4j.impl.Arguments",
"net.sourceforge.argparse4j.inf.ArgumentParser",
"net.sourceforge.argparse4j.inf.ArgumentParserException",
"net.sourceforge.argparse4j.inf.Namespace"
] | import java.io.File; import net.sourceforge.argparse4j.ArgumentParsers; import net.sourceforge.argparse4j.impl.Arguments; import net.sourceforge.argparse4j.inf.ArgumentParser; import net.sourceforge.argparse4j.inf.ArgumentParserException; import net.sourceforge.argparse4j.inf.Namespace; | import java.io.*; import net.sourceforge.argparse4j.*; import net.sourceforge.argparse4j.impl.*; import net.sourceforge.argparse4j.inf.*; | [
"java.io",
"net.sourceforge.argparse4j"
] | java.io; net.sourceforge.argparse4j; | 518,385 |
public UUIDFactory getUUIDFactory()
{
return uuidFactory;
} | UUIDFactory function() { return uuidFactory; } | /**
* Get the UUID Factory. (No need to make the UUIDFactory a module.)
*
* @return UUIDFactory The UUID Factory for this DataDictionary.
*/ | Get the UUID Factory. (No need to make the UUIDFactory a module.) | getUUIDFactory | {
"repo_name": "papicella/snappy-store",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/catalog/DataDictionaryImpl.java",
"license": "apache-2.0",
"size": 403048
} | [
"com.pivotal.gemfirexd.internal.iapi.services.uuid.UUIDFactory"
] | import com.pivotal.gemfirexd.internal.iapi.services.uuid.UUIDFactory; | import com.pivotal.gemfirexd.internal.iapi.services.uuid.*; | [
"com.pivotal.gemfirexd"
] | com.pivotal.gemfirexd; | 1,057,409 |
private void startLRUHeapPercentage(Attributes atts) {
final String lruAction = atts.getValue(ACTION);
EvictionAction action = EvictionAction.DEFAULT_EVICTION_ACTION;
if (lruAction != null) {
action = EvictionAction.parseAction(lruAction);
}
// Store for later addition of ObjectSizer, if any
stack.push(EvictionAttributes.createLRUHeapAttributes(null, action));
} | void function(Attributes atts) { final String lruAction = atts.getValue(ACTION); EvictionAction action = EvictionAction.DEFAULT_EVICTION_ACTION; if (lruAction != null) { action = EvictionAction.parseAction(lruAction); } stack.push(EvictionAttributes.createLRUHeapAttributes(null, action)); } | /**
* Create an <code>lru-heap-percentage</code> eviction controller, assigning it to the enclosed
* <code>region-attributes</code>
*
* @param atts
*/ | Create an <code>lru-heap-percentage</code> eviction controller, assigning it to the enclosed <code>region-attributes</code> | startLRUHeapPercentage | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParser.java",
"license": "apache-2.0",
"size": 130334
} | [
"org.apache.geode.cache.EvictionAction",
"org.apache.geode.cache.EvictionAttributes",
"org.xml.sax.Attributes"
] | import org.apache.geode.cache.EvictionAction; import org.apache.geode.cache.EvictionAttributes; import org.xml.sax.Attributes; | import org.apache.geode.cache.*; import org.xml.sax.*; | [
"org.apache.geode",
"org.xml.sax"
] | org.apache.geode; org.xml.sax; | 615,985 |
private void updateLookAndFeel(String lookAndFeelClassName)
{
setLookAndFeel(lookAndFeelClassName);
MultimediaContainerManager.updateLookAndFeel();
SwingUtilities.updateComponentTreeUI(this); pack();
for (Window window : windows)
{
SwingUtilities.updateComponentTreeUI(window); window.pack();
}
} | void function(String lookAndFeelClassName) { setLookAndFeel(lookAndFeelClassName); MultimediaContainerManager.updateLookAndFeel(); SwingUtilities.updateComponentTreeUI(this); pack(); for (Window window : windows) { SwingUtilities.updateComponentTreeUI(window); window.pack(); } } | /**
* Changes the look and feel to the new ClassName
* @since 22.06.2006
* @param lookAndFeelClassName
* @return
*/ | Changes the look and feel to the new ClassName | updateLookAndFeel | {
"repo_name": "jtrfp/javamod",
"path": "src/main/java/de/quippy/javamod/main/gui/MainForm.java",
"license": "gpl-2.0",
"size": 90291
} | [
"de.quippy.javamod.multimedia.MultimediaContainerManager",
"java.awt.Window",
"javax.swing.SwingUtilities"
] | import de.quippy.javamod.multimedia.MultimediaContainerManager; import java.awt.Window; import javax.swing.SwingUtilities; | import de.quippy.javamod.multimedia.*; import java.awt.*; import javax.swing.*; | [
"de.quippy.javamod",
"java.awt",
"javax.swing"
] | de.quippy.javamod; java.awt; javax.swing; | 2,659,749 |
public OneResponse info()
{
OneResponse response = info(client);
super.processInfo(response);
return response;
} | OneResponse function() { OneResponse response = info(client); super.processInfo(response); return response; } | /**
* Loads the xml representation of the host pool.
*
* @see HostPool#info(Client)
*/ | Loads the xml representation of the host pool | info | {
"repo_name": "fairchild/one-mirror",
"path": "src/oca/java/src/org/opennebula/client/host/HostPool.java",
"license": "apache-2.0",
"size": 2582
} | [
"org.opennebula.client.OneResponse"
] | import org.opennebula.client.OneResponse; | import org.opennebula.client.*; | [
"org.opennebula.client"
] | org.opennebula.client; | 2,350,046 |
public IPermissionTarget getTarget(String key) {
switch (key) {
case IPermission.ALL_CATEGORIES_TARGET:
return ALL_CATEGORIES_TARGET;
case IPermission.ALL_PORTLETS_TARGET:
return ALL_PORTLETS_TARGET;
case IPermission.ALL_GROUPS_TARGET:
return ALL_GROUPS_TARGET;
// Else just fall through...
}
for (TargetType targetType : allowedTargetTypes) {
JsonEntityBean entity = groupListHelper.getEntity(targetType.toString(), key, false);
if (entity != null) {
IPermissionTarget target = new PermissionTargetImpl(entity.getId(), entity.getName(), targetType);
return target;
}
}
return null;
} | IPermissionTarget function(String key) { switch (key) { case IPermission.ALL_CATEGORIES_TARGET: return ALL_CATEGORIES_TARGET; case IPermission.ALL_PORTLETS_TARGET: return ALL_PORTLETS_TARGET; case IPermission.ALL_GROUPS_TARGET: return ALL_GROUPS_TARGET; } for (TargetType targetType : allowedTargetTypes) { JsonEntityBean entity = groupListHelper.getEntity(targetType.toString(), key, false); if (entity != null) { IPermissionTarget target = new PermissionTargetImpl(entity.getId(), entity.getName(), targetType); return target; } } return null; } | /**
* The <code>key</code> parameter <em>should</em> specify a unique entity
* across all 4 supported types: people, groups, portlets, and categories.
*
* Concrete examples of working keys:
* <ul>
* <li>defaultTemplateUser (user)</li>
* <li>local.0 (group)</li>
* <li>PORTLET_ID.82 (portlet)</li>
* <li>local.1 (category)</li>
* </ul>
*/ | The <code>key</code> parameter should specify a unique entity across all 4 supported types: people, groups, portlets, and categories. Concrete examples of working keys: defaultTemplateUser (user) local.0 (group) PORTLET_ID.82 (portlet) local.1 (category) | getTarget | {
"repo_name": "ASU-Capstone/uPortal-Forked",
"path": "uportal-war/src/main/java/org/jasig/portal/permission/target/EntityTargetProviderImpl.java",
"license": "apache-2.0",
"size": 7465
} | [
"org.jasig.portal.layout.dlm.remoting.JsonEntityBean",
"org.jasig.portal.permission.target.IPermissionTarget",
"org.jasig.portal.security.IPermission"
] | import org.jasig.portal.layout.dlm.remoting.JsonEntityBean; import org.jasig.portal.permission.target.IPermissionTarget; import org.jasig.portal.security.IPermission; | import org.jasig.portal.layout.dlm.remoting.*; import org.jasig.portal.permission.target.*; import org.jasig.portal.security.*; | [
"org.jasig.portal"
] | org.jasig.portal; | 2,355,975 |
public void stateChanged(ChangeEvent e)
{
Object src = e.getSource();
if (src == fieldsZoomSlider) {
int v = fieldsZoomSlider.getValue();
double f = (double) v/FACTOR;
view.setMagnificationUnscaled(f);
} else if (src == zoomSlider) {
int v = zoomSlider.getValue();
double f = (double) v/FACTOR;
view.setMagnificationFactor(f);
firePropertyChange(
MagnificationComponent.MAGNIFICATION_UPDATE_PROPERTY,
null, f);
DataBrowserFactory.setThumbnailScaleFactor(f);
}
} | void function(ChangeEvent e) { Object src = e.getSource(); if (src == fieldsZoomSlider) { int v = fieldsZoomSlider.getValue(); double f = (double) v/FACTOR; view.setMagnificationUnscaled(f); } else if (src == zoomSlider) { int v = zoomSlider.getValue(); double f = (double) v/FACTOR; view.setMagnificationFactor(f); firePropertyChange( MagnificationComponent.MAGNIFICATION_UPDATE_PROPERTY, null, f); DataBrowserFactory.setThumbnailScaleFactor(f); } } | /**
* Zooms in or out the thumbnails.
* @see ChangeListener#stateChanged(ChangeEvent)
*/ | Zooms in or out the thumbnails | stateChanged | {
"repo_name": "dominikl/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserStatusBar.java",
"license": "gpl-2.0",
"size": 7186
} | [
"javax.swing.event.ChangeEvent",
"org.openmicroscopy.shoola.util.ui.MagnificationComponent"
] | import javax.swing.event.ChangeEvent; import org.openmicroscopy.shoola.util.ui.MagnificationComponent; | import javax.swing.event.*; import org.openmicroscopy.shoola.util.ui.*; | [
"javax.swing",
"org.openmicroscopy.shoola"
] | javax.swing; org.openmicroscopy.shoola; | 1,773,375 |
public static FastDateFormat getTimeInstance(int style,
Locale locale) {
return getTimeInstance(style, null, locale);
} | static FastDateFormat function(int style, Locale locale) { return getTimeInstance(style, null, locale); } | /**
* Gets the time instance.
*
* @param style the style
* @param locale the locale
* @return the time instance
*/ | Gets the time instance | getTimeInstance | {
"repo_name": "hopestar720/aioweb",
"path": "src/com/xhsoft/framework/common/date/FastDateFormat.java",
"license": "apache-2.0",
"size": 35462
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,030,752 |
public void testAddNonComparable() {
NavigableSet q = set0();
try {
q.add(new Object());
q.add(new Object());
shouldThrow();
} catch (ClassCastException success) {}
} | void function() { NavigableSet q = set0(); try { q.add(new Object()); q.add(new Object()); shouldThrow(); } catch (ClassCastException success) {} } | /**
* Add of non-Comparable throws CCE
*/ | Add of non-Comparable throws CCE | testAddNonComparable | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "test/java/util/concurrent/tck/ConcurrentSkipListSubSetTest.java",
"license": "gpl-2.0",
"size": 32034
} | [
"java.util.NavigableSet"
] | import java.util.NavigableSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,456,311 |
protected void createButtons() {
if(iconButtonUI == null) {
iconButtonUI = TinyWindowButtonUI.createButtonUIForType(TinyWindowButtonUI.MINIMIZE);
maxButtonUI = TinyWindowButtonUI.createButtonUIForType(TinyWindowButtonUI.MAXIMIZE);
closeButtonUI = TinyWindowButtonUI.createButtonUIForType(TinyWindowButtonUI.CLOSE);
}
iconButton = new SpecialUIButton(iconButtonUI);
iconButton.addActionListener(iconifyAction);
iconButton.setRolloverEnabled(true);
iconButton.addMouseListener(new RolloverListener(iconButton, iconifyAction));
maxButton = new SpecialUIButton(maxButtonUI);
maxButton.addActionListener(maximizeAction);
maxButton.setRolloverEnabled(true);
maxButton.addMouseListener(new RolloverListener(maxButton, maximizeAction));
closeButton = new SpecialUIButton(closeButtonUI);
closeButton.addActionListener(closeAction);
closeButton.setRolloverEnabled(true);
closeButton.addMouseListener(new RolloverListener(closeButton, closeAction));
iconButton.putClientProperty("externalFrameButton", Boolean.FALSE);
maxButton.putClientProperty("externalFrameButton", Boolean.FALSE);
closeButton.putClientProperty("externalFrameButton", Boolean.FALSE);
iconButton.getAccessibleContext().setAccessibleName(UIManager.getString("InternalFrameTitlePane.iconifyButtonAccessibleName"));
maxButton.getAccessibleContext().setAccessibleName(UIManager.getString("InternalFrameTitlePane.maximizeButtonAccessibleName"));
closeButton.getAccessibleContext().setAccessibleName(UIManager.getString("InternalFrameTitlePane.closeButtonAccessibleName"));
if(frame.isSelected()) {
activate();
} else {
deactivate();
}
} | void function() { if(iconButtonUI == null) { iconButtonUI = TinyWindowButtonUI.createButtonUIForType(TinyWindowButtonUI.MINIMIZE); maxButtonUI = TinyWindowButtonUI.createButtonUIForType(TinyWindowButtonUI.MAXIMIZE); closeButtonUI = TinyWindowButtonUI.createButtonUIForType(TinyWindowButtonUI.CLOSE); } iconButton = new SpecialUIButton(iconButtonUI); iconButton.addActionListener(iconifyAction); iconButton.setRolloverEnabled(true); iconButton.addMouseListener(new RolloverListener(iconButton, iconifyAction)); maxButton = new SpecialUIButton(maxButtonUI); maxButton.addActionListener(maximizeAction); maxButton.setRolloverEnabled(true); maxButton.addMouseListener(new RolloverListener(maxButton, maximizeAction)); closeButton = new SpecialUIButton(closeButtonUI); closeButton.addActionListener(closeAction); closeButton.setRolloverEnabled(true); closeButton.addMouseListener(new RolloverListener(closeButton, closeAction)); iconButton.putClientProperty(STR, Boolean.FALSE); maxButton.putClientProperty(STR, Boolean.FALSE); closeButton.putClientProperty(STR, Boolean.FALSE); iconButton.getAccessibleContext().setAccessibleName(UIManager.getString(STR)); maxButton.getAccessibleContext().setAccessibleName(UIManager.getString(STR)); closeButton.getAccessibleContext().setAccessibleName(UIManager.getString(STR)); if(frame.isSelected()) { activate(); } else { deactivate(); } } | /**
* Creates the buttons of the title pane and initilizes their actions.
*/ | Creates the buttons of the title pane and initilizes their actions | createButtons | {
"repo_name": "semantic-web-software/dynagent",
"path": "Tinylaf/src/de/muntjak/tinylookandfeel/TinyInternalFrameTitlePane.java",
"license": "agpl-3.0",
"size": 13851
} | [
"javax.swing.UIManager"
] | import javax.swing.UIManager; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,147,800 |
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4,
EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
int l = MathHelper
.floor_double((double) (par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int i1 = par1World.getBlockMetadata(par2, par3, par4) >> 2;
++l;
l %= 4;
if (l == 3) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | i1 << 2,
2);
}
if (l == 0) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | i1 << 2,
2);
}
if (l == 1) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, i1 << 2,
2);
}
if (l == 2) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | i1 << 2,
2);
}
} | void function(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { int l = MathHelper .floor_double((double) (par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int i1 = par1World.getBlockMetadata(par2, par3, par4) >> 2; ++l; l %= 4; if (l == 3) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 i1 << 2, 2); } if (l == 0) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 i1 << 2, 2); } if (l == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, i1 << 2, 2); } if (l == 2) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 i1 << 2, 2); } } | /**
* Called when the block is placed in the world.
*/ | Called when the block is placed in the world | onBlockPlacedBy | {
"repo_name": "AnDwHaT5/PixelUtilities",
"path": "src/main/java/com/pixelutilitys/blocks/RadioBlock.java",
"license": "gpl-3.0",
"size": 6205
} | [
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.item.ItemStack",
"net.minecraft.util.MathHelper",
"net.minecraft.world.World"
] | import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; | import net.minecraft.entity.*; import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraft.world.*; | [
"net.minecraft.entity",
"net.minecraft.item",
"net.minecraft.util",
"net.minecraft.world"
] | net.minecraft.entity; net.minecraft.item; net.minecraft.util; net.minecraft.world; | 1,924,297 |
public long readUBits( int numBits ) throws IOException
{
if (numBits == 0) {
return 0;
}
int bitsLeft = numBits;
long result = 0;
if (bitPos == 0) { //no value in the buffer - read a byte
if (in != null) {
bitBuf = in.read();
} else {
bitBuf = din.readByte();
}
bitPos = 8;
}
while( true )
{
int shift = bitsLeft - bitPos;
if( shift > 0 )
{
// Consume the entire buffer
result |= bitBuf << shift;
bitsLeft -= bitPos;
// Get the next byte from the input stream
if (in != null) {
bitBuf = in.read();
} else {
bitBuf = din.readByte();
}
bitPos = 8;
}
else
{
// Consume a portion of the buffer
result |= bitBuf >> -shift;
bitPos -= bitsLeft;
bitBuf &= 0xff >> (8 - bitPos); // mask off the consumed bits
return result;
}
}
} | long function( int numBits ) throws IOException { if (numBits == 0) { return 0; } int bitsLeft = numBits; long result = 0; if (bitPos == 0) { if (in != null) { bitBuf = in.read(); } else { bitBuf = din.readByte(); } bitPos = 8; } while( true ) { int shift = bitsLeft - bitPos; if( shift > 0 ) { result = bitBuf << shift; bitsLeft -= bitPos; if (in != null) { bitBuf = in.read(); } else { bitBuf = din.readByte(); } bitPos = 8; } else { result = bitBuf >> -shift; bitPos -= bitsLeft; bitBuf &= 0xff >> (8 - bitPos); return result; } } } | /**
* Read an unsigned value from the given number of bits
*/ | Read an unsigned value from the given number of bits | readUBits | {
"repo_name": "Fivium/FOXopen",
"path": "src/main/java/net/foxopen/fox/ImageInfo.java",
"license": "gpl-3.0",
"size": 30786
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,509,249 |
@SuppressLint("InlinedApi")
private Camera createCamera() {
int requestedCameraId = getIdForRequestedCamera(mFacing);
if (requestedCameraId == -1) {
throw new RuntimeException("Could not find requested camera.");
}
Camera camera = Camera.open(requestedCameraId);
SizePair sizePair = selectSizePair(camera, mRequestedPreviewWidth, mRequestedPreviewHeight);
if (sizePair == null) {
throw new RuntimeException("Could not find suitable preview size.");
}
Size pictureSize = sizePair.pictureSize();
mPreviewSize = sizePair.previewSize();
int[] previewFpsRange = selectPreviewFpsRange(camera, mRequestedFps);
if (previewFpsRange == null) {
throw new RuntimeException("Could not find suitable preview frames per second range.");
}
Camera.Parameters parameters = camera.getParameters();
if (pictureSize != null) {
parameters.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight());
}
parameters.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
parameters.setPreviewFpsRange(
previewFpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX],
previewFpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]);
parameters.setPreviewFormat(ImageFormat.NV21);
setRotation(camera, parameters, requestedCameraId);
if (mFocusMode != null) {
if (parameters.getSupportedFocusModes().contains(
mFocusMode)) {
parameters.setFocusMode(mFocusMode);
} else {
Log.i(TAG, "Camera focus mode: " + mFocusMode + " is not supported on this device.");
}
}
// setting mFocusMode to the one set in the params
mFocusMode = parameters.getFocusMode();
if (mFlashMode != null) {
if (parameters.getSupportedFlashModes().contains(
mFlashMode)) {
parameters.setFlashMode(mFlashMode);
} else {
Log.i(TAG, "Camera flash mode: " + mFlashMode + " is not supported on this device.");
}
}
// setting mFlashMode to the one set in the params
mFlashMode = parameters.getFlashMode();
camera.setParameters(parameters);
// Four frame buffers are needed for working with the camera:
//
// one for the frame that is currently being executed upon in doing detection
// one for the next pending frame to process immediately upon completing detection
// two for the frames that the camera uses to populate future preview images
camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback());
camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize));
camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize));
camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize));
camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize));
return camera;
} | @SuppressLint(STR) Camera function() { int requestedCameraId = getIdForRequestedCamera(mFacing); if (requestedCameraId == -1) { throw new RuntimeException(STR); } Camera camera = Camera.open(requestedCameraId); SizePair sizePair = selectSizePair(camera, mRequestedPreviewWidth, mRequestedPreviewHeight); if (sizePair == null) { throw new RuntimeException(STR); } Size pictureSize = sizePair.pictureSize(); mPreviewSize = sizePair.previewSize(); int[] previewFpsRange = selectPreviewFpsRange(camera, mRequestedFps); if (previewFpsRange == null) { throw new RuntimeException(STR); } Camera.Parameters parameters = camera.getParameters(); if (pictureSize != null) { parameters.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight()); } parameters.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight()); parameters.setPreviewFpsRange( previewFpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX], previewFpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]); parameters.setPreviewFormat(ImageFormat.NV21); setRotation(camera, parameters, requestedCameraId); if (mFocusMode != null) { if (parameters.getSupportedFocusModes().contains( mFocusMode)) { parameters.setFocusMode(mFocusMode); } else { Log.i(TAG, STR + mFocusMode + STR); } } mFocusMode = parameters.getFocusMode(); if (mFlashMode != null) { if (parameters.getSupportedFlashModes().contains( mFlashMode)) { parameters.setFlashMode(mFlashMode); } else { Log.i(TAG, STR + mFlashMode + STR); } } mFlashMode = parameters.getFlashMode(); camera.setParameters(parameters); camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback()); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize)); return camera; } | /**
* Opens the camera and applies the user settings.
*
* @throws RuntimeException if the method fails
*/ | Opens the camera and applies the user settings | createCamera | {
"repo_name": "EdwardvanRaak/MaterialBarcodeScanner",
"path": "materialbarcodescanner/src/main/java/com/edwardvanraak/materialbarcodescanner/CameraSource.java",
"license": "apache-2.0",
"size": 48147
} | [
"android.annotation.SuppressLint",
"android.graphics.ImageFormat",
"android.hardware.Camera",
"android.util.Log",
"com.google.android.gms.common.images.Size"
] | import android.annotation.SuppressLint; import android.graphics.ImageFormat; import android.hardware.Camera; import android.util.Log; import com.google.android.gms.common.images.Size; | import android.annotation.*; import android.graphics.*; import android.hardware.*; import android.util.*; import com.google.android.gms.common.images.*; | [
"android.annotation",
"android.graphics",
"android.hardware",
"android.util",
"com.google.android"
] | android.annotation; android.graphics; android.hardware; android.util; com.google.android; | 1,547,723 |
return JpaProviderFactory.getInstance().getImplementation().getUserTransactionJSE();
} | return JpaProviderFactory.getInstance().getImplementation().getUserTransactionJSE(); } | /**
* Return the user transaction in a JSE environment.
* @return the user transaction.
*/ | Return the user transaction in a JSE environment | getUserTransaction | {
"repo_name": "qjafcunuas/jbromo",
"path": "jbromo-dao/jbromo-dao-jpa/jbromo-dao-jpa-lib/src/test/java/org/jbromo/dao/test/cdi/CdiUserTransactionProducer.java",
"license": "apache-2.0",
"size": 1764
} | [
"org.jbromo.dao.jpa.container.common.JpaProviderFactory"
] | import org.jbromo.dao.jpa.container.common.JpaProviderFactory; | import org.jbromo.dao.jpa.container.common.*; | [
"org.jbromo.dao"
] | org.jbromo.dao; | 16,855 |
public static void main(String[] args) {
PropertyConfigurator.configure("log4j.properties");
LearningAnalysisOptions options = new LearningAnalysisOptions();
CmdLineParser parser = new CmdLineParser(options);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
StatementAnalysisMain.printUsage(e.getMessage(), parser);
return;
}
if(options.getHelp()) {
StatementAnalysisMain.printHelp(parser);
return;
}
LearningDataSet dataSet = LearningDataSet.createLearningDataSet(options.getDataSetPath());
DomainAnalysis learning = StatementDomainAnalysis.createLearningAnalysis();
DomainAnalysis complexity = ChangeComplexityDomainAnalysis.createComplexityAnalysis();
List<DomainAnalysis> domains = new LinkedList<DomainAnalysis>();
domains.add(learning);
domains.add(complexity);
CommitAnalysis commitAnalysis = new CommitAnalysis(dataSet, domains);
GitProjectAnalysis gitProjectAnalysis;
if(options.getURI() != null) {
try {
gitProjectAnalysis = GitProjectAnalysis.fromURI(options.getURI(),
CHECKOUT_DIR, options.getRegex(), commitAnalysis);
gitProjectAnalysis.analyze();
} catch (Exception e) {
e.printStackTrace(System.err);
return;
}
}
else if(options.getRepoFile() != null) {
List<String> uris = new LinkedList<String>();
try(BufferedReader br = new BufferedReader(new FileReader(options.getRepoFile()))) {
for(String line; (line = br.readLine()) != null; ) {
uris.add(line);
}
}
catch(Exception e) {
System.err.println("Error while reading URI file: " + e.getMessage());
return;
}
ExecutorService executor = Executors.newFixedThreadPool(options.getNThreads());
CountDownLatch latch = new CountDownLatch(uris.size());
for(String uri : uris) {
try {
gitProjectAnalysis = GitProjectAnalysis.fromURI(uri,
StatementAnalysisMain.CHECKOUT_DIR, options.getRegex(), commitAnalysis);
executor.submit(new GitProjectAnalysisTask(gitProjectAnalysis, latch));
} catch (Exception e) {
e.printStackTrace(System.err);
logger.error("[IMPORTANT] Project " + uri + " threw an exception");
logger.error(e);
continue;
}
}
try {
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
return;
}
}
else {
System.out.println("No repository given.");
StatementAnalysisMain.printUsage("No repository given.", parser);
return;
}
} | static void function(String[] args) { PropertyConfigurator.configure(STR); LearningAnalysisOptions options = new LearningAnalysisOptions(); CmdLineParser parser = new CmdLineParser(options); try { parser.parseArgument(args); } catch (CmdLineException e) { StatementAnalysisMain.printUsage(e.getMessage(), parser); return; } if(options.getHelp()) { StatementAnalysisMain.printHelp(parser); return; } LearningDataSet dataSet = LearningDataSet.createLearningDataSet(options.getDataSetPath()); DomainAnalysis learning = StatementDomainAnalysis.createLearningAnalysis(); DomainAnalysis complexity = ChangeComplexityDomainAnalysis.createComplexityAnalysis(); List<DomainAnalysis> domains = new LinkedList<DomainAnalysis>(); domains.add(learning); domains.add(complexity); CommitAnalysis commitAnalysis = new CommitAnalysis(dataSet, domains); GitProjectAnalysis gitProjectAnalysis; if(options.getURI() != null) { try { gitProjectAnalysis = GitProjectAnalysis.fromURI(options.getURI(), CHECKOUT_DIR, options.getRegex(), commitAnalysis); gitProjectAnalysis.analyze(); } catch (Exception e) { e.printStackTrace(System.err); return; } } else if(options.getRepoFile() != null) { List<String> uris = new LinkedList<String>(); try(BufferedReader br = new BufferedReader(new FileReader(options.getRepoFile()))) { for(String line; (line = br.readLine()) != null; ) { uris.add(line); } } catch(Exception e) { System.err.println(STR + e.getMessage()); return; } ExecutorService executor = Executors.newFixedThreadPool(options.getNThreads()); CountDownLatch latch = new CountDownLatch(uris.size()); for(String uri : uris) { try { gitProjectAnalysis = GitProjectAnalysis.fromURI(uri, StatementAnalysisMain.CHECKOUT_DIR, options.getRegex(), commitAnalysis); executor.submit(new GitProjectAnalysisTask(gitProjectAnalysis, latch)); } catch (Exception e) { e.printStackTrace(System.err); logger.error(STR + uri + STR); logger.error(e); continue; } } try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); return; } } else { System.out.println(STR); StatementAnalysisMain.printUsage(STR, parser); return; } } | /**
* Creates the learning data set for extracting repair patterns.
* @param args
* @throws Exception
*/ | Creates the learning data set for extracting repair patterns | main | {
"repo_name": "MackMendes/ExperimentsPapers",
"path": "DescobrindoPadroesdeBugJS/BugAID/src/ca/ubc/ece/salt/pangor/js/learn/StatementAnalysisMain.java",
"license": "mit",
"size": 5543
} | [
"ca.ubc.ece.salt.pangor.original.analysis.CommitAnalysis",
"ca.ubc.ece.salt.pangor.original.analysis.DomainAnalysis",
"ca.ubc.ece.salt.pangor.original.batch.GitProjectAnalysis",
"ca.ubc.ece.salt.pangor.original.batch.GitProjectAnalysisTask",
"ca.ubc.ece.salt.pangor.original.js.learn.analysis.ChangeComplexityDomainAnalysis",
"ca.ubc.ece.salt.pangor.original.js.learn.statements.StatementDomainAnalysis",
"ca.ubc.ece.salt.pangor.original.learn.analysis.LearningDataSet",
"java.io.BufferedReader",
"java.io.FileReader",
"java.util.LinkedList",
"java.util.List",
"java.util.concurrent.CountDownLatch",
"java.util.concurrent.ExecutorService",
"java.util.concurrent.Executors",
"org.apache.log4j.PropertyConfigurator",
"org.kohsuke.args4j.CmdLineException",
"org.kohsuke.args4j.CmdLineParser"
] | import ca.ubc.ece.salt.pangor.original.analysis.CommitAnalysis; import ca.ubc.ece.salt.pangor.original.analysis.DomainAnalysis; import ca.ubc.ece.salt.pangor.original.batch.GitProjectAnalysis; import ca.ubc.ece.salt.pangor.original.batch.GitProjectAnalysisTask; import ca.ubc.ece.salt.pangor.original.js.learn.analysis.ChangeComplexityDomainAnalysis; import ca.ubc.ece.salt.pangor.original.js.learn.statements.StatementDomainAnalysis; import ca.ubc.ece.salt.pangor.original.learn.analysis.LearningDataSet; import java.io.BufferedReader; import java.io.FileReader; import java.util.LinkedList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.apache.log4j.PropertyConfigurator; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; | import ca.ubc.ece.salt.pangor.original.analysis.*; import ca.ubc.ece.salt.pangor.original.batch.*; import ca.ubc.ece.salt.pangor.original.js.learn.analysis.*; import ca.ubc.ece.salt.pangor.original.js.learn.statements.*; import ca.ubc.ece.salt.pangor.original.learn.analysis.*; import java.io.*; import java.util.*; import java.util.concurrent.*; import org.apache.log4j.*; import org.kohsuke.args4j.*; | [
"ca.ubc.ece",
"java.io",
"java.util",
"org.apache.log4j",
"org.kohsuke.args4j"
] | ca.ubc.ece; java.io; java.util; org.apache.log4j; org.kohsuke.args4j; | 939,773 |
public static void closeSafely(@Nullable CloseableReference<?> ref) {
if (ref != null) {
ref.close();
}
}
| static void function(@Nullable CloseableReference<?> ref) { if (ref != null) { ref.close(); } } | /**
* Closes the reference handling null.
*
* @param ref the reference to close
*/ | Closes the reference handling null | closeSafely | {
"repo_name": "onesubone/dolphin",
"path": "lib-java/src/main/java/org/dolphin/lib/references/CloseableReference.java",
"license": "apache-2.0",
"size": 5507
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 1,113,891 |
String findUserByEmail(String email) throws NoSuchElementException; | String findUserByEmail(String email) throws NoSuchElementException; | /**
* Find a user's id given their email address. Note that this query is case
* sensitive!
*
* @param email user's email address
*
* @return the user's id if found
* @throws NoSuchElementException if we can't find a user with that exact
* email address
*/ | Find a user's id given their email address. Note that this query is case sensitive | findUserByEmail | {
"repo_name": "rkipper/AppInventor_RK",
"path": "appinventor/appengine/src/com/google/appinventor/server/storage/StorageIo.java",
"license": "mit",
"size": 12012
} | [
"java.util.NoSuchElementException"
] | import java.util.NoSuchElementException; | import java.util.*; | [
"java.util"
] | java.util; | 1,571,076 |
public void empty() {
this.store = new HashMap();
} | void function() { this.store = new HashMap(); } | /**
* Empty the store
*/ | Empty the store | empty | {
"repo_name": "pengqiuyuan/jcaptcha",
"path": "src/main/java/com/octo/captcha/service/captchastore/MapCaptchaStore.java",
"license": "lgpl-2.1",
"size": 4419
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,110,762 |
void close(CloseIndexRequest request, ActionListener<CloseIndexResponse> listener); | void close(CloseIndexRequest request, ActionListener<CloseIndexResponse> listener); | /**
* Closes an index based on the index name.
*
* @param request The close index request
* @param listener A listener to be notified with a result
* @see org.elasticsearch.client.Requests#closeIndexRequest(String)
*/ | Closes an index based on the index name | close | {
"repo_name": "qwerty4030/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java",
"license": "apache-2.0",
"size": 31749
} | [
"org.elasticsearch.action.ActionListener",
"org.elasticsearch.action.admin.indices.close.CloseIndexRequest",
"org.elasticsearch.action.admin.indices.close.CloseIndexResponse"
] | import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; | import org.elasticsearch.action.*; import org.elasticsearch.action.admin.indices.close.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 2,787,187 |
protected Resource getResourceByPath(String path) {
return new ServletContextResource(this.servletContext, path);
}
| Resource function(String path) { return new ServletContextResource(this.servletContext, path); } | /**
* This implementation supports file paths beneath the root of the ServletContext.
* @see ServletContextResource
*/ | This implementation supports file paths beneath the root of the ServletContext | getResourceByPath | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/web/context/support/StaticWebApplicationContext.java",
"license": "unlicense",
"size": 6098
} | [
"org.springframework.core.io.Resource"
] | import org.springframework.core.io.Resource; | import org.springframework.core.io.*; | [
"org.springframework.core"
] | org.springframework.core; | 1,578,671 |
private void saveFile(File folder, String file, String link) {
if (!folder.exists()) {
folder.mkdir();
}
BufferedInputStream in = null;
FileOutputStream fout = null;
try {
// Download the file
final URL url = new URL(link);
final int fileLength = url.openConnection().getContentLength();
in = new BufferedInputStream(url.openStream());
fout = new FileOutputStream(folder.getAbsolutePath() + File.separator + file);
final byte[] data = new byte[Updater.BYTE_SIZE];
int count;
if (this.announce) {
this.plugin.getLogger().info("About to download a new update: " + this.versionName);
}
long downloaded = 0;
while ((count = in.read(data, 0, Updater.BYTE_SIZE)) != -1) {
downloaded += count;
fout.write(data, 0, count);
final int percent = (int) ((downloaded * 100) / fileLength);
if (this.announce && ((percent % 10) == 0)) {
this.plugin.getLogger().info("Downloading update: " + percent + "% of " + fileLength + " bytes.");
}
}
//Just a quick check to make sure we didn't leave any files from last time...
for (final File xFile : new File(this.plugin.getDataFolder().getParent(), this.updateFolder).listFiles()) {
if (xFile.getName().endsWith(".zip")) {
xFile.delete();
}
}
// Check to see if it's a zip file, if it is, unzip it.
final File dFile = new File(folder.getAbsolutePath() + File.separator + file);
if (dFile.getName().endsWith(".zip")) {
// Unzip
this.unzip(dFile.getCanonicalPath());
}
if (this.announce) {
this.plugin.getLogger().info("Finished updating.");
}
} catch (final Exception ex) {
this.plugin.getLogger().warning("The auto-updater tried to download a new update, but was unsuccessful.");
this.result = Updater.UpdateResult.FAIL_DOWNLOAD;
} finally {
try {
if (in != null) {
in.close();
}
if (fout != null) {
fout.close();
}
} catch (final Exception ex) {
}
}
} | void function(File folder, String file, String link) { if (!folder.exists()) { folder.mkdir(); } BufferedInputStream in = null; FileOutputStream fout = null; try { final URL url = new URL(link); final int fileLength = url.openConnection().getContentLength(); in = new BufferedInputStream(url.openStream()); fout = new FileOutputStream(folder.getAbsolutePath() + File.separator + file); final byte[] data = new byte[Updater.BYTE_SIZE]; int count; if (this.announce) { this.plugin.getLogger().info(STR + this.versionName); } long downloaded = 0; while ((count = in.read(data, 0, Updater.BYTE_SIZE)) != -1) { downloaded += count; fout.write(data, 0, count); final int percent = (int) ((downloaded * 100) / fileLength); if (this.announce && ((percent % 10) == 0)) { this.plugin.getLogger().info(STR + percent + STR + fileLength + STR); } } for (final File xFile : new File(this.plugin.getDataFolder().getParent(), this.updateFolder).listFiles()) { if (xFile.getName().endsWith(".zip")) { xFile.delete(); } } final File dFile = new File(folder.getAbsolutePath() + File.separator + file); if (dFile.getName().endsWith(".zip")) { this.unzip(dFile.getCanonicalPath()); } if (this.announce) { this.plugin.getLogger().info(STR); } } catch (final Exception ex) { this.plugin.getLogger().warning(STR); this.result = Updater.UpdateResult.FAIL_DOWNLOAD; } finally { try { if (in != null) { in.close(); } if (fout != null) { fout.close(); } } catch (final Exception ex) { } } } | /**
* Save an update from dev.bukkit.org into the server's update folder.
*
* @param folder the updates folder location.
* @param file the name of the file to save it as.
* @param link the url of the file.
*/ | Save an update from dev.bukkit.org into the server's update folder | saveFile | {
"repo_name": "Tommsy64/Bash-Multi-Command",
"path": "src/main/java/net/gravitydevelopment/updater/Updater.java",
"license": "mit",
"size": 25720
} | [
"java.io.BufferedInputStream",
"java.io.File",
"java.io.FileOutputStream"
] | import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,299,359 |
private void init() {
if (cursor instanceof SecondaryCursor) {
secCursor = (SecondaryCursor) cursor;
} else {
secCursor = null;
}
if (range.hasBound()) {
privKey = new DatabaseEntry();
privPKey = new DatabaseEntry();
privData = new DatabaseEntry();
} else {
privKey = null;
privPKey = null;
privData = null;
}
} | void function() { if (cursor instanceof SecondaryCursor) { secCursor = (SecondaryCursor) cursor; } else { secCursor = null; } if (range.hasBound()) { privKey = new DatabaseEntry(); privPKey = new DatabaseEntry(); privData = new DatabaseEntry(); } else { privKey = null; privPKey = null; privData = null; } } | /**
* Used for opening and duping (cloning).
*/ | Used for opening and duping (cloning) | init | {
"repo_name": "prat0318/dbms",
"path": "mini_dbms/je-5.0.103/src/com/sleepycat/util/keyrange/RangeCursor.java",
"license": "mit",
"size": 37406
} | [
"com.sleepycat.je.DatabaseEntry",
"com.sleepycat.je.SecondaryCursor"
] | import com.sleepycat.je.DatabaseEntry; import com.sleepycat.je.SecondaryCursor; | import com.sleepycat.je.*; | [
"com.sleepycat.je"
] | com.sleepycat.je; | 2,073,129 |
Calendar testDateCal = Calendar.getInstance(getTimeZone());
testDateCal.setTime(date);
testDateCal.set(Calendar.MILLISECOND, 0);
Date originalDate = testDateCal.getTime();
testDateCal.add(Calendar.SECOND, -1);
Date timeAfter = getTimeAfter(testDateCal.getTime());
return ((timeAfter != null) && (timeAfter.equals(originalDate)));
} | Calendar testDateCal = Calendar.getInstance(getTimeZone()); testDateCal.setTime(date); testDateCal.set(Calendar.MILLISECOND, 0); Date originalDate = testDateCal.getTime(); testDateCal.add(Calendar.SECOND, -1); Date timeAfter = getTimeAfter(testDateCal.getTime()); return ((timeAfter != null) && (timeAfter.equals(originalDate))); } | /**
* Indicates whether the given date satisfies the cron expression. Note that
* milliseconds are ignored, so two Dates falling on different milliseconds
* of the same second will always have the same result here.
*
* @param date the date to evaluate
* @return a boolean indicating whether the given date satisfies the cron
* expression
*/ | Indicates whether the given date satisfies the cron expression. Note that milliseconds are ignored, so two Dates falling on different milliseconds of the same second will always have the same result here | isSatisfiedBy | {
"repo_name": "zuoyebushiwo/elasticsearch-1.5.0",
"path": "src/main/java/org/xbib/elasticsearch/plugin/jdbc/cron/CronExpression.java",
"license": "apache-2.0",
"size": 46223
} | [
"java.util.Calendar",
"java.util.Date"
] | import java.util.Calendar; import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 50,017 |
public void setXMLReader(final XMLReader xmlReader) {
this.xmlReader = xmlReader;
}
private class InternalXMLSerializer extends SAXSerializer {
private VirtualTempPath tempFile = null;
private OutputStreamWriter writer = null;
public InternalXMLSerializer() {
super();
} | void function(final XMLReader xmlReader) { this.xmlReader = xmlReader; } private class InternalXMLSerializer extends SAXSerializer { private VirtualTempPath tempFile = null; private OutputStreamWriter writer = null; public InternalXMLSerializer() { super(); } | /**
* Sets the external XMLReader to use.
*
* @param xmlReader the XMLReader
*/ | Sets the external XMLReader to use | setXMLReader | {
"repo_name": "windauer/exist",
"path": "exist-core/src/main/java/org/exist/xmldb/RemoteXMLResource.java",
"license": "lgpl-2.1",
"size": 15187
} | [
"java.io.OutputStreamWriter",
"org.exist.util.io.VirtualTempPath",
"org.exist.util.serializer.SAXSerializer",
"org.xml.sax.XMLReader"
] | import java.io.OutputStreamWriter; import org.exist.util.io.VirtualTempPath; import org.exist.util.serializer.SAXSerializer; import org.xml.sax.XMLReader; | import java.io.*; import org.exist.util.io.*; import org.exist.util.serializer.*; import org.xml.sax.*; | [
"java.io",
"org.exist.util",
"org.xml.sax"
] | java.io; org.exist.util; org.xml.sax; | 133,326 |
public void fitHistograms() {
if (null == histograms)
return;
params_from_fit = new ArrayList<double[]>(histograms.size());
goodness_of_fit = new double[histograms.size()];
double[] dir;
double[] init_params = new double[4];
double[] params = new double[4];
double[] padded_dir;
double[] padded_bins;
double ymax, ymin;
int imax, shift_index, current_index;
// Prepare fitter and function
CurveFitter fitter = null;
// Loop over slices
for (int i = 0; i < histograms.size(); i++) {
dir = histograms.get(i);
// Infer initial values
ymax = Double.NEGATIVE_INFINITY;
ymin = Double.POSITIVE_INFINITY;
imax = 0;
for (int j = 0; j < dir.length; j++) {
if (dir[j] > ymax) {
ymax = dir[j];
imax = j;
}
if (dir[j]<ymin) {
ymin = dir[j];
}
}
// Shift found peak to the center (periodic issue) and add to fitter
padded_dir = new double[bins.length];
padded_bins = new double[bins.length];
shift_index = bins.length/2 - imax;
for (int j = 0; j < bins.length; j++) {
current_index = j - shift_index;
if (current_index < 0) {
current_index += bins.length;
}
if (current_index >= bins.length) {
current_index -= bins.length;
}
padded_dir[j] = dir[current_index];
padded_bins[j] = bins[j];
}
fitter = new CurveFitter(padded_bins, padded_dir);
init_params[0] = ymin; // base
init_params[1] = ymax; // peak value
init_params[2] = padded_bins[bins.length/2]; // peak center with padding
init_params[3] = 2 * ( bins[1] - bins[0]); // std
// Do fit
fitter.doFit(CurveFitter.GAUSSIAN);
params = fitter.getParams();
goodness_of_fit[i] = fitter.getFitGoodness();
if (shift_index < 0) { // back into orig coordinates
params[2] += (bins[-shift_index]-bins[0]);
} else {
params[2] -= (bins[shift_index]-bins[0]);
}
params[3] = Math.abs(params[3]); // std is positive
params_from_fit.add(params);
}
fit_string = fitter.getFormula();
}
| void function() { if (null == histograms) return; params_from_fit = new ArrayList<double[]>(histograms.size()); goodness_of_fit = new double[histograms.size()]; double[] dir; double[] init_params = new double[4]; double[] params = new double[4]; double[] padded_dir; double[] padded_bins; double ymax, ymin; int imax, shift_index, current_index; CurveFitter fitter = null; for (int i = 0; i < histograms.size(); i++) { dir = histograms.get(i); ymax = Double.NEGATIVE_INFINITY; ymin = Double.POSITIVE_INFINITY; imax = 0; for (int j = 0; j < dir.length; j++) { if (dir[j] > ymax) { ymax = dir[j]; imax = j; } if (dir[j]<ymin) { ymin = dir[j]; } } padded_dir = new double[bins.length]; padded_bins = new double[bins.length]; shift_index = bins.length/2 - imax; for (int j = 0; j < bins.length; j++) { current_index = j - shift_index; if (current_index < 0) { current_index += bins.length; } if (current_index >= bins.length) { current_index -= bins.length; } padded_dir[j] = dir[current_index]; padded_bins[j] = bins[j]; } fitter = new CurveFitter(padded_bins, padded_dir); init_params[0] = ymin; init_params[1] = ymax; init_params[2] = padded_bins[bins.length/2]; init_params[3] = 2 * ( bins[1] - bins[0]); fitter.doFit(CurveFitter.GAUSSIAN); params = fitter.getParams(); goodness_of_fit[i] = fitter.getFitGoodness(); if (shift_index < 0) { params[2] += (bins[-shift_index]-bins[0]); } else { params[2] -= (bins[shift_index]-bins[0]); } params[3] = Math.abs(params[3]); params_from_fit.add(params); } fit_string = fitter.getFormula(); } | /**
* This method tries to fit a gaussian to the highest peak of each directionality histogram,
* and store fit results in the {@link #params_from_fit} field. The goodness of fit will be
* stored in {@link #goodness_of_fit}.
*/ | This method tries to fit a gaussian to the highest peak of each directionality histogram, and store fit results in the <code>#params_from_fit</code> field. The goodness of fit will be stored in <code>#goodness_of_fit</code> | fitHistograms | {
"repo_name": "KatjaSchulze/PlanktoVision",
"path": "src/calc/Directionality.java",
"license": "gpl-3.0",
"size": 60292
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,225,913 |
public LinkageType getLinkagetype2() {
return this.linkagetype2;
}
| LinkageType function() { return this.linkagetype2; } | /**
* Get the linkage type of the second attachment position
* @return the linkagetype2
*/ | Get the linkage type of the second attachment position | getLinkagetype2 | {
"repo_name": "glycoinfo/ResourcesDB",
"path": "src/main/java/org/eurocarbdb/resourcesdb/io/SubstituentExchangeObject.java",
"license": "gpl-3.0",
"size": 16704
} | [
"org.eurocarbdb.resourcesdb.glycoconjugate_derived.LinkageType"
] | import org.eurocarbdb.resourcesdb.glycoconjugate_derived.LinkageType; | import org.eurocarbdb.resourcesdb.glycoconjugate_derived.*; | [
"org.eurocarbdb.resourcesdb"
] | org.eurocarbdb.resourcesdb; | 1,814,862 |
private static List<String> getUserClasspathFileList(Config config) {
int userClassPathSource = getUserClassPathSource(config);
if (userClassPathSource == ClasspathUtil.SOURCE_TYPE_MASTER) {
// get the list as configured in config
return getClassPathFileList(config, ClasspathUtil.USER_SUPPLIED);
} else if (userClassPathSource == ClasspathUtil.SOURCE_TYPE_SLAVES) {
// get the list from userLib folder on master
JobConfig jobConfig = (JobConfig)config;
return ConfigurationUtil
.getAllFileNamesInDir(jobConfig.getUserLibLocationAtMaster());
}
return null;
} | static List<String> function(Config config) { int userClassPathSource = getUserClassPathSource(config); if (userClassPathSource == ClasspathUtil.SOURCE_TYPE_MASTER) { return getClassPathFileList(config, ClasspathUtil.USER_SUPPLIED); } else if (userClassPathSource == ClasspathUtil.SOURCE_TYPE_SLAVES) { JobConfig jobConfig = (JobConfig)config; return ConfigurationUtil .getAllFileNamesInDir(jobConfig.getUserLibLocationAtMaster()); } return null; } | /**
* <p>
* Gets the list of all user supplied classpath files
* </p>
*
* @param config
* Config
* @return List<String> List of files
*/ | Gets the list of all user supplied classpath files | getUserClasspathFileList | {
"repo_name": "impetus-opensource/jumbune",
"path": "debugger/src/main/java/org/jumbune/debugger/instrumentation/utils/FileUtil.java",
"license": "lgpl-3.0",
"size": 5433
} | [
"java.util.List",
"org.jumbune.common.job.Config",
"org.jumbune.common.job.JobConfig",
"org.jumbune.common.utils.ClasspathUtil",
"org.jumbune.common.utils.ConfigurationUtil"
] | import java.util.List; import org.jumbune.common.job.Config; import org.jumbune.common.job.JobConfig; import org.jumbune.common.utils.ClasspathUtil; import org.jumbune.common.utils.ConfigurationUtil; | import java.util.*; import org.jumbune.common.job.*; import org.jumbune.common.utils.*; | [
"java.util",
"org.jumbune.common"
] | java.util; org.jumbune.common; | 923,835 |
public byte[] encode() throws IOException {
byte[] buffer = new byte[8+12];
ByteBuffer dos = ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN);
dos.put((byte)0xFE);
dos.put((byte)(length & 0x00FF));
dos.put((byte)(sequence & 0x00FF));
dos.put((byte)(sysId & 0x00FF));
dos.put((byte)(componentId & 0x00FF));
dos.put((byte)(messageType & 0x00FF));
dos.putShort((short)(adc1&0x00FFFF));
dos.putShort((short)(adc2&0x00FFFF));
dos.putShort((short)(adc3&0x00FFFF));
dos.putShort((short)(adc4&0x00FFFF));
dos.putShort((short)(adc5&0x00FFFF));
dos.putShort((short)(adc6&0x00FFFF));
int crc = MAVLinkCRC.crc_calculate_encode(buffer, 12);
crc = MAVLinkCRC.crc_accumulate((byte) IMAVLinkCRC.MAVLINK_MESSAGE_CRCS[messageType], crc);
byte crcl = (byte) (crc & 0x00FF);
byte crch = (byte) ((crc >> 8) & 0x00FF);
buffer[18] = crcl;
buffer[19] = crch;
return buffer;
} | byte[] function() throws IOException { byte[] buffer = new byte[8+12]; ByteBuffer dos = ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN); dos.put((byte)0xFE); dos.put((byte)(length & 0x00FF)); dos.put((byte)(sequence & 0x00FF)); dos.put((byte)(sysId & 0x00FF)); dos.put((byte)(componentId & 0x00FF)); dos.put((byte)(messageType & 0x00FF)); dos.putShort((short)(adc1&0x00FFFF)); dos.putShort((short)(adc2&0x00FFFF)); dos.putShort((short)(adc3&0x00FFFF)); dos.putShort((short)(adc4&0x00FFFF)); dos.putShort((short)(adc5&0x00FFFF)); dos.putShort((short)(adc6&0x00FFFF)); int crc = MAVLinkCRC.crc_calculate_encode(buffer, 12); crc = MAVLinkCRC.crc_accumulate((byte) IMAVLinkCRC.MAVLINK_MESSAGE_CRCS[messageType], crc); byte crcl = (byte) (crc & 0x00FF); byte crch = (byte) ((crc >> 8) & 0x00FF); buffer[18] = crcl; buffer[19] = crch; return buffer; } | /**
* Encode message with raw data and other informations
*/ | Encode message with raw data and other informations | encode | {
"repo_name": "geeksville/arduleader",
"path": "thirdparty/org.mavlink.library/generated/org/mavlink/messages/ardupilotmega/msg_ap_adc.java",
"license": "gpl-3.0",
"size": 2482
} | [
"java.io.IOException",
"java.nio.ByteBuffer",
"java.nio.ByteOrder",
"org.mavlink.IMAVLinkCRC",
"org.mavlink.MAVLinkCRC"
] | import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.mavlink.IMAVLinkCRC; import org.mavlink.MAVLinkCRC; | import java.io.*; import java.nio.*; import org.mavlink.*; | [
"java.io",
"java.nio",
"org.mavlink"
] | java.io; java.nio; org.mavlink; | 1,384,795 |
@POST("tv/{tv_id}/rating")
Call<Status> addRating(
@Path("tv_id") Integer tvShowId,
@Body RatingObject body
); | @POST(STR) Call<Status> addRating( @Path("tv_id") Integer tvShowId, @Body RatingObject body ); | /**
* Rate a TV show.
*
* <b>Requires an active Session.</b>
*
* @param tvShowId TMDb id.
* @param body <em>Required.</em> A ReviewObject Object. Minimum value is 0.5 and Maximum 10.0, expected value is a number.
*/ | Rate a TV show. Requires an active Session | addRating | {
"repo_name": "UweTrottmann/tmdb-java",
"path": "src/main/java/com/uwetrottmann/tmdb2/services/TvService.java",
"license": "unlicense",
"size": 10863
} | [
"com.uwetrottmann.tmdb2.entities.RatingObject",
"com.uwetrottmann.tmdb2.entities.Status"
] | import com.uwetrottmann.tmdb2.entities.RatingObject; import com.uwetrottmann.tmdb2.entities.Status; | import com.uwetrottmann.tmdb2.entities.*; | [
"com.uwetrottmann.tmdb2"
] | com.uwetrottmann.tmdb2; | 976,896 |
EClass getIFunction(); | EClass getIFunction(); | /**
* Returns the meta object for class '{@link org.tud.inf.st.mbt.functions.IFunction <em>IFunction</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>IFunction</em>'.
* @see org.tud.inf.st.mbt.functions.IFunction
* @generated
*/ | Returns the meta object for class '<code>org.tud.inf.st.mbt.functions.IFunction IFunction</code>'. | getIFunction | {
"repo_name": "paetti1988/qmate",
"path": "MATE/org.tud.inf.st.mbt.emf/src-gen/org/tud/inf/st/mbt/functions/FunctionsPackage.java",
"license": "apache-2.0",
"size": 134465
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,666,087 |
public static String getMainPipeline(@SuppressWarnings("rawtypes") Map map) {
return getStringValue(map.get(KEY_MAINPIP), null);
}
| static String function(@SuppressWarnings(STR) Map map) { return getStringValue(map.get(KEY_MAINPIP), null); } | /**
* In case of a sub-pipeline, the name of the including main pipeline.
*
* @param map the map (Storm conf) containing the name-value binding
* @return the name of the main pipeline, may be <b>null</b> or empty if this is not a sub-pipeline
*/ | In case of a sub-pipeline, the name of the including main pipeline | getMainPipeline | {
"repo_name": "QualiMaster/Infrastructure",
"path": "QualiMaster.Events/src/eu/qualimaster/infrastructure/PipelineOptions.java",
"license": "apache-2.0",
"size": 37707
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,586,116 |
@Override
protected boolean validatePage() {
if (super.validatePage()) {
String extension = new Path(getFileName()).getFileExtension();
if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
setErrorMessage(DomainMetamodelM2MEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
return false;
}
return true;
}
return false;
} | boolean function() { if (super.validatePage()) { String extension = new Path(getFileName()).getFileExtension(); if (extension == null !FILE_EXTENSIONS.contains(extension)) { String key = FILE_EXTENSIONS.size() > 1 ? STR : STR; setErrorMessage(DomainMetamodelM2MEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); return false; } return true; } return false; } | /**
* The framework calls this to see if the file is correct.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | The framework calls this to see if the file is correct. | validatePage | {
"repo_name": "unicesi/QD-SPL",
"path": "Generation/co.shift.modeling.m2m.editor/src/domainmetamodelm2m/presentation/Domainmetamodelm2mModelWizard.java",
"license": "lgpl-3.0",
"size": 18243
} | [
"org.eclipse.core.runtime.Path"
] | import org.eclipse.core.runtime.Path; | import org.eclipse.core.runtime.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 2,886,124 |
List<IExpectedResultAsserter> getExpectedResultAsserter();
| List<IExpectedResultAsserter> getExpectedResultAsserter(); | /**
* Gets the expected result asserter.
*
* @return the expected result asserter
*/ | Gets the expected result asserter | getExpectedResultAsserter | {
"repo_name": "bigtester/automation-test-engine",
"path": "org.bigtester.ate.core/src/main/java/org/bigtester/ate/model/casestep/ITestStep.java",
"license": "apache-2.0",
"size": 5117
} | [
"java.util.List",
"org.bigtester.ate.model.asserter.IExpectedResultAsserter"
] | import java.util.List; import org.bigtester.ate.model.asserter.IExpectedResultAsserter; | import java.util.*; import org.bigtester.ate.model.asserter.*; | [
"java.util",
"org.bigtester.ate"
] | java.util; org.bigtester.ate; | 1,056,862 |
@Generated
@StructureField(order = 8, isGetter = true)
@FunctionPtr(name = "call_getSize")
public native Function_getSize getSize(); | @StructureField(order = 8, isGetter = true) @FunctionPtr(name = STR) native Function_getSize function(); | /**
* < This callback is called (once) during enqueue and dequeue operation to
* update the total size of the queue. Can be NULL. Ignored if version < 1.
*/ | < This callback is called (once) during enqueue and dequeue operation to update the total size of the queue. Can be NULL. Ignored if version < 1 | getSize | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/coremedia/struct/CMBufferCallbacks.java",
"license": "apache-2.0",
"size": 9818
} | [
"org.moe.natj.c.ann.FunctionPtr",
"org.moe.natj.c.ann.StructureField"
] | import org.moe.natj.c.ann.FunctionPtr; import org.moe.natj.c.ann.StructureField; | import org.moe.natj.c.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 2,682,333 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> setSharedKeyWithResponseAsync(
String resourceGroupName,
String virtualNetworkGatewayConnectionName,
ConnectionSharedKeyInner parameters,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (virtualNetworkGatewayConnectionName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter virtualNetworkGatewayConnectionName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2021-05-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.setSharedKey(
this.client.getEndpoint(),
resourceGroupName,
virtualNetworkGatewayConnectionName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
accept,
context);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKeyInner parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (virtualNetworkGatewayConnectionName == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (parameters == null) { return Mono.error(new IllegalArgumentException(STR)); } else { parameters.validate(); } final String apiVersion = STR; final String accept = STR; context = this.client.mergeContext(context); return service .setSharedKey( this.client.getEndpoint(), resourceGroupName, virtualNetworkGatewayConnectionName, apiVersion, this.client.getSubscriptionId(), parameters, accept, context); } | /**
* The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key
* for passed virtual network gateway connection in the specified resource group through Network resource provider.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayConnectionName The virtual network gateway connection name.
* @param parameters Parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation
* throughNetwork resource provider.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response for GetConnectionSharedKey API service call along with {@link Response} on successful completion
* of {@link Mono}.
*/ | The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider | setSharedKeyWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/VirtualNetworkGatewayConnectionsClientImpl.java",
"license": "mit",
"size": 187423
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.network.fluent.models.ConnectionSharedKeyInner",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.network.fluent.models.ConnectionSharedKeyInner; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.network.fluent.models.*; import java.nio.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio"
] | com.azure.core; com.azure.resourcemanager; java.nio; | 1,590,330 |
public List<Tuple3<FieldsTree, FieldsSupersedesTree, FieldsTree>> getRelationshipIsSupersededByTree(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException {
List<Object> args = new ArrayList<Object>();
args.add(ids);
args.add(fromFields);
args.add(relFields);
args.add(toFields);
TypeReference<List<List<Tuple3<FieldsTree, FieldsSupersedesTree, FieldsTree>>>> retType = new TypeReference<List<List<Tuple3<FieldsTree, FieldsSupersedesTree, FieldsTree>>>>() {};
List<List<Tuple3<FieldsTree, FieldsSupersedesTree, FieldsTree>>> res = caller.jsonrpcCall("CDMI_EntityAPI.get_relationship_IsSupersededByTree", args, retType, true, false);
return res.get(0);
} | List<Tuple3<FieldsTree, FieldsSupersedesTree, FieldsTree>> function(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(ids); args.add(fromFields); args.add(relFields); args.add(toFields); TypeReference<List<List<Tuple3<FieldsTree, FieldsSupersedesTree, FieldsTree>>>> retType = new TypeReference<List<List<Tuple3<FieldsTree, FieldsSupersedesTree, FieldsTree>>>>() {}; List<List<Tuple3<FieldsTree, FieldsSupersedesTree, FieldsTree>>> res = caller.jsonrpcCall(STR, args, retType, true, false); return res.get(0); } | /**
* <p>Original spec-file function name: get_relationship_IsSupersededByTree</p>
* <pre>
* </pre>
* @param ids instance of list of String
* @param fromFields instance of list of String
* @param relFields instance of list of String
* @param toFields instance of list of String
* @return instance of list of tuple of size 3: type {@link us.kbase.cdmientityapi.FieldsTree FieldsTree} (original type "fields_Tree"), type {@link us.kbase.cdmientityapi.FieldsSupersedesTree FieldsSupersedesTree} (original type "fields_SupersedesTree"), type {@link us.kbase.cdmientityapi.FieldsTree FieldsTree} (original type "fields_Tree")
* @throws IOException if an IO exception occurs
* @throws JsonClientException if a JSON RPC exception occurs
*/ | Original spec-file function name: get_relationship_IsSupersededByTree <code> </code> | getRelationshipIsSupersededByTree | {
"repo_name": "kbase/trees",
"path": "src/us/kbase/cdmientityapi/CDMIEntityAPIClient.java",
"license": "mit",
"size": 869221
} | [
"com.fasterxml.jackson.core.type.TypeReference",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"us.kbase.common.service.JsonClientException",
"us.kbase.common.service.Tuple3"
] | import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; import java.util.ArrayList; import java.util.List; import us.kbase.common.service.JsonClientException; import us.kbase.common.service.Tuple3; | import com.fasterxml.jackson.core.type.*; import java.io.*; import java.util.*; import us.kbase.common.service.*; | [
"com.fasterxml.jackson",
"java.io",
"java.util",
"us.kbase.common"
] | com.fasterxml.jackson; java.io; java.util; us.kbase.common; | 1,967,784 |
protected Command getReorientRelationshipCommand(
ReorientRelationshipRequest req) {
switch (getVisualID(req)) {
case EsbLinkEditPart.VISUAL_ID:
return getGEFWrapper(new EsbLinkReorientCommand(req));
}
return super.getReorientRelationshipCommand(req);
} | Command function( ReorientRelationshipRequest req) { switch (getVisualID(req)) { case EsbLinkEditPart.VISUAL_ID: return getGEFWrapper(new EsbLinkReorientCommand(req)); } return super.getReorientRelationshipCommand(req); } | /**
* Returns command to reorient EClass based link. New link target or source
* should be the domain model element associated with this node.
*
* @generated
*/ | Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node | getReorientRelationshipCommand | {
"repo_name": "rajeevanv89/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.diagram/src/org/wso2/developerstudio/eclipse/gmf/esb/diagram/edit/policies/PropertyMediatorOutputConnectorItemSemanticEditPolicy.java",
"license": "apache-2.0",
"size": 3885
} | [
"org.eclipse.gef.commands.Command",
"org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest",
"org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.commands.EsbLinkReorientCommand",
"org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.parts.EsbLinkEditPart"
] | import org.eclipse.gef.commands.Command; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; import org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.commands.EsbLinkReorientCommand; import org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.parts.EsbLinkEditPart; | import org.eclipse.gef.commands.*; import org.eclipse.gmf.runtime.emf.type.core.requests.*; import org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.commands.*; import org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.parts.*; | [
"org.eclipse.gef",
"org.eclipse.gmf",
"org.wso2.developerstudio"
] | org.eclipse.gef; org.eclipse.gmf; org.wso2.developerstudio; | 2,074,519 |
public void removeDataType(int fuzzTestId, int dataTypeId) {
EntityManager manager = EntityManagerFactoryInstance.getInstance()
.createEntityManager();
manager.getTransaction().begin();
DataTypeDO dataType = manager.find(DataTypeDO.class, new Integer(
dataTypeId));
FuzzTestDO fuzzTest = manager.find(FuzzTestDO.class,
new Integer(fuzzTestId));
dataType.removeOwner(fuzzTest);
fuzzTest.removeDataType(dataType);
manager.merge(fuzzTest);
manager.remove(dataType);
manager.getTransaction().commit();
manager.close();
notifyListeners();
} | void function(int fuzzTestId, int dataTypeId) { EntityManager manager = EntityManagerFactoryInstance.getInstance() .createEntityManager(); manager.getTransaction().begin(); DataTypeDO dataType = manager.find(DataTypeDO.class, new Integer( dataTypeId)); FuzzTestDO fuzzTest = manager.find(FuzzTestDO.class, new Integer(fuzzTestId)); dataType.removeOwner(fuzzTest); fuzzTest.removeDataType(dataType); manager.merge(fuzzTest); manager.remove(dataType); manager.getTransaction().commit(); manager.close(); notifyListeners(); } | /**
* Remove a data type from the fuzzTest.
* @param fuzzTestId
* @param DataTypeId
*/ | Remove a data type from the fuzzTest | removeDataType | {
"repo_name": "epri-dev/PT2",
"path": "src/main/java/org/epri/pt2/controller/DataTypeController.java",
"license": "bsd-3-clause",
"size": 8925
} | [
"javax.persistence.EntityManager",
"org.epri.pt2.DO"
] | import javax.persistence.EntityManager; import org.epri.pt2.DO; | import javax.persistence.*; import org.epri.pt2.*; | [
"javax.persistence",
"org.epri.pt2"
] | javax.persistence; org.epri.pt2; | 1,047,912 |
void getSmscAddress(Message result); | void getSmscAddress(Message result); | /**
* Gets the default SMSC address.
*
* @param result Callback message contains the SMSC address.
*/ | Gets the default SMSC address | getSmscAddress | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/internal/telephony/Phone.java",
"license": "apache-2.0",
"size": 62674
} | [
"android.os.Message"
] | import android.os.Message; | import android.os.*; | [
"android.os"
] | android.os; | 1,071,541 |
boolean post(Event event); | boolean post(Event event); | /**
* Fire an event
*
* @param event
* @return true if event is cancelable and cancelled.
*/ | Fire an event | post | {
"repo_name": "BoomBot/BoomBot",
"path": "src/main/java/net/lomeli/boombot/api/registry/IEventRegistry.java",
"license": "lgpl-3.0",
"size": 413
} | [
"net.lomeli.boombot.api.events.Event"
] | import net.lomeli.boombot.api.events.Event; | import net.lomeli.boombot.api.events.*; | [
"net.lomeli.boombot"
] | net.lomeli.boombot; | 2,684,101 |
@Test(groups= {"ut"})
public void testCompareStepInErrorWithReferenceNoStep() throws Exception {
ITestResult testResult = Reporter.getCurrentTestResult();
TestNGResultUtils.setSeleniumRobotTestContext(testResult, SeleniumTestsContextManager.getThreadContext());
SeleniumTestsContextManager.getThreadContext().getTestStepManager().setTestSteps(new ArrayList<>());
List<ErrorCause> causes = new ErrorCauseFinder(testResult).compareStepInErrorWithReference();
Assert.assertEquals(causes.size(), 0);
Assert.assertFalse(TestNGResultUtils.isErrorCauseSearchedInReferencePicture(testResult));
}
| @Test(groups= {"ut"}) void function() throws Exception { ITestResult testResult = Reporter.getCurrentTestResult(); TestNGResultUtils.setSeleniumRobotTestContext(testResult, SeleniumTestsContextManager.getThreadContext()); SeleniumTestsContextManager.getThreadContext().getTestStepManager().setTestSteps(new ArrayList<>()); List<ErrorCause> causes = new ErrorCauseFinder(testResult).compareStepInErrorWithReference(); Assert.assertEquals(causes.size(), 0); Assert.assertFalse(TestNGResultUtils.isErrorCauseSearchedInReferencePicture(testResult)); } | /**
* Check the case where no TestStep is available
* @throws Exception
*/ | Check the case where no TestStep is available | testCompareStepInErrorWithReferenceNoStep | {
"repo_name": "bhecquet/seleniumRobot",
"path": "core/src/test/java/com/seleniumtests/ut/core/testanalysis/TestErrorCauseFinder.java",
"license": "apache-2.0",
"size": 39669
} | [
"com.seleniumtests.core.SeleniumTestsContextManager",
"com.seleniumtests.core.testanalysis.ErrorCause",
"com.seleniumtests.core.testanalysis.ErrorCauseFinder",
"com.seleniumtests.core.utils.TestNGResultUtils",
"java.util.ArrayList",
"java.util.List",
"org.testng.Assert",
"org.testng.ITestResult",
"org.testng.Reporter",
"org.testng.annotations.Test"
] | import com.seleniumtests.core.SeleniumTestsContextManager; import com.seleniumtests.core.testanalysis.ErrorCause; import com.seleniumtests.core.testanalysis.ErrorCauseFinder; import com.seleniumtests.core.utils.TestNGResultUtils; import java.util.ArrayList; import java.util.List; import org.testng.Assert; import org.testng.ITestResult; import org.testng.Reporter; import org.testng.annotations.Test; | import com.seleniumtests.core.*; import com.seleniumtests.core.testanalysis.*; import com.seleniumtests.core.utils.*; import java.util.*; import org.testng.*; import org.testng.annotations.*; | [
"com.seleniumtests.core",
"java.util",
"org.testng",
"org.testng.annotations"
] | com.seleniumtests.core; java.util; org.testng; org.testng.annotations; | 1,079,915 |
public void setCustomerPaymentMedium(PaymentMedium customerPaymentMedium) {
this.customerPaymentMedium = customerPaymentMedium;
} | void function(PaymentMedium customerPaymentMedium) { this.customerPaymentMedium = customerPaymentMedium; } | /**
* Sets the customerPaymentMedium attribute value.
*
* @param customerPaymentMedium The customerPaymentMedium to set.
*/ | Sets the customerPaymentMedium attribute value | setCustomerPaymentMedium | {
"repo_name": "bhutchinson/kfs",
"path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/document/CashControlDocument.java",
"license": "agpl-3.0",
"size": 29406
} | [
"org.kuali.kfs.module.ar.businessobject.PaymentMedium"
] | import org.kuali.kfs.module.ar.businessobject.PaymentMedium; | import org.kuali.kfs.module.ar.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 2,528,897 |
public void dispose() {
getMetadataRepositoryManager().removeRepository(metadataRepository.getLocation());
try {
FileUtils.deleteDirectory(repositoryDirectory.toPath());
Installer.log("Deleted product repository at: " + repositoryDirectory.getAbsolutePath());
}
// Could not delete the temporary repository
catch (Exception e) {
Installer.log(e);;
}
} | void function() { getMetadataRepositoryManager().removeRepository(metadataRepository.getLocation()); try { FileUtils.deleteDirectory(repositoryDirectory.toPath()); Installer.log(STR + repositoryDirectory.getAbsolutePath()); } catch (Exception e) { Installer.log(e);; } } | /**
* Disposes of the product repository.
*/ | Disposes of the product repository | dispose | {
"repo_name": "MentorEmbedded/p2-installer",
"path": "plugins/com.codesourcery.installer/src/com/codesourcery/internal/installer/ProductRepository.java",
"license": "epl-1.0",
"size": 8856
} | [
"com.codesourcery.installer.Installer"
] | import com.codesourcery.installer.Installer; | import com.codesourcery.installer.*; | [
"com.codesourcery.installer"
] | com.codesourcery.installer; | 1,939,504 |
private List<Device> getAllDeviceInfo(List<Device> allDevices) throws DeviceManagementException {
if (log.isDebugEnabled()) {
log.debug("Get all device info of devices, num of devices: " + allDevices.size());
}
List<Device> devices = new ArrayList<>();
for (Device device : allDevices) {
device.setDeviceInfo(this.getDeviceInfo(device));
device.setApplications(this.getInstalledApplications(device));
DeviceManager deviceManager = this.getDeviceManager(device.getType());
if (deviceManager == null) {
if (log.isDebugEnabled()) {
log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " +
"Therefore, not attempting method 'isEnrolled'");
}
devices.add(device);
continue;
}
Device dmsDevice =
deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
if (dmsDevice != null) {
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
}
devices.add(device);
}
return devices;
} | List<Device> function(List<Device> allDevices) throws DeviceManagementException { if (log.isDebugEnabled()) { log.debug(STR + allDevices.size()); } List<Device> devices = new ArrayList<>(); for (Device device : allDevices) { device.setDeviceInfo(this.getDeviceInfo(device)); device.setApplications(this.getInstalledApplications(device)); DeviceManager deviceManager = this.getDeviceManager(device.getType()); if (deviceManager == null) { if (log.isDebugEnabled()) { log.debug(STR + device.getType() + STR + STR); } devices.add(device); continue; } Device dmsDevice = deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); if (dmsDevice != null) { device.setFeatures(dmsDevice.getFeatures()); device.setProperties(dmsDevice.getProperties()); } devices.add(device); } return devices; } | /**
* Returns all the available information (device-info, location, applications and plugin-db data)
* of the given device list.
*/ | Returns all the available information (device-info, location, applications and plugin-db data) of the given device list | getAllDeviceInfo | {
"repo_name": "ruwany/carbon-device-mgt",
"path": "components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java",
"license": "apache-2.0",
"size": 127331
} | [
"java.util.ArrayList",
"java.util.List",
"org.wso2.carbon.device.mgt.common.Device",
"org.wso2.carbon.device.mgt.common.DeviceIdentifier",
"org.wso2.carbon.device.mgt.common.DeviceManagementException",
"org.wso2.carbon.device.mgt.common.DeviceManager"
] | import java.util.ArrayList; import java.util.List; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; | import java.util.*; import org.wso2.carbon.device.mgt.common.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 2,658,510 |
public Status getReply(int i) {
return proto.getStatus(i);
} | Status function(int i) { return proto.getStatus(i); } | /**
* get the ith reply
* @return the the ith reply
*/ | get the ith reply | getReply | {
"repo_name": "moreus/hadoop",
"path": "hadoop-0.23.10/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PipelineAck.java",
"license": "apache-2.0",
"size": 3022
} | [
"org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos"
] | import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos; | import org.apache.hadoop.hdfs.protocol.proto.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,276,639 |
private NewApplication createNewApplication() {
GetNewApplicationRequest req =
recordFactory.newRecordInstance(GetNewApplicationRequest.class);
GetNewApplicationResponse resp;
try {
resp = rm.getClientRMService().getNewApplication(req);
} catch (YarnException e) {
String msg = "Unable to create new app from RM web service";
LOG.error(msg, e);
throw new YarnRuntimeException(msg, e);
}
NewApplication appId =
new NewApplication(resp.getApplicationId().toString(),
new ResourceInfo(resp.getMaximumResourceCapability()));
return appId;
} | NewApplication function() { GetNewApplicationRequest req = recordFactory.newRecordInstance(GetNewApplicationRequest.class); GetNewApplicationResponse resp; try { resp = rm.getClientRMService().getNewApplication(req); } catch (YarnException e) { String msg = STR; LOG.error(msg, e); throw new YarnRuntimeException(msg, e); } NewApplication appId = new NewApplication(resp.getApplicationId().toString(), new ResourceInfo(resp.getMaximumResourceCapability())); return appId; } | /**
* Function that actually creates the ApplicationId by calling the
* ClientRMService
*
* @return returns structure containing the app-id and maximum resource
* capabilities
*/ | Function that actually creates the ApplicationId by calling the ClientRMService | createNewApplication | {
"repo_name": "Reidddddd/mo-hadoop2.6.0",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java",
"license": "apache-2.0",
"size": 57695
} | [
"org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationRequest",
"org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse",
"org.apache.hadoop.yarn.exceptions.YarnException",
"org.apache.hadoop.yarn.exceptions.YarnRuntimeException",
"org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NewApplication",
"org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo"
] | import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NewApplication; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; | import org.apache.hadoop.yarn.api.protocolrecords.*; import org.apache.hadoop.yarn.exceptions.*; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,598,865 |
public int prune(double[] alphas, double[] errors, Instances test)
throws Exception {
Vector<LMTNode> nodeList;
CompareNode comparator = new CompareNode();
// determine training error of logistic models and subtrees, and calculate
// alpha-values from them
treeErrors();
calculateAlphas();
// get list of all inner nodes in the tree
nodeList = getNodes();
boolean prune = (nodeList.size() > 0);
// alpha_0 is always zero (unpruned tree)
alphas[0] = 0;
Evaluation eval;
// error of unpruned tree
if (errors != null) {
eval = new Evaluation(test);
eval.evaluateModel(this, test);
errors[0] = eval.errorRate();
}
int iteration = 0;
while (prune) {
iteration++;
// get node with minimum alpha
LMTNode nodeToPrune = Collections.min(nodeList, comparator);
nodeToPrune.m_isLeaf = true;
// Do not set m_sons null, want to unprune
// get alpha-value of node
alphas[iteration] = nodeToPrune.m_alpha;
// log error
if (errors != null) {
eval = new Evaluation(test);
eval.evaluateModel(this, test);
errors[iteration] = eval.errorRate();
}
// update errors/alphas
treeErrors();
calculateAlphas();
nodeList = getNodes();
prune = (nodeList.size() > 0);
}
// set last alpha 1 to indicate end
alphas[iteration + 1] = 1.0;
return iteration;
} | int function(double[] alphas, double[] errors, Instances test) throws Exception { Vector<LMTNode> nodeList; CompareNode comparator = new CompareNode(); treeErrors(); calculateAlphas(); nodeList = getNodes(); boolean prune = (nodeList.size() > 0); alphas[0] = 0; Evaluation eval; if (errors != null) { eval = new Evaluation(test); eval.evaluateModel(this, test); errors[0] = eval.errorRate(); } int iteration = 0; while (prune) { iteration++; LMTNode nodeToPrune = Collections.min(nodeList, comparator); nodeToPrune.m_isLeaf = true; alphas[iteration] = nodeToPrune.m_alpha; if (errors != null) { eval = new Evaluation(test); eval.evaluateModel(this, test); errors[iteration] = eval.errorRate(); } treeErrors(); calculateAlphas(); nodeList = getNodes(); prune = (nodeList.size() > 0); } alphas[iteration + 1] = 1.0; return iteration; } | /**
* Method for performing one fold in the cross-validation of the
* cost-complexity parameter. Generates a sequence of alpha-values with error
* estimates for the corresponding (partially pruned) trees, given the test
* set of that fold.
*
* @param alphas array to hold the generated alpha-values
* @param errors array to hold the corresponding error estimates
* @param test test set of that fold (to obtain error estimates)
* @throws Exception if something goes wrong
*/ | Method for performing one fold in the cross-validation of the cost-complexity parameter. Generates a sequence of alpha-values with error estimates for the corresponding (partially pruned) trees, given the test set of that fold | prune | {
"repo_name": "Scauser/j2ee",
"path": "Weka_Parallel_Test/weka/weka/classifiers/trees/lmt/LMTNode.java",
"license": "apache-2.0",
"size": 26059
} | [
"java.util.Collections",
"java.util.Vector"
] | import java.util.Collections; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 658,145 |
@Source("com/google/appinventor/images/file.png")
ImageResource file(); | @Source(STR) ImageResource file(); | /**
* Designer palette item: File Component
*/ | Designer palette item: File Component | file | {
"repo_name": "mintingle/appinventor-sources",
"path": "appinventor/appengine/src/com/google/appinventor/client/Images.java",
"license": "apache-2.0",
"size": 13759
} | [
"com.google.gwt.resources.client.ImageResource"
] | import com.google.gwt.resources.client.ImageResource; | import com.google.gwt.resources.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 353,791 |
public long decr(String key, int by, long def) {
return mutateWithDefault(Mutator.decr, key, by, def, 0);
} | long function(String key, int by, long def) { return mutateWithDefault(Mutator.decr, key, by, def, 0); } | /**
* Decrement the given counter, returning the new value.
*
* @param key the key
* @param by the amount to decrement
* @param def the default value (if the counter does not exist)
* @return the new value, or -1 if we were unable to decrement or add
* @throws OperationTimeoutException if the global operation timeout is
* exceeded
* @throws IllegalStateException in the rare circumstance where queue
* is too full to accept any more requests
*/ | Decrement the given counter, returning the new value | decr | {
"repo_name": "zjjxxl/java-memcached-client",
"path": "src/main/java/net/spy/memcached/MemcachedClient.java",
"license": "mit",
"size": 54244
} | [
"net.spy.memcached.ops.Mutator"
] | import net.spy.memcached.ops.Mutator; | import net.spy.memcached.ops.*; | [
"net.spy.memcached"
] | net.spy.memcached; | 2,346,162 |
public long getFreeMemorySize(Context context) {
ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo();
ActivityManager am = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
am.getMemoryInfo(outInfo);
long avaliMem = outInfo.availMem;
return avaliMem / 1024;
}
| long function(Context context) { ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo(); ActivityManager am = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); am.getMemoryInfo(outInfo); long avaliMem = outInfo.availMem; return avaliMem / 1024; } | /**
* get free memory.
*
* @return free memory of device
*
*/ | get free memory | getFreeMemorySize | {
"repo_name": "bingoHuang/performanceMonitor",
"path": "src/com/netease/emmagee/performance/MemoryInfo.java",
"license": "apache-2.0",
"size": 3570
} | [
"android.app.ActivityManager",
"android.content.Context"
] | import android.app.ActivityManager; import android.content.Context; | import android.app.*; import android.content.*; | [
"android.app",
"android.content"
] | android.app; android.content; | 2,587,347 |
public XMLOutputProcessor getXMLOutputProcessor() {
return myProcessor;
} | XMLOutputProcessor function() { return myProcessor; } | /**
* Returns the current XMLOutputProcessor instance in use by the
* XMLOutputter.
*
* @return the current XMLOutputProcessor instance.
*/ | Returns the current XMLOutputProcessor instance in use by the XMLOutputter | getXMLOutputProcessor | {
"repo_name": "djcraft/Algotica",
"path": "compilateurAlgotica/src/org/jdom2/output/XMLOutputter.java",
"license": "gpl-3.0",
"size": 35699
} | [
"org.jdom2.output.support.XMLOutputProcessor"
] | import org.jdom2.output.support.XMLOutputProcessor; | import org.jdom2.output.support.*; | [
"org.jdom2.output"
] | org.jdom2.output; | 475,925 |
public Map<String, String> getPublishParameters() {
return m_publishParameters;
} | Map<String, String> function() { return m_publishParameters; } | /**
* Gets the additional publish parameters which should be used for the publish functionality in the Acacia editor.<p>
*
* @return the additional publish parameters
*/ | Gets the additional publish parameters which should be used for the publish functionality in the Acacia editor | getPublishParameters | {
"repo_name": "mediaworx/opencms-core",
"path": "src-gwt/org/opencms/ade/contenteditor/client/CmsEditorContext.java",
"license": "lgpl-2.1",
"size": 2737
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,586,963 |
protected void refreshVisuals() {
if (widget == null)
return;
if (getActor().getContRefs().size() == 0)
((TreeItem) widget).setForeground(ColorManager.DARKGRAY);
else
((TreeItem) widget).setForeground(ColorManager.BLACK);
super.refreshVisuals();
} | void function() { if (widget == null) return; if (getActor().getContRefs().size() == 0) ((TreeItem) widget).setForeground(ColorManager.DARKGRAY); else ((TreeItem) widget).setForeground(ColorManager.BLACK); super.refreshVisuals(); } | /**
* Sets unused definitions to a lighter color.
*
* @see org.eclipse.gef.editparts.AbstractTreeEditPart#refreshVisuals()
*/ | Sets unused definitions to a lighter color | refreshVisuals | {
"repo_name": "McGill-DP-Group/seg.jUCMNav",
"path": "src/seg/jUCMNav/editparts/treeEditparts/ActorTreeEditPart.java",
"license": "epl-1.0",
"size": 1687
} | [
"org.eclipse.swt.widgets.TreeItem"
] | import org.eclipse.swt.widgets.TreeItem; | import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 429,297 |
protected ResourceLocation getEntityTexture(EntityPig p_110775_1_)
{
return pigTextures;
} | ResourceLocation function(EntityPig p_110775_1_) { return pigTextures; } | /**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/ | Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture | getEntityTexture | {
"repo_name": "mviitanen/marsmod",
"path": "mcp/src/minecraft/net/minecraft/client/renderer/entity/RenderPig.java",
"license": "gpl-2.0",
"size": 1974
} | [
"net.minecraft.entity.passive.EntityPig",
"net.minecraft.util.ResourceLocation"
] | import net.minecraft.entity.passive.EntityPig; import net.minecraft.util.ResourceLocation; | import net.minecraft.entity.passive.*; import net.minecraft.util.*; | [
"net.minecraft.entity",
"net.minecraft.util"
] | net.minecraft.entity; net.minecraft.util; | 1,502,374 |
protected interface ContentInfo {
InputSupplier<? extends InputStream> getContentSupplier(); | interface ContentInfo { InputSupplier<? extends InputStream> function(); | /**
* Returns an {@link InputSupplier} that provides the content.
*/ | Returns an <code>InputSupplier</code> that provides the content | getContentSupplier | {
"repo_name": "chtyim/cdap",
"path": "cdap-data-fabric/src/test/java/co/cask/cdap/data/stream/service/upload/StreamBodyConsumerTestBase.java",
"license": "apache-2.0",
"size": 7853
} | [
"com.google.common.io.InputSupplier",
"java.io.InputStream"
] | import com.google.common.io.InputSupplier; import java.io.InputStream; | import com.google.common.io.*; import java.io.*; | [
"com.google.common",
"java.io"
] | com.google.common; java.io; | 1,044,970 |
public static void cancelSwarm(Object swarm) {
Assert.assertTrue(swarm instanceof InternalDistributedSystem); // TODO
// Find the swarmSet and remove it
ArrayList swarmSet;
synchronized (allSwarms) {
swarmSet = (ArrayList) allSwarms.get(swarm);
if (swarmSet == null) {
return; // already cancelled
}
// Remove before releasing synchronization, so any fresh timer ends up
// in a new set with same key
allSwarms.remove(swarmSet);
} // synchronized
// Empty the swarmSet
synchronized (swarmSet) {
Iterator it = swarmSet.iterator();
while (it.hasNext()) {
WeakReference wr = (WeakReference) it.next();
SystemTimer st = (SystemTimer) wr.get();
// it.remove(); Not necessary, we're emptying the list...
if (st != null) {
st.cancelled = true; // for safety :-)
st.timer.cancel(); // st.cancel() would just search for it again
}
} // while
} // synchronized
} | static void function(Object swarm) { Assert.assertTrue(swarm instanceof InternalDistributedSystem); ArrayList swarmSet; synchronized (allSwarms) { swarmSet = (ArrayList) allSwarms.get(swarm); if (swarmSet == null) { return; } allSwarms.remove(swarmSet); } synchronized (swarmSet) { Iterator it = swarmSet.iterator(); while (it.hasNext()) { WeakReference wr = (WeakReference) it.next(); SystemTimer st = (SystemTimer) wr.get(); if (st != null) { st.cancelled = true; st.timer.cancel(); } } } } | /**
* Cancel all outstanding timers
*
* @param swarm the swarm to cancel
*/ | Cancel all outstanding timers | cancelSwarm | {
"repo_name": "PurelyApplied/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java",
"license": "apache-2.0",
"size": 14623
} | [
"java.lang.ref.WeakReference",
"java.util.ArrayList",
"java.util.Iterator",
"org.apache.geode.distributed.internal.InternalDistributedSystem"
] | import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Iterator; import org.apache.geode.distributed.internal.InternalDistributedSystem; | import java.lang.ref.*; import java.util.*; import org.apache.geode.distributed.internal.*; | [
"java.lang",
"java.util",
"org.apache.geode"
] | java.lang; java.util; org.apache.geode; | 74,979 |
protected double t(double m, double mu, double v, double n) {
return (m - mu) / FastMath.sqrt(v / n);
} | double function(double m, double mu, double v, double n) { return (m - mu) / FastMath.sqrt(v / n); } | /**
* Computes t test statistic for 1-sample t-test.
*
* @param m sample mean
* @param mu constant to test against
* @param v sample variance
* @param n sample n
* @return t test statistic
*/ | Computes t test statistic for 1-sample t-test | t | {
"repo_name": "SpoonLabs/astor",
"path": "examples/math_57/src/main/java/org/apache/commons/math/stat/inference/TTestImpl.java",
"license": "gpl-2.0",
"size": 46491
} | [
"org.apache.commons.math.util.FastMath"
] | import org.apache.commons.math.util.FastMath; | import org.apache.commons.math.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,064,290 |
protected void onMessageSent(ChatMessage message)
{
}
| void function(ChatMessage message) { } | /**
* Callback method to be invoked when a message is sent.
*
* @param message
* The message that was sent.
*/ | Callback method to be invoked when a message is sent | onMessageSent | {
"repo_name": "Hipmob/hipmob-android-experience",
"path": "src/com/hipmob/android/experience/chat/CustomHipmobCore.java",
"license": "mit",
"size": 2472
} | [
"com.hipmob.android.ChatMessage"
] | import com.hipmob.android.ChatMessage; | import com.hipmob.android.*; | [
"com.hipmob.android"
] | com.hipmob.android; | 2,716,995 |
@Test public void
sends_timer_to_statsd_from_locale_with_unamerican_number_formatting() throws Exception {
Locale originalDefaultLocale = Locale.getDefault();
// change the default Locale to one that uses something other than a '.' as the decimal separator (Germany uses a comma)
Locale.setDefault(Locale.GERMANY);
try {
client.recordExecutionTime("mytime", 123, dimensions);
server.waitForMessage();
assertThat(server.messagesReceived(), hasItem("my.prefix.mytime:123|ms|#{'name':'foo','region':'us-west'}"));
} finally {
// reset the default Locale in case changing it has side-effects
Locale.setDefault(originalDefaultLocale);
}
} | @Test void function() throws Exception { Locale originalDefaultLocale = Locale.getDefault(); Locale.setDefault(Locale.GERMANY); try { client.recordExecutionTime(STR, 123, dimensions); server.waitForMessage(); assertThat(server.messagesReceived(), hasItem(STR)); } finally { Locale.setDefault(originalDefaultLocale); } } | /**
* A regression test for <a href="https://github.com/indeedeng/java-dogstatsd-client/issues/3">this i18n number formatting bug</a>
* @throws Exception
*/ | A regression test for this i18n number formatting bug | sends_timer_to_statsd_from_locale_with_unamerican_number_formatting | {
"repo_name": "hpcloud-mon/java-monasca-statsd",
"path": "src/test/java/monasca/test/statsd/BlockingStatsDClientTest.java",
"license": "mit",
"size": 9469
} | [
"java.util.Locale",
"org.hamcrest.MatcherAssert",
"org.hamcrest.core.IsCollectionContaining",
"org.junit.Test"
] | import java.util.Locale; import org.hamcrest.MatcherAssert; import org.hamcrest.core.IsCollectionContaining; import org.junit.Test; | import java.util.*; import org.hamcrest.*; import org.hamcrest.core.*; import org.junit.*; | [
"java.util",
"org.hamcrest",
"org.hamcrest.core",
"org.junit"
] | java.util; org.hamcrest; org.hamcrest.core; org.junit; | 1,937,146 |
@Auditable(parameters = {"nodeRef"})
public int countRules(NodeRef nodeRef);
| @Auditable(parameters = {STR}) int function(NodeRef nodeRef); | /**
* Count the number of rules associated with an actionable node.
*
* @param nodeRef the node reference
* @return a list of the rules associated with the node
*/ | Count the number of rules associated with an actionable node | countRules | {
"repo_name": "loftuxab/community-edition-old",
"path": "projects/repository/source/java/org/alfresco/service/cmr/rule/RuleService.java",
"license": "lgpl-3.0",
"size": 10471
} | [
"org.alfresco.service.Auditable",
"org.alfresco.service.cmr.repository.NodeRef"
] | import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; | import org.alfresco.service.*; import org.alfresco.service.cmr.repository.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 1,856,474 |
public List<MessageKey> getAll(); | List<MessageKey> function(); | /**
* Query for all of the items in the object table
* @return list of all chats or null on error
*/ | Query for all of the items in the object table | getAll | {
"repo_name": "FAU-Inf2/yasme-android",
"path": "yasme/src/main/java/de/fau/cs/mad/yasme/android/storage/dao/MessageKeyDAO.java",
"license": "mit",
"size": 2602
} | [
"de.fau.cs.mad.yasme.android.entities.MessageKey",
"java.util.List"
] | import de.fau.cs.mad.yasme.android.entities.MessageKey; import java.util.List; | import de.fau.cs.mad.yasme.android.entities.*; import java.util.*; | [
"de.fau.cs",
"java.util"
] | de.fau.cs; java.util; | 458,323 |
public WindowMode getWindowMode() {
return getState(false).windowMode;
} | WindowMode function() { return getState(false).windowMode; } | /**
* Gets the current mode of the window.
*
* @see WindowMode
* @return the mode of the window.
*/ | Gets the current mode of the window | getWindowMode | {
"repo_name": "cbmeeks/vaadin",
"path": "server/src/com/vaadin/ui/Window.java",
"license": "apache-2.0",
"size": 42502
} | [
"com.vaadin.shared.ui.window.WindowMode"
] | import com.vaadin.shared.ui.window.WindowMode; | import com.vaadin.shared.ui.window.*; | [
"com.vaadin.shared"
] | com.vaadin.shared; | 692,185 |
@Reference(
name = "siddhi.dependency.resolver",
service = SimulationDependencyListener.class,
cardinality = ReferenceCardinality.OPTIONAL,
policy = ReferencePolicy.DYNAMIC,
unbind = "unsubscribeFromListener"
)
protected void subscribeToListener(SimulationDependencyListener simulationDependencyListener) {
this.simulationDependencyListener = simulationDependencyListener;
} | @Reference( name = STR, service = SimulationDependencyListener.class, cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, unbind = STR ) void function(SimulationDependencyListener simulationDependencyListener) { this.simulationDependencyListener = simulationDependencyListener; } | /**
* This bind method will be called when SimulationDependencyListener OSGi service is registered.
*/ | This bind method will be called when SimulationDependencyListener OSGi service is registered | subscribeToListener | {
"repo_name": "wso2/carbon-analytics",
"path": "components/org.wso2.carbon.streaming.integrator.core/src/main/java/org/wso2/carbon/streaming/integrator/core/internal/StreamProcessorDeployer.java",
"license": "apache-2.0",
"size": 25702
} | [
"org.osgi.service.component.annotations.Reference",
"org.osgi.service.component.annotations.ReferenceCardinality",
"org.osgi.service.component.annotations.ReferencePolicy",
"org.wso2.carbon.streaming.integrator.common.SimulationDependencyListener"
] | import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.streaming.integrator.common.SimulationDependencyListener; | import org.osgi.service.component.annotations.*; import org.wso2.carbon.streaming.integrator.common.*; | [
"org.osgi.service",
"org.wso2.carbon"
] | org.osgi.service; org.wso2.carbon; | 2,388,799 |
@Override
public Adapter createBTSTranslationAdapter() {
if (btsTranslationItemProvider == null) {
btsTranslationItemProvider = new BTSTranslationItemProvider(this);
}
return btsTranslationItemProvider;
}
protected BTSDateItemProvider btsDateItemProvider;
| Adapter function() { if (btsTranslationItemProvider == null) { btsTranslationItemProvider = new BTSTranslationItemProvider(this); } return btsTranslationItemProvider; } protected BTSDateItemProvider btsDateItemProvider; | /**
* This creates an adapter for a {@link org.bbaw.bts.btsmodel.BTSTranslation}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This creates an adapter for a <code>org.bbaw.bts.btsmodel.BTSTranslation</code>. | createBTSTranslationAdapter | {
"repo_name": "JKatzwinkel/bts",
"path": "org.bbaw.bts.model.edit/src/org/bbaw/bts/btsmodel/provider/BtsmodelItemProviderAdapterFactory.java",
"license": "lgpl-3.0",
"size": 27124
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,644,561 |
public void endElement(String uri, String localName, String qName)
throws SAXException
{
checkForEndTag(qName.toLowerCase());
} | void function(String uri, String localName, String qName) throws SAXException { checkForEndTag(qName.toLowerCase()); } | /**
* Callback-methode. Wird aufgerufen, wenn ein XML-Element geschlossen wird.
*/ | Callback-methode. Wird aufgerufen, wenn ein XML-Element geschlossen wird | endElement | {
"repo_name": "bakkdoor/v-unit",
"path": "src/model/data/xml/parsers/AbstractParser.java",
"license": "lgpl-3.0",
"size": 2602
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,386,030 |
private void writeEntry(HashtableEntry entry)
throws IOException, EOFException, FileManagerException, ClassNotFoundException {
long index = getHtindex(entry.index, entry.tableid);
if (index == 0) { // first one in this bucket
updateEntry(entry); // write to disk
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else if (index == entry.location) { // replacing first entry
updateEntry(entry);
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else { //
//
// If the entry has a "previous" pointer, then it was read earlier
// from disk. Otherwise, it is a brand new entry. If it is a brand
// entry, we write it to disk and chain at the front of the bucket.
// If "previous" is not zero, we check to see if reallocation is
// needed (location == 0). If not, we simply update on disk and we're
// done. If reallocation is needed we update on disk to do the allocation
// and call updatePointer to chain into the bucket.
//
if (entry.previous == 0) {
entry.next = index;
updateEntry(entry);
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else {
if (entry.location == 0) { // allocation needed?
updateEntry(entry); // do allocation
updatePointer(entry.previous, entry.location); // chain in
} else {
updateEntry(entry); // no allocation, just update fields
}
}
}
} | void function(HashtableEntry entry) throws IOException, EOFException, FileManagerException, ClassNotFoundException { long index = getHtindex(entry.index, entry.tableid); if (index == 0) { updateEntry(entry); writeHashIndex(entry.index, entry.location, entry.tableid); } else if (index == entry.location) { updateEntry(entry); writeHashIndex(entry.index, entry.location, entry.tableid); } else { entry.next = index; updateEntry(entry); writeHashIndex(entry.index, entry.location, entry.tableid); } else { if (entry.location == 0) { updateEntry(entry); updatePointer(entry.previous, entry.location); } else { updateEntry(entry); } } } } | /**************************************************************************
* Common code to insert an entry into the hashtable.
*************************************************************************/ | Common code to insert an entry into the hashtable | writeEntry | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java",
"license": "epl-1.0",
"size": 150881
} | [
"com.ibm.ws.cache.persistent.filemgr.FileManagerException",
"java.io.EOFException",
"java.io.IOException"
] | import com.ibm.ws.cache.persistent.filemgr.FileManagerException; import java.io.EOFException; import java.io.IOException; | import com.ibm.ws.cache.persistent.filemgr.*; import java.io.*; | [
"com.ibm.ws",
"java.io"
] | com.ibm.ws; java.io; | 1,038,245 |
public static String getFileNameFromPath(File file) {
if (!isOnlyAFolder(file)) {
return file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("\\") + 1);
} else
return "";
}
| static String function(File file) { if (!isOnlyAFolder(file)) { return file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("\\") + 1); } else return ""; } | /**
* Returns the file name from a given file. If file is a folder an empty String is returned
*
* @param file
* @return
*/ | Returns the file name from a given file. If file is a folder an empty String is returned | getFileNameFromPath | {
"repo_name": "DrewG/mzmine2",
"path": "src/main/java/net/sf/mzmine/util/files/FileAndPathUtil.java",
"license": "gpl-2.0",
"size": 13773
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,449,480 |
public Object[] ungroupCells(Object[] cells)
{
List<Object> result = new ArrayList<Object>();
if (cells == null)
{
cells = getSelectionCells();
// Finds the cells with children
List<Object> tmp = new ArrayList<Object>(cells.length);
for (int i = 0; i < cells.length; i++)
{
if (model.getChildCount(cells[i]) > 0)
{
tmp.add(cells[i]);
}
}
cells = tmp.toArray();
}
if (cells != null && cells.length > 0)
{
model.beginUpdate();
try
{
for (int i = 0; i < cells.length; i++)
{
Object[] children = mxGraphModel.getChildren(model,
cells[i]);
if (children != null && children.length > 0)
{
Object parent = model.getParent(cells[i]);
int index = model.getChildCount(parent);
cellsAdded(children, parent, index, null, null, true);
result.addAll(Arrays.asList(children));
}
}
cellsRemoved(addAllEdges(cells));
fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS, "cells",
cells));
}
finally
{
model.endUpdate();
}
}
return result.toArray();
} | Object[] function(Object[] cells) { List<Object> result = new ArrayList<Object>(); if (cells == null) { cells = getSelectionCells(); List<Object> tmp = new ArrayList<Object>(cells.length); for (int i = 0; i < cells.length; i++) { if (model.getChildCount(cells[i]) > 0) { tmp.add(cells[i]); } } cells = tmp.toArray(); } if (cells != null && cells.length > 0) { model.beginUpdate(); try { for (int i = 0; i < cells.length; i++) { Object[] children = mxGraphModel.getChildren(model, cells[i]); if (children != null && children.length > 0) { Object parent = model.getParent(cells[i]); int index = model.getChildCount(parent); cellsAdded(children, parent, index, null, null, true); result.addAll(Arrays.asList(children)); } } cellsRemoved(addAllEdges(cells)); fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS, "cells", cells)); } finally { model.endUpdate(); } } return result.toArray(); } | /**
* Ungroups the given cells by moving the children the children to their
* parents parent and removing the empty groups.
*
* @param cells Array of cells to be ungrouped. If null is specified then
* the selection cells are used.
* @return Returns the children that have been removed from the groups.
*/ | Ungroups the given cells by moving the children the children to their parents parent and removing the empty groups | ungroupCells | {
"repo_name": "luartmg/WMA",
"path": "WMA/LibreriaJGraphx/src/com/mxgraph/view/mxGraph.java",
"license": "apache-2.0",
"size": 204261
} | [
"com.mxgraph.util.mxEventObject",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List"
] | import com.mxgraph.util.mxEventObject; import java.util.ArrayList; import java.util.Arrays; import java.util.List; | import com.mxgraph.util.*; import java.util.*; | [
"com.mxgraph.util",
"java.util"
] | com.mxgraph.util; java.util; | 542,319 |
public Recipient getRecipient() {
if (isUsingPrincipal()) {
return new KimPrincipalRecipient(getPrincipal());
} else if (isUsingGroup()) {
return new KimGroupRecipient(getGroup());
} else if (isUsingRole()) {
return new RoleRecipient(getRole());
} else {
return null;
}
} | Recipient function() { if (isUsingPrincipal()) { return new KimPrincipalRecipient(getPrincipal()); } else if (isUsingGroup()) { return new KimGroupRecipient(getGroup()); } else if (isUsingRole()) { return new RoleRecipient(getRole()); } else { return null; } } | /**
* Convenience method to return the Recipient for this RuleResponsibility
* @return the Recipient for this RuleResponsibility
*/ | Convenience method to return the Recipient for this RuleResponsibility | getRecipient | {
"repo_name": "ricepanda/rice-git3",
"path": "rice-middleware/impl/src/main/java/org/kuali/rice/kew/rule/RuleResponsibilityBo.java",
"license": "apache-2.0",
"size": 13358
} | [
"org.kuali.rice.kew.actionrequest.KimGroupRecipient",
"org.kuali.rice.kew.actionrequest.KimPrincipalRecipient",
"org.kuali.rice.kew.actionrequest.Recipient",
"org.kuali.rice.kew.user.RoleRecipient"
] | import org.kuali.rice.kew.actionrequest.KimGroupRecipient; import org.kuali.rice.kew.actionrequest.KimPrincipalRecipient; import org.kuali.rice.kew.actionrequest.Recipient; import org.kuali.rice.kew.user.RoleRecipient; | import org.kuali.rice.kew.actionrequest.*; import org.kuali.rice.kew.user.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 754,781 |
private void updateMinimumSize() {
Dimension size = new Dimension(DEFAULT_SCALE * (int) getMapSize().getWidth(),
DEFAULT_SCALE * (SEQUENCE_HEIGHT + (int) getMapSize().getHeight()));
this.setMinimumSize(size);
this.setPreferredSize(size);
this.setMaximumSize(size);
} | void function() { Dimension size = new Dimension(DEFAULT_SCALE * (int) getMapSize().getWidth(), DEFAULT_SCALE * (SEQUENCE_HEIGHT + (int) getMapSize().getHeight())); this.setMinimumSize(size); this.setPreferredSize(size); this.setMaximumSize(size); } | /**
* Update minimum size based on controller.
*/ | Update minimum size based on controller | updateMinimumSize | {
"repo_name": "eishub/BW4T",
"path": "bw4t-core/src/main/java/nl/tudelft/bw4t/map/renderer/MapRenderer.java",
"license": "gpl-3.0",
"size": 11893
} | [
"java.awt.Dimension"
] | import java.awt.Dimension; | import java.awt.*; | [
"java.awt"
] | java.awt; | 270,442 |
public void setDn( String dn ) throws LdapInvalidDnException
{
entryDn = new Dn( dn );
entry.setDn( entryDn );
} | void function( String dn ) throws LdapInvalidDnException { entryDn = new Dn( dn ); entry.setDn( entryDn ); } | /**
* Set the Distinguished Name
*
* @param dn The Distinguished Name
* @throws LdapInvalidDnException If the Dn is invalid
*/ | Set the Distinguished Name | setDn | {
"repo_name": "darranl/directory-shared",
"path": "ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java",
"license": "apache-2.0",
"size": 35212
} | [
"org.apache.directory.api.ldap.model.exception.LdapInvalidDnException",
"org.apache.directory.api.ldap.model.name.Dn"
] | import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; import org.apache.directory.api.ldap.model.name.Dn; | import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.api.ldap.model.name.*; | [
"org.apache.directory"
] | org.apache.directory; | 444,203 |
Field field = getDeclaredField(object, fieldName);
checkNotNull(field, "Could not find field [%s] on target [%s]", fieldName, object);
makeAccessible(field);
try {
return field.get(object);
} catch (IllegalAccessException e) {
LOGGER.error(e.getMessage(), e);
}
return null;
} | Field field = getDeclaredField(object, fieldName); checkNotNull(field, STR, fieldName, object); makeAccessible(field); try { return field.get(object); } catch (IllegalAccessException e) { LOGGER.error(e.getMessage(), e); } return null; } | /**
* Get object field value, bypassing getter method.
*
* @param object object
* @param fieldName field Name
* @return fileValue
*/ | Get object field value, bypassing getter method | getFieldValue | {
"repo_name": "naver/ngrinder",
"path": "ngrinder-core/src/main/java/org/ngrinder/common/util/ReflectionUtils.java",
"license": "apache-2.0",
"size": 3036
} | [
"java.lang.reflect.Field",
"org.ngrinder.common.util.Preconditions"
] | import java.lang.reflect.Field; import org.ngrinder.common.util.Preconditions; | import java.lang.reflect.*; import org.ngrinder.common.util.*; | [
"java.lang",
"org.ngrinder.common"
] | java.lang; org.ngrinder.common; | 2,577,914 |
private void subscribe() {
GFJmxConnection gf = new GFJmxConnection(getConfig());
// just in case, unsubscribe first
gf.removeAlertNotificationListener(this);
mServer = gf.addAlertNotificationListener(this);
if(mServer == null)
log.info("Failed to subscribe to Gemfire alert notifications.");
else
log.debug("Successfully subscribed to Gemfire alert notifications.");
} | void function() { GFJmxConnection gf = new GFJmxConnection(getConfig()); gf.removeAlertNotificationListener(this); mServer = gf.addAlertNotificationListener(this); if(mServer == null) log.info(STR); else log.debug(STR); } | /**
* Subscribes to alert notifications.
*
* This method also caches mbean server connection what is
* later used to check if mbean server is still available.
*/ | Subscribes to alert notifications. This method also caches mbean server connection what is later used to check if mbean server is still available | subscribe | {
"repo_name": "pivotal/gf-hq-plugin",
"path": "src/main/java/com/vmware/vfabric/hyperic/plugin/vfgf/log/GFNotificationTrack.java",
"license": "gpl-2.0",
"size": 8724
} | [
"com.vmware.vfabric.hyperic.plugin.vfgf.mx.GFJmxConnection"
] | import com.vmware.vfabric.hyperic.plugin.vfgf.mx.GFJmxConnection; | import com.vmware.vfabric.hyperic.plugin.vfgf.mx.*; | [
"com.vmware.vfabric"
] | com.vmware.vfabric; | 1,533,735 |
public synchronized ListenableFuture<List<String>> startNodesAsync(final int numNodes, final Settings settings) {
return startNodesAsync(numNodes, settings, Version.CURRENT);
} | synchronized ListenableFuture<List<String>> function(final int numNodes, final Settings settings) { return startNodesAsync(numNodes, settings, Version.CURRENT); } | /**
* Starts multiple nodes in an async manner with the given settings and returns future with its name.
*/ | Starts multiple nodes in an async manner with the given settings and returns future with its name | startNodesAsync | {
"repo_name": "tsohil/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/test/InternalTestCluster.java",
"license": "apache-2.0",
"size": 81423
} | [
"com.google.common.util.concurrent.ListenableFuture",
"java.util.List",
"org.elasticsearch.Version",
"org.elasticsearch.common.settings.Settings"
] | import com.google.common.util.concurrent.ListenableFuture; import java.util.List; import org.elasticsearch.Version; import org.elasticsearch.common.settings.Settings; | import com.google.common.util.concurrent.*; import java.util.*; import org.elasticsearch.*; import org.elasticsearch.common.settings.*; | [
"com.google.common",
"java.util",
"org.elasticsearch",
"org.elasticsearch.common"
] | com.google.common; java.util; org.elasticsearch; org.elasticsearch.common; | 792,040 |
private boolean hasNonConfidentialIncorrectValues(String target, String parameter, String[] values, List tempStateValues) {
Hashtable receivedValues = new Hashtable();
for (int i = 0; i < values.length; i++) {
boolean exists = false;
for (int j = 0; j < tempStateValues.size() && !exists; j++) {
String tempValue = (String) tempStateValues.get(j);
if (tempValue.equalsIgnoreCase(values[i])) {
tempStateValues.remove(j);
exists = true;
}
}
if (!exists) {
if (receivedValues.containsKey(values[i])) {
this.logger.log(HDIVErrorCodes.REPEATED_VALUES, target, parameter, values[i]);
return true;
}
this.logger.log(HDIVErrorCodes.PARAMETER_VALUE_INCORRECT, target, parameter, values[i]);
return true;
}
receivedValues.put(values[i], values[i]);
}
return false;
} | boolean function(String target, String parameter, String[] values, List tempStateValues) { Hashtable receivedValues = new Hashtable(); for (int i = 0; i < values.length; i++) { boolean exists = false; for (int j = 0; j < tempStateValues.size() && !exists; j++) { String tempValue = (String) tempStateValues.get(j); if (tempValue.equalsIgnoreCase(values[i])) { tempStateValues.remove(j); exists = true; } } if (!exists) { if (receivedValues.containsKey(values[i])) { this.logger.log(HDIVErrorCodes.REPEATED_VALUES, target, parameter, values[i]); return true; } this.logger.log(HDIVErrorCodes.PARAMETER_VALUE_INCORRECT, target, parameter, values[i]); return true; } receivedValues.put(values[i], values[i]); } return false; } | /**
* Checks if repeated or no valid values have been received for the
* parameter <code>parameter</code>.
*
* @param target Part of the url that represents the target action
* @param parameter parameter name
* @param values Parameter <code>parameter</code> values
* @param tempStateValues values stored in state for <code>parameter</code>
* @return True If repeated or no valid values have been received for the
* parameter <code>parameter</code>.
*/ | Checks if repeated or no valid values have been received for the parameter <code>parameter</code> | hasNonConfidentialIncorrectValues | {
"repo_name": "adamjhamer/hdiv-archive",
"path": "hdiv-core/src/main/java/org/hdiv/filter/AbstractValidatorHelper.java",
"license": "apache-2.0",
"size": 30735
} | [
"java.util.Hashtable",
"java.util.List",
"org.hdiv.util.HDIVErrorCodes"
] | import java.util.Hashtable; import java.util.List; import org.hdiv.util.HDIVErrorCodes; | import java.util.*; import org.hdiv.util.*; | [
"java.util",
"org.hdiv.util"
] | java.util; org.hdiv.util; | 724,680 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.