method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private static double findUpgradeUnitEfficiency( final ProPurchaseOption ppo, final double strategicValue) { final double multiplier = (strategicValue >= 1) ? ppo.getDefenseEfficiency() : ppo.getMovement(); return ppo.getAttackEfficiency() * multiplier * ppo.getCost() / ppo.getQuantity(); }
static double function( final ProPurchaseOption ppo, final double strategicValue) { final double multiplier = (strategicValue >= 1) ? ppo.getDefenseEfficiency() : ppo.getMovement(); return ppo.getAttackEfficiency() * multiplier * ppo.getCost() / ppo.getQuantity(); }
/** * Determine efficiency value for upgrading to the given purchase option. If the strategic value * of the territory is low then favor high movement units as its far from the enemy otherwise * favor high defense. */
Determine efficiency value for upgrading to the given purchase option. If the strategic value of the territory is low then favor high movement units as its far from the enemy otherwise favor high defense
findUpgradeUnitEfficiency
{ "repo_name": "DanVanAtta/triplea", "path": "game-core/src/main/java/games/strategy/triplea/ai/pro/ProPurchaseAi.java", "license": "gpl-3.0", "size": 115076 }
[ "games.strategy.triplea.ai.pro.data.ProPurchaseOption" ]
import games.strategy.triplea.ai.pro.data.ProPurchaseOption;
import games.strategy.triplea.ai.pro.data.*;
[ "games.strategy.triplea" ]
games.strategy.triplea;
2,042,447
private void skipStores() throws IOException { // Get stores specifically List<LOStore> sinks = Util.getLogicalRelationalOperators(lp, LOStore.class); List<Operator> sinksToRemove = new ArrayList<Operator>(); int skipCount = processedStores; if( skipCount > 0 ) { for( LOStore sink : sinks ) { sinksToRemove.add( sink ); skipCount--; if( skipCount == 0 ) break; } } for( Operator op : sinksToRemove ) { // It's fully possible in the multiquery case that // a store that is not a leaf (sink) and therefor has // successors that need to be removed. removeToLoad(op); Operator pred = lp.getPredecessors( op ).get(0); lp.disconnect( pred, op ); lp.remove( op ); } }
void function() throws IOException { List<LOStore> sinks = Util.getLogicalRelationalOperators(lp, LOStore.class); List<Operator> sinksToRemove = new ArrayList<Operator>(); int skipCount = processedStores; if( skipCount > 0 ) { for( LOStore sink : sinks ) { sinksToRemove.add( sink ); skipCount--; if( skipCount == 0 ) break; } } for( Operator op : sinksToRemove ) { removeToLoad(op); Operator pred = lp.getPredecessors( op ).get(0); lp.disconnect( pred, op ); lp.remove( op ); } }
/** * Remove stores that have been executed previously from the overall plan. */
Remove stores that have been executed previously from the overall plan
skipStores
{ "repo_name": "apache/pig", "path": "src/org/apache/pig/PigServer.java", "license": "apache-2.0", "size": 77089 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.pig.newplan.Operator", "org.apache.pig.newplan.logical.Util", "org.apache.pig.newplan.logical.relational.LOStore" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.pig.newplan.Operator; import org.apache.pig.newplan.logical.Util; import org.apache.pig.newplan.logical.relational.LOStore;
import java.io.*; import java.util.*; import org.apache.pig.newplan.*; import org.apache.pig.newplan.logical.*; import org.apache.pig.newplan.logical.relational.*;
[ "java.io", "java.util", "org.apache.pig" ]
java.io; java.util; org.apache.pig;
892,087
private List<Path> buildParentPath(String pathList, int restSize) { List<Path> r = new ArrayList<>(); StringTokenizer tokens = new StringTokenizer(pathList, "/"); int total = tokens.countTokens(); int current = 1; while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); r.add(new Path(createBackRef(total - current + restSize), token, true, 0, true, 0)); current++; } return r; }
List<Path> function(String pathList, int restSize) { List<Path> r = new ArrayList<>(); StringTokenizer tokens = new StringTokenizer(pathList, "/"); int total = tokens.countTokens(); int current = 1; while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); r.add(new Path(createBackRef(total - current + restSize), token, true, 0, true, 0)); current++; } return r; }
/** * Builds a list of {@link Path} that represents ancestors * from a string like "/foo/bar/zot". */
Builds a list of <code>Path</code> that represents ancestors from a string like "/foo/bar/zot"
buildParentPath
{ "repo_name": "jenkinsci/jenkins", "path": "core/src/main/java/hudson/model/DirectoryBrowserSupport.java", "license": "mit", "size": 33934 }
[ "java.util.ArrayList", "java.util.List", "java.util.StringTokenizer" ]
import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer;
import java.util.*;
[ "java.util" ]
java.util;
1,149,107
void setFont(IRow row, IColumn column, FontData fontdata);
void setFont(IRow row, IColumn column, FontData fontdata);
/** * Convenience method for setting the font. The method will create a cell style for the element or manipulate the * already set style. * * @param row row of th cell * @param column column of the cell * @param fontdata font data for the font to use */
Convenience method for setting the font. The method will create a cell style for the element or manipulate the already set style
setFont
{ "repo_name": "heartsome/tmxeditor8", "path": "base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyleProvider.java", "license": "gpl-2.0", "size": 9569 }
[ "de.jaret.util.ui.table.model.IColumn", "de.jaret.util.ui.table.model.IRow", "org.eclipse.swt.graphics.FontData" ]
import de.jaret.util.ui.table.model.IColumn; import de.jaret.util.ui.table.model.IRow; import org.eclipse.swt.graphics.FontData;
import de.jaret.util.ui.table.model.*; import org.eclipse.swt.graphics.*;
[ "de.jaret.util", "org.eclipse.swt" ]
de.jaret.util; org.eclipse.swt;
2,663,220
CompletableFuture<Consumer<T>> subscribeAsync();
CompletableFuture<Consumer<T>> subscribeAsync();
/** * Finalize the {@link Consumer} creation by subscribing to the topic in asynchronous mode. * * <p> * If the subscription does not exist, a new subscription will be created and all messages published after the * creation will be retained until acknowledged, even if the consumer is not connected. * * @return a future that will yield a {@link Consumer} instance * @throws PulsarClientException * if the the subscribe operation fails */
Finalize the <code>Consumer</code> creation by subscribing to the topic in asynchronous mode. If the subscription does not exist, a new subscription will be created and all messages published after the creation will be retained until acknowledged, even if the consumer is not connected
subscribeAsync
{ "repo_name": "ArvinDevel/incubator-pulsar", "path": "pulsar-client/src/main/java/org/apache/pulsar/client/api/ConsumerBuilder.java", "license": "apache-2.0", "size": 14301 }
[ "java.util.concurrent.CompletableFuture" ]
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,898,590
public static void runWizard(Shell shell, Wizard wizard, String settingsKey) { IDialogSettings pluginDialogSettings = Wc2014DiagramEditorPlugin .getInstance().getDialogSettings(); IDialogSettings wizardDialogSettings = pluginDialogSettings .getSection(settingsKey); if (wizardDialogSettings == null) { wizardDialogSettings = pluginDialogSettings .addNewSection(settingsKey); } wizard.setDialogSettings(wizardDialogSettings); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500); dialog.open(); }
static void function(Shell shell, Wizard wizard, String settingsKey) { IDialogSettings pluginDialogSettings = Wc2014DiagramEditorPlugin .getInstance().getDialogSettings(); IDialogSettings wizardDialogSettings = pluginDialogSettings .getSection(settingsKey); if (wizardDialogSettings == null) { wizardDialogSettings = pluginDialogSettings .addNewSection(settingsKey); } wizard.setDialogSettings(wizardDialogSettings); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500); dialog.open(); }
/** * Runs the wizard in a dialog. * * @generated */
Runs the wizard in a dialog
runWizard
{ "repo_name": "ggxx/HelloBrazil", "path": "src/edu.thu.ggxx.hellobrazil.diagram/src/edu/thu/ggxx/hellobrazil/wc2014/diagram/part/Wc2014DiagramEditorUtil.java", "license": "mit", "size": 13025 }
[ "org.eclipse.jface.dialogs.IDialogSettings", "org.eclipse.jface.wizard.Wizard", "org.eclipse.jface.wizard.WizardDialog", "org.eclipse.swt.widgets.Shell" ]
import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.dialogs.*; import org.eclipse.jface.wizard.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.jface", "org.eclipse.swt" ]
org.eclipse.jface; org.eclipse.swt;
1,048,095
public void copyConfFilesToDefaultLocation(String confFile, String keytabFile) throws Exception { String methodName = "copyConfFilesToDefaultLocation"; try { if (confFile != null) { Log.info(thisClass, methodName, "Kerberos configuration file will be copied to default location"); RemoteFile confFilePath = server.getFileFromLibertyServerRoot(SPNEGOConstants.KRB_RESOURCE_LOCATION.substring(1) + confFile); String defaultConfFileName = SPNEGOConstants.KRB5_CONF_FILE; //If and only if the OS is Windows, we change the file name to be the krb5.ini if (serverOS.toString().equals("WINDOWS")) { defaultConfFileName = SPNEGOConstants.KRB5_INI_FILE; } //We now proceed to try and copy the krb conf file at the default location. LocalFile confDefaultFilePath = new LocalFile(krb5DefaultLocation + defaultConfFileName); copiedAtDefault = copyKrbFilestoDefaultLocation(defaultConfFileName, confFilePath, confDefaultFilePath); Log.info(thisClass, methodName, "Kerberos configuration file move result: " + copiedAtDefault); //We confirm that the file we tried to copy was the krb5.ini. if (defaultConfFileName != SPNEGOConstants.KRB5_INI_FILE) { copiedAtDefault = false; } //If we were able to copy the file then we trigger the flag that let us know that we created the file on this run. if (copiedAtDefault) { waskrbiniCreatedAtDefault = true; } //if we were able to create the file and it was created at the windows directory, we trigger the flag that we //did this on this run. if (copiedAtWindowsDir && copiedAtDefault) { copiedkrbiniAtWindowsDir = true; } Log.info(thisClass, methodName, "Is the filed copied at the default location: krb5.ini: " + copiedAtDefault); } else { Log.info(thisClass, methodName, "Kerberos configuration file will NOT be copied to default location"); } if (keytabFile != null) { Log.info(thisClass, methodName, "Kerberos keytab file will be copied to default location"); //We proceed to try and copy the keytab at the default location. RemoteFile keytabFilePath = server.getFileFromLibertyServerRoot(SPNEGOConstants.KRB_RESOURCE_LOCATION.substring(1) + keytabFile); LocalFile keytabDefaultFilePath = new LocalFile(krb5DefaultLocation + SPNEGOConstants.KRB5_KEYTAB_FILE); copiedAtDefault = copyKrbFilestoDefaultLocation(SPNEGOConstants.KRB5_KEYTAB_FILE, keytabFilePath, keytabDefaultFilePath); Log.info(thisClass, methodName, "Kerberos keytab file move result: " + copiedAtDefault); //If we were able to copy the file at the default location, we trigger the flag that we did this on this run. if (copiedAtDefault) { waskeyTabCreatedAtDefault = true; } //If we were able to copy this file and it was on the windows directory, we trigger the flag that we did this on this run. if (copiedAtWindowsDir && copiedAtDefault) { copiedkeyTabAtWindowsDir = true; } } else { Log.info(thisClass, methodName, "Kerberos keytab file will NOT be copied to default location"); } } catch (Exception e) { e.printStackTrace(); throw e; } }
void function(String confFile, String keytabFile) throws Exception { String methodName = STR; try { if (confFile != null) { Log.info(thisClass, methodName, STR); RemoteFile confFilePath = server.getFileFromLibertyServerRoot(SPNEGOConstants.KRB_RESOURCE_LOCATION.substring(1) + confFile); String defaultConfFileName = SPNEGOConstants.KRB5_CONF_FILE; if (serverOS.toString().equals(STR)) { defaultConfFileName = SPNEGOConstants.KRB5_INI_FILE; } LocalFile confDefaultFilePath = new LocalFile(krb5DefaultLocation + defaultConfFileName); copiedAtDefault = copyKrbFilestoDefaultLocation(defaultConfFileName, confFilePath, confDefaultFilePath); Log.info(thisClass, methodName, STR + copiedAtDefault); if (defaultConfFileName != SPNEGOConstants.KRB5_INI_FILE) { copiedAtDefault = false; } if (copiedAtDefault) { waskrbiniCreatedAtDefault = true; } if (copiedAtWindowsDir && copiedAtDefault) { copiedkrbiniAtWindowsDir = true; } Log.info(thisClass, methodName, STR + copiedAtDefault); } else { Log.info(thisClass, methodName, STR); } if (keytabFile != null) { Log.info(thisClass, methodName, STR); RemoteFile keytabFilePath = server.getFileFromLibertyServerRoot(SPNEGOConstants.KRB_RESOURCE_LOCATION.substring(1) + keytabFile); LocalFile keytabDefaultFilePath = new LocalFile(krb5DefaultLocation + SPNEGOConstants.KRB5_KEYTAB_FILE); copiedAtDefault = copyKrbFilestoDefaultLocation(SPNEGOConstants.KRB5_KEYTAB_FILE, keytabFilePath, keytabDefaultFilePath); Log.info(thisClass, methodName, STR + copiedAtDefault); if (copiedAtDefault) { waskeyTabCreatedAtDefault = true; } if (copiedAtWindowsDir && copiedAtDefault) { copiedkeyTabAtWindowsDir = true; } } else { Log.info(thisClass, methodName, STR); } } catch (Exception e) { e.printStackTrace(); throw e; } }
/** * Copies the Kerberos configuration and keytab files from the Kerberos resource location within the server root * to the KDC-dependent default location. Specifying null for either argument will result in no move operation * being done on that file. * * @param confFile * @param keytabFile * @throws Exception */
Copies the Kerberos configuration and keytab files from the Kerberos resource location within the server root to the KDC-dependent default location. Specifying null for either argument will result in no move operation being done on that file
copyConfFilesToDefaultLocation
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.security.spnego.fat.common/fat/src/com/ibm/ws/security/spnego/fat/config/KdcHelper.java", "license": "epl-1.0", "size": 49972 }
[ "com.ibm.websphere.simplicity.LocalFile", "com.ibm.websphere.simplicity.RemoteFile", "com.ibm.websphere.simplicity.log.Log" ]
import com.ibm.websphere.simplicity.LocalFile; import com.ibm.websphere.simplicity.RemoteFile; import com.ibm.websphere.simplicity.log.Log;
import com.ibm.websphere.simplicity.*; import com.ibm.websphere.simplicity.log.*;
[ "com.ibm.websphere" ]
com.ibm.websphere;
1,133,662
FieldProviderResponse overrideViaAnnotation(OverrideViaAnnotationRequest overrideViaAnnotationRequest, Map<String, FieldMetadata> metadata);
FieldProviderResponse overrideViaAnnotation(OverrideViaAnnotationRequest overrideViaAnnotationRequest, Map<String, FieldMetadata> metadata);
/** * Contribute to metadata inspection for the entity in the request. Implementations should override values * in the metadata parameter. * * @param overrideViaAnnotationRequest contains the requested entity and support classes. * @param metadata implementations should override metadata here * @return whether or not this implementation adjusted metadata */
Contribute to metadata inspection for the entity in the request. Implementations should override values in the metadata parameter
overrideViaAnnotation
{ "repo_name": "liqianggao/BroadleafCommerce", "path": "admin/broadleaf-open-admin-platform/src/main/java/org/broadleafcommerce/openadmin/server/dao/provider/metadata/FieldMetadataProvider.java", "license": "apache-2.0", "size": 6069 }
[ "java.util.Map", "org.broadleafcommerce.openadmin.dto.FieldMetadata", "org.broadleafcommerce.openadmin.server.dao.provider.metadata.request.OverrideViaAnnotationRequest", "org.broadleafcommerce.openadmin.server.service.type.FieldProviderResponse" ]
import java.util.Map; import org.broadleafcommerce.openadmin.dto.FieldMetadata; import org.broadleafcommerce.openadmin.server.dao.provider.metadata.request.OverrideViaAnnotationRequest; import org.broadleafcommerce.openadmin.server.service.type.FieldProviderResponse;
import java.util.*; import org.broadleafcommerce.openadmin.dto.*; import org.broadleafcommerce.openadmin.server.dao.provider.metadata.request.*; import org.broadleafcommerce.openadmin.server.service.type.*;
[ "java.util", "org.broadleafcommerce.openadmin" ]
java.util; org.broadleafcommerce.openadmin;
1,980,271
public static void logRecordBatchStats(String sourceId, RecordBatch recordBatch, RecordBatchStatsContext batchStatsContext) { if (!batchStatsContext.isEnableBatchSzLogging()) { return; // NOOP } final String statsId = batchStatsContext.getContextOperatorId(); final boolean verbose = batchStatsContext.isEnableFgBatchSzLogging(); final String msg = printRecordBatchStats(statsId, sourceId, recordBatch, verbose); logBatchStatsMsg(batchStatsContext, msg, false); }
static void function(String sourceId, RecordBatch recordBatch, RecordBatchStatsContext batchStatsContext) { if (!batchStatsContext.isEnableBatchSzLogging()) { return; } final String statsId = batchStatsContext.getContextOperatorId(); final boolean verbose = batchStatsContext.isEnableFgBatchSzLogging(); final String msg = printRecordBatchStats(statsId, sourceId, recordBatch, verbose); logBatchStatsMsg(batchStatsContext, msg, false); }
/** * Logs record batch statistics for the input record batch (logging happens only * when record statistics logging is enabled). * * @param sourceId optional source identifier for scanners * @param recordBatch a set of records * @param batchStatsContext batch stats context object */
Logs record batch statistics for the input record batch (logging happens only when record statistics logging is enabled)
logRecordBatchStats
{ "repo_name": "cchang738/drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/util/record/RecordBatchStats.java", "license": "apache-2.0", "size": 9404 }
[ "org.apache.drill.exec.record.RecordBatch" ]
import org.apache.drill.exec.record.RecordBatch;
import org.apache.drill.exec.record.*;
[ "org.apache.drill" ]
org.apache.drill;
1,691,941
if(!NetworkUtils.isConnected(context)) throw new TwitterClientException("The device is connected to the internet!"); String apiUrl = getApiUrl("account/verify_credentials.json"); // params RequestParams params = new RequestParams(); // execute request client.get(apiUrl, params, handler); }
if(!NetworkUtils.isConnected(context)) throw new TwitterClientException(STR); String apiUrl = getApiUrl(STR); RequestParams params = new RequestParams(); client.get(apiUrl, params, handler); }
/** * GET account/verify_credentials * https://dev.twitter.com/rest/reference/get/account/verify_credentials */
GET account/verify_credentials HREF
getAccountVerifyCredentials
{ "repo_name": "hideki/twitter-android", "path": "app/src/main/java/self/hideki/twitter/network/TwitterClient.java", "license": "mit", "size": 11410 }
[ "com.loopj.android.http.RequestParams" ]
import com.loopj.android.http.RequestParams;
import com.loopj.android.http.*;
[ "com.loopj.android" ]
com.loopj.android;
1,478,731
@VisibleForTesting synchronized void clearDownloadingModelDetails(Editor editor, @NonNull String modelName) { editor .remove(String.format(DOWNLOADING_MODEL_ID_PATTERN, persistenceKey, modelName)) .remove(String.format(DOWNLOADING_MODEL_HASH_PATTERN, persistenceKey, modelName)) .remove(String.format(DOWNLOADING_MODEL_SIZE_PATTERN, persistenceKey, modelName)) .remove(String.format(DOWNLOAD_BEGIN_TIME_MS_PATTERN, persistenceKey, modelName)) .remove(String.format(DOWNLOADING_COMPLETE_TIME_MS_PATTERN, persistenceKey, modelName)) .apply(); }
synchronized void clearDownloadingModelDetails(Editor editor, @NonNull String modelName) { editor .remove(String.format(DOWNLOADING_MODEL_ID_PATTERN, persistenceKey, modelName)) .remove(String.format(DOWNLOADING_MODEL_HASH_PATTERN, persistenceKey, modelName)) .remove(String.format(DOWNLOADING_MODEL_SIZE_PATTERN, persistenceKey, modelName)) .remove(String.format(DOWNLOAD_BEGIN_TIME_MS_PATTERN, persistenceKey, modelName)) .remove(String.format(DOWNLOADING_COMPLETE_TIME_MS_PATTERN, persistenceKey, modelName)) .apply(); }
/** * Clears all stored data related to a custom model download. * * @param modelName - name of model */
Clears all stored data related to a custom model download
clearDownloadingModelDetails
{ "repo_name": "firebase/firebase-android-sdk", "path": "firebase-ml-modeldownloader/src/main/java/com/google/firebase/ml/modeldownloader/internal/SharedPreferencesUtil.java", "license": "apache-2.0", "size": 15317 }
[ "android.content.SharedPreferences", "androidx.annotation.NonNull" ]
import android.content.SharedPreferences; import androidx.annotation.NonNull;
import android.content.*; import androidx.annotation.*;
[ "android.content", "androidx.annotation" ]
android.content; androidx.annotation;
1,226,146
void saveTaskBoss(ReadOnlyTaskBoss taskBoss) throws IOException;
void saveTaskBoss(ReadOnlyTaskBoss taskBoss) throws IOException;
/** * Saves the given {@link ReadOnlyTaskBoss} to the storage. * @param taskBoss cannot be null. * @throws IOException if there was any problem writing to the file. */
Saves the given <code>ReadOnlyTaskBoss</code> to the storage
saveTaskBoss
{ "repo_name": "CS2103JAN2017-W14-B2/main", "path": "src/main/java/seedu/taskboss/storage/TaskBossStorage.java", "license": "mit", "size": 1396 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,750,196
public InstitutionalProposalCostShare getCostShareForValidation() { return institutionalProposalCostShare; }
InstitutionalProposalCostShare function() { return institutionalProposalCostShare; }
/** * This method returns the equipment item for validation * @return */
This method returns the equipment item for validation
getCostShareForValidation
{ "repo_name": "mukadder/kc", "path": "coeus-impl/src/main/java/org/kuali/kra/institutionalproposal/rules/InstitutionalProposalAddCostShareRuleEvent.java", "license": "agpl-3.0", "size": 2849 }
[ "org.kuali.kra.institutionalproposal.home.InstitutionalProposalCostShare" ]
import org.kuali.kra.institutionalproposal.home.InstitutionalProposalCostShare;
import org.kuali.kra.institutionalproposal.home.*;
[ "org.kuali.kra" ]
org.kuali.kra;
643,864
public interface ValueFactory { Serializable read_value(org.omg.CORBA_2_3.portable.InputStream is);
interface ValueFactory { Serializable function(org.omg.CORBA_2_3.portable.InputStream is);
/** * Is called by * the ORB runtime while in the process of unmarshaling a value type. * A user shall implement this method as part of implementing a type * specific value factory. * @param is an InputStream object--from which the value will be read. * @return a Serializable object--the value read off of "is" Input stream. */
Is called by the ORB runtime while in the process of unmarshaling a value type. A user shall implement this method as part of implementing a type specific value factory
read_value
{ "repo_name": "shun634501730/java_source_cn", "path": "src_en/org/omg/CORBA/portable/ValueFactory.java", "license": "apache-2.0", "size": 1440 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
1,584,774
public static Document requestXMLDocumentSync(final String url, final Map<String, String> requestHeaders, final String requestMethod, final String requestBody, final int timeout) throws Exception { final String response = requestStringSync(url, requestHeaders, requestMethod, requestBody, timeout); final StringReader responseReader = new StringReader(response); final Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(responseReader)); responseReader.close(); return document; } } public static class PlainText extends Request<String> { private String rawResponse = null; public PlainText() { super(); }
static Document function(final String url, final Map<String, String> requestHeaders, final String requestMethod, final String requestBody, final int timeout) throws Exception { final String response = requestStringSync(url, requestHeaders, requestMethod, requestBody, timeout); final StringReader responseReader = new StringReader(response); final Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(responseReader)); responseReader.close(); return document; } } public static class PlainText extends Request<String> { private String rawResponse = null; public PlainText() { super(); }
/** Read an URL to get a XML document in a sync way. * This method is not used by class itself, it's intended to be an utility method * @param requestHeaders The request headers, can be NULL * @param requestBody The request body, can be NULL * @param timeout Timeout in milliseconds */
Read an URL to get a XML document in a sync way. This method is not used by class itself, it's intended to be an utility method
requestXMLDocumentSync
{ "repo_name": "lorenzos/AndroidUtilClasses", "path": "com/lorenzostanco/utils/Request.java", "license": "mit", "size": 18916 }
[ "java.io.StringReader", "java.util.Map", "javax.xml.parsers.DocumentBuilderFactory", "org.w3c.dom.Document", "org.xml.sax.InputSource" ]
import java.io.StringReader; import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.xml.sax.InputSource;
import java.io.*; import java.util.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*;
[ "java.io", "java.util", "javax.xml", "org.w3c.dom", "org.xml.sax" ]
java.io; java.util; javax.xml; org.w3c.dom; org.xml.sax;
201,252
public NaturalLanguageUsage to(NaturalLanguageUsageBo naturalLanguageUsageBo);
NaturalLanguageUsage function(NaturalLanguageUsageBo naturalLanguageUsageBo);
/** * Converts a mutable {@link NaturalLanguageUsageBo} to its immutable counterpart, {@link NaturalLanguageUsage}. * @param naturalLanguageUsageBo the mutable business object. * @return a {@link NaturalLanguageUsage} the immutable object. * */
Converts a mutable <code>NaturalLanguageUsageBo</code> to its immutable counterpart, <code>NaturalLanguageUsage</code>
to
{ "repo_name": "ricepanda/rice-git2", "path": "rice-middleware/krms/impl/src/main/java/org/kuali/rice/krms/impl/repository/NaturalLanguageUsageBoService.java", "license": "apache-2.0", "size": 4380 }
[ "org.kuali.rice.krms.api.repository.language.NaturalLanguageUsage" ]
import org.kuali.rice.krms.api.repository.language.NaturalLanguageUsage;
import org.kuali.rice.krms.api.repository.language.*;
[ "org.kuali.rice" ]
org.kuali.rice;
553,062
void updateProperties(final IdentifierConverter<Resource, FedoraResource> idTranslator, final String sparqlUpdateStatement, final RdfStream originalTriples) throws MalformedRdfException, AccessDeniedException;
void updateProperties(final IdentifierConverter<Resource, FedoraResource> idTranslator, final String sparqlUpdateStatement, final RdfStream originalTriples) throws MalformedRdfException, AccessDeniedException;
/** * Update the provided properties with a SPARQL Update query. The updated * properties may be serialized to the persistence layer. * * @param idTranslator the property of idTranslator * @param sparqlUpdateStatement sparql update statement * @param originalTriples original triples * @throws MalformedRdfException if malformed rdf exception occurred * @throws AccessDeniedException if access denied in updating properties */
Update the provided properties with a SPARQL Update query. The updated properties may be serialized to the persistence layer
updateProperties
{ "repo_name": "bbranan/fcrepo4", "path": "fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/models/FedoraResource.java", "license": "apache-2.0", "size": 7824 }
[ "org.apache.jena.rdf.model.Resource", "org.fcrepo.kernel.api.RdfStream", "org.fcrepo.kernel.api.exception.AccessDeniedException", "org.fcrepo.kernel.api.exception.MalformedRdfException", "org.fcrepo.kernel.api.identifiers.IdentifierConverter" ]
import org.apache.jena.rdf.model.Resource; import org.fcrepo.kernel.api.RdfStream; import org.fcrepo.kernel.api.exception.AccessDeniedException; import org.fcrepo.kernel.api.exception.MalformedRdfException; import org.fcrepo.kernel.api.identifiers.IdentifierConverter;
import org.apache.jena.rdf.model.*; import org.fcrepo.kernel.api.*; import org.fcrepo.kernel.api.exception.*; import org.fcrepo.kernel.api.identifiers.*;
[ "org.apache.jena", "org.fcrepo.kernel" ]
org.apache.jena; org.fcrepo.kernel;
1,964,524
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { btnRegistrarSecretaria = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); etiquetaNombreDirector = new javax.swing.JLabel(); btnSalir = new javax.swing.JButton(); btnProfesor = new javax.swing.JButton();
@SuppressWarnings(STR) void function() { btnRegistrarSecretaria = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); etiquetaNombreDirector = new javax.swing.JLabel(); btnSalir = new javax.swing.JButton(); btnProfesor = new javax.swing.JButton();
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */
This method is called from within the constructor to initialize the form. regenerated by the Form Editor
initComponents
{ "repo_name": "05K4R1N/Instituto-de-Ensenianza-Superior", "path": "src/vista/Director/Direccion.java", "license": "mit", "size": 12113 }
[ "javax.swing.JLabel" ]
import javax.swing.JLabel;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,681,284
public String getTranslogUUID() { return commitUserData.get(Translog.TRANSLOG_UUID_KEY); }
String function() { return commitUserData.get(Translog.TRANSLOG_UUID_KEY); }
/** * returns the translog uuid the store points at */
returns the translog uuid the store points at
getTranslogUUID
{ "repo_name": "maddin2016/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/store/Store.java", "license": "apache-2.0", "size": 67230 }
[ "org.elasticsearch.index.translog.Translog" ]
import org.elasticsearch.index.translog.Translog;
import org.elasticsearch.index.translog.*;
[ "org.elasticsearch.index" ]
org.elasticsearch.index;
205,728
private PBXFileReference getOrCreateTestLibraryFileReference( TargetNode<AppleTestDescription.Arg> test) { SourceTreePath path = new SourceTreePath( PBXReference.SourceTree.BUILT_PRODUCTS_DIR, Paths.get(getBuiltProductsRelativeTargetOutputPath(test)).resolve( String.format( AppleBuildRules.getOutputFileNameFormatForLibrary(false), getProductName(test.getBuildTarget())))); return project.getMainGroup() .getOrCreateChildGroupByName("Test Libraries") .getOrCreateFileReferenceBySourceTreePath(path); }
PBXFileReference function( TargetNode<AppleTestDescription.Arg> test) { SourceTreePath path = new SourceTreePath( PBXReference.SourceTree.BUILT_PRODUCTS_DIR, Paths.get(getBuiltProductsRelativeTargetOutputPath(test)).resolve( String.format( AppleBuildRules.getOutputFileNameFormatForLibrary(false), getProductName(test.getBuildTarget())))); return project.getMainGroup() .getOrCreateChildGroupByName(STR) .getOrCreateFileReferenceBySourceTreePath(path); }
/** * Return a file reference to a test assuming it's built as a static library. */
Return a file reference to a test assuming it's built as a static library
getOrCreateTestLibraryFileReference
{ "repo_name": "MarkRunWu/buck", "path": "src/com/facebook/buck/apple/ProjectGenerator.java", "license": "apache-2.0", "size": 85879 }
[ "com.facebook.buck.apple.xcode.xcodeproj.PBXFileReference", "com.facebook.buck.apple.xcode.xcodeproj.PBXReference", "com.facebook.buck.apple.xcode.xcodeproj.SourceTreePath", "com.facebook.buck.rules.TargetNode", "java.nio.file.Paths" ]
import com.facebook.buck.apple.xcode.xcodeproj.PBXFileReference; import com.facebook.buck.apple.xcode.xcodeproj.PBXReference; import com.facebook.buck.apple.xcode.xcodeproj.SourceTreePath; import com.facebook.buck.rules.TargetNode; import java.nio.file.Paths;
import com.facebook.buck.apple.xcode.xcodeproj.*; import com.facebook.buck.rules.*; import java.nio.file.*;
[ "com.facebook.buck", "java.nio" ]
com.facebook.buck; java.nio;
736,889
protected Injector getInjector() { List<Handler> instantiationProviders = InjectorBuilder.createInstantiationProviders(""); return new InjectorBuilder() .addHandlers( new AnnotationResolver(testClass, target), new MockDependencyHandler(testClass, target), new PostConstructMethodInvoker()) .addHandlers(instantiationProviders) .create(); }
Injector function() { List<Handler> instantiationProviders = InjectorBuilder.createInstantiationProviders(""); return new InjectorBuilder() .addHandlers( new AnnotationResolver(testClass, target), new MockDependencyHandler(testClass, target), new PostConstructMethodInvoker()) .addHandlers(instantiationProviders) .create(); }
/** * Override this method to provide your own injector in the test runner, e.g. if your application uses * custom instantiation methods or annotation behavior. * * @return the injector used to set {@link ch.jalu.injector.testing.InjectDelayed} fields */
Override this method to provide your own injector in the test runner, e.g. if your application uses custom instantiation methods or annotation behavior
getInjector
{ "repo_name": "ljacqu/DependencyInjector", "path": "injector/src/main/java/ch/jalu/injector/testing/runner/RunDelayedInjects.java", "license": "mit", "size": 2573 }
[ "ch.jalu.injector.Injector", "ch.jalu.injector.InjectorBuilder", "ch.jalu.injector.handlers.Handler", "ch.jalu.injector.handlers.postconstruct.PostConstructMethodInvoker", "java.util.List" ]
import ch.jalu.injector.Injector; import ch.jalu.injector.InjectorBuilder; import ch.jalu.injector.handlers.Handler; import ch.jalu.injector.handlers.postconstruct.PostConstructMethodInvoker; import java.util.List;
import ch.jalu.injector.*; import ch.jalu.injector.handlers.*; import ch.jalu.injector.handlers.postconstruct.*; import java.util.*;
[ "ch.jalu.injector", "java.util" ]
ch.jalu.injector; java.util;
2,645,219
@Override public void parentChanged(TWorkItemBean workItemBean, TWorkItemBean workItemBeanOriginal, Map<String, Object> contextInformation) { if (workItemBeanOriginal==null) { //new item return; } Integer oldParent = workItemBeanOriginal.getSuperiorworkitem(); Integer newParent = workItemBean.getSuperiorworkitem(); if ((oldParent==null && newParent==null) || (oldParent!=null && newParent!=null && oldParent.equals(newParent))) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("no parent change: wbs not affected"); } return; } Integer projectID = workItemBean.getProjectID(); if (projectID==null) { LOGGER.warn("No project found for workItem" + workItemBean.getObjectID()); return; } //old parent workItem and project TWorkItemBean oldParentWorkItemBean = null; boolean sameProjectAsOldParent = false; if (oldParent!=null) { try { oldParentWorkItemBean = loadByPrimaryKey(oldParent); Integer oldParentProjectID = oldParentWorkItemBean.getProjectID(); if (oldParentProjectID==null) { LOGGER.warn("No project found for oldParent " + oldParent); return; } else { sameProjectAsOldParent = projectID.equals(oldParentProjectID); } } catch (ItemLoaderException e1) { LOGGER.warn("The oldParent workItem " + oldParent + " does not exist"); return; } } else { //previously it has no parent: the projects are considered the same sameProjectAsOldParent = true; } //new parent workItem and project TWorkItemBean newParentWorkItemBean = null; boolean sameProjectAsNewParent = false; if (newParent!=null) { try { newParentWorkItemBean = loadByPrimaryKey(newParent); Integer newParentProjectID = newParentWorkItemBean.getProjectID(); if (newParentProjectID==null) { LOGGER.warn("No project found for newParent " + newParent); return; } else { sameProjectAsNewParent = projectID.equals(newParentProjectID); } } catch (ItemLoaderException e1) { LOGGER.warn("The newParent workItem " + newParent + " does not exist"); return; } } else { //the parent is removed: the projects are considered the same sameProjectAsNewParent = true; } boolean outdent = false; if (contextInformation!=null && contextInformation.get(TWorkItemBean.OUTDENT)!=null && ((Boolean)contextInformation.get(TWorkItemBean.OUTDENT)).booleanValue()) { outdent = true; } Integer originalWBS = workItemBean.getWBSOnLevel(); if (originalWBS==null) { //renumber if null and get the WBS number again setWbs(projectID); try { //load them again this time with wbs numbers set workItemBean = loadByPrimaryKey(workItemBean.getObjectID()); originalWBS = workItemBean.getWBSOnLevel(); } catch (ItemLoaderException e) { } } //1. remove the item from the original parent's childen and shift the following items up if (sameProjectAsOldParent && !outdent) { //if there were no previous wbs or the project of the workItem differs form the //oldParent's project then there is no need to change anything in the old branch //move the issue's next siblings up one level if it is no outdent //(by outdent the issue's next siblings will be children of the issue) shiftBranch(originalWBS, oldParent, projectID, false); } //2. add the item as last child of the new parent if (sameProjectAsNewParent) { //if the new parent differs from the workItem's parent then no change in wbs Integer newWBS; if (outdent && (contextInformation != null) && (oldParentWorkItemBean != null)) { List<Integer> filteredNextSiblingIDs = (List<Integer>)contextInformation.get(TWorkItemBean.NEXT_SIBLINGS); //by outdent the oldParent becomes the new previous sibling: make space for the outdented item, //by shifting down the siblings of newParent (previous grandparent) after the oldParent Integer oldParentWBS = oldParentWorkItemBean.getWBSOnLevel(); if (oldParentWBS==null) { newWBS = Integer.valueOf(1); } else { newWBS = Integer.valueOf(oldParentWBS.intValue()+1); } //shift down the children of the newParent beginning with //oldParentWBS exclusive to make place for the outdented issue shiftBranch(oldParentWBS, newParent, projectID, true); //get the next available WBS after the outdented issue's original children Integer nextWbsOnOudentedChildren = getNextWbsOnLevel(workItemBean.getObjectID(), projectID); //gather the all siblings (not just the next ones according to wbs) of the outdented issue, //because it is not guaranteed that at the moment of the outline the sortOrder is by wbs //(can be that in the ReportBeans there is a next sibling which has a lower wbs nummer as the outlined one still according //to the selected ReportBeans sortorder it is a next sibling, consequently it will become a child of outlined issue) Criteria criteria = new Criteria(); criteria.add(SUPERIORWORKITEM, oldParent); criteria.add(WORKITEMKEY, workItemBean.getObjectID(), Criteria.NOT_EQUAL); //criteria.add(WBSONLEVEL, originalWBS, Criteria.GREATER_THAN); criteria.add(PROJECTKEY, projectID); //in the case that the wbs got corrupted but still a wbs existed before try to preserve the order criteria.addAscendingOrderByColumn(WBSONLEVEL); //if wbs does not exist then fall back to workItemKey as wbs criteria.addAscendingOrderByColumn(WORKITEMKEY); List<TWorkItemBean> allSiblingWorkItemBeans = null; try { allSiblingWorkItemBeans = convertTorqueListToBeanList(doSelect(criteria)); } catch (TorqueException e) { LOGGER.warn("Getting the next siblings of the outdented issue " + workItemBean.getObjectID() + failedWith + e.getMessage(), e ); } List<String> idChunks = GeneralUtils.getCommaSepararedIDChunksInParenthesis(filteredNextSiblingIDs); //set all next siblings as children of the outdented workItem (see MS Project) //actualize the WBS for old next present siblings (future children of the outdented issue). //No common update is possible because the WBS of the next present siblings might contain gaps Map<Integer, TWorkItemBean> siblingWorkItemsMap = GeneralUtils.createMapFromList(allSiblingWorkItemBeans); for (int i = 0; i < filteredNextSiblingIDs.size(); i++) { //the order from the ReportBeans should be preserved, insependently of current wbs //(consquently the relative wbs order between the siblings might change) TWorkItemBean nextSiblingworkItemBean = siblingWorkItemsMap.get(filteredNextSiblingIDs.get(i)); if (nextSiblingworkItemBean!=null && nextSiblingworkItemBean.getWBSOnLevel()!=(nextWbsOnOudentedChildren+i)) { nextSiblingworkItemBean.setWBSOnLevel(nextWbsOnOudentedChildren+i); try { saveSimple(nextSiblingworkItemBean); } catch (ItemPersisterException e) { LOGGER.warn("Saving the outdented present workitem " + nextSiblingworkItemBean.getObjectID() + failedWith + e.getMessage()); } } } //renumber those next siblings which were not re-parented (those not present in the ReportBeans) //to fill up the gaps leaved by the re-parented present next siblings //no common update is possible because of gaps int i=0; if (allSiblingWorkItemBeans != null) { for (Iterator<TWorkItemBean> iterator = allSiblingWorkItemBeans.iterator(); iterator.hasNext();) { TWorkItemBean nextSiblingworkItemBean = iterator.next(); if (!filteredNextSiblingIDs.contains(nextSiblingworkItemBean.getObjectID())) { i++; if (nextSiblingworkItemBean.getWBSOnLevel()!=i) { nextSiblingworkItemBean.setWBSOnLevel(i); try { saveSimple(nextSiblingworkItemBean); } catch (ItemPersisterException e) { LOGGER.warn("Saving the outdented not present workItem " + nextSiblingworkItemBean.getObjectID() + failedWith + e.getMessage()); } } } } } String parentCriteria = " AND SUPERIORWORKITEM = " + oldParent; String subprojectCriteria = " PROJECTKEY = " + projectID; //set all present next siblings as children of the outdented workItem (see MS Project). for (Iterator<String> iterator = idChunks.iterator(); iterator.hasNext();) { String idChunk = iterator.next(); String sqlStmt = "UPDATE TWORKITEM SET SUPERIORWORKITEM = " + workItemBean.getObjectID() + " WHERE " + subprojectCriteria + parentCriteria + " AND WORKITEMKEY IN " + idChunk; executeStatemant(sqlStmt); } } else { newWBS = getNextWbsOnLevel(newParent, projectID); } //shift the entire branch down and set the outdented workitem as first child of his previous parent if (EqualUtils.notEqual(workItemBean.getWBSOnLevel(), newWBS)) { workItemBean.setWBSOnLevel(newWBS); } } }
void function(TWorkItemBean workItemBean, TWorkItemBean workItemBeanOriginal, Map<String, Object> contextInformation) { if (workItemBeanOriginal==null) { return; } Integer oldParent = workItemBeanOriginal.getSuperiorworkitem(); Integer newParent = workItemBean.getSuperiorworkitem(); if ((oldParent==null && newParent==null) (oldParent!=null && newParent!=null && oldParent.equals(newParent))) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(STR); } return; } Integer projectID = workItemBean.getProjectID(); if (projectID==null) { LOGGER.warn(STR + workItemBean.getObjectID()); return; } TWorkItemBean oldParentWorkItemBean = null; boolean sameProjectAsOldParent = false; if (oldParent!=null) { try { oldParentWorkItemBean = loadByPrimaryKey(oldParent); Integer oldParentProjectID = oldParentWorkItemBean.getProjectID(); if (oldParentProjectID==null) { LOGGER.warn(STR + oldParent); return; } else { sameProjectAsOldParent = projectID.equals(oldParentProjectID); } } catch (ItemLoaderException e1) { LOGGER.warn(STR + oldParent + STR); return; } } else { sameProjectAsOldParent = true; } TWorkItemBean newParentWorkItemBean = null; boolean sameProjectAsNewParent = false; if (newParent!=null) { try { newParentWorkItemBean = loadByPrimaryKey(newParent); Integer newParentProjectID = newParentWorkItemBean.getProjectID(); if (newParentProjectID==null) { LOGGER.warn(STR + newParent); return; } else { sameProjectAsNewParent = projectID.equals(newParentProjectID); } } catch (ItemLoaderException e1) { LOGGER.warn(STR + newParent + STR); return; } } else { sameProjectAsNewParent = true; } boolean outdent = false; if (contextInformation!=null && contextInformation.get(TWorkItemBean.OUTDENT)!=null && ((Boolean)contextInformation.get(TWorkItemBean.OUTDENT)).booleanValue()) { outdent = true; } Integer originalWBS = workItemBean.getWBSOnLevel(); if (originalWBS==null) { setWbs(projectID); try { workItemBean = loadByPrimaryKey(workItemBean.getObjectID()); originalWBS = workItemBean.getWBSOnLevel(); } catch (ItemLoaderException e) { } } if (sameProjectAsOldParent && !outdent) { shiftBranch(originalWBS, oldParent, projectID, false); } if (sameProjectAsNewParent) { Integer newWBS; if (outdent && (contextInformation != null) && (oldParentWorkItemBean != null)) { List<Integer> filteredNextSiblingIDs = (List<Integer>)contextInformation.get(TWorkItemBean.NEXT_SIBLINGS); Integer oldParentWBS = oldParentWorkItemBean.getWBSOnLevel(); if (oldParentWBS==null) { newWBS = Integer.valueOf(1); } else { newWBS = Integer.valueOf(oldParentWBS.intValue()+1); } shiftBranch(oldParentWBS, newParent, projectID, true); Integer nextWbsOnOudentedChildren = getNextWbsOnLevel(workItemBean.getObjectID(), projectID); Criteria criteria = new Criteria(); criteria.add(SUPERIORWORKITEM, oldParent); criteria.add(WORKITEMKEY, workItemBean.getObjectID(), Criteria.NOT_EQUAL); criteria.add(PROJECTKEY, projectID); criteria.addAscendingOrderByColumn(WBSONLEVEL); criteria.addAscendingOrderByColumn(WORKITEMKEY); List<TWorkItemBean> allSiblingWorkItemBeans = null; try { allSiblingWorkItemBeans = convertTorqueListToBeanList(doSelect(criteria)); } catch (TorqueException e) { LOGGER.warn(STR + workItemBean.getObjectID() + failedWith + e.getMessage(), e ); } List<String> idChunks = GeneralUtils.getCommaSepararedIDChunksInParenthesis(filteredNextSiblingIDs); Map<Integer, TWorkItemBean> siblingWorkItemsMap = GeneralUtils.createMapFromList(allSiblingWorkItemBeans); for (int i = 0; i < filteredNextSiblingIDs.size(); i++) { TWorkItemBean nextSiblingworkItemBean = siblingWorkItemsMap.get(filteredNextSiblingIDs.get(i)); if (nextSiblingworkItemBean!=null && nextSiblingworkItemBean.getWBSOnLevel()!=(nextWbsOnOudentedChildren+i)) { nextSiblingworkItemBean.setWBSOnLevel(nextWbsOnOudentedChildren+i); try { saveSimple(nextSiblingworkItemBean); } catch (ItemPersisterException e) { LOGGER.warn(STR + nextSiblingworkItemBean.getObjectID() + failedWith + e.getMessage()); } } } int i=0; if (allSiblingWorkItemBeans != null) { for (Iterator<TWorkItemBean> iterator = allSiblingWorkItemBeans.iterator(); iterator.hasNext();) { TWorkItemBean nextSiblingworkItemBean = iterator.next(); if (!filteredNextSiblingIDs.contains(nextSiblingworkItemBean.getObjectID())) { i++; if (nextSiblingworkItemBean.getWBSOnLevel()!=i) { nextSiblingworkItemBean.setWBSOnLevel(i); try { saveSimple(nextSiblingworkItemBean); } catch (ItemPersisterException e) { LOGGER.warn(STR + nextSiblingworkItemBean.getObjectID() + failedWith + e.getMessage()); } } } } } String parentCriteria = STR + oldParent; String subprojectCriteria = STR + projectID; for (Iterator<String> iterator = idChunks.iterator(); iterator.hasNext();) { String idChunk = iterator.next(); String sqlStmt = STR + workItemBean.getObjectID() + STR + subprojectCriteria + parentCriteria + STR + idChunk; executeStatemant(sqlStmt); } } else { newWBS = getNextWbsOnLevel(newParent, projectID); } if (EqualUtils.notEqual(workItemBean.getWBSOnLevel(), newWBS)) { workItemBean.setWBSOnLevel(newWBS); } } }
/** * The parent was changed: recalculate the WBS both the old parent and the new parent can be null * @param workItemBean * @param workItemBeanOriginal * @param contextInformation */
The parent was changed: recalculate the WBS both the old parent and the new parent can be null
parentChanged
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/TWorkItemPeer.java", "license": "gpl-3.0", "size": 84464 }
[ "com.aurel.track.beans.TWorkItemBean", "com.aurel.track.item.ItemLoaderException", "com.aurel.track.item.ItemPersisterException", "com.aurel.track.util.EqualUtils", "com.aurel.track.util.GeneralUtils", "java.util.Iterator", "java.util.List", "java.util.Map", "org.apache.torque.TorqueException", "org.apache.torque.util.Criteria" ]
import com.aurel.track.beans.TWorkItemBean; import com.aurel.track.item.ItemLoaderException; import com.aurel.track.item.ItemPersisterException; import com.aurel.track.util.EqualUtils; import com.aurel.track.util.GeneralUtils; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.torque.TorqueException; import org.apache.torque.util.Criteria;
import com.aurel.track.beans.*; import com.aurel.track.item.*; import com.aurel.track.util.*; import java.util.*; import org.apache.torque.*; import org.apache.torque.util.*;
[ "com.aurel.track", "java.util", "org.apache.torque" ]
com.aurel.track; java.util; org.apache.torque;
44,211
@GET @Path("token") @Produces(MediaType.APPLICATION_JSON) public OAuthToken token(@Required @QueryParam("oauth_provider") String oauthProvider) throws ServerException, BadRequestException, NotFoundException, ForbiddenException { OAuthAuthenticator provider = getAuthenticator(oauthProvider); final Subject subject = EnvironmentContext.getCurrent().getSubject(); try { OAuthToken token = provider.getToken(subject.getUserId()); if (token == null) { token = provider.getToken(subject.getUserName()); } if (token != null) { return token; } throw new NotFoundException("OAuth token for user " + subject.getUserId() + " was not found"); } catch (IOException e) { throw new ServerException(e.getLocalizedMessage(), e); } }
@Path("token") @Produces(MediaType.APPLICATION_JSON) OAuthToken function(@Required @QueryParam(STR) String oauthProvider) throws ServerException, BadRequestException, NotFoundException, ForbiddenException { OAuthAuthenticator provider = getAuthenticator(oauthProvider); final Subject subject = EnvironmentContext.getCurrent().getSubject(); try { OAuthToken token = provider.getToken(subject.getUserId()); if (token == null) { token = provider.getToken(subject.getUserName()); } if (token != null) { return token; } throw new NotFoundException(STR + subject.getUserId() + STR); } catch (IOException e) { throw new ServerException(e.getLocalizedMessage(), e); } }
/** * Gets OAuth token for user. * * @param oauthProvider OAuth provider name * @return OAuthToken * @throws ServerException */
Gets OAuth token for user
token
{ "repo_name": "jonahkichwacoders/che", "path": "wsmaster/che-core-api-auth/src/main/java/org/eclipse/che/security/oauth/OAuthAuthenticationService.java", "license": "epl-1.0", "size": 8732 }
[ "java.io.IOException", "javax.ws.rs.Path", "javax.ws.rs.Produces", "javax.ws.rs.QueryParam", "javax.ws.rs.core.MediaType", "org.eclipse.che.api.auth.shared.dto.OAuthToken", "org.eclipse.che.api.core.BadRequestException", "org.eclipse.che.api.core.ForbiddenException", "org.eclipse.che.api.core.NotFoundException", "org.eclipse.che.api.core.ServerException", "org.eclipse.che.api.core.rest.annotations.Required", "org.eclipse.che.commons.env.EnvironmentContext", "org.eclipse.che.commons.subject.Subject" ]
import java.io.IOException; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.eclipse.che.api.auth.shared.dto.OAuthToken; import org.eclipse.che.api.core.BadRequestException; import org.eclipse.che.api.core.ForbiddenException; import org.eclipse.che.api.core.NotFoundException; import org.eclipse.che.api.core.ServerException; import org.eclipse.che.api.core.rest.annotations.Required; import org.eclipse.che.commons.env.EnvironmentContext; import org.eclipse.che.commons.subject.Subject;
import java.io.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.eclipse.che.api.auth.shared.dto.*; import org.eclipse.che.api.core.*; import org.eclipse.che.api.core.rest.annotations.*; import org.eclipse.che.commons.env.*; import org.eclipse.che.commons.subject.*;
[ "java.io", "javax.ws", "org.eclipse.che" ]
java.io; javax.ws; org.eclipse.che;
2,002,825
@Override public Enumeration<Option> listOptions() { Vector<Option> newVector = new Vector<Option>(2); newVector.addElement(new Option("\ttreat missing values as a seperate " + "value.", "M", 0, "-M")); newVector.addElement(new Option( "\tjust binarize numeric attributes instead \n" + "\tof properly discretizing them.", "B", 0, "-B")); return newVector.elements(); }
Enumeration<Option> function() { Vector<Option> newVector = new Vector<Option>(2); newVector.addElement(new Option(STR + STR, "M", 0, "-M")); newVector.addElement(new Option( STR + STR, "B", 0, "-B")); return newVector.elements(); }
/** * Returns an enumeration describing the available options * * @return an enumeration of all the available options **/
Returns an enumeration describing the available options
listOptions
{ "repo_name": "DANCEcollaborative/bazaar", "path": "bazaar_server/bazaar_server_lobby/agents/lightside/wekafiles/packages/chiSquaredAttributeEval/src/main/java/weka/attributeSelection/ChiSquaredAttributeEval.java", "license": "lgpl-3.0", "size": 13589 }
[ "java.util.Enumeration", "java.util.Vector" ]
import java.util.Enumeration; import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
796,969
public void showDetails(WifiP2pDevice device) { //Get device object this.device = device; this.getView().setVisibility(View.VISIBLE); TextView view = (TextView) mContentView.findViewById(R.id.device_address); view.setText(device.deviceAddress); view = (TextView) mContentView.findViewById(R.id.device_info); view.setText(device.toString()); }
void function(WifiP2pDevice device) { this.device = device; this.getView().setVisibility(View.VISIBLE); TextView view = (TextView) mContentView.findViewById(R.id.device_address); view.setText(device.deviceAddress); view = (TextView) mContentView.findViewById(R.id.device_info); view.setText(device.toString()); }
/** * Updates the UI with device data * * @param device the device to be displayed */
Updates the UI with device data
showDetails
{ "repo_name": "YYsong/WifiDirect", "path": "app/src/main/java/com/example/android/wifidirect/DeviceDetailFragment.java", "license": "apache-2.0", "size": 23954 }
[ "android.net.wifi.p2p.WifiP2pDevice", "android.view.View", "android.widget.TextView" ]
import android.net.wifi.p2p.WifiP2pDevice; import android.view.View; import android.widget.TextView;
import android.net.wifi.p2p.*; import android.view.*; import android.widget.*;
[ "android.net", "android.view", "android.widget" ]
android.net; android.view; android.widget;
886,033
public static Node diff(Node xml1, Node xml2, String whitespace, String granularity) throws DiffException, IOException { // Get the config DiffConfig config = toConfig(whitespace, granularity); // Get Sequences DOMLoader loader = new DOMLoader(); loader.setConfig(config); Sequence seq1 = loader.load(xml1); Sequence seq2 = loader.load(xml2); if (seq1.size() == 0 && seq2.size() == 0) return null; // Start comparing StringWriter out = new StringWriter(); diff(seq1, seq2, out); // Return a node try { String factory = getFactoryClass(xml1, xml2); return toNode(out.toString(), config, factory); } catch (Exception ex) { throw new DiffException("Could not generate Node from Diff result", ex); } } // private helpers ------------------------------------------------------------------------------
static Node function(Node xml1, Node xml2, String whitespace, String granularity) throws DiffException, IOException { DiffConfig config = toConfig(whitespace, granularity); DOMLoader loader = new DOMLoader(); loader.setConfig(config); Sequence seq1 = loader.load(xml1); Sequence seq2 = loader.load(xml2); if (seq1.size() == 0 && seq2.size() == 0) return null; StringWriter out = new StringWriter(); diff(seq1, seq2, out); try { String factory = getFactoryClass(xml1, xml2); return toNode(out.toString(), config, factory); } catch (Exception ex) { throw new DiffException(STR, ex); } }
/** * Compares the two specified <code>Node</code>s and returns the diff as a node. * * <p>Only the first node in the node list is sequenced. * * @param xml1 The first XML node to compare. * @param xml2 The second XML node to compare. * @param whitespace The white space processing (a valid {@link WhiteSpaceProcessing} value). * @param granularity The text granularity (a valid {@link TextGranularity} value). * * @throws DiffException Should a Diff exception occur. * @throws IOException Should an I/O exception occur. */
Compares the two specified <code>Node</code>s and returns the diff as a node. Only the first node in the node list is sequenced
diff
{ "repo_name": "pageseeder/diffx", "path": "src/main/java/org/pageseeder/diffx/Extension.java", "license": "apache-2.0", "size": 6760 }
[ "java.io.IOException", "java.io.StringWriter", "org.pageseeder.diffx.config.DiffConfig", "org.pageseeder.diffx.load.DOMLoader", "org.pageseeder.diffx.xml.Sequence", "org.w3c.dom.Node" ]
import java.io.IOException; import java.io.StringWriter; import org.pageseeder.diffx.config.DiffConfig; import org.pageseeder.diffx.load.DOMLoader; import org.pageseeder.diffx.xml.Sequence; import org.w3c.dom.Node;
import java.io.*; import org.pageseeder.diffx.config.*; import org.pageseeder.diffx.load.*; import org.pageseeder.diffx.xml.*; import org.w3c.dom.*;
[ "java.io", "org.pageseeder.diffx", "org.w3c.dom" ]
java.io; org.pageseeder.diffx; org.w3c.dom;
2,180,791
@Test public void testUSPS() { System.out.println("USPS"); double[][] x = null; double[][] testx = null; long start = System.currentTimeMillis(); DelimitedTextParser parser = new DelimitedTextParser(); parser.setResponseIndex(new NominalAttribute("class"), 0); try { AttributeDataset train = parser.parse("USPS Train", smile.data.parser.IOUtils.getTestDataFile("usps/zip.train")); AttributeDataset test = parser.parse("USPS Test", smile.data.parser.IOUtils.getTestDataFile("usps/zip.test")); x = train.toArray(new double[train.size()][]); testx = test.toArray(new double[test.size()][]); } catch (Exception ex) { System.err.println(ex); } double time = (System.currentTimeMillis() - start) / 1000.0; System.out.format("Loading USPS: %.2fs\n", time); start = System.currentTimeMillis(); MPLSH<double[]> lsh = new MPLSH<double[]>(256, 100, 3, 4.0); for (double[] xi : x) { lsh.put(xi, xi); } double[][] train = new double[500][]; int[] index = Math.permutate(x.length); for (int i = 0; i < train.length; i++) { train[i] = x[index[i]]; } LinearSearch<double[]> naive = new LinearSearch<double[]>(x, new EuclideanDistance()); lsh.learn(naive, train, 8.0); time = (System.currentTimeMillis() - start) / 1000.0; System.out.format("Building LSH: %.2fs\n", time); start = System.currentTimeMillis(); for (int i = 0; i < testx.length; i++) { lsh.nearest(testx[i]); } time = (System.currentTimeMillis() - start) / 1000.0; System.out.format("NN: %.2fs\n", time); start = System.currentTimeMillis(); for (int i = 0; i < testx.length; i++) { lsh.knn(testx[i], 10); } time = (System.currentTimeMillis() - start) / 1000.0; System.out.format("10-NN: %.2fs\n", time); start = System.currentTimeMillis(); List<Neighbor<double[], double[]>> n = new ArrayList<Neighbor<double[], double[]>>(); for (int i = 0; i < testx.length; i++) { lsh.range(testx[i], 8.0, n); n.clear(); } time = (System.currentTimeMillis() - start) / 1000.0; System.out.format("Range: %.2fs\n", time); }
void function() { System.out.println("USPS"); double[][] x = null; double[][] testx = null; long start = System.currentTimeMillis(); DelimitedTextParser parser = new DelimitedTextParser(); parser.setResponseIndex(new NominalAttribute("class"), 0); try { AttributeDataset train = parser.parse(STR, smile.data.parser.IOUtils.getTestDataFile(STR)); AttributeDataset test = parser.parse(STR, smile.data.parser.IOUtils.getTestDataFile(STR)); x = train.toArray(new double[train.size()][]); testx = test.toArray(new double[test.size()][]); } catch (Exception ex) { System.err.println(ex); } double time = (System.currentTimeMillis() - start) / 1000.0; System.out.format(STR, time); start = System.currentTimeMillis(); MPLSH<double[]> lsh = new MPLSH<double[]>(256, 100, 3, 4.0); for (double[] xi : x) { lsh.put(xi, xi); } double[][] train = new double[500][]; int[] index = Math.permutate(x.length); for (int i = 0; i < train.length; i++) { train[i] = x[index[i]]; } LinearSearch<double[]> naive = new LinearSearch<double[]>(x, new EuclideanDistance()); lsh.learn(naive, train, 8.0); time = (System.currentTimeMillis() - start) / 1000.0; System.out.format(STR, time); start = System.currentTimeMillis(); for (int i = 0; i < testx.length; i++) { lsh.nearest(testx[i]); } time = (System.currentTimeMillis() - start) / 1000.0; System.out.format(STR, time); start = System.currentTimeMillis(); for (int i = 0; i < testx.length; i++) { lsh.knn(testx[i], 10); } time = (System.currentTimeMillis() - start) / 1000.0; System.out.format(STR, time); start = System.currentTimeMillis(); List<Neighbor<double[], double[]>> n = new ArrayList<Neighbor<double[], double[]>>(); for (int i = 0; i < testx.length; i++) { lsh.range(testx[i], 8.0, n); n.clear(); } time = (System.currentTimeMillis() - start) / 1000.0; System.out.format(STR, time); }
/** * Test of nearest method, of class KDTree. */
Test of nearest method, of class KDTree
testUSPS
{ "repo_name": "arehart13/smile", "path": "core/src/test/java/smile/neighbor/MPLSHSpeedTest.java", "license": "apache-2.0", "size": 4002 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,314,117
public ElemTemplateElement appendChild(ElemTemplateElement newChild) { error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); return null; }
ElemTemplateElement function(ElemTemplateElement newChild) { error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); return null; }
/** * Add a child to the child list. * <!ELEMENT xsl:apply-imports EMPTY> * * @param newChild New element to append to this element's children list * * @return null, xsl:apply-Imports cannot have children */
Add a child to the child list.
appendChild
{ "repo_name": "mirego/j2objc", "path": "xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemApplyImport.java", "license": "apache-2.0", "size": 3471 }
[ "org.apache.xalan.res.XSLTErrorResources" ]
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.res.*;
[ "org.apache.xalan" ]
org.apache.xalan;
2,063,470
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<AutomationAccountInner>> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) .<PagedResponse<AutomationAccountInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<AutomationAccountInner>> function(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; return FluxUtil .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) .<PagedResponse<AutomationAccountInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
/** * Get the next page of items. * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response model for the list account operation. */
Get the next page of items
listNextSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/automation/azure-resourcemanager-automation/src/main/java/com/azure/resourcemanager/automation/implementation/AutomationAccountsClientImpl.java", "license": "mit", "size": 60401 }
[ "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.FluxUtil", "com.azure.resourcemanager.automation.fluent.models.AutomationAccountInner" ]
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.FluxUtil; import com.azure.resourcemanager.automation.fluent.models.AutomationAccountInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.automation.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,831,352
Collection<ProcessInstanceDesc> getProcessInstancesByDeploymentId(String deploymentId, List<Integer> states, QueryContext queryContext);
Collection<ProcessInstanceDesc> getProcessInstancesByDeploymentId(String deploymentId, List<Integer> states, QueryContext queryContext);
/** * Returns list of process instance descriptions found for given deployment id and statuses. * @param deploymentId The deployment id of the runtime. * @param states A list of possible state (int) values that the {@link ProcessInstance} can have. * @param queryContext control parameters for the result e.g. sorting, paging * @return A list of {@link ProcessInstanceDesc} instances representing the process instances that match * the given criteria (deploymentId and states). */
Returns list of process instance descriptions found for given deployment id and statuses
getProcessInstancesByDeploymentId
{ "repo_name": "DuncanDoyle/jbpm", "path": "jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/RuntimeDataService.java", "license": "apache-2.0", "size": 26170 }
[ "java.util.Collection", "java.util.List", "org.jbpm.services.api.model.ProcessInstanceDesc", "org.kie.api.runtime.query.QueryContext" ]
import java.util.Collection; import java.util.List; import org.jbpm.services.api.model.ProcessInstanceDesc; import org.kie.api.runtime.query.QueryContext;
import java.util.*; import org.jbpm.services.api.model.*; import org.kie.api.runtime.query.*;
[ "java.util", "org.jbpm.services", "org.kie.api" ]
java.util; org.jbpm.services; org.kie.api;
312,544
public Object create(Service service, String url) throws MalformedURLException { Collection transports = xfire.getTransportManager().getTransportsForUri(url); if (transports.size() == 0) throw new XFireRuntimeException("No Transport is available for url " + url); Binding binding = null; Transport transport = null; for (Iterator itr = transports.iterator(); itr.hasNext() && binding == null;) { transport = (Transport) itr.next(); for (int i = 0; i < transport.getSupportedBindings().length; i++) { binding = service.getBinding(transport.getSupportedBindings()[i]); if (binding != null) break; } } Client client = new Client(transport, binding, url); return create(client); }
Object function(Service service, String url) throws MalformedURLException { Collection transports = xfire.getTransportManager().getTransportsForUri(url); if (transports.size() == 0) throw new XFireRuntimeException(STR + url); Binding binding = null; Transport transport = null; for (Iterator itr = transports.iterator(); itr.hasNext() && binding == null;) { transport = (Transport) itr.next(); for (int i = 0; i < transport.getSupportedBindings().length; i++) { binding = service.getBinding(transport.getSupportedBindings()[i]); if (binding != null) break; } } Client client = new Client(transport, binding, url); return create(client); }
/** * Creates a new proxy with the specified URL. The returned object is a proxy with the interface specified by the * given service interface. * <pre> * String url = "http://localhost:8080/services/Echo"); * Echo echo = (Echo) factory.create(myService, url); * </pre> * * @param service the service to create a client for. * @param url the URL where the client object is located. * @return a proxy to the object with the specified interface. */
Creates a new proxy with the specified URL. The returned object is a proxy with the interface specified by the given service interface. <code> String url = "HREF"); Echo echo = (Echo) factory.create(myService, url); </code>
create
{ "repo_name": "eduardodaluz/xfire", "path": "xfire-core/src/main/org/codehaus/xfire/client/XFireProxyFactory.java", "license": "mit", "size": 5329 }
[ "java.net.MalformedURLException", "java.util.Collection", "java.util.Iterator", "org.codehaus.xfire.XFireRuntimeException", "org.codehaus.xfire.service.Binding", "org.codehaus.xfire.service.Service", "org.codehaus.xfire.transport.Transport" ]
import java.net.MalformedURLException; import java.util.Collection; import java.util.Iterator; import org.codehaus.xfire.XFireRuntimeException; import org.codehaus.xfire.service.Binding; import org.codehaus.xfire.service.Service; import org.codehaus.xfire.transport.Transport;
import java.net.*; import java.util.*; import org.codehaus.xfire.*; import org.codehaus.xfire.service.*; import org.codehaus.xfire.transport.*;
[ "java.net", "java.util", "org.codehaus.xfire" ]
java.net; java.util; org.codehaus.xfire;
789,089
protected void initialize(@NonNull final List<ExpandedDisplayProperty< ? >> xdpl) { //-- For all properties in the list, use metadata to define'm final int[] widths = new int[80]; m_totwidth = 0; int ix = 0; addColumns(xdpl, widths); ix = 0; for(final SimpleColumnDef< ? > scd : getColumnList()) { final int pct = (100 * widths[ix++]) / m_totwidth; scd.setWidth(pct + "%"); } }
void function(@NonNull final List<ExpandedDisplayProperty< ? >> xdpl) { final int[] widths = new int[80]; m_totwidth = 0; int ix = 0; addColumns(xdpl, widths); ix = 0; for(final SimpleColumnDef< ? > scd : getColumnList()) { final int pct = (100 * widths[ix++]) / m_totwidth; scd.setWidth(pct + "%"); } }
/** * Initialize, using the genericized table column set. * FIXME Should be private * @param clz * @param xdpl */
Initialize, using the genericized table column set. FIXME Should be private
initialize
{ "repo_name": "fjalvingh/domui", "path": "to.etc.domui/src/main/java/to/etc/domui/component/tbl/SimpleRowRenderer.java", "license": "lgpl-2.1", "size": 5911 }
[ "java.util.List", "org.eclipse.jdt.annotation.NonNull", "to.etc.domui.component.meta.impl.ExpandedDisplayProperty" ]
import java.util.List; import org.eclipse.jdt.annotation.NonNull; import to.etc.domui.component.meta.impl.ExpandedDisplayProperty;
import java.util.*; import org.eclipse.jdt.annotation.*; import to.etc.domui.component.meta.impl.*;
[ "java.util", "org.eclipse.jdt", "to.etc.domui" ]
java.util; org.eclipse.jdt; to.etc.domui;
974,452
public boolean shouldStripWhiteSpace( XPathContext support, Element targetElement) throws TransformerException;
boolean function( XPathContext support, Element targetElement) throws TransformerException;
/** * Get information about whether or not an element should strip whitespace. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a> * * @param support The XPath runtime state. * @param targetElement Element to check * * @return true if the whitespace should be stripped. * * @throws TransformerException */
Get information about whether or not an element should strip whitespace
shouldStripWhiteSpace
{ "repo_name": "bandcampdotcom/j2objc", "path": "xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/WhitespaceStrippingElementMatcher.java", "license": "apache-2.0", "size": 1946 }
[ "javax.xml.transform.TransformerException", "org.w3c.dom.Element" ]
import javax.xml.transform.TransformerException; import org.w3c.dom.Element;
import javax.xml.transform.*; import org.w3c.dom.*;
[ "javax.xml", "org.w3c.dom" ]
javax.xml; org.w3c.dom;
1,169,314
public byte[] decode(String pArray) { return decode(StringUtils.getBytesUtf8(pArray)); }
byte[] function(String pArray) { return decode(StringUtils.getBytesUtf8(pArray)); }
/** * Decodes a String containing containing characters in the Base64 alphabet. * * @param pArray * A String containing Base64 character data * @return a byte array containing binary data * @since 1.4 */
Decodes a String containing containing characters in the Base64 alphabet
decode
{ "repo_name": "Cantal0p3/Networking-Aircasting", "path": "src/main/java/pl/llp/aircasting/util/base64/Base64.java", "license": "gpl-3.0", "size": 40754 }
[ "org.apache.commons.codec.binary.StringUtils" ]
import org.apache.commons.codec.binary.StringUtils;
import org.apache.commons.codec.binary.*;
[ "org.apache.commons" ]
org.apache.commons;
415,493
public void testCloning() { StandardXYItemRenderer r1 = new StandardXYItemRenderer(); Rectangle2D rect1 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0); r1.setLegendLine(rect1); StandardXYItemRenderer r2 = null; try { r2 = (StandardXYItemRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); // check independence rect1.setRect(4.0, 3.0, 2.0, 1.0); assertFalse(r1.equals(r2)); r2.setLegendLine(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0)); assertTrue(r1.equals(r2)); r1.setSeriesShapesFilled(1, Boolean.TRUE); assertFalse(r1.equals(r2)); r2.setSeriesShapesFilled(1, Boolean.TRUE); assertTrue(r1.equals(r2)); }
void function() { StandardXYItemRenderer r1 = new StandardXYItemRenderer(); Rectangle2D rect1 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0); r1.setLegendLine(rect1); StandardXYItemRenderer r2 = null; try { r2 = (StandardXYItemRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); rect1.setRect(4.0, 3.0, 2.0, 1.0); assertFalse(r1.equals(r2)); r2.setLegendLine(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0)); assertTrue(r1.equals(r2)); r1.setSeriesShapesFilled(1, Boolean.TRUE); assertFalse(r1.equals(r2)); r2.setSeriesShapesFilled(1, Boolean.TRUE); assertTrue(r1.equals(r2)); }
/** * Confirm that cloning works. */
Confirm that cloning works
testCloning
{ "repo_name": "JSansalone/JFreeChart", "path": "tests/org/jfree/chart/renderer/xy/junit/StandardXYItemRendererTests.java", "license": "lgpl-2.1", "size": 10352 }
[ "java.awt.geom.Rectangle2D", "org.jfree.chart.renderer.xy.StandardXYItemRenderer" ]
import java.awt.geom.Rectangle2D; import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
import java.awt.geom.*; import org.jfree.chart.renderer.xy.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
902,126
public InetAddress getInetAddress(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + " not found"); } try { return InetAddress.getByName(value); } catch (UnknownHostException ex) { throw new FtpException("Host " + value + " not found"); } }
InetAddress function(final String str) throws FtpException { String value = getProperty(str); if (value == null) { throw new FtpException(str + STR); } try { return InetAddress.getByName(value); } catch (UnknownHostException ex) { throw new FtpException(STR + value + STR); } }
/** * Get <code>InetAddress</code>. */
Get <code>InetAddress</code>
getInetAddress
{ "repo_name": "xuse/ef-others", "path": "common-net/src/main/java/jef/net/ftpserver/util/BaseProperties.java", "license": "apache-2.0", "size": 10435 }
[ "java.net.InetAddress", "java.net.UnknownHostException" ]
import java.net.InetAddress; import java.net.UnknownHostException;
import java.net.*;
[ "java.net" ]
java.net;
2,093,371
public View getStickyFooter() { return mDrawerBuilder.mStickyFooterView; }
View function() { return mDrawerBuilder.mStickyFooterView; }
/** * get the StickyFooter View if set else NULL * * @return */
get the StickyFooter View if set else NULL
getStickyFooter
{ "repo_name": "FreedomZZQ/YouJoin-Android", "path": "material-drawer-library/src/main/java/com/mikepenz/materialdrawer/Drawer.java", "license": "mit", "size": 33812 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,028,810
public void testQueryByNameLikeCaseInsensitive() { ProcessDefinitionQuery queryCaseInsensitive = repositoryService.createProcessDefinitionQuery() .processDefinitionNameLike("%OnE%"); verifyQueryResults(queryCaseInsensitive, 2); }
void function() { ProcessDefinitionQuery queryCaseInsensitive = repositoryService.createProcessDefinitionQuery() .processDefinitionNameLike("%OnE%"); verifyQueryResults(queryCaseInsensitive, 2); }
/** * CAM-8014 * * Verify that search by name like returns results with case-insensitive */
CAM-8014 Verify that search by name like returns results with case-insensitive
testQueryByNameLikeCaseInsensitive
{ "repo_name": "subhrajyotim/camunda-bpm-platform", "path": "engine/src/test/java/org/camunda/bpm/engine/test/api/repository/ProcessDefinitionQueryTest.java", "license": "apache-2.0", "size": 24381 }
[ "org.camunda.bpm.engine.repository.ProcessDefinitionQuery" ]
import org.camunda.bpm.engine.repository.ProcessDefinitionQuery;
import org.camunda.bpm.engine.repository.*;
[ "org.camunda.bpm" ]
org.camunda.bpm;
1,566,171
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>POST</code> method
doPost
{ "repo_name": "wensttay/Ecmat2016", "path": "src/main/java/io/github/herocode/ecmat/controller/ParticipantRecoverUpdate.java", "license": "gpl-3.0", "size": 5419 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
829,966
private final void fireEditorChanged(boolean bTranspose) { IEditorListener el; for (int i = 0; i < mvListeners.size(); i++) { el = (IEditorListener)mvListeners.get(i); try { String sProps = null; if (!bTranspose) sProps = getResourceProperty("aDci"); el.editorChanged(new EditorEvent(DataCompInfo.createFromData(midDocument, sProps),bTranspose)); } catch (DataException e) { e.printStackTrace(); } } }
final void function(boolean bTranspose) { IEditorListener el; for (int i = 0; i < mvListeners.size(); i++) { el = (IEditorListener)mvListeners.get(i); try { String sProps = null; if (!bTranspose) sProps = getResourceProperty("aDci"); el.editorChanged(new EditorEvent(DataCompInfo.createFromData(midDocument, sProps),bTranspose)); } catch (DataException e) { e.printStackTrace(); } } }
/** * Notifies all listeners about changes of the transposed state. * * @param bTranspose * The new transposed state. */
Notifies all listeners about changes of the transposed state
fireEditorChanged
{ "repo_name": "matthias-wolff/dLabPro-Plugin", "path": "Plugin/src/de/tudresden/ias/eclipse/dlabpro/editors/vis/editor/VisEditor.java", "license": "lgpl-3.0", "size": 27706 }
[ "de.tucottbus.kt.jlab.datadisplays.data.DataCompInfo", "de.tucottbus.kt.jlab.datadisplays.data.DataException" ]
import de.tucottbus.kt.jlab.datadisplays.data.DataCompInfo; import de.tucottbus.kt.jlab.datadisplays.data.DataException;
import de.tucottbus.kt.jlab.datadisplays.data.*;
[ "de.tucottbus.kt" ]
de.tucottbus.kt;
2,746,385
public static GenericValue getBillToAddress(GenericValue invoice) { return getInvoiceAddressByType(invoice, "BILLING_LOCATION"); }
static GenericValue function(GenericValue invoice) { return getInvoiceAddressByType(invoice, STR); }
/** * Method to obtain the billing address for an invoice * @param invoice GenericValue object of the Invoice * @return GenericValue object of the PostalAddress */
Method to obtain the billing address for an invoice
getBillToAddress
{ "repo_name": "ilscipio/scipio-erp", "path": "applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java", "license": "apache-2.0", "size": 62366 }
[ "org.ofbiz.entity.GenericValue" ]
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.*;
[ "org.ofbiz.entity" ]
org.ofbiz.entity;
2,891,990
public RefsetDescriptorRefSetMember addRefsetDescriptorRefSetMember( RefsetDescriptorRefSetMember refsetDescriptorRefSetMember) throws Exception;
RefsetDescriptorRefSetMember function( RefsetDescriptorRefSetMember refsetDescriptorRefSetMember) throws Exception;
/** * Adds the refset descriptor ref set member. * * @param refsetDescriptorRefSetMember the refset descriptor ref set member * @return the refset descriptor ref set member * @throws Exception the exception */
Adds the refset descriptor ref set member
addRefsetDescriptorRefSetMember
{ "repo_name": "WestCoastInformatics/ihtsdo-refset-tool", "path": "services/src/main/java/org/ihtsdo/otf/refset/services/ProjectService.java", "license": "apache-2.0", "size": 10024 }
[ "org.ihtsdo.otf.refset.rf2.RefsetDescriptorRefSetMember" ]
import org.ihtsdo.otf.refset.rf2.RefsetDescriptorRefSetMember;
import org.ihtsdo.otf.refset.rf2.*;
[ "org.ihtsdo.otf" ]
org.ihtsdo.otf;
1,219,267
@Nonnull public synchronized Map<String, TaskState> getTaskStates(@Nonnull String taskType) { Map<String, TaskState> helixJobStates = _taskDriver.getWorkflowContext(getHelixJobQueueName(taskType)).getJobStates(); Map<String, TaskState> taskStates = new HashMap<>(helixJobStates.size()); for (Map.Entry<String, TaskState> entry : helixJobStates.entrySet()) { taskStates.put(getPinotTaskName(entry.getKey()), entry.getValue()); } return taskStates; }
synchronized Map<String, TaskState> function(@Nonnull String taskType) { Map<String, TaskState> helixJobStates = _taskDriver.getWorkflowContext(getHelixJobQueueName(taskType)).getJobStates(); Map<String, TaskState> taskStates = new HashMap<>(helixJobStates.size()); for (Map.Entry<String, TaskState> entry : helixJobStates.entrySet()) { taskStates.put(getPinotTaskName(entry.getKey()), entry.getValue()); } return taskStates; }
/** * Get all task states for the given task type. * * @param taskType Task type * @return Map from task name to task state */
Get all task states for the given task type
getTaskStates
{ "repo_name": "apucher/pinot", "path": "pinot-controller/src/main/java/com/linkedin/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java", "license": "apache-2.0", "size": 12686 }
[ "java.util.HashMap", "java.util.Map", "javax.annotation.Nonnull", "org.apache.helix.task.TaskState" ]
import java.util.HashMap; import java.util.Map; import javax.annotation.Nonnull; import org.apache.helix.task.TaskState;
import java.util.*; import javax.annotation.*; import org.apache.helix.task.*;
[ "java.util", "javax.annotation", "org.apache.helix" ]
java.util; javax.annotation; org.apache.helix;
702,932
public List<DatabaseRemoteFile> getKnownDatabases() { List<DatabaseRemoteFile> knownDatabases = new ArrayList<DatabaseRemoteFile>(); try (PreparedStatement preparedStatement = getStatement("application.select.all.getKnownDatabases.sql")) { try (ResultSet resultSet = preparedStatement.executeQuery()) { while (resultSet.next()) { String clientName = resultSet.getString("client"); int fileNumber = resultSet.getInt("filenumber"); knownDatabases.add(new DatabaseRemoteFile(clientName, fileNumber)); } return knownDatabases; } } catch (Exception e) { throw new RuntimeException(e); } }
List<DatabaseRemoteFile> function() { List<DatabaseRemoteFile> knownDatabases = new ArrayList<DatabaseRemoteFile>(); try (PreparedStatement preparedStatement = getStatement(STR)) { try (ResultSet resultSet = preparedStatement.executeQuery()) { while (resultSet.next()) { String clientName = resultSet.getString(STR); int fileNumber = resultSet.getInt(STR); knownDatabases.add(new DatabaseRemoteFile(clientName, fileNumber)); } return knownDatabases; } } catch (Exception e) { throw new RuntimeException(e); } }
/** * Queries the database for already known {@link DatabaseRemoteFile}s and returns a * list of all of them. * * @return Returns a list of all known/processed remote databases */
Queries the database for already known <code>DatabaseRemoteFile</code>s and returns a list of all of them
getKnownDatabases
{ "repo_name": "syncany/syncany-plugin-sftp", "path": "core/syncany-lib/src/main/java/org/syncany/database/dao/ApplicationSqlDao.java", "license": "gpl-3.0", "size": 6715 }
[ "java.sql.PreparedStatement", "java.sql.ResultSet", "java.util.ArrayList", "java.util.List", "org.syncany.plugins.transfer.files.DatabaseRemoteFile" ]
import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import org.syncany.plugins.transfer.files.DatabaseRemoteFile;
import java.sql.*; import java.util.*; import org.syncany.plugins.transfer.files.*;
[ "java.sql", "java.util", "org.syncany.plugins" ]
java.sql; java.util; org.syncany.plugins;
28,305
private static Node getChildByName(Node parentNode, String name) throws DOMException { if (parentNode == null) return null; NodeList children = parentNode.getChildNodes(); if (children != null) { for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child != null) { if ((child.getNodeName() != null && (name.equals(child.getNodeName()))) || (child.getLocalName() != null && (name.equals(child.getLocalName())))) { return child; } } } } return null; }
static Node function(Node parentNode, String name) throws DOMException { if (parentNode == null) return null; NodeList children = parentNode.getChildNodes(); if (children != null) { for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child != null) { if ((child.getNodeName() != null && (name.equals(child.getNodeName()))) (child.getLocalName() != null && (name.equals(child.getLocalName())))) { return child; } } } } return null; }
/** * Returns named child node. * * @param parentNode Parent node. * @param name Element name of child node to return. */
Returns named child node
getChildByName
{ "repo_name": "apache/axis1-java", "path": "axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/SchemaUtils.java", "license": "apache-2.0", "size": 77933 }
[ "org.w3c.dom.DOMException", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,444,824
public void setOnPreparedListener(IMediaPlayer.OnPreparedListener l) { mOnPreparedListener = l; }
void function(IMediaPlayer.OnPreparedListener l) { mOnPreparedListener = l; }
/** * Register a callback to be invoked when the media file * is loaded and ready to go. * * @param l The callback that will be run */
Register a callback to be invoked when the media file is loaded and ready to go
setOnPreparedListener
{ "repo_name": "maytrue/ijkplayer", "path": "android/ijkplayer/ijkplayer-example/src/main/java/tv/danmaku/ijk/media/example/widget/media/IjkVideoView.java", "license": "gpl-2.0", "size": 48701 }
[ "tv.danmaku.ijk.media.player.IMediaPlayer" ]
import tv.danmaku.ijk.media.player.IMediaPlayer;
import tv.danmaku.ijk.media.player.*;
[ "tv.danmaku.ijk" ]
tv.danmaku.ijk;
929,492
InputStream getInputStream(ResourceAccess access) throws IOException;
InputStream getInputStream(ResourceAccess access) throws IOException;
/** * Returns an {@link InputStream} that can be used to read the underling data. The * caller is responsible close the underlying stream. * @param access hint indicating how the underlying data should be accessed * @return a new input stream that can be used to read the underlying data. * @throws IOException */
Returns an <code>InputStream</code> that can be used to read the underling data. The caller is responsible close the underlying stream
getInputStream
{ "repo_name": "izestrea/spring-boot", "path": "spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessData.java", "license": "apache-2.0", "size": 2040 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,109,850
public ServiceFuture<VpnServerConfigurationInner> createOrUpdateAsync(String resourceGroupName, String vpnServerConfigurationName, VpnServerConfigurationInner vpnServerConfigurationParameters, final ServiceCallback<VpnServerConfigurationInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters), serviceCallback); }
ServiceFuture<VpnServerConfigurationInner> function(String resourceGroupName, String vpnServerConfigurationName, VpnServerConfigurationInner vpnServerConfigurationParameters, final ServiceCallback<VpnServerConfigurationInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters), serviceCallback); }
/** * Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnServerConfiguration. * * @param resourceGroupName The resource group name of the VpnServerConfiguration. * @param vpnServerConfigurationName The name of the VpnServerConfiguration being created or updated. * @param vpnServerConfigurationParameters Parameters supplied to create or update VpnServerConfiguration. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnServerConfiguration
createOrUpdateAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/VpnServerConfigurationsInner.java", "license": "mit", "size": 70526 }
[ "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;
432,403
private void eventosMenuArchivo(ActionEvent e) { if (e.getSource()==menuItemNuevo) { areaDeTexto.setText(""); } if (e.getSource()==menuItemAbrir) { String archivo=abrirArchivo(); areaDeTexto.setText(archivo); } if (e.getSource()==menuItemGuardar) { guardarArchivo(); } if (e.getSource()==itemSalir) { cadenaArchivo=""+itemSalir.getText(); dispose(); } }
void function(ActionEvent e) { if (e.getSource()==menuItemNuevo) { areaDeTexto.setText(STR"+itemSalir.getText(); dispose(); } }
/** * Metodos para los eventos del menu Archivo * @param e */
Metodos para los eventos del menu Archivo
eventosMenuArchivo
{ "repo_name": "luartmg/urSQL", "path": "urSQL/src/urSQL/GUI/VentanaPrincipal.java", "license": "apache-2.0", "size": 22418 }
[ "java.awt.event.ActionEvent" ]
import java.awt.event.ActionEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
2,885,808
GenericResponseMessage exec(KapuaId scopeId, KapuaId deviceId, GenericRequestMessage requestInput, Long timeout) throws KapuaException;
GenericResponseMessage exec(KapuaId scopeId, KapuaId deviceId, GenericRequestMessage requestInput, Long timeout) throws KapuaException;
/** * Execute the given device request with the provided options * * @param scopeId The scope {@link KapuaId} of the target device * @param deviceId The device {@link KapuaId} of the target device * @param requestInput The {@link GenericRequestMessage} for this request * @param timeout The timeout in milliseconds for the request to complete * @return the response from the device * @throws KapuaException if error occurs during processing * @since 1.1.0 */
Execute the given device request with the provided options
exec
{ "repo_name": "LeoNerdoG/kapua", "path": "service/device/management/request/api/src/main/java/org/eclipse/kapua/service/device/management/request/DeviceRequestManagementService.java", "license": "epl-1.0", "size": 2274 }
[ "org.eclipse.kapua.KapuaException", "org.eclipse.kapua.model.id.KapuaId", "org.eclipse.kapua.service.device.management.request.message.request.GenericRequestMessage", "org.eclipse.kapua.service.device.management.request.message.response.GenericResponseMessage" ]
import org.eclipse.kapua.KapuaException; import org.eclipse.kapua.model.id.KapuaId; import org.eclipse.kapua.service.device.management.request.message.request.GenericRequestMessage; import org.eclipse.kapua.service.device.management.request.message.response.GenericResponseMessage;
import org.eclipse.kapua.*; import org.eclipse.kapua.model.id.*; import org.eclipse.kapua.service.device.management.request.message.request.*; import org.eclipse.kapua.service.device.management.request.message.response.*;
[ "org.eclipse.kapua" ]
org.eclipse.kapua;
1,880,349
public static Long getVersion(final Map<String, Object> modifiedPropertiesHolder) { final Object arrivedVersionVal = modifiedPropertiesHolder.get(AbstractEntity.VERSION); return ((Integer) arrivedVersionVal).longValue(); }
static Long function(final Map<String, Object> modifiedPropertiesHolder) { final Object arrivedVersionVal = modifiedPropertiesHolder.get(AbstractEntity.VERSION); return ((Integer) arrivedVersionVal).longValue(); }
/** * Determines the version that is shipped with 'modifiedPropertiesHolder'. * * @param modifiedPropertiesHolder * @return */
Determines the version that is shipped with 'modifiedPropertiesHolder'
getVersion
{ "repo_name": "fieldenms/tg", "path": "platform-pojo-bl/src/main/java/ua/com/fielden/platform/web/utils/EntityResourceUtils.java", "license": "mit", "size": 54150 }
[ "java.util.Map", "ua.com.fielden.platform.entity.AbstractEntity" ]
import java.util.Map; import ua.com.fielden.platform.entity.AbstractEntity;
import java.util.*; import ua.com.fielden.platform.entity.*;
[ "java.util", "ua.com.fielden" ]
java.util; ua.com.fielden;
1,416,216
private void createAdditionalCaches() throws Exception { Map<String, CacheConfiguration> cfgMap; try { // Loading spring application context and getting all of the caches configurations in the map. cfgMap = IgniteNode.loadConfiguration(args.configuration()).get2().getBeansOfType(CacheConfiguration.class); } catch (BeansException e) { throw new Exception("Failed to instantiate bean [type=" + CacheConfiguration.class + ", err=" + e.getMessage() + ']', e); } if (cfgMap == null || cfgMap.isEmpty()) throw new Exception("Failed to find cache configurations in: " + args.configuration()); // Getting cache configuration from the map using name specified in property file. CacheConfiguration<Object, Object> ccfg = cfgMap.get(args.additionalCachesName()); if (ccfg == null) throw new Exception("Failed to find cache configuration [cache=" + args.additionalCachesName() + ", cfg=" + args.configuration() + ']'); for (int i = 0; i < args.additionalCachesNumber(); i++) { CacheConfiguration<Object, Object> newCfg = new CacheConfiguration<>(ccfg); newCfg.setName("additional_" + args.additionalCachesName() + "_cache_" + i); try { ignite().createCache(newCfg); } catch (CacheException e) { BenchmarkUtils.error("Failed to create additional cache [ name = " + args.additionalCachesName() + ", err" + e.getMessage() + ']', e); } } }
void function() throws Exception { Map<String, CacheConfiguration> cfgMap; try { cfgMap = IgniteNode.loadConfiguration(args.configuration()).get2().getBeansOfType(CacheConfiguration.class); } catch (BeansException e) { throw new Exception(STR + CacheConfiguration.class + STR + e.getMessage() + ']', e); } if (cfgMap == null cfgMap.isEmpty()) throw new Exception(STR + args.configuration()); CacheConfiguration<Object, Object> ccfg = cfgMap.get(args.additionalCachesName()); if (ccfg == null) throw new Exception(STR + args.additionalCachesName() + STR + args.configuration() + ']'); for (int i = 0; i < args.additionalCachesNumber(); i++) { CacheConfiguration<Object, Object> newCfg = new CacheConfiguration<>(ccfg); newCfg.setName(STR + args.additionalCachesName() + STR + i); try { ignite().createCache(newCfg); } catch (CacheException e) { BenchmarkUtils.error(STR + args.additionalCachesName() + STR + e.getMessage() + ']', e); } } }
/** * Creates additional caches. * * @throws Exception If failed. */
Creates additional caches
createAdditionalCaches
{ "repo_name": "nizhikov/ignite", "path": "modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java", "license": "apache-2.0", "size": 42504 }
[ "java.util.Map", "javax.cache.CacheException", "org.apache.ignite.configuration.CacheConfiguration", "org.apache.ignite.yardstick.IgniteNode", "org.springframework.beans.BeansException", "org.yardstickframework.BenchmarkUtils" ]
import java.util.Map; import javax.cache.CacheException; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.yardstick.IgniteNode; import org.springframework.beans.BeansException; import org.yardstickframework.BenchmarkUtils;
import java.util.*; import javax.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.yardstick.*; import org.springframework.beans.*; import org.yardstickframework.*;
[ "java.util", "javax.cache", "org.apache.ignite", "org.springframework.beans", "org.yardstickframework" ]
java.util; javax.cache; org.apache.ignite; org.springframework.beans; org.yardstickframework;
2,848,688
public void setMultipartUploads(List<MultipartUploadSummary> multipartUploads) { this.multipartUploads = multipartUploads; }
void function(List<MultipartUploadSummary> multipartUploads) { this.multipartUploads = multipartUploads; }
/** * Sets the list of multipart uploads. * * @param multipartUploads The list of multipart uploads. */
Sets the list of multipart uploads
setMultipartUploads
{ "repo_name": "baidubce/bce-sdk-java", "path": "src/main/java/com/baidubce/services/bos/model/ListMultipartUploadsResponse.java", "license": "apache-2.0", "size": 10602 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,525,131
@Override public int toByteMarshalCost() { return Marshal.COST_NUMERIC_LOSSY; } // // conversions //
int function() { return Marshal.COST_NUMERIC_LOSSY; } //
/** * Cost to convert to a byte */
Cost to convert to a byte
toByteMarshalCost
{ "repo_name": "WelcomeHUME/svn-caucho-com-resin", "path": "modules/quercus/src/com/caucho/quercus/env/DoubleValue.java", "license": "gpl-2.0", "size": 10289 }
[ "com.caucho.quercus.marshal.Marshal" ]
import com.caucho.quercus.marshal.Marshal;
import com.caucho.quercus.marshal.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
2,744,819
public void setForeground(Color fg) { m_text.setForeground(fg); } // setForeground
void function(Color fg) { m_text.setForeground(fg); }
/** * Set Foreground * @param fg color */
Set Foreground
setForeground
{ "repo_name": "arthurmelo88/palmetalADP", "path": "adempiereTrunk/client/src/org/compiere/grid/ed/VLocator.java", "license": "gpl-2.0", "size": 16904 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
25,750
public ArrayList<Point2D.Double> locateFlies(int day) { if (this.useMDD) { return EsotericMath.pickSomePointsMDD(location, stepSize, stepsPerDay, turnAngleStdev, day, numberOfFlies, rng); } else { return EsotericMath.pickSomePoints(location, diffusionCoefficient, day, numberOfFlies, rng); } }
ArrayList<Point2D.Double> function(int day) { if (this.useMDD) { return EsotericMath.pickSomePointsMDD(location, stepSize, stepsPerDay, turnAngleStdev, day, numberOfFlies, rng); } else { return EsotericMath.pickSomePoints(location, diffusionCoefficient, day, numberOfFlies, rng); } }
/** * Randomly places flies using a Gaussian distribution according to their * diffusion coefficient and the number of days elapsed since their release * @param day * @return An ArrayList of points representing the locations of the flies */
Randomly places flies using a Gaussian distribution according to their diffusion coefficient and the number of days elapsed since their release
locateFlies
{ "repo_name": "bruab/TrapGrid", "path": "src/com/reallymany/trapgrid/OutbreakLocation.java", "license": "mit", "size": 2054 }
[ "java.awt.geom.Point2D", "java.util.ArrayList" ]
import java.awt.geom.Point2D; import java.util.ArrayList;
import java.awt.geom.*; import java.util.*;
[ "java.awt", "java.util" ]
java.awt; java.util;
730,824
public ArrayList<Brick> getBricks() { return bricks; }
ArrayList<Brick> function() { return bricks; }
/** * Returns a list of bricks in the game * @return List of bricks */
Returns a list of bricks in the game
getBricks
{ "repo_name": "nabulator/BrickBreaker", "path": "Fjoejoe/brickbreaker/thePackage/PlayerManager.java", "license": "gpl-3.0", "size": 4610 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,688,219
LayoutFormatter a = new AuthorLastFirstAbbrCommas(); // Empty case Assert.assertEquals("", a.format("")); // Single Names Assert.assertEquals("Someone, V. S.", a.format("Van Something Someone")); // Two names Assert.assertEquals("von Neumann, J. and Black Brown, P.", a .format("John von Neumann and Black Brown, Peter")); // Three names Assert.assertEquals("von Neumann, J., Smith, J. and Black Brown, P.", a .format("von Neumann, John and Smith, John and Black Brown, Peter")); Assert.assertEquals("von Neumann, J., Smith, J. and Black Brown, P.", a .format("John von Neumann and John Smith and Black Brown, Peter")); }
LayoutFormatter a = new AuthorLastFirstAbbrCommas(); Assert.assertEquals(STRSTRSomeone, V. S.STRVan Something SomeoneSTRvon Neumann, J. and Black Brown, P.STRJohn von Neumann and Black Brown, PeterSTRvon Neumann, J., Smith, J. and Black Brown, P.STRvon Neumann, John and Smith, John and Black Brown, PeterSTRvon Neumann, J., Smith, J. and Black Brown, P.STRJohn von Neumann and John Smith and Black Brown, Peter")); }
/** * Test method for {@link net.sf.jabref.exporter.layout.format.AuthorLastFirstAbbrCommas#format(java.lang.String)}. */
Test method for <code>net.sf.jabref.exporter.layout.format.AuthorLastFirstAbbrCommas#format(java.lang.String)</code>
testFormat
{ "repo_name": "denki/jabref", "path": "src/test/java/net/sf/jabref/exporter/layout/format/AuthorLastFirstAbbrCommasTest.java", "license": "gpl-2.0", "size": 2129 }
[ "net.sf.jabref.exporter.layout.LayoutFormatter", "org.junit.Assert" ]
import net.sf.jabref.exporter.layout.LayoutFormatter; import org.junit.Assert;
import net.sf.jabref.exporter.layout.*; import org.junit.*;
[ "net.sf.jabref", "org.junit" ]
net.sf.jabref; org.junit;
2,106,773
properties = new PropertiesLoader().getProperties(); }
properties = new PropertiesLoader().getProperties(); }
/** * Setup for testing the file System manager * this loads the properties file for getting * the correct path for different file systems */
Setup for testing the file System manager this loads the properties file for getting the correct path for different file systems
setUp
{ "repo_name": "nate-rcl/irplus", "path": "file_db/test/edu/ur/file/db/FileInfoTest.java", "license": "apache-2.0", "size": 8596 }
[ "edu.ur.test.helper.PropertiesLoader" ]
import edu.ur.test.helper.PropertiesLoader;
import edu.ur.test.helper.*;
[ "edu.ur.test" ]
edu.ur.test;
859,671
public void testRequeueingConsumer() throws Exception { openConnection(); open(); injectMessage(); QueueingConsumer c = new QueueingConsumer(channel); channel.basicConsume(Q, c); c.nextDelivery(); close(); open(); assertNotNull(getMessage()); close(); closeConnection(); }
void function() throws Exception { openConnection(); open(); injectMessage(); QueueingConsumer c = new QueueingConsumer(channel); channel.basicConsume(Q, c); c.nextDelivery(); close(); open(); assertNotNull(getMessage()); close(); closeConnection(); }
/** * Test we requeue unacknowledged message (using consumer) * @throws Exception untested */
Test we requeue unacknowledged message (using consumer)
testRequeueingConsumer
{ "repo_name": "yanellyjm/rabbitmq-client-java", "path": "src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java", "license": "gpl-3.0", "size": 9420 }
[ "com.rabbitmq.client.QueueingConsumer" ]
import com.rabbitmq.client.QueueingConsumer;
import com.rabbitmq.client.*;
[ "com.rabbitmq.client" ]
com.rabbitmq.client;
582,960
private void getQLCategoryItem(PresentationObjectContainer poc, ICCategory cat) { String catPK = ((Integer) cat.getPrimaryKey()).toString(); Layer layer = createLayerWithStyleClass("category"); AnchorLink link = new AnchorLink(new Text(cat.getName(this.currentLocale)), "ap_cat" + catPK); layer.getChildren().add(link); Anchor anchor = new Anchor("cat" + catPK); layer.getChildren().add(anchor); poc.getChildren().add(layer); }
void function(PresentationObjectContainer poc, ICCategory cat) { String catPK = ((Integer) cat.getPrimaryKey()).toString(); Layer layer = createLayerWithStyleClass(STR); AnchorLink link = new AnchorLink(new Text(cat.getName(this.currentLocale)), STR + catPK); layer.getChildren().add(link); Anchor anchor = new Anchor("cat" + catPK); layer.getChildren().add(anchor); poc.getChildren().add(layer); }
/** * returns category headline */
returns category headline
getQLCategoryItem
{ "repo_name": "idega/platform2", "path": "src/com/idega/block/questions/presentation/QuestionsAndAnswers2.java", "license": "gpl-3.0", "size": 34081 }
[ "com.idega.block.category.data.ICCategory", "com.idega.presentation.Layer", "com.idega.presentation.PresentationObjectContainer", "com.idega.presentation.text.Anchor", "com.idega.presentation.text.AnchorLink", "com.idega.presentation.text.Text" ]
import com.idega.block.category.data.ICCategory; import com.idega.presentation.Layer; import com.idega.presentation.PresentationObjectContainer; import com.idega.presentation.text.Anchor; import com.idega.presentation.text.AnchorLink; import com.idega.presentation.text.Text;
import com.idega.block.category.data.*; import com.idega.presentation.*; import com.idega.presentation.text.*;
[ "com.idega.block", "com.idega.presentation" ]
com.idega.block; com.idega.presentation;
2,461,958
public JobSpecification translate( Pipeline pipeline, DataflowRunner runner, List<DataflowPackage> packages) { Translator translator = new Translator(pipeline, runner); Job result = translator.translate(packages); return new JobSpecification(result, Collections.unmodifiableMap(translator.stepNames)); } public static class JobSpecification { private final Job job; private final Map<AppliedPTransform<?, ?, ?>, String> stepNames; public JobSpecification(Job job, Map<AppliedPTransform<?, ?, ?>, String> stepNames) { this.job = job; this.stepNames = stepNames; }
JobSpecification function( Pipeline pipeline, DataflowRunner runner, List<DataflowPackage> packages) { Translator translator = new Translator(pipeline, runner); Job result = translator.translate(packages); return new JobSpecification(result, Collections.unmodifiableMap(translator.stepNames)); } public static class JobSpecification { private final Job job; private final Map<AppliedPTransform<?, ?, ?>, String> stepNames; public JobSpecification(Job job, Map<AppliedPTransform<?, ?, ?>, String> stepNames) { this.job = job; this.stepNames = stepNames; }
/** * Translates a {@link Pipeline} into a {@code JobSpecification}. */
Translates a <code>Pipeline</code> into a JobSpecification
translate
{ "repo_name": "manuzhang/beam", "path": "runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowPipelineTranslator.java", "license": "apache-2.0", "size": 38149 }
[ "com.google.api.services.dataflow.model.DataflowPackage", "com.google.api.services.dataflow.model.Job", "java.util.Collections", "java.util.List", "java.util.Map", "org.apache.beam.sdk.Pipeline", "org.apache.beam.sdk.runners.AppliedPTransform" ]
import com.google.api.services.dataflow.model.DataflowPackage; import com.google.api.services.dataflow.model.Job; import java.util.Collections; import java.util.List; import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.runners.AppliedPTransform;
import com.google.api.services.dataflow.model.*; import java.util.*; import org.apache.beam.sdk.*; import org.apache.beam.sdk.runners.*;
[ "com.google.api", "java.util", "org.apache.beam" ]
com.google.api; java.util; org.apache.beam;
27,599
public String getContents() { return dictionary.getString(COSName.CONTENTS); }
String function() { return dictionary.getString(COSName.CONTENTS); }
/** * Get the "contents" of the field. * * @return the value of the contents. */
Get the "contents" of the field
getContents
{ "repo_name": "mdamt/PdfBox-Android", "path": "library/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java", "license": "apache-2.0", "size": 16669 }
[ "org.apache.pdfbox.cos.COSName" ]
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
1,617,057
public static boolean isInH2HDirectory(IFileAgent fileAgent, File file) { return fileAgent == null ? false : isInH2HDirectory(file, fileAgent.getRoot()); }
static boolean function(IFileAgent fileAgent, File file) { return fileAgent == null ? false : isInH2HDirectory(file, fileAgent.getRoot()); }
/** * Does the same as {@link #isInH2HDirectory(File, File)} but taking a session as parameter */
Does the same as <code>#isInH2HDirectory(File, File)</code> but taking a session as parameter
isInH2HDirectory
{ "repo_name": "gfneto/Hive2Hive", "path": "org.hive2hive.core/src/main/java/org/hive2hive/core/file/FileUtil.java", "license": "mit", "size": 3908 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
308,719
@Test public void testIOExceptionHandlingWithNonRepeatableRequestContent() { // A mock HttpClient that always throws the specified IOException object IOException simulatedIOException = new IOException("fake IOException"); injectMockHttpClient(testedClient, new ThrowingExceptionHttpClient(simulatedIOException)); // The ExecutionContext should collect the expected RequestCount ExecutionContext context = new ExecutionContext(true); // A non-repeatable request Request<?> testedRepeatableRequest = getSampleRequestWithNonRepeatableContent(originalRequest); // It should fail directly and throw an ACE containing the simulated // IOException, without consulting the // custom shouldRetry(..) method. try { testedClient.requestExecutionBuilder() .request(testedRepeatableRequest) .errorResponseHandler(errorResponseHandler) .executionContext(context) .execute(); Assert.fail("AmazonClientException is expected."); } catch (AmazonClientException ace) { Assert.assertTrue(simulatedIOException == ace.getCause()); } // Verifies that shouldRetry and calculateSleepTime are still called verifyExpectedContextData(retryCondition, null, null, EXPECTED_RETRY_COUNT); verifyExpectedContextData(backoffStrategy, null, null, EXPECTED_RETRY_COUNT); Assert.assertEquals( EXPECTED_RETRY_COUNT + 1, // request count = retries + 1 context.getAwsRequestMetrics() .getTimingInfo().getCounter(AWSRequestMetrics.Field.RequestCount.toString()).intValue()); }
void function() { IOException simulatedIOException = new IOException(STR); injectMockHttpClient(testedClient, new ThrowingExceptionHttpClient(simulatedIOException)); ExecutionContext context = new ExecutionContext(true); Request<?> testedRepeatableRequest = getSampleRequestWithNonRepeatableContent(originalRequest); try { testedClient.requestExecutionBuilder() .request(testedRepeatableRequest) .errorResponseHandler(errorResponseHandler) .executionContext(context) .execute(); Assert.fail(STR); } catch (AmazonClientException ace) { Assert.assertTrue(simulatedIOException == ace.getCause()); } verifyExpectedContextData(retryCondition, null, null, EXPECTED_RETRY_COUNT); verifyExpectedContextData(backoffStrategy, null, null, EXPECTED_RETRY_COUNT); Assert.assertEquals( EXPECTED_RETRY_COUNT + 1, context.getAwsRequestMetrics() .getTimingInfo().getCounter(AWSRequestMetrics.Field.RequestCount.toString()).intValue()); }
/** * Tests AmazonHttpClient's behavior upon simulated IOException when the * request payload is not repeatable. */
Tests AmazonHttpClient's behavior upon simulated IOException when the request payload is not repeatable
testIOExceptionHandlingWithNonRepeatableRequestContent
{ "repo_name": "dagnir/aws-sdk-java", "path": "aws-java-sdk-core/src/test/java/com/amazonaws/retry/AmazonHttpClientRetryPolicyTest.java", "license": "apache-2.0", "size": 13339 }
[ "com.amazonaws.AmazonClientException", "com.amazonaws.Request", "com.amazonaws.http.ExecutionContext", "com.amazonaws.util.AWSRequestMetrics", "java.io.IOException", "org.junit.Assert" ]
import com.amazonaws.AmazonClientException; import com.amazonaws.Request; import com.amazonaws.http.ExecutionContext; import com.amazonaws.util.AWSRequestMetrics; import java.io.IOException; import org.junit.Assert;
import com.amazonaws.*; import com.amazonaws.http.*; import com.amazonaws.util.*; import java.io.*; import org.junit.*;
[ "com.amazonaws", "com.amazonaws.http", "com.amazonaws.util", "java.io", "org.junit" ]
com.amazonaws; com.amazonaws.http; com.amazonaws.util; java.io; org.junit;
44,585
@Override public void setLoginConfig(LoginConfig config) { // Validate the incoming property value if (config == null) throw new IllegalArgumentException (sm.getString("standardContext.loginConfig.required")); String loginPage = config.getLoginPage(); if ((loginPage != null) && !loginPage.startsWith("/")) { if (isServlet22()) { if(log.isDebugEnabled()) log.debug(sm.getString("standardContext.loginConfig.loginWarning", loginPage)); config.setLoginPage("/" + loginPage); } else { throw new IllegalArgumentException (sm.getString("standardContext.loginConfig.loginPage", loginPage)); } } String errorPage = config.getErrorPage(); if ((errorPage != null) && !errorPage.startsWith("/")) { if (isServlet22()) { if(log.isDebugEnabled()) log.debug(sm.getString("standardContext.loginConfig.errorWarning", errorPage)); config.setErrorPage("/" + errorPage); } else { throw new IllegalArgumentException (sm.getString("standardContext.loginConfig.errorPage", errorPage)); } } // Process the property setting change LoginConfig oldLoginConfig = this.loginConfig; this.loginConfig = config; support.firePropertyChange("loginConfig", oldLoginConfig, this.loginConfig); }
void function(LoginConfig config) { if (config == null) throw new IllegalArgumentException (sm.getString(STR)); String loginPage = config.getLoginPage(); if ((loginPage != null) && !loginPage.startsWith("/")) { if (isServlet22()) { if(log.isDebugEnabled()) log.debug(sm.getString(STR, loginPage)); config.setLoginPage("/" + loginPage); } else { throw new IllegalArgumentException (sm.getString(STR, loginPage)); } } String errorPage = config.getErrorPage(); if ((errorPage != null) && !errorPage.startsWith("/")) { if (isServlet22()) { if(log.isDebugEnabled()) log.debug(sm.getString(STR, errorPage)); config.setErrorPage("/" + errorPage); } else { throw new IllegalArgumentException (sm.getString(STR, errorPage)); } } LoginConfig oldLoginConfig = this.loginConfig; this.loginConfig = config; support.firePropertyChange(STR, oldLoginConfig, this.loginConfig); }
/** * Set the login configuration descriptor for this web application. * * @param config The new login configuration */
Set the login configuration descriptor for this web application
setLoginConfig
{ "repo_name": "pistolove/sourcecode4junit", "path": "Source4Tomcat/src/org/apache/catalina/core/StandardContext.java", "license": "apache-2.0", "size": 202235 }
[ "org.apache.catalina.deploy.LoginConfig" ]
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.deploy.*;
[ "org.apache.catalina" ]
org.apache.catalina;
1,872,327
public int getEndOffsetForLineIndex(int index) { if (index<0 || index>=getDefaultRootElement().getElementCount()) return -1; Element element=getDefaultRootElement().getElement(index); return element==null ? -1 : element.getEndOffset(); }
int function(int index) { if (index<0 index>=getDefaultRootElement().getElementCount()) return -1; Element element=getDefaultRootElement().getElement(index); return element==null ? -1 : element.getEndOffset(); }
/** * Get the end offset for the specified line index. */
Get the end offset for the specified line index
getEndOffsetForLineIndex
{ "repo_name": "xylo/idea-sql-query-plugin", "path": "src/com/kiwisoft/utils/text/SourceDocument.java", "license": "gpl-2.0", "size": 11016 }
[ "javax.swing.text.Element" ]
import javax.swing.text.Element;
import javax.swing.text.*;
[ "javax.swing" ]
javax.swing;
2,568,154
private static boolean shouldRemoveVariable(ScopeData scopeData, DetailAST ast) { boolean shouldRemove = true; for (DetailAST variable : scopeData.uninitializedVariables) { if (variable.getText().equals(ast.getText())) { // if the variable is declared outside the loop and initialized inside // the loop, then it cannot be declared final, as it can be initialized // more than once in this case if (isInTheSameLoop(variable, ast)) { shouldRemove = false; } scopeData.uninitializedVariables.remove(variable); break; } } return shouldRemove; }
static boolean function(ScopeData scopeData, DetailAST ast) { boolean shouldRemove = true; for (DetailAST variable : scopeData.uninitializedVariables) { if (variable.getText().equals(ast.getText())) { if (isInTheSameLoop(variable, ast)) { shouldRemove = false; } scopeData.uninitializedVariables.remove(variable); break; } } return shouldRemove; }
/** * Whether the variable should be removed from the list of final local variable * candidates. * @param scopeData the scope data of the variable. * @param ast the variable ast. * @return true, if the variable should be removed. */
Whether the variable should be removed from the list of final local variable candidates
shouldRemoveVariable
{ "repo_name": "Bhavik3/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java", "license": "lgpl-2.1", "size": 16908 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
2,629,245
@SuppressWarnings("unchecked") public <T extends ClientBuilder> T unwrap(Class<T> clientBuilderClass) { Assert.notNull(clientBuilderClass, "Client builder class is required"); final ClientBuilder builder = builder(); if (!clientBuilderClass.isAssignableFrom(builder.getClass())) { throw new IllegalStateException(String.format("Could not cast %s into %s", builder.getClass().getName(), clientBuilderClass.getName())); } return (T) builder; }
@SuppressWarnings(STR) <T extends ClientBuilder> T function(Class<T> clientBuilderClass) { Assert.notNull(clientBuilderClass, STR); final ClientBuilder builder = builder(); if (!clientBuilderClass.isAssignableFrom(builder.getClass())) { throw new IllegalStateException(String.format(STR, builder.getClass().getName(), clientBuilderClass.getName())); } return (T) builder; }
/** * Unwraps the underlying {@link ClientBuilder} instance * * @param clientBuilderClass the client builder class * @param <T> the type * @return the client builder * @throws IllegalArgumentException if {@code clientBuilderClass} is {@code null} or the passed class does not * match the actual builder */
Unwraps the underlying <code>ClientBuilder</code> instance
unwrap
{ "repo_name": "jmnarloch/spring-jax-rs-client-proxy", "path": "src/main/java/com/github/jmnarloch/spring/jaxrs/client/support/ClientBuilderConfigurer.java", "license": "apache-2.0", "size": 4245 }
[ "javax.ws.rs.client.ClientBuilder", "org.springframework.util.Assert" ]
import javax.ws.rs.client.ClientBuilder; import org.springframework.util.Assert;
import javax.ws.rs.client.*; import org.springframework.util.*;
[ "javax.ws", "org.springframework.util" ]
javax.ws; org.springframework.util;
1,163,478
public ExecutorService getExecutorService() { return executorService; }
ExecutorService function() { return executorService; }
/** * Gets the {@link ExecutorService} to use in this workspace. * * @return The {@link ExecutorService} to use in this workspace. */
Gets the <code>ExecutorService</code> to use in this workspace
getExecutorService
{ "repo_name": "adufilie/flex-falcon", "path": "compiler/src/org/apache/flex/compiler/internal/workspaces/Workspace.java", "license": "apache-2.0", "size": 50460 }
[ "java.util.concurrent.ExecutorService" ]
import java.util.concurrent.ExecutorService;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,078,419
public static String getConfiguredHistoryServerDoneDirPrefix( Configuration conf) { String doneDirPrefix = conf.get(JHAdminConfig.MR_HISTORY_DONE_DIR); if (doneDirPrefix == null) { doneDirPrefix = conf.get(MRJobConfig.MR_AM_STAGING_DIR, MRJobConfig.DEFAULT_MR_AM_STAGING_DIR) + "/history/done"; } return doneDirPrefix; }
static String function( Configuration conf) { String doneDirPrefix = conf.get(JHAdminConfig.MR_HISTORY_DONE_DIR); if (doneDirPrefix == null) { doneDirPrefix = conf.get(MRJobConfig.MR_AM_STAGING_DIR, MRJobConfig.DEFAULT_MR_AM_STAGING_DIR) + STR; } return doneDirPrefix; }
/** * Gets the configured directory prefix for Done history files. * @param conf the configuration object * @return the done history directory */
Gets the configured directory prefix for Done history files
getConfiguredHistoryServerDoneDirPrefix
{ "repo_name": "ict-carch/hadoop-plus", "path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java", "license": "apache-2.0", "size": 18943 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.mapreduce.MRJobConfig" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.MRJobConfig;
import org.apache.hadoop.conf.*; import org.apache.hadoop.mapreduce.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,480,485
public void cleanUpForNeighborDown(DeviceId neighborId) { Set<PortNumber> ports = devicePortMap.remove(neighborId); if (ports != null) { ports.forEach(p -> portDeviceMap.remove(p)); } }
void function(DeviceId neighborId) { Set<PortNumber> ports = devicePortMap.remove(neighborId); if (ports != null) { ports.forEach(p -> portDeviceMap.remove(p)); } }
/** * Cleans up local stores for removed neighbor device. * * @param neighborId the device identifier for the neighbor device */
Cleans up local stores for removed neighbor device
cleanUpForNeighborDown
{ "repo_name": "kuujo/onos", "path": "apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java", "license": "apache-2.0", "size": 73488 }
[ "java.util.Set", "org.onosproject.net.DeviceId", "org.onosproject.net.PortNumber" ]
import java.util.Set; import org.onosproject.net.DeviceId; import org.onosproject.net.PortNumber;
import java.util.*; import org.onosproject.net.*;
[ "java.util", "org.onosproject.net" ]
java.util; org.onosproject.net;
193,863
@Test public void testLessThanBoundRange() { final String range = "(,23.0.1)"; assertTrue("'<' range was expected to match", MavenVersionRangeParser.rangeAccepts(range, "1")); assertTrue("'<' range was expected to match", MavenVersionRangeParser.rangeAccepts(range, "3.41.2")); assertTrue("'<' range was expected to match", MavenVersionRangeParser.rangeAccepts(range, "5.0")); assertTrue("'<' range was expected to match", MavenVersionRangeParser.rangeAccepts(range, "0")); assertTrue("'<' range was expected to match", MavenVersionRangeParser.rangeAccepts(range, "23.0")); assertFalse("'<' range wasn't expected to match", MavenVersionRangeParser.rangeAccepts(range, "23.0.1")); assertFalse("'<' range wasn't expected to match", MavenVersionRangeParser.rangeAccepts(range, "24")); assertFalse("'<' range wasn't expected to match", MavenVersionRangeParser.rangeAccepts(range, "26.2")); }
void function() { final String range = STR; assertTrue(STR, MavenVersionRangeParser.rangeAccepts(range, "1")); assertTrue(STR, MavenVersionRangeParser.rangeAccepts(range, STR)); assertTrue(STR, MavenVersionRangeParser.rangeAccepts(range, "5.0")); assertTrue(STR, MavenVersionRangeParser.rangeAccepts(range, "0")); assertTrue(STR, MavenVersionRangeParser.rangeAccepts(range, "23.0")); assertFalse(STR, MavenVersionRangeParser.rangeAccepts(range, STR)); assertFalse(STR, MavenVersionRangeParser.rangeAccepts(range, "24")); assertFalse(STR, MavenVersionRangeParser.rangeAccepts(range, "26.2")); }
/** * Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when a range of the form * {@code (,1.0)} is used to compare against some value. */
Tests the <code>MavenVersionRangeParser#rangeAccepts(String, String)</code> works correctly when a range of the form (,1.0) is used to compare against some value
testLessThanBoundRange
{ "repo_name": "jaikiran/ant-ivy", "path": "test/java/org/apache/ivy/plugins/parser/m2/MavenVersionRangeParserTest.java", "license": "apache-2.0", "size": 9046 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,226,680
private void throwIfClosed() throws AlreadyClosedSqlException { if ( isClosed() ) { throw new AlreadyClosedSqlException( "Statement is already closed." ); } } // Note: Using dynamic proxies would reduce the quantity (450?) of method // overrides by eliminating those that exist solely to check whether the // object is closed. It would also eliminate the need to throw non-compliant // RuntimeExceptions when Avatica's method declarations won't let us throw // proper SQLExceptions. (Check performance before applying to frequently // called ResultSet.)
void function() throws AlreadyClosedSqlException { if ( isClosed() ) { throw new AlreadyClosedSqlException( STR ); } }
/** * Throws AlreadyClosedSqlException <i>iff</i> this Statement is closed. * * @throws AlreadyClosedSqlException if Statement is closed */
Throws AlreadyClosedSqlException iff this Statement is closed
throwIfClosed
{ "repo_name": "ebegoli/drill", "path": "exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillStatementImpl.java", "license": "apache-2.0", "size": 14396 }
[ "org.apache.drill.jdbc.AlreadyClosedSqlException" ]
import org.apache.drill.jdbc.AlreadyClosedSqlException;
import org.apache.drill.jdbc.*;
[ "org.apache.drill" ]
org.apache.drill;
1,982,649
ContentResource getContent(String uri);
ContentResource getContent(String uri);
/** * Method return content by uri. * * @param uri * to content storage. * @return ContentResource for given uri. */
Method return content by uri
getContent
{ "repo_name": "optigra/funny-pictures", "path": "funny-pictures/funny-pictures-facade/src/main/java/com/optigra/funnypictures/facade/facade/content/ContentFacade.java", "license": "mpl-2.0", "size": 622 }
[ "com.optigra.funnypictures.facade.resources.content.ContentResource" ]
import com.optigra.funnypictures.facade.resources.content.ContentResource;
import com.optigra.funnypictures.facade.resources.content.*;
[ "com.optigra.funnypictures" ]
com.optigra.funnypictures;
825,560
protected void startMbContainer() { if (mbContainer != null && Server.getVersion().startsWith("8")) { //JETTY8 only try { boolean b = (Boolean)mbContainer.getClass().getMethod("isStarted").invoke(mbContainer); if (b) { mbContainer.getClass().getMethod("start").invoke(mbContainer); // Publish the container itself for consistency with // traditional embedded Jetty configurations. mbContainer.getClass().getMethod("addBean", Object.class).invoke(mbContainer, mbContainer); } } catch (Throwable e) { LOG.warn("Could not start Jetty MBeanContainer. Jetty JMX extensions will remain disabled.", e); } } }
void function() { if (mbContainer != null && Server.getVersion().startsWith("8")) { try { boolean b = (Boolean)mbContainer.getClass().getMethod(STR).invoke(mbContainer); if (b) { mbContainer.getClass().getMethod("start").invoke(mbContainer); mbContainer.getClass().getMethod(STR, Object.class).invoke(mbContainer, mbContainer); } } catch (Throwable e) { LOG.warn(STR, e); } } }
/** * Starts {@link #mbContainer} and registers the container with itself as a managed bean * logging an error if there is a problem starting the container. * Does nothing if {@link #mbContainer} is {@code null}. */
Starts <code>#mbContainer</code> and registers the container with itself as a managed bean logging an error if there is a problem starting the container. Does nothing if <code>#mbContainer</code> is null
startMbContainer
{ "repo_name": "yuruki/camel", "path": "components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java", "license": "apache-2.0", "size": 63394 }
[ "org.eclipse.jetty.server.Server" ]
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.*;
[ "org.eclipse.jetty" ]
org.eclipse.jetty;
2,858,053
public BastionSessionDeleteResult withValue(List<BastionSessionStateInner> value) { this.value = value; return this; }
BastionSessionDeleteResult function(List<BastionSessionStateInner> value) { this.value = value; return this; }
/** * Set the value property: List of sessions with their corresponding state. * * @param value the value value to set. * @return the BastionSessionDeleteResult object itself. */
Set the value property: List of sessions with their corresponding state
withValue
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/models/BastionSessionDeleteResult.java", "license": "mit", "size": 2373 }
[ "com.azure.resourcemanager.network.fluent.models.BastionSessionStateInner", "java.util.List" ]
import com.azure.resourcemanager.network.fluent.models.BastionSessionStateInner; import java.util.List;
import com.azure.resourcemanager.network.fluent.models.*; import java.util.*;
[ "com.azure.resourcemanager", "java.util" ]
com.azure.resourcemanager; java.util;
1,106,534
private static void updateLog(Boot boot, String msg, boolean isHtml) { if ( boot != null) boot.updateLog(msg, isHtml); }
static void function(Boot boot, String msg, boolean isHtml) { if ( boot != null) boot.updateLog(msg, isHtml); }
/**************************** * Metodos privados ****************************/
Metodos privados
updateLog
{ "repo_name": "adriangeles/pacman", "path": "workspace/Pacman/src/es/upm/fi/f980092/tfc/pacman/GameContext.java", "license": "gpl-2.0", "size": 8110 }
[ "es.upm.fi.f980092.tfc.pacman.activities.Boot" ]
import es.upm.fi.f980092.tfc.pacman.activities.Boot;
import es.upm.fi.f980092.tfc.pacman.activities.*;
[ "es.upm.fi" ]
es.upm.fi;
2,624,727
public java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI> getSubterm_partitions_LessThanHLAPI() { java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI>(); for (Term elemnt : getSubterm()) { if (elemnt.getClass().equals(fr.lip6.move.pnml.pthlpng.partitions.impl.LessThanImpl.class)) { retour.add(new fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI( (fr.lip6.move.pnml.pthlpng.partitions.LessThan) elemnt)); } } return retour; }
java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI> function() { java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI>(); for (Term elemnt : getSubterm()) { if (elemnt.getClass().equals(fr.lip6.move.pnml.pthlpng.partitions.impl.LessThanImpl.class)) { retour.add(new fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI( (fr.lip6.move.pnml.pthlpng.partitions.LessThan) elemnt)); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of LessThanHLAPI * kind. WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_partitions_LessThanHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/integers/hlapi/GreaterThanOrEqualHLAPI.java", "license": "epl-1.0", "size": 70100 }
[ "fr.lip6.move.pnml.pthlpng.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.pthlpng.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.pthlpng.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
128,327
public Collection<Visibility> listAllVisibilityOptions() { return this.manager.listAllVisibilityOptions(); }
Collection<Visibility> function() { return this.manager.listAllVisibilityOptions(); }
/** * Get all visibility options available in the platform, including {@link Visibility#isDisabled() disabled} ones. * * @return a collection of visibilities, may be empty if none are available * @since 1.3M2 */
Get all visibility options available in the platform, including <code>Visibility#isDisabled() disabled</code> ones
listAllVisibilityOptions
{ "repo_name": "alexhenrie/phenotips", "path": "components/patient-access-rules/api/src/main/java/org/phenotips/data/permissions/script/PermissionsManagerScriptService.java", "license": "agpl-3.0", "size": 3189 }
[ "java.util.Collection", "org.phenotips.data.permissions.Visibility" ]
import java.util.Collection; import org.phenotips.data.permissions.Visibility;
import java.util.*; import org.phenotips.data.permissions.*;
[ "java.util", "org.phenotips.data" ]
java.util; org.phenotips.data;
2,120,526
protected AdminClient admin() { return client().admin(); }
AdminClient function() { return client().admin(); }
/** * Returns a random admin client. This client can either be a node or a transport client pointing to any of * the nodes in the cluster. */
Returns a random admin client. This client can either be a node or a transport client pointing to any of the nodes in the cluster
admin
{ "repo_name": "zkidkid/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java", "license": "apache-2.0", "size": 101030 }
[ "org.elasticsearch.client.AdminClient" ]
import org.elasticsearch.client.AdminClient;
import org.elasticsearch.client.*;
[ "org.elasticsearch.client" ]
org.elasticsearch.client;
2,596,593
private void registerSwiftCompileAction( Artifact sourceFile, Artifact objFile, IntermediateArtifacts intermediateArtifacts, ObjcProvider objcProvider) { ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext); // Compiling a single swift file requires knowledge of all of the other // swift files in the same module. The primary file ({@code sourceFile}) is // compiled to an object file, while the remaining files are used to resolve // symbols (they behave like c/c++ headers in this context). ImmutableSet.Builder<Artifact> otherSwiftSourcesBuilder = ImmutableSet.builder(); for (Artifact otherSourceFile : compilationArtifacts(ruleContext).getSrcs()) { if (ObjcRuleClasses.SWIFT_SOURCES.matches(otherSourceFile.getFilename()) && otherSourceFile != sourceFile) { otherSwiftSourcesBuilder.add(otherSourceFile); } } ImmutableSet<Artifact> otherSwiftSources = otherSwiftSourcesBuilder.build(); CustomCommandLine.Builder commandLine = new CustomCommandLine.Builder() .add("-frontend") .add("-emit-object") .add("-target").add(IosSdkCommands.swiftTarget(objcConfiguration)) .add("-sdk").add(IosSdkCommands.sdkDir(objcConfiguration)) .add("-enable-objc-interop"); if (objcConfiguration.generateDebugSymbols()) { commandLine.add("-g"); } commandLine .add("-Onone") .add("-module-name").add(getModuleName()) .add("-parse-as-library") .addExecPath("-primary-file", sourceFile) .addExecPaths(otherSwiftSources) .addExecPath("-o", objFile) .addExecPath("-emit-module-path", intermediateArtifacts.swiftModuleFile(sourceFile)); ImmutableList.Builder<Artifact> inputHeaders = ImmutableList.builder(); inputHeaders.addAll(attributes.hdrs()); Optional<Artifact> bridgingHeader = attributes.bridgingHeader(); if (bridgingHeader.isPresent()) { commandLine.addExecPath("-import-objc-header", bridgingHeader.get()); inputHeaders.add(bridgingHeader.get()); } // Import the Objective-C module map. // TODO(bazel-team): Find a way to import the module map directly, instead of the parent // directory? if (objcConfiguration.moduleMapsEnabled()) { PathFragment moduleMapPath = intermediateArtifacts.moduleMap().getArtifact().getExecPath(); commandLine.add("-I").add(moduleMapPath.getParentDirectory().toString()); } ruleContext.registerAction( ObjcRuleClasses.spawnOnDarwinActionBuilder(ruleContext) .setMnemonic("SwiftCompile") .setExecutable(SWIFT) .setCommandLine(commandLine.build()) .addInput(sourceFile) .addInputs(otherSwiftSources) .addInputs(inputHeaders.build()) .addTransitiveInputs(objcProvider.get(HEADER)) .addTransitiveInputs(objcProvider.get(MODULE_MAP)) .addOutput(objFile) .addOutput(intermediateArtifacts.swiftModuleFile(sourceFile)) .build(ruleContext)); }
void function( Artifact sourceFile, Artifact objFile, IntermediateArtifacts intermediateArtifacts, ObjcProvider objcProvider) { ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext); ImmutableSet.Builder<Artifact> otherSwiftSourcesBuilder = ImmutableSet.builder(); for (Artifact otherSourceFile : compilationArtifacts(ruleContext).getSrcs()) { if (ObjcRuleClasses.SWIFT_SOURCES.matches(otherSourceFile.getFilename()) && otherSourceFile != sourceFile) { otherSwiftSourcesBuilder.add(otherSourceFile); } } ImmutableSet<Artifact> otherSwiftSources = otherSwiftSourcesBuilder.build(); CustomCommandLine.Builder commandLine = new CustomCommandLine.Builder() .add(STR) .add(STR) .add(STR).add(IosSdkCommands.swiftTarget(objcConfiguration)) .add("-sdk").add(IosSdkCommands.sdkDir(objcConfiguration)) .add(STR); if (objcConfiguration.generateDebugSymbols()) { commandLine.add("-g"); } commandLine .add(STR) .add(STR).add(getModuleName()) .add(STR) .addExecPath(STR, sourceFile) .addExecPaths(otherSwiftSources) .addExecPath("-o", objFile) .addExecPath(STR, intermediateArtifacts.swiftModuleFile(sourceFile)); ImmutableList.Builder<Artifact> inputHeaders = ImmutableList.builder(); inputHeaders.addAll(attributes.hdrs()); Optional<Artifact> bridgingHeader = attributes.bridgingHeader(); if (bridgingHeader.isPresent()) { commandLine.addExecPath(STR, bridgingHeader.get()); inputHeaders.add(bridgingHeader.get()); } if (objcConfiguration.moduleMapsEnabled()) { PathFragment moduleMapPath = intermediateArtifacts.moduleMap().getArtifact().getExecPath(); commandLine.add("-I").add(moduleMapPath.getParentDirectory().toString()); } ruleContext.registerAction( ObjcRuleClasses.spawnOnDarwinActionBuilder(ruleContext) .setMnemonic(STR) .setExecutable(SWIFT) .setCommandLine(commandLine.build()) .addInput(sourceFile) .addInputs(otherSwiftSources) .addInputs(inputHeaders.build()) .addTransitiveInputs(objcProvider.get(HEADER)) .addTransitiveInputs(objcProvider.get(MODULE_MAP)) .addOutput(objFile) .addOutput(intermediateArtifacts.swiftModuleFile(sourceFile)) .build(ruleContext)); }
/** * Compiles a single swift file. * * @param sourceFile the artifact to compile * @param objFile the resulting object artifact */
Compiles a single swift file
registerSwiftCompileAction
{ "repo_name": "xindaya/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java", "license": "apache-2.0", "size": 48470 }
[ "com.google.common.base.Optional", "com.google.common.collect.ImmutableList", "com.google.common.collect.ImmutableSet", "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.analysis.actions.CustomCommandLine", "com.google.devtools.build.lib.rules.objc.XcodeProvider", "com.google.devtools.build.lib.vfs.PathFragment" ]
import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; import com.google.devtools.build.lib.rules.objc.XcodeProvider; import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.common.base.*; import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.actions.*; import com.google.devtools.build.lib.rules.objc.*; import com.google.devtools.build.lib.vfs.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
1,968,597
public static void startAlarm(Context context, AlarmInstance instance) { Intent intent = AlarmInstance.createIntent(context, AlarmService.class, instance.mId); intent.setAction(START_ALARM_ACTION); // Maintain a cpu wake lock until the service can get it AlarmAlertWakeLock.acquireCpuWakeLock(context); context.startService(intent); }
static void function(Context context, AlarmInstance instance) { Intent intent = AlarmInstance.createIntent(context, AlarmService.class, instance.mId); intent.setAction(START_ALARM_ACTION); AlarmAlertWakeLock.acquireCpuWakeLock(context); context.startService(intent); }
/** * Utility method to help start alarm properly. If alarm is already firing, it * will mark it as missed and start the new one. * * @param context application context * @param instance to trigger alarm */
Utility method to help start alarm properly. If alarm is already firing, it will mark it as missed and start the new one
startAlarm
{ "repo_name": "TurboOS/android_packages_apps_DeskClock", "path": "src/com/phonemetra/deskclock/alarms/AlarmService.java", "license": "apache-2.0", "size": 16990 }
[ "android.content.Context", "android.content.Intent", "com.phonemetra.deskclock.AlarmAlertWakeLock", "com.phonemetra.deskclock.provider.AlarmInstance" ]
import android.content.Context; import android.content.Intent; import com.phonemetra.deskclock.AlarmAlertWakeLock; import com.phonemetra.deskclock.provider.AlarmInstance;
import android.content.*; import com.phonemetra.deskclock.*; import com.phonemetra.deskclock.provider.*;
[ "android.content", "com.phonemetra.deskclock" ]
android.content; com.phonemetra.deskclock;
1,243,610
@Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { DiscoveryEvent info = (DiscoveryEvent) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getServiceName(), dataOut); looseMarshalString(info.getBrokerName(), dataOut); }
void function(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { DiscoveryEvent info = (DiscoveryEvent) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getServiceName(), dataOut); looseMarshalString(info.getBrokerName(), dataOut); }
/** * Write the booleans that this object uses to a BooleanStream */
Write the booleans that this object uses to a BooleanStream
looseMarshal
{ "repo_name": "apache/activemq-openwire", "path": "openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DiscoveryEventMarshaller.java", "license": "apache-2.0", "size": 4481 }
[ "java.io.DataOutput", "java.io.IOException", "org.apache.activemq.openwire.codec.OpenWireFormat", "org.apache.activemq.openwire.commands.DiscoveryEvent" ]
import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DiscoveryEvent;
import java.io.*; import org.apache.activemq.openwire.codec.*; import org.apache.activemq.openwire.commands.*;
[ "java.io", "org.apache.activemq" ]
java.io; org.apache.activemq;
2,772,553
public static Value makeAnyHTMLElement() { return Value.makeObject(HTMLBuilder.HTML_OBJECT_LABELS) .join(Value.makeObject(HTML5Builder.HTML5_OBJECT_LABELS)); }
static Value function() { return Value.makeObject(HTMLBuilder.HTML_OBJECT_LABELS) .join(Value.makeObject(HTML5Builder.HTML5_OBJECT_LABELS)); }
/** * Returns a Value representing all possible HTML elements. */
Returns a Value representing all possible HTML elements
makeAnyHTMLElement
{ "repo_name": "cursem/ScriptCompressor", "path": "ScriptCompressor1.0/src/dk/brics/tajs/analysis/dom/DOMFunctions.java", "license": "apache-2.0", "size": 32669 }
[ "dk.brics.tajs.analysis.dom.html.HTMLBuilder", "dk.brics.tajs.analysis.dom.html5.HTML5Builder", "dk.brics.tajs.lattice.Value" ]
import dk.brics.tajs.analysis.dom.html.HTMLBuilder; import dk.brics.tajs.analysis.dom.html5.HTML5Builder; import dk.brics.tajs.lattice.Value;
import dk.brics.tajs.analysis.dom.html.*; import dk.brics.tajs.analysis.dom.html5.*; import dk.brics.tajs.lattice.*;
[ "dk.brics.tajs" ]
dk.brics.tajs;
1,158,154
private void decryptImage() { Log.v(LOG_TAG, "decryptImage() called"); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); IEncryptor encryptor = preferences.getString("encryptionMethodPref", "lsb").equals("lsb") ? new GIFEncryptorByLSBMethod() : new GIFEncryptorByPaletteExtensionMethod(); ICompressor compressor = new StringCompressor(); ICrypto crypto = new AESCrypto(); // obtaining the encryption key String key = preferences.getString("keyPref", ""); try { // extracting hidden data from the image byte[] data = encryptor.decrypt(image); // decoding of hidden data String decryptedMsg = new String(compressor.decompress(crypto.decrypt(data, key))); Toast.makeText(this, "decrypted message: " + decryptedMsg, Toast.LENGTH_LONG).show(); } catch (UnableToDecodeException e) { Toast.makeText(this, Parameters.MESSAGE_DECRYPTION_ERROR, Toast.LENGTH_LONG).show(); Log.w(LOG_TAG, e); } catch (IOException e) { Toast.makeText(this, Parameters.MESSAGE_IO_ERROR, Toast.LENGTH_LONG).show(); Log.w(LOG_TAG, e); } catch (NullPointerException e) { Toast.makeText(this, Parameters.MESSAGE_UNEXPECTED_ERROR, Toast.LENGTH_LONG).show(); Log.w(LOG_TAG, e); } catch (GeneralSecurityException e) { Toast.makeText(this, Parameters.MESSAGE_DECRYPTION_ERROR, Toast.LENGTH_LONG).show(); Log.w(LOG_TAG, e); } }
void function() { Log.v(LOG_TAG, STR); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); IEncryptor encryptor = preferences.getString(STR, "lsb").equals("lsb") ? new GIFEncryptorByLSBMethod() : new GIFEncryptorByPaletteExtensionMethod(); ICompressor compressor = new StringCompressor(); ICrypto crypto = new AESCrypto(); String key = preferences.getString(STR, STRdecrypted message: " + decryptedMsg, Toast.LENGTH_LONG).show(); } catch (UnableToDecodeException e) { Toast.makeText(this, Parameters.MESSAGE_DECRYPTION_ERROR, Toast.LENGTH_LONG).show(); Log.w(LOG_TAG, e); } catch (IOException e) { Toast.makeText(this, Parameters.MESSAGE_IO_ERROR, Toast.LENGTH_LONG).show(); Log.w(LOG_TAG, e); } catch (NullPointerException e) { Toast.makeText(this, Parameters.MESSAGE_UNEXPECTED_ERROR, Toast.LENGTH_LONG).show(); Log.w(LOG_TAG, e); } catch (GeneralSecurityException e) { Toast.makeText(this, Parameters.MESSAGE_DECRYPTION_ERROR, Toast.LENGTH_LONG).show(); Log.w(LOG_TAG, e); } }
/** * Decrypt steganographic messages using selected encryption * method and display the encrypted message. */
Decrypt steganographic messages using selected encryption method and display the encrypted message
decryptImage
{ "repo_name": "johnkil/Steganography", "path": "src/com/shishkin/steganographie/ui/MainActivity.java", "license": "apache-2.0", "size": 14616 }
[ "android.content.SharedPreferences", "android.preference.PreferenceManager", "android.util.Log", "android.widget.Toast", "com.shishkin.steganographie.IEncryptor", "com.shishkin.steganographie.Parameters", "com.shishkin.steganographie.UnableToDecodeException", "com.shishkin.steganographie.crypto.AESCrypto", "com.shishkin.steganographie.crypto.ICrypto", "com.shishkin.steganographie.gif.GIFEncryptorByLSBMethod", "com.shishkin.steganographie.gif.GIFEncryptorByPaletteExtensionMethod", "com.shishkin.steganographie.zip.ICompressor", "com.shishkin.steganographie.zip.StringCompressor", "java.io.IOException", "java.security.GeneralSecurityException" ]
import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; import android.widget.Toast; import com.shishkin.steganographie.IEncryptor; import com.shishkin.steganographie.Parameters; import com.shishkin.steganographie.UnableToDecodeException; import com.shishkin.steganographie.crypto.AESCrypto; import com.shishkin.steganographie.crypto.ICrypto; import com.shishkin.steganographie.gif.GIFEncryptorByLSBMethod; import com.shishkin.steganographie.gif.GIFEncryptorByPaletteExtensionMethod; import com.shishkin.steganographie.zip.ICompressor; import com.shishkin.steganographie.zip.StringCompressor; import java.io.IOException; import java.security.GeneralSecurityException;
import android.content.*; import android.preference.*; import android.util.*; import android.widget.*; import com.shishkin.steganographie.*; import com.shishkin.steganographie.crypto.*; import com.shishkin.steganographie.gif.*; import com.shishkin.steganographie.zip.*; import java.io.*; import java.security.*;
[ "android.content", "android.preference", "android.util", "android.widget", "com.shishkin.steganographie", "java.io", "java.security" ]
android.content; android.preference; android.util; android.widget; com.shishkin.steganographie; java.io; java.security;
8,817
public void dump(final OutputStream os) throws IOException { final byte [] outputBuffer = new byte [16*1024]; int read = outputBuffer.length; while ((read = read(outputBuffer, 0, outputBuffer.length)) != -1) { os.write(outputBuffer, 0, read); } os.flush(); }
void function(final OutputStream os) throws IOException { final byte [] outputBuffer = new byte [16*1024]; int read = outputBuffer.length; while ((read = read(outputBuffer, 0, outputBuffer.length)) != -1) { os.write(outputBuffer, 0, read); } os.flush(); }
/** * Writes output on passed <code>os</code>. * @throws IOException */
Writes output on passed <code>os</code>
dump
{ "repo_name": "searchtechnologies/heritrix-connector", "path": "engine-3.1.1/commons/src/main/java/org/archive/io/ArchiveRecord.java", "license": "apache-2.0", "size": 13140 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
155,680
public void setRefEntityTypeValue(YangString refEntityTypeValue) throws JNCException { setLeafValue(Epc.NAMESPACE, "ref-entity-type", refEntityTypeValue, childrenNames()); }
void function(YangString refEntityTypeValue) throws JNCException { setLeafValue(Epc.NAMESPACE, STR, refEntityTypeValue, childrenNames()); }
/** * Sets the value for child leaf "ref-entity-type", * using instance of generated typedef class. * @param refEntityTypeValue The value to set. * @param refEntityTypeValue used during instantiation. */
Sets the value for child leaf "ref-entity-type", using instance of generated typedef class
setRefEntityTypeValue
{ "repo_name": "jnpr-shinma/yangfile", "path": "hitel/src/hctaEpc/mmeSgsn/statistics/umtsSm/SecondaryAct.java", "license": "apache-2.0", "size": 11402 }
[ "com.tailf.jnc.YangString" ]
import com.tailf.jnc.YangString;
import com.tailf.jnc.*;
[ "com.tailf.jnc" ]
com.tailf.jnc;
514,529
public static void main(String[] args) { CmdLine cmd = new CmdLine(); Configuration conf = new Configuration(); int res = 0; try { res = ToolRunner.run(conf, cmd, args); } catch (Exception e) { System.err.println("Error while running MR job"); e.printStackTrace(); } System.exit(res); }
static void function(String[] args) { CmdLine cmd = new CmdLine(); Configuration conf = new Configuration(); int res = 0; try { res = ToolRunner.run(conf, cmd, args); } catch (Exception e) { System.err.println(STR); e.printStackTrace(); } System.exit(res); }
/** * Entry point for this example * Uses HDFS ToolRunner to wrap processing of * * @param args Command-line arguments for HDFS example */
Entry point for this example Uses HDFS ToolRunner to wrap processing of
main
{ "repo_name": "mibrahim/DataGenerator", "path": "dg-example-hadoop/src/main/java/org/finra/datagenerator/samples/CmdLine.java", "license": "apache-2.0", "size": 7974 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.util.ToolRunner" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.ToolRunner;
import org.apache.hadoop.conf.*; import org.apache.hadoop.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
910,601
@Nonnull @SuppressWarnings("unchecked") // used by Jelly EL only @Restricted(NoExternalUse.class) // used by Jelly EL only public final List<Descriptor<RetentionStrategy<?>>> retentionStrategyDescriptors(@CheckForNull Slave it) { return it == null ? DescriptorVisibilityFilter.applyType(clazz, RetentionStrategy.all()) : DescriptorVisibilityFilter.apply(it, RetentionStrategy.all()); }
@SuppressWarnings(STR) @Restricted(NoExternalUse.class) final List<Descriptor<RetentionStrategy<?>>> function(@CheckForNull Slave it) { return it == null ? DescriptorVisibilityFilter.applyType(clazz, RetentionStrategy.all()) : DescriptorVisibilityFilter.apply(it, RetentionStrategy.all()); }
/** * Returns the list of {@link RetentionStrategy} descriptors appropriate to the supplied {@link Slave}. * * @param it the {@link Slave} or {@code null} to assume the slave is of type {@link #clazz}. * @return the filtered list * @since 2.12 */
Returns the list of <code>RetentionStrategy</code> descriptors appropriate to the supplied <code>Slave</code>
retentionStrategyDescriptors
{ "repo_name": "ErikVerheul/jenkins", "path": "core/src/main/java/hudson/model/Slave.java", "license": "mit", "size": 28753 }
[ "hudson.slaves.RetentionStrategy", "java.util.List", "javax.annotation.CheckForNull", "org.kohsuke.accmod.Restricted", "org.kohsuke.accmod.restrictions.NoExternalUse" ]
import hudson.slaves.RetentionStrategy; import java.util.List; import javax.annotation.CheckForNull; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse;
import hudson.slaves.*; import java.util.*; import javax.annotation.*; import org.kohsuke.accmod.*; import org.kohsuke.accmod.restrictions.*;
[ "hudson.slaves", "java.util", "javax.annotation", "org.kohsuke.accmod" ]
hudson.slaves; java.util; javax.annotation; org.kohsuke.accmod;
111,833
public static String[] getSupportedCADExtensions() { String extensions = settings.getString("Actify3dFiles"); if (StringUtil.isDefined(extensions)) { return extensions.split(","); } return new String[0]; }
static String[] function() { String extensions = settings.getString(STR); if (StringUtil.isDefined(extensions)) { return extensions.split(","); } return new String[0]; }
/** * Gets the CAD file extensions supported by Actify. * * @return an array of CAD extensions supported by Actify. */
Gets the CAD file extensions supported by Actify
getSupportedCADExtensions
{ "repo_name": "SilverDav/Silverpeas-Core", "path": "core-library/src/main/java/org/silverpeas/core/contribution/attachment/ActifyDocumentProcessor.java", "license": "agpl-3.0", "size": 7841 }
[ "org.silverpeas.core.util.StringUtil" ]
import org.silverpeas.core.util.StringUtil;
import org.silverpeas.core.util.*;
[ "org.silverpeas.core" ]
org.silverpeas.core;
2,125,303
public static boolean isUrlWhiteListed(String url) { if (parser == null) { Log.e(TAG, "Config was not initialised. Did you forget to Config.init(this)?"); return false; } return parser.getInternalWhitelist().isUrlWhiteListed(url); }
static boolean function(String url) { if (parser == null) { Log.e(TAG, STR); return false; } return parser.getInternalWhitelist().isUrlWhiteListed(url); }
/** * Determine if URL is in approved list of URLs to load. * * @param url * @return true if whitelisted */
Determine if URL is in approved list of URLs to load
isUrlWhiteListed
{ "repo_name": "apache/cordova-amazon-fireos", "path": "framework/src/org/apache/cordova/Config.java", "license": "apache-2.0", "size": 3784 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
683,687
@Test public void whenSelectNameSearchTaskNameExitTrackerTest() throws IOException { Item item = new Item("name", "description"); this.tracker.add(item); this.tracker.addComment(item, "comment"); final List<String> answers = new ArrayList<>();//{"3", "2", item.getName(), "6", "y"}; answers.add("3"); answers.add("2"); answers.add(item.getName()); answers.add("6"); answers.add("y"); final Input stubInput = new StubInput(answers); final Main main = new Main(stubInput, this.tracker); main.init(); Item searchName = this.tracker.findByName("name"); assertThat(searchName.getName(), is(item.getName())); }
void function() throws IOException { Item item = new Item("name", STR); this.tracker.add(item); this.tracker.addComment(item, STR); final List<String> answers = new ArrayList<>(); answers.add("3"); answers.add("2"); answers.add(item.getName()); answers.add("6"); answers.add("y"); final Input stubInput = new StubInput(answers); final Main main = new Main(stubInput, this.tracker); main.init(); Item searchName = this.tracker.findByName("name"); assertThat(searchName.getName(), is(item.getName())); }
/** * method select name search task name. * @throws IOException IOException */
method select name search task name
whenSelectNameSearchTaskNameExitTrackerTest
{ "repo_name": "RomanLotnyk/lotnyk", "path": "chapter_002/src/test/java/ru/lotnyk/start/MainTest.java", "license": "apache-2.0", "size": 6076 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.hamcrest.CoreMatchers", "org.hamcrest.MatcherAssert", "ru.lotnyk.model.Item" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import ru.lotnyk.model.Item;
import java.io.*; import java.util.*; import org.hamcrest.*; import ru.lotnyk.model.*;
[ "java.io", "java.util", "org.hamcrest", "ru.lotnyk.model" ]
java.io; java.util; org.hamcrest; ru.lotnyk.model;
2,280,841
private ProfileResult doGetTree(int token) { E element = elements.get(token); PB breakdown = breakdowns.get(token); List<Integer> children = tree.get(token); List<ProfileResult> childrenProfileResults = Collections.emptyList(); if (children != null) { childrenProfileResults = new ArrayList<>(children.size()); for (Integer child : children) { ProfileResult childNode = doGetTree(child); childrenProfileResults.add(childNode); } } // TODO this would be better done bottom-up instead of top-down to avoid // calculating the same times over and over...but worth the effort? String type = getTypeFromElement(element); String description = getDescriptionFromElement(element); return new ProfileResult(type, description, breakdown.toBreakdownMap(), breakdown.toDebugMap(), breakdown.toNodeTime(), childrenProfileResults); }
ProfileResult function(int token) { E element = elements.get(token); PB breakdown = breakdowns.get(token); List<Integer> children = tree.get(token); List<ProfileResult> childrenProfileResults = Collections.emptyList(); if (children != null) { childrenProfileResults = new ArrayList<>(children.size()); for (Integer child : children) { ProfileResult childNode = doGetTree(child); childrenProfileResults.add(childNode); } } String type = getTypeFromElement(element); String description = getDescriptionFromElement(element); return new ProfileResult(type, description, breakdown.toBreakdownMap(), breakdown.toDebugMap(), breakdown.toNodeTime(), childrenProfileResults); }
/** * Recursive helper to finalize a node in the dependency tree * @param token The node we are currently finalizing * @return A hierarchical representation of the tree inclusive of children at this level */
Recursive helper to finalize a node in the dependency tree
doGetTree
{ "repo_name": "gingerwizard/elasticsearch", "path": "server/src/main/java/org/elasticsearch/search/profile/AbstractInternalProfileTree.java", "license": "apache-2.0", "size": 6784 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
258,795
private synchronized Socket createDataSocket() throws Exception { // get socket depending on the selection dataSoc = null; DataConnectionConfiguration dataConfig = session.getListener() .getDataConnectionConfiguration(); try { if (!passive) { if (secure) { LOG.debug("Opening secure active data connection"); SslConfiguration ssl = getSslConfiguration(); if (ssl == null) { throw new FtpException( "Data connection SSL not configured"); } // get socket factory SSLContext ctx = ssl.getSSLContext(); SSLSocketFactory socFactory = ctx.getSocketFactory(); // create socket SSLSocket ssoc = (SSLSocket) socFactory.createSocket(); ssoc.setUseClientMode(false); // initialize socket if (ssl.getEnabledCipherSuites() != null) { ssoc.setEnabledCipherSuites(ssl.getEnabledCipherSuites()); } dataSoc = ssoc; } else { LOG.debug("Opening active data connection"); dataSoc = new Socket(); } dataSoc.setReuseAddress(true); InetAddress localAddr = resolveAddress(dataConfig .getActiveLocalAddress()); // if no local address has been configured, make sure we use the same as the client connects from if(localAddr == null) { localAddr = ((InetSocketAddress)session.getLocalAddress()).getAddress(); } SocketAddress localSocketAddress = new InetSocketAddress(localAddr, dataConfig.getActiveLocalPort()); LOG.debug("Binding active data connection to {}", localSocketAddress); dataSoc.bind(localSocketAddress); dataSoc.connect(new InetSocketAddress(address, port)); } else { if (secure) { LOG.debug("Opening secure passive data connection"); // this is where we wrap the unsecured socket as a SSLSocket. This is // due to the JVM bug described in FTPSERVER-241. // get server socket factory SslConfiguration ssl = getSslConfiguration(); // we've already checked this, but let's do it again if (ssl == null) { throw new FtpException( "Data connection SSL not configured"); } SSLContext ctx = ssl.getSSLContext(); SSLSocketFactory ssocketFactory = ctx.getSocketFactory(); Socket serverSocket = servSoc.accept(); SSLSocket sslSocket = (SSLSocket) ssocketFactory .createSocket(serverSocket, serverSocket .getInetAddress().getHostName(), serverSocket.getPort(), true); sslSocket.setUseClientMode(false); // initialize server socket if (ssl.getClientAuth() == ClientAuth.NEED) { sslSocket.setNeedClientAuth(true); } else if (ssl.getClientAuth() == ClientAuth.WANT) { sslSocket.setWantClientAuth(true); } if (ssl.getEnabledCipherSuites() != null) { sslSocket.setEnabledCipherSuites(ssl .getEnabledCipherSuites()); } dataSoc = sslSocket; } else { LOG.debug("Opening passive data connection"); dataSoc = servSoc.accept(); } LOG.debug("Passive data connection opened"); } } catch (Exception ex) { closeDataConnection(); LOG.warn("FtpDataConnection.getDataSocket()", ex); throw ex; } dataSoc.setSoTimeout(dataConfig.getIdleTime() * 1000); // Make sure we initiate the SSL handshake, or we'll // get an error if we turn out not to send any data // e.g. during the listing of an empty directory if (dataSoc instanceof SSLSocket) { ((SSLSocket) dataSoc).startHandshake(); } return dataSoc; }
synchronized Socket function() throws Exception { dataSoc = null; DataConnectionConfiguration dataConfig = session.getListener() .getDataConnectionConfiguration(); try { if (!passive) { if (secure) { LOG.debug(STR); SslConfiguration ssl = getSslConfiguration(); if (ssl == null) { throw new FtpException( STR); } SSLContext ctx = ssl.getSSLContext(); SSLSocketFactory socFactory = ctx.getSocketFactory(); SSLSocket ssoc = (SSLSocket) socFactory.createSocket(); ssoc.setUseClientMode(false); if (ssl.getEnabledCipherSuites() != null) { ssoc.setEnabledCipherSuites(ssl.getEnabledCipherSuites()); } dataSoc = ssoc; } else { LOG.debug(STR); dataSoc = new Socket(); } dataSoc.setReuseAddress(true); InetAddress localAddr = resolveAddress(dataConfig .getActiveLocalAddress()); if(localAddr == null) { localAddr = ((InetSocketAddress)session.getLocalAddress()).getAddress(); } SocketAddress localSocketAddress = new InetSocketAddress(localAddr, dataConfig.getActiveLocalPort()); LOG.debug(STR, localSocketAddress); dataSoc.bind(localSocketAddress); dataSoc.connect(new InetSocketAddress(address, port)); } else { if (secure) { LOG.debug(STR); SslConfiguration ssl = getSslConfiguration(); if (ssl == null) { throw new FtpException( STR); } SSLContext ctx = ssl.getSSLContext(); SSLSocketFactory ssocketFactory = ctx.getSocketFactory(); Socket serverSocket = servSoc.accept(); SSLSocket sslSocket = (SSLSocket) ssocketFactory .createSocket(serverSocket, serverSocket .getInetAddress().getHostName(), serverSocket.getPort(), true); sslSocket.setUseClientMode(false); if (ssl.getClientAuth() == ClientAuth.NEED) { sslSocket.setNeedClientAuth(true); } else if (ssl.getClientAuth() == ClientAuth.WANT) { sslSocket.setWantClientAuth(true); } if (ssl.getEnabledCipherSuites() != null) { sslSocket.setEnabledCipherSuites(ssl .getEnabledCipherSuites()); } dataSoc = sslSocket; } else { LOG.debug(STR); dataSoc = servSoc.accept(); } LOG.debug(STR); } } catch (Exception ex) { closeDataConnection(); LOG.warn(STR, ex); throw ex; } dataSoc.setSoTimeout(dataConfig.getIdleTime() * 1000); if (dataSoc instanceof SSLSocket) { ((SSLSocket) dataSoc).startHandshake(); } return dataSoc; }
/** * Get the data socket. In case of error returns null. */
Get the data socket. In case of error returns null
createDataSocket
{ "repo_name": "CasparLi/ftpserver", "path": "core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java", "license": "apache-2.0", "size": 15455 }
[ "java.net.InetAddress", "java.net.InetSocketAddress", "java.net.Socket", "java.net.SocketAddress", "javax.net.ssl.SSLContext", "javax.net.ssl.SSLSocket", "javax.net.ssl.SSLSocketFactory", "org.apache.ftpserver.DataConnectionConfiguration", "org.apache.ftpserver.ftplet.FtpException", "org.apache.ftpserver.ssl.ClientAuth", "org.apache.ftpserver.ssl.SslConfiguration" ]
import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import org.apache.ftpserver.DataConnectionConfiguration; import org.apache.ftpserver.ftplet.FtpException; import org.apache.ftpserver.ssl.ClientAuth; import org.apache.ftpserver.ssl.SslConfiguration;
import java.net.*; import javax.net.ssl.*; import org.apache.ftpserver.*; import org.apache.ftpserver.ftplet.*; import org.apache.ftpserver.ssl.*;
[ "java.net", "javax.net", "org.apache.ftpserver" ]
java.net; javax.net; org.apache.ftpserver;
2,571,734
@Override public boolean readBool() throws TException { if (boolValue_ != null) { boolean result = boolValue_.booleanValue(); boolValue_ = null; return result; } return readByte() == Types.BOOLEAN_TRUE; }
boolean function() throws TException { if (boolValue_ != null) { boolean result = boolValue_.booleanValue(); boolValue_ = null; return result; } return readByte() == Types.BOOLEAN_TRUE; }
/** * Read a boolean off the wire. If this is a boolean field, the value should already have been * read during readFieldBegin, so we'll just consume the pre-stored value. Otherwise, read a byte. */
Read a boolean off the wire. If this is a boolean field, the value should already have been read during readFieldBegin, so we'll just consume the pre-stored value. Otherwise, read a byte
readBool
{ "repo_name": "facebook/fbthrift", "path": "thrift/lib/javadeprecated/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java", "license": "apache-2.0", "size": 29224 }
[ "com.facebook.thrift.TException" ]
import com.facebook.thrift.TException;
import com.facebook.thrift.*;
[ "com.facebook.thrift" ]
com.facebook.thrift;
388,724
@Override protected void initEnd() { super.initEnd(); if (isAllowRepository()) { RepositorySystem repositoryService = RepositorySystem.getCurrent(); _repository = repositoryService.getRepository(); _repository.addListener(getId(), this); _repositorySpi = repositoryService.getRepositorySpi(); } DeployControllerService deployService = DeployControllerService.getCurrent(); deployService.addTag(getId()); _deployItem = deployService.getTagItem(getId()); if (_container != null) { _deployListener = new DeployListener(_container, getId()); _deployItem.addNotificationListener(_deployListener); } _rootHash = readRootHash(); }
void function() { super.initEnd(); if (isAllowRepository()) { RepositorySystem repositoryService = RepositorySystem.getCurrent(); _repository = repositoryService.getRepository(); _repository.addListener(getId(), this); _repositorySpi = repositoryService.getRepositorySpi(); } DeployControllerService deployService = DeployControllerService.getCurrent(); deployService.addTag(getId()); _deployItem = deployService.getTagItem(getId()); if (_container != null) { _deployListener = new DeployListener(_container, getId()); _deployItem.addNotificationListener(_deployListener); } _rootHash = readRootHash(); }
/** * Final calls for init. */
Final calls for init
initEnd
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/env/deploy/ExpandDeployController.java", "license": "gpl-2.0", "size": 18944 }
[ "com.caucho.env.repository.RepositorySystem" ]
import com.caucho.env.repository.RepositorySystem;
import com.caucho.env.repository.*;
[ "com.caucho.env" ]
com.caucho.env;
511,558
@Override public void incrementSequences(List<SequenceKey> sequenceKeys, long timestamp, long[] values, SQLException[] exceptions) throws SQLException { incrementSequenceValues(sequenceKeys, timestamp, values, exceptions, Sequence.ValueOp.INCREMENT_SEQUENCE); }
void function(List<SequenceKey> sequenceKeys, long timestamp, long[] values, SQLException[] exceptions) throws SQLException { incrementSequenceValues(sequenceKeys, timestamp, values, exceptions, Sequence.ValueOp.INCREMENT_SEQUENCE); }
/** * Increment any of the set of sequences that need more values. These are the sequences * that are asking for the next value within a given statement. The returned sequences * are the ones that were not found because they were deleted by another client. * @param sequenceKeys sorted list of sequence kyes * @param timestamp * @throws SQLException if any of the sequences cannot be found * */
Increment any of the set of sequences that need more values. These are the sequences that are asking for the next value within a given statement. The returned sequences are the ones that were not found because they were deleted by another client
incrementSequences
{ "repo_name": "simararneja/phoenix", "path": "phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java", "license": "apache-2.0", "size": 141176 }
[ "java.sql.SQLException", "java.util.List", "org.apache.phoenix.schema.Sequence", "org.apache.phoenix.schema.SequenceKey" ]
import java.sql.SQLException; import java.util.List; import org.apache.phoenix.schema.Sequence; import org.apache.phoenix.schema.SequenceKey;
import java.sql.*; import java.util.*; import org.apache.phoenix.schema.*;
[ "java.sql", "java.util", "org.apache.phoenix" ]
java.sql; java.util; org.apache.phoenix;
1,443,412
private static void rdf_ParseTypeOtherPropertyElement() throws XMPException { throw new XMPException("ParseTypeOther property element not allowed", BADXMP); }
static void function() throws XMPException { throw new XMPException(STR, BADXMP); }
/** * 7.2.20 parseTypeOtherPropertyElt * start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) ) * propertyEltList * end-element() * * @throws XMPException thown on parsing errors */
7.2.20 parseTypeOtherPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) ) propertyEltList end-element()
rdf_ParseTypeOtherPropertyElement
{ "repo_name": "bdaum/zoraPD", "path": "xmp/src/com/adobe/xmp/impl/ParseRDF.java", "license": "gpl-2.0", "size": 38937 }
[ "com.adobe.xmp.XMPException" ]
import com.adobe.xmp.XMPException;
import com.adobe.xmp.*;
[ "com.adobe.xmp" ]
com.adobe.xmp;
2,207,027
public void setExceptionListener(ExceptionListener exceptionListener) { getConfiguration().setExceptionListener(exceptionListener); }
void function(ExceptionListener exceptionListener) { getConfiguration().setExceptionListener(exceptionListener); }
/** * Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions. */
Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions
setExceptionListener
{ "repo_name": "arnaud-deprez/camel", "path": "components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java", "license": "apache-2.0", "size": 45950 }
[ "javax.jms.ExceptionListener" ]
import javax.jms.ExceptionListener;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
2,584,691