method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<ManagementLockObjectInner> listByResourceGroup(String resourceGroupName);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<ManagementLockObjectInner> listByResourceGroup(String resourceGroupName);
/** * Gets all the management locks for a resource group. * * @param resourceGroupName The name of the resource group containing the locks to get. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all the management locks for a resource group as paginated response with {@link PagedIterable}. */
Gets all the management locks for a resource group
listByResourceGroup
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluent/ManagementLocksClient.java", "license": "mit", "size": 66646 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.resources.fluent.models.ManagementLockObjectInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.resources.fluent.models.ManagementLockObjectInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.resources.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
231,873
protected RegisterApplicationMasterResponse registerApplicationMaster( final int testAppId) throws Exception, YarnException, IOException { final ApplicationUserInfo ugi = getApplicationUserInfo(testAppId);
RegisterApplicationMasterResponse function( final int testAppId) throws Exception, YarnException, IOException { final ApplicationUserInfo ugi = getApplicationUserInfo(testAppId);
/** * Helper method to register an application master using specified testAppId * as the application identifier and return the response * * @param testAppId * @return * @throws Exception * @throws YarnException * @throws IOException */
Helper method to register an application master using specified testAppId as the application identifier and return the response
registerApplicationMaster
{ "repo_name": "dennishuo/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/BaseAMRMProxyTest.java", "license": "apache-2.0", "size": 27696 }
[ "java.io.IOException", "org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse", "org.apache.hadoop.yarn.exceptions.YarnException" ]
import java.io.IOException; import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse; import org.apache.hadoop.yarn.exceptions.YarnException;
import java.io.*; import org.apache.hadoop.yarn.api.protocolrecords.*; import org.apache.hadoop.yarn.exceptions.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,245,613
public static AnimatablePaintValue createCurrentColorPaintValue (AnimationTarget target) { AnimatablePaintValue v = new AnimatablePaintValue(target); v.paintType = PAINT_CURRENT_COLOR; return v; }
static AnimatablePaintValue function (AnimationTarget target) { AnimatablePaintValue v = new AnimatablePaintValue(target); v.paintType = PAINT_CURRENT_COLOR; return v; }
/** * Creates a new AnimatablePaintValue for a 'currentColor' value. */
Creates a new AnimatablePaintValue for a 'currentColor' value
createCurrentColorPaintValue
{ "repo_name": "Squeegee/batik", "path": "sources/org/apache/batik/anim/values/AnimatablePaintValue.java", "license": "apache-2.0", "size": 8932 }
[ "org.apache.batik.dom.anim.AnimationTarget" ]
import org.apache.batik.dom.anim.AnimationTarget;
import org.apache.batik.dom.anim.*;
[ "org.apache.batik" ]
org.apache.batik;
448,080
public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); }
void function(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); }
/** * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This implements <code>org.eclipse.jface.viewers.ISelectionProvider</code>.
removeSelectionChangedListener
{ "repo_name": "ohaegi/emfshell", "path": "tests/org.eclipse.emf.examples.library.editor/src/org/eclipse/emf/examples/extlibrary/presentation/EXTLibraryEditor.java", "license": "epl-1.0", "size": 60131 }
[ "org.eclipse.jface.viewers.ISelectionChangedListener" ]
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
1,978,258
@Override public JSDocInfo getJSDocInfo() { return docInfo; }
JSDocInfo function() { return docInfo; }
/** * Gets the docInfo for this type. */
Gets the docInfo for this type
getJSDocInfo
{ "repo_name": "MatrixFrog/closure-compiler", "path": "src/com/google/javascript/rhino/jstype/ObjectType.java", "license": "apache-2.0", "size": 26839 }
[ "com.google.javascript.rhino.JSDocInfo" ]
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
1,797,367
public static String wildcardToRegex(String str) { return StringUtils.isEmpty(str) ? str : str.replace("?", ".?").replace("*", ".*?"); // NON-NLS }
static String function(String str) { return StringUtils.isEmpty(str) ? str : str.replace("?", ".?").replace("*", ".*?"); }
/** * Transforms wildcard mask string to regex ready string. * * @param str * wildcard string * @return regex ready string */
Transforms wildcard mask string to regex ready string
wildcardToRegex
{ "repo_name": "Nastel/tnt4j-stream-jmx", "path": "tnt4j-stream-jmx-core/src/main/java/com/jkoolcloud/tnt4j/stream/jmx/utils/Utils.java", "license": "apache-2.0", "size": 10093 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
487,668
public ObjectIdentifierValue findOid(String oid) { MibValue value = ((MibValueSymbol) symbols.get(ISO)).getValue(); ObjectIdentifierValue match = ((ObjectIdentifierValue) value).find(oid); if (match == null) { value = ((MibValueSymbol) symbols.get(CCITT)).getValue(); match = ((ObjectIdentifierValue) value).find(oid); } if (match == null) { value = ((MibValueSymbol) symbols.get(JOINT_ISO_CCITT)).getValue(); match = ((ObjectIdentifierValue) value).find(oid); } return match; }
ObjectIdentifierValue function(String oid) { MibValue value = ((MibValueSymbol) symbols.get(ISO)).getValue(); ObjectIdentifierValue match = ((ObjectIdentifierValue) value).find(oid); if (match == null) { value = ((MibValueSymbol) symbols.get(CCITT)).getValue(); match = ((ObjectIdentifierValue) value).find(oid); } if (match == null) { value = ((MibValueSymbol) symbols.get(JOINT_ISO_CCITT)).getValue(); match = ((ObjectIdentifierValue) value).find(oid); } return match; }
/** * Searches the OID tree for the best matching value. The * returned OID value will be the longest matching OID value, but * doesn't have to be an exact match. The search requires the * full numeric OID value (from the root). * * @param oid the numeric OID string to search for * * @return the best matching OID value, or * null if no partial match was found * * @since 2.10 */
Searches the OID tree for the best matching value. The returned OID value will be the longest matching OID value, but doesn't have to be an exact match. The search requires the full numeric OID value (from the root)
findOid
{ "repo_name": "runner-mei/mibble", "path": "src/main/java/net/percederberg/mibble/DefaultContext.java", "license": "gpl-2.0", "size": 5025 }
[ "net.percederberg.mibble.value.ObjectIdentifierValue" ]
import net.percederberg.mibble.value.ObjectIdentifierValue;
import net.percederberg.mibble.value.*;
[ "net.percederberg.mibble" ]
net.percederberg.mibble;
2,614,620
public static boolean isEnabled() { return CachedFeatureFlags.isEnabled(ChromeFeatureList.PAINT_PREVIEW_SHOW_ON_STARTUP); }
static boolean function() { return CachedFeatureFlags.isEnabled(ChromeFeatureList.PAINT_PREVIEW_SHOW_ON_STARTUP); }
/** * Checks whether the paint preview feature is enabled * @return the feature availability */
Checks whether the paint preview feature is enabled
isEnabled
{ "repo_name": "chromium/chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/paint_preview/StartupPaintPreviewHelper.java", "license": "bsd-3-clause", "size": 9071 }
[ "org.chromium.chrome.browser.flags.CachedFeatureFlags", "org.chromium.chrome.browser.flags.ChromeFeatureList" ]
import org.chromium.chrome.browser.flags.CachedFeatureFlags; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.*;
[ "org.chromium.chrome" ]
org.chromium.chrome;
303,327
@Override public Point2D setToolSize(Point2D size) { Point2D newSize = this.setResolvedToolSize(size); this.onResize(); return newSize; }
Point2D function(Point2D size) { Point2D newSize = this.setResolvedToolSize(size); this.onResize(); return newSize; }
/** * Note: make sure the size here does NOT include padding/margin/border of the tool, otherwise * getToolSize and setToolSize will not be compatible (will be using different values.) */
Note: make sure the size here does NOT include padding/margin/border of the tool, otherwise getToolSize and setToolSize will not be compatible (will be using different values.)
setToolSize
{ "repo_name": "popsimple/popsimple", "path": "website/src/com/project/website/canvas/client/canvastools/base/CanvasToolFrameImpl.java", "license": "gpl-3.0", "size": 21315 }
[ "com.project.shared.data.Point2D" ]
import com.project.shared.data.Point2D;
import com.project.shared.data.*;
[ "com.project.shared" ]
com.project.shared;
1,931,153
public void testExtendsEmpty() { DefDescriptor<T> cmp = addSourceAutoCleanup(getDefClass(), String.format(baseTag, "extends=''", "")); DefType defType = DefType.getDefType(this.getDefClass()); try { definitionService.getDefinition(cmp); fail(defType + " should throw Exception when extends is empty"); } catch (QuickFixException e) { checkExceptionFull(e, InvalidDefinitionException.class, "QualifiedName is required for descriptors"); } }
void function() { DefDescriptor<T> cmp = addSourceAutoCleanup(getDefClass(), String.format(baseTag, STR, STR should throw Exception when extends is emptySTRQualifiedName is required for descriptors"); } }
/** * Verify extending a non-existent component throws correct Exception */
Verify extending a non-existent component throws correct Exception
testExtendsEmpty
{ "repo_name": "badlogicmanpreet/aura", "path": "aura-impl/src/test/java/org/auraframework/impl/root/component/BaseComponentDefTest.java", "license": "apache-2.0", "size": 99025 }
[ "org.auraframework.def.DefDescriptor" ]
import org.auraframework.def.DefDescriptor;
import org.auraframework.def.*;
[ "org.auraframework.def" ]
org.auraframework.def;
1,618,638
public ApiResponse<DevicePricingTiersEnvelope> getPricingTiersWithHttpInfo(String did, Boolean active) throws ApiException { com.squareup.okhttp.Call call = getPricingTiersValidateBeforeCall(did, active, null, null); Type localVarReturnType = new TypeToken<DevicePricingTiersEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
ApiResponse<DevicePricingTiersEnvelope> function(String did, Boolean active) throws ApiException { com.squareup.okhttp.Call call = getPricingTiersValidateBeforeCall(did, active, null, null); Type localVarReturnType = new TypeToken<DevicePricingTiersEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
/** * Get a device&#39;s pricing tiers * Get a device&#39;s pricing tiers * @param did Device ID (required) * @param active Filter by active (optional) * @return ApiResponse&lt;DevicePricingTiersEnvelope&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */
Get a device&#39;s pricing tiers Get a device&#39;s pricing tiers
getPricingTiersWithHttpInfo
{ "repo_name": "artikcloud/artikcloud-java", "path": "src/main/java/cloud/artik/api/MonetizationApi.java", "license": "apache-2.0", "size": 32854 }
[ "cloud.artik.client.ApiException", "cloud.artik.client.ApiResponse", "cloud.artik.model.DevicePricingTiersEnvelope", "com.google.gson.reflect.TypeToken", "java.lang.reflect.Type" ]
import cloud.artik.client.ApiException; import cloud.artik.client.ApiResponse; import cloud.artik.model.DevicePricingTiersEnvelope; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type;
import cloud.artik.client.*; import cloud.artik.model.*; import com.google.gson.reflect.*; import java.lang.reflect.*;
[ "cloud.artik.client", "cloud.artik.model", "com.google.gson", "java.lang" ]
cloud.artik.client; cloud.artik.model; com.google.gson; java.lang;
796,573
boolean setSuppressions(Set<String> suppressions) { lazyInitInfo(); if (info.suppressions != null) { return false; } info.suppressions = suppressions; return true; }
boolean setSuppressions(Set<String> suppressions) { lazyInitInfo(); if (info.suppressions != null) { return false; } info.suppressions = suppressions; return true; }
/** * Sets suppressed warnings. * @param suppressions A list of suppressed warning types. */
Sets suppressed warnings
setSuppressions
{ "repo_name": "ehsan/js-symbolic-executor", "path": "closure-compiler/src/com/google/javascript/rhino/JSDocInfo.java", "license": "apache-2.0", "size": 31979 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,059,928
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner> beginUpdatePortMirroring( String resourceGroupName, String privateCloudName, String portMirroringId, WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) { return beginUpdatePortMirroringAsync( resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring) .getSyncPoller(); }
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner> function( String resourceGroupName, String privateCloudName, String portMirroringId, WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) { return beginUpdatePortMirroringAsync( resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring) .getSyncPoller(); }
/** * Create or update a port mirroring profile by id in a private cloud workload network. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param privateCloudName Name of the private cloud. * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. * @param workloadNetworkPortMirroring NSX port mirroring. * @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 nSX Port Mirroring. */
Create or update a port mirroring profile by id in a private cloud workload network
beginUpdatePortMirroring
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/avs/azure-resourcemanager-avs/src/main/java/com/azure/resourcemanager/avs/implementation/WorkloadNetworksClientImpl.java", "license": "mit", "size": 538828 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkPortMirroringInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkPortMirroringInner;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.avs.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,416,434
private Cursor getContactByAddress(final String address) { final Uri uri = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Email.CONTENT_LOOKUP_URI, Uri.encode(address)); final Cursor c = mContentResolver.query( uri, PROJECTION, null, null, SORT_ORDER); return c; }
Cursor function(final String address) { final Uri uri = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Email.CONTENT_LOOKUP_URI, Uri.encode(address)); final Cursor c = mContentResolver.query( uri, PROJECTION, null, null, SORT_ORDER); return c; }
/** * Return a {@link Cursor} instance that can be used to fetch information * about the contact with the given email address. * * @param address The email address to search for. * @return A {@link Cursor} instance that can be used to fetch information * about the contact with the given email address */
Return a <code>Cursor</code> instance that can be used to fetch information about the contact with the given email address
getContactByAddress
{ "repo_name": "rtreffer/openpgp-k-9", "path": "src/com/fsck/k9/helper/Contacts.java", "license": "bsd-3-clause", "size": 14137 }
[ "android.database.Cursor", "android.net.Uri", "android.provider.ContactsContract" ]
import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract;
import android.database.*; import android.net.*; import android.provider.*;
[ "android.database", "android.net", "android.provider" ]
android.database; android.net; android.provider;
540,887
@Test void onInvoke() { Assumptions.assumeFalse(isTravisEnvironment(), () -> "Aborting test: Travis CI detected"); Assumptions.assumeTrue(initialized); String[] args = {"10", "10"}; //test the connection if one was specified String jdbcUrl = Config.CONFIG.getJdbcUrl(); if (jdbcUrl != null && !"".equals(jdbcUrl)) { //start the database DatabaseManager dbm = DatabaseManager.postgres(); try { dbm.startup(); Assertions.assertTrue(new TestCommand("").invoke(dbm, new FakeContext(testChannel, testSelfMember, testGuild), args)); } finally { dbm.shutdown(); } } //test the internal SQLite db args[0] = args[1] = "2"; DatabaseManager dbm = DatabaseManager.sqlite(); try { dbm.startup(); Assertions.assertTrue(new TestCommand("").invoke(dbm, new FakeContext(testChannel, testSelfMember, testGuild), args)); } finally { dbm.shutdown(); } bumpPassedTests(); }
void onInvoke() { Assumptions.assumeFalse(isTravisEnvironment(), () -> STR); Assumptions.assumeTrue(initialized); String[] args = {"10", "10"}; String jdbcUrl = Config.CONFIG.getJdbcUrl(); if (jdbcUrl != null && !STRSTR2STR").invoke(dbm, new FakeContext(testChannel, testSelfMember, testGuild), args)); } finally { dbm.shutdown(); } bumpPassedTests(); }
/** * Run a small db test */
Run a small db test
onInvoke
{ "repo_name": "napstr/FredBoat", "path": "FredBoat/src/test/java/fredboat/command/admin/TestCommandTest.java", "license": "mit", "size": 1704 }
[ "org.junit.jupiter.api.Assumptions" ]
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.*;
[ "org.junit.jupiter" ]
org.junit.jupiter;
1,244,820
private final Parameter KEYZ_COMMON[] = {Parameter.EVERID}; @Override public String getPValue(TrackingParameter trackingParameter) { SortedMap<Parameter, String> tp = trackingParameter.getDefaultParameter(); return "p=" + Webtrekk.mTrackingLibraryVersion + ",0"; }
final Parameter KEYZ_COMMON[] = {Parameter.EVERID}; public String function(TrackingParameter trackingParameter) { SortedMap<Parameter, String> tp = trackingParameter.getDefaultParameter(); return "p=" + Webtrekk.mTrackingLibraryVersion + ",0"; }
/** * this method is generated p parameter for URL for specific implementation * @param trackingParameter * @return */
this method is generated p parameter for URL for specific implementation
getPValue
{ "repo_name": "Webtrekk/webtrekk-android-sdk", "path": "webtrekk_sdk/src/main/java/com/webtrekk/webtrekksdk/Request/TrackingRequest.java", "license": "mit", "size": 23583 }
[ "com.webtrekk.webtrekksdk.TrackingParameter", "com.webtrekk.webtrekksdk.Webtrekk", "java.util.SortedMap" ]
import com.webtrekk.webtrekksdk.TrackingParameter; import com.webtrekk.webtrekksdk.Webtrekk; import java.util.SortedMap;
import com.webtrekk.webtrekksdk.*; import java.util.*;
[ "com.webtrekk.webtrekksdk", "java.util" ]
com.webtrekk.webtrekksdk; java.util;
2,149,288
@Override InputStream getBodyInputStream();
InputStream getBodyInputStream();
/** * Return the bodyInputStream for large messages * @return */
Return the bodyInputStream for large messages
getBodyInputStream
{ "repo_name": "cshannon/activemq-artemis", "path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientMessage.java", "license": "apache-2.0", "size": 8719 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
145,276
public static List<Element> getData(final Packet packet) { Element iq = packet.getElement(); Element command = iq.getChild(COMMAND_EL); return command.getChildren(); }
static List<Element> function(final Packet packet) { Element iq = packet.getElement(); Element command = iq.getChild(COMMAND_EL); return command.getChildren(); }
/** * Method description * * * @param packet * * @return */
Method description
getData
{ "repo_name": "Smartupz/tigase-server", "path": "src/main/java/tigase/server/Command.java", "license": "agpl-3.0", "size": 29104 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,140,106
void replCommitTxn(CommitTxnRequest rqst) throws LockException;
void replCommitTxn(CommitTxnRequest rqst) throws LockException;
/** * Commit the transaction in target cluster. * * @param rqst Commit transaction request having information related to commit txn and write events. * @throws LockException in case of failure to commit the transaction. */
Commit the transaction in target cluster
replCommitTxn
{ "repo_name": "vineetgarg02/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/lockmgr/HiveTxnManager.java", "license": "apache-2.0", "size": 14014 }
[ "org.apache.hadoop.hive.metastore.api.CommitTxnRequest" ]
import org.apache.hadoop.hive.metastore.api.CommitTxnRequest;
import org.apache.hadoop.hive.metastore.api.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,316,088
public static void registerDataEntryForms(EHRService es, Module module) { // register the generic singular, edit forms Stream.of(Arrays.asList(BREEDING_ENCOUNTER_LABEL, BREEDING_ENCOUNTER_QUERY) , Arrays.asList(PREGNANCY_LABEL, PREGNANCY_QUERY) , Arrays.asList(ULTRASOUND_LABEL, ULTRASOUND_QUERY) , Arrays.asList(PREGNANCY_OUTCOME_LABEL, PREGNANCY_OUTCOME_QUERY) ).map(e -> Breeding.editFactory(module, e.get(0), e.get(1))) .forEach(es::registerFormType); // register the generic bulk entry forms Stream.of(Arrays.asList(BREEDING_ENCOUNTER_LABEL, BREEDING_ENCOUNTER_QUERY, MASTER_PANEL_XTYPE) , Arrays.asList(PREGNANCY_LABEL, PREGNANCY_QUERY, PREGNANCY_PANEL_XTYPE) , Arrays.asList(ULTRASOUND_LABEL, ULTRASOUND_QUERY, ULTRASOUND_PANEL_XTYPE) , Arrays.asList(PREGNANCY_OUTCOME_LABEL, PREGNANCY_OUTCOME_QUERY, MASTER_PANEL_XTYPE) ).map(e -> Breeding.bulkFactory(module, e.get(0), e.get(1), e.get(2))) .forEach(es::registerFormType); }
static void function(EHRService es, Module module) { Stream.of(Arrays.asList(BREEDING_ENCOUNTER_LABEL, BREEDING_ENCOUNTER_QUERY) , Arrays.asList(PREGNANCY_LABEL, PREGNANCY_QUERY) , Arrays.asList(ULTRASOUND_LABEL, ULTRASOUND_QUERY) , Arrays.asList(PREGNANCY_OUTCOME_LABEL, PREGNANCY_OUTCOME_QUERY) ).map(e -> Breeding.editFactory(module, e.get(0), e.get(1))) .forEach(es::registerFormType); Stream.of(Arrays.asList(BREEDING_ENCOUNTER_LABEL, BREEDING_ENCOUNTER_QUERY, MASTER_PANEL_XTYPE) , Arrays.asList(PREGNANCY_LABEL, PREGNANCY_QUERY, PREGNANCY_PANEL_XTYPE) , Arrays.asList(ULTRASOUND_LABEL, ULTRASOUND_QUERY, ULTRASOUND_PANEL_XTYPE) , Arrays.asList(PREGNANCY_OUTCOME_LABEL, PREGNANCY_OUTCOME_QUERY, MASTER_PANEL_XTYPE) ).map(e -> Breeding.bulkFactory(module, e.get(0), e.get(1), e.get(2))) .forEach(es::registerFormType); }
/** * Registers the breeding data entry forms in the passed EHR service for the passed module. * * @param es EHR service instance to register in * @param module Parent module instance for the forms */
Registers the breeding data entry forms in the passed EHR service for the passed module
registerDataEntryForms
{ "repo_name": "WNPRC-EHR-Services/wnprc-modules", "path": "WNPRC_EHR/src/org/labkey/wnprc_ehr/dataentry/forms/Breeding.java", "license": "apache-2.0", "size": 8321 }
[ "java.util.Arrays", "java.util.stream.Stream", "org.labkey.api.ehr.EHRService", "org.labkey.api.module.Module" ]
import java.util.Arrays; import java.util.stream.Stream; import org.labkey.api.ehr.EHRService; import org.labkey.api.module.Module;
import java.util.*; import java.util.stream.*; import org.labkey.api.ehr.*; import org.labkey.api.module.*;
[ "java.util", "org.labkey.api" ]
java.util; org.labkey.api;
2,566,529
protected void loadFile() { //if target file is not null if(targetFile!=null) { //if target file is readable if(targetFile.canRead()) { try { //initialize string builder stringBuilder=new StringBuilder(); //initialize readers fileIn=new FileReader(targetFile); readIn=new BufferedReader(fileIn); //create temp String to store lines read String temp; //build String from file using temp and string builder while((temp = readIn.readLine()) !=null) { stringBuilder.append(temp); } //set text area text to be String built from file this.setText(stringBuilder.toString()); //close streams readIn.close(); fileIn.close(); //update initialText initialText=this.getText(); } catch(IOException e) { //if an error occurs, display error System.err.println(e.getMessage()); } } //if target file cannot be read else { //display a message to open a different file and call openFile JOptionPane.showMessageDialog(null, "The selected file could not be read, \nplease verify you have the appropriate permissions.", "Attention", JOptionPane.YES_NO_OPTION); openFile(); } } //if target is null, all openFile else { openFile(); } }
void function() { if(targetFile!=null) { if(targetFile.canRead()) { try { stringBuilder=new StringBuilder(); fileIn=new FileReader(targetFile); readIn=new BufferedReader(fileIn); String temp; while((temp = readIn.readLine()) !=null) { stringBuilder.append(temp); } this.setText(stringBuilder.toString()); readIn.close(); fileIn.close(); initialText=this.getText(); } catch(IOException e) { System.err.println(e.getMessage()); } } else { JOptionPane.showMessageDialog(null, STR, STR, JOptionPane.YES_NO_OPTION); openFile(); } } else { openFile(); } }
/** * loadFile: Loads currently selected target into text area */
loadFile: Loads currently selected target into text area
loadFile
{ "repo_name": "gmcgibbon/Agilitext-Text-Editor", "path": "SOURCE/src1.1 Ostrich/AgilitextTextArea.java", "license": "gpl-3.0", "size": 10914 }
[ "java.io.BufferedReader", "java.io.FileReader", "java.io.IOException", "javax.swing.JOptionPane" ]
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import javax.swing.JOptionPane;
import java.io.*; import javax.swing.*;
[ "java.io", "javax.swing" ]
java.io; javax.swing;
1,839,925
protected static SAXBuilder createSAXBuilder() throws Exception{ SAXBuilder sb=new SAXBuilder(false); sb.setValidation(false); sb.setExpandEntities(false); return sb; }
static SAXBuilder function() throws Exception{ SAXBuilder sb=new SAXBuilder(false); sb.setValidation(false); sb.setExpandEntities(false); return sb; }
/** * Crea un SAXBuilder * @return * @throws Exception */
Crea un SAXBuilder
createSAXBuilder
{ "repo_name": "projectestac/qv", "path": "qv_applets/src/local/edu/xtec/qv/player/CorrectQVApplet.java", "license": "gpl-2.0", "size": 15648 }
[ "org.jdom.input.SAXBuilder" ]
import org.jdom.input.SAXBuilder;
import org.jdom.input.*;
[ "org.jdom.input" ]
org.jdom.input;
2,211,961
public static void paintScilentPoint(final BufferedImage _bi, final int _x, final int _y, final int _rgb) { //create integer values int x = _x; int y = _y; //transform x coordinate. if (x <= 0) { x = 0; } else if (x >= _bi.getWidth()) { x = _bi.getWidth() - 1; } //transform y coordinate if (y <= 0) { y = 0; } else if (y >= _bi.getHeight()) { y = _bi.getHeight() - 1; } //transform bufferedImage. _bi.setRGB(x, y, _rgb); }
static void function(final BufferedImage _bi, final int _x, final int _y, final int _rgb) { int x = _x; int y = _y; if (x <= 0) { x = 0; } else if (x >= _bi.getWidth()) { x = _bi.getWidth() - 1; } if (y <= 0) { y = 0; } else if (y >= _bi.getHeight()) { y = _bi.getHeight() - 1; } _bi.setRGB(x, y, _rgb); }
/** * Paint point. * @param _bi the bufferedImage * @param _x the x coordinate of point * @param _y the y coordinate of point * @param _rgb the color */
Paint point
paintScilentPoint
{ "repo_name": "juliusHuelsmann/paint", "path": "PaintNotes/src/main/java/model/objects/painting/PaintBI.java", "license": "apache-2.0", "size": 27123 }
[ "java.awt.image.BufferedImage" ]
import java.awt.image.BufferedImage;
import java.awt.image.*;
[ "java.awt" ]
java.awt;
2,048,441
// TODO: Remove? A little dangerous due to ownership Map<Class<? extends Component>, Component> copyComponents(EntityRef original);
Map<Class<? extends Component>, Component> copyComponents(EntityRef original);
/** * Creates a copy of the components of an entity. * * @param original * @return A map of components types to components copied from the target entity. */
Creates a copy of the components of an entity
copyComponents
{ "repo_name": "immortius/Terasology", "path": "engine/src/main/java/org/terasology/entitySystem/entity/EntityManager.java", "license": "apache-2.0", "size": 4584 }
[ "java.util.Map", "org.terasology.entitySystem.Component" ]
import java.util.Map; import org.terasology.entitySystem.Component;
import java.util.*; import org.terasology.*;
[ "java.util", "org.terasology" ]
java.util; org.terasology;
1,737,877
public TBLOB getTBLOB() throws TorqueException { if (aTBLOB == null && (!ObjectUtils.equals(this.iconKey, null))) { aTBLOB = TBLOBPeer.retrieveByPK(SimpleKey.keyFor(this.iconKey)); } return aTBLOB; }
TBLOB function() throws TorqueException { if (aTBLOB == null && (!ObjectUtils.equals(this.iconKey, null))) { aTBLOB = TBLOBPeer.retrieveByPK(SimpleKey.keyFor(this.iconKey)); } return aTBLOB; }
/** * Returns the associated TBLOB object. * If it was not retrieved before, the object is retrieved from * the database * * @return the associated TBLOB object * @throws TorqueException */
Returns the associated TBLOB object. If it was not retrieved before, the object is retrieved from the database
getTBLOB
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTPerson.java", "license": "gpl-3.0", "size": 1013508 }
[ "com.aurel.track.persist.TBLOBPeer", "org.apache.commons.lang.ObjectUtils", "org.apache.torque.TorqueException", "org.apache.torque.om.SimpleKey" ]
import com.aurel.track.persist.TBLOBPeer; import org.apache.commons.lang.ObjectUtils; import org.apache.torque.TorqueException; import org.apache.torque.om.SimpleKey;
import com.aurel.track.persist.*; import org.apache.commons.lang.*; import org.apache.torque.*; import org.apache.torque.om.*;
[ "com.aurel.track", "org.apache.commons", "org.apache.torque" ]
com.aurel.track; org.apache.commons; org.apache.torque;
1,206,769
public void flush() throws IOException { getMiniHBaseCluster().flushcache(); }
void function() throws IOException { getMiniHBaseCluster().flushcache(); }
/** * Flushes all caches in the mini hbase cluster * @throws IOException */
Flushes all caches in the mini hbase cluster
flush
{ "repo_name": "HubSpot/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 173926 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,069,393
public List<Integer> execute() throws IOException{ StringBuilder sb = new StringBuilder(); double[][] sh = new double[maxC-minC+1][numBootstraps]; double[][] ssd = new double[maxC-minC+1][numBootstraps]; HashMap<Integer,Vector<VectorClusterElement>> bestClusterMeans = new HashMap<Integer,Vector<VectorClusterElement>>(); for(int c = minC; c<=maxC; c++){ double bestSh = Double.MIN_VALUE; Vector<VectorClusterElement> bestMeans = null; for(int b=0; b<numBootstraps; b++){ ArrayList<VectorClusterElement> currBS = generateBootStrapSample(); Pair<Pair<Double,Double>,Vector<VectorClusterElement>> currOut = doClustering(c, currBS); double currSH = currOut.car().car(); double currSSD = currOut.car().cdr(); sh[c-minC][b] = currSH; ssd[c-minC][b] = currSSD; sb.append(c);sb.append("\t");sb.append(currSH);sb.append("\t");sb.append("Silhouette");sb.append("\n"); sb.append(c);sb.append("\t");sb.append(currSSD);sb.append("\t");sb.append("SSD");sb.append("\n"); if(bestSh < currSH){ bestSh = currSH; bestMeans = currOut.cdr(); } } bestClusterMeans.put(c, bestMeans); } BufferedWriter bwQual = new BufferedWriter(new FileWriter(outdir.getAbsolutePath()+File.separator+"ClusterQuality.tab")); bwQual.write(sb.toString()); bwQual.close(); double[] mediansSh = new double[maxC-minC+1]; for(int c=0; c<sh.length; c++){ Arrays.sort(sh[c]); int middle = ((numBootstraps) / 2); if(numBootstraps % 2 == 0){ double medianA = sh[c][middle]; double medianB = sh[c][middle-1]; mediansSh[c] = (medianA + medianB) / 2; } else{ mediansSh[c] = sh[c][middle]; } } double maxMedian = Double.MIN_VALUE; int bestC = 0; for(int c=0; c<mediansSh.length; c++){ if(mediansSh[c]>maxMedian){ maxMedian = mediansSh[c]; bestC = c+minC; } } K= bestC; // Caution: the value of K might change in the "writClusters" method also List<Integer> clusAssignment = writeClusters(bestClusterMeans.get(bestC)); return clusAssignment; }
List<Integer> function() throws IOException{ StringBuilder sb = new StringBuilder(); double[][] sh = new double[maxC-minC+1][numBootstraps]; double[][] ssd = new double[maxC-minC+1][numBootstraps]; HashMap<Integer,Vector<VectorClusterElement>> bestClusterMeans = new HashMap<Integer,Vector<VectorClusterElement>>(); for(int c = minC; c<=maxC; c++){ double bestSh = Double.MIN_VALUE; Vector<VectorClusterElement> bestMeans = null; for(int b=0; b<numBootstraps; b++){ ArrayList<VectorClusterElement> currBS = generateBootStrapSample(); Pair<Pair<Double,Double>,Vector<VectorClusterElement>> currOut = doClustering(c, currBS); double currSH = currOut.car().car(); double currSSD = currOut.car().cdr(); sh[c-minC][b] = currSH; ssd[c-minC][b] = currSSD; sb.append(c);sb.append("\t");sb.append(currSH);sb.append("\t");sb.append(STR);sb.append("\n"); sb.append(c);sb.append("\t");sb.append(currSSD);sb.append("\t");sb.append("SSD");sb.append("\n"); if(bestSh < currSH){ bestSh = currSH; bestMeans = currOut.cdr(); } } bestClusterMeans.put(c, bestMeans); } BufferedWriter bwQual = new BufferedWriter(new FileWriter(outdir.getAbsolutePath()+File.separator+STR)); bwQual.write(sb.toString()); bwQual.close(); double[] mediansSh = new double[maxC-minC+1]; for(int c=0; c<sh.length; c++){ Arrays.sort(sh[c]); int middle = ((numBootstraps) / 2); if(numBootstraps % 2 == 0){ double medianA = sh[c][middle]; double medianB = sh[c][middle-1]; mediansSh[c] = (medianA + medianB) / 2; } else{ mediansSh[c] = sh[c][middle]; } } double maxMedian = Double.MIN_VALUE; int bestC = 0; for(int c=0; c<mediansSh.length; c++){ if(mediansSh[c]>maxMedian){ maxMedian = mediansSh[c]; bestC = c+minC; } } K= bestC; List<Integer> clusAssignment = writeClusters(bestClusterMeans.get(bestC)); return clusAssignment; }
/** * The method that should be executed after initiating the class object * @throws IOException */
The method that should be executed after initiating the class object
execute
{ "repo_name": "seqcode/sequnwinder", "path": "src/org/seqcode/projects/sequnwinder/clusterkmerprofile/ClusterProfiles.java", "license": "mit", "size": 11260 }
[ "java.io.BufferedWriter", "java.io.File", "java.io.FileWriter", "java.io.IOException", "java.util.ArrayList", "java.util.Arrays", "java.util.HashMap", "java.util.List", "java.util.Vector", "org.seqcode.gseutils.Pair", "org.seqcode.ml.clustering.vectorcluster.VectorClusterElement" ]
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Vector; import org.seqcode.gseutils.Pair; import org.seqcode.ml.clustering.vectorcluster.VectorClusterElement;
import java.io.*; import java.util.*; import org.seqcode.gseutils.*; import org.seqcode.ml.clustering.vectorcluster.*;
[ "java.io", "java.util", "org.seqcode.gseutils", "org.seqcode.ml" ]
java.io; java.util; org.seqcode.gseutils; org.seqcode.ml;
2,187,090
private GeneratorSetDocWriter createWriter( File file) { try { return new GeneratorSetDocWriter( new FileWriter( file)); } catch( Exception e) { throw new RuntimeException( "Can't open file=" + file, e); } }
GeneratorSetDocWriter function( File file) { try { return new GeneratorSetDocWriter( new FileWriter( file)); } catch( Exception e) { throw new RuntimeException( STR + file, e); } }
/** * Creates a {@link GeneratorSetDocWriter} for the given file. */
Creates a <code>GeneratorSetDocWriter</code> for the given file
createWriter
{ "repo_name": "Cornutum/tcases", "path": "tcases-io/src/test/java/org/cornutum/tcases/generator/io/GeneratorSetResources.java", "license": "mit", "size": 4520 }
[ "java.io.File", "java.io.FileWriter" ]
import java.io.File; import java.io.FileWriter;
import java.io.*;
[ "java.io" ]
java.io;
2,535,968
public static String escapeAssignmentFeedback(String value) { if (value == null || value.length() == 0) return value; value = fixAssignmentFeedback(value); StringBuilder buf = new StringBuilder(value); int pos = -1; while ((pos = buf.indexOf("{{")) != -1) { buf.replace(pos, pos + "{{".length(), "<span class='highlight'>"); } while ((pos = buf.indexOf("}}")) != -1) { buf.replace(pos, pos + "}}".length(), "</span>"); } return FormattedText.escapeHtmlFormattedText(buf.toString()); }
static String function(String value) { if (value == null value.length() == 0) return value; value = fixAssignmentFeedback(value); StringBuilder buf = new StringBuilder(value); int pos = -1; while ((pos = buf.indexOf("{{")) != -1) { buf.replace(pos, pos + "{{".length(), STR); } while ((pos = buf.indexOf("}}")) != -1) { buf.replace(pos, pos + "}}".length(), STR); } return FormattedText.escapeHtmlFormattedText(buf.toString()); }
/** * Called to deal with old Chef-style assignment feedback annotation, {{like this}}. * * @param value * A formatted text string that may contain {{}} style markup * @return HTML ready to for display on a browser */
Called to deal with old Chef-style assignment feedback annotation, {{like this}}
escapeAssignmentFeedback
{ "repo_name": "udayg/sakai", "path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java", "license": "apache-2.0", "size": 672322 }
[ "org.sakaiproject.util.FormattedText" ]
import org.sakaiproject.util.FormattedText;
import org.sakaiproject.util.*;
[ "org.sakaiproject.util" ]
org.sakaiproject.util;
1,838,744
public void setOverrideProperties(Properties overrideProperties) { this.overrideProperties = overrideProperties; }
void function(Properties overrideProperties) { this.overrideProperties = overrideProperties; }
/** * Sets a special list of override properties that take precedence and will use first, if a property exist. */
Sets a special list of override properties that take precedence and will use first, if a property exist
setOverrideProperties
{ "repo_name": "tadayosi/camel", "path": "core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java", "license": "apache-2.0", "size": 65677 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
2,139,510
private static Collection<TypeQualifierAnnotation> getApplicableScopedApplications(XMethod o, int parameter) { Set<TypeQualifierAnnotation> result = new HashSet<TypeQualifierAnnotation>(); ElementType e = ElementType.PARAMETER; getApplicableScopedApplications(result, o, e); getDirectApplications(result, o, parameter); return result; }
static Collection<TypeQualifierAnnotation> function(XMethod o, int parameter) { Set<TypeQualifierAnnotation> result = new HashSet<TypeQualifierAnnotation>(); ElementType e = ElementType.PARAMETER; getApplicableScopedApplications(result, o, e); getDirectApplications(result, o, parameter); return result; }
/** * Get the collection of resolved TypeQualifierAnnotations for a given * parameter, taking into account annotations applied to outer scopes (e.g., * enclosing classes and packages.) * * @param o * a method * @param parameter * a parameter (0 == first parameter) * @return Collection of resolved TypeQualifierAnnotations */
Get the collection of resolved TypeQualifierAnnotations for a given parameter, taking into account annotations applied to outer scopes (e.g., enclosing classes and packages.)
getApplicableScopedApplications
{ "repo_name": "OpenNTF/FindBug-for-Domino-Designer", "path": "findBugsEclipsePlugin/src/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java", "license": "lgpl-3.0", "size": 44560 }
[ "edu.umd.cs.findbugs.ba.XMethod", "java.lang.annotation.ElementType", "java.util.Collection", "java.util.HashSet", "java.util.Set" ]
import edu.umd.cs.findbugs.ba.XMethod; import java.lang.annotation.ElementType; import java.util.Collection; import java.util.HashSet; import java.util.Set;
import edu.umd.cs.findbugs.ba.*; import java.lang.annotation.*; import java.util.*;
[ "edu.umd.cs", "java.lang", "java.util" ]
edu.umd.cs; java.lang; java.util;
2,289,760
public static List<File> sortInBatch(final BufferedReader fbr, final long datalength, final Comparator<String> cmp, final boolean distinct) throws IOException { return sortInBatch(fbr, datalength, cmp, DEFAULTMAXTEMPFILES, estimateAvailableMemory(), Charset.defaultCharset(), null, distinct, 0, false); }
static List<File> function(final BufferedReader fbr, final long datalength, final Comparator<String> cmp, final boolean distinct) throws IOException { return sortInBatch(fbr, datalength, cmp, DEFAULTMAXTEMPFILES, estimateAvailableMemory(), Charset.defaultCharset(), null, distinct, 0, false); }
/** * This will simply load the file by blocks of lines, then sort them * in-memory, and write the result to temporary files that have to be * merged later. * * @param fbr * data source * @param datalength * estimated data volume (in bytes) * @param cmp * string comparator * @param distinct * Pass <code>true</code> if duplicate lines should be * discarded. * @return a list of temporary flat files * @throws IOException */
This will simply load the file by blocks of lines, then sort them in-memory, and write the result to temporary files that have to be merged later
sortInBatch
{ "repo_name": "wkapil/distributedexternalsort", "path": "src/main/java/com/google/code/externalsorting/ExternalSortParallelStreamSort.java", "license": "apache-2.0", "size": 25354 }
[ "java.io.BufferedReader", "java.io.File", "java.io.IOException", "java.nio.charset.Charset", "java.util.Comparator", "java.util.List" ]
import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.util.Comparator; import java.util.List;
import java.io.*; import java.nio.charset.*; import java.util.*;
[ "java.io", "java.nio", "java.util" ]
java.io; java.nio; java.util;
1,121,928
@Test(groups= {"ut"}) public void testCompareStepInErrorWithReferenceNoReferenceSnapshot() throws Exception { stepFailed.getSnapshots().removeAll(stepFailed.getSnapshots()); ITestResult testResult = Reporter.getCurrentTestResult(); TestNGResultUtils.setSeleniumRobotTestContext(testResult, SeleniumTestsContextManager.getThreadContext()); SeleniumTestsContextManager.getThreadContext().getTestStepManager().setTestSteps(Arrays.asList(step1, stepFailed, lastStep)); PowerMockito.whenNew(StepReferenceComparator.class).withAnyArguments().thenReturn(stepReferenceComparatorStep2); List<ErrorCause> causes = new ErrorCauseFinder(testResult).compareStepInErrorWithReference(); // no comparison done PowerMockito.verifyNew(StepReferenceComparator.class, never()).withArguments(any(File.class), any(File.class));; Assert.assertEquals(causes.size(), 0); Assert.assertTrue(TestNGResultUtils.isErrorCauseSearchedInReferencePicture(testResult)); }
@Test(groups= {"ut"}) void function() throws Exception { stepFailed.getSnapshots().removeAll(stepFailed.getSnapshots()); ITestResult testResult = Reporter.getCurrentTestResult(); TestNGResultUtils.setSeleniumRobotTestContext(testResult, SeleniumTestsContextManager.getThreadContext()); SeleniumTestsContextManager.getThreadContext().getTestStepManager().setTestSteps(Arrays.asList(step1, stepFailed, lastStep)); PowerMockito.whenNew(StepReferenceComparator.class).withAnyArguments().thenReturn(stepReferenceComparatorStep2); List<ErrorCause> causes = new ErrorCauseFinder(testResult).compareStepInErrorWithReference(); PowerMockito.verifyNew(StepReferenceComparator.class, never()).withArguments(any(File.class), any(File.class));; Assert.assertEquals(causes.size(), 0); Assert.assertTrue(TestNGResultUtils.isErrorCauseSearchedInReferencePicture(testResult)); }
/** * Failed test step does not contain a "reference snapshot" so there is no way to compare it to the one stored on server * No error should be raised * @throws Exception */
Failed test step does not contain a "reference snapshot" so there is no way to compare it to the one stored on server No error should be raised
testCompareStepInErrorWithReferenceNoReferenceSnapshot
{ "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", "com.seleniumtests.util.imaging.StepReferenceComparator", "java.io.File", "java.util.Arrays", ...
import com.seleniumtests.core.SeleniumTestsContextManager; import com.seleniumtests.core.testanalysis.ErrorCause; import com.seleniumtests.core.testanalysis.ErrorCauseFinder; import com.seleniumtests.core.utils.TestNGResultUtils; import com.seleniumtests.util.imaging.StepReferenceComparator; import java.io.File; import java.util.Arrays; import java.util.List; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; 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 com.seleniumtests.util.imaging.*; import java.io.*; import java.util.*; import org.mockito.*; import org.powermock.api.mockito.*; import org.testng.*; import org.testng.annotations.*;
[ "com.seleniumtests.core", "com.seleniumtests.util", "java.io", "java.util", "org.mockito", "org.powermock.api", "org.testng", "org.testng.annotations" ]
com.seleniumtests.core; com.seleniumtests.util; java.io; java.util; org.mockito; org.powermock.api; org.testng; org.testng.annotations;
1,079,916
protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) { boolean bSesnValid = this.isSesnValid(); if (!bSesnValid) { if (this.getDST() != null) { logger.debug("session invalid, setting dead authentication, and pushing through to attemptAuthentication"); SecurityContextHolder.getContext().setAuthentication(new KualiDistributedSessionExpiredAuthentication()); return true; } } return super.requiresAuthentication(request, response); }
boolean function(HttpServletRequest request, HttpServletResponse response) { boolean bSesnValid = this.isSesnValid(); if (!bSesnValid) { if (this.getDST() != null) { logger.debug(STR); SecurityContextHolder.getContext().setAuthentication(new KualiDistributedSessionExpiredAuthentication()); return true; } } return super.requiresAuthentication(request, response); }
/** * This overridden method checks if the DST is valid. If it's not, the * authentication is set to a new, non-authenticated, * {@link KualiDistributedSessionExpiredAuthentication} which is the * indication for {@link attemptAuthentication} that the session has * expired * * @return true if DST is inValid or if super method returns true * @see org.acegisecurity.ui.AbstractProcessingFilter#requiresAuthentication(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */
This overridden method checks if the DST is valid. If it's not, the authentication is set to a new, non-authenticated, <code>KualiDistributedSessionExpiredAuthentication</code> which is the indication for <code>attemptAuthentication</code> that the session has expired
requiresAuthentication
{ "repo_name": "ewestfal/rice", "path": "rice-middleware/client-contrib/src/main/java/org/kuali/rice/kim/client/acegi/KualiDistributedSessionFilter.java", "license": "apache-2.0", "size": 6205 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.acegisecurity.context.SecurityContextHolder" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.acegisecurity.context.SecurityContextHolder;
import javax.servlet.http.*; import org.acegisecurity.context.*;
[ "javax.servlet", "org.acegisecurity.context" ]
javax.servlet; org.acegisecurity.context;
1,834,042
public void updateUserLocales(IPerson person, Locale[] locales);
void function(IPerson person, Locale[] locales);
/** * Persists the locale preferences for a particular user. * @param person the user * @param locales the user's new locale preferences * @throws Exception */
Persists the locale preferences for a particular user
updateUserLocales
{ "repo_name": "kole9273/uPortal", "path": "uportal-war/src/main/java/org/jasig/portal/i18n/ILocaleStore.java", "license": "apache-2.0", "size": 1582 }
[ "java.util.Locale", "org.jasig.portal.security.IPerson" ]
import java.util.Locale; import org.jasig.portal.security.IPerson;
import java.util.*; import org.jasig.portal.security.*;
[ "java.util", "org.jasig.portal" ]
java.util; org.jasig.portal;
909,799
@SuppressWarnings("unchecked") public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of( E e1, E e2, E e3, E e4, E e5, E e6, E... remaining) { int size = remaining.length + 6; List<E> all = Lists.newArrayListWithCapacity(size); Collections.addAll(all, e1, e2, e3, e4, e5, e6); Collections.addAll(all, remaining); return copyOf(Ordering.natural(), all); }
@SuppressWarnings(STR) static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> function( E e1, E e2, E e3, E e4, E e5, E e6, E... remaining) { int size = remaining.length + 6; List<E> all = Lists.newArrayListWithCapacity(size); Collections.addAll(all, e1, e2, e3, e4, e5, e6); Collections.addAll(all, remaining); return copyOf(Ordering.natural(), all); }
/** * Returns an immutable sorted multiset containing the given elements sorted by their natural * ordering. * * @throws NullPointerException if any element is null */
Returns an immutable sorted multiset containing the given elements sorted by their natural ordering
of
{ "repo_name": "rgoldberg/guava", "path": "guava/src/com/google/common/collect/ImmutableSortedMultiset.java", "license": "apache-2.0", "size": 22778 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
680,599
@Nullable protected com.google.gson.JsonElement cumulative; @Nonnull public WorkbookFunctionsBeta_DistParameterSetBuilder withCumulative(@Nullable final com.google.gson.JsonElement val) { this.cumulative = val; return this; }
com.google.gson.JsonElement cumulative; public WorkbookFunctionsBeta_DistParameterSetBuilder function(@Nullable final com.google.gson.JsonElement val) { this.cumulative = val; return this; }
/** * Sets the Cumulative * @param val the value to set it to * @return the current builder object */
Sets the Cumulative
withCumulative
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/models/WorkbookFunctionsBeta_DistParameterSet.java", "license": "mit", "size": 7435 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
630,665
@Override public void setCluster(Cluster cluster) { Cluster oldCluster = null; Lock writeLock = clusterLock.writeLock(); writeLock.lock(); try { // Change components if necessary oldCluster = this.cluster; if (oldCluster == cluster) return; this.cluster = cluster; // Stop the old component if necessary if (getState().isAvailable() && (oldCluster != null) && (oldCluster instanceof Lifecycle)) { try { ((Lifecycle) oldCluster).stop(); } catch (LifecycleException e) { log.error("ContainerBase.setCluster: stop: ", e); } } // Start the new component if necessary if (cluster != null) cluster.setContainer(this); if (getState().isAvailable() && (cluster != null) && (cluster instanceof Lifecycle)) { try { ((Lifecycle) cluster).start(); } catch (LifecycleException e) { log.error("ContainerBase.setCluster: start: ", e); } } } finally { writeLock.unlock(); } // Report this property change to interested listeners support.firePropertyChange("cluster", oldCluster, cluster); }
void function(Cluster cluster) { Cluster oldCluster = null; Lock writeLock = clusterLock.writeLock(); writeLock.lock(); try { oldCluster = this.cluster; if (oldCluster == cluster) return; this.cluster = cluster; if (getState().isAvailable() && (oldCluster != null) && (oldCluster instanceof Lifecycle)) { try { ((Lifecycle) oldCluster).stop(); } catch (LifecycleException e) { log.error(STR, e); } } if (cluster != null) cluster.setContainer(this); if (getState().isAvailable() && (cluster != null) && (cluster instanceof Lifecycle)) { try { ((Lifecycle) cluster).start(); } catch (LifecycleException e) { log.error(STR, e); } } } finally { writeLock.unlock(); } support.firePropertyChange(STR, oldCluster, cluster); }
/** * Set the Cluster with which this Container is associated. * * @param cluster The newly associated Cluster */
Set the Cluster with which this Container is associated
setCluster
{ "repo_name": "Nickname0806/Test_Q4", "path": "java/org/apache/catalina/core/ContainerBase.java", "license": "apache-2.0", "size": 45391 }
[ "java.util.concurrent.locks.Lock", "org.apache.catalina.Cluster", "org.apache.catalina.Lifecycle", "org.apache.catalina.LifecycleException" ]
import java.util.concurrent.locks.Lock; import org.apache.catalina.Cluster; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException;
import java.util.concurrent.locks.*; import org.apache.catalina.*;
[ "java.util", "org.apache.catalina" ]
java.util; org.apache.catalina;
1,409,620
public void resendCreditCreatedEmail(String code) throws Exception { MozuClient client = com.mozu.api.clients.commerce.customer.CreditClient.resendCreditCreatedEmailClient( code); client.setContext(_apiContext); client.executeRequest(); client.cleanupHttpConnection(); }
void function(String code) throws Exception { MozuClient client = com.mozu.api.clients.commerce.customer.CreditClient.resendCreditCreatedEmailClient( code); client.setContext(_apiContext); client.executeRequest(); client.cleanupHttpConnection(); }
/** * customer-credits Put ResendCreditCreatedEmail description DOCUMENT_HERE * <p><pre><code> * Credit credit = new Credit(); * credit.resendCreditCreatedEmail( code); * </code></pre></p> * @param code User-defined code that uniqely identifies the channel group. * @return */
customer-credits Put ResendCreditCreatedEmail description DOCUMENT_HERE <code><code> Credit credit = new Credit(); credit.resendCreditCreatedEmail( code); </code></code>
resendCreditCreatedEmail
{ "repo_name": "lakshmi-nair/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/resources/commerce/customer/CreditResource.java", "license": "mit", "size": 11729 }
[ "com.mozu.api.MozuClient" ]
import com.mozu.api.MozuClient;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
1,312,814
public void addSentenceListener(SentenceListener sl, SentenceId type) { registerListener(type.toString(), sl); }
void function(SentenceListener sl, SentenceId type) { registerListener(type.toString(), sl); }
/** * Adds a {@link SentenceListener} that is interested in receiving only * sentences of certain type. * * @param sl SentenceListener to add * @param type Sentence type for which the listener is registered. * @see net.sf.marineapi.nmea.event.SentenceListener */
Adds a <code>SentenceListener</code> that is interested in receiving only sentences of certain type
addSentenceListener
{ "repo_name": "SignalK/signalk-core-java", "path": "src/main/java/nz/co/fortytwo/signalk/handler/NMEAHandler.java", "license": "apache-2.0", "size": 20012 }
[ "net.sf.marineapi.nmea.event.SentenceListener", "net.sf.marineapi.nmea.sentence.SentenceId" ]
import net.sf.marineapi.nmea.event.SentenceListener; import net.sf.marineapi.nmea.sentence.SentenceId;
import net.sf.marineapi.nmea.event.*; import net.sf.marineapi.nmea.sentence.*;
[ "net.sf.marineapi" ]
net.sf.marineapi;
1,247,628
public static String getAsterixDBURL(Configuration conf) { return conf.get(PregelixJob.ASTERIXDB_URL); }
static String function(Configuration conf) { return conf.get(PregelixJob.ASTERIXDB_URL); }
/** * Gets AsterixDB URL */
Gets AsterixDB URL
getAsterixDBURL
{ "repo_name": "sigmod/asterixdb-analytics", "path": "pregelix/pregelix-api/src/main/java/edu/uci/ics/pregelix/api/util/BspUtils.java", "license": "apache-2.0", "size": 39926 }
[ "edu.uci.ics.pregelix.api.job.PregelixJob", "org.apache.hadoop.conf.Configuration" ]
import edu.uci.ics.pregelix.api.job.PregelixJob; import org.apache.hadoop.conf.Configuration;
import edu.uci.ics.pregelix.api.job.*; import org.apache.hadoop.conf.*;
[ "edu.uci.ics", "org.apache.hadoop" ]
edu.uci.ics; org.apache.hadoop;
1,979,128
public static <T> List<T> readNullableCollection(BinaryRawReaderEx reader) { return readNullableCollection(reader, null); }
static <T> List<T> function(BinaryRawReaderEx reader) { return readNullableCollection(reader, null); }
/** * Read nullable collection. * * @param reader Reader. * @return List. */
Read nullable collection
readNullableCollection
{ "repo_name": "andrey-kuznetsov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java", "license": "apache-2.0", "size": 39937 }
[ "java.util.List", "org.apache.ignite.internal.binary.BinaryRawReaderEx" ]
import java.util.List; import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import java.util.*; import org.apache.ignite.internal.binary.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
1,781,572
protected boolean release(InternalDistributedMember grantor, String serviceName, boolean lockBatch, int lockId) { DM dm = getDistributionManager(); DLockReleaseMessage msg = new DLockReleaseMessage(); msg.processorId = getProcessorId(); msg.serviceName = serviceName; msg.objectName = this.objectName; msg.lockBatch = lockBatch; msg.lockId = lockId; msg.setRecipient(grantor); if (grantor.equals(dm.getId())) { // local... don't message... msg.setSender(grantor); msg.processLocally(dm); } else { dm.putOutgoing(msg); } // keep waiting even if interrupted try { waitForRepliesUninterruptibly(); } catch (ReplyException e) { e.handleAsUnexpected(); } if (this.reply == null) return false; return this.reply.replyCode == DLockReleaseReplyMessage.OK; }
boolean function(InternalDistributedMember grantor, String serviceName, boolean lockBatch, int lockId) { DM dm = getDistributionManager(); DLockReleaseMessage msg = new DLockReleaseMessage(); msg.processorId = getProcessorId(); msg.serviceName = serviceName; msg.objectName = this.objectName; msg.lockBatch = lockBatch; msg.lockId = lockId; msg.setRecipient(grantor); if (grantor.equals(dm.getId())) { msg.setSender(grantor); msg.processLocally(dm); } else { dm.putOutgoing(msg); } try { waitForRepliesUninterruptibly(); } catch (ReplyException e) { e.handleAsUnexpected(); } if (this.reply == null) return false; return this.reply.replyCode == DLockReleaseReplyMessage.OK; }
/** Returns true if release was acknowledged by the grantor; false means * we targeted someone who is not the grantor */
Returns true if release was acknowledged by the grantor; false means
release
{ "repo_name": "robertgeiger/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/DLockReleaseProcessor.java", "license": "apache-2.0", "size": 15484 }
[ "com.gemstone.gemfire.distributed.internal.ReplyException", "com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember" ]
import com.gemstone.gemfire.distributed.internal.ReplyException; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.distributed.internal.membership.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
1,718,660
private void testJournaledMethod(String methodName, Object... arguments) throws ServerException { buildExpectedCall(methodName, arguments); setupLeader(); executeManagmentMethod(creator, methodName, arguments); closeLeader(); setupFollower(); letFollowerCatchUp(); assertExpectedCall("leading", leadingDelegate); assertExpectedCall("following", followingDelegate); try { executeManagmentMethod(consumer, methodName, arguments); fail("expected an InvalidStateException"); } catch (InvalidStateException e) { // That's the one we expected. } }
void function(String methodName, Object... arguments) throws ServerException { buildExpectedCall(methodName, arguments); setupLeader(); executeManagmentMethod(creator, methodName, arguments); closeLeader(); setupFollower(); letFollowerCatchUp(); assertExpectedCall(STR, leadingDelegate); assertExpectedCall(STR, followingDelegate); try { executeManagmentMethod(consumer, methodName, arguments); fail(STR); } catch (InvalidStateException e) { } }
/** * <p> * Test a Journaled method. * </p> * <p> * Call the selected method on the JournalCreator. Then tell the * JournalConsumer to process the journal. Compare the calls received by * both Management delegates to the call we expected them to see. * </p> * <p> * Calling the method directly on the JournalConsumer should produce an * exception. * </p> * * @throws ModuleInitializationException * @throws ModuleShutdownException */
Test a Journaled method. Call the selected method on the JournalCreator. Then tell the JournalConsumer to process the journal. Compare the calls received by both Management delegates to the call we expected them to see. Calling the method directly on the JournalConsumer should produce an exception.
testJournaledMethod
{ "repo_name": "FLVC/fcrepo-src-3.4.2", "path": "fcrepo-server/src/test/java/org/fcrepo/server/journal/TestJournalRoundTrip.java", "license": "apache-2.0", "size": 22132 }
[ "junit.framework.Assert", "org.fcrepo.server.errors.InvalidStateException", "org.fcrepo.server.errors.ServerException" ]
import junit.framework.Assert; import org.fcrepo.server.errors.InvalidStateException; import org.fcrepo.server.errors.ServerException;
import junit.framework.*; import org.fcrepo.server.errors.*;
[ "junit.framework", "org.fcrepo.server" ]
junit.framework; org.fcrepo.server;
1,229,912
void reorder(@NotNull Comparator pComparator, @NotNull Set<Object> pAttributes);
void reorder(@NotNull Comparator pComparator, @NotNull Set<Object> pAttributes);
/** * Reorders the child nodes using the given comparator. * * @param pComparator the comparator used to order the children. * @param pAttributes additional attributes describing this change. */
Reorders the child nodes using the given comparator
reorder
{ "repo_name": "aditosoftware/propertly", "path": "propertly.core/src/main/java/de/adito/propertly/core/api/INode.java", "license": "mit", "size": 5738 }
[ "java.util.Comparator", "java.util.Set", "org.jetbrains.annotations.NotNull" ]
import java.util.Comparator; import java.util.Set; import org.jetbrains.annotations.NotNull;
import java.util.*; import org.jetbrains.annotations.*;
[ "java.util", "org.jetbrains.annotations" ]
java.util; org.jetbrains.annotations;
2,324,019
public boolean isPickingPass() { return GLGraphicsUtils.isPickingPass(gl); } // #############
boolean function() { return GLGraphicsUtils.isPickingPass(gl); }
/** * returns whether we are currently in the picking pass * * @return */
returns whether we are currently in the picking pass
isPickingPass
{ "repo_name": "Caleydo/caleydo", "path": "org.caleydo.ui/src/org/caleydo/core/view/opengl/layout2/GLGraphics.java", "license": "bsd-3-clause", "size": 22476 }
[ "org.caleydo.core.view.opengl.layout2.util.GLGraphicsUtils" ]
import org.caleydo.core.view.opengl.layout2.util.GLGraphicsUtils;
import org.caleydo.core.view.opengl.layout2.util.*;
[ "org.caleydo.core" ]
org.caleydo.core;
307,744
default Collection<PropertySource> getPropertySources(Predicate<PropertySource> selector){ return getPropertySources().stream().filter(selector).collect(Collectors.toList()); } /** * <p> * This method returns the Map of registered PropertyConverters * per type. * The List for each type is ordered via their {@link javax.annotation.Priority} and * class name. * </p> * <p> * A simplified scenario could be like: * <pre> * { * Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter } * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter} * Integer.class -> {DynamicDefaultConverter} * }
default Collection<PropertySource> getPropertySources(Predicate<PropertySource> selector){ return getPropertySources().stream().filter(selector).collect(Collectors.toList()); } /** * <p> * This method returns the Map of registered PropertyConverters * per type. * The List for each type is ordered via their {@link javax.annotation.Priority} and * class name. * </p> * <p> * A simplified scenario could be like: * <pre> * { * Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter } * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter} * Integer.class -> {DynamicDefaultConverter} * }
/** * This method returns a subset ot the currently registered PropertySources. * * @param selector the selector query, not null. * @return a collectino of selected PropertySources. */
This method returns a subset ot the currently registered PropertySources
getPropertySources
{ "repo_name": "syzer/incubator-tamaya", "path": "java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java", "license": "apache-2.0", "size": 6116 }
[ "java.util.Collection", "java.util.List", "java.util.Map", "java.util.function.Predicate", "java.util.stream.Collectors" ]
import java.util.Collection; import java.util.List; import java.util.Map; import java.util.function.Predicate; import java.util.stream.Collectors;
import java.util.*; import java.util.function.*; import java.util.stream.*;
[ "java.util" ]
java.util;
52,477
Properties properties = new Properties(); if (host == null) throw new ConnectionException("[" + HbaseConfig.ZOOKEEPER_QUORUM_PROPERTY + "] is required !"); properties.setProperty(HbaseConfig.ZOOKEEPER_QUORUM_PROPERTY, host); if (port == null) throw new ConnectionException("[" + HbaseConfig.ZOOKEEPER_CLIENTPORT_PROPERTY + "] is required !"); properties.setProperty(HbaseConfig.ZOOKEEPER_CLIENTPORT_PROPERTY, port); if (master != null) properties.setProperty(HbaseConfig.MASTER_PROPERTY, master); if (rootdir != null) properties.setProperty(HbaseConfig.ROOTDIR_PROPERTY, rootdir); return getInstance(properties); }
Properties properties = new Properties(); if (host == null) throw new ConnectionException("[" + HbaseConfig.ZOOKEEPER_QUORUM_PROPERTY + STR); properties.setProperty(HbaseConfig.ZOOKEEPER_QUORUM_PROPERTY, host); if (port == null) throw new ConnectionException("[" + HbaseConfig.ZOOKEEPER_CLIENTPORT_PROPERTY + STR); properties.setProperty(HbaseConfig.ZOOKEEPER_CLIENTPORT_PROPERTY, port); if (master != null) properties.setProperty(HbaseConfig.MASTER_PROPERTY, master); if (rootdir != null) properties.setProperty(HbaseConfig.ROOTDIR_PROPERTY, rootdir); return getInstance(properties); }
/** * Gets instance. * * @param host the host * @param port the port * @param master the master * @param rootdir the rootdir * @return the instance */
Gets instance
getInstance
{ "repo_name": "DarkPhoenixs/connection-pool-client", "path": "src/main/java/org/darkphoenixs/pool/hbase/HbaseSharedConnPool.java", "license": "apache-2.0", "size": 3678 }
[ "java.util.Properties", "org.darkphoenixs.pool.ConnectionException" ]
import java.util.Properties; import org.darkphoenixs.pool.ConnectionException;
import java.util.*; import org.darkphoenixs.pool.*;
[ "java.util", "org.darkphoenixs.pool" ]
java.util; org.darkphoenixs.pool;
619,848
public void generateBitmapUsingJava2D(File outputFile, String format) throws IOException { //String compression = "CCITT T.6"; String compression = "PackBits"; OutputStream out = FileOutputStream(outputFile); out = BufferedOutputStream(out); try { ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor(format); ImageWriterParams params = new ImageWriterParams(); params.setCompressionMethod(compression); params.setResolution(72); if (writer.supportsMultiImageWriter()) { MultiImageWriter multiWriter = writer.createMultiImageWriter(out); multiWriter.writeImage(createAnImage(compression, 1), params); multiWriter.writeImage(createAnImage(compression, 2), params); multiWriter.close(); } else { throw new UnsupportedOperationException("multi-page images not supported for " + format); } } finally { IOUtils.closeQuietly(out); } }
void function(File outputFile, String format) throws IOException { String compression = STR; OutputStream out = FileOutputStream(outputFile); out = BufferedOutputStream(out); try { ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor(format); ImageWriterParams params = new ImageWriterParams(); params.setCompressionMethod(compression); params.setResolution(72); if (writer.supportsMultiImageWriter()) { MultiImageWriter multiWriter = writer.createMultiImageWriter(out); multiWriter.writeImage(createAnImage(compression, 1), params); multiWriter.writeImage(createAnImage(compression, 2), params); multiWriter.close(); } else { throw new UnsupportedOperationException(STR + format); } } finally { IOUtils.closeQuietly(out); } }
/** * Creates a bitmap file. We paint a few things on a bitmap and then save the bitmap using * an ImageWriter. * @param outputFile the target file * @param format the target format (a MIME type, ex. "image/png") * @throws IOException In case of an I/O error */
Creates a bitmap file. We paint a few things on a bitmap and then save the bitmap using an ImageWriter
generateBitmapUsingJava2D
{ "repo_name": "Guronzan/Apache-XmlGraphics", "path": "examples/java/image/writer/ImageWriterExample2.java", "license": "apache-2.0", "size": 4325 }
[ "java.io.File", "java.io.IOException", "java.io.OutputStream", "org.apache.commons.io.IOUtils", "org.apache.xmlgraphics.image.writer.ImageWriter", "org.apache.xmlgraphics.image.writer.ImageWriterParams", "org.apache.xmlgraphics.image.writer.ImageWriterRegistry", "org.apache.xmlgraphics.image.writer.Mu...
import java.io.File; import java.io.IOException; import java.io.OutputStream; import org.apache.commons.io.IOUtils; import org.apache.xmlgraphics.image.writer.ImageWriter; import org.apache.xmlgraphics.image.writer.ImageWriterParams; import org.apache.xmlgraphics.image.writer.ImageWriterRegistry; import org.apache.xmlgraphics.image.writer.MultiImageWriter;
import java.io.*; import org.apache.commons.io.*; import org.apache.xmlgraphics.image.writer.*;
[ "java.io", "org.apache.commons", "org.apache.xmlgraphics" ]
java.io; org.apache.commons; org.apache.xmlgraphics;
129,189
synchronized void dropAll(boolean doSave) throws IOException { Throwable priorE = null; final Iterator<Map.Entry<SegmentCommitInfo,ReadersAndUpdates>> it = readerMap.entrySet().iterator(); while(it.hasNext()) { final ReadersAndUpdates rld = it.next().getValue(); try { if (doSave && rld.writeLiveDocs(directory)) { // Make sure we only write del docs and field updates for a live segment: assert infoIsLive(rld.info); // Must checkpoint because we just // created new _X_N.del and field updates files; // don't call IW.checkpoint because that also // increments SIS.version, which we do not want to // do here: it was done previously (after we // invoked BDS.applyDeletes), whereas here all we // did was move the state to disk: checkpointNoSIS(); } } catch (Throwable t) { if (doSave) { IOUtils.reThrow(t); } else if (priorE == null) { priorE = t; } } // Important to remove as-we-go, not with .clear() // in the end, in case we hit an exception; // otherwise we could over-decref if close() is // called again: it.remove(); // NOTE: it is allowed that these decRefs do not // actually close the SRs; this happens when a // near real-time reader is kept open after the // IndexWriter instance is closed: try { rld.dropReaders(); } catch (Throwable t) { if (doSave) { IOUtils.reThrow(t); } else if (priorE == null) { priorE = t; } } } assert readerMap.size() == 0; IOUtils.reThrow(priorE); }
synchronized void dropAll(boolean doSave) throws IOException { Throwable priorE = null; final Iterator<Map.Entry<SegmentCommitInfo,ReadersAndUpdates>> it = readerMap.entrySet().iterator(); while(it.hasNext()) { final ReadersAndUpdates rld = it.next().getValue(); try { if (doSave && rld.writeLiveDocs(directory)) { assert infoIsLive(rld.info); checkpointNoSIS(); } } catch (Throwable t) { if (doSave) { IOUtils.reThrow(t); } else if (priorE == null) { priorE = t; } } it.remove(); try { rld.dropReaders(); } catch (Throwable t) { if (doSave) { IOUtils.reThrow(t); } else if (priorE == null) { priorE = t; } } } assert readerMap.size() == 0; IOUtils.reThrow(priorE); }
/** Remove all our references to readers, and commits * any pending changes. */
Remove all our references to readers, and commits
dropAll
{ "repo_name": "zhangdian/solr4.6.0", "path": "lucene/core/src/java/org/apache/lucene/index/IndexWriter.java", "license": "apache-2.0", "size": 173047 }
[ "java.io.IOException", "java.util.Iterator", "java.util.Map", "org.apache.lucene.util.IOUtils" ]
import java.io.IOException; import java.util.Iterator; import java.util.Map; import org.apache.lucene.util.IOUtils;
import java.io.*; import java.util.*; import org.apache.lucene.util.*;
[ "java.io", "java.util", "org.apache.lucene" ]
java.io; java.util; org.apache.lucene;
1,201,258
@Override protected boolean isVisibleGhost() { if (User.isAdmin()) { return true; } return false; } // // Entity2DView //
boolean function() { if (User.isAdmin()) { return true; } return false; } //
/** * Determine is the user can see this entity while in ghostmode. * * @return <code>true</code> if the client user can see this entity while in * ghostmode. */
Determine is the user can see this entity while in ghostmode
isVisibleGhost
{ "repo_name": "sourceress-project/archestica", "path": "src/games/stendhal/client/gui/j2d/entity/Player2DView.java", "license": "gpl-2.0", "size": 7675 }
[ "games.stendhal.client.entity.User" ]
import games.stendhal.client.entity.User;
import games.stendhal.client.entity.*;
[ "games.stendhal.client" ]
games.stendhal.client;
2,289,204
public void loadExtensions() { File extensionDir = new File(EXTENSIONS_FOLDER); if (!extensionDir.isDirectory()) { Log.warn("Invalid extension directory '" + ExtensionManager.EXTENSIONS_FOLDER + "'"); return; } // initialize helper this.error = new PrintWriter(System.err); ModelFactory modelFactory = new ModelFactory(); this.emptyModel = modelFactory.createModel("Extension Model");
void function() { File extensionDir = new File(EXTENSIONS_FOLDER); if (!extensionDir.isDirectory()) { Log.warn(STR + ExtensionManager.EXTENSIONS_FOLDER + "'"); return; } this.error = new PrintWriter(System.err); ModelFactory modelFactory = new ModelFactory(); this.emptyModel = modelFactory.createModel(STR);
/*** * Loads the extensions specified in EXTENSION_FOLDER */
Loads the extensions specified in EXTENSION_FOLDER
loadExtensions
{ "repo_name": "anonymous100001/maxuse", "path": "src/main/org/tzi/use/uml/ocl/extension/ExtensionManager.java", "license": "gpl-2.0", "size": 5252 }
[ "java.io.File", "java.io.PrintWriter", "org.tzi.use.uml.mm.ModelFactory", "org.tzi.use.util.Log" ]
import java.io.File; import java.io.PrintWriter; import org.tzi.use.uml.mm.ModelFactory; import org.tzi.use.util.Log;
import java.io.*; import org.tzi.use.uml.mm.*; import org.tzi.use.util.*;
[ "java.io", "org.tzi.use" ]
java.io; org.tzi.use;
2,140,556
public void runJob(Properties jobProps, JobListener jobListener) throws JobException { Preconditions.checkArgument(jobProps.containsKey(ConfigurationKeys.JOB_NAME_KEY), "A job must have a job name specified by job.name"); String jobName = jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY); // Check if the job has been disabled boolean disabled = Boolean.valueOf(jobProps.getProperty(ConfigurationKeys.JOB_DISABLED_KEY, "false")); if (disabled) { LOG.info("Skipping disabled job " + jobName); return; } // Populate the assigned job ID jobProps.setProperty(ConfigurationKeys.JOB_ID_KEY, JobLauncherUtils.newJobId(jobName)); Closer closer = Closer.create(); // Launch the job try { JobLauncher jobLauncher = closer.register(JobLauncherFactory.newJobLauncher(this.properties, jobProps)); jobLauncher.launchJob(jobListener); boolean runOnce = Boolean.valueOf(jobProps.getProperty(ConfigurationKeys.JOB_RUN_ONCE_KEY, "false")); if (runOnce && this.scheduledJobs.containsKey(jobName)) { this.scheduler.deleteJob(this.scheduledJobs.remove(jobName)); } } catch (Throwable t) { String errMsg = "Failed to launch and run job " + jobName; LOG.error(errMsg, t); throw new JobException(errMsg, t); } finally { try { closer.close(); } catch (IOException ioe) { LOG.error("Failed to close the JobLauncher for job " + jobName, ioe); } } }
void function(Properties jobProps, JobListener jobListener) throws JobException { Preconditions.checkArgument(jobProps.containsKey(ConfigurationKeys.JOB_NAME_KEY), STR); String jobName = jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY); boolean disabled = Boolean.valueOf(jobProps.getProperty(ConfigurationKeys.JOB_DISABLED_KEY, "false")); if (disabled) { LOG.info(STR + jobName); return; } jobProps.setProperty(ConfigurationKeys.JOB_ID_KEY, JobLauncherUtils.newJobId(jobName)); Closer closer = Closer.create(); try { JobLauncher jobLauncher = closer.register(JobLauncherFactory.newJobLauncher(this.properties, jobProps)); jobLauncher.launchJob(jobListener); boolean runOnce = Boolean.valueOf(jobProps.getProperty(ConfigurationKeys.JOB_RUN_ONCE_KEY, "false")); if (runOnce && this.scheduledJobs.containsKey(jobName)) { this.scheduler.deleteJob(this.scheduledJobs.remove(jobName)); } } catch (Throwable t) { String errMsg = STR + jobName; LOG.error(errMsg, t); throw new JobException(errMsg, t); } finally { try { closer.close(); } catch (IOException ioe) { LOG.error(STR + jobName, ioe); } } }
/** * Run a job. * * <p> * This method runs the job immediately without going through the Quartz scheduler. * This is particularly useful for testing. * </p> * * @param jobProps Job configuration properties * @param jobListener {@link JobListener} used for callback, * can be <em>null</em> if no callback is needed. * @throws JobException when there is anything wrong * with running the job */
Run a job. This method runs the job immediately without going through the Quartz scheduler. This is particularly useful for testing.
runJob
{ "repo_name": "rayortigas/gobblin", "path": "gobblin-scheduler/src/main/java/gobblin/scheduler/JobScheduler.java", "license": "apache-2.0", "size": 18701 }
[ "com.google.common.base.Preconditions", "com.google.common.io.Closer", "java.io.IOException", "java.util.Properties" ]
import com.google.common.base.Preconditions; import com.google.common.io.Closer; import java.io.IOException; import java.util.Properties;
import com.google.common.base.*; import com.google.common.io.*; import java.io.*; import java.util.*;
[ "com.google.common", "java.io", "java.util" ]
com.google.common; java.io; java.util;
2,642,676
private void deleteReferencedObjects(List<LinkedObject> referencedObjects, Set<ObjectIdentifier> parentObjects) throws SQLException, NamingException, DataErrorException, NoSuchColumnException { int numberOfDeletedObjects = Integer.MAX_VALUE; List<LinkedObject> deletedObjects = new LinkedList<LinkedObject>(); while (numberOfDeletedObjects > 0){ numberOfDeletedObjects = 0; List<LinkedObject> deletedLinkedObjects = new LinkedList<LinkedObject>(); for (LinkedObject linkedObject : referencedObjects) { if (isDeleteableObject(linkedObject)){ numberOfDeletedObjects ++; deletedLinkedObjects.add(linkedObject); removeLinksToParents(linkedObject, parentObjects); deleteObject(linkedObject, dataBaseMap, fcdb); deletedObjects.add(linkedObject); } } referencedObjects.removeAll(deletedLinkedObjects); deleteReferencesToObjects(deletedLinkedObjects); // Acumulamos los objetos borrados para procesar los vinculos por // estructurales que surjan de los mismos. deletedObjects.addAll(deletedLinkedObjects); } // Si se ha conseguido borrar algun objeto, exploramos el siguiente // nivel de estructural. if (deletedObjects.size() > 0){ Set<LinkedObject> nextLevel = new HashSet<LinkedObject>(); Set<ObjectIdentifier> nextParentObjects = new HashSet<ObjectIdentifier>(); for (LinkedObject linkedObject : deletedObjects) { nextLevel.addAll(getReferencedObjects(linkedObject)); nextParentObjects.add(new ObjectIdentifier(linkedObject.getIdto(), linkedObject.getTableId())); } deleteReferencedObjects(new LinkedList<LinkedObject>(nextLevel), nextParentObjects); } }
void function(List<LinkedObject> referencedObjects, Set<ObjectIdentifier> parentObjects) throws SQLException, NamingException, DataErrorException, NoSuchColumnException { int numberOfDeletedObjects = Integer.MAX_VALUE; List<LinkedObject> deletedObjects = new LinkedList<LinkedObject>(); while (numberOfDeletedObjects > 0){ numberOfDeletedObjects = 0; List<LinkedObject> deletedLinkedObjects = new LinkedList<LinkedObject>(); for (LinkedObject linkedObject : referencedObjects) { if (isDeleteableObject(linkedObject)){ numberOfDeletedObjects ++; deletedLinkedObjects.add(linkedObject); removeLinksToParents(linkedObject, parentObjects); deleteObject(linkedObject, dataBaseMap, fcdb); deletedObjects.add(linkedObject); } } referencedObjects.removeAll(deletedLinkedObjects); deleteReferencesToObjects(deletedLinkedObjects); deletedObjects.addAll(deletedLinkedObjects); } if (deletedObjects.size() > 0){ Set<LinkedObject> nextLevel = new HashSet<LinkedObject>(); Set<ObjectIdentifier> nextParentObjects = new HashSet<ObjectIdentifier>(); for (LinkedObject linkedObject : deletedObjects) { nextLevel.addAll(getReferencedObjects(linkedObject)); nextParentObjects.add(new ObjectIdentifier(linkedObject.getIdto(), linkedObject.getTableId())); } deleteReferencedObjects(new LinkedList<LinkedObject>(nextLevel), nextParentObjects); } }
/** * Intenta borrar los objetos apuntados por estructurales recursivamente. * * @param referencedObjects * Lista de los objetos que son refernciados mediante una * propiedad estructural y que deben ser borrados. * @param parentObjects TODO * @throws DataErrorException * Si hay algun error en la estructura de los datos. * @throws NamingException * Si hay algun error en la conexión con la base de datos. * @throws SQLException * Si hay algun error en la consulta SQL * @throws NoSuchColumnException */
Intenta borrar los objetos apuntados por estructurales recursivamente
deleteReferencedObjects
{ "repo_name": "semantic-web-software/dynagent", "path": "Server/src/dynagent/server/services/DeletableObject.java", "license": "agpl-3.0", "size": 78584 }
[ "java.sql.SQLException", "java.util.HashSet", "java.util.LinkedList", "java.util.List", "java.util.Set", "javax.naming.NamingException" ]
import java.sql.SQLException; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import javax.naming.NamingException;
import java.sql.*; import java.util.*; import javax.naming.*;
[ "java.sql", "java.util", "javax.naming" ]
java.sql; java.util; javax.naming;
150,399
//----------------------------------------------------------------------- public PutCall getPutCall() { return putCall; }
PutCall function() { return putCall; }
/** * Gets whether the option is put or call. * <p> * A call gives the owner the right, but not obligation, to buy the underlying at * an agreed price in the future. A put gives a similar option to sell. * @return the value of the property */
Gets whether the option is put or call. A call gives the owner the right, but not obligation, to buy the underlying at an agreed price in the future. A put gives a similar option to sell
getPutCall
{ "repo_name": "nssales/Strata", "path": "modules/finance/src/main/java/com/opengamma/strata/finance/future/GenericFutureOption.java", "license": "apache-2.0", "size": 36115 }
[ "com.opengamma.strata.basics.PutCall" ]
import com.opengamma.strata.basics.PutCall;
import com.opengamma.strata.basics.*;
[ "com.opengamma.strata" ]
com.opengamma.strata;
2,035,805
public void writeToJPG(File file, float quality) throws IOException { FileOutputStream out = new FileOutputStream(file); // Encodes image as a JPEG data stream JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img); param.setQuality(quality, true); encoder.setJPEGEncodeParam(param); encoder.encode(img); }
void function(File file, float quality) throws IOException { FileOutputStream out = new FileOutputStream(file); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img); param.setQuality(quality, true); encoder.setJPEGEncodeParam(param); encoder.encode(img); }
/** * Writes to JPG using Sun's JPEGCodec * @param file File to write image to * @param quality The image quality * @throws IOException */
Writes to JPG using Sun's JPEGCodec
writeToJPG
{ "repo_name": "thiagoramos23/java_mock_project", "path": "thramos-core/src/main/java/com/thramos/framework/util/image/Image.java", "license": "apache-2.0", "size": 10847 }
[ "com.sun.image.codec.jpeg.JPEGCodec", "com.sun.image.codec.jpeg.JPEGEncodeParam", "com.sun.image.codec.jpeg.JPEGImageEncoder", "java.io.File", "java.io.FileOutputStream", "java.io.IOException" ]
import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGEncodeParam; import com.sun.image.codec.jpeg.JPEGImageEncoder; import java.io.File; import java.io.FileOutputStream; import java.io.IOException;
import com.sun.image.codec.jpeg.*; import java.io.*;
[ "com.sun.image", "java.io" ]
com.sun.image; java.io;
2,660,480
public Optional<Boolean> getEnabled() { return enabled; }
Optional<Boolean> function() { return enabled; }
/** Get whether the provider should be enabled or not, or no change should be made. * @return whether the provider should be enabled. */
Get whether the provider should be enabled or not, or no change should be made
getEnabled
{ "repo_name": "MrCreosote/auth2", "path": "src/us/kbase/auth2/lib/config/AuthConfigUpdate.java", "license": "mit", "size": 12814 }
[ "com.google.common.base.Optional" ]
import com.google.common.base.Optional;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
2,055,632
public void addDependency(PersistentDependency depend) { if (! _dependList.contains(depend)) _dependList.add(depend); }
void function(PersistentDependency depend) { if (! _dependList.contains(depend)) _dependList.add(depend); }
/** * Add a dependency. */
Add a dependency
addDependency
{ "repo_name": "christianchristensen/resin", "path": "modules/resin/src/com/caucho/ejb/cfg/EjbBeanConfigProxy.java", "license": "gpl-2.0", "size": 3776 }
[ "com.caucho.vfs.PersistentDependency" ]
import com.caucho.vfs.PersistentDependency;
import com.caucho.vfs.*;
[ "com.caucho.vfs" ]
com.caucho.vfs;
1,698,547
ServiceFuture<Void> putOptionalQueryAsync(String queryParameter, final ServiceCallback<Void> serviceCallback);
ServiceFuture<Void> putOptionalQueryAsync(String queryParameter, final ServiceCallback<Void> serviceCallback);
/** * Test implicitly optional query parameter. * * @param queryParameter the String value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Test implicitly optional query parameter
putOptionalQueryAsync
{ "repo_name": "vishrutshah/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/requiredoptional/Implicits.java", "license": "mit", "size": 15143 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
529,542
@Override public Adapter createFastXSLTMediatorOutputConnectorAdapter() { if (fastXSLTMediatorOutputConnectorItemProvider == null) { fastXSLTMediatorOutputConnectorItemProvider = new FastXSLTMediatorOutputConnectorItemProvider(this); } return fastXSLTMediatorOutputConnectorItemProvider; } protected ScriptMediatorItemProvider scriptMediatorItemProvider;
Adapter function() { if (fastXSLTMediatorOutputConnectorItemProvider == null) { fastXSLTMediatorOutputConnectorItemProvider = new FastXSLTMediatorOutputConnectorItemProvider(this); } return fastXSLTMediatorOutputConnectorItemProvider; } protected ScriptMediatorItemProvider scriptMediatorItemProvider;
/** * This creates an adapter for a {@link org.wso2.developerstudio.eclipse.gmf.esb.FastXSLTMediatorOutputConnector}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This creates an adapter for a <code>org.wso2.developerstudio.eclipse.gmf.esb.FastXSLTMediatorOutputConnector</code>.
createFastXSLTMediatorOutputConnectorAdapter
{ "repo_name": "rajeevanv89/developer-studio", "path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EsbItemProviderAdapterFactory.java", "license": "apache-2.0", "size": 286852 }
[ "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;
1,344,767
public void addNewItems(List<M> newItems) { if (this.items == null) { this.items = createEmptyList(); } this.items.addAll(newItems); }
void function(List<M> newItems) { if (this.items == null) { this.items = createEmptyList(); } this.items.addAll(newItems); }
/** * <p> * Add items. * </p> * * <p> * If {@link #items} is null an empty list of {@link M} will be created first. * </p> * * @param newItems items */
Add items. If <code>#items</code> is null an empty list of <code>M</code> will be created first.
addNewItems
{ "repo_name": "Bodo1981/appkit", "path": "core/src/main/java/com/christianbahl/appkit/core/adapter/CBAdapterRecyclerView.java", "license": "apache-2.0", "size": 3511 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,788,294
protected void writeParagraphEnd() throws IOException { if (!inParagraph) { writeParagraphStart(); } output.write(getParagraphEnd()); inParagraph = false; }
void function() throws IOException { if (!inParagraph) { writeParagraphStart(); } output.write(getParagraphEnd()); inParagraph = false; }
/** * Write something (if defined) at the end of a paragraph. * @throws IOException if something went wrong */
Write something (if defined) at the end of a paragraph
writeParagraphEnd
{ "repo_name": "ChunghwaTelecom/pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java", "license": "apache-2.0", "size": 72634 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,387,430
public void createViews(ArrayList<LayoutElement> bitmap, boolean back, String path, final OpenMode openMode, boolean results, boolean grid) { if (bitmap != null && isAdded()) { synchronized (bitmap) { boolean isOtg = path.equals(OTGUtil.PREFIX_OTG + "/"), isOnTheCloud = path.equals(CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE + "/") || path.equals(CloudHandler.CLOUD_PREFIX_ONE_DRIVE + "/") || path.equals(CloudHandler.CLOUD_PREFIX_BOX + "/") || path.equals(CloudHandler.CLOUD_PREFIX_DROPBOX + "/"); String goToParentText = getString(R.string.goback); if (GO_BACK_ITEM && !path.equals("/") && (openMode == OpenMode.FILE || openMode == OpenMode.ROOT) && !isOtg && !isOnTheCloud && (bitmap.size() == 0 || !bitmap.get(0).getSize().equals(goToParentText))) { //create the "go to parent" button (aka '..') Bitmap iconBitmap = BitmapFactory.decodeResource(res, R.drawable.ic_arrow_left_white_24dp); bitmap.add(0, new LayoutElement(new BitmapDrawable(res, iconBitmap), "..", "", "", goToParentText, 0, false, true, "")); } if (bitmap.size() == 0 && !results) { nofilesview.setVisibility(View.VISIBLE); listView.setVisibility(View.GONE); mSwipeRefreshLayout.setEnabled(false); } else { mSwipeRefreshLayout.setEnabled(true); nofilesview.setVisibility(View.GONE); listView.setVisibility(View.VISIBLE); } putLayoutElements(bitmap); if (grid && IS_LIST) switchToGrid(); else if (!grid && !IS_LIST) switchToList(); if (adapter == null) { adapter = new RecyclerAdapter(ma, utilsProvider, bitmap, ma.getActivity(), SHOW_HEADERS); } else { adapter.setItems(getLayoutElements()); } stopAnims = true; this.openMode = openMode; if (openMode != OpenMode.CUSTOM) dataUtils.addHistoryFile(path); //mSwipeRefreshLayout.setRefreshing(false); listView.setAdapter(adapter); if (!addheader) { //listView.removeItemDecoration(headersDecor); listView.removeItemDecoration(dividerItemDecoration); addheader = true; } if (addheader && IS_LIST) { dividerItemDecoration = new DividerItemDecoration(getActivity(), true, SHOW_DIVIDERS); listView.addItemDecoration(dividerItemDecoration); addheader = false; } if (!results) this.results = false; CURRENT_PATH = path; if (back) { if (scrolls.containsKey(CURRENT_PATH)) { Bundle b = scrolls.get(CURRENT_PATH); if (IS_LIST) mLayoutManager.scrollToPositionWithOffset(b.getInt("index"), b.getInt("top")); else mLayoutManagerGrid.scrollToPositionWithOffset(b.getInt("index"), b.getInt("top")); } }
void function(ArrayList<LayoutElement> bitmap, boolean back, String path, final OpenMode openMode, boolean results, boolean grid) { if (bitmap != null && isAdded()) { synchronized (bitmap) { boolean isOtg = path.equals(OTGUtil.PREFIX_OTG + "/"), isOnTheCloud = path.equals(CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE + "/") path.equals(CloudHandler.CLOUD_PREFIX_ONE_DRIVE + "/") path.equals(CloudHandler.CLOUD_PREFIX_BOX + "/") path.equals(CloudHandler.CLOUD_PREFIX_DROPBOX + "/"); String goToParentText = getString(R.string.goback); if (GO_BACK_ITEM && !path.equals("/") && (openMode == OpenMode.FILE openMode == OpenMode.ROOT) && !isOtg && !isOnTheCloud && (bitmap.size() == 0 !bitmap.get(0).getSize().equals(goToParentText))) { Bitmap iconBitmap = BitmapFactory.decodeResource(res, R.drawable.ic_arrow_left_white_24dp); bitmap.add(0, new LayoutElement(new BitmapDrawable(res, iconBitmap), "..", STRSTRSTRindexSTRtopSTRindexSTRtop")); } }
/** * Loading adapter after getting a list of elements * * @param bitmap the list of objects for the adapter * @param back if we're coming back from any directory and want the scroll to be restored * @param path the path for the adapter * @param openMode the type of file being created * @param results is the list of elements a result from search * @param grid whether to set grid view or list view */
Loading adapter after getting a list of elements
createViews
{ "repo_name": "MoKee/android_packages_apps_AmazeFileManager", "path": "app/src/main/java/com/amaze/filemanager/fragments/MainFragment.java", "license": "gpl-3.0", "size": 77379 }
[ "android.graphics.Bitmap", "android.graphics.BitmapFactory", "android.graphics.drawable.BitmapDrawable", "com.amaze.filemanager.database.CloudHandler", "com.amaze.filemanager.ui.LayoutElement", "com.amaze.filemanager.utils.OTGUtil", "com.amaze.filemanager.utils.OpenMode", "java.util.ArrayList" ]
import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import com.amaze.filemanager.database.CloudHandler; import com.amaze.filemanager.ui.LayoutElement; import com.amaze.filemanager.utils.OTGUtil; import com.amaze.filemanager.utils.OpenMode; import java.util.ArrayList;
import android.graphics.*; import android.graphics.drawable.*; import com.amaze.filemanager.database.*; import com.amaze.filemanager.ui.*; import com.amaze.filemanager.utils.*; import java.util.*;
[ "android.graphics", "com.amaze.filemanager", "java.util" ]
android.graphics; com.amaze.filemanager; java.util;
1,029,946
public void doDelete(HttpServletRequest request, HttpServletResponse response) { String sesId = request.getParameter("session"); String reason = request.getParameter("reason"); if (sesId == null || reason == null) { this.logger.warn("Bad session delete request, required parameters not specified."); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return; } SessionDao dao = null; try { dao = new SessionDao(); Session ses = dao.get(Long.parseLong(sesId)); if (ses == null) { this.logger.warn("Cannot end node session " + sesId + " as the session was not found."); response.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } if (!ses.isActive()) { this.logger.info("No need to end node session " + ses.getId() + " as it not active."); response.setStatus(HttpServletResponse.SC_OK); } SessionService service = NodeProviderActivator.getSession(); if (service == null) { this.logger.error("Unable to obtain Session service, cannot obtain session functions."); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); return; } if (service.finishSession(ses, reason, dao.getSession())) { this.logger.debug("Successfully ended node session for " + ses.getAssignedRigName() + "."); response.setStatus(HttpServletResponse.SC_OK); } else { this.logger.info("Failed session " + ses.getId() + " not successfully ended for " + ses.getAssignedRigName()); response.setStatus(HttpServletResponse.SC_CONFLICT); } } finally { if (dao != null) dao.closeSession(); } }
void function(HttpServletRequest request, HttpServletResponse response) { String sesId = request.getParameter(STR); String reason = request.getParameter(STR); if (sesId == null reason == null) { this.logger.warn(STR); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return; } SessionDao dao = null; try { dao = new SessionDao(); Session ses = dao.get(Long.parseLong(sesId)); if (ses == null) { this.logger.warn(STR + sesId + STR); response.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } if (!ses.isActive()) { this.logger.info(STR + ses.getId() + STR); response.setStatus(HttpServletResponse.SC_OK); } SessionService service = NodeProviderActivator.getSession(); if (service == null) { this.logger.error(STR); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); return; } if (service.finishSession(ses, reason, dao.getSession())) { this.logger.debug(STR + ses.getAssignedRigName() + "."); response.setStatus(HttpServletResponse.SC_OK); } else { this.logger.info(STR + ses.getId() + STR + ses.getAssignedRigName()); response.setStatus(HttpServletResponse.SC_CONFLICT); } } finally { if (dao != null) dao.closeSession(); } }
/** * The DELETE method finishes a session. */
The DELETE method finishes a session
doDelete
{ "repo_name": "sahara-labs/scheduling-server", "path": "NodeProvider/src/io/rln/node/ss/service/AccessApi.java", "license": "bsd-3-clause", "size": 19521 }
[ "au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.SessionDao", "au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.Session", "au.edu.uts.eng.remotelabs.schedserver.session.pojo.SessionService", "io.rln.node.ss.NodeProviderActivator", "javax.servlet.http.HttpServletRequest", "javax.servlet.http....
import au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.SessionDao; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.Session; import au.edu.uts.eng.remotelabs.schedserver.session.pojo.SessionService; import io.rln.node.ss.NodeProviderActivator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.*; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.*; import au.edu.uts.eng.remotelabs.schedserver.session.pojo.*; import io.rln.node.ss.*; import javax.servlet.http.*;
[ "au.edu.uts", "io.rln.node", "javax.servlet" ]
au.edu.uts; io.rln.node; javax.servlet;
1,742,377
protected synchronized void handleMatch(EventBean newEvent) { UpdateHandlerThread handler = new UpdateHandlerThread(this, newEvent); //handle match in its own thread using a ThreadPool ThreadPool tp = ThreadPool.getInstance(); tp.execute(handler); } // // public synchronized void doOutput(MapEvent resultEvent) { // String outputName = this.statement.getSelectFunction().getOutputName(); // // //load output description // if (this.outDescription == null) { // if (this.getOutDescriptionPerformed) { // //output description not found // return; // } // // //try to find output description // this.outDescription = this.controller.getOutputDescription(outputName); // this.getOutDescriptionPerformed = true; // // if (this.outDescription == null) { // //not found // return; // } // } // // //send output (the whole event or only the value) // if (this.outDescription.getDataType().equals(SupportedDataTypes.EVENT)) { // //send event // this.controller.doOutput(outputName, resultEvent); // } // else { // //send only value // this.controller.doOutput(outputName, resultEvent.get(MapEvent.VALUE_KEY)); // } // }
synchronized void function(EventBean newEvent) { UpdateHandlerThread handler = new UpdateHandlerThread(this, newEvent); ThreadPool tp = ThreadPool.getInstance(); tp.execute(handler); }
/** * handles a single pattern match * * @param newEvent the EventBean representing the match */
handles a single pattern match
handleMatch
{ "repo_name": "52North/SES", "path": "52n-ses-eml-002/src/main/java/org/n52/ses/eml/v002/filterlogic/esper/StatementListener.java", "license": "gpl-2.0", "size": 11280 }
[ "com.espertech.esper.client.EventBean", "org.n52.ses.eml.v002.util.ThreadPool" ]
import com.espertech.esper.client.EventBean; import org.n52.ses.eml.v002.util.ThreadPool;
import com.espertech.esper.client.*; import org.n52.ses.eml.v002.util.*;
[ "com.espertech.esper", "org.n52.ses" ]
com.espertech.esper; org.n52.ses;
336,190
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ManagedInstanceLongTermRetentionBackupInner>> listByDatabaseSinglePageAsync( String locationName, String managedInstanceName, String databaseName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (locationName == null) { return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); } if (managedInstanceName == null) { return Mono .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); } if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName 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.")); } final String apiVersion = "2018-06-01-preview"; context = this.client.mergeContext(context); return service .listByDatabase( this.client.getEndpoint(), locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, this.client.getSubscriptionId(), apiVersion, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<ManagedInstanceLongTermRetentionBackupInner>> function( String locationName, String managedInstanceName, String databaseName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (locationName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (managedInstanceName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (databaseName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String apiVersion = STR; context = this.client.mergeContext(context); return service .listByDatabase( this.client.getEndpoint(), locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, this.client.getSubscriptionId(), apiVersion, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * Lists all long term retention backups for a managed database. * * @param locationName The location of the database. * @param managedInstanceName The name of the managed instance. * @param databaseName The name of the managed database. * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. * @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 a list of long term retention backups for managed database(s). */
Lists all long term retention backups for a managed database
listByDatabaseSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java", "license": "mit", "size": 162168 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.sql.fluent.models.ManagedInstanceLongTermRetentionBackupInner", "com.azure....
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.sql.fluent.models.ManagedInstanceLongTermRetentionBackupInner; import com.azure.resourcemanager.sql.models.DatabaseState;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.sql.fluent.models.*; import com.azure.resourcemanager.sql.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,812,869
public GenericTextFieldAssert hasTextContaining(String textFragment) { String errorMessage = "Expected text field's text to contain <%s>, but it didn't."; String actualText = actual.getText(); assertThat(actualText).overridingErrorMessage(errorMessage, textFragment).contains(textFragment); return this; }
GenericTextFieldAssert function(String textFragment) { String errorMessage = STR; String actualText = actual.getText(); assertThat(actualText).overridingErrorMessage(errorMessage, textFragment).contains(textFragment); return this; }
/** * Asserts that the {@link GenericTextField text field's} text contains a certain text fragment. * * @param textFragment the expected text fragment * @return same assertion instance for fluent API * @see GenericTextField#getText() * @since 2.0 */
Asserts that the <code>GenericTextField text field's</code> text contains a certain text fragment
hasTextContaining
{ "repo_name": "testIT-WebTester/webtester2-core", "path": "webtester-support-assertj3/src/main/java/info/novatec/testit/webtester/support/assertj/assertions/pagefragments/GenericTextFieldAssert.java", "license": "apache-2.0", "size": 3153 }
[ "org.assertj.core.api.Assertions" ]
import org.assertj.core.api.Assertions;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
1,375,908
@Override public void enterIncluding_specifier(WindowParser.Including_specifierContext ctx) { if(checkForException(ctx)) { return; } enterList(); }
void function(WindowParser.Including_specifierContext ctx) { if(checkForException(ctx)) { return; } enterList(); }
/** * When we're beginning an inclusion specifier list, then we push the list token so we * know when we're done processing * @param ctx */
When we're beginning an inclusion specifier list, then we push the list token so we know when we're done processing
enterIncluding_specifier
{ "repo_name": "JonZeolla/metron", "path": "metron-analytics/metron-profiler-client/src/main/java/org/apache/metron/profiler/client/window/WindowProcessor.java", "license": "apache-2.0", "size": 14220 }
[ "org.apache.metron.profiler.client.window.generated.WindowParser" ]
import org.apache.metron.profiler.client.window.generated.WindowParser;
import org.apache.metron.profiler.client.window.generated.*;
[ "org.apache.metron" ]
org.apache.metron;
2,685,818
protected HttpURLConnection getOpenHttpURLConnection(String url) throws IOException { return getOpenHttpURLConnection(url, false, 0, ""); }
HttpURLConnection function(String url) throws IOException { return getOpenHttpURLConnection(url, false, 0, ""); }
/** * By default do not use a proxy. * @param url url * @return HttpURLConnection * @throws IOException If encountered. */
By default do not use a proxy
getOpenHttpURLConnection
{ "repo_name": "agdturner/agdt-web", "path": "src/main/java/uk/ac/leeds/ccg/web/io/Web_Scraper.java", "license": "bsd-3-clause", "size": 8390 }
[ "java.io.IOException", "java.net.HttpURLConnection" ]
import java.io.IOException; import java.net.HttpURLConnection;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
117,172
public void testSimpleChoiceSchemaValidation() throws Exception { CmsObject cms = getCmsObject(); echo("Testing a simple XML file validation for a schema that contains xsd:choice"); CmsXmlEntityResolver resolver = new CmsXmlEntityResolver(cms); cacheXmlSchema( "org/opencms/xml/content/xmlcontent-choice-definition-1.xsd", "http://www.opencms.org/testChoice1.xsd"); cacheXmlSchema( "org/opencms/xml/content/xmlcontent-choice-definition-1-subA.xsd", "http://www.opencms.org/choice-definition1-subA.xsd"); cacheXmlSchema( "org/opencms/xml/content/xmlcontent-choice-definition-1-subB.xsd", "http://www.opencms.org/choice-definition1-subB.xsd"); cacheXmlSchema( "org/opencms/xml/content/xmlcontent-choice-definition-1-subC.xsd", "http://www.opencms.org/choice-definition1-subC.xsd"); // now read the XML content byte[] content = CmsFileUtil.readFile("org/opencms/xml/content/xmlcontent-choice-1.xml"); // validate the XML structure CmsXmlUtils.validateXmlStructure(content, resolver); }
void function() throws Exception { CmsObject cms = getCmsObject(); echo(STR); CmsXmlEntityResolver resolver = new CmsXmlEntityResolver(cms); cacheXmlSchema( STR, STRorg/opencms/xml/content/xmlcontent-choice-definition-1-subA.xsd", STRorg/opencms/xml/content/xmlcontent-choice-definition-1-subB.xsd", STRorg/opencms/xml/content/xmlcontent-choice-definition-1-subC.xsdSTRhttp: byte[] content = CmsFileUtil.readFile(STR); CmsXmlUtils.validateXmlStructure(content, resolver); }
/** * Tests a simple XML file validation for a schema that contains xsd:choice.<p> * * @throws Exception in case something goes wrong */
Tests a simple XML file validation for a schema that contains xsd:choice
testSimpleChoiceSchemaValidation
{ "repo_name": "ggiudetti/opencms-core", "path": "test/org/opencms/xml/content/TestCmsXmlContentChoice.java", "license": "lgpl-2.1", "size": 17462 }
[ "org.opencms.file.CmsObject", "org.opencms.util.CmsFileUtil", "org.opencms.xml.CmsXmlEntityResolver", "org.opencms.xml.CmsXmlUtils" ]
import org.opencms.file.CmsObject; import org.opencms.util.CmsFileUtil; import org.opencms.xml.CmsXmlEntityResolver; import org.opencms.xml.CmsXmlUtils;
import org.opencms.file.*; import org.opencms.util.*; import org.opencms.xml.*;
[ "org.opencms.file", "org.opencms.util", "org.opencms.xml" ]
org.opencms.file; org.opencms.util; org.opencms.xml;
2,093,974
@Deprecated public IndexReader getReader(int termInfosIndexDivisor) throws IOException { return getReader(termInfosIndexDivisor, true); }
IndexReader function(int termInfosIndexDivisor) throws IOException { return getReader(termInfosIndexDivisor, true); }
/** Expert: like {@link #getReader}, except you can * specify which termInfosIndexDivisor should be used for * any newly opened readers. * @param termInfosIndexDivisor Subsamples which indexed * terms are loaded into RAM. This has the same effect as {@link * IndexWriter#setTermIndexInterval} except that setting * must be done at indexing time while this setting can be * set per reader. When set to N, then one in every * N*termIndexInterval terms in the index is loaded into * memory. By setting this to a value > 1 you can reduce * memory usage, at the expense of higher latency when * loading a TermInfo. The default value is 1. Set this * to -1 to skip loading the terms index entirely. * * @deprecated Please use {@link * IndexReader#open(IndexWriter,boolean)} instead. Furthermore, * this method cannot guarantee the reader (and its * sub-readers) will be opened with the * termInfosIndexDivisor setting because some of them may * have already been opened according to {@link * IndexWriterConfig#setReaderTermsIndexDivisor}. You * should set the requested termInfosIndexDivisor through * {@link IndexWriterConfig#setReaderTermsIndexDivisor} and use * {@link #getReader()}. */
Expert: like <code>#getReader</code>, except you can specify which termInfosIndexDivisor should be used for any newly opened readers
getReader
{ "repo_name": "bighaidao/lucene", "path": "lucene-core/src/main/java/org/apache/lucene/index/IndexWriter.java", "license": "apache-2.0", "size": 174024 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
525,912
static synchronized void storeAppIstance(UiApplication istance) { try{ Log.trace(">>> storeAppIstance"); //Open the RuntimeStore. RuntimeStore store = RuntimeStore.getRuntimeStore(); //Obtain the reference of WordPress for BlackBerry. Object obj = store.get(WordPressInfo.APPLICATION_ID); //If obj is null, there is no current reference //to WordPress for BlackBerry. if (obj == null) { //Store a reference to this instance in the RuntimeStore. store.put(WordPressInfo.APPLICATION_ID, istance); Log.trace("Application References added to the runtimestore"); } else { //should never fall here bc the app deregister istance on exit Log.trace("runtimestore not empty, why??"); store.replace(WordPressInfo.APPLICATION_ID, UiApplication.getUiApplication()); } } catch (ControlledAccessException e) { Log.trace(e, "Error while accessing the runtime store"); } }
static synchronized void storeAppIstance(UiApplication istance) { try{ Log.trace(STR); RuntimeStore store = RuntimeStore.getRuntimeStore(); Object obj = store.get(WordPressInfo.APPLICATION_ID); if (obj == null) { store.put(WordPressInfo.APPLICATION_ID, istance); Log.trace(STR); } else { Log.trace(STR); store.replace(WordPressInfo.APPLICATION_ID, UiApplication.getUiApplication()); } } catch (ControlledAccessException e) { Log.trace(e, STR); } }
/** * Called at startup to store the app references onto runtime store * @param istance */
Called at startup to store the app references onto runtime store
storeAppIstance
{ "repo_name": "wordpress-mobile/WordPress-BlackBerry-Legacy", "path": "src/com/wordpress/bb/SharingHelperOldDevices.java", "license": "gpl-2.0", "size": 10370 }
[ "com.wordpress.utils.log.Log", "net.rim.device.api.system.ControlledAccessException", "net.rim.device.api.system.RuntimeStore", "net.rim.device.api.ui.UiApplication" ]
import com.wordpress.utils.log.Log; import net.rim.device.api.system.ControlledAccessException; import net.rim.device.api.system.RuntimeStore; import net.rim.device.api.ui.UiApplication;
import com.wordpress.utils.log.*; import net.rim.device.api.system.*; import net.rim.device.api.ui.*;
[ "com.wordpress.utils", "net.rim.device" ]
com.wordpress.utils; net.rim.device;
722,208
@RequestMapping(value = BUSINESS_OBJECT_DATA_ATTRIBUTES_URI_PREFIX + "/namespaces/{namespace}" + "/businessObjectDefinitionNames/{businessObjectDefinitionName}" + "/businessObjectFormatUsages/{businessObjectFormatUsage}/businessObjectFormatFileTypes/{businessObjectFormatFileType}" + "/businessObjectFormatVersions/{businessObjectFormatVersion}/partitionValues/{partitionValue}/subPartition1Values/{subPartition1Value}" + "/subPartition2Values/{subPartition2Value}/subPartition3Values/{subPartition3Value}/subPartition4Values/{subPartition4Value}" + "/businessObjectDataVersions/{businessObjectDataVersion}/businessObjectDataAttributeNames/{businessObjectDataAttributeName}", method = RequestMethod.PUT, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_BUSINESS_OBJECT_DATA_ATTRIBUTES_PUT) public BusinessObjectDataAttribute updateBusinessObjectDataAttribute(@PathVariable("namespace") String namespace, @PathVariable("businessObjectDefinitionName") String businessObjectDefinitionName, @PathVariable("businessObjectFormatUsage") String businessObjectFormatUsage, @PathVariable("businessObjectFormatFileType") String businessObjectFormatFileType, @PathVariable("businessObjectFormatVersion") Integer businessObjectFormatVersion, @PathVariable("partitionValue") String partitionValue, @PathVariable("subPartition1Value") String subPartition1Value, @PathVariable("subPartition2Value") String subPartition2Value, @PathVariable("subPartition3Value") String subPartition3Value, @PathVariable("subPartition4Value") String subPartition4Value, @PathVariable("businessObjectDataVersion") Integer businessObjectDataVersion, @PathVariable("businessObjectDataAttributeName") String businessObjectDataAttributeName, @RequestBody BusinessObjectDataAttributeUpdateRequest request) { return businessObjectDataAttributeService.updateBusinessObjectDataAttribute( new BusinessObjectDataAttributeKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, businessObjectFormatVersion, partitionValue, Arrays.asList(subPartition1Value, subPartition2Value, subPartition3Value, subPartition4Value), businessObjectDataVersion, businessObjectDataAttributeName), request); }
@RequestMapping(value = BUSINESS_OBJECT_DATA_ATTRIBUTES_URI_PREFIX + STR + STR + STR + STR + STR + STR, method = RequestMethod.PUT, consumes = {STR, STR}) @Secured(SecurityFunctions.FN_BUSINESS_OBJECT_DATA_ATTRIBUTES_PUT) BusinessObjectDataAttribute function(@PathVariable(STR) String namespace, @PathVariable(STR) String businessObjectDefinitionName, @PathVariable(STR) String businessObjectFormatUsage, @PathVariable(STR) String businessObjectFormatFileType, @PathVariable(STR) Integer businessObjectFormatVersion, @PathVariable(STR) String partitionValue, @PathVariable(STR) String subPartition1Value, @PathVariable(STR) String subPartition2Value, @PathVariable(STR) String subPartition3Value, @PathVariable(STR) String subPartition4Value, @PathVariable(STR) Integer businessObjectDataVersion, @PathVariable(STR) String businessObjectDataAttributeName, @RequestBody BusinessObjectDataAttributeUpdateRequest request) { return businessObjectDataAttributeService.updateBusinessObjectDataAttribute( new BusinessObjectDataAttributeKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, businessObjectFormatVersion, partitionValue, Arrays.asList(subPartition1Value, subPartition2Value, subPartition3Value, subPartition4Value), businessObjectDataVersion, businessObjectDataAttributeName), request); }
/** * Updates an existing attribute for the business object data with 4 subpartition values. * * @param namespace the namespace * @param businessObjectDefinitionName the business object definition name * @param businessObjectFormatUsage the business object format usage * @param businessObjectFormatFileType the business object format file type * @param businessObjectFormatVersion the business object format version * @param partitionValue the primary partition value of the business object data * @param subPartition1Value the 1st subpartition value of the business object data * @param subPartition2Value the 2nd subpartition value of the business object data * @param subPartition3Value the 3rd subpartition value of the business object data * @param subPartition4Value the 4th subpartition value of the business object data * @param businessObjectDataVersion the business object data version * @param businessObjectDataAttributeName the business object data attribute name * @param request the request information needed to update the business object data attribute * * @return the business object data attribute information */
Updates an existing attribute for the business object data with 4 subpartition values
updateBusinessObjectDataAttribute
{ "repo_name": "seoj/herd", "path": "herd-code/herd-rest/src/main/java/org/finra/herd/rest/BusinessObjectDataAttributeRestController.java", "license": "apache-2.0", "size": 62227 }
[ "java.util.Arrays", "org.finra.herd.model.api.xml.BusinessObjectDataAttribute", "org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey", "org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest", "org.finra.herd.model.dto.SecurityFunctions", "org.springframework.security.access.annotat...
import java.util.Arrays; import org.finra.herd.model.api.xml.BusinessObjectDataAttribute; import org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey; import org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest; import org.finra.herd.model.dto.SecurityFunctions; import org.springframework.security.access.annotation.Secured; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
import java.util.*; import org.finra.herd.model.api.xml.*; import org.finra.herd.model.dto.*; import org.springframework.security.access.annotation.*; import org.springframework.web.bind.annotation.*;
[ "java.util", "org.finra.herd", "org.springframework.security", "org.springframework.web" ]
java.util; org.finra.herd; org.springframework.security; org.springframework.web;
2,648,369
public ArrayList<SelectTableMap> getSelect() { return select; }
ArrayList<SelectTableMap> function() { return select; }
/** * Gets the select. * * @return the select */
Gets the select
getSelect
{ "repo_name": "termMed/sct-descriptive-statistics-generator", "path": "src/main/java/com/termmed/statistics/model/OutputFileTableMap.java", "license": "apache-2.0", "size": 1745 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,407,231
public void start_resource_list(final Attributes meta) throws SAXException;
void function(final Attributes meta) throws SAXException;
/** * * A container element start event handling method. * * @param meta attributes */
A container element start event handling method
start_resource_list
{ "repo_name": "3-mode/lumens", "path": "lumens-engine/src/main/java/com/lumens/engine/serializer/parser/ProjectHandler.java", "license": "lgpl-3.0", "size": 6858 }
[ "org.xml.sax.Attributes", "org.xml.sax.SAXException" ]
import org.xml.sax.Attributes; import org.xml.sax.SAXException;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
1,278,964
public void setErrorMessage(Image image, String message) { fErrorText = trim(message); fErrorImage = image; updateMessageLabel(); }
void function(Image image, String message) { fErrorText = trim(message); fErrorImage = image; updateMessageLabel(); }
/** * Sets an image and error message text to be displayed on the status line. * * @param image * the image to use, or <code>null</code> for no image * @param message * the error message, or <code>null</code> for no error message */
Sets an image and error message text to be displayed on the status line
setErrorMessage
{ "repo_name": "ghillairet/gef-gwt", "path": "src/main/java/org/eclipse/jface/action/StatusLine.java", "license": "epl-1.0", "size": 20015 }
[ "org.eclipse.swt.graphics.Image" ]
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,585,243
public final Addresses deliveredAndWithoutBlindCarbonCopies() { return new Addresses(this.address.stream().map(Address::delivered).filter(address -> address.getType() != Address.Type.BCC).collect(Collectors.toList())); }
final Addresses function() { return new Addresses(this.address.stream().map(Address::delivered).filter(address -> address.getType() != Address.Type.BCC).collect(Collectors.toList())); }
/** * Creates a copy of this addresses extension, but without any BCC addresses. * This is useful for server processing (multicast usage). * * @return A new addresses extension. * @see <a href="http://xmpp.org/extensions/xep-0033.html#multicast">6. Multicast Usage</a> */
Creates a copy of this addresses extension, but without any BCC addresses. This is useful for server processing (multicast usage)
deliveredAndWithoutBlindCarbonCopies
{ "repo_name": "jeozey/XmppServerTester", "path": "xmpp-extensions/src/main/java/rocks/xmpp/extensions/address/model/Addresses.java", "license": "mit", "size": 7369 }
[ "java.util.stream.Collectors" ]
import java.util.stream.Collectors;
import java.util.stream.*;
[ "java.util" ]
java.util;
2,640,143
public void addBindings(Map bindings) { log.info("Adding bindings {}", bindings); getBindings().putAll(bindings); }
void function(Map bindings) { log.info(STR, bindings); getBindings().putAll(bindings); }
/** * adds additional bindings (global variables to use in child pipes expressions) * @param bindings key/values bindings to add to the existing bindings */
adds additional bindings (global variables to use in child pipes expressions)
addBindings
{ "repo_name": "vladbailescu/sling", "path": "contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/PipeBindings.java", "license": "apache-2.0", "size": 11150 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
153,799
@Parameters(name = "{0}") public static Collection<Object[]> retrieveTestFolders() { return retrieveTestFolders("resources/paginationServices"); }
@Parameters(name = "{0}") static Collection<Object[]> function() { return retrieveTestFolders(STR); }
/** * Gets test folders from resources/feature. * * @return test folders from resources/feature */
Gets test folders from resources/feature
retrieveTestFolders
{ "repo_name": "ylussaud/M2Doc", "path": "tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/services/PaginationServicesTests.java", "license": "epl-1.0", "size": 1760 }
[ "java.util.Collection", "org.junit.runners.Parameterized" ]
import java.util.Collection; import org.junit.runners.Parameterized;
import java.util.*; import org.junit.runners.*;
[ "java.util", "org.junit.runners" ]
java.util; org.junit.runners;
758,756
public Date getBirthday() { return (Date) get(3); }
Date function() { return (Date) get(3); }
/** * Getter for <code>staypaldb.users.birthday</code>. */
Getter for <code>staypaldb.users.birthday</code>
getBirthday
{ "repo_name": "bajohn/staypal_java", "path": "src/com/staypal/db/tables/records/UsersRecord.java", "license": "mit", "size": 11625 }
[ "java.sql.Date" ]
import java.sql.Date;
import java.sql.*;
[ "java.sql" ]
java.sql;
598,580
public TroubleshootingResultInner withStartTime(DateTime startTime) { this.startTime = startTime; return this; }
TroubleshootingResultInner function(DateTime startTime) { this.startTime = startTime; return this; }
/** * Set the start time of the troubleshooting. * * @param startTime the startTime value to set * @return the TroubleshootingResultInner object itself. */
Set the start time of the troubleshooting
withStartTime
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_02_01/src/main/java/com/microsoft/azure/management/network/v2019_02_01/implementation/TroubleshootingResultInner.java", "license": "mit", "size": 3099 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
2,241,368
public static String adaptExpression( ScriptExpression expression ) { if ( expression == null ) { return IConstants.EMPTY_STRING; } ExpressionCodec exprCodec = ChartModelHelper.instance( ) .createExpressionCodec( ); exprCodec.setType( expression.getType( ) ); exprCodec.setExpression( expression.getValue( ) ); return exprCodec.encode( ); }
static String function( ScriptExpression expression ) { if ( expression == null ) { return IConstants.EMPTY_STRING; } ExpressionCodec exprCodec = ChartModelHelper.instance( ) .createExpressionCodec( ); exprCodec.setType( expression.getType( ) ); exprCodec.setExpression( expression.getValue( ) ); return exprCodec.encode( ); }
/** * Encode script expression into a string * * @param expression * script expression * @return encoded expression string */
Encode script expression into a string
adaptExpression
{ "repo_name": "sguan-actuate/birt", "path": "chart/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/util/ChartUtil.java", "license": "epl-1.0", "size": 74337 }
[ "org.eclipse.birt.chart.computation.IConstants", "org.eclipse.birt.chart.model.data.ScriptExpression", "org.eclipse.birt.chart.model.impl.ChartModelHelper", "org.eclipse.birt.chart.util.ChartExpressionUtil" ]
import org.eclipse.birt.chart.computation.IConstants; import org.eclipse.birt.chart.model.data.ScriptExpression; import org.eclipse.birt.chart.model.impl.ChartModelHelper; import org.eclipse.birt.chart.util.ChartExpressionUtil;
import org.eclipse.birt.chart.computation.*; import org.eclipse.birt.chart.model.data.*; import org.eclipse.birt.chart.model.impl.*; import org.eclipse.birt.chart.util.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
952,190
@Test(timeout=60000) public void testIpcWithReaderQueuing() throws Exception { // 1 reader, 1 connectionQ slot, 1 callq for (int i=0; i < 10; i++) { checkBlocking(1, 1, 1); } // 4 readers, 5 connectionQ slots, 2 callq for (int i=0; i < 10; i++) { checkBlocking(4, 5, 2); } }
@Test(timeout=60000) void function() throws Exception { for (int i=0; i < 10; i++) { checkBlocking(1, 1, 1); } for (int i=0; i < 10; i++) { checkBlocking(4, 5, 2); } }
/** * Check that reader queueing works * @throws BrokenBarrierException * @throws InterruptedException */
Check that reader queueing works
testIpcWithReaderQueuing
{ "repo_name": "steveloughran/hadoop", "path": "hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java", "license": "apache-2.0", "size": 64299 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
469,246
public static void suspendTaskInstance(long taskInstanceId) throws WorkflowException { log.debug("suspendTaskInstance({})", taskInstanceId); JbpmContext jbpmContext = JBPMUtils.getConfig().createJbpmContext(); try { TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession(); org.jbpm.taskmgmt.exe.TaskInstance ti = taskMgmtSession.getTaskInstance(taskInstanceId); ti.suspend(); jbpmContext.getSession().flush(); } catch (JbpmException e) { throw new WorkflowException(e.getMessage(), e); } finally { jbpmContext.close(); } log.debug("suspendTaskInstance: void"); }
static void function(long taskInstanceId) throws WorkflowException { log.debug(STR, taskInstanceId); JbpmContext jbpmContext = JBPMUtils.getConfig().createJbpmContext(); try { TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession(); org.jbpm.taskmgmt.exe.TaskInstance ti = taskMgmtSession.getTaskInstance(taskInstanceId); ti.suspend(); jbpmContext.getSession().flush(); } catch (JbpmException e) { throw new WorkflowException(e.getMessage(), e); } finally { jbpmContext.close(); } log.debug(STR); }
/** * Suspend (pause) Task Instance */
Suspend (pause) Task Instance
suspendTaskInstance
{ "repo_name": "codelibs/n2dms", "path": "src/main/java/com/openkm/module/common/CommonWorkflowModule.java", "license": "gpl-2.0", "size": 39627 }
[ "com.openkm.bean.workflow.TaskInstance", "com.openkm.core.WorkflowException", "com.openkm.util.JBPMUtils", "org.jbpm.JbpmContext", "org.jbpm.JbpmException", "org.jbpm.db.TaskMgmtSession" ]
import com.openkm.bean.workflow.TaskInstance; import com.openkm.core.WorkflowException; import com.openkm.util.JBPMUtils; import org.jbpm.JbpmContext; import org.jbpm.JbpmException; import org.jbpm.db.TaskMgmtSession;
import com.openkm.bean.workflow.*; import com.openkm.core.*; import com.openkm.util.*; import org.jbpm.*; import org.jbpm.db.*;
[ "com.openkm.bean", "com.openkm.core", "com.openkm.util", "org.jbpm", "org.jbpm.db" ]
com.openkm.bean; com.openkm.core; com.openkm.util; org.jbpm; org.jbpm.db;
1,885,291
public String getSortAlbumArtist() { return Dispatch.get(this, "SortAlbumArtist").toString(); }
String function() { return Dispatch.get(this, STR).toString(); }
/** * Wrapper for calling the ActiveX-Method with input-parameter(s). * * @return the result is of type String */
Wrapper for calling the ActiveX-Method with input-parameter(s)
getSortAlbumArtist
{ "repo_name": "cpesch/MetaMusic", "path": "itunes-com-library/src/main/java/slash/metamusic/itunes/com/binding/IITFileOrCDTrack.java", "license": "gpl-2.0", "size": 32709 }
[ "com.jacob.com.Dispatch" ]
import com.jacob.com.Dispatch;
import com.jacob.com.*;
[ "com.jacob.com" ]
com.jacob.com;
1,588,006
EList<EPoint> getPath();
EList<EPoint> getPath();
/** * Returns the value of the '<em><b>Path</b></em>' containment reference list. * The list contents are of type {@link com.paxelerate.model.EPoint}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the value of the '<em>Path</em>' containment reference list. * @see com.paxelerate.model.monuments.MonumentsPackage#getAisle_Path() * @model containment="true" * @generated */
Returns the value of the 'Path' containment reference list. The list contents are of type <code>com.paxelerate.model.EPoint</code>.
getPath
{ "repo_name": "BauhausLuftfahrt/PAXelerate", "path": "com.paxelerate.model/src/com/paxelerate/model/monuments/Aisle.java", "license": "epl-1.0", "size": 4157 }
[ "com.paxelerate.model.EPoint", "org.eclipse.emf.common.util.EList" ]
import com.paxelerate.model.EPoint; import org.eclipse.emf.common.util.EList;
import com.paxelerate.model.*; import org.eclipse.emf.common.util.*;
[ "com.paxelerate.model", "org.eclipse.emf" ]
com.paxelerate.model; org.eclipse.emf;
1,275,527
protected MainDesktopPane getDesktop() { return desktop; }
MainDesktopPane function() { return desktop; }
/** * Gets the main desktop. * * @return desktop. */
Gets the main desktop
getDesktop
{ "repo_name": "mars-sim/mars-sim", "path": "mars-sim-ui/src/main/java/org/mars_sim/msp/ui/swing/unit_window/TabPanel.java", "license": "gpl-3.0", "size": 8983 }
[ "org.mars_sim.msp.ui.swing.MainDesktopPane" ]
import org.mars_sim.msp.ui.swing.MainDesktopPane;
import org.mars_sim.msp.ui.swing.*;
[ "org.mars_sim.msp" ]
org.mars_sim.msp;
432,658
public boolean isValidNumber(PhoneNumber number) { String regionCode = getRegionCodeForNumber(number); return isValidNumberForRegion(number, regionCode); }
boolean function(PhoneNumber number) { String regionCode = getRegionCodeForNumber(number); return isValidNumberForRegion(number, regionCode); }
/** * Tests whether a phone number matches a valid pattern. Note this doesn't verify the number * is actually in use, which is impossible to tell by just looking at a number itself. * * @param number the phone number that we want to validate * @return a boolean that indicates whether the number is of a valid pattern */
Tests whether a phone number matches a valid pattern. Note this doesn't verify the number is actually in use, which is impossible to tell by just looking at a number itself
isValidNumber
{ "repo_name": "xtremelabs/libphonenumber", "path": "java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java", "license": "apache-2.0", "size": 160935 }
[ "com.google.i18n.phonenumbers.Phonenumber" ]
import com.google.i18n.phonenumbers.Phonenumber;
import com.google.i18n.phonenumbers.*;
[ "com.google.i18n" ]
com.google.i18n;
2,445,196
protected boolean validateBlockChecksum(HFileBlock block, byte[] data, int hdrSize) throws IOException { return ChecksumUtil.validateBlockChecksum(path, block, data, hdrSize); }
boolean function(HFileBlock block, byte[] data, int hdrSize) throws IOException { return ChecksumUtil.validateBlockChecksum(path, block, data, hdrSize); }
/** * Generates the checksum for the header as well as the data and * then validates that it matches the value stored in the header. * If there is a checksum mismatch, then return false. Otherwise * return true. */
Generates the checksum for the header as well as the data and then validates that it matches the value stored in the header. If there is a checksum mismatch, then return false. Otherwise return true
validateBlockChecksum
{ "repo_name": "amyvmiwei/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java", "license": "apache-2.0", "size": 75136 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,138,436
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<VpnGatewayInner> listByResourceGroup(String resourceGroupName);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<VpnGatewayInner> listByResourceGroup(String resourceGroupName);
/** * Lists all the VpnGateways in a resource group. * * @param resourceGroupName The resource group name of the VpnGateway. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.network.models.ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of the request to list VpnGateways. */
Lists all the VpnGateways in a resource group
listByResourceGroup
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/VpnGatewaysClient.java", "license": "mit", "size": 24769 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.network.fluent.models.VpnGatewayInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.network.fluent.models.VpnGatewayInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,836,371
protected void generateColumns(Metadata metadata){ for(MetadataColumn metadataColumn : metadata.getColumns()){ //skip current_datetime if(metadata.getSourceType() == Metadata.SourceType.ENGINE && COLUMN_NAME_CURRENT_DATETIME.equals(metadataColumn.getPhysicalName()) && metadataColumn.getRole() == Field.FieldRole.TIMESTAMP){ continue; } columnNames.add(metadataColumn.getPhysicalName()); //Create column description //column field role Map additionalMap = metadataColumn.getAdditionalContextMap(); if(additionalMap == null){ additionalMap = new HashMap(); } additionalMap.put("role", metadataColumn.getRole()); ColumnDescription columnDescription = new ColumnDescription(metadataColumn.getName(), metadataColumn.getType() == null ? DataType.UNKNOWN.toLogicalType().toString() : metadataColumn.getType().toString(), metadataColumn.getPhysicalName(), metadataColumn.getPhysicalType(), GlobalObjectMapper.readValue(metadataColumn.getFormat()), additionalMap); columnDescriptions.add(columnDescription); columnIndex.put(metadataColumn.getPhysicalName(), metadata.getColumns().indexOf(metadataColumn)); } }
void function(Metadata metadata){ for(MetadataColumn metadataColumn : metadata.getColumns()){ if(metadata.getSourceType() == Metadata.SourceType.ENGINE && COLUMN_NAME_CURRENT_DATETIME.equals(metadataColumn.getPhysicalName()) && metadataColumn.getRole() == Field.FieldRole.TIMESTAMP){ continue; } columnNames.add(metadataColumn.getPhysicalName()); Map additionalMap = metadataColumn.getAdditionalContextMap(); if(additionalMap == null){ additionalMap = new HashMap(); } additionalMap.put("role", metadataColumn.getRole()); ColumnDescription columnDescription = new ColumnDescription(metadataColumn.getName(), metadataColumn.getType() == null ? DataType.UNKNOWN.toLogicalType().toString() : metadataColumn.getType().toString(), metadataColumn.getPhysicalName(), metadataColumn.getPhysicalType(), GlobalObjectMapper.readValue(metadataColumn.getFormat()), additionalMap); columnDescriptions.add(columnDescription); columnIndex.put(metadataColumn.getPhysicalName(), metadata.getColumns().indexOf(metadataColumn)); } }
/** * Generate columns. * * @param metadata the metadata */
Generate columns
generateColumns
{ "repo_name": "metatron-app/metatron-discovery", "path": "discovery-server/src/main/java/app/metatron/discovery/domain/mdm/preview/MetadataDataPreview.java", "license": "apache-2.0", "size": 5435 }
[ "app.metatron.discovery.common.GlobalObjectMapper", "app.metatron.discovery.common.data.projection.ColumnDescription", "app.metatron.discovery.common.datasource.DataType", "app.metatron.discovery.domain.datasource.Field", "app.metatron.discovery.domain.mdm.Metadata", "app.metatron.discovery.domain.mdm.Met...
import app.metatron.discovery.common.GlobalObjectMapper; import app.metatron.discovery.common.data.projection.ColumnDescription; import app.metatron.discovery.common.datasource.DataType; import app.metatron.discovery.domain.datasource.Field; import app.metatron.discovery.domain.mdm.Metadata; import app.metatron.discovery.domain.mdm.MetadataColumn; import java.util.HashMap; import java.util.Map;
import app.metatron.discovery.common.*; import app.metatron.discovery.common.data.projection.*; import app.metatron.discovery.common.datasource.*; import app.metatron.discovery.domain.datasource.*; import app.metatron.discovery.domain.mdm.*; import java.util.*;
[ "app.metatron.discovery", "java.util" ]
app.metatron.discovery; java.util;
532,799
@Test public void whenSetEmailThenItChanges() { this.client.setEmail("test@test.ru"); assertThat(this.client.getEmail(), is("test@test.ru")); }
void function() { this.client.setEmail(STR); assertThat(this.client.getEmail(), is(STR)); }
/** * Test correctness of <code>setEmail</code> and <code>getEmail</code> method. */
Test correctness of <code>setEmail</code> and <code>getEmail</code> method
whenSetEmailThenItChanges
{ "repo_name": "lightstar/job4j-clinic", "path": "src/test/java/ru/lightstar/clinic/model/ClientTest.java", "license": "gpl-3.0", "size": 6010 }
[ "org.hamcrest.CoreMatchers", "org.junit.Assert" ]
import org.hamcrest.CoreMatchers; import org.junit.Assert;
import org.hamcrest.*; import org.junit.*;
[ "org.hamcrest", "org.junit" ]
org.hamcrest; org.junit;
2,904,826
protected Group createGroup( Composite textArea , String name , Control t_previous , Control l_previous , boolean toRight , int height , int width , boolean toBottom) { Group groupBody = new Group(textArea, SWT.NONE); groupBody.setBackground(textArea.getBackground()); groupBody.setLayout(new FormLayout()); groupBody.setText(" " + name + " "); groupBody.setFont(Activator.VIEW_FONT); FormData data = new FormData(); if(t_previous != null) { data.top = new FormAttachment(t_previous, H_SPACE); } if(l_previous != null) { data.left = new FormAttachment(l_previous, H_SPACE); } if(data.top == null) { data.top = new FormAttachment(0, H_SPACE); } if(data.left == null) { data.left = new FormAttachment(0, H_SPACE); } if(toBottom) { data.bottom = new FormAttachment(100, -H_SPACE); } else if(height != 0) { data.bottom = new FormAttachment(height); } if(toRight) { data.right = new FormAttachment(100, -H_SPACE); } else { data.right = new FormAttachment(width, 0); } groupBody.setLayoutData(data); return groupBody; }
Group function( Composite textArea , String name , Control t_previous , Control l_previous , boolean toRight , int height , int width , boolean toBottom) { Group groupBody = new Group(textArea, SWT.NONE); groupBody.setBackground(textArea.getBackground()); groupBody.setLayout(new FormLayout()); groupBody.setText(" " + name + " "); groupBody.setFont(Activator.VIEW_FONT); FormData data = new FormData(); if(t_previous != null) { data.top = new FormAttachment(t_previous, H_SPACE); } if(l_previous != null) { data.left = new FormAttachment(l_previous, H_SPACE); } if(data.top == null) { data.top = new FormAttachment(0, H_SPACE); } if(data.left == null) { data.left = new FormAttachment(0, H_SPACE); } if(toBottom) { data.bottom = new FormAttachment(100, -H_SPACE); } else if(height != 0) { data.bottom = new FormAttachment(height); } if(toRight) { data.right = new FormAttachment(100, -H_SPACE); } else { data.right = new FormAttachment(width, 0); } groupBody.setLayoutData(data); return groupBody; }
/** * Create a group for a text area * * @param textArea * parent composite * @param name * of the group * @param t_previous * attached to top border * @param l_previous * attached to left border * @param toRight * should group reach right border of parent * @param height * of text in percent of group size * @param width * of text in percent of group size * @param toBottom * should group reach bottom of parent * @return new Group */
Create a group for a text area
createGroup
{ "repo_name": "RobotML/RobotML-SDK-Juno", "path": "plugins/robotml/com.cea.papyrus.views.cpp/src/com/cea/papyrus/views/panels/CppAbstractPanel.java", "license": "epl-1.0", "size": 13556 }
[ "com.cea.papyrus.views.cpp.Activator", "org.eclipse.swt.layout.FormAttachment", "org.eclipse.swt.layout.FormData", "org.eclipse.swt.layout.FormLayout", "org.eclipse.swt.widgets.Composite", "org.eclipse.swt.widgets.Control", "org.eclipse.swt.widgets.Group" ]
import com.cea.papyrus.views.cpp.Activator; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group;
import com.cea.papyrus.views.cpp.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*;
[ "com.cea.papyrus", "org.eclipse.swt" ]
com.cea.papyrus; org.eclipse.swt;
449,002
private void notifySampleListeners(SampleEvent event) { JMeterTreeModel treeModel = GuiPackage.getInstance().getTreeModel(); JMeterTreeNode myNode = treeModel.getNodeOf(this); Enumeration<JMeterTreeNode> kids = myNode.children(); while (kids.hasMoreElements()) { JMeterTreeNode subNode = kids.nextElement(); if (subNode.isEnabled()) { TestElement testElement = subNode.getTestElement(); if (testElement instanceof SampleListener) { ((SampleListener) testElement).sampleOccurred(event); } } } }
void function(SampleEvent event) { JMeterTreeModel treeModel = GuiPackage.getInstance().getTreeModel(); JMeterTreeNode myNode = treeModel.getNodeOf(this); Enumeration<JMeterTreeNode> kids = myNode.children(); while (kids.hasMoreElements()) { JMeterTreeNode subNode = kids.nextElement(); if (subNode.isEnabled()) { TestElement testElement = subNode.getTestElement(); if (testElement instanceof SampleListener) { ((SampleListener) testElement).sampleOccurred(event); } } } }
/** * This will notify sample listeners directly within the Proxy of the * sampling that just occured -- so that we have a means to record the * server's responses as we go. * * @param event * sampling event to be delivered */
This will notify sample listeners directly within the Proxy of the sampling that just occured -- so that we have a means to record the server's responses as we go
notifySampleListeners
{ "repo_name": "DoctorQ/jmeter", "path": "src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java", "license": "apache-2.0", "size": 64808 }
[ "java.util.Enumeration", "org.apache.jmeter.gui.GuiPackage", "org.apache.jmeter.gui.tree.JMeterTreeModel", "org.apache.jmeter.gui.tree.JMeterTreeNode", "org.apache.jmeter.samplers.SampleEvent", "org.apache.jmeter.samplers.SampleListener", "org.apache.jmeter.testelement.TestElement" ]
import java.util.Enumeration; import org.apache.jmeter.gui.GuiPackage; import org.apache.jmeter.gui.tree.JMeterTreeModel; import org.apache.jmeter.gui.tree.JMeterTreeNode; import org.apache.jmeter.samplers.SampleEvent; import org.apache.jmeter.samplers.SampleListener; import org.apache.jmeter.testelement.TestElement;
import java.util.*; import org.apache.jmeter.gui.*; import org.apache.jmeter.gui.tree.*; import org.apache.jmeter.samplers.*; import org.apache.jmeter.testelement.*;
[ "java.util", "org.apache.jmeter" ]
java.util; org.apache.jmeter;
2,328,257
private FileSystem createFileSystem(Principal user, String doAs) throws IOException, FileSystemAccessException { String hadoopUser = getEffectiveUser(user, doAs); FileSystemAccess fsAccess = HttpFSServerWebApp.get().get(FileSystemAccess.class); Configuration conf = HttpFSServerWebApp.get().get(FileSystemAccess.class) .getFileSystemConfiguration(); FileSystem fs = fsAccess.createFileSystem(hadoopUser, conf); FileSystemReleaseFilter.setFileSystem(fs); return fs; }
FileSystem function(Principal user, String doAs) throws IOException, FileSystemAccessException { String hadoopUser = getEffectiveUser(user, doAs); FileSystemAccess fsAccess = HttpFSServerWebApp.get().get(FileSystemAccess.class); Configuration conf = HttpFSServerWebApp.get().get(FileSystemAccess.class) .getFileSystemConfiguration(); FileSystem fs = fsAccess.createFileSystem(hadoopUser, conf); FileSystemReleaseFilter.setFileSystem(fs); return fs; }
/** * Returns a filesystem instance. The fileystem instance is wired for release * at the completion of * the current Servlet request via the {@link FileSystemReleaseFilter}. * <p/> * If a do-as user is specified, the current user must be a valid proxyuser, * otherwise an * <code>AccessControlException</code> will be thrown. * * @param user * principal for whom the filesystem instance is. * @param doAs * do-as user, if any. * @return a filesystem for the specified user or do-as user. * @throws IOException * thrown if an IO error occurred. Thrown exceptions are * handled by {@link HttpFSExceptionProvider}. * @throws FileSystemAccessException * thrown if a FileSystemAccess releated error occurred. Thrown * exceptions are handled by {@link HttpFSExceptionProvider}. */
Returns a filesystem instance. The fileystem instance is wired for release at the completion of the current Servlet request via the <code>FileSystemReleaseFilter</code>. If a do-as user is specified, the current user must be a valid proxyuser, otherwise an <code>AccessControlException</code> will be thrown
createFileSystem
{ "repo_name": "robzor92/hops", "path": "hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSServer.java", "license": "apache-2.0", "size": 24367 }
[ "java.io.IOException", "java.security.Principal", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.lib.service.FileSystemAccess", "org.apache.hadoop.lib.service.FileSystemAccessException", "org.apache.hadoop.lib.servlet.FileSystemReleaseFilter" ]
import java.io.IOException; import java.security.Principal; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.lib.service.FileSystemAccess; import org.apache.hadoop.lib.service.FileSystemAccessException; import org.apache.hadoop.lib.servlet.FileSystemReleaseFilter;
import java.io.*; import java.security.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.lib.service.*; import org.apache.hadoop.lib.servlet.*;
[ "java.io", "java.security", "org.apache.hadoop" ]
java.io; java.security; org.apache.hadoop;
397,063
public Point3 getCenter() { Check.state(!isEmpty(),"bounding sphere is not empty"); Check.state(!isInfinite(),"bounding sphere is not infinite"); return new Point3(_x,_y,_z); }
Point3 function() { Check.state(!isEmpty(),STR); Check.state(!isInfinite(),STR); return new Point3(_x,_y,_z); }
/** * Gets the sphere center. * @return the center. */
Gets the sphere center
getCenter
{ "repo_name": "ctrueden/jtk", "path": "src/main/java/edu/mines/jtk/sgl/BoundingSphere.java", "license": "epl-1.0", "size": 11899 }
[ "edu.mines.jtk.util.Check" ]
import edu.mines.jtk.util.Check;
import edu.mines.jtk.util.*;
[ "edu.mines.jtk" ]
edu.mines.jtk;
2,688,013
public Layout.Alignment getTextAlign() { return mTextAlignment; }
Layout.Alignment function() { return mTextAlignment; }
/** * Return the current text alignment setting */
Return the current text alignment setting
getTextAlign
{ "repo_name": "wangkang0627/WordPress-Android", "path": "WordPress/src/main/java/org/wordpress/android/widgets/TextDrawable.java", "license": "gpl-2.0", "size": 13698 }
[ "android.text.Layout" ]
import android.text.Layout;
import android.text.*;
[ "android.text" ]
android.text;
2,556,795
public @Nonnull TopologyFilterOptions withTags(@Nonnull Map<String, String> tags) { this.tags = tags; return this; }
@Nonnull TopologyFilterOptions function(@Nonnull Map<String, String> tags) { this.tags = tags; return this; }
/** * Sets the tags to filter against. * @param tags the tags to filter against * @return this */
Sets the tags to filter against
withTags
{ "repo_name": "OSS-TheWeatherCompany/dasein-cloud-core", "path": "src/main/java/org/dasein/cloud/ci/TopologyFilterOptions.java", "license": "apache-2.0", "size": 5468 }
[ "java.util.Map", "javax.annotation.Nonnull" ]
import java.util.Map; import javax.annotation.Nonnull;
import java.util.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
636,998
EReference getExecutionRegion_Nodes();
EReference getExecutionRegion_Nodes();
/** * Returns the meta object for the reference list '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getNodes <em>Nodes</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference list '<em>Nodes</em>'. * @see org.yakindu.sct.model.sexec.ExecutionRegion#getNodes() * @see #getExecutionRegion() * @generated */
Returns the meta object for the reference list '<code>org.yakindu.sct.model.sexec.ExecutionRegion#getNodes Nodes</code>'.
getExecutionRegion_Nodes
{ "repo_name": "Yakindu/statecharts", "path": "plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecPackage.java", "license": "epl-1.0", "size": 168724 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
456,159
private static boolean isKeyValueArrayMethod(JSONObject mapJSON) { if (mapJSON.has(RelevanceJSONConstants.KW_KEY) && mapJSON.has(RelevanceJSONConstants.KW_VALUE)) { JSONArray keysList = mapJSON.optJSONArray(RelevanceJSONConstants.KW_KEY); JSONArray valuesList = mapJSON.optJSONArray(RelevanceJSONConstants.KW_VALUE); if (keysList != null && valuesList != null) return true; } return false; }
static boolean function(JSONObject mapJSON) { if (mapJSON.has(RelevanceJSONConstants.KW_KEY) && mapJSON.has(RelevanceJSONConstants.KW_VALUE)) { JSONArray keysList = mapJSON.optJSONArray(RelevanceJSONConstants.KW_KEY); JSONArray valuesList = mapJSON.optJSONArray(RelevanceJSONConstants.KW_VALUE); if (keysList != null && valuesList != null) return true; } return false; }
/** * check if in the JSON values part the map variable is represented in a json map way or two key and value json array; * "JsonMapway":{"1":2.3, "2":3.4, "3":2.9} // A user input hashmap; * "KeyValueJsonArrayPairWay":{"key":[1,2,3], "value":[2.3, 3.4, 2.9]} // It also supports this method to pass in a map. * @param values * @return boolean */
check if in the JSON values part the map variable is represented in a json map way or two key and value json array; "JsonMapway":{"1":2.3, "2":3.4, "3":2.9} // A user input hashmap; "KeyValueJsonArrayPairWay":{"key":[1,2,3], "value":[2.3, 3.4, 2.9]} // It also supports this method to pass in a map
isKeyValueArrayMethod
{ "repo_name": "senseidb/sensei", "path": "sensei-core/src/main/java/com/senseidb/search/relevance/impl/CompilationHelper.java", "license": "apache-2.0", "size": 49877 }
[ "org.json.JSONArray", "org.json.JSONObject" ]
import org.json.JSONArray; import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
122,092