method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public PublicKey getOwnPublicKey() { return usersKeyPair.getPublic(); }
PublicKey function() { return usersKeyPair.getPublic(); }
/** * Helper method that returns the public key of the currently logged in user. */
Helper method that returns the public key of the currently logged in user
getOwnPublicKey
{ "repo_name": "gfneto/Hive2Hive", "path": "org.hive2hive.core/src/main/java/org/hive2hive/core/network/data/PublicKeyManager.java", "license": "mit", "size": 4672 }
[ "java.security.PublicKey" ]
import java.security.PublicKey;
import java.security.*;
[ "java.security" ]
java.security;
169,980
public Set<String> getFolders() { return m_folders; }
Set<String> function() { return m_folders; }
/** * Returns the list of selected VFS folders.<p> * * @return the list of selected VFS folders */
Returns the list of selected VFS folders
getFolders
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/ade/galleries/shared/CmsGallerySearchBean.java", "license": "lgpl-2.1", "size": 21658 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
926,707
public boolean containsHosts(long pk) throws SystemException { if (getHostsSize(pk) > 0) { return true; } else { return false; } }
boolean function(long pk) throws SystemException { if (getHostsSize(pk) > 0) { return true; } else { return false; } }
/** * Determines if the site has any hosts associated with it. * * @param pk the primary key of the site to check for associations with hosts * @return <code>true</code> if the site has any hosts associated with it; <code>false</code> otherwise * @throws SystemException if a system exception occurred */
Determines if the site has any hosts associated with it
containsHosts
{ "repo_name": "RamkumarChandran/My-Courses-Portlet", "path": "docroot/WEB-INF/src/org/gnenc/internet/mycourses/service/persistence/SitePersistenceImpl.java", "license": "gpl-3.0", "size": 74617 }
[ "com.liferay.portal.kernel.exception.SystemException" ]
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.exception.*;
[ "com.liferay.portal" ]
com.liferay.portal;
2,582,413
public List<PrivateLinkServiceConnection> privateLinkServiceConnections() { return this.privateLinkServiceConnections; }
List<PrivateLinkServiceConnection> function() { return this.privateLinkServiceConnections; }
/** * Get a grouping of information about the connection to the remote resource. * * @return the privateLinkServiceConnections value */
Get a grouping of information about the connection to the remote resource
privateLinkServiceConnections
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointInner.java", "license": "mit", "size": 6617 }
[ "com.microsoft.azure.management.network.v2019_06_01.PrivateLinkServiceConnection", "java.util.List" ]
import com.microsoft.azure.management.network.v2019_06_01.PrivateLinkServiceConnection; import java.util.List;
import com.microsoft.azure.management.network.v2019_06_01.*; import java.util.*;
[ "com.microsoft.azure", "java.util" ]
com.microsoft.azure; java.util;
1,443,776
private int getItemIndex(TableItem item) { int index = -1; for (int i = 0; i < table.getItemCount(); i++) { if (table.getItem(i) == item) { index = i; break; } } return index; }
int function(TableItem item) { int index = -1; for (int i = 0; i < table.getItemCount(); i++) { if (table.getItem(i) == item) { index = i; break; } } return index; }
/** * Returns the index of the given item. * * @param item * @return */
Returns the index of the given item
getItemIndex
{ "repo_name": "jgaupp/arx", "path": "src/gui/org/deidentifier/arx/gui/view/impl/explore/ViewClipboard.java", "license": "apache-2.0", "size": 18508 }
[ "org.eclipse.swt.widgets.TableItem" ]
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
386,712
public static HELM2Notation generatePeptidePolymersFromFASTAFormatHELM1(String fasta) throws FastaFormatException, ChemistryException { helm2notation = new HELM2Notation(); if (null == fasta) { LOG.error("Peptide Sequence must be specified"); throw new FastaFormatException("Peptide Sequence must be specified"); } initMapAminoAcid(); StringBuilder elements = new StringBuilder(); int counter = 0; PolymerNotation polymer; try { polymer = new PolymerNotation("PEPTIDE" + "1"); } catch (org.helm.notation2.parser.exceptionparser.NotationException e) { e.printStackTrace(); throw new FastaFormatException(e.getMessage()); } String annotation = ""; for (String line : fasta.split("\n")) { if (line.startsWith(">")) { counter++; if (counter > 1) { helm2notation.addPolymer(new PolymerNotation(polymer.getPolymerID(), generateElementsOfPeptide(elements.toString(), polymer.getPolymerID()), annotation)); elements = new StringBuilder(); try { polymer = new PolymerNotation("PEPTIDE" + counter); } catch (org.helm.notation2.parser.exceptionparser.NotationException e) { e.printStackTrace(); throw new FastaFormatException(e.getMessage()); } } annotation = line.substring(1); } else { line = cleanup(line); elements.append(line); } } helm2notation.addPolymer(new PolymerNotation(polymer.getPolymerID(), generateElementsOfPeptide(elements.toString(), polymer.getPolymerID()), annotation)); return helm2notation; }
static HELM2Notation function(String fasta) throws FastaFormatException, ChemistryException { helm2notation = new HELM2Notation(); if (null == fasta) { LOG.error(STR); throw new FastaFormatException(STR); } initMapAminoAcid(); StringBuilder elements = new StringBuilder(); int counter = 0; PolymerNotation polymer; try { polymer = new PolymerNotation(STR + "1"); } catch (org.helm.notation2.parser.exceptionparser.NotationException e) { e.printStackTrace(); throw new FastaFormatException(e.getMessage()); } String annotation = STR\nSTR>")) { counter++; if (counter > 1) { helm2notation.addPolymer(new PolymerNotation(polymer.getPolymerID(), generateElementsOfPeptide(elements.toString(), polymer.getPolymerID()), annotation)); elements = new StringBuilder(); try { polymer = new PolymerNotation(STR + counter); } catch (org.helm.notation2.parser.exceptionparser.NotationException e) { e.printStackTrace(); throw new FastaFormatException(e.getMessage()); } } annotation = line.substring(1); } else { line = cleanup(line); elements.append(line); } } helm2notation.addPolymer(new PolymerNotation(polymer.getPolymerID(), generateElementsOfPeptide(elements.toString(), polymer.getPolymerID()), annotation)); return helm2notation; }
/** * method to read the information from a FastaFile-Format + generate peptide * polymers, be careful, it produces only polymers in the HELM1 standard, no * ambiguity * * @param fasta * FastaFile in string format * @return HELM2Notation generated HELM2Notation * @throws FastaFormatException * if the input is not correct * @throws ChemistryException * if chemistry engine can not be initialized */
method to read the information from a FastaFile-Format + generate peptide polymers, be careful, it produces only polymers in the HELM1 standard, no ambiguity
generatePeptidePolymersFromFASTAFormatHELM1
{ "repo_name": "PistoiaHELM/HELM2NotationToolkit", "path": "src/main/java/org/helm/notation2/tools/FastaFormat.java", "license": "mit", "size": 29777 }
[ "org.helm.notation2.exception.ChemistryException", "org.helm.notation2.exception.FastaFormatException", "org.helm.notation2.parser.exceptionparser.NotationException", "org.helm.notation2.parser.notation.HELM2Notation", "org.helm.notation2.parser.notation.polymer.PolymerNotation" ]
import org.helm.notation2.exception.ChemistryException; import org.helm.notation2.exception.FastaFormatException; import org.helm.notation2.parser.exceptionparser.NotationException; import org.helm.notation2.parser.notation.HELM2Notation; import org.helm.notation2.parser.notation.polymer.PolymerNotation;
import org.helm.notation2.exception.*; import org.helm.notation2.parser.exceptionparser.*; import org.helm.notation2.parser.notation.*; import org.helm.notation2.parser.notation.polymer.*;
[ "org.helm.notation2" ]
org.helm.notation2;
2,450,350
InputStream formStream = this.getClass().getClassLoader().getResourceAsStream("startFormFrame.html"); InputRepresentation formResultRepresentation = new InputRepresentation(formStream); formResultRepresentation.setMediaType(MediaType.APPLICATION_XHTML); return formResultRepresentation; }
InputStream formStream = this.getClass().getClassLoader().getResourceAsStream(STR); InputRepresentation formResultRepresentation = new InputRepresentation(formStream); formResultRepresentation.setMediaType(MediaType.APPLICATION_XHTML); return formResultRepresentation; }
/** * The formFrame * */
The formFrame
getTaskFormPage
{ "repo_name": "gdharley/activiti-alpaca", "path": "src/main/java/org/activiti/rest/alpaca/services/StartFormFrameResource.java", "license": "apache-2.0", "size": 1296 }
[ "java.io.InputStream", "org.restlet.data.MediaType", "org.restlet.representation.InputRepresentation" ]
import java.io.InputStream; import org.restlet.data.MediaType; import org.restlet.representation.InputRepresentation;
import java.io.*; import org.restlet.data.*; import org.restlet.representation.*;
[ "java.io", "org.restlet.data", "org.restlet.representation" ]
java.io; org.restlet.data; org.restlet.representation;
1,278,349
public Version pluginVersion() { return pluginVersion; }
Version function() { return pluginVersion; }
/** * Return the plugin's version. * * @return the version of the plugin */
Return the plugin's version
pluginVersion
{ "repo_name": "kylycht/concourse", "path": "concourse-plugin-core/src/main/java/com/cinchapi/concourse/server/plugin/PluginContext.java", "license": "apache-2.0", "size": 2554 }
[ "com.github.zafarkhaja.semver.Version" ]
import com.github.zafarkhaja.semver.Version;
import com.github.zafarkhaja.semver.*;
[ "com.github.zafarkhaja" ]
com.github.zafarkhaja;
2,378,805
@Test(expected = AssertionError.class) public void testInvokeScriptCausesException() throws Exception { final TestRunner runner = TestRunners.newTestRunner(new InvokeScriptedProcessor()); runner.setValidateExpressionUsage(false); runner.setProperty(scriptingComponent.getScriptingComponentHelper().SCRIPT_ENGINE, "ECMAScript"); runner.setProperty(ScriptingComponentUtils.SCRIPT_BODY, getFileContentsAsString( TEST_RESOURCE_LOCATION + "javascript/testInvokeScriptCausesException.js") ); runner.assertValid(); runner.enqueue("test content".getBytes(StandardCharsets.UTF_8)); runner.run(); }
@Test(expected = AssertionError.class) void function() throws Exception { final TestRunner runner = TestRunners.newTestRunner(new InvokeScriptedProcessor()); runner.setValidateExpressionUsage(false); runner.setProperty(scriptingComponent.getScriptingComponentHelper().SCRIPT_ENGINE, STR); runner.setProperty(ScriptingComponentUtils.SCRIPT_BODY, getFileContentsAsString( TEST_RESOURCE_LOCATION + STR) ); runner.assertValid(); runner.enqueue(STR.getBytes(StandardCharsets.UTF_8)); runner.run(); }
/** * Tests a script that throws a ProcessException within. * The expected result is that the exception will be propagated. * * @throws Exception Any error encountered while testing */
Tests a script that throws a ProcessException within. The expected result is that the exception will be propagated
testInvokeScriptCausesException
{ "repo_name": "tequalsme/nifi", "path": "nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/java/org/apache/nifi/processors/script/TestInvokeJavascript.java", "license": "apache-2.0", "size": 7964 }
[ "java.nio.charset.StandardCharsets", "org.apache.nifi.util.TestRunner", "org.apache.nifi.util.TestRunners", "org.junit.Test" ]
import java.nio.charset.StandardCharsets; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; import org.junit.Test;
import java.nio.charset.*; import org.apache.nifi.util.*; import org.junit.*;
[ "java.nio", "org.apache.nifi", "org.junit" ]
java.nio; org.apache.nifi; org.junit;
1,164,219
@Deprecated public void setFontWeight(Expression fontWeight) { this.fontWeight = fontWeight; }
void function(Expression fontWeight) { this.fontWeight = fontWeight; }
/** * Setter for property fontWeight. * * @param fontWeight New value of property fontWeight. */
Setter for property fontWeight
setFontWeight
{ "repo_name": "FUNCATE/TerraMobile", "path": "sldparser/src/main/geotools/styling/FontImpl.java", "license": "apache-2.0", "size": 7134 }
[ "org.opengis.filter.expression.Expression" ]
import org.opengis.filter.expression.Expression;
import org.opengis.filter.expression.*;
[ "org.opengis.filter" ]
org.opengis.filter;
472,465
public Set<String> nodes() { return nodes; }
Set<String> function() { return nodes; }
/** * Set of all nodes that can participate in disruptions */
Set of all nodes that can participate in disruptions
nodes
{ "repo_name": "crate/crate", "path": "server/src/testFixtures/java/org/elasticsearch/test/disruption/NetworkDisruption.java", "license": "apache-2.0", "size": 19033 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
779,419
private long createRoleDefinition(TechnicalProduct technicalProduct, String roleID) throws Exception { ArrayList<PricedProductRole> pricedRoles = new ArrayList<PricedProductRole>(); RoleDefinition roleDefinition = new RoleDefinition(); roleDefinition.setTechnicalProduct(technicalProduct); roleDefinition.setRoleId(roleID); roleDefinition.setPricedRoles(pricedRoles); mgr.persist(roleDefinition); mgr.flush(); return roleDefinition.getKey(); }
long function(TechnicalProduct technicalProduct, String roleID) throws Exception { ArrayList<PricedProductRole> pricedRoles = new ArrayList<PricedProductRole>(); RoleDefinition roleDefinition = new RoleDefinition(); roleDefinition.setTechnicalProduct(technicalProduct); roleDefinition.setRoleId(roleID); roleDefinition.setPricedRoles(pricedRoles); mgr.persist(roleDefinition); mgr.flush(); return roleDefinition.getKey(); }
/** * Helper method for discount creating. * * @param value * @return * @throws Exception */
Helper method for discount creating
createRoleDefinition
{ "repo_name": "opetrovski/development", "path": "oscm-dataservice-unittests/javasrc-it/org/oscm/domobjects/RoleDefinitionIT.java", "license": "apache-2.0", "size": 4684 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
891,221
@UiThread @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) void showProgress(final boolean show) { // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow // for very easy animations. If available, use these APIs to fade-in // the progress spinner. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getResources().getInteger( android.R.integer.config_shortAnimTime);
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) void showProgress(final boolean show) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getResources().getInteger( android.R.integer.config_shortAnimTime);
/** * Shows the progress UI and hides the login form. */
Shows the progress UI and hides the login form
showProgress
{ "repo_name": "luiseduardobrito/android-boilerplate", "path": "src/io/github/luiseduardobrito/androidboilerplate/activity/LoginActivity.java", "license": "mit", "size": 4661 }
[ "android.annotation.TargetApi", "android.os.Build" ]
import android.annotation.TargetApi; import android.os.Build;
import android.annotation.*; import android.os.*;
[ "android.annotation", "android.os" ]
android.annotation; android.os;
445,716
private static String md5(String string) throws Exception { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); messageDigest.update(string.getBytes(Charset.forName("UTF-8"))); byte digest[] = messageDigest.digest(); StringBuilder result = new StringBuilder(); for (byte dig : digest) { result.append(String.format("%02x", dig)); } return result.toString(); }
static String function(String string) throws Exception { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); messageDigest.update(string.getBytes(Charset.forName("UTF-8"))); byte digest[] = messageDigest.digest(); StringBuilder result = new StringBuilder(); for (byte dig : digest) { result.append(String.format("%02x", dig)); } return result.toString(); }
/** * Gets MD5 hash of given string. * * @param string String for which want to have MD5 hash. * @return String with MD5 hash of given string. */
Gets MD5 hash of given string
md5
{ "repo_name": "Leanplum/Leanplum-Android-SDK", "path": "AndroidSDKCore/src/main/java/com/leanplum/internal/Util.java", "license": "apache-2.0", "size": 23436 }
[ "java.nio.charset.Charset", "java.security.MessageDigest" ]
import java.nio.charset.Charset; import java.security.MessageDigest;
import java.nio.charset.*; import java.security.*;
[ "java.nio", "java.security" ]
java.nio; java.security;
814,639
// TODO alias to closeDrawer before 3.0 and deprecate this method. public static ViewAction close() { return close(GravityCompat.START); }
static ViewAction function() { return close(GravityCompat.START); }
/** * Creates an action which closes the {@link DrawerLayout} with gravity START. This method blocks * until the drawer is fully closed. No operation if the drawer is already closed. */
Creates an action which closes the <code>DrawerLayout</code> with gravity START. This method blocks until the drawer is fully closed. No operation if the drawer is already closed
close
{ "repo_name": "android/android-test", "path": "espresso/contrib/java/androidx/test/espresso/contrib/DrawerActions.java", "license": "apache-2.0", "size": 7971 }
[ "androidx.core.view.GravityCompat", "androidx.test.espresso.ViewAction" ]
import androidx.core.view.GravityCompat; import androidx.test.espresso.ViewAction;
import androidx.core.view.*; import androidx.test.espresso.*;
[ "androidx.core", "androidx.test" ]
androidx.core; androidx.test;
1,133,209
public boolean isSameNode(Node other) { return this == other; }
boolean function(Node other) { return this == other; }
/** * <b>DOM</b>: Implements {@link org.w3c.dom.Node#isSameNode(Node)}. */
DOM: Implements <code>org.w3c.dom.Node#isSameNode(Node)</code>
isSameNode
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/dom/AbstractNode.java", "license": "apache-2.0", "size": 44954 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
343,514
@Test public void testRenameRdnExistIsReferralCoreAPIWithManageDsaIt() throws Exception { CoreSession session = getService().getAdminSession(); Dn dn = new Dn( "ou=Roles,o=MNN,c=WW,ou=system" ); Rdn newRdn = new Rdn( "ou=People" ); try { session.rename( dn, newRdn, false, true ); fail(); } catch ( LdapEntryAlreadyExistsException leaee ) { assertTrue( true ); } }
void function() throws Exception { CoreSession session = getService().getAdminSession(); Dn dn = new Dn( STR ); Rdn newRdn = new Rdn( STR ); try { session.rename( dn, newRdn, false, true ); fail(); } catch ( LdapEntryAlreadyExistsException leaee ) { assertTrue( true ); } }
/** * Test a rename a referral using an already existing Rdn (the new entry already exists and is a referral), * using the Core API, with the ManageDsaIt flag */
Test a rename a referral using an already existing Rdn (the new entry already exists and is a referral), using the Core API, with the ManageDsaIt flag
testRenameRdnExistIsReferralCoreAPIWithManageDsaIt
{ "repo_name": "apache/directory-server", "path": "core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/RenameReferralIgnoreIT.java", "license": "apache-2.0", "size": 10115 }
[ "org.apache.directory.api.ldap.model.exception.LdapEntryAlreadyExistsException", "org.apache.directory.api.ldap.model.name.Dn", "org.apache.directory.api.ldap.model.name.Rdn", "org.apache.directory.server.core.api.CoreSession", "org.junit.jupiter.api.Assertions" ]
import org.apache.directory.api.ldap.model.exception.LdapEntryAlreadyExistsException; import org.apache.directory.api.ldap.model.name.Dn; import org.apache.directory.api.ldap.model.name.Rdn; import org.apache.directory.server.core.api.CoreSession; import org.junit.jupiter.api.Assertions;
import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.api.ldap.model.name.*; import org.apache.directory.server.core.api.*; import org.junit.jupiter.api.*;
[ "org.apache.directory", "org.junit.jupiter" ]
org.apache.directory; org.junit.jupiter;
1,581,987
SlidingMenu getSlidingMenu();
SlidingMenu getSlidingMenu();
/** * Gets the SlidingMenu associated with this activity. * * @return the SlidingMenu associated with this activity. */
Gets the SlidingMenu associated with this activity
getSlidingMenu
{ "repo_name": "efrozaq/DailyQuotes", "path": "app/src/main/java/com/dreamcodes/dcquotes/lib/slidingmenu/app/SlidingActivityBase.java", "license": "apache-2.0", "size": 2380 }
[ "com.dreamcodes.dcquotes.lib.slidingmenu.SlidingMenu" ]
import com.dreamcodes.dcquotes.lib.slidingmenu.SlidingMenu;
import com.dreamcodes.dcquotes.lib.slidingmenu.*;
[ "com.dreamcodes.dcquotes" ]
com.dreamcodes.dcquotes;
2,530,173
public void saveTrack(Track track) { if (track != null) { db = new DataBaseHandler(context.getApplicationContext()); track.finishTrack(); db.updateGPSTrack(track); Log.d(TAG, "Finish and update track in database with id: " + track.getID()); db.close(); } }
void function(Track track) { if (track != null) { db = new DataBaseHandler(context.getApplicationContext()); track.finishTrack(); db.updateGPSTrack(track); Log.d(TAG, STR + track.getID()); db.close(); } }
/** * Saves and closes a track in the database By closing a track it is not * possible to add new trackpoints. * * @param track * The track */
Saves and closes a track in the database By closing a track it is not possible to add new trackpoints
saveTrack
{ "repo_name": "Data4All/Data4All", "path": "src/main/java/io/github/data4all/util/TrackUtil.java", "license": "apache-2.0", "size": 6145 }
[ "io.github.data4all.handler.DataBaseHandler", "io.github.data4all.logger.Log", "io.github.data4all.model.data.Track" ]
import io.github.data4all.handler.DataBaseHandler; import io.github.data4all.logger.Log; import io.github.data4all.model.data.Track;
import io.github.data4all.handler.*; import io.github.data4all.logger.*; import io.github.data4all.model.data.*;
[ "io.github.data4all" ]
io.github.data4all;
854,953
public void setRegisterValueValue(YangString registerValueValue) throws JNCException { setLeafValue(Epc.NAMESPACE, "register-value", registerValueValue, childrenNames()); }
void function(YangString registerValueValue) throws JNCException { setLeafValue(Epc.NAMESPACE, STR, registerValueValue, childrenNames()); }
/** * Sets the value for child leaf "register-value", * using instance of generated typedef class. * @param registerValueValue The value to set. * @param registerValueValue used during instantiation. */
Sets the value for child leaf "register-value", using instance of generated typedef class
setRegisterValueValue
{ "repo_name": "jnpr-shinma/yangfile", "path": "hitel/src/hctaEpc/mmeSgsn/statistics/gprsMm/General.java", "license": "apache-2.0", "size": 11341 }
[ "com.tailf.jnc.YangString" ]
import com.tailf.jnc.YangString;
import com.tailf.jnc.*;
[ "com.tailf.jnc" ]
com.tailf.jnc;
583,336
void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool);
void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool);
/** * Sets a pluggable service pool to use for {@link PollingConsumer} pooling. * * @param servicePool the pool */
Sets a pluggable service pool to use for <code>PollingConsumer</code> pooling
setPollingConsumerServicePool
{ "repo_name": "borcsokj/camel", "path": "camel-core/src/main/java/org/apache/camel/CamelContext.java", "license": "apache-2.0", "size": 68766 }
[ "org.apache.camel.spi.ServicePool" ]
import org.apache.camel.spi.ServicePool;
import org.apache.camel.spi.*;
[ "org.apache.camel" ]
org.apache.camel;
2,456,482
public static void centerOnScreen(Window win) { win.setLocationRelativeTo(null); }
static void function(Window win) { win.setLocationRelativeTo(null); }
/** * Move the specified window to the center of the screen. It is the * programmer's responsibility to ensure that the window fits on the screen. * * @param win * The window to be moved */
Move the specified window to the center of the screen. It is the programmer's responsibility to ensure that the window fits on the screen
centerOnScreen
{ "repo_name": "truhanen/JSana", "path": "JSana/src_others/org/crosswire/common/swing/GuiUtil.java", "license": "gpl-2.0", "size": 20415 }
[ "java.awt.Window" ]
import java.awt.Window;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,131,789
@Override public SerialMessage getValueMessage() { // TODO: Why does this return!!!???!!! for (Map.Entry<AlarmType, Alarm> entry : this.alarms.entrySet()) { return getMessage(entry.getValue().getAlarmType()); } // in case there are no supported alarms, get them. return this.getSupportedMessage(); }
SerialMessage function() { for (Map.Entry<AlarmType, Alarm> entry : this.alarms.entrySet()) { return getMessage(entry.getValue().getAlarmType()); } return this.getSupportedMessage(); }
/** * Gets a SerialMessage with the SENSOR_ALARM_GET command * * @return the serial message */
Gets a SerialMessage with the SENSOR_ALARM_GET command
getValueMessage
{ "repo_name": "talltechdude/openhab2-addons", "path": "addons/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveAlarmSensorCommandClass.java", "license": "epl-1.0", "size": 16737 }
[ "java.util.Map", "org.openhab.binding.zwave.internal.protocol.SerialMessage" ]
import java.util.Map; import org.openhab.binding.zwave.internal.protocol.SerialMessage;
import java.util.*; import org.openhab.binding.zwave.internal.protocol.*;
[ "java.util", "org.openhab.binding" ]
java.util; org.openhab.binding;
508,872
public GfxColor getClassRelationBackgroundColor() { return classRelationBackgroundColor; }
GfxColor function() { return classRelationBackgroundColor; }
/** * Getter for the classClassRelationBackgroundColor * * @return the classClassRelationBackgroundColor */
Getter for the classClassRelationBackgroundColor
getClassRelationBackgroundColor
{ "repo_name": "RaphaelBrugier/gwtuml", "path": "GWTUMLAPI/src/com/objetdirect/gwt/umlapi/client/helpers/ThemeManager.java", "license": "gpl-3.0", "size": 23588 }
[ "com.objetdirect.gwt.umlapi.client.gfx.GfxColor" ]
import com.objetdirect.gwt.umlapi.client.gfx.GfxColor;
import com.objetdirect.gwt.umlapi.client.gfx.*;
[ "com.objetdirect.gwt" ]
com.objetdirect.gwt;
1,477,198
public String[] getNames(){ String[] retval = new String[registry.size()]; int i = 0; for(Enumeration e = registry.keys(); e.hasMoreElements(); i++){ retval[i] = (String) e.nextElement(); } return retval; }
String[] function(){ String[] retval = new String[registry.size()]; int i = 0; for(Enumeration e = registry.keys(); e.hasMoreElements(); i++){ retval[i] = (String) e.nextElement(); } return retval; }
/** * Gets a list of all the Global Extractors available by name * */
Gets a list of all the Global Extractors available by name
getNames
{ "repo_name": "fracpete/tclass-weka-package", "path": "src/main/java/tclass/GlobalExtrMgr.java", "license": "gpl-3.0", "size": 5439 }
[ "java.util.Enumeration" ]
import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
1,642,899
public static boolean visitNeededAttributeParts(final Attribute node, VisitorBase base) throws Exception { exprType value = node.value; boolean valueVisited = false; boolean doReturn = false; if (value instanceof Subscript) { Subscript subs = (Subscript) value; base.traverse(subs.slice); if (subs.value instanceof Name) { base.visitName((Name) subs.value); } else { base.traverse(subs.value); } //No need to keep visiting. Reason: //Let's take the example: //print function()[0].strip() //function()[0] is part 1 of attribute // //and the .strip will constitute the second part of the attribute //and its value (from the subscript) constitutes the 'function' part, //so, when we visit it directly, we don't have to visit the first part anymore, //because it was just visited... kind of strange to think about it though. doReturn = true; } else if (value instanceof Call) { visitCallAttr((Call) value, base); valueVisited = true; } else if (value instanceof Tuple) { base.visitTuple((Tuple) value); valueVisited = true; } else if (value instanceof Dict) { base.visitDict((Dict) value); doReturn = true; } if (!doReturn && !valueVisited) { if (visitNeededValues(value, base)) { doReturn = true; } } return doReturn; }
static boolean function(final Attribute node, VisitorBase base) throws Exception { exprType value = node.value; boolean valueVisited = false; boolean doReturn = false; if (value instanceof Subscript) { Subscript subs = (Subscript) value; base.traverse(subs.slice); if (subs.value instanceof Name) { base.visitName((Name) subs.value); } else { base.traverse(subs.value); } doReturn = true; } else if (value instanceof Call) { visitCallAttr((Call) value, base); valueVisited = true; } else if (value instanceof Tuple) { base.visitTuple((Tuple) value); valueVisited = true; } else if (value instanceof Dict) { base.visitDict((Dict) value); doReturn = true; } if (!doReturn && !valueVisited) { if (visitNeededValues(value, base)) { doReturn = true; } } return doReturn; }
/** * In this function, the visitor will traverse the value of the attribute as needed, * if it is a subscript, call, etc, as those things are not actually a part of the attribute, * but are rather 'in' the attribute. * * @param node the attribute to visit * @param base the visitor that should visit the elements inside the attribute * @return true if there's no need to keep visiting other stuff in the attribute * @throws Exception */
In this function, the visitor will traverse the value of the attribute as needed, if it is a subscript, call, etc, as those things are not actually a part of the attribute, but are rather 'in' the attribute
visitNeededAttributeParts
{ "repo_name": "fabioz/Pydev", "path": "plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/scopeanalysis/AbstractScopeAnalyzerVisitor.java", "license": "epl-1.0", "size": 55266 }
[ "org.python.pydev.parser.jython.ast.Attribute", "org.python.pydev.parser.jython.ast.Call", "org.python.pydev.parser.jython.ast.Dict", "org.python.pydev.parser.jython.ast.Name", "org.python.pydev.parser.jython.ast.Subscript", "org.python.pydev.parser.jython.ast.Tuple", "org.python.pydev.parser.jython.ast.VisitorBase" ]
import org.python.pydev.parser.jython.ast.Attribute; import org.python.pydev.parser.jython.ast.Call; import org.python.pydev.parser.jython.ast.Dict; import org.python.pydev.parser.jython.ast.Name; import org.python.pydev.parser.jython.ast.Subscript; import org.python.pydev.parser.jython.ast.Tuple; import org.python.pydev.parser.jython.ast.VisitorBase;
import org.python.pydev.parser.jython.ast.*;
[ "org.python.pydev" ]
org.python.pydev;
3,225
@RequiresPermission(MANAGE_FINGERPRINT) public void remove(Fingerprint fp, int userId, RemovalCallback callback) { if (mService != null) try { mRemovalCallback = callback; mRemovalFingerprint = fp; mService.remove(mToken, fp.getFingerId(), fp.getGroupId(), userId, mServiceReceiver); } catch (RemoteException e) { Log.w(TAG, "Remote exception in remove: ", e); if (callback != null) { callback.onRemovalError(fp, FINGERPRINT_ERROR_HW_UNAVAILABLE, getErrorString(FINGERPRINT_ERROR_HW_UNAVAILABLE)); } } }
@RequiresPermission(MANAGE_FINGERPRINT) void function(Fingerprint fp, int userId, RemovalCallback callback) { if (mService != null) try { mRemovalCallback = callback; mRemovalFingerprint = fp; mService.remove(mToken, fp.getFingerId(), fp.getGroupId(), userId, mServiceReceiver); } catch (RemoteException e) { Log.w(TAG, STR, e); if (callback != null) { callback.onRemovalError(fp, FINGERPRINT_ERROR_HW_UNAVAILABLE, getErrorString(FINGERPRINT_ERROR_HW_UNAVAILABLE)); } } }
/** * Remove given fingerprint template from fingerprint hardware and/or protected storage. * @param fp the fingerprint item to remove * @param userId the user who this fingerprint belongs to * @param callback an optional callback to verify that fingerprint templates have been * successfully removed. May be null of no callback is required. * * @hide */
Remove given fingerprint template from fingerprint hardware and/or protected storage
remove
{ "repo_name": "xorware/android_frameworks_base", "path": "core/java/android/hardware/fingerprint/FingerprintManager.java", "license": "apache-2.0", "size": 39147 }
[ "android.annotation.RequiresPermission", "android.os.RemoteException", "android.util.Log" ]
import android.annotation.RequiresPermission; import android.os.RemoteException; import android.util.Log;
import android.annotation.*; import android.os.*; import android.util.*;
[ "android.annotation", "android.os", "android.util" ]
android.annotation; android.os; android.util;
2,170,570
public Scroll scroll() { return scroll; }
Scroll function() { return scroll; }
/** * If set, will enable scrolling of the search request. */
If set, will enable scrolling of the search request
scroll
{ "repo_name": "gingerwizard/elasticsearch", "path": "server/src/main/java/org/elasticsearch/action/search/SearchRequest.java", "license": "apache-2.0", "size": 27745 }
[ "org.elasticsearch.search.Scroll" ]
import org.elasticsearch.search.Scroll;
import org.elasticsearch.search.*;
[ "org.elasticsearch.search" ]
org.elasticsearch.search;
2,150,398
public Chart getOrganizationChartOfAccounts() { return organizationChartOfAccounts; }
Chart function() { return organizationChartOfAccounts; }
/** * Gets the organizationChartOfAccounts attribute. * * @return Returns the organizationChartOfAccounts */
Gets the organizationChartOfAccounts attribute
getOrganizationChartOfAccounts
{ "repo_name": "bhutchinson/kfs", "path": "kfs-bc/src/main/java/org/kuali/kfs/module/bc/businessobject/BudgetConstructionSalaryTotal.java", "license": "agpl-3.0", "size": 7347 }
[ "org.kuali.kfs.coa.businessobject.Chart" ]
import org.kuali.kfs.coa.businessobject.Chart;
import org.kuali.kfs.coa.businessobject.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
1,190,542
protected void getProperBaseMatrix2(final Drawable bitmap, final Matrix matrix) { final float viewWidth = getWidth(); final float viewHeight = getHeight(); final float w = bitmap.getIntrinsicWidth(); final float h = bitmap.getIntrinsicHeight(); matrix.reset(); final float widthScale = Math.min(viewWidth / w, MAX_ZOOM); final float heightScale = Math.min(viewHeight / h, MAX_ZOOM); final float scale = Math.min(widthScale, heightScale); matrix.postScale(scale, scale); matrix.postTranslate((viewWidth - w * scale) / MAX_ZOOM, (viewHeight - h * scale) / MAX_ZOOM); }
void function(final Drawable bitmap, final Matrix matrix) { final float viewWidth = getWidth(); final float viewHeight = getHeight(); final float w = bitmap.getIntrinsicWidth(); final float h = bitmap.getIntrinsicHeight(); matrix.reset(); final float widthScale = Math.min(viewWidth / w, MAX_ZOOM); final float heightScale = Math.min(viewHeight / h, MAX_ZOOM); final float scale = Math.min(widthScale, heightScale); matrix.postScale(scale, scale); matrix.postTranslate((viewWidth - w * scale) / MAX_ZOOM, (viewHeight - h * scale) / MAX_ZOOM); }
/** * Setup the base matrix so that the image is centered and scaled properly. * * @param bitmap * @param matrix */
Setup the base matrix so that the image is centered and scaled properly
getProperBaseMatrix2
{ "repo_name": "gen4young/twidere", "path": "src/it/sephiroth/android/library/imagezoom/ImageViewTouchBase.java", "license": "gpl-3.0", "size": 14397 }
[ "android.graphics.Matrix", "android.graphics.drawable.Drawable" ]
import android.graphics.Matrix; import android.graphics.drawable.Drawable;
import android.graphics.*; import android.graphics.drawable.*;
[ "android.graphics" ]
android.graphics;
2,604,725
ILanguage getLanguage(); // -- Pages --
ILanguage getLanguage();
/** Returns the language of the Wiktionary edition, which is equivalent * to the entry language of the contained entries. */
Returns the language of the Wiktionary edition, which is equivalent
getLanguage
{ "repo_name": "dkpro/dkpro-jwktl", "path": "src/main/java/de/tudarmstadt/ukp/jwktl/api/IWiktionaryEdition.java", "license": "apache-2.0", "size": 5229 }
[ "de.tudarmstadt.ukp.jwktl.api.util.ILanguage" ]
import de.tudarmstadt.ukp.jwktl.api.util.ILanguage;
import de.tudarmstadt.ukp.jwktl.api.util.*;
[ "de.tudarmstadt.ukp" ]
de.tudarmstadt.ukp;
26,706
public WSCurationTagHistory[] getCurationTagHistory(String id) throws RemoteException { return getCurationTagHistory(id, null); }
WSCurationTagHistory[] function(String id) throws RemoteException { return getCurationTagHistory(id, null); }
/** * Get the curation tag history for the given pathway * @param id The pathway identifier * @return An array with the history items * @throws RemoteException */
Get the curation tag history for the given pathway
getCurationTagHistory
{ "repo_name": "wikipathways/org.wikipathways.client", "path": "wp-client/src/org/wikipathways/client/WikiPathwaysClient.java", "license": "apache-2.0", "size": 13662 }
[ "java.rmi.RemoteException", "org.pathvisio.wikipathways.webservice.WSCurationTagHistory" ]
import java.rmi.RemoteException; import org.pathvisio.wikipathways.webservice.WSCurationTagHistory;
import java.rmi.*; import org.pathvisio.wikipathways.webservice.*;
[ "java.rmi", "org.pathvisio.wikipathways" ]
java.rmi; org.pathvisio.wikipathways;
1,293,468
private Map<KeyCacheObject, List<CacheDataRow>> allVersions(IgniteCache cache) throws IgniteCheckedException { IgniteCacheProxy cache0 = (IgniteCacheProxy)cache; GridCacheContext cctx = cache0.context(); assert cctx.mvccEnabled(); Map<KeyCacheObject, List<CacheDataRow>> vers = new HashMap<>(); for (Object e : cache) { IgniteBiTuple entry = (IgniteBiTuple)e; KeyCacheObject key = cctx.toCacheKeyObject(entry.getKey()); GridCursor<CacheDataRow> cur = cctx.offheap().mvccAllVersionsCursor(cctx, key, null); List<CacheDataRow> rows = new ArrayList<>(); while (cur.next()) { CacheDataRow row = cur.get(); rows.add(row); } vers.put(key, rows); } return vers; }
Map<KeyCacheObject, List<CacheDataRow>> function(IgniteCache cache) throws IgniteCheckedException { IgniteCacheProxy cache0 = (IgniteCacheProxy)cache; GridCacheContext cctx = cache0.context(); assert cctx.mvccEnabled(); Map<KeyCacheObject, List<CacheDataRow>> vers = new HashMap<>(); for (Object e : cache) { IgniteBiTuple entry = (IgniteBiTuple)e; KeyCacheObject key = cctx.toCacheKeyObject(entry.getKey()); GridCursor<CacheDataRow> cur = cctx.offheap().mvccAllVersionsCursor(cctx, key, null); List<CacheDataRow> rows = new ArrayList<>(); while (cur.next()) { CacheDataRow row = cur.get(); rows.add(row); } vers.put(key, rows); } return vers; }
/** * Retrieves all versions of all keys from cache. * * @param cache Cache. * @return {@link Map} of keys to its versions. * @throws IgniteCheckedException If failed. */
Retrieves all versions of all keys from cache
allVersions
{ "repo_name": "amirakhmedov/ignite", "path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBackupsAbstractTest.java", "license": "apache-2.0", "size": 25853 }
[ "java.util.ArrayList", "java.util.HashMap", "java.util.List", "java.util.Map", "org.apache.ignite.IgniteCache", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.processors.cache.GridCacheContext", "org.apache.ignite.internal.processors.cache.IgniteCacheProxy", "org.apache.ignite.internal.processors.cache.KeyCacheObject", "org.apache.ignite.internal.processors.cache.persistence.CacheDataRow", "org.apache.ignite.internal.util.lang.GridCursor", "org.apache.ignite.lang.IgniteBiTuple" ]
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.util.lang.GridCursor; import org.apache.ignite.lang.IgniteBiTuple;
import java.util.*; import org.apache.ignite.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.persistence.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.lang.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
2,500,072
public void setHideDetail( boolean hideDetail ) throws SemanticException { setProperty( IGroupElementModel.HIDE_DETAIL_PROP, Boolean .valueOf( hideDetail ) ); }
void function( boolean hideDetail ) throws SemanticException { setProperty( IGroupElementModel.HIDE_DETAIL_PROP, Boolean .valueOf( hideDetail ) ); }
/** * Sets hide detail * * @param hideDetail * hide detail * @throws SemanticException * if the property is locked. */
Sets hide detail
setHideDetail
{ "repo_name": "rrimmana/birt-1", "path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Group.java", "license": "epl-1.0", "size": 5569 }
[ "org.eclipse.birt.report.model.api.activity.SemanticException", "org.eclipse.birt.report.model.elements.interfaces.IGroupElementModel" ]
import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.elements.interfaces.IGroupElementModel;
import org.eclipse.birt.report.model.api.activity.*; import org.eclipse.birt.report.model.elements.interfaces.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
2,758,671
private static double getResponseTimeDeviation(List<Long> responseTimes) { // Cannot calculate a deviation with less than // two response time values if (responseTimes.size() < 2) { return -1; } double avg = getResponseTimeAverage(responseTimes); double result = 0; for (long value : responseTimes) { result += Math.pow(value - avg, 2); } result = Math.sqrt(result / (responseTimes.size() - 1)); // Check if there is too much deviation if (result > WARN_TIME_STDEV) { log.warn( "There is considerable lagging in connection response(s) which gives a standard deviation of {}ms on the sample set which is more than {}ms", result, WARN_TIME_STDEV); } return result; }
static double function(List<Long> responseTimes) { if (responseTimes.size() < 2) { return -1; } double avg = getResponseTimeAverage(responseTimes); double result = 0; for (long value : responseTimes) { result += Math.pow(value - avg, 2); } result = Math.sqrt(result / (responseTimes.size() - 1)); if (result > WARN_TIME_STDEV) { log.warn( STR, result, WARN_TIME_STDEV); } return result; }
/** * Computes standard deviation of the responseTimes Reference: * http://www.goldb.org/corestats.html * * @return the current responseTimes deviation */
Computes standard deviation of the responseTimes Reference: HREF
getResponseTimeDeviation
{ "repo_name": "denniskniep/zap-extensions", "path": "addOns/ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/CommandInjectionScanRule.java", "license": "apache-2.0", "size": 30791 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
439,778
@Override public void enterFunctionCallExpression(@NotNull BramsprParser.FunctionCallExpressionContext ctx) { }
@Override public void enterFunctionCallExpression(@NotNull BramsprParser.FunctionCallExpressionContext ctx) { }
/** * {@inheritDoc} * <p/> * The default implementation does nothing. */
The default implementation does nothing
exitUniversalNotEqualsToExpression
{ "repo_name": "bcleenders/Bramspr", "path": "src/bramspr/BramsprBaseListener.java", "license": "mit", "size": 21948 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,277,648
public void setOutlierIgnoreRatio (double ratio) { if (ratio < 0.0) { LOGGER.warn("Illegal outlier ignore ratio {}: Must be >= 0.0", ratio); return; } if (ratio >= 1.0) { LOGGER.warn("Illegal outlier ignore ratio {}: Must be < 1.0", ratio); return; } if (Math.abs(_outlierIgnoreRatio-ratio) < EPSILON) // No change return; _outlierIgnoreRatio = ratio; // Recalculate our practical mean int toKeep = (int) Math.ceil(_tracks.size()*(1.0-_outlierIgnoreRatio)); _practicalMean = null; for (int i=0; i<toKeep; ++i) { Track track = _tracks.get(i); if (0 == i) { _practicalMean = track; } else { _practicalMean = _practicalMean.weightedAverage(track, i, 1); } } // Precalculate distances from practical mean and total standard deviation _distanceFromPracticalMean = new HashMap<Track, Double>(); double variance = 0.0; for (Track track: _tracks) { double distance = track.getDistance(_practicalMean); _distanceFromPracticalMean.put(track, distance); variance += distance*distance; } variance /= _tracks.size(); _standardDeviation = Math.sqrt(variance); }
void function (double ratio) { if (ratio < 0.0) { LOGGER.warn(STR, ratio); return; } if (ratio >= 1.0) { LOGGER.warn(STR, ratio); return; } if (Math.abs(_outlierIgnoreRatio-ratio) < EPSILON) return; _outlierIgnoreRatio = ratio; int toKeep = (int) Math.ceil(_tracks.size()*(1.0-_outlierIgnoreRatio)); _practicalMean = null; for (int i=0; i<toKeep; ++i) { Track track = _tracks.get(i); if (0 == i) { _practicalMean = track; } else { _practicalMean = _practicalMean.weightedAverage(track, i, 1); } } _distanceFromPracticalMean = new HashMap<Track, Double>(); double variance = 0.0; for (Track track: _tracks) { double distance = track.getDistance(_practicalMean); _distanceFromPracticalMean.put(track, distance); variance += distance*distance; } variance /= _tracks.size(); _standardDeviation = Math.sqrt(variance); }
/** * Causes the given proportion of tracks farthest from the true mean to be * ignored when calculating the practical mean. * * @param ratio * A number in the range [0.0, 1.0). Floor(proportion times * number of tracks) will be ignored, so that at least one track * is always used, so the practical mean is never null. */
Causes the given proportion of tracks farthest from the true mean to be ignored when calculating the practical mean
setOutlierIgnoreRatio
{ "repo_name": "unchartedsoftware/ensemble-clustering", "path": "ensemble-clustering/src/main/java/com/oculusinfo/ml/stats/TrackClusterWrapper.java", "license": "mit", "size": 9733 }
[ "com.oculusinfo.geometry.geodesic.Track", "java.util.HashMap" ]
import com.oculusinfo.geometry.geodesic.Track; import java.util.HashMap;
import com.oculusinfo.geometry.geodesic.*; import java.util.*;
[ "com.oculusinfo.geometry", "java.util" ]
com.oculusinfo.geometry; java.util;
688,029
public final TransactionService getTransactionService() { return m_transactionService; }
final TransactionService function() { return m_transactionService; }
/** * Return the transaction service * * @return TransactionService */
Return the transaction service
getTransactionService
{ "repo_name": "Alfresco/alfresco-repository", "path": "src/main/java/org/alfresco/filesys/AlfrescoConfigSection.java", "license": "lgpl-3.0", "size": 5255 }
[ "org.alfresco.service.transaction.TransactionService" ]
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.service.transaction.*;
[ "org.alfresco.service" ]
org.alfresco.service;
593,790
private void createInitialTab() { Log.i(TAG, "#createInitialTab executed."); mPendingInitialTabCreation = false; // If the start surface or grid tab switcher will be shown on start, do not create a new // tab. if (!shouldShowOverviewPageOnStart()) { String url = HomepageManager.getHomepageUri(); if (TextUtils.isEmpty(url)) { url = UrlConstants.NTP_URL; } else { // Migrate legacy NTP URLs (chrome://newtab) to the newer format // (chrome-native://newtab) if (UrlUtilities.isNTPUrl(url)) { url = UrlConstants.NTP_URL; } } getTabCreator(false).launchUrl(url, TabLaunchType.FROM_STARTUP); } // If we didn't call setInitialOverviewState() in onStartWithNative() because // mPendingInitialTabCreation was true then do so now. if (hasStartWithNativeBeenCalled()) { setInitialOverviewState(); } mAppLaunchDrawBlocker.onActiveTabAvailable(isTabRegularNtp(getActivityTab())); }
void function() { Log.i(TAG, STR); mPendingInitialTabCreation = false; if (!shouldShowOverviewPageOnStart()) { String url = HomepageManager.getHomepageUri(); if (TextUtils.isEmpty(url)) { url = UrlConstants.NTP_URL; } else { if (UrlUtilities.isNTPUrl(url)) { url = UrlConstants.NTP_URL; } } getTabCreator(false).launchUrl(url, TabLaunchType.FROM_STARTUP); } if (hasStartWithNativeBeenCalled()) { setInitialOverviewState(); } mAppLaunchDrawBlocker.onActiveTabAvailable(isTabRegularNtp(getActivityTab())); }
/** * Create an initial tab for cold start without restored tabs. */
Create an initial tab for cold start without restored tabs
createInitialTab
{ "repo_name": "chromium/chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java", "license": "bsd-3-clause", "size": 135297 }
[ "android.text.TextUtils", "org.chromium.base.Log", "org.chromium.chrome.browser.homepage.HomepageManager", "org.chromium.chrome.browser.tab.TabLaunchType", "org.chromium.components.embedder_support.util.UrlConstants", "org.chromium.components.embedder_support.util.UrlUtilities" ]
import android.text.TextUtils; import org.chromium.base.Log; import org.chromium.chrome.browser.homepage.HomepageManager; import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.components.embedder_support.util.UrlUtilities;
import android.text.*; import org.chromium.base.*; import org.chromium.chrome.browser.homepage.*; import org.chromium.chrome.browser.tab.*; import org.chromium.components.embedder_support.util.*;
[ "android.text", "org.chromium.base", "org.chromium.chrome", "org.chromium.components" ]
android.text; org.chromium.base; org.chromium.chrome; org.chromium.components;
272,056
public static List<Path> getFamilyDirs(final FileSystem fs, final Path regionDir) throws IOException { // assumes we are in a region dir. FileStatus[] fds = fs.listStatus(regionDir, new FamilyDirFilter(fs)); List<Path> familyDirs = new ArrayList<Path>(fds.length); for (FileStatus fdfs: fds) { Path fdPath = fdfs.getPath(); familyDirs.add(fdPath); } return familyDirs; } public static class HFileFilter implements PathFilter { // This pattern will accept 0.90+ style hex hfies files but reject reference files final public static Pattern hfilePattern = Pattern.compile("^([0-9a-f]+)$"); final FileSystem fs; public HFileFilter(FileSystem fs) { this.fs = fs; }
static List<Path> function(final FileSystem fs, final Path regionDir) throws IOException { FileStatus[] fds = fs.listStatus(regionDir, new FamilyDirFilter(fs)); List<Path> familyDirs = new ArrayList<Path>(fds.length); for (FileStatus fdfs: fds) { Path fdPath = fdfs.getPath(); familyDirs.add(fdPath); } return familyDirs; } public static class HFileFilter implements PathFilter { final public static Pattern hfilePattern = Pattern.compile(STR); final FileSystem fs; public HFileFilter(FileSystem fs) { this.fs = fs; }
/** * Given a particular region dir, return all the familydirs inside it * * @param fs A file system for the Path * @param regionDir Path to a specific region directory * @return List of paths to valid family directories in region dir. * @throws IOException */
Given a particular region dir, return all the familydirs inside it
getFamilyDirs
{ "repo_name": "intel-hadoop/hbase-rhino", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java", "license": "apache-2.0", "size": 69381 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "java.util.regex.Pattern", "org.apache.hadoop.fs.FileStatus", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.fs.PathFilter" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.PathFilter;
import java.io.*; import java.util.*; import java.util.regex.*; import org.apache.hadoop.fs.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,491,005
public void createDefaultAuthenticationSeq(DefaultAuthenticationSequence authenticationSequence) throws DefaultAuthSeqMgtException { try { authenticationSeqMgtService = DefaultAuthSeqMgtServiceImpl.getInstance(); authenticationSeqMgtService.createDefaultAuthenticationSeq(authenticationSequence, getTenantDomain()); } catch (DefaultAuthSeqMgtServerException e) { log.error("Error while creating default authentication sequence of tenant: " + getTenantDomain(), e); throw new DefaultAuthSeqMgtException("Server error occurred."); } }
void function(DefaultAuthenticationSequence authenticationSequence) throws DefaultAuthSeqMgtException { try { authenticationSeqMgtService = DefaultAuthSeqMgtServiceImpl.getInstance(); authenticationSeqMgtService.createDefaultAuthenticationSeq(authenticationSequence, getTenantDomain()); } catch (DefaultAuthSeqMgtServerException e) { log.error(STR + getTenantDomain(), e); throw new DefaultAuthSeqMgtException(STR); } }
/** * Create default authentication sequence. * * @param authenticationSequence default authentication sequence * @throws DefaultAuthSeqMgtException */
Create default authentication sequence
createDefaultAuthenticationSeq
{ "repo_name": "omindu/carbon-identity-framework", "path": "components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/defaultsequence/DefaultAuthSeqMgtAdminService.java", "license": "apache-2.0", "size": 7176 }
[ "org.wso2.carbon.identity.application.common.model.DefaultAuthenticationSequence" ]
import org.wso2.carbon.identity.application.common.model.DefaultAuthenticationSequence;
import org.wso2.carbon.identity.application.common.model.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,474,320
public String verifyEnvInjection(int testpoint) { String envName = null; // Assert that none of the injection methods were called assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "No Injection Methods called : 0 : " + ivInjectCount, 0, ivInjectCount); ++testpoint; // Assert that all of the primitive object method types are null because // no value is specified in their Environment Entries. assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "String field is null : " + ivString, I_STRING, ivString); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Character field is null : " + ivCharacter, I_CHAR, ivCharacter); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Byte field is null : " + ivByte, I_BYTE, ivByte); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Short field is null : " + ivShort, I_SHORT, ivShort); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Integer field is null : " + ivInteger, I_INTEGER, ivInteger); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Long field is null : " + ivLong, I_LONG, ivLong); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Boolean field is null : " + ivBoolean, I_BOOL, ivBoolean); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Double field is null : " + ivDouble, I_DOUBLE, ivDouble); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Float field is null : " + ivFloat, I_FLOAT, ivFloat); ++testpoint; // Next, insure the above may not be looked up in the global namespace try { Context initCtx = new InitialContext(); Context myEnv = (Context) initCtx.lookup("java:comp/env"); try { envName = CLASS_NAME + "/ivString"; Object gString = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivCharacter"; Object gChar = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivByte"; Object gByte = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivShort"; Object gShort = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivInteger"; Object gInteger = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivLong"; Object gLong = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivBoolean"; Object gBoolean = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivDouble"; Object gDouble = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivFloat"; Object gFloat = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + " should not have been found"); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by JNDI lookup", e); ++testpoint; } } catch (Throwable ex) { ex.printStackTrace(System.out); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "Global Environment Property lookup failed : " + envName + " : " + ex); ++testpoint; } // Next, insure the above may not be looked up from the SessionContext try { try { envName = CLASS_NAME + "/ivString"; Object cString = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivCharacter"; Object cChar = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivByte"; Object cByte = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivShort"; Object cShort = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivInteger"; Object cInteger = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivLong"; Object cLong = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivBoolean"; Object cBoolean = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivDouble"; Object cDouble = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } try { envName = CLASS_NAME + "/ivFloat"; Object cFloat = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + envName + "should not have been found"); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "16.4.1.3 : " + envName + " correctly not found by EJBContext.lookup", e); ++testpoint; } } catch (Throwable ex) { ex.printStackTrace(System.out); fail(testpoint + (testpoint > 9 ? " --> " : " ---> ") + "SessionContext Environment lookup failed : " + envName + " : " + ex); ++testpoint; } // Finally, reset all of the fields to insure injection does not occur // when object is re-used from the pool. ivString = M_STRING; ivCharacter = M_CHAR; ivByte = M_BYTE; ivShort = M_SHORT; ivInteger = M_INTEGER; ivLong = M_LONG; ivBoolean = M_BOOL; ivDouble = M_DOUBLE; ivFloat = M_FLOAT; ivInjectCount = 0; return PASSED; }
String function(int testpoint) { String envName = null; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivInjectCount, 0, ivInjectCount); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivString, I_STRING, ivString); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivCharacter, I_CHAR, ivCharacter); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivByte, I_BYTE, ivByte); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivShort, I_SHORT, ivShort); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivInteger, I_INTEGER, ivInteger); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivLong, I_LONG, ivLong); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivBoolean, I_BOOL, ivBoolean); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivDouble, I_DOUBLE, ivDouble); ++testpoint; assertEquals(testpoint + (testpoint > 9 ? STR : STR) + STR + ivFloat, I_FLOAT, ivFloat); ++testpoint; try { Context initCtx = new InitialContext(); Context myEnv = (Context) initCtx.lookup(STR); try { envName = CLASS_NAME + STR; Object gString = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object gChar = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object gByte = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object gShort = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object gInteger = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object gLong = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object gBoolean = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object gDouble = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object gFloat = myEnv.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (NameNotFoundException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } } catch (Throwable ex) { ex.printStackTrace(System.out); fail(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR + ex); ++testpoint; } try { try { envName = CLASS_NAME + STR; Object cString = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object cChar = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object cByte = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object cShort = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object cInteger = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object cLong = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object cBoolean = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object cDouble = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } try { envName = CLASS_NAME + STR; Object cFloat = ivContext.lookup(envName); fail(testpoint + (testpoint > 9 ? STR : STR) + envName + STR); ++testpoint; } catch (IllegalArgumentException e) { assertNotNull(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR, e); ++testpoint; } } catch (Throwable ex) { ex.printStackTrace(System.out); fail(testpoint + (testpoint > 9 ? STR : STR) + STR + envName + STR + ex); ++testpoint; } ivString = M_STRING; ivCharacter = M_CHAR; ivByte = M_BYTE; ivShort = M_SHORT; ivInteger = M_INTEGER; ivLong = M_LONG; ivBoolean = M_BOOL; ivDouble = M_DOUBLE; ivFloat = M_FLOAT; ivInjectCount = 0; return PASSED; }
/** * Verify Environment Injection (field or method) occurred properly. **/
Verify Environment Injection (field or method) occurred properly
verifyEnvInjection
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.ejbcontainer.injection_fat/test-applications/EJB3INJSABean.jar/src/com/ibm/ws/ejbcontainer/injection/ann/ejb/CompSFEnvInjectObjMthdBean.java", "license": "epl-1.0", "size": 32567 }
[ "javax.naming.Context", "javax.naming.InitialContext", "javax.naming.NameNotFoundException", "org.junit.Assert" ]
import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameNotFoundException; import org.junit.Assert;
import javax.naming.*; import org.junit.*;
[ "javax.naming", "org.junit" ]
javax.naming; org.junit;
1,959,169
public byte[] convertLetterOfCreditReviewToCSV(ContractsGrantsLetterOfCreditReviewDocument contractsGrantsLOCReviewDocument);
byte[] function(ContractsGrantsLetterOfCreditReviewDocument contractsGrantsLOCReviewDocument);
/** * This method is used to generate CSV file for Contracts & Grants LOC review document. * * @param contractsGrantsLOCReviewDocument * @return Byte array is returned so a file is not created on the server. */
This method is used to generate CSV file for Contracts & Grants LOC review document
convertLetterOfCreditReviewToCSV
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/report/service/ContractsGrantsInvoiceReportService.java", "license": "agpl-3.0", "size": 4091 }
[ "org.kuali.kfs.module.ar.document.ContractsGrantsLetterOfCreditReviewDocument" ]
import org.kuali.kfs.module.ar.document.ContractsGrantsLetterOfCreditReviewDocument;
import org.kuali.kfs.module.ar.document.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
589,959
@ServiceMethod(returns = ReturnType.SINGLE) void regenerateAuthToken(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName);
@ServiceMethod(returns = ReturnType.SINGLE) void regenerateAuthToken(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName);
/** * Regenerates the auth token for the notebook workspace. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param notebookWorkspaceName The name of the notebook workspace resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */
Regenerates the auth token for the notebook workspace
regenerateAuthToken
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/fluent/NotebookWorkspacesClient.java", "license": "mit", "size": 36953 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName;
import com.azure.core.annotation.*; import com.azure.resourcemanager.cosmos.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,200,439
public static ContextDefinition to(ContextBo bo) { if (bo == null) { return null; } return ContextDefinition.Builder.create(bo).build(); }
static ContextDefinition function(ContextBo bo) { if (bo == null) { return null; } return ContextDefinition.Builder.create(bo).build(); }
/** * Converts a mutable bo to it's immutable counterpart * * @param bo the mutable business object * @return the immutable object */
Converts a mutable bo to it's immutable counterpart
to
{ "repo_name": "mztaylor/rice-git", "path": "rice-middleware/krms/impl/src/main/java/org/kuali/rice/krms/impl/repository/ContextBo.java", "license": "apache-2.0", "size": 8188 }
[ "org.kuali.rice.krms.api.repository.context.ContextDefinition" ]
import org.kuali.rice.krms.api.repository.context.ContextDefinition;
import org.kuali.rice.krms.api.repository.context.*;
[ "org.kuali.rice" ]
org.kuali.rice;
2,186,448
public void readFrameBufferWithFormat(FrameBuffer fb, ByteBuffer byteBuf, Image.Format format);
void function(FrameBuffer fb, ByteBuffer byteBuf, Image.Format format);
/** * Reads the pixels currently stored in the specified framebuffer * into the given ByteBuffer object. * Only color pixels are transferred, witht hte given format. * The given byte buffer should have at least * fb.getWidth() * fb.getHeight() * 4 bytes remaining. * * @param fb The framebuffer to read from * @param byteBuf The bytebuffer to transfer color data to * @param format the image format to use when reading the frameBuffer. */
Reads the pixels currently stored in the specified framebuffer into the given ByteBuffer object. Only color pixels are transferred, witht hte given format. The given byte buffer should have at least fb.getWidth() * fb.getHeight() * 4 bytes remaining
readFrameBufferWithFormat
{ "repo_name": "phr00t/jmonkeyengine", "path": "jme3-core/src/main/java/com/jme3/renderer/Renderer.java", "license": "bsd-3-clause", "size": 14223 }
[ "com.jme3.texture.FrameBuffer", "com.jme3.texture.Image", "java.nio.ByteBuffer" ]
import com.jme3.texture.FrameBuffer; import com.jme3.texture.Image; import java.nio.ByteBuffer;
import com.jme3.texture.*; import java.nio.*;
[ "com.jme3.texture", "java.nio" ]
com.jme3.texture; java.nio;
216,426
SetupWizard getWizard();
SetupWizard getWizard();
/** * returns the setup wizard * * @return setup wizard */
returns the setup wizard
getWizard
{ "repo_name": "madoar/POL-POM-5", "path": "phoenicis-engines/src/main/java/org/phoenicis/engines/Engine.java", "license": "lgpl-3.0", "size": 3134 }
[ "org.phoenicis.scripts.wizard.SetupWizard" ]
import org.phoenicis.scripts.wizard.SetupWizard;
import org.phoenicis.scripts.wizard.*;
[ "org.phoenicis.scripts" ]
org.phoenicis.scripts;
881,386
@Override public boolean authenticate(final String username, final String password) { //importDemoData(); Subject currentUser = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(username, password); try { currentUser.login(token); // if we come this far, the login worked! DataContainer dc = new DataContainer(); SubjectDataTable dt = new SubjectDataTable(dc); SubjectDataRow row = dt.fillByName(username); if(row == null) { LOG_SEC.error(MessageFormat.format("Something terrible happened with: User {0}", username)); return false; } SubjectDataRowKey keySubject = row.getKey(); setCurrentUser(row.getShortName()); setCurrentAssessment(keySubject); _dtmLastLogin = row.getLastLoginDate(); row.setLastLoginDate(new Date()); dc.persist(); LOG_SEC.info(MessageFormat.format("Login successfull: User {0} with token {1}", username, token)); return true; // the following exceptions are just a few you can catch and handle accordingly. See the // AuthenticationException JavaDoc and its subclasses for more. } catch (IncorrectCredentialsException ice) { LOG_SEC.info(ice.getMessage()); error("Invalid username and/or password."); } catch (UnknownAccountException uae) { LOG_SEC.info(uae.getMessage()); error("There is no account with that username."); } catch (AuthenticationException ae) { LOG_SEC.info(ae.getMessage()); error("Invalid username and/or password."); } catch( Exception ex ) { LOG_SEC.info(ex.getMessage()); error("Login failed"); } return false; }
boolean function(final String username, final String password) { Subject currentUser = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(username, password); try { currentUser.login(token); DataContainer dc = new DataContainer(); SubjectDataTable dt = new SubjectDataTable(dc); SubjectDataRow row = dt.fillByName(username); if(row == null) { LOG_SEC.error(MessageFormat.format(STR, username)); return false; } SubjectDataRowKey keySubject = row.getKey(); setCurrentUser(row.getShortName()); setCurrentAssessment(keySubject); _dtmLastLogin = row.getLastLoginDate(); row.setLastLoginDate(new Date()); dc.persist(); LOG_SEC.info(MessageFormat.format(STR, username, token)); return true; } catch (IncorrectCredentialsException ice) { LOG_SEC.info(ice.getMessage()); error(STR); } catch (UnknownAccountException uae) { LOG_SEC.info(uae.getMessage()); error(STR); } catch (AuthenticationException ae) { LOG_SEC.info(ae.getMessage()); error(STR); } catch( Exception ex ) { LOG_SEC.info(ex.getMessage()); error(STR); } return false; }
/** * Authenticates this session using the given username and password * * @param username * The username * @param password * The password * @return True if the user was authenticated successfully */
Authenticates this session using the given username and password
authenticate
{ "repo_name": "swordlordcodingcrew/gozer", "path": "src/main/java/com/swordlord/gozer/session/SecuredWebSession.java", "license": "agpl-3.0", "size": 9122 }
[ "com.swordlord.jalapeno.datacontainer.DataContainer", "java.text.MessageFormat", "java.util.Date", "org.apache.shiro.SecurityUtils", "org.apache.shiro.authc.AuthenticationException", "org.apache.shiro.authc.IncorrectCredentialsException", "org.apache.shiro.authc.UnknownAccountException", "org.apache.shiro.authc.UsernamePasswordToken", "org.apache.shiro.subject.Subject" ]
import com.swordlord.jalapeno.datacontainer.DataContainer; import java.text.MessageFormat; import java.util.Date; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject;
import com.swordlord.jalapeno.datacontainer.*; import java.text.*; import java.util.*; import org.apache.shiro.*; import org.apache.shiro.authc.*; import org.apache.shiro.subject.*;
[ "com.swordlord.jalapeno", "java.text", "java.util", "org.apache.shiro" ]
com.swordlord.jalapeno; java.text; java.util; org.apache.shiro;
1,113,213
public boolean isFieldTypeLong(Field field);
boolean function(Field field);
/** * Use to determine if if the field value is a Long value withing the contentlet object * @param field * @return */
Use to determine if if the field value is a Long value withing the contentlet object
isFieldTypeLong
{ "repo_name": "jtesser/core-2.x", "path": "src/com/dotmarketing/portlets/contentlet/business/ContentletAPIPreHook.java", "license": "gpl-3.0", "size": 46259 }
[ "com.dotmarketing.portlets.structure.model.Field" ]
import com.dotmarketing.portlets.structure.model.Field;
import com.dotmarketing.portlets.structure.model.*;
[ "com.dotmarketing.portlets" ]
com.dotmarketing.portlets;
2,427,080
void verifyImportProcessGroup(VersionControlInformationDTO versionControlInfo, final VersionedProcessGroup versionedProcessGroup, String groupId);
void verifyImportProcessGroup(VersionControlInformationDTO versionControlInfo, final VersionedProcessGroup versionedProcessGroup, String groupId);
/** * Verifies that the flow identified by the given Version Control Information can be imported into the Process Group * with the given id * * @param versionControlInfo the information about the versioned flow * @param versionedProcessGroup the contents to be imported * @param groupId the ID of the Process Group where the flow should be instantiated * * @throws IllegalStateException if the flow cannot be imported into the specified group */
Verifies that the flow identified by the given Version Control Information can be imported into the Process Group with the given id
verifyImportProcessGroup
{ "repo_name": "InspurUSA/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java", "license": "apache-2.0", "size": 75521 }
[ "org.apache.nifi.registry.flow.VersionedProcessGroup", "org.apache.nifi.web.api.dto.VersionControlInformationDTO" ]
import org.apache.nifi.registry.flow.VersionedProcessGroup; import org.apache.nifi.web.api.dto.VersionControlInformationDTO;
import org.apache.nifi.registry.flow.*; import org.apache.nifi.web.api.dto.*;
[ "org.apache.nifi" ]
org.apache.nifi;
1,815,771
private JSDocInfo.Marker assertDocumentationInMarker(JSDocInfo.Marker marker, String description, int startCharno, int endLineno, int endCharno) { assertTrue(marker.getDescription() != null); assertEquals(description, marker.getDescription().getItem()); // Match positional information. assertEquals(marker.getAnnotation().getStartLine(), marker.getDescription().getStartLine()); assertEquals(startCharno, marker.getDescription().getPositionOnStartLine()); assertEquals(endLineno, marker.getDescription().getEndLine()); assertEquals(endCharno, marker.getDescription().getPositionOnEndLine()); return marker; }
JSDocInfo.Marker function(JSDocInfo.Marker marker, String description, int startCharno, int endLineno, int endCharno) { assertTrue(marker.getDescription() != null); assertEquals(description, marker.getDescription().getItem()); assertEquals(marker.getAnnotation().getStartLine(), marker.getDescription().getStartLine()); assertEquals(startCharno, marker.getDescription().getPositionOnStartLine()); assertEquals(endLineno, marker.getDescription().getEndLine()); assertEquals(endCharno, marker.getDescription().getPositionOnEndLine()); return marker; }
/** * Asserts that a documentation field exists on the given marker. * * @param description The text of the documentation field expected. * @param startCharno The starting character of the text. * @param endLineno The ending line of the text. * @param endCharno The ending character of the text. * @return The marker, for chaining purposes. */
Asserts that a documentation field exists on the given marker
assertDocumentationInMarker
{ "repo_name": "nicupavel/google-closure-compiler", "path": "test/com/google/javascript/jscomp/parsing/JsDocInfoParserTest.java", "license": "apache-2.0", "size": 105264 }
[ "com.google.javascript.rhino.JSDocInfo" ]
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,551,342
private static String mapToCurrentInstance(TruncateBoundary trunc, int yr, int month, int day, int hr, int min) { Calendar nominalInstanceCal = CoordELFunctions.getEffectiveNominalTime(); if (nominalInstanceCal == null) { XLog.getLog(OozieELExtensions.class).warn( "If the initial instance of the dataset is later than the nominal time, " + "an empty string is returned. This means that no data is available " + "at the current-instance specified by the user and the user could " + "try modifying his initial-instance to an earlier time."); return ""; } Calendar dsInstanceCal = getEffectiveTime(trunc, yr, month, day, hr, min); int[] instCnt = new int[1]; Calendar compInstCal = CoordELFunctions.getCurrentInstance(dsInstanceCal.getTime(), instCnt); if (compInstCal == null) { return ""; } int dsInstanceCnt = instCnt[0]; compInstCal = CoordELFunctions.getCurrentInstance(nominalInstanceCal.getTime(), instCnt); if (compInstCal == null) { return ""; } int nominalInstanceCnt = instCnt[0]; return COORD_CURRENT + "(" + (dsInstanceCnt - nominalInstanceCnt) + ")"; } }
static String function(TruncateBoundary trunc, int yr, int month, int day, int hr, int min) { Calendar nominalInstanceCal = CoordELFunctions.getEffectiveNominalTime(); if (nominalInstanceCal == null) { XLog.getLog(OozieELExtensions.class).warn( STR + STR + STR + STR); return STRSTRSTR(STR)"; } }
/** * Maps the dataset time to coord:current(n) with respect to action's * nominal time dataset time = truncate(nominal time) + yr + day + month + * hr + min. * * @param trunc * : Truncate resolution * @param yr * : Year to add (can be -ve) * @param month * : month to add (can be -ve) * @param day * : day to add (can be -ve) * @param hr * : hr to add (can be -ve) * @param min * : min to add (can be -ve) * @return coord:current(n) * @throws Exception * : If encountered an exception while evaluating */
Maps the dataset time to coord:current(n) with respect to action's nominal time dataset time = truncate(nominal time) + yr + day + month + hr + min
mapToCurrentInstance
{ "repo_name": "InMobi/falcon", "path": "oozie-el-extensions/src/main/java/org/apache/oozie/extensions/OozieELExtensions.java", "license": "apache-2.0", "size": 20220 }
[ "java.util.Calendar", "org.apache.oozie.coord.CoordELFunctions", "org.apache.oozie.util.XLog" ]
import java.util.Calendar; import org.apache.oozie.coord.CoordELFunctions; import org.apache.oozie.util.XLog;
import java.util.*; import org.apache.oozie.coord.*; import org.apache.oozie.util.*;
[ "java.util", "org.apache.oozie" ]
java.util; org.apache.oozie;
1,867,947
public Collection getVoices() { return m_voices; }
Collection function() { return m_voices; }
/** * Returns a Collection of {@link Voice}. */
Returns a Collection of <code>Voice</code>
getVoices
{ "repo_name": "Sciss/abc4j", "path": "abc/src/main/java/abc/notation/Music.java", "license": "lgpl-3.0", "size": 12130 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,017,406
public static int process(final String[] args, final InputStream in, final PrintStream out, final PrintStream err) { // parse args Options options = new Options(); options.addOption("h", "help", false, "Show this help"); options.addOption(OptionBuilder.withLongOpt("version") .withDescription("Print version and exit") .create()); options.addOption("v", "verbose", false, "Print more stuff about what's happening"); options.addOption("m", "minlen", true, "Minimum length sequence to include in stats (default=0)"); CommandLineParser parser = new DefaultParser(); try { CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("help")) { printHelp(out); return EXIT_OK; // success } if (cmd.hasOption("version")) { printVersion(out); return EXIT_OK; // success } // minlen param int minlength = 0; if (cmd.hasOption("minlen")) { try { minlength = Integer.parseInt( cmd.getOptionValue("minlen", "0")); } catch (NumberFormatException e) { err.println("\n*** Invalid minlen option. " + "Expected number, got '" + cmd.getOptionValue("minlen", "0") + "' ***\n"); printHelp(err); return EXIT_CMD_LINE; // cmd line error } } out.println("FILENAME\tTOTAL\tNUMSEQ\tMIN\tAVG\tMAX"); if (cmd.getArgs().length == 0) { try { FastaStats stats = new FastaStats( in, cmd.hasOption("verbose"), minlength); out.printf("%s\t%d\t%d\t%d\t%d\t%d\n", "stdin", stats.getTotal(), stats.getNumSeq(), stats.getMin(), stats.getAverage(), stats.getMax()); } catch (java.io.IOException e) { err.println("Failed to read stdin: " + e.getMessage()); return EXIT_IO; // io error } } else { // process files for (String filename: cmd.getArgs()) { try { FastaStats stats = new FastaStats(filename, cmd.hasOption("verbose"), minlength); out.printf("%s\t%d\t%d\t%d\t%d\t%d\n", filename, stats.getTotal(), stats.getNumSeq(), stats.getMin(), stats.getAverage(), stats.getMax()); } catch (java.io.IOException e) { err.println("Failed to open '" + filename + "': " + e.getMessage()); return EXIT_IO; // io error } } } } catch (FastaException e) { err.println("\n*** Invalid input file: " + e.getMessage() + " ***\n"); return EXIT_FORMAT; // invalid fasta } catch (ParseException e) { err.println("\n*** Invalid command line arguments: " + e.getMessage() + " ***\n"); printHelp(err); return EXIT_CMD_LINE; // cmd line error } return EXIT_OK; }
static int function(final String[] args, final InputStream in, final PrintStream out, final PrintStream err) { Options options = new Options(); options.addOption("h", "help", false, STR); options.addOption(OptionBuilder.withLongOpt(STR) .withDescription(STR) .create()); options.addOption("v", STR, false, STR); options.addOption("m", STR, true, STR); CommandLineParser parser = new DefaultParser(); try { CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("help")) { printHelp(out); return EXIT_OK; } if (cmd.hasOption(STR)) { printVersion(out); return EXIT_OK; } int minlength = 0; if (cmd.hasOption(STR)) { try { minlength = Integer.parseInt( cmd.getOptionValue(STR, "0")); } catch (NumberFormatException e) { err.println(STR + STR + cmd.getOptionValue(STR, "0") + STR); printHelp(err); return EXIT_CMD_LINE; } } out.println(STR); if (cmd.getArgs().length == 0) { try { FastaStats stats = new FastaStats( in, cmd.hasOption(STR), minlength); out.printf(STR, "stdin", stats.getTotal(), stats.getNumSeq(), stats.getMin(), stats.getAverage(), stats.getMax()); } catch (java.io.IOException e) { err.println(STR + e.getMessage()); return EXIT_IO; } } else { for (String filename: cmd.getArgs()) { try { FastaStats stats = new FastaStats(filename, cmd.hasOption(STR), minlength); out.printf(STR, filename, stats.getTotal(), stats.getNumSeq(), stats.getMin(), stats.getAverage(), stats.getMax()); } catch (java.io.IOException e) { err.println(STR + filename + STR + e.getMessage()); return EXIT_IO; } } } } catch (FastaException e) { err.println(STR + e.getMessage() + STR); return EXIT_FORMAT; } catch (ParseException e) { err.println(STR + e.getMessage() + STR); printHelp(err); return EXIT_CMD_LINE; } return EXIT_OK; }
/** * process request based on incoming arguments. * @param args command line arguments * @param in where to read input from * @param out where to send output to * @param err where to send logging and errors * @return exit code indicating result of processing */
process request based on incoming arguments
process
{ "repo_name": "bjpop/biotool", "path": "java/biotool/src/main/java/org/supernifty/biotool/App.java", "license": "mit", "size": 6540 }
[ "java.io.InputStream", "java.io.PrintStream", "org.apache.commons.cli.CommandLine", "org.apache.commons.cli.CommandLineParser", "org.apache.commons.cli.DefaultParser", "org.apache.commons.cli.OptionBuilder", "org.apache.commons.cli.Options", "org.apache.commons.cli.ParseException" ]
import java.io.InputStream; import java.io.PrintStream; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException;
import java.io.*; import org.apache.commons.cli.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
787,997
public void addColumn(byte[] columnFamily) { this.addColumn(columnFamily, Constants.EMPTY_COLUMN_QUALIFIER); }
void function(byte[] columnFamily) { this.addColumn(columnFamily, Constants.EMPTY_COLUMN_QUALIFIER); }
/** * Get all the column qualifiers under the specified column family * @param columnFamily */
Get all the column qualifiers under the specified column family
addColumn
{ "repo_name": "booz-allen-hamilton/culvert", "path": "culvert-main/src/main/java/com/bah/culvert/transactions/Get.java", "license": "apache-2.0", "size": 4594 }
[ "com.bah.culvert.util.Constants" ]
import com.bah.culvert.util.Constants;
import com.bah.culvert.util.*;
[ "com.bah.culvert" ]
com.bah.culvert;
1,422,751
public PostReplyBuilder postReplyBuilder() { return database.newPostReplyBuilder(); } /** * {@inheritDoc}
PostReplyBuilder function() { return database.newPostReplyBuilder(); } /** * {@inheritDoc}
/** * Returns a post reply builder. * * @return A new post reply builder */
Returns a post reply builder
postReplyBuilder
{ "repo_name": "ArneBab/Sone", "path": "src/main/java/net/pterodactylus/sone/core/Core.java", "license": "gpl-3.0", "size": 56664 }
[ "net.pterodactylus.sone.database.PostReplyBuilder" ]
import net.pterodactylus.sone.database.PostReplyBuilder;
import net.pterodactylus.sone.database.*;
[ "net.pterodactylus.sone" ]
net.pterodactylus.sone;
1,560,274
IntegerLiteral getVal();
IntegerLiteral getVal();
/** * Returns the value of the '<em><b>Val</b></em>' containment reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Val</em>' containment reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Val</em>' containment reference. * @see #setVal(IntegerLiteral) * @see com.rockwellcollins.atc.resolute.resolute.ResolutePackage#getIntExpr_Val() * @model containment="true" * @generated */
Returns the value of the 'Val' containment reference. If the meaning of the 'Val' containment reference isn't clear, there really should be more of a description here...
getVal
{ "repo_name": "smaccm/smaccm", "path": "fm-workbench/resolute/com.rockwellcollins.atc.resolute/src-gen/com/rockwellcollins/atc/resolute/resolute/IntExpr.java", "license": "bsd-3-clause", "size": 1463 }
[ "org.osate.aadl2.IntegerLiteral" ]
import org.osate.aadl2.IntegerLiteral;
import org.osate.aadl2.*;
[ "org.osate.aadl2" ]
org.osate.aadl2;
707,362
@Test(expectedExceptions = { LDAPException.class }) public void testConstructor3ValueEmptySequence() throws Exception { Control c = new Control( GetEffectiveRightsRequestControl.GET_EFFECTIVE_RIGHTS_REQUEST_OID, true, new ASN1OctetString(new ASN1Sequence().encode())); new GetEffectiveRightsRequestControl(c); }
@Test(expectedExceptions = { LDAPException.class }) void function() throws Exception { Control c = new Control( GetEffectiveRightsRequestControl.GET_EFFECTIVE_RIGHTS_REQUEST_OID, true, new ASN1OctetString(new ASN1Sequence().encode())); new GetEffectiveRightsRequestControl(c); }
/** * Tests the third constructor with a generic control whose value is an empty * sequence. * * @throws Exception If an unexpected problem occurs. */
Tests the third constructor with a generic control whose value is an empty sequence
testConstructor3ValueEmptySequence
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/controls/GetEffectiveRightsRequestControlTestCase.java", "license": "gpl-2.0", "size": 10736 }
[ "com.unboundid.asn1.ASN1OctetString", "com.unboundid.asn1.ASN1Sequence", "com.unboundid.ldap.sdk.Control", "com.unboundid.ldap.sdk.LDAPException", "org.testng.annotations.Test" ]
import com.unboundid.asn1.ASN1OctetString; import com.unboundid.asn1.ASN1Sequence; import com.unboundid.ldap.sdk.Control; import com.unboundid.ldap.sdk.LDAPException; import org.testng.annotations.Test;
import com.unboundid.asn1.*; import com.unboundid.ldap.sdk.*; import org.testng.annotations.*;
[ "com.unboundid.asn1", "com.unboundid.ldap", "org.testng.annotations" ]
com.unboundid.asn1; com.unboundid.ldap; org.testng.annotations;
1,978,332
private void processPluginOnObserver(String pluginName, JSONObject object) throws JSONException { int zkId = object.getInt("zkId"); ZooKeeperCluster cluster = null; if (clusters.containsKey(zkId)) { cluster = clusters.get(zkId); } else { logger.error("Wrong zkId! " + zkId); return; } if (!contexts.get(pluginName).containsKey(zkId)) { contexts.get(pluginName).put(zkId, new byte[1 << 20]); // 1M Arrays.fill(contexts.get(pluginName).get(zkId), (byte) 0); } ZooKeeperClient client = cluster.getObserverClient(); if (client != null) { byte[] context = contexts.get(pluginName).get(zkId); try { IPlugin plugin = createPlugin(pluginName, object, client, context); Thread pluginThread = new Thread(plugin); pluginThread.start(); pluginThread.join(30 * 1000); if (pluginThread.isAlive()) { pluginThread.interrupt(); logger.error(pluginName + " have run out of times. " + "It may be hang and must be killed."); } else { logger.info(pluginName + " runs at " + client.getConnectionString() + " successfully!"); } } catch (Exception e) { logger.error(pluginName + " runs at " + client.getConnectionString() + " failed! " , e); } } else { logger.warn(pluginName + " must run on observer, please config observer address."); } }
void function(String pluginName, JSONObject object) throws JSONException { int zkId = object.getInt("zkId"); ZooKeeperCluster cluster = null; if (clusters.containsKey(zkId)) { cluster = clusters.get(zkId); } else { logger.error(STR + zkId); return; } if (!contexts.get(pluginName).containsKey(zkId)) { contexts.get(pluginName).put(zkId, new byte[1 << 20]); Arrays.fill(contexts.get(pluginName).get(zkId), (byte) 0); } ZooKeeperClient client = cluster.getObserverClient(); if (client != null) { byte[] context = contexts.get(pluginName).get(zkId); try { IPlugin plugin = createPlugin(pluginName, object, client, context); Thread pluginThread = new Thread(plugin); pluginThread.start(); pluginThread.join(30 * 1000); if (pluginThread.isAlive()) { pluginThread.interrupt(); logger.error(pluginName + STR + STR); } else { logger.info(pluginName + STR + client.getConnectionString() + STR); } } catch (Exception e) { logger.error(pluginName + STR + client.getConnectionString() + STR , e); } } else { logger.warn(pluginName + STR); } }
/** * Process plugin on the observer client. * @param pluginName * @param object * @throws JSONException */
Process plugin on the observer client
processPluginOnObserver
{ "repo_name": "ZheYuan/Mario", "path": "Wario/src/main/java/com/renren/Wario/WarioMain.java", "license": "apache-2.0", "size": 10761 }
[ "com.renren.Wario", "java.util.Arrays", "org.json.JSONException", "org.json.JSONObject" ]
import com.renren.Wario; import java.util.Arrays; import org.json.JSONException; import org.json.JSONObject;
import com.renren.*; import java.util.*; import org.json.*;
[ "com.renren", "java.util", "org.json" ]
com.renren; java.util; org.json;
284,522
CompletableFuture<Versioned<V>> get(String tableName, K key);
CompletableFuture<Versioned<V>> get(String tableName, K key);
/** * Gets a value from the table. * * @param tableName table name * @param key The key to get. * @return A completable future to be completed with the result once complete. */
Gets a value from the table
get
{ "repo_name": "ravikumaran2015/ravikumaran201504", "path": "core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DatabaseProxy.java", "license": "apache-2.0", "size": 8350 }
[ "java.util.concurrent.CompletableFuture", "org.onosproject.store.service.Versioned" ]
import java.util.concurrent.CompletableFuture; import org.onosproject.store.service.Versioned;
import java.util.concurrent.*; import org.onosproject.store.service.*;
[ "java.util", "org.onosproject.store" ]
java.util; org.onosproject.store;
574,251
public static void generateGnuplotScripts(GAM gam, Instances instances, String dirPath, Terminal outputTerminal) throws IOException { List<Attribute> attributes = instances.getAttributes(); List<int[]> terms = gam.getTerms(); List<Regressor> regressors = gam.getRegressors(); File dir = new File(dirPath); if (!dir.exists()) { dir.mkdirs(); } double[] value = new double[attributes.size()]; Instance point = new Instance(value); String terminal = outputTerminal.toString(); for (int i = 0; i < terms.size(); i++) { int[] term = terms.get(i); Regressor regressor = regressors.get(i); if (term.length == 1) { Attribute f = attributes.get(term[0]); switch (f.getType()) { case BINNED: int numBins = ((BinnedAttribute) f).getNumBins(); if (numBins == 1) { continue; } break; case NOMINAL: int numStates = ((NominalAttribute) f).getStates().length; if (numStates == 1) { continue; } break; default: break; } PrintWriter out = new PrintWriter(dir.getAbsolutePath() + File.separator + f.getName() + ".plt"); out.printf("set term %s\n", terminal); out.printf("set output \"%s.%s\"\n", f.getName(), terminal); out.println("set datafile separator \"\t\""); out.println("set grid"); switch (f.getType()) { case BINNED: int numBins = ((BinnedAttribute) f).getNumBins(); Bins bins = ((BinnedAttribute) f).getBins(); double[] boundaries = bins.getBoundaries(); double start = boundaries[0] - 1; if (boundaries.length >= 2) { start = boundaries[0] - (boundaries[1] - boundaries[0]); } out.printf("set xrange[%f:%f]\n", start, boundaries[boundaries.length - 1]); out.println("plot \"-\" u 1:2 w l t \"\""); List<Double> predList = new ArrayList<>(); for (int j = 0; j < numBins; j++) { point.setValue(term[0], j); predList.add(regressor.regress(point)); } point.setValue(term[0], 0); out.printf("%f\t%f\n", start, predList.get(0)); for (int j = 0; j < numBins; j++) { point.setValue(term[0], j); out.printf("%f\t%f\n", boundaries[j], predList.get(j)); if (j < numBins - 1) { out.printf("%f\t%f\n", boundaries[j], predList.get(j + 1)); } } out.println("e"); break; case NOMINAL: out.println("set style data histogram"); out.println("set style histogram cluster gap 1"); out.println("set style fill solid border -1"); out.println("set boxwidth 0.9"); out.println("plot \"-\" u 2:xtic(1) t \"\""); out.println("set xtic rotate by -90"); String[] states = ((NominalAttribute) f).getStates(); for (int j = 0; j < states.length; j++) { point.setValue(term[0], j); out.printf("%s\t%f\n", states[j], regressor.regress(point)); } out.println("e"); break; default: Set<Double> values = new HashSet<>(); for (Instance instance : instances) { values.add(instance.getValue(term[0])); } List<Double> list = new ArrayList<>(values); Collections.sort(list); out.printf("set xrange[%f:%f]\n", list.get(0), list.get(list.size() - 1)); if (regressor instanceof CubicSpline) { CubicSpline spline = (CubicSpline) regressor; out.println("z(x) = x < 0 ? 0 : x ** 3"); out.println("h(x, k) = z(x - k)"); double[] knots = spline.getKnots(); double[] w = spline.getCoefficients(); StringBuilder sb = new StringBuilder(); sb.append("plot ").append(spline.getIntercept()); sb.append(" + ").append(w[0]).append(" * x"); sb.append(" + ").append(w[1]).append(" * (x ** 2)"); sb.append(" + ").append(w[2]).append(" * (x ** 3)"); for (int j = 0; j < knots.length; j++) { sb.append(" + ").append(w[j + 3]).append(" * "); sb.append("h(x, ").append(knots[j]).append(")"); } sb.append(" t \"\""); out.println(sb.toString()); } else { out.println("plot \"-\" u 1:2 w lp t \"\""); for (double v : list) { point.setValue(term[0], v); out.printf("%f\t%f\n", v, regressor.regress(point)); } } break; } out.flush(); out.close(); } else if (term.length == 2) { Attribute f1 = attributes.get(term[0]); Attribute f2 = attributes.get(term[1]); PrintWriter out = new PrintWriter(dir.getAbsolutePath() + File.separator + f1.getName() + "_" + f2.getName() + ".plt"); out.printf("set term %s\n", terminal); out.printf("set output \"%s_%s.%s\"\n", f1.getName(), f2.getName(), terminal); out.println("set datafile separator \"\t\""); int size1 = 0; if (f1.getType() == Attribute.Type.BINNED) { size1 = ((BinnedAttribute) f1).getNumBins(); } else if (f1.getType() == Attribute.Type.NOMINAL) { size1 = ((NominalAttribute) f1).getCardinality(); } int size2 = 0; if (f2.getType() == Attribute.Type.BINNED) { size2 = ((BinnedAttribute) f2).getNumBins(); } else if (f2.getType() == Attribute.Type.NOMINAL) { size2 = ((NominalAttribute) f2).getCardinality(); } if (f1.getType() == Attribute.Type.NOMINAL) { out.print("set ytics("); String[] states = ((NominalAttribute) f1).getStates(); for (int j = 0; j < states.length; j++) { out.printf("%s %d", states[j], j); } out.println(")"); } if (f2.getType() == Attribute.Type.NOMINAL) { out.print("set xtics("); String[] states = ((NominalAttribute) f2).getStates(); for (int j = 0; j < states.length; j++) { out.printf("%s %d", states[j], j); } out.println(")"); } out.println("set view map"); out.println("set style data pm3d"); out.println("set style function pm3d"); out.println("set pm3d corners2color c4"); Bins bins1 = ((BinnedAttribute) f1).getBins(); double[] boundaries1 = bins1.getBoundaries(); double start1 = boundaries1[0] - 1; if (boundaries1.length >= 2) { start1 = boundaries1[0] - (boundaries1[1] - boundaries1[0]); } Bins bins2 = ((BinnedAttribute) f2).getBins(); double[] boundaries2 = bins2.getBoundaries(); double start2 = boundaries2[0] - 1; if (boundaries2.length >= 2) { start2 = boundaries2[0] - (boundaries2[1] - boundaries2[0]); } out.printf("set yrange[%f:%f]\n", start1, boundaries1[boundaries1.length - 1]); out.printf("set xrange[%f:%f]\n", start2, boundaries2[boundaries2.length - 1]); out.println("splot \"-\""); for (int r = -1; r < size1; r++) { if (r == -1) { point.setValue(term[0], 0); } else { point.setValue(term[0], r); } for (int c = -1; c < size2; c++) { if (c == -1) { point.setValue(term[1], 0); } else { point.setValue(term[1], c); } if (c == -1) { out.print(start2 + "\t"); } else { out.print(boundaries2[c] + "\t"); } if (r == -1) { out.print(start1 + "\t"); } else { out.print(boundaries1[r] + "\t"); } out.println(gam.regress(point)); } out.println(); } out.println("e"); out.flush(); out.close(); } } } static class Options { @Argument(name = "-r", description = "attribute file path", required = true) String attPath = null; @Argument(name = "-d", description = "dataset path", required = true) String datasetPath = null; @Argument(name = "-i", description = "input model path", required = true) String inputModelPath = null; @Argument(name = "-o", description = "output directory path", required = true) String dirPath = null; @Argument(name = "-t", description = "output terminal (default: png)") String terminal = "png"; }
static void function(GAM gam, Instances instances, String dirPath, Terminal outputTerminal) throws IOException { List<Attribute> attributes = instances.getAttributes(); List<int[]> terms = gam.getTerms(); List<Regressor> regressors = gam.getRegressors(); File dir = new File(dirPath); if (!dir.exists()) { dir.mkdirs(); } double[] value = new double[attributes.size()]; Instance point = new Instance(value); String terminal = outputTerminal.toString(); for (int i = 0; i < terms.size(); i++) { int[] term = terms.get(i); Regressor regressor = regressors.get(i); if (term.length == 1) { Attribute f = attributes.get(term[0]); switch (f.getType()) { case BINNED: int numBins = ((BinnedAttribute) f).getNumBins(); if (numBins == 1) { continue; } break; case NOMINAL: int numStates = ((NominalAttribute) f).getStates().length; if (numStates == 1) { continue; } break; default: break; } PrintWriter out = new PrintWriter(dir.getAbsolutePath() + File.separator + f.getName() + ".plt"); out.printf(STR, terminal); out.printf(STR%s.%s\"\n", f.getName(), terminal); out.println(STR\t\STRset gridSTRset xrange[%f:%f]\nSTRplot \"-\" u 1:2 w l t \"\"STR%f\t%f\nSTR%f\t%f\nSTR%f\t%f\nSTReSTRset style data histogramSTRset style histogram cluster gap 1STRset style fill solid border -1STRset boxwidth 0.9STRplot \"-\" u 2:xtic(1) t \"\STRset xtic rotate by -90STR%s\t%f\nSTReSTRset xrange[%f:%f]\nSTRz(x) = x < 0 ? 0 : x ** 3STRh(x, k) = z(x - k)STRplot STR + STR * xSTR + STR * (x ** 2)STR + STR * (x ** 3)STR + STR * STRh(x, STR)STR t \"\"STRplot \"-\" u 1:2 w lp t \"\"STR%f\t%f\nSTR_STR.plt"); out.printf(STR, terminal); out.printf(STR%s_%s.%s\"\n", f1.getName(), f2.getName(), terminal); out.println(STR\t\"STRset ytics(STR%s %dSTR)STRset xtics(STR%s %dSTR)STRset view mapSTRset style data pm3dSTRset style function pm3dSTRset pm3d corners2color c4STRset yrange[%f:%f]\nSTRset xrange[%f:%f]\nSTRsplot \"-\"STR\tSTR\tSTR\tSTR\tSTReSTR-rSTRattribute file pathSTR-dSTRdataset pathSTR-iSTRinput model pathSTR-oSTRoutput directory pathSTR-tSTRoutput terminal (default: png)STRpng"; }
/** * Generates a set of Gnuplot scripts for visualizing low dimensional components in a GAM. * * @param gam the GAM model. * @param instances the training set. * @param dirPath the directory path to write to. * @param outputTerminal output plot format (png or pdf). * @throws IOException */
Generates a set of Gnuplot scripts for visualizing low dimensional components in a GAM
generateGnuplotScripts
{ "repo_name": "ardydedase/mltk", "path": "src/mltk/predictor/gam/tool/Visualizer.java", "license": "bsd-3-clause", "size": 10432 }
[ "java.io.File", "java.io.IOException", "java.io.PrintWriter", "java.util.List" ]
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,370,379
private TaskData doInBackgroundRemoveTemplate(TaskData... params) { Timber.d("doInBackgroundRemoveTemplate"); Object [] args = params[0].getObjArray(); Collection col = (Collection ) args[0]; JSONObject model = (JSONObject) args[1]; JSONObject template = (JSONObject) args[2]; // add the new template try { boolean success = col.getModels().remTemplate(model, template); if (! success) { return new TaskData(col, "removeTemplateFailed", false); } } catch (ConfirmModSchemaException e) { Timber.e("doInBackgroundRemoveTemplate :: ConfirmModSchemaException"); return new TaskData(false); } return new TaskData(true); } public static interface Listener {
TaskData function(TaskData... params) { Timber.d(STR); Object [] args = params[0].getObjArray(); Collection col = (Collection ) args[0]; JSONObject model = (JSONObject) args[1]; JSONObject template = (JSONObject) args[2]; try { boolean success = col.getModels().remTemplate(model, template); if (! success) { return new TaskData(col, STR, false); } } catch (ConfirmModSchemaException e) { Timber.e(STR); return new TaskData(false); } return new TaskData(true); } public static interface Listener {
/** * Add a new card template * @param params * @return */
Add a new card template
doInBackgroundRemoveTemplate
{ "repo_name": "federvieh/Anki-Android", "path": "AnkiDroid/src/main/java/com/ichi2/async/DeckTask.java", "license": "gpl-3.0", "size": 57340 }
[ "com.ichi2.anki.exception.ConfirmModSchemaException", "com.ichi2.libanki.Collection", "org.json.JSONObject" ]
import com.ichi2.anki.exception.ConfirmModSchemaException; import com.ichi2.libanki.Collection; import org.json.JSONObject;
import com.ichi2.anki.exception.*; import com.ichi2.libanki.*; import org.json.*;
[ "com.ichi2.anki", "com.ichi2.libanki", "org.json" ]
com.ichi2.anki; com.ichi2.libanki; org.json;
1,628,178
@Test public void testScriptTimeout() throws Exception { LOG.info("running testScriptTimeout"); TTClient client = cluster.getTTClient(); Configuration tConf= client.getProxy().getDaemonConf(); int defaultTimeout = tConf.getInt("mapred.healthChecker.script.timeout", 0); tConf.set("mapred.task.tracker.report.address", cluster.getConf().get("mapred.task.tracker.report.address")); Assert.assertTrue("Health script timeout was not set",defaultTimeout != 0); tConf.set("mapred.healthChecker.script.path", remotePath+File.separator+ healthScriptTimeout); tConf.setInt("mapred.healthChecker.script.timeout", 100); tConf.setInt("mapred.healthChecker.interval",1000); helper.copyFileToRemoteHost(healthScriptTimeout, client.getHostName(), remotePath, cluster); cluster.restartDaemonWithNewConfig(client, "mapred-site.xml", tConf, Role.TT); //make sure the TT is blacklisted helper.verifyTTBlackList(tConf, client, "Node health script timed out", cluster); //Now put back the task tracker in a health state cluster.restart(client, Role.TT); tConf = client.getProxy().getDaemonConf(); //now do the opposite of blacklist verification helper.deleteFileOnRemoteHost(remotePath+File.separator+healthScriptTimeout, client.getHostName()); }
void function() throws Exception { LOG.info(STR); TTClient client = cluster.getTTClient(); Configuration tConf= client.getProxy().getDaemonConf(); int defaultTimeout = tConf.getInt(STR, 0); tConf.set(STR, cluster.getConf().get(STR)); Assert.assertTrue(STR,defaultTimeout != 0); tConf.set(STR, remotePath+File.separator+ healthScriptTimeout); tConf.setInt(STR, 100); tConf.setInt(STR,1000); helper.copyFileToRemoteHost(healthScriptTimeout, client.getHostName(), remotePath, cluster); cluster.restartDaemonWithNewConfig(client, STR, tConf, Role.TT); helper.verifyTTBlackList(tConf, client, STR, cluster); cluster.restart(client, Role.TT); tConf = client.getProxy().getDaemonConf(); helper.deleteFileOnRemoteHost(remotePath+File.separator+healthScriptTimeout, client.getHostName()); }
/** * In this case the test times out the task tracker will get blacklisted . * @throws Exception in case of test errors */
In this case the test times out the task tracker will get blacklisted
testScriptTimeout
{ "repo_name": "gndpig/hadoop", "path": "src/test/system/java/org/apache/hadoop/mapred/TestHealthScriptTimeout.java", "license": "apache-2.0", "size": 3471 }
[ "java.io.File", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.mapreduce.test.system.MRCluster", "org.apache.hadoop.mapreduce.test.system.TTClient", "org.junit.Assert" ]
import java.io.File; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.test.system.MRCluster; import org.apache.hadoop.mapreduce.test.system.TTClient; import org.junit.Assert;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.mapreduce.test.system.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
1,533,329
public static VoiceMail[] getAllVoiceMails() throws SkypeException { try { String command = "SEARCH VOICEMAILS"; String responseHeader = "VOICEMAILS "; String response = getConnectorInstance().execute(command, responseHeader); String data = response.substring(responseHeader.length()); String[] ids = Utils.convertToArray(data); VoiceMail[] voiceMails = new VoiceMail[ids.length]; for (int i = 0; i < ids.length; ++i) { voiceMails[i] = VoiceMail.getInstance(ids[i]); } return voiceMails; } catch (ConnectorException ex) { Utils.convertToSkypeException(ex); return null; } }
static VoiceMail[] function() throws SkypeException { try { String command = STR; String responseHeader = STR; String response = getConnectorInstance().execute(command, responseHeader); String data = response.substring(responseHeader.length()); String[] ids = Utils.convertToArray(data); VoiceMail[] voiceMails = new VoiceMail[ids.length]; for (int i = 0; i < ids.length; ++i) { voiceMails[i] = VoiceMail.getInstance(ids[i]); } return voiceMails; } catch (ConnectorException ex) { Utils.convertToSkypeException(ex); return null; } }
/** * Gets the all voice mails. * @return The all voice mails * @throws SkypeException If there is a problem with the connection or state at the Skype client. */
Gets the all voice mails
getAllVoiceMails
{ "repo_name": "AManuev/Skype4OSGi", "path": "src/main/java/com/skype/Skype.java", "license": "apache-2.0", "size": 45830 }
[ "com.skype.connector.ConnectorException" ]
import com.skype.connector.ConnectorException;
import com.skype.connector.*;
[ "com.skype.connector" ]
com.skype.connector;
1,552,465
public boolean connect() { if (mService != null) Log.e(TAG, "Already connected."); Intent intent = new Intent(GSA_SERVICE).setPackage(GSAState.SEARCH_INTENT_PACKAGE); return mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }
boolean function() { if (mService != null) Log.e(TAG, STR); Intent intent = new Intent(GSA_SERVICE).setPackage(GSAState.SEARCH_INTENT_PACKAGE); return mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }
/** * Establishes a connection to the service. Call this method once the callback passed here is * ready to handle calls. * If you pass in an GSA context, it will be sent up the service as soon as the connection is * established. * @return Whether or not the connection to the service was established successfully. */
Establishes a connection to the service. Call this method once the callback passed here is ready to handle calls. If you pass in an GSA context, it will be sent up the service as soon as the connection is established
connect
{ "repo_name": "SaschaMester/delicium", "path": "chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java", "license": "bsd-3-clause", "size": 5092 }
[ "android.content.Context", "android.content.Intent", "android.util.Log" ]
import android.content.Context; import android.content.Intent; import android.util.Log;
import android.content.*; import android.util.*;
[ "android.content", "android.util" ]
android.content; android.util;
2,687,564
public static ParquetTableMetadata_v3 getParquetTableMetadata(FileSystem fs, List<FileStatus> fileStatuses, ParquetFormatConfig formatConfig) throws IOException { Metadata metadata = new Metadata(fs, formatConfig); return metadata.getParquetTableMetadata(fileStatuses); }
static ParquetTableMetadata_v3 function(FileSystem fs, List<FileStatus> fileStatuses, ParquetFormatConfig formatConfig) throws IOException { Metadata metadata = new Metadata(fs, formatConfig); return metadata.getParquetTableMetadata(fileStatuses); }
/** * Get the parquet metadata for a list of parquet files * * @param fs * @param fileStatuses * @return * @throws IOException */
Get the parquet metadata for a list of parquet files
getParquetTableMetadata
{ "repo_name": "shakamunyi/drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java", "license": "apache-2.0", "size": 71648 }
[ "java.io.IOException", "java.util.List", "org.apache.hadoop.fs.FileStatus", "org.apache.hadoop.fs.FileSystem" ]
import java.io.IOException; import java.util.List; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
2,816,821
public void get(int index, NullableTimeStampMicroHolder holder) { if (isSet(index) == 0) { holder.isSet = 0; return; } holder.isSet = 1; holder.value = valueBuffer.getLong(index * TYPE_WIDTH); }
void function(int index, NullableTimeStampMicroHolder holder) { if (isSet(index) == 0) { holder.isSet = 0; return; } holder.isSet = 1; holder.value = valueBuffer.getLong(index * TYPE_WIDTH); }
/** * Get the element at the given index from the vector and * sets the state in holder. If element at given index * is null, holder.isSet will be zero. * * @param index position of element */
Get the element at the given index from the vector and sets the state in holder. If element at given index is null, holder.isSet will be zero
get
{ "repo_name": "renesugar/arrow", "path": "java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroVector.java", "license": "apache-2.0", "size": 8069 }
[ "org.apache.arrow.vector.holders.NullableTimeStampMicroHolder" ]
import org.apache.arrow.vector.holders.NullableTimeStampMicroHolder;
import org.apache.arrow.vector.holders.*;
[ "org.apache.arrow" ]
org.apache.arrow;
814,865
@Test public void testGetBooksHttpContent() throws Exception { HttpGet httpGet = new HttpGet("http://localhost:9080" + ContainerConstants.EXAM_CONTEXT_ROOT + "/books.html"); try (CloseableHttpClient httpclient = HttpClients.createDefault(); CloseableHttpResponse response = httpclient.execute(httpGet)) { assertThat("Status code must be 200 - OK", response.getStatusLine().getStatusCode(), is(200)); // verify html content String content = EntityUtils.toString(response.getEntity()); assertThat(content, is(notNullValue())); // TODO Why does CoreMatchers.containsString() not work? assertThat(content.contains("Steinbeck"), is(true)); } }
void function() throws Exception { HttpGet httpGet = new HttpGet(STRStatus code must be 200 - OKSTRSteinbeck"), is(true)); } }
/** * Gets books.html which contains the list of books in a library. * <p> * The html content is based on the defined books.jsp in the sample web module. */
Gets books.html which contains the list of books in a library. The html content is based on the defined books.jsp in the sample web module
testGetBooksHttpContent
{ "repo_name": "bimargulies/org.ops4j.pax.exam2", "path": "itest/web/src/it/regression-web-spring-userprobe/src/test/java/org/ops4j/pax/exam/regression/web/spring/UserProbeTest.java", "license": "apache-2.0", "size": 3841 }
[ "org.apache.http.client.methods.HttpGet", "org.hamcrest.CoreMatchers" ]
import org.apache.http.client.methods.HttpGet; import org.hamcrest.CoreMatchers;
import org.apache.http.client.methods.*; import org.hamcrest.*;
[ "org.apache.http", "org.hamcrest" ]
org.apache.http; org.hamcrest;
2,467,477
@Override public void initGUI() { try { SwingEngine swingEngine = new SwingEngine(this); swingEngine.setClassLoader(UserLoginFailurePane.class.getClassLoader()); JPanel panel = (JPanel) swingEngine.render(getClass().getResource("/swixml/UserLoginFailurePane.xml")); int failure = ((Integer) getDisplay().getProperties().get("failure")).intValue(); String msg; if (failure == UserLoginFailureAction.USER_ALREADY_ONLINE) { msg = Engine.instance().getResourceService().getString("aktario.userLoginFailureUserAlreadyOnline"); button.setEnabled(false);
void function() { try { SwingEngine swingEngine = new SwingEngine(this); swingEngine.setClassLoader(UserLoginFailurePane.class.getClassLoader()); JPanel panel = (JPanel) swingEngine.render(getClass().getResource(STR)); int failure = ((Integer) getDisplay().getProperties().get(STR)).intValue(); String msg; if (failure == UserLoginFailureAction.USER_ALREADY_ONLINE) { msg = Engine.instance().getResourceService().getString(STR); button.setEnabled(false);
/** * Initialize the gui. */
Initialize the gui
initGUI
{ "repo_name": "iritgo/iritgo-aktario", "path": "aktario-client/src/main/java/de/iritgo/aktario/client/gui/UserLoginFailurePane.java", "license": "apache-2.0", "size": 4120 }
[ "de.iritgo.aktario.core.Engine", "de.iritgo.aktario.framework.user.action.UserLoginFailureAction", "javax.swing.JPanel", "org.swixml.SwingEngine" ]
import de.iritgo.aktario.core.Engine; import de.iritgo.aktario.framework.user.action.UserLoginFailureAction; import javax.swing.JPanel; import org.swixml.SwingEngine;
import de.iritgo.aktario.core.*; import de.iritgo.aktario.framework.user.action.*; import javax.swing.*; import org.swixml.*;
[ "de.iritgo.aktario", "javax.swing", "org.swixml" ]
de.iritgo.aktario; javax.swing; org.swixml;
2,055,031
public void testAddressingMetadataDisabled() { Map<String, List<Annotation>> map = new HashMap(); ArrayList<Annotation> wsFeatures = new ArrayList<Annotation>(); AddressingAnnot addressingFeature = new AddressingAnnot(); addressingFeature.setEnabled(false); addressingFeature.setRequired(true); addressingFeature.setResponses(Responses.NON_ANONYMOUS); wsFeatures.add(addressingFeature); map.put(ProxyAddressingService.class.getName(), wsFeatures); DescriptionBuilderComposite serviceDBC = new DescriptionBuilderComposite(); serviceDBC.getProperties().put(MDQConstants.SEI_FEATURES_MAP, map); ServiceDelegate.setServiceMetadata(serviceDBC); Service svc = Service.create(new QName("http://test", "ProxyAddressingService")); ProxyAddressingService proxy = svc.getPort(ProxyAddressingService.class); assertNotNull(proxy); proxy.doSomething("12345"); TestClientInvocationController testController = getInvocationController(); InvocationContext ic = testController.getInvocationContext(); MessageContext request = ic.getRequestMessageContext(); // If addressing is not enabled the version should not be set String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION); assertNull("Version set", version); Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES); assertNotNull("Disabled not set", disabled); assertTrue("Addressing disabled", disabled); // Even though required=true above, per the addressing developers, they want to leave it set as unspecified when // addressing is not enabled. String required = (String) request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER); assertNotNull("Required not set", required); assertEquals("Wrong addressing required", AddressingConstants.ADDRESSING_UNSPECIFIED, required); String responses = (String) request.getProperty(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME); assertNotNull("Responses not set", responses); assertEquals("Wrong responses value", AddressingConstants.WSAM_INVOCATION_PATTERN_ASYNCHRONOUS, responses); } @WebService() public interface ProxyAddressingService {
void function() { Map<String, List<Annotation>> map = new HashMap(); ArrayList<Annotation> wsFeatures = new ArrayList<Annotation>(); AddressingAnnot addressingFeature = new AddressingAnnot(); addressingFeature.setEnabled(false); addressingFeature.setRequired(true); addressingFeature.setResponses(Responses.NON_ANONYMOUS); wsFeatures.add(addressingFeature); map.put(ProxyAddressingService.class.getName(), wsFeatures); DescriptionBuilderComposite serviceDBC = new DescriptionBuilderComposite(); serviceDBC.getProperties().put(MDQConstants.SEI_FEATURES_MAP, map); ServiceDelegate.setServiceMetadata(serviceDBC); Service svc = Service.create(new QName(STR12345STRVersion setSTRDisabled not setSTRAddressing disabledSTRRequired not setSTRWrong addressing requiredSTRResponses not setSTRWrong responses value", AddressingConstants.WSAM_INVOCATION_PATTERN_ASYNCHRONOUS, responses); } @WebService() public interface ProxyAddressingService {
/** * Validate correct behavior when addressing is disabled via addressing-related metadata specified in a sparse composite, such as * would be used to represent configuration via a Deployment Descriptor. */
Validate correct behavior when addressing is disabled via addressing-related metadata specified in a sparse composite, such as would be used to represent configuration via a Deployment Descriptor
testAddressingMetadataDisabled
{ "repo_name": "arunasujith/wso2-axis2", "path": "modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingMetadataTest.java", "license": "apache-2.0", "size": 8503 }
[ "java.lang.annotation.Annotation", "java.util.ArrayList", "java.util.HashMap", "java.util.List", "java.util.Map", "javax.jws.WebService", "javax.xml.namespace.QName", "javax.xml.ws.Service", "javax.xml.ws.soap.AddressingFeature", "org.apache.axis2.addressing.AddressingConstants", "org.apache.axis2.jaxws.description.builder.AddressingAnnot", "org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite", "org.apache.axis2.jaxws.description.builder.MDQConstants", "org.apache.axis2.jaxws.spi.ServiceDelegate" ]
import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.jws.WebService; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.soap.AddressingFeature; import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.jaxws.description.builder.AddressingAnnot; import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite; import org.apache.axis2.jaxws.description.builder.MDQConstants; import org.apache.axis2.jaxws.spi.ServiceDelegate;
import java.lang.annotation.*; import java.util.*; import javax.jws.*; import javax.xml.namespace.*; import javax.xml.ws.*; import javax.xml.ws.soap.*; import org.apache.axis2.addressing.*; import org.apache.axis2.jaxws.description.builder.*; import org.apache.axis2.jaxws.spi.*;
[ "java.lang", "java.util", "javax.jws", "javax.xml", "org.apache.axis2" ]
java.lang; java.util; javax.jws; javax.xml; org.apache.axis2;
468,404
@XmlElementRef public DefaultCitation getElement() { return DefaultCitation.castOrCopy(metadata); }
DefaultCitation function() { return DefaultCitation.castOrCopy(metadata); }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <gmd:CI_Citation>} XML element. * This is the value or a copy of the value given in argument to the {@code wrap} method. * * @return The metadata to be marshalled. */
Invoked by JAXB at marshalling time for getting the actual metadata to write inside the XML element. This is the value or a copy of the value given in argument to the wrap method
getElement
{ "repo_name": "desruisseaux/sis", "path": "core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/CI_Citation.java", "license": "apache-2.0", "size": 3137 }
[ "org.apache.sis.metadata.iso.citation.DefaultCitation" ]
import org.apache.sis.metadata.iso.citation.DefaultCitation;
import org.apache.sis.metadata.iso.citation.*;
[ "org.apache.sis" ]
org.apache.sis;
1,339,525
public synchronized void clear(Handler handler, Runnable onCompletionAction) { removeMediaSourceRange(0, getSize(), handler, onCompletionAction); }
synchronized void function(Handler handler, Runnable onCompletionAction) { removeMediaSourceRange(0, getSize(), handler, onCompletionAction); }
/** * Clears the playlist and executes a custom action on completion. * * @param handler The {@link Handler} to run {@code onCompletionAction}. * @param onCompletionAction A {@link Runnable} which is executed immediately after the playlist * has been cleared. */
Clears the playlist and executes a custom action on completion
clear
{ "repo_name": "androidx/media", "path": "libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ConcatenatingMediaSource.java", "license": "apache-2.0", "size": 42634 }
[ "android.os.Handler" ]
import android.os.Handler;
import android.os.*;
[ "android.os" ]
android.os;
1,064,179
public void init(S subject, String key, ObjectNode node, ObjectMapper mapper, ConfigApplyDelegate delegate) { this.subject = checkNotNull(subject); this.key = key; this.node = checkNotNull(node); this.mapper = checkNotNull(mapper); this.delegate = checkNotNull(delegate); }
void function(S subject, String key, ObjectNode node, ObjectMapper mapper, ConfigApplyDelegate delegate) { this.subject = checkNotNull(subject); this.key = key; this.node = checkNotNull(node); this.mapper = checkNotNull(mapper); this.delegate = checkNotNull(delegate); }
/** * Initializes the configuration behaviour with necessary context. * * @param subject configuration subject * @param key configuration key * @param node JSON object node where configuration data is stored * @param mapper JSON object mapper * @param delegate delegate context */
Initializes the configuration behaviour with necessary context
init
{ "repo_name": "rvhub/onos", "path": "core/api/src/main/java/org/onosproject/net/config/Config.java", "license": "apache-2.0", "size": 9237 }
[ "com.fasterxml.jackson.databind.ObjectMapper", "com.fasterxml.jackson.databind.node.ObjectNode", "com.google.common.base.Preconditions" ]
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.base.Preconditions;
import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.*; import com.google.common.base.*;
[ "com.fasterxml.jackson", "com.google.common" ]
com.fasterxml.jackson; com.google.common;
741,486
public static void save(String filename, double[] samples) { // assumes 44,100 samples per second // use 16-bit audio, mono, signed PCM, little Endian AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false); byte[] data = new byte[2 * samples.length]; for (int i = 0; i < samples.length; i++) { int temp = (short) (samples[i] * MAX_16_BIT); data[2*i + 0] = (byte) temp; data[2*i + 1] = (byte) (temp >> 8); } // now save the file try { ByteArrayInputStream bais = new ByteArrayInputStream(data); AudioInputStream ais = new AudioInputStream(bais, format, samples.length); if (filename.endsWith(".wav") || filename.endsWith(".WAV")) { AudioSystem.write(ais, AudioFileFormat.Type.WAVE, new File(filename)); } else if (filename.endsWith(".au") || filename.endsWith(".AU")) { AudioSystem.write(ais, AudioFileFormat.Type.AU, new File(filename)); } else { throw new RuntimeException("File format not supported: " + filename); } } catch (IOException e) { System.out.println(e); System.exit(1); } }
static void function(String filename, double[] samples) { AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false); byte[] data = new byte[2 * samples.length]; for (int i = 0; i < samples.length; i++) { int temp = (short) (samples[i] * MAX_16_BIT); data[2*i + 0] = (byte) temp; data[2*i + 1] = (byte) (temp >> 8); } try { ByteArrayInputStream bais = new ByteArrayInputStream(data); AudioInputStream ais = new AudioInputStream(bais, format, samples.length); if (filename.endsWith(".wav") filename.endsWith(".WAV")) { AudioSystem.write(ais, AudioFileFormat.Type.WAVE, new File(filename)); } else if (filename.endsWith(".au") filename.endsWith(".AU")) { AudioSystem.write(ais, AudioFileFormat.Type.AU, new File(filename)); } else { throw new RuntimeException(STR + filename); } } catch (IOException e) { System.out.println(e); System.exit(1); } }
/** * Saves the double array as an audio file (using .wav or .au format). * * @param filename the name of the audio file * @param samples the array of samples */
Saves the double array as an audio file (using .wav or .au format)
save
{ "repo_name": "SATL/AlgorithmsJava", "path": "src/fundamentals/programming_model/StdAudio.java", "license": "apache-2.0", "size": 11451 }
[ "java.io.ByteArrayInputStream", "java.io.File", "java.io.IOException", "javax.sound.sampled.AudioFileFormat", "javax.sound.sampled.AudioFormat", "javax.sound.sampled.AudioInputStream", "javax.sound.sampled.AudioSystem" ]
import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem;
import java.io.*; import javax.sound.sampled.*;
[ "java.io", "javax.sound" ]
java.io; javax.sound;
1,935,271
public void processIncludes(VFile currentDir) { List<PartialUISuite> partialSuites = findIncludes(currentDir); if(includes != null) includes.clear(); partialSuites.forEach(this::importEnums); partialSuites.forEach(this::importResources); partialSuites.forEach(this::importFtlIncludes); partialSuites.forEach(this::importFtlMacros); partialSuites.forEach(this::importFtlFunctions); partialSuites.forEach(this::importFtlImports); partialSuites.forEach(p -> importTemplatesToMap(p.getTemplates())); importTemplatesToMap(templates); updateTemplateList(); partialSuites.forEach(p -> importControlsToMap(p.getControls())); importControlsToMap(controls); updateControlList(); }
void function(VFile currentDir) { List<PartialUISuite> partialSuites = findIncludes(currentDir); if(includes != null) includes.clear(); partialSuites.forEach(this::importEnums); partialSuites.forEach(this::importResources); partialSuites.forEach(this::importFtlIncludes); partialSuites.forEach(this::importFtlMacros); partialSuites.forEach(this::importFtlFunctions); partialSuites.forEach(this::importFtlImports); partialSuites.forEach(p -> importTemplatesToMap(p.getTemplates())); importTemplatesToMap(templates); updateTemplateList(); partialSuites.forEach(p -> importControlsToMap(p.getControls())); importControlsToMap(controls); updateControlList(); }
/** * Proccess the partial UI suites includes for this object. * * @param currentDir The current dir for the includes. */
Proccess the partial UI suites includes for this object
processIncludes
{ "repo_name": "bridje/bridje-framework", "path": "bridje-web-srcgen/src/main/java/org/bridje/web/srcgen/uisuite/UISuiteBase.java", "license": "apache-2.0", "size": 15472 }
[ "java.util.List", "org.bridje.vfs.VFile" ]
import java.util.List; import org.bridje.vfs.VFile;
import java.util.*; import org.bridje.vfs.*;
[ "java.util", "org.bridje.vfs" ]
java.util; org.bridje.vfs;
189,568
public ActionForward deleteFinancialEntityAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FinancialEntityForm financialEntityForm = (FinancialEntityForm) form; int selectedLine = getSelectedLine(request); financialEntityForm.getFinancialEntityHelper().removeNewFinancialEntityAttachment(selectedLine); return mapping.findForward(Constants.MAPPING_BASIC); }
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FinancialEntityForm financialEntityForm = (FinancialEntityForm) form; int selectedLine = getSelectedLine(request); financialEntityForm.getFinancialEntityHelper().removeNewFinancialEntityAttachment(selectedLine); return mapping.findForward(Constants.MAPPING_BASIC); }
/** * Method called when deleting an attachment from a Financial Entity. * * @param mapping * @param form * @param request * @param response= * @return * @throws Exception */
Method called when deleting an attachment from a Financial Entity
deleteFinancialEntityAttachment
{ "repo_name": "blackcathacker/kc.preclean", "path": "coeus-code/src/main/java/org/kuali/kra/coi/personfinancialentity/FinancialEntityEditNewAction.java", "license": "apache-2.0", "size": 7667 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.kuali.kra.infrastructure.Constants" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.kra.infrastructure.Constants;
import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.kra.infrastructure.*;
[ "javax.servlet", "org.apache.struts", "org.kuali.kra" ]
javax.servlet; org.apache.struts; org.kuali.kra;
2,050,548
void shutdown() throws InterruptedException { channel.shutdown().awaitTermination(5, TimeUnit.SECONDS); }
void shutdown() throws InterruptedException { channel.shutdown().awaitTermination(5, TimeUnit.SECONDS); }
/** * Safely terminate the connection to the server. */
Safely terminate the connection to the server
shutdown
{ "repo_name": "graphflow/graphflow", "path": "src/main/java/ca/waterloo/dsg/graphflow/client/cli/GraphflowCli.java", "license": "apache-2.0", "size": 4081 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,788,203
public void sendWorkflowNotification(WorkflowDocument workflowDocument, String annotation, List<AdHocRouteRecipient> adHocRecipients, String notificationLabel) throws WorkflowException;
void function(WorkflowDocument workflowDocument, String annotation, List<AdHocRouteRecipient> adHocRecipients, String notificationLabel) throws WorkflowException;
/** * Sends workflow notification to the list of ad hoc recipients. This method is usually used to * notify users of a note that has been added to a document. The notificationLabel parameter is * used to give the request a custom label in the user's Action List * * @param workflowDocument * @param annotation * @param adHocRecipients * @param notificationLabel * @throws WorkflowException */
Sends workflow notification to the list of ad hoc recipients. This method is usually used to notify users of a note that has been added to a document. The notificationLabel parameter is used to give the request a custom label in the user's Action List
sendWorkflowNotification
{ "repo_name": "ua-eas/ua-rice-2.1.9", "path": "krad/krad-web-framework/src/main/java/org/kuali/rice/krad/workflow/service/WorkflowDocumentService.java", "license": "apache-2.0", "size": 10974 }
[ "java.util.List", "org.kuali.rice.kew.api.WorkflowDocument", "org.kuali.rice.kew.api.exception.WorkflowException", "org.kuali.rice.krad.bo.AdHocRouteRecipient" ]
import java.util.List; import org.kuali.rice.kew.api.WorkflowDocument; import org.kuali.rice.kew.api.exception.WorkflowException; import org.kuali.rice.krad.bo.AdHocRouteRecipient;
import java.util.*; import org.kuali.rice.kew.api.*; import org.kuali.rice.kew.api.exception.*; import org.kuali.rice.krad.bo.*;
[ "java.util", "org.kuali.rice" ]
java.util; org.kuali.rice;
2,473,985
@Override public ValuedAction actionSelection(AgentModel am) { Intention i = null; ActiveEmotion fear; ActiveEmotion hope; IPlanningOperator copingAction; _selectedActionEmotion = null; _selectedAction = null; _selectedPlan = null; _options.clear(); //forget old intentions that are not brought into attention for(Intention intention : _intentions.values()) { if(intention.isForgotten()) { AgentLogger.GetInstance().logAndPrint("Removing forgotten intention " + intention.getGoal().getName()); removeIntention(intention); //remove one forgotten intention at a time, or else the for will crash break; } } for (IOptionsStrategy strategy : _optionStrategies) { _options.addAll(strategy.options(am)); } // deliberation; ActivePursuitGoal g = filter(am, this._options); if (g != null) { addIntention(am, g); } // means-end reasoning _currentIntention = filter2ndLevel(am); if (_currentIntention != null) { i = _currentIntention.GetSubIntention(); _currentIntention.FocusAttention(); // ok, this needs some explaining. If you pay close attention to the following // code u'll see that if an intention has no available plans (i.e. // failed), I will not remove the intention unless it has been strongly committed. // This is intended. If not strongly committed the intention needs to stay in the list // of current intentions. This is because if we would remove it, the agent would immediately select the intention // again not knowing that he would fail to create a plan for it. So // he needs to remember that the intention is not feasible. What we should do latter is to // remove the intention from memory after some significant time has passed, or if a maximum number of // stored intentions is reached if (i.getGoal().CheckSuccess(am)) { removeIntention(i); if(i.IsStrongCommitment()) { for (IGoalSuccessStrategy s : _goalSuccessStrategies) { s.perceiveGoalSuccess(am, i.getGoal()); } i.ProcessIntentionSuccess(am); cancelAction(am); } return null; } else if (i.getGoal().CheckFailure(am)) { removeIntention(i); if(i.IsStrongCommitment()) { for (IGoalFailureStrategy s : _goalFailureStrategies) { s.perceiveGoalFailure(am, i.getGoal()); } i.ProcessIntentionFailure(am); cancelAction(am); } return null; } else if (i.NumberOfAlternativePlans() == 0) { AgentLogger.GetInstance().logAndPrint("no plans found for the intention"); _currentIntention = null; if(i.IsStrongCommitment()) { removeIntention(i); for (IGoalFailureStrategy s : _goalFailureStrategies) { s.perceiveGoalFailure(am, i.getGoal()); } i.ProcessIntentionFailure(am); cancelAction(am); } return null; } else if(i.getGoal().CheckCanceling(am)) { //the agent cancels the goal out //if the cancel conditions are verified if(i.IsStrongCommitment()) { i.ProcessIntentionCancel(am); cancelAction(am); } removeIntention(i); } else { _selectedPlan = _planner.ThinkAbout(am, this, i); } // A plan does not have open preconditions nor any steps. This means // that the plan was succesfully // achieved if (_selectedPlan != null && _selectedPlan.getOpenPreconditions().size() == 0 && _selectedPlan.getStaticPreconditions().size() == 0 && _selectedPlan.getSteps().size() == 0) { removeIntention(i); if(i.IsStrongCommitment()) { for (IGoalSuccessStrategy s : _goalSuccessStrategies) { s.perceiveGoalSuccess(am, i.getGoal()); } i.ProcessIntentionSuccess(am); cancelAction(am); } return null; } if (_actionMonitor == null && _selectedPlan != null) { AgentLogger.GetInstance().logAndPrint("Plan Finished: " + _selectedPlan.toString()); copingAction = _selectedPlan.UnexecutedAction(am); if (copingAction != null) { if (!i.IsStrongCommitment()) { AgentLogger.GetInstance().log("Plan Commited: " + _selectedPlan.toString()); i.SetStrongCommitment(am); i.ProcessIntentionActivation(am); } String actionName = copingAction.getName().GetFirstLiteral().toString(); if (copingAction instanceof ActivePursuitGoal) { addSubIntention(am, _currentIntention,(ActivePursuitGoal) copingAction); } else if (!actionName.startsWith("Inference") && !actionName.startsWith("SA")) { fear = i.GetFear(am.getEmotionalState()); hope = i.GetHope(am.getEmotionalState()); if (hope != null) { if (fear != null) { if (hope.GetIntensity() >= fear.GetIntensity()) { _selectedActionEmotion = hope; } else { _selectedActionEmotion = fear; } } else { _selectedActionEmotion = hope; } } else { _selectedActionEmotion = fear; } _selectedAction = (Step) copingAction; AgentLogger.GetInstance().log( "Selecting Action: " + _selectedAction.toString() + "from plan:" + _selectedPlan.toString()); } else if (actionName.startsWith("SA")) { Effect eff; for (ListIterator<Effect> li = copingAction.getEffects().listIterator(); li.hasNext();) { eff = (Effect) li.next(); if (eff.isGrounded()) am.getMemory().getSemanticMemory().Tell(true,eff.GetEffect().getName(),eff.GetEffect().getValue().toString()); } this.checkLinks(am); } else { // this should never be selected // System.out.println("InferenceOperator selected for execution"); } } else { // If a complete plan does not have a valid next action to // execute (ex: the next // action to execute by self contains unboundvariables), // it means that the plan cannot be executed, and the plan // must be removed i.RemovePlan(_selectedPlan); AgentLogger.GetInstance().logAndPrint( "Plan with invalid next action removed!"); } } } return getSelectedAction(); }
ValuedAction function(AgentModel am) { Intention i = null; ActiveEmotion fear; ActiveEmotion hope; IPlanningOperator copingAction; _selectedActionEmotion = null; _selectedAction = null; _selectedPlan = null; _options.clear(); for(Intention intention : _intentions.values()) { if(intention.isForgotten()) { AgentLogger.GetInstance().logAndPrint(STR + intention.getGoal().getName()); removeIntention(intention); break; } } for (IOptionsStrategy strategy : _optionStrategies) { _options.addAll(strategy.options(am)); } ActivePursuitGoal g = filter(am, this._options); if (g != null) { addIntention(am, g); } _currentIntention = filter2ndLevel(am); if (_currentIntention != null) { i = _currentIntention.GetSubIntention(); _currentIntention.FocusAttention(); if (i.getGoal().CheckSuccess(am)) { removeIntention(i); if(i.IsStrongCommitment()) { for (IGoalSuccessStrategy s : _goalSuccessStrategies) { s.perceiveGoalSuccess(am, i.getGoal()); } i.ProcessIntentionSuccess(am); cancelAction(am); } return null; } else if (i.getGoal().CheckFailure(am)) { removeIntention(i); if(i.IsStrongCommitment()) { for (IGoalFailureStrategy s : _goalFailureStrategies) { s.perceiveGoalFailure(am, i.getGoal()); } i.ProcessIntentionFailure(am); cancelAction(am); } return null; } else if (i.NumberOfAlternativePlans() == 0) { AgentLogger.GetInstance().logAndPrint(STR); _currentIntention = null; if(i.IsStrongCommitment()) { removeIntention(i); for (IGoalFailureStrategy s : _goalFailureStrategies) { s.perceiveGoalFailure(am, i.getGoal()); } i.ProcessIntentionFailure(am); cancelAction(am); } return null; } else if(i.getGoal().CheckCanceling(am)) { if(i.IsStrongCommitment()) { i.ProcessIntentionCancel(am); cancelAction(am); } removeIntention(i); } else { _selectedPlan = _planner.ThinkAbout(am, this, i); } if (_selectedPlan != null && _selectedPlan.getOpenPreconditions().size() == 0 && _selectedPlan.getStaticPreconditions().size() == 0 && _selectedPlan.getSteps().size() == 0) { removeIntention(i); if(i.IsStrongCommitment()) { for (IGoalSuccessStrategy s : _goalSuccessStrategies) { s.perceiveGoalSuccess(am, i.getGoal()); } i.ProcessIntentionSuccess(am); cancelAction(am); } return null; } if (_actionMonitor == null && _selectedPlan != null) { AgentLogger.GetInstance().logAndPrint(STR + _selectedPlan.toString()); copingAction = _selectedPlan.UnexecutedAction(am); if (copingAction != null) { if (!i.IsStrongCommitment()) { AgentLogger.GetInstance().log(STR + _selectedPlan.toString()); i.SetStrongCommitment(am); i.ProcessIntentionActivation(am); } String actionName = copingAction.getName().GetFirstLiteral().toString(); if (copingAction instanceof ActivePursuitGoal) { addSubIntention(am, _currentIntention,(ActivePursuitGoal) copingAction); } else if (!actionName.startsWith(STR) && !actionName.startsWith("SA")) { fear = i.GetFear(am.getEmotionalState()); hope = i.GetHope(am.getEmotionalState()); if (hope != null) { if (fear != null) { if (hope.GetIntensity() >= fear.GetIntensity()) { _selectedActionEmotion = hope; } else { _selectedActionEmotion = fear; } } else { _selectedActionEmotion = hope; } } else { _selectedActionEmotion = fear; } _selectedAction = (Step) copingAction; AgentLogger.GetInstance().log( STR + _selectedAction.toString() + STR + _selectedPlan.toString()); } else if (actionName.startsWith("SA")) { Effect eff; for (ListIterator<Effect> li = copingAction.getEffects().listIterator(); li.hasNext();) { eff = (Effect) li.next(); if (eff.isGrounded()) am.getMemory().getSemanticMemory().Tell(true,eff.GetEffect().getName(),eff.GetEffect().getValue().toString()); } this.checkLinks(am); } else { } } else { i.RemovePlan(_selectedPlan); AgentLogger.GetInstance().logAndPrint( STR); } } } return getSelectedAction(); }
/** * Deliberative Coping process. Gets the most relevant intention, thinks * about it for one reasoning cycle (planning) and if possible selects an * action for execution. */
Deliberative Coping process. Gets the most relevant intention, thinks about it for one reasoning cycle (planning) and if possible selects an action for execution
actionSelection
{ "repo_name": "nurv/lirec", "path": "AgentMind/branches/FAtiMA-Modular/FAtiMA.DeliberativeComponent/src/FAtiMA/DeliberativeComponent/DeliberativeComponent.java", "license": "gpl-3.0", "size": 49208 }
[ "java.util.ListIterator" ]
import java.util.ListIterator;
import java.util.*;
[ "java.util" ]
java.util;
722,425
List<T> getDependencies();
List<T> getDependencies();
/** * Returns the list of nodes on which this node * depends. * * @return List of dependency nodes. */
Returns the list of nodes on which this node depends
getDependencies
{ "repo_name": "jarney/snackbot", "path": "src/main/java/org/ensor/algorithms/toposort/INode.java", "license": "mit", "size": 1828 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,610,652
public void run(String[] args) throws BadArgs, Fault, IOException { File testSuite = null; String finder = null; String[] finderArgs = null; File outFile = null; File initialFile = null; for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase("-finder") && (i + 1 < args.length)) { finder = args[++i]; int j = ++i; while ((i < args.length - 1) && !(args[i].equalsIgnoreCase("-end"))) ++i; finderArgs = new String[i - j]; System.arraycopy(args, j, finderArgs, 0, finderArgs.length); } else if (args[i].equalsIgnoreCase("-initial") && (i + 1 < args.length)) { initialFile = new File(args[++i]); } else if (args[i].equalsIgnoreCase("-o") && (i + 1 < args.length)) { outFile = new File(args[++i]); } else if (args[i].equalsIgnoreCase("-nodes")) { nodes = true; } else if (args[i].equalsIgnoreCase("-fulltests")) { fullTests = true; } else if (args[i].startsWith("-") ) { throw new BadArgs(args[i]); } else testSuite = new File(args[i]); } if (finder == null) throw new BadArgs("no test finder specified"); if (testSuite == null) throw new BadArgs("testsuite.html file not specified"); testFinder = initializeTestFinder(finder, finderArgs, testSuite); if (initialFile == null) initialFile = testFinder.getRoot(); // equals testSuite, adjusted by finder as necessary .. e.g. for dirWalk, webWalk etc if (outFile == null) out = System.out; else out = new PrintStream(new BufferedOutputStream(new FileOutputStream(outFile))); // read the tests and write them to output list(initialFile); } //------------------------------------------------------------------------------------------
void function(String[] args) throws BadArgs, Fault, IOException { File testSuite = null; String finder = null; String[] finderArgs = null; File outFile = null; File initialFile = null; for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase(STR) && (i + 1 < args.length)) { finder = args[++i]; int j = ++i; while ((i < args.length - 1) && !(args[i].equalsIgnoreCase("-end"))) ++i; finderArgs = new String[i - j]; System.arraycopy(args, j, finderArgs, 0, finderArgs.length); } else if (args[i].equalsIgnoreCase(STR) && (i + 1 < args.length)) { initialFile = new File(args[++i]); } else if (args[i].equalsIgnoreCase("-o") && (i + 1 < args.length)) { outFile = new File(args[++i]); } else if (args[i].equalsIgnoreCase(STR)) { nodes = true; } else if (args[i].equalsIgnoreCase(STR)) { fullTests = true; } else if (args[i].startsWith("-") ) { throw new BadArgs(args[i]); } else testSuite = new File(args[i]); } if (finder == null) throw new BadArgs(STR); if (testSuite == null) throw new BadArgs(STR); testFinder = initializeTestFinder(finder, finderArgs, testSuite); if (initialFile == null) initialFile = testFinder.getRoot(); if (outFile == null) out = System.out; else out = new PrintStream(new BufferedOutputStream(new FileOutputStream(outFile))); list(initialFile); }
/** * Main work method. * Reads all the arguments on the command line, makes sure a valid * testFinder is available, and then calls methods to create the tree of tests * and then write the binary file. * * @param args An array of strings, typically provided via the command line * @throws ShowTests.BadArgs * if a problem is found in the arguments provided * @throws ShowTests.Fault * if a fault is found while running * @throws IOException * if a problem is found while trying to read a file * @see #main */
Main work method. Reads all the arguments on the command line, makes sure a valid testFinder is available, and then calls methods to create the tree of tests and then write the binary file
run
{ "repo_name": "Distrotech/icedtea7", "path": "test/jtreg/com/sun/javatest/finder/ShowTests.java", "license": "gpl-2.0", "size": 10755 }
[ "java.io.BufferedOutputStream", "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.io.PrintStream" ]
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream;
import java.io.*;
[ "java.io" ]
java.io;
1,401,494
RowMetaInterface getIncomingFields();
RowMetaInterface getIncomingFields();
/** * Get the incoming fields * * @return the incoming fields */
Get the incoming fields
getIncomingFields
{ "repo_name": "akhayrutdinov/big-data-plugin", "path": "src/org/pentaho/hbase/mapping/FieldProducer.java", "license": "apache-2.0", "size": 1301 }
[ "org.pentaho.di.core.row.RowMetaInterface" ]
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.core.row.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,269,471
@Override public void hasBeenUnpublished(String connectionIdentifier) { Log.Info(this,"bye "+name); }
void function(String connectionIdentifier) { Log.Info(this,STR+name); }
/** * interface RemotedActor, session time out notification callback * @param connectionIdentifier * */
interface RemotedActor, session time out notification callback
hasBeenUnpublished
{ "repo_name": "RuedigerMoeller/kontraktor", "path": "examples/webapp-spa/misc/servlet/react-intrinsic-minimal-servlet/src/main/java/reactinstrinsic/servlet/ReactServletSession.java", "license": "lgpl-3.0", "size": 797 }
[ "org.nustaq.kontraktor.util.Log" ]
import org.nustaq.kontraktor.util.Log;
import org.nustaq.kontraktor.util.*;
[ "org.nustaq.kontraktor" ]
org.nustaq.kontraktor;
626,599
public static ComponentUI createUI(JComponent c) { if (sharedUI == null) sharedUI = new MetalButtonUI(); return sharedUI; } public MetalButtonUI() { super(); }
static ComponentUI function(JComponent c) { if (sharedUI == null) sharedUI = new MetalButtonUI(); return sharedUI; } public MetalButtonUI() { super(); }
/** * Returns a UI delegate for the specified component. * * @param c the component (should be a subclass of {@link AbstractButton}). * * @return A new instance of <code>MetalButtonUI</code>. */
Returns a UI delegate for the specified component
createUI
{ "repo_name": "taciano-perez/JamVM-PH", "path": "src/classpath/javax/swing/plaf/metal/MetalButtonUI.java", "license": "gpl-2.0", "size": 8643 }
[ "javax.swing.JComponent", "javax.swing.plaf.ComponentUI" ]
import javax.swing.JComponent; import javax.swing.plaf.ComponentUI;
import javax.swing.*; import javax.swing.plaf.*;
[ "javax.swing" ]
javax.swing;
201,131
if (vertex.property(Schema.VertexProperty.THING_TYPE_LABEL_ID.name()).isPresent()) { return LabelId.of(vertex.value(Schema.VertexProperty.THING_TYPE_LABEL_ID.name())); } return LabelId.invalid(); }
if (vertex.property(Schema.VertexProperty.THING_TYPE_LABEL_ID.name()).isPresent()) { return LabelId.of(vertex.value(Schema.VertexProperty.THING_TYPE_LABEL_ID.name())); } return LabelId.invalid(); }
/** * The Grakn type property on a given Tinkerpop vertex. * If the vertex is a {@link SchemaConcept}, return invalid {@link Label}. * * @param vertex the Tinkerpop vertex * @return the type */
The Grakn type property on a given Tinkerpop vertex. If the vertex is a <code>SchemaConcept</code>, return invalid <code>Label</code>
getVertexTypeId
{ "repo_name": "burukuru/grakn", "path": "grakn-graql/src/main/java/ai/grakn/graql/internal/analytics/Utility.java", "license": "gpl-3.0", "size": 5357 }
[ "ai.grakn.concept.LabelId", "ai.grakn.util.Schema" ]
import ai.grakn.concept.LabelId; import ai.grakn.util.Schema;
import ai.grakn.concept.*; import ai.grakn.util.*;
[ "ai.grakn.concept", "ai.grakn.util" ]
ai.grakn.concept; ai.grakn.util;
46,300
protected boolean needTagInQuery(I queryInstance) { boolean needed = StringUtils.isNotBlank(queryInstance.getTagPrefix()) || !queryInstance.getUserTagIds().isEmpty(); return needed; }
boolean function(I queryInstance) { boolean needed = StringUtils.isNotBlank(queryInstance.getTagPrefix()) !queryInstance.getUserTagIds().isEmpty(); return needed; }
/** * Whether the tag entity is needed in the query. * * @param queryInstance * the current query instance * @return true if the query returns tags or the result is filtered by a tag prefix or a single * tag */
Whether the tag entity is needed in the query
needTagInQuery
{ "repo_name": "Communote/communote-server", "path": "communote/persistence/src/main/java/com/communote/server/core/vo/query/user/AbstractUserQuery.java", "license": "apache-2.0", "size": 23638 }
[ "org.apache.commons.lang.StringUtils" ]
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
1,297,600
public boolean getColision(Rectangle colision) { return this.colision.intersects(colision); }
boolean function(Rectangle colision) { return this.colision.intersects(colision); }
/** * Test if square colide with another square * * @param colision rectangle to be tested * @return */
Test if square colide with another square
getColision
{ "repo_name": "aenniw/TetrominGenerator", "path": "src/cz/fi/muni/pv097/CoreComponents/TetroSquare.java", "license": "gpl-2.0", "size": 6571 }
[ "java.awt.Rectangle" ]
import java.awt.Rectangle;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,100,489
@Override public StreamObserver<Point> recordRoute(final StreamObserver<RouteSummary> responseObserver) { return new StreamObserver<Point>() { int pointCount; int featureCount; int distance; Point previous; long startTime = System.nanoTime();
StreamObserver<Point> function(final StreamObserver<RouteSummary> responseObserver) { return new StreamObserver<Point>() { int pointCount; int featureCount; int distance; Point previous; long startTime = System.nanoTime();
/** * Gets a stream of points, and responds with statistics about the "trip": number of points, * number of known features visited, total distance traveled, and total time spent. * * @param responseObserver an observer to receive the response summary. * @return an observer to receive the requested route points. */
Gets a stream of points, and responds with statistics about the "trip": number of points, number of known features visited, total distance traveled, and total time spent
recordRoute
{ "repo_name": "jiakuan/grpc-sample", "path": "src/main/java/io/grpc/sample/routeguide/RouteGuideServer.java", "license": "apache-2.0", "size": 11458 }
[ "io.grpc.stub.StreamObserver" ]
import io.grpc.stub.StreamObserver;
import io.grpc.stub.*;
[ "io.grpc.stub" ]
io.grpc.stub;
2,156,935
public void dataNodeChildAdded(ArbilNode destination, ArbilNode newNode) { // Nothing to do }
void function(ArbilNode destination, ArbilNode newNode) { }
/** * A new child node has been added to the destination node * * @param destination Node to which a node has been added * @param newNode The newly added node */
A new child node has been added to the destination node
dataNodeChildAdded
{ "repo_name": "TheLanguageArchive/Arbil", "path": "arbil/src/main/java/nl/mpi/arbil/ui/ArbilTableModel.java", "license": "agpl-3.0", "size": 20549 }
[ "nl.mpi.arbil.data.ArbilNode" ]
import nl.mpi.arbil.data.ArbilNode;
import nl.mpi.arbil.data.*;
[ "nl.mpi.arbil" ]
nl.mpi.arbil;
569,136
String url = this.eventsUrl + collection; String eventJSON = event.getEventJSON(); Request request = this.generatePostRequest(url, eventJSON); Response response = null; try { response = client.newCall(request).execute(); } catch (IOException e) { throw new ConnectException(e); } if (!response.isSuccessful()) { throw ConnectAPI.getExceptionForResponse(response); } }
String url = this.eventsUrl + collection; String eventJSON = event.getEventJSON(); Request request = this.generatePostRequest(url, eventJSON); Response response = null; try { response = client.newCall(request).execute(); } catch (IOException e) { throw new ConnectException(e); } if (!response.isSuccessful()) { throw ConnectAPI.getExceptionForResponse(response); } }
/** * Pushes a single event to the Connect API synchronously. * @param collection The name of the collection to push to. * @param event The {@link Event} to send. * @throws ConnectException When an error occurs. * Will be {@link InvalidEventException}, {@Link ServerException} * or a generic {@link ConnectException} with an inner exception. */
Pushes a single event to the Connect API synchronously
pushEvent
{ "repo_name": "getconnect/connect-java", "path": "core/src/main/java/io/getconnect/client/ConnectAPI.java", "license": "mit", "size": 10481 }
[ "com.squareup.okhttp.Request", "com.squareup.okhttp.Response", "io.getconnect.client.exceptions.ConnectException", "java.io.IOException" ]
import com.squareup.okhttp.Request; import com.squareup.okhttp.Response; import io.getconnect.client.exceptions.ConnectException; import java.io.IOException;
import com.squareup.okhttp.*; import io.getconnect.client.exceptions.*; import java.io.*;
[ "com.squareup.okhttp", "io.getconnect.client", "java.io" ]
com.squareup.okhttp; io.getconnect.client; java.io;
1,885,019
@javax.annotation.Nullable @ApiModelProperty( value = "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.") public Boolean getReadOnly() { return readOnly; }
@javax.annotation.Nullable @ApiModelProperty( value = STR) Boolean function() { return readOnly; }
/** * Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. * * @return readOnly */
Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts
getReadOnly
{ "repo_name": "kubernetes-client/java", "path": "client-java-contrib/prometheus-operator/src/main/java/com/coreos/monitoring/models/V1ThanosRulerSpecScaleIO.java", "license": "apache-2.0", "size": 10770 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
146,387
protected void removeFeedbackVersionElements(Document doc) throws XPathExpressionException { final String xpath = "/io:openimmo_feedback/io:version"; XmlUtils.xPathElementsProcess(XmlUtils.xPath(xpath, doc, "io"), doc, (element) -> element.getParentNode().removeChild(element)); }
void function(Document doc) throws XPathExpressionException { final String xpath = STR; XmlUtils.xPathElementsProcess(XmlUtils.xPath(xpath, doc, "io"), doc, (element) -> element.getParentNode().removeChild(element)); }
/** * Remove &lt;version&gt; elements in feedback XML. * <p> * OpenImmo 1.2.3 does not support &lt;version&gt; elements in feedback XML. * * @param doc OpenImmo document in version 1.2.4 * @throws XPathExpressionException if xpath evaluation failed */
Remove &lt;version&gt; elements in feedback XML. OpenImmo 1.2.3 does not support &lt;version&gt; elements in feedback XML
removeFeedbackVersionElements
{ "repo_name": "OpenEstate/OpenEstate-IO", "path": "OpenImmo/src/main/java/org/openestate/io/openimmo/converters/OpenImmo_1_2_4.java", "license": "apache-2.0", "size": 22636 }
[ "javax.xml.xpath.XPathExpressionException", "org.openestate.io.core.XmlUtils", "org.w3c.dom.Document" ]
import javax.xml.xpath.XPathExpressionException; import org.openestate.io.core.XmlUtils; import org.w3c.dom.Document;
import javax.xml.xpath.*; import org.openestate.io.core.*; import org.w3c.dom.*;
[ "javax.xml", "org.openestate.io", "org.w3c.dom" ]
javax.xml; org.openestate.io; org.w3c.dom;
2,421,641
boolean restartVpc(long id, boolean cleanUp) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
boolean restartVpc(long id, boolean cleanUp) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
/** * Restarts the VPC. VPC gets shutdown and started as a part of it * * @param id * @param cleanUp * @return * @throws InsufficientCapacityException */
Restarts the VPC. VPC gets shutdown and started as a part of it
restartVpc
{ "repo_name": "MissionCriticalCloud/cosmic", "path": "cosmic-core/api/src/main/java/com/cloud/network/vpc/VpcService.java", "license": "apache-2.0", "size": 8625 }
[ "com.cloud.legacymodel.exceptions.ConcurrentOperationException", "com.cloud.legacymodel.exceptions.InsufficientCapacityException", "com.cloud.legacymodel.exceptions.ResourceUnavailableException" ]
import com.cloud.legacymodel.exceptions.ConcurrentOperationException; import com.cloud.legacymodel.exceptions.InsufficientCapacityException; import com.cloud.legacymodel.exceptions.ResourceUnavailableException;
import com.cloud.legacymodel.exceptions.*;
[ "com.cloud.legacymodel" ]
com.cloud.legacymodel;
2,636,242
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "booleanF", "(" + OBJECT_SIG + ")Z"); il.append(new INVOKESTATIC(index)); }
void function(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, STR, "(" + OBJECT_SIG + ")Z"); il.append(new INVOKESTATIC(index)); }
/** * Translates a reference to an object of internal type <code>type</code>. * * @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo */
Translates a reference to an object of internal type <code>type</code>
translateTo
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ReferenceType.java", "license": "mit", "size": 15093 }
[ "com.sun.org.apache.bcel.internal.generic.ConstantPoolGen", "com.sun.org.apache.bcel.internal.generic.InstructionList" ]
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import com.sun.org.apache.bcel.internal.generic.InstructionList;
import com.sun.org.apache.bcel.internal.generic.*;
[ "com.sun.org" ]
com.sun.org;
2,595,599
public void setSelectedStockHistory(List<HistoricalQuote> selectedStockHistory){ List<HistoricalQuote> oldValue = null; synchronized(this){ oldValue = this.selectedStockHistory; this.selectedStockHistory = selectedStockHistory; } firePropertyChange(SELECTED_STOCK_HISTORY_PROPERTY, oldValue, selectedStockHistory); }
void function(List<HistoricalQuote> selectedStockHistory){ List<HistoricalQuote> oldValue = null; synchronized(this){ oldValue = this.selectedStockHistory; this.selectedStockHistory = selectedStockHistory; } firePropertyChange(SELECTED_STOCK_HISTORY_PROPERTY, oldValue, selectedStockHistory); }
/** * Sets the history of the selected and displayed stock. This is a bound * property, and a <tt>PropertyChangeEvent</tt> is fired when it is * changed. * * @param selectedStockHistory the history of the selected and displayed stock. */
Sets the history of the selected and displayed stock. This is a bound property, and a PropertyChangeEvent is fired when it is changed
setSelectedStockHistory
{ "repo_name": "craigmiller160/StockMarket-2.0", "path": "src/main/java/io/craigmiller160/stockmarket/model/StockDisplayModel.java", "license": "apache-2.0", "size": 3585 }
[ "io.craigmiller160.stockmarket.stock.HistoricalQuote", "java.util.List" ]
import io.craigmiller160.stockmarket.stock.HistoricalQuote; import java.util.List;
import io.craigmiller160.stockmarket.stock.*; import java.util.*;
[ "io.craigmiller160.stockmarket", "java.util" ]
io.craigmiller160.stockmarket; java.util;
601,555
@Test public void testGetName() { assertEquals("Termek", products.getName()); }
void function() { assertEquals(STR, products.getName()); }
/** * Test getter of product's name. */
Test getter of product's name
testGetName
{ "repo_name": "firstvan/OrderTaker", "path": "model/src/test/java/hu/firstvan/model/ProductsTest.java", "license": "gpl-3.0", "size": 5768 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,071,469
@Override public ElementGrouping getChild() { return null; }
ElementGrouping function() { return null; }
/** * TODO summary sentence for getChild ... * * @see org.geotools.xml.schema.ComplexType#getChild() */
TODO summary sentence for getChild ..
getChild
{ "repo_name": "geotools/geotools", "path": "modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java", "license": "lgpl-2.1", "size": 82167 }
[ "org.geotools.xml.schema.ElementGrouping" ]
import org.geotools.xml.schema.ElementGrouping;
import org.geotools.xml.schema.*;
[ "org.geotools.xml" ]
org.geotools.xml;
220,756
@SuppressWarnings("rawtypes") private void calculateWidthsForGlue(List figures, int availableWidth, int[] widths) { int glueIndex = -1; int totalUsedWidths = 0; for (int i = 0; i < figures.size(); ++i) { IWidgetFigure wf = (IWidgetFigure) figures.get(i); // glueIndex == -1 is used to ensure that, in the event that there // are two Glues the first Glue is chosen if (wf instanceof Glue && glueIndex == -1) { glueIndex = i; } else { int w = wf.getMinWidth(); widths[i] = w; totalUsedWidths += w; } } // Now allocate the space to the Glue widths[glueIndex] = availableWidth - totalUsedWidths; }
@SuppressWarnings(STR) void function(List figures, int availableWidth, int[] widths) { int glueIndex = -1; int totalUsedWidths = 0; for (int i = 0; i < figures.size(); ++i) { IWidgetFigure wf = (IWidgetFigure) figures.get(i); if (wf instanceof Glue && glueIndex == -1) { glueIndex = i; } else { int w = wf.getMinWidth(); widths[i] = w; totalUsedWidths += w; } } widths[glueIndex] = availableWidth - totalUsedWidths; }
/** * Calculate the widths when the widgets contains a Glue. * * @param figures * The List of figures to allocate the widths to * @param availableWidth * The amount of width which is available to the Widgets (in other words the total width minus the * spacings) * @param widths * The widths to be allocated. This array MUST have the same length as figures */
Calculate the widths when the widgets contains a Glue
calculateWidthsForGlue
{ "repo_name": "debabratahazra/DS", "path": "designstudio/components/page/ui/com.odcgroup.page.ui/src/main/java/com/odcgroup/page/ui/figure/HorizontalLayout.java", "license": "epl-1.0", "size": 25434 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
621,458
public static java.util.Set extractNursingClinicalNotesSet(ims.domain.ILightweightDomainFactory domainFactory, ims.nursing.vo.NursingClinicalNotesListVoCollection voCollection) { return extractNursingClinicalNotesSet(domainFactory, voCollection, null, new HashMap()); }
static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.nursing.vo.NursingClinicalNotesListVoCollection voCollection) { return extractNursingClinicalNotesSet(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.nursing.domain.objects.NursingClinicalNotes set from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.nursing.domain.objects.NursingClinicalNotes set from the value object collection
extractNursingClinicalNotesSet
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/nursing/vo/domain/NursingClinicalNotesListVoAssembler.java", "license": "agpl-3.0", "size": 17972 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,087,482
@Override public void runTest(Test test, TestResult result) { if (test instanceof DeviceTest) { DeviceTest deviceTest = (DeviceTest)test; deviceTest.setDevice(mDevice); deviceTest.setTestAppPath(mTestDataPath); } test.run(result); } /** * {@inheritDoc}
void function(Test test, TestResult result) { if (test instanceof DeviceTest) { DeviceTest deviceTest = (DeviceTest)test; deviceTest.setDevice(mDevice); deviceTest.setTestAppPath(mTestDataPath); } test.run(result); } /** * {@inheritDoc}
/** * Overrides parent method to pass in device and test app path to included test */
Overrides parent method to pass in device and test app path to included test
runTest
{ "repo_name": "rex-xxx/mt6572_x201", "path": "development/tools/hosttestlib/src/com/android/hosttest/DeviceTestSuite.java", "license": "gpl-2.0", "size": 2207 }
[ "junit.framework.Test", "junit.framework.TestResult" ]
import junit.framework.Test; import junit.framework.TestResult;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
287,335