method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private void changeNullnessOfValue(ValueNumber valueNumber, Location location, DefinitelyNullSet fact, NullnessValue nullnessValue) throws DataflowAnalysisException { // fact.setValue(valueNumber, isNull); // if (isNull) { // fact.addAssignedNullLocation(valueNumber.getNumber(), compactLocationNumbering.getNumber(location)); // } else { // fact.clearAssignNullLocations(valueNumber.getNumber()); // } fact.setNullnessValue(valueNumber, nullnessValue); if (fact.getNulllessValue(valueNumber) != nullnessValue) { throw new IllegalStateException(); } // TODO: set location where value becomes null or non-null }
void function(ValueNumber valueNumber, Location location, DefinitelyNullSet fact, NullnessValue nullnessValue) throws DataflowAnalysisException { fact.setNullnessValue(valueNumber, nullnessValue); if (fact.getNulllessValue(valueNumber) != nullnessValue) { throw new IllegalStateException(); } }
/** * Change the nullness of a value number. * * @param valueNumber the ValueNumber * @param location Location where information is gained * @param fact the DefinitelyNullSet to modify * @param nullnessValue the nullness of the value number * @throws DataflowAnalysisException */
Change the nullness of a value number
changeNullnessOfValue
{ "repo_name": "optivo-org/fingbugs-1.3.9-optivo", "path": "src/java/edu/umd/cs/findbugs/ba/npe2/DefinitelyNullSetAnalysis.java", "license": "lgpl-2.1", "size": 10357 }
[ "edu.umd.cs.findbugs.ba.DataflowAnalysisException", "edu.umd.cs.findbugs.ba.Location", "edu.umd.cs.findbugs.ba.vna.ValueNumber" ]
import edu.umd.cs.findbugs.ba.DataflowAnalysisException; import edu.umd.cs.findbugs.ba.Location; import edu.umd.cs.findbugs.ba.vna.ValueNumber;
import edu.umd.cs.findbugs.ba.*; import edu.umd.cs.findbugs.ba.vna.*;
[ "edu.umd.cs" ]
edu.umd.cs;
2,394,630
public TypeValuePair convertTo( final Type targetType, final TypeValuePair valuePair ) throws EvaluationException { if ( targetType.isFlagSet( Type.ARRAY_TYPE ) ) { if ( valuePair.getType().isFlagSet( Type.ARRAY_TYPE ) ) { return valuePair; } else if ( targetType.isFlagSet( Type.SEQUENCE_TYPE ) ) { return convertTo( targetType, valuePair ); } else { final Object o = valuePair.getValue(); if ( o != null && o.getClass().isArray() ) { return new TypeValuePair( targetType, convertToArray( valuePair.getType(), o ) ); } else { final Object retval = convertPlainToPlain( targetType, valuePair.getType(), valuePair.getValue() ); return new TypeValuePair( targetType, new ArrayConverterCallback( retval, targetType ) ); } } } else if ( targetType.isFlagSet( Type.SEQUENCE_TYPE ) ) { if ( valuePair.getType().isFlagSet( Type.ARRAY_TYPE ) ) { return convertToSequence( targetType, valuePair ); } else if ( targetType.isFlagSet( Type.SEQUENCE_TYPE ) ) { return valuePair; } else { final Object retval = convertPlainToPlain( targetType, valuePair.getType(), valuePair.getValue() ); final ArrayConverterCallback converterCallback = new ArrayConverterCallback( retval, targetType ); return convertToSequence( targetType, new TypeValuePair( AnyType.ANY_ARRAY, converterCallback ) ); } } // else scalar final Object value = valuePair.getValue(); final Object o = convertPlainToPlain( targetType, valuePair.getType(), value ); if ( value == o ) { return valuePair; } return new TypeValuePair( targetType, o ); }
TypeValuePair function( final Type targetType, final TypeValuePair valuePair ) throws EvaluationException { if ( targetType.isFlagSet( Type.ARRAY_TYPE ) ) { if ( valuePair.getType().isFlagSet( Type.ARRAY_TYPE ) ) { return valuePair; } else if ( targetType.isFlagSet( Type.SEQUENCE_TYPE ) ) { return convertTo( targetType, valuePair ); } else { final Object o = valuePair.getValue(); if ( o != null && o.getClass().isArray() ) { return new TypeValuePair( targetType, convertToArray( valuePair.getType(), o ) ); } else { final Object retval = convertPlainToPlain( targetType, valuePair.getType(), valuePair.getValue() ); return new TypeValuePair( targetType, new ArrayConverterCallback( retval, targetType ) ); } } } else if ( targetType.isFlagSet( Type.SEQUENCE_TYPE ) ) { if ( valuePair.getType().isFlagSet( Type.ARRAY_TYPE ) ) { return convertToSequence( targetType, valuePair ); } else if ( targetType.isFlagSet( Type.SEQUENCE_TYPE ) ) { return valuePair; } else { final Object retval = convertPlainToPlain( targetType, valuePair.getType(), valuePair.getValue() ); final ArrayConverterCallback converterCallback = new ArrayConverterCallback( retval, targetType ); return convertToSequence( targetType, new TypeValuePair( AnyType.ANY_ARRAY, converterCallback ) ); } } final Object value = valuePair.getValue(); final Object o = convertPlainToPlain( targetType, valuePair.getType(), value ); if ( value == o ) { return valuePair; } return new TypeValuePair( targetType, o ); }
/** * Checks whether the target type would accept the specified value object and value type.<br/> This method is called * for auto conversion of fonction parameters using the conversion type declared by the function metadata. * * @param targetType * @param valuePair * @noinspection ObjectEquality is tested at the end of the method for performance reasons only. We just want to * detect whether a new object has been created or not. */
Checks whether the target type would accept the specified value object and value type. This method is called for auto conversion of fonction parameters using the conversion type declared by the function metadata
convertTo
{ "repo_name": "mbatchelor/pentaho-reporting", "path": "libraries/libformula/src/main/java/org/pentaho/reporting/libraries/formula/typing/DefaultTypeRegistry.java", "license": "lgpl-2.1", "size": 24034 }
[ "org.pentaho.reporting.libraries.formula.EvaluationException", "org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair", "org.pentaho.reporting.libraries.formula.typing.coretypes.AnyType" ]
import org.pentaho.reporting.libraries.formula.EvaluationException; import org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair; import org.pentaho.reporting.libraries.formula.typing.coretypes.AnyType;
import org.pentaho.reporting.libraries.formula.*; import org.pentaho.reporting.libraries.formula.lvalues.*; import org.pentaho.reporting.libraries.formula.typing.coretypes.*;
[ "org.pentaho.reporting" ]
org.pentaho.reporting;
1,051,079
public int serializableBytes() { if (m_signatureBytes == null) { try { m_signatureBytes = m_signature.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return FIXED_PAYLOAD_LENGTH + (m_data != null ? m_data.remaining() : 0) + m_signatureBytes.length; }
int function() { if (m_signatureBytes == null) { try { m_signatureBytes = m_signature.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return FIXED_PAYLOAD_LENGTH + (m_data != null ? m_data.remaining() : 0) + m_signatureBytes.length; }
/** * Total bytes that would be used if serialized in its current state. * Does not include 4 byte length prefix that flattenToBuffer adds * @return byte count. */
Total bytes that would be used if serialized in its current state. Does not include 4 byte length prefix that flattenToBuffer adds
serializableBytes
{ "repo_name": "kobronson/cs-voltdb", "path": "src/frontend/org/voltdb/export/ExportProtoMessage.java", "license": "agpl-3.0", "size": 13508 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
541,922
public static String nodeListToString(NodeList nodeList) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); sb.append(nodeToString(node)); } return sb.toString(); }
static String function(NodeList nodeList) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); sb.append(nodeToString(node)); } return sb.toString(); }
/** * Converts the given {@link NodeList} to a {@link String}. */
Converts the given <code>NodeList</code> to a <code>String</code>
nodeListToString
{ "repo_name": "sgilda/windup", "path": "utils/src/main/java/org/jboss/windup/util/xml/XmlUtil.java", "license": "epl-1.0", "size": 6952 }
[ "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,096,810
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == INTENT_REQUEST_GET_IMAGES && resultCode == Activity.RESULT_OK) { ArrayList<Uri> image_uris = data.getParcelableArrayListExtra(ImagePickerActivity.EXTRA_IMAGE_URIS); for (int i = 0; i < image_uris.size(); i++) { imagesUri.add(image_uris.get(i).getPath()); } Toast.makeText(activity, R.string.toast_images_added, Toast.LENGTH_LONG).show(); morphToSquare(createPdf, integer(R.integer.mb_animation)); } }
void function(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == INTENT_REQUEST_GET_IMAGES && resultCode == Activity.RESULT_OK) { ArrayList<Uri> image_uris = data.getParcelableArrayListExtra(ImagePickerActivity.EXTRA_IMAGE_URIS); for (int i = 0; i < image_uris.size(); i++) { imagesUri.add(image_uris.get(i).getPath()); } Toast.makeText(activity, R.string.toast_images_added, Toast.LENGTH_LONG).show(); morphToSquare(createPdf, integer(R.integer.mb_animation)); } }
/** * Called after ImagePickerActivity is called * * @param requestCode REQUEST Code for opening ImagePickerActivity * @param resultCode result code of the process * @param data Data of the image selected */
Called after ImagePickerActivity is called
onActivityResult
{ "repo_name": "Azooz2014/Images-to-PDF", "path": "app/src/main/java/swati4star/createpdf/Home.java", "license": "gpl-3.0", "size": 14853 }
[ "android.app.Activity", "android.content.Intent", "android.net.Uri", "android.widget.Toast", "com.gun0912.tedpicker.ImagePickerActivity", "java.util.ArrayList" ]
import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.widget.Toast; import com.gun0912.tedpicker.ImagePickerActivity; import java.util.ArrayList;
import android.app.*; import android.content.*; import android.net.*; import android.widget.*; import com.gun0912.tedpicker.*; import java.util.*;
[ "android.app", "android.content", "android.net", "android.widget", "com.gun0912.tedpicker", "java.util" ]
android.app; android.content; android.net; android.widget; com.gun0912.tedpicker; java.util;
2,705,829
public XBeeLocalInterface getDestinationInterface() { return localInterface; }
XBeeLocalInterface function() { return localInterface; }
/** * Retrieves the the destination XBee local interface. * * @return The the destination interface. * * @see #setDestinationInterface(XBeeLocalInterface) * @see XBeeLocalInterface */
Retrieves the the destination XBee local interface
getDestinationInterface
{ "repo_name": "digidotcom/XBeeJavaLibrary", "path": "library/src/main/java/com/digi/xbee/api/packet/relay/UserDataRelayPacket.java", "license": "mpl-2.0", "size": 6871 }
[ "com.digi.xbee.api.models.XBeeLocalInterface" ]
import com.digi.xbee.api.models.XBeeLocalInterface;
import com.digi.xbee.api.models.*;
[ "com.digi.xbee" ]
com.digi.xbee;
599,156
private String makeHttpRequest(String token, String url, String item, String httpMethod, int expectedResponseCode) throws IOException { HttpURLConnection connection = (HttpURLConnection)(new URL(url)).openConnection() ; connection.setDoInput(true); connection.setDoOutput(true); // Set the properties of the connection: the http request method, the // content type and the authorization header connection.setRequestMethod(httpMethod); connection.setRequestProperty("Content-Type", "application/atom+xml"); connection.setRequestProperty("Authorization", "GoogleLogin auth=" + token); // Post the data item OutputStream outputStream = connection.getOutputStream(); outputStream.write(item.getBytes()); outputStream.close(); // Retrieve the output int responseCode = connection.getResponseCode(); if (responseCode == expectedResponseCode) { return toString(connection.getInputStream()); } else { throw new RuntimeException(toString(connection.getErrorStream())); } }
String function(String token, String url, String item, String httpMethod, int expectedResponseCode) throws IOException { HttpURLConnection connection = (HttpURLConnection)(new URL(url)).openConnection() ; connection.setDoInput(true); connection.setDoOutput(true); connection.setRequestMethod(httpMethod); connection.setRequestProperty(STR, STR); connection.setRequestProperty(STR, STR + token); OutputStream outputStream = connection.getOutputStream(); outputStream.write(item.getBytes()); outputStream.close(); int responseCode = connection.getResponseCode(); if (responseCode == expectedResponseCode) { return toString(connection.getInputStream()); } else { throw new RuntimeException(toString(connection.getErrorStream())); } }
/** * Make an Http request to <code>url</code>, using <code>httpMethod</code>, * post <code>item</code> and return the response. * * @param token authentication token obtained using <code>authenticate</code> * @param url the identifier of the item to update, which has the form * <code>ITEMS_URL + "/itemId"</code> * @param item the item to be posted via the request * @param httpMethod the httpMethod to use for posting (should be PUT or POST) * @param expectedResponseCode the response code returned in case of a * successful operation * @return the Google Base data API update response * @throws IOException if an I/O exception occurs while * creating/writing/reading the request */
Make an Http request to <code>url</code>, using <code>httpMethod</code>, post <code>item</code> and return the response
makeHttpRequest
{ "repo_name": "simonrrr/gdata-java-client", "path": "java/sample/gbase/basic/UpdateExample.java", "license": "apache-2.0", "size": 11715 }
[ "java.io.IOException", "java.io.OutputStream", "java.net.HttpURLConnection" ]
import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
2,802,917
public long[] getWheelRecipeIds() throws CouldNotGetDataException { long[] ids; int i = 0; SQLiteDatabase db = mDatabaseHelper.getReadableDatabase(); Cursor cursor = db.query(ChefBuddyContract.WheelRecipeTable.TABLE_NAME, null, null, null, null, null, null); ids = new long[cursor.getCount()]; try { while (cursor.moveToNext()) { long recipeId = getRecipeIdFromWheelRecipeCursor(cursor); ids[i] = recipeId; i++; } } finally { cursor.close(); } return ids; }
long[] function() throws CouldNotGetDataException { long[] ids; int i = 0; SQLiteDatabase db = mDatabaseHelper.getReadableDatabase(); Cursor cursor = db.query(ChefBuddyContract.WheelRecipeTable.TABLE_NAME, null, null, null, null, null, null); ids = new long[cursor.getCount()]; try { while (cursor.moveToNext()) { long recipeId = getRecipeIdFromWheelRecipeCursor(cursor); ids[i] = recipeId; i++; } } finally { cursor.close(); } return ids; }
/** * Returns the complete list of recipe IDs in the wheel_recipe table * @return An array of recipe IDs */
Returns the complete list of recipe IDs in the wheel_recipe table
getWheelRecipeIds
{ "repo_name": "abicelis/ChefBuddy", "path": "app/src/main/java/ve/com/abicelis/chefbuddy/database/ChefBuddyDAO.java", "license": "mit", "size": 66206 }
[ "android.database.Cursor", "android.database.sqlite.SQLiteDatabase" ]
import android.database.Cursor; import android.database.sqlite.SQLiteDatabase;
import android.database.*; import android.database.sqlite.*;
[ "android.database" ]
android.database;
700,240
super.validationTest(HibernateMod10CheckTestCases.getEmptyTestBean(), true, null); }
super.validationTest(HibernateMod10CheckTestCases.getEmptyTestBean(), true, null); }
/** * empty not blank is ok. */
empty not blank is ok
testEmptyMod10CheckIsWrong
{ "repo_name": "ManfredTremmel/gwt-bean-validators", "path": "gwt-bean-validators/src/test/java/de/knightsoftnet/validators/client/GwtTstHibernateMod10Check.java", "license": "apache-2.0", "size": 2045 }
[ "de.knightsoftnet.validators.shared.testcases.HibernateMod10CheckTestCases" ]
import de.knightsoftnet.validators.shared.testcases.HibernateMod10CheckTestCases;
import de.knightsoftnet.validators.shared.testcases.*;
[ "de.knightsoftnet.validators" ]
de.knightsoftnet.validators;
2,521,431
public void setMinDate(final Date minDate) { this.minDate = minDate; }
void function(final Date minDate) { this.minDate = minDate; }
/** * DOCUMENT ME! * * @param minDate DOCUMENT ME! */
DOCUMENT ME
setMinDate
{ "repo_name": "cismet/cids-custom-udm2020-di-server", "path": "src/main/java/de/cismet/cids/custom/udm2020di/types/AggregationValue.java", "license": "lgpl-3.0", "size": 8826 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,618,289
List<Group> getByNameContains(String name);
List<Group> getByNameContains(String name);
/** * Get the list of all groups which names contains the specified name. * * @param name group name * @return list of groups * @throws IllegalArgumentException if name is null */
Get the list of all groups which names contains the specified name
getByNameContains
{ "repo_name": "Noctrunal/jcommune", "path": "jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/GroupDao.java", "license": "lgpl-2.1", "size": 2286 }
[ "java.util.List", "org.jtalks.common.model.entity.Group" ]
import java.util.List; import org.jtalks.common.model.entity.Group;
import java.util.*; import org.jtalks.common.model.entity.*;
[ "java.util", "org.jtalks.common" ]
java.util; org.jtalks.common;
1,674,270
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>POST</code> method
doPost
{ "repo_name": "cerberustesting/cerberus-source", "path": "source/src/main/java/org/cerberus/servlet/zzpublic/ResultCI.java", "license": "gpl-3.0", "size": 12007 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
362,018
public void testHolidayFromDateAgainstThruDateSucces() throws Exception { long fromDateMillis = new DateMidnight().getMillis(); Calendar fromDate = Calendar.getInstance(); fromDate.setTimeInMillis(fromDateMillis); fromDate.add(Calendar.DAY_OF_MONTH, 1); fromDateMillis = fromDate.getTimeInMillis(); HolidayPK holidayPK = new HolidayPK((short) 1, new Date(fromDateMillis)); Calendar thruDate = Calendar.getInstance(); long thruDateMillis = new DateMidnight().getMillis(); thruDate.setTimeInMillis(thruDateMillis); thruDate.add(Calendar.DAY_OF_MONTH, 1); thruDateMillis = thruDate.getTimeInMillis(); RepaymentRuleEntity entity = new HolidayPersistence().getRepaymentRule((short) 1); holidayEntity = new HolidayBO(holidayPK, thruDate.getTime(), "Test Holiday", entity); holidayEntity.save(); StaticHibernateUtil.commitTransaction(); StaticHibernateUtil.closeSession(); holidayEntity = (HolidayBO) TestObjectFactory.getObject(HolidayBO.class, holidayEntity.getHolidayPK()); Assert.assertEquals("Test Holiday", holidayEntity.getHolidayName()); Assert.assertEquals(fromDateMillis, holidayEntity.getHolidayFromDate().getTime()); Assert.assertEquals(thruDateMillis, holidayEntity.getHolidayThruDate().getTime()); }
void function() throws Exception { long fromDateMillis = new DateMidnight().getMillis(); Calendar fromDate = Calendar.getInstance(); fromDate.setTimeInMillis(fromDateMillis); fromDate.add(Calendar.DAY_OF_MONTH, 1); fromDateMillis = fromDate.getTimeInMillis(); HolidayPK holidayPK = new HolidayPK((short) 1, new Date(fromDateMillis)); Calendar thruDate = Calendar.getInstance(); long thruDateMillis = new DateMidnight().getMillis(); thruDate.setTimeInMillis(thruDateMillis); thruDate.add(Calendar.DAY_OF_MONTH, 1); thruDateMillis = thruDate.getTimeInMillis(); RepaymentRuleEntity entity = new HolidayPersistence().getRepaymentRule((short) 1); holidayEntity = new HolidayBO(holidayPK, thruDate.getTime(), STR, entity); holidayEntity.save(); StaticHibernateUtil.commitTransaction(); StaticHibernateUtil.closeSession(); holidayEntity = (HolidayBO) TestObjectFactory.getObject(HolidayBO.class, holidayEntity.getHolidayPK()); Assert.assertEquals(STR, holidayEntity.getHolidayName()); Assert.assertEquals(fromDateMillis, holidayEntity.getHolidayFromDate().getTime()); Assert.assertEquals(thruDateMillis, holidayEntity.getHolidayThruDate().getTime()); }
/** * test Holiday From Date Against Thru Date Success. */
test Holiday From Date Against Thru Date Success
testHolidayFromDateAgainstThruDateSucces
{ "repo_name": "mifos/1.5.x", "path": "application/src/test/java/org/mifos/application/holiday/business/HolidayBOIntegrationTest.java", "license": "apache-2.0", "size": 8505 }
[ "java.util.Calendar", "java.util.Date", "junit.framework.Assert", "org.joda.time.DateMidnight", "org.mifos.application.holiday.persistence.HolidayPersistence", "org.mifos.framework.hibernate.helper.StaticHibernateUtil", "org.mifos.framework.util.helpers.TestObjectFactory" ]
import java.util.Calendar; import java.util.Date; import junit.framework.Assert; import org.joda.time.DateMidnight; import org.mifos.application.holiday.persistence.HolidayPersistence; import org.mifos.framework.hibernate.helper.StaticHibernateUtil; import org.mifos.framework.util.helpers.TestObjectFactory;
import java.util.*; import junit.framework.*; import org.joda.time.*; import org.mifos.application.holiday.persistence.*; import org.mifos.framework.hibernate.helper.*; import org.mifos.framework.util.helpers.*;
[ "java.util", "junit.framework", "org.joda.time", "org.mifos.application", "org.mifos.framework" ]
java.util; junit.framework; org.joda.time; org.mifos.application; org.mifos.framework;
2,221,761
public void xMinYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID; }
void function() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID; }
/** * Invoked when 'xMinYMid' has been parsed. * @exception ParseException if an error occured while processing * the transform */
Invoked when 'xMinYMid' has been parsed
xMinYMid
{ "repo_name": "apache/batik", "path": "batik-bridge/src/main/java/org/apache/batik/bridge/ViewBox.java", "license": "apache-2.0", "size": 27227 }
[ "org.apache.batik.parser.ParseException", "org.w3c.dom.svg.SVGPreserveAspectRatio" ]
import org.apache.batik.parser.ParseException; import org.w3c.dom.svg.SVGPreserveAspectRatio;
import org.apache.batik.parser.*; import org.w3c.dom.svg.*;
[ "org.apache.batik", "org.w3c.dom" ]
org.apache.batik; org.w3c.dom;
2,749,336
static void visitPostOrder(Node node, Visitor vistor, Predicate<Node> traverseChildrenPred) { if (traverseChildrenPred.apply(node)) { for (Node c = node.getFirstChild(); c != null; c = c.getNext()) { visitPostOrder(c, vistor, traverseChildrenPred); } } vistor.visit(node); }
static void visitPostOrder(Node node, Visitor vistor, Predicate<Node> traverseChildrenPred) { if (traverseChildrenPred.apply(node)) { for (Node c = node.getFirstChild(); c != null; c = c.getNext()) { visitPostOrder(c, vistor, traverseChildrenPred); } } vistor.visit(node); }
/** * A post-order traversal, calling Vistor.visit for each child matching * the predicate. */
A post-order traversal, calling Vistor.visit for each child matching the predicate
visitPostOrder
{ "repo_name": "007slm/kissy", "path": "tools/module-compiler/src/com/google/javascript/jscomp/NodeUtil.java", "license": "mit", "size": 77263 }
[ "com.google.common.base.Predicate", "com.google.javascript.rhino.Node" ]
import com.google.common.base.Predicate; import com.google.javascript.rhino.Node;
import com.google.common.base.*; import com.google.javascript.rhino.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
2,186,569
private boolean updateImages(boolean forceImage) { ResourceManager parentResourceManager = JFaceResources.getResources(); if (widget instanceof ToolItem) { if (USE_COLOR_ICONS) { ImageDescriptor image = action.getHoverImageDescriptor(); if (image == null) { image = action.getImageDescriptor(); } ImageDescriptor disabledImage = action .getDisabledImageDescriptor(); // Make sure there is a valid image. if (image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } LocalResourceManager localManager = new LocalResourceManager( parentResourceManager); // performance: more efficient in SWT to set disabled and hot // image before regular image ((ToolItem) widget) .setDisabledImage(disabledImage == null ? null : localManager .createImageWithDefault(disabledImage)); ((ToolItem) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); disposeOldImages(); imageManager = localManager; return image != null; } ImageDescriptor image = action.getImageDescriptor(); ImageDescriptor hoverImage = action.getHoverImageDescriptor(); ImageDescriptor disabledImage = action.getDisabledImageDescriptor(); // If there is no regular image, but there is a hover image, // convert the hover image to gray and use it as the regular image. if (image == null && hoverImage != null) { image = ImageDescriptor.createWithFlags(action .getHoverImageDescriptor(), SWT.IMAGE_GRAY); } else { // If there is no hover image, use the regular image as the // hover image, // and convert the regular image to gray if (hoverImage == null && image != null) { hoverImage = image; image = ImageDescriptor.createWithFlags(action .getImageDescriptor(), SWT.IMAGE_GRAY); } } // Make sure there is a valid image. if (hoverImage == null && image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } // Create a local resource manager to remember the images we've // allocated for this tool item LocalResourceManager localManager = new LocalResourceManager( parentResourceManager); // performance: more efficient in SWT to set disabled and hot image // before regular image ((ToolItem) widget).setDisabledImage(disabledImage == null ? null : localManager.createImageWithDefault(disabledImage)); ((ToolItem) widget).setHotImage(hoverImage == null ? null : localManager.createImageWithDefault(hoverImage)); ((ToolItem) widget).setImage(image == null ? null : localManager .createImageWithDefault(image)); // Now that we're no longer referencing the old images, clear them // out. disposeOldImages(); imageManager = localManager; return image != null; } else if (widget instanceof Item || widget instanceof Button) { // Use hover image if there is one, otherwise use regular image. ImageDescriptor image = action.getHoverImageDescriptor(); if (image == null) { image = action.getImageDescriptor(); } // Make sure there is a valid image. if (image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } // Create a local resource manager to remember the images we've // allocated for this widget LocalResourceManager localManager = new LocalResourceManager( parentResourceManager); if (widget instanceof Item) { ((Item) widget).setImage(image == null ? null : localManager .createImageWithDefault(image)); } else if (widget instanceof Button) { ((Button) widget).setImage(image == null ? null : localManager .createImageWithDefault(image)); } // Now that we're no longer referencing the old images, clear them // out. disposeOldImages(); imageManager = localManager; return image != null; } return false; }
boolean function(boolean forceImage) { ResourceManager parentResourceManager = JFaceResources.getResources(); if (widget instanceof ToolItem) { if (USE_COLOR_ICONS) { ImageDescriptor image = action.getHoverImageDescriptor(); if (image == null) { image = action.getImageDescriptor(); } ImageDescriptor disabledImage = action .getDisabledImageDescriptor(); if (image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } LocalResourceManager localManager = new LocalResourceManager( parentResourceManager); ((ToolItem) widget) .setDisabledImage(disabledImage == null ? null : localManager .createImageWithDefault(disabledImage)); ((ToolItem) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); disposeOldImages(); imageManager = localManager; return image != null; } ImageDescriptor image = action.getImageDescriptor(); ImageDescriptor hoverImage = action.getHoverImageDescriptor(); ImageDescriptor disabledImage = action.getDisabledImageDescriptor(); if (image == null && hoverImage != null) { image = ImageDescriptor.createWithFlags(action .getHoverImageDescriptor(), SWT.IMAGE_GRAY); } else { if (hoverImage == null && image != null) { hoverImage = image; image = ImageDescriptor.createWithFlags(action .getImageDescriptor(), SWT.IMAGE_GRAY); } } if (hoverImage == null && image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } LocalResourceManager localManager = new LocalResourceManager( parentResourceManager); ((ToolItem) widget).setDisabledImage(disabledImage == null ? null : localManager.createImageWithDefault(disabledImage)); ((ToolItem) widget).setHotImage(hoverImage == null ? null : localManager.createImageWithDefault(hoverImage)); ((ToolItem) widget).setImage(image == null ? null : localManager .createImageWithDefault(image)); disposeOldImages(); imageManager = localManager; return image != null; } else if (widget instanceof Item widget instanceof Button) { ImageDescriptor image = action.getHoverImageDescriptor(); if (image == null) { image = action.getImageDescriptor(); } if (image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } LocalResourceManager localManager = new LocalResourceManager( parentResourceManager); if (widget instanceof Item) { ((Item) widget).setImage(image == null ? null : localManager .createImageWithDefault(image)); } else if (widget instanceof Button) { ((Button) widget).setImage(image == null ? null : localManager .createImageWithDefault(image)); } disposeOldImages(); imageManager = localManager; return image != null; } return false; }
/** * Updates the images for this action. * * @param forceImage * <code>true</code> if some form of image is compulsory, and * <code>false</code> if it is acceptable for this item to have * no image * @return <code>true</code> if there are images for this action, * <code>false</code> if not */
Updates the images for this action
updateImages
{ "repo_name": "AntoineDelacroix/NewSuperProject-", "path": "org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java", "license": "gpl-2.0", "size": 39559 }
[ "org.eclipse.jface.resource.ImageDescriptor", "org.eclipse.jface.resource.JFaceResources", "org.eclipse.jface.resource.LocalResourceManager", "org.eclipse.jface.resource.ResourceManager", "org.eclipse.swt.widgets.Button", "org.eclipse.swt.widgets.Item", "org.eclipse.swt.widgets.ToolItem" ]
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.LocalResourceManager; import org.eclipse.jface.resource.ResourceManager; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Item; import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.jface.resource.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.jface", "org.eclipse.swt" ]
org.eclipse.jface; org.eclipse.swt;
2,800,081
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8)); }
return UUID.nameUUIDFromBytes((STR + name).getBytes(StandardCharsets.UTF_8)); }
/** * Returns offline mode uuid for name * @param name name * @return offline mode uuid */
Returns offline mode uuid for name
generateOfflineModeUUID
{ "repo_name": "ProtocolSupport/ProtocolSupport", "path": "src/protocolsupport/api/utils/Profile.java", "license": "agpl-3.0", "size": 2580 }
[ "java.nio.charset.StandardCharsets", "java.util.UUID" ]
import java.nio.charset.StandardCharsets; import java.util.UUID;
import java.nio.charset.*; import java.util.*;
[ "java.nio", "java.util" ]
java.nio; java.util;
1,706,171
protected ConversionExecutor convertClassToTargetType(final Class targetType) { return this.flowBuilderServices.getConversionService().getConversionExecutor(String.class, targetType); }
ConversionExecutor function(final Class targetType) { return this.flowBuilderServices.getConversionService().getConversionExecutor(String.class, targetType); }
/** * From string to class type, based on the flow conversion service. * * @param targetType the target type * @return the conversion executor */
From string to class type, based on the flow conversion service
convertClassToTargetType
{ "repo_name": "vydra/cas", "path": "core/cas-server-core-webflow/src/main/java/org/apereo/cas/web/flow/AbstractCasWebflowConfigurer.java", "license": "apache-2.0", "size": 27222 }
[ "org.springframework.binding.convert.ConversionExecutor" ]
import org.springframework.binding.convert.ConversionExecutor;
import org.springframework.binding.convert.*;
[ "org.springframework.binding" ]
org.springframework.binding;
2,732,080
PlayerGroup createGroup(Player leader, String name);
PlayerGroup createGroup(Player leader, String name);
/** * Creates a new group. * * @param leader the leader * @param name the group's name - must be unique * @return a new group or null if values are invalid */
Creates a new group
createGroup
{ "repo_name": "DRE2N/DungeonsXL", "path": "api/src/main/java/de/erethon/dungeonsxl/api/DungeonsAPI.java", "license": "gpl-3.0", "size": 10136 }
[ "de.erethon.dungeonsxl.api.player.PlayerGroup", "org.bukkit.entity.Player" ]
import de.erethon.dungeonsxl.api.player.PlayerGroup; import org.bukkit.entity.Player;
import de.erethon.dungeonsxl.api.player.*; import org.bukkit.entity.*;
[ "de.erethon.dungeonsxl", "org.bukkit.entity" ]
de.erethon.dungeonsxl; org.bukkit.entity;
175,582
public Set<String> keySet() { return this.map.keySet(); }
Set<String> function() { return this.map.keySet(); }
/** * Get a set of keys of the JSONObject. * * @return A keySet. */
Get a set of keys of the JSONObject
keySet
{ "repo_name": "shaunstanislaus/actor-platform", "path": "actor-apps/core/src/main/java/im/actor/model/droidkit/json/JSONObject.java", "license": "mit", "size": 36795 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,235,188
public List<Node<T>> getChildren() { if (this.children == null) { return new ArrayList<Node<T>>(); } return this.children; }
List<Node<T>> function() { if (this.children == null) { return new ArrayList<Node<T>>(); } return this.children; }
/** * Return the children of Node<T>. The Tree<T> is represented by a single root * Node<T> whose children are represented by a List<Node<T>>. Each of these * Node<T> elements in the List can have children. The getChildren() method * will return the children of a Node<T>. * * @return the children of Node<T> */
Return the children of Node. The Tree is represented by a single root Node whose children are represented by a List<Node>. Each of these Node elements in the List can have children. The getChildren() method will return the children of a Node
getChildren
{ "repo_name": "jmacauley/OpenDRAC", "path": "Server/Common/src/main/java/com/nortel/appcore/app/drac/common/datastructure/tree/Node.java", "license": "gpl-3.0", "size": 3457 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
238,791
EClass getTerminalConstraintTerm();
EClass getTerminalConstraintTerm();
/** * Returns the meta object for class '{@link CIM.IEC61970.Informative.MarketOperations.TerminalConstraintTerm <em>Terminal Constraint Term</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Terminal Constraint Term</em>'. * @see CIM.IEC61970.Informative.MarketOperations.TerminalConstraintTerm * @generated */
Returns the meta object for class '<code>CIM.IEC61970.Informative.MarketOperations.TerminalConstraintTerm Terminal Constraint Term</code>'.
getTerminalConstraintTerm
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Informative/MarketOperations/MarketOperationsPackage.java", "license": "mit", "size": 688294 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,431,794
public static void build(@Nullable final BufferedSink sink, @Nullable final Iterator<?> iterator, final boolean indent) { buildWithIndent(sink, iterator, indent ? DEFAULT_INDENTATION : null); }
static void function(@Nullable final BufferedSink sink, @Nullable final Iterator<?> iterator, final boolean indent) { buildWithIndent(sink, iterator, indent ? DEFAULT_INDENTATION : null); }
/** * Writes the string representation of a given json array (represented by a list) to a * {@link okio.BufferedSource}. * @param sink the target buffer. * @param iterator the list (iterator) representation of the json array. * @param indent whether to indent (2 spaces) the result or not. */
Writes the string representation of a given json array (represented by a list) to a <code>okio.BufferedSource</code>
build
{ "repo_name": "programingjd/okjson", "path": "src/main/java/info/jdavid/ok/json/Builder.java", "license": "apache-2.0", "size": 25524 }
[ "java.util.Iterator", "javax.annotation.Nullable" ]
import java.util.Iterator; import javax.annotation.Nullable;
import java.util.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
2,316,151
public static RepositoryDescriptor read(InputStream[] updateSiteDescriptorStreams, Logger log) throws IOException, JDOMException { UpdateSiteDescriptorReader reader = new UpdateSiteDescriptorReader(updateSiteDescriptorStreams, log); reader.doRead(); return reader.repositoryDescriptor; }
static RepositoryDescriptor function(InputStream[] updateSiteDescriptorStreams, Logger log) throws IOException, JDOMException { UpdateSiteDescriptorReader reader = new UpdateSiteDescriptorReader(updateSiteDescriptorStreams, log); reader.doRead(); return reader.repositoryDescriptor; }
/** * Reads the stream, standing for a content.xml file, and returns the repository descriptor associated with it. * * @param updateSiteDescriptorStream * @param log * @return * @throws IOException * @throws JDOMException */
Reads the stream, standing for a content.xml file, and returns the repository descriptor associated with it
read
{ "repo_name": "awltech/eclipse-p2repo-index", "path": "src/main/java/com/worldline/mojo/p2repoindex/locators/UpdateSiteDescriptorReader.java", "license": "lgpl-3.0", "size": 15046 }
[ "com.worldline.mojo.p2repoindex.descriptors.RepositoryDescriptor", "java.io.IOException", "java.io.InputStream", "org.jdom.JDOMException", "org.slf4j.Logger" ]
import com.worldline.mojo.p2repoindex.descriptors.RepositoryDescriptor; import java.io.IOException; import java.io.InputStream; import org.jdom.JDOMException; import org.slf4j.Logger;
import com.worldline.mojo.p2repoindex.descriptors.*; import java.io.*; import org.jdom.*; import org.slf4j.*;
[ "com.worldline.mojo", "java.io", "org.jdom", "org.slf4j" ]
com.worldline.mojo; java.io; org.jdom; org.slf4j;
476,275
T execute(SqlExecutor executor, Connection connection) throws SQLException; } static final class SelectSequenceValue implements SqlIntegrationCallback<Long> { @Nonnull private final SelectSequenceCommand _sequenceQuery; protected SelectSequenceValue(final SelectSequenceCommand sequenceStatement) { super(); _sequenceQuery = sequenceStatement; }
T execute(SqlExecutor executor, Connection connection) throws SQLException; } static final class SelectSequenceValue implements SqlIntegrationCallback<Long> { @Nonnull private final SelectSequenceCommand _sequenceQuery; protected SelectSequenceValue(final SelectSequenceCommand sequenceStatement) { super(); _sequenceQuery = sequenceStatement; }
/** * Execute on the given connection, using the provided sql builder object * for building your sql. */
Execute on the given connection, using the provided sql builder object for building your sql
execute
{ "repo_name": "freiheit-com/sqlapi4j", "path": "dao/src/main/java/com/freiheit/sqlapi4j/dao/IntegrationCallbacks.java", "license": "apache-2.0", "size": 13714 }
[ "com.freiheit.sqlapi4j.query.SelectSequenceCommand", "com.freiheit.sqlapi4j.query.SqlExecutor", "java.sql.Connection", "java.sql.SQLException", "javax.annotation.Nonnull" ]
import com.freiheit.sqlapi4j.query.SelectSequenceCommand; import com.freiheit.sqlapi4j.query.SqlExecutor; import java.sql.Connection; import java.sql.SQLException; import javax.annotation.Nonnull;
import com.freiheit.sqlapi4j.query.*; import java.sql.*; import javax.annotation.*;
[ "com.freiheit.sqlapi4j", "java.sql", "javax.annotation" ]
com.freiheit.sqlapi4j; java.sql; javax.annotation;
54,567
public static Integer getRequirementAsCountByPEAndIsScoped(Long portfolioEntryId, Boolean isScoped) { ExpressionList<Requirement> expr = RequirementDAO.findRequirement.where().eq("deleted", false).eq("portfolioEntry.id", portfolioEntryId); if (isScoped != null) { expr = expr.eq("isScoped", isScoped); } return expr.findRowCount(); }
static Integer function(Long portfolioEntryId, Boolean isScoped) { ExpressionList<Requirement> expr = RequirementDAO.findRequirement.where().eq(STR, false).eq(STR, portfolioEntryId); if (isScoped != null) { expr = expr.eq(STR, isScoped); } return expr.findRowCount(); }
/** * Get the total number of direct requirements of a portfolio entry * according to the isScoped value. * * @param portfolioEntryId * the portfolio entry id * @param isScoped * if true: get only the scoped requirements, if false: get only * the non-scoped requirements, if null: get all requirements */
Get the total number of direct requirements of a portfolio entry according to the isScoped value
getRequirementAsCountByPEAndIsScoped
{ "repo_name": "theAgileFactory/maf-desktop-app", "path": "app/dao/delivery/RequirementDAO.java", "license": "gpl-2.0", "size": 15784 }
[ "com.avaje.ebean.ExpressionList" ]
import com.avaje.ebean.ExpressionList;
import com.avaje.ebean.*;
[ "com.avaje.ebean" ]
com.avaje.ebean;
46,123
void execute(PartitionSpecificRunnable task);
void execute(PartitionSpecificRunnable task);
/** * Executes the given {@link PartitionSpecificRunnable} at some point in the future. * * @param task the task the execute. * @throws java.lang.NullPointerException if task is null. */
Executes the given <code>PartitionSpecificRunnable</code> at some point in the future
execute
{ "repo_name": "emrahkocaman/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/spi/impl/operationexecutor/OperationExecutor.java", "license": "apache-2.0", "size": 6204 }
[ "com.hazelcast.spi.impl.PartitionSpecificRunnable" ]
import com.hazelcast.spi.impl.PartitionSpecificRunnable;
import com.hazelcast.spi.impl.*;
[ "com.hazelcast.spi" ]
com.hazelcast.spi;
636,284
@Test public void testJobResultRetrieval() throws Exception { final MiniDispatcher miniDispatcher = createMiniDispatcher(ClusterEntrypoint.ExecutionMode.NORMAL); miniDispatcher.start(); try { // wait until we have submitted the job final TestingJobManagerRunner testingJobManagerRunner = testingJobManagerRunnerFactory.takeCreatedJobManagerRunner(); testingJobManagerRunner.completeResultFuture(executionGraphInfo); assertFalse(miniDispatcher.getTerminationFuture().isDone()); final DispatcherGateway dispatcherGateway = miniDispatcher.getSelfGateway(DispatcherGateway.class); final CompletableFuture<JobResult> jobResultFuture = dispatcherGateway.requestJobResult(jobGraph.getJobID(), timeout); final JobResult jobResult = jobResultFuture.get(); assertThat(jobResult.getJobId(), is(jobGraph.getJobID())); } finally { RpcUtils.terminateRpcEndpoint(miniDispatcher, timeout); } }
void function() throws Exception { final MiniDispatcher miniDispatcher = createMiniDispatcher(ClusterEntrypoint.ExecutionMode.NORMAL); miniDispatcher.start(); try { final TestingJobManagerRunner testingJobManagerRunner = testingJobManagerRunnerFactory.takeCreatedJobManagerRunner(); testingJobManagerRunner.completeResultFuture(executionGraphInfo); assertFalse(miniDispatcher.getTerminationFuture().isDone()); final DispatcherGateway dispatcherGateway = miniDispatcher.getSelfGateway(DispatcherGateway.class); final CompletableFuture<JobResult> jobResultFuture = dispatcherGateway.requestJobResult(jobGraph.getJobID(), timeout); final JobResult jobResult = jobResultFuture.get(); assertThat(jobResult.getJobId(), is(jobGraph.getJobID())); } finally { RpcUtils.terminateRpcEndpoint(miniDispatcher, timeout); } }
/** * Tests that the {@link MiniDispatcher} only terminates in {@link * ClusterEntrypoint.ExecutionMode#NORMAL} after it has served the {@link * org.apache.flink.runtime.jobmaster.JobResult} once. */
Tests that the <code>MiniDispatcher</code> only terminates in <code>ClusterEntrypoint.ExecutionMode#NORMAL</code> after it has served the <code>org.apache.flink.runtime.jobmaster.JobResult</code> once
testJobResultRetrieval
{ "repo_name": "clarkyzl/flink", "path": "flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/MiniDispatcherTest.java", "license": "apache-2.0", "size": 10883 }
[ "java.util.concurrent.CompletableFuture", "org.apache.flink.runtime.entrypoint.ClusterEntrypoint", "org.apache.flink.runtime.jobmaster.JobResult", "org.apache.flink.runtime.jobmaster.TestingJobManagerRunner", "org.apache.flink.runtime.rpc.RpcUtils", "org.hamcrest.Matchers", "org.junit.Assert" ]
import java.util.concurrent.CompletableFuture; import org.apache.flink.runtime.entrypoint.ClusterEntrypoint; import org.apache.flink.runtime.jobmaster.JobResult; import org.apache.flink.runtime.jobmaster.TestingJobManagerRunner; import org.apache.flink.runtime.rpc.RpcUtils; import org.hamcrest.Matchers; import org.junit.Assert;
import java.util.concurrent.*; import org.apache.flink.runtime.entrypoint.*; import org.apache.flink.runtime.jobmaster.*; import org.apache.flink.runtime.rpc.*; import org.hamcrest.*; import org.junit.*;
[ "java.util", "org.apache.flink", "org.hamcrest", "org.junit" ]
java.util; org.apache.flink; org.hamcrest; org.junit;
1,045,912
public static gloTauType fromPerUnaligned(byte[] encodedBytes) { gloTauType result = new gloTauType(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; }
static gloTauType function(byte[] encodedBytes) { gloTauType result = new gloTauType(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; }
/** * Creates a new gloTauType from encoded stream. */
Creates a new gloTauType from encoded stream
fromPerUnaligned
{ "repo_name": "google/supl-client", "path": "src/main/java/com/google/location/suplclient/asn1/supl2/rrlp_components/GLONASSclockModel.java", "license": "apache-2.0", "size": 15575 }
[ "com.google.location.suplclient.asn1.base.BitStreamReader" ]
import com.google.location.suplclient.asn1.base.BitStreamReader;
import com.google.location.suplclient.asn1.base.*;
[ "com.google.location" ]
com.google.location;
244,047
public void setForwarder(MBeanServerForwarder forwarder) { this.forwarder = forwarder; } /** * Set the {@code ObjectName} used to register the {@code JMXConnectorServer}
void function(MBeanServerForwarder forwarder) { this.forwarder = forwarder; } /** * Set the {@code ObjectName} used to register the {@code JMXConnectorServer}
/** * Set an MBeanServerForwarder to be applied to the {@code JMXConnectorServer}. */
Set an MBeanServerForwarder to be applied to the JMXConnectorServer
setForwarder
{ "repo_name": "spring-projects/spring-framework", "path": "spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java", "license": "apache-2.0", "size": 7484 }
[ "javax.management.ObjectName", "javax.management.remote.JMXConnectorServer", "javax.management.remote.MBeanServerForwarder" ]
import javax.management.ObjectName; import javax.management.remote.JMXConnectorServer; import javax.management.remote.MBeanServerForwarder;
import javax.management.*; import javax.management.remote.*;
[ "javax.management" ]
javax.management;
1,534,309
EAttribute getTExpression_ExpressionLanguage();
EAttribute getTExpression_ExpressionLanguage();
/** * Returns the meta object for the attribute '{@link org.wso2.developerstudio.eclipse.humantask.model.ht.TExpression#getExpressionLanguage <em>Expression Language</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Expression Language</em>'. * @see org.wso2.developerstudio.eclipse.humantask.model.ht.TExpression#getExpressionLanguage() * @see #getTExpression() * @generated */
Returns the meta object for the attribute '<code>org.wso2.developerstudio.eclipse.humantask.model.ht.TExpression#getExpressionLanguage Expression Language</code>'.
getTExpression_ExpressionLanguage
{ "repo_name": "chanakaudaya/developer-studio", "path": "humantask/org.wso2.tools.humantask.model/src/org/wso2/carbonstudio/eclipse/humantask/model/ht/HTPackage.java", "license": "apache-2.0", "size": 247810 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,563,399
Swarm restartContainer(SwarmId swarmId, ContainerId containerId);
Swarm restartContainer(SwarmId swarmId, ContainerId containerId);
/** * Restart a container inside the swarm. * * @param swarmId * the swarm identifier. * @param containerId * the container identifier. * @return TODO */
Restart a container inside the swarm
restartContainer
{ "repo_name": "quirinobrizi/adam", "path": "adam-rest/src/main/java/eu/codesketch/adam/rest/application/SwarmService.java", "license": "apache-2.0", "size": 2500 }
[ "eu.codesketch.adam.rest.domain.model.Swarm", "eu.codesketch.adam.rest.domain.model.SwarmId", "eu.codesketch.adam.rest.domain.model.container.ContainerId" ]
import eu.codesketch.adam.rest.domain.model.Swarm; import eu.codesketch.adam.rest.domain.model.SwarmId; import eu.codesketch.adam.rest.domain.model.container.ContainerId;
import eu.codesketch.adam.rest.domain.model.*; import eu.codesketch.adam.rest.domain.model.container.*;
[ "eu.codesketch.adam" ]
eu.codesketch.adam;
1,221,282
public static CircuitBreakerExports ofCircuitBreakerRegistry(String prefix, CircuitBreakerRegistry circuitBreakerRegistry) { requireNonNull(prefix); requireNonNull(circuitBreakerRegistry); return new CircuitBreakerExports(prefix, circuitBreakerRegistry); }
static CircuitBreakerExports function(String prefix, CircuitBreakerRegistry circuitBreakerRegistry) { requireNonNull(prefix); requireNonNull(circuitBreakerRegistry); return new CircuitBreakerExports(prefix, circuitBreakerRegistry); }
/** * Creates a new instance of {@link CircuitBreakerExports} with specified metrics names prefix and * {@link CircuitBreakerRegistry} as a source of circuit breakers. * * @param prefix the prefix of metrics names * @param circuitBreakerRegistry the registry of circuit breakers */
Creates a new instance of <code>CircuitBreakerExports</code> with specified metrics names prefix and <code>CircuitBreakerRegistry</code> as a source of circuit breakers
ofCircuitBreakerRegistry
{ "repo_name": "mehtabsinghmann/resilience4j", "path": "resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/CircuitBreakerExports.java", "license": "apache-2.0", "size": 10033 }
[ "io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry", "java.util.Objects" ]
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry; import java.util.Objects;
import io.github.resilience4j.circuitbreaker.*; import java.util.*;
[ "io.github.resilience4j", "java.util" ]
io.github.resilience4j; java.util;
2,875,061
public Response getEventServiceHead() throws RMapApiException { boolean reqSuccessful = false; Response response = null; try { response = Response.status(Response.Status.OK) .allow(HttpMethod.HEAD,HttpMethod.OPTIONS,HttpMethod.GET) .link(pathUtils.getDocumentationPath(),LinkRels.DC_DESCRIPTION) .build(); reqSuccessful = true; } catch (Exception ex){ throw RMapApiException.wrap(ex, ErrorCode.ER_RETRIEVING_API_HEAD); } finally{ if (!reqSuccessful && response!=null) response.close(); } return response; }
Response function() throws RMapApiException { boolean reqSuccessful = false; Response response = null; try { response = Response.status(Response.Status.OK) .allow(HttpMethod.HEAD,HttpMethod.OPTIONS,HttpMethod.GET) .link(pathUtils.getDocumentationPath(),LinkRels.DC_DESCRIPTION) .build(); reqSuccessful = true; } catch (Exception ex){ throw RMapApiException.wrap(ex, ErrorCode.ER_RETRIEVING_API_HEAD); } finally{ if (!reqSuccessful && response!=null) response.close(); } return response; }
/** * Displays Event Service Options Header. * * @return HTTP Response * @throws RMapApiException the RMap API exception */
Displays Event Service Options Header
getEventServiceHead
{ "repo_name": "rmap-project/rmap", "path": "api/src/main/java/info/rmapproject/api/responsemgr/EventResponseManager.java", "license": "apache-2.0", "size": 9570 }
[ "info.rmapproject.api.exception.ErrorCode", "info.rmapproject.api.exception.RMapApiException", "info.rmapproject.api.utils.LinkRels", "javax.ws.rs.HttpMethod", "javax.ws.rs.core.Response" ]
import info.rmapproject.api.exception.ErrorCode; import info.rmapproject.api.exception.RMapApiException; import info.rmapproject.api.utils.LinkRels; import javax.ws.rs.HttpMethod; import javax.ws.rs.core.Response;
import info.rmapproject.api.exception.*; import info.rmapproject.api.utils.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "info.rmapproject.api", "javax.ws" ]
info.rmapproject.api; javax.ws;
2,064,305
Query getQuery(String queryStr, String ctxStr) throws QueryConstructionException;
Query getQuery(String queryStr, String ctxStr) throws QueryConstructionException;
/** * Returns a query object defined by queryStr asked in Microtheory ctxStr, with default inference * parameters. * * @param queryStr The query string * @param ctxStr The Microtheory where the query is asked * * @return * * @throws QueryConstructionException * */
Returns a query object defined by queryStr asked in Microtheory ctxStr, with default inference parameters
getQuery
{ "repo_name": "cycorp/CycCoreAPI", "path": "core-api/src/main/java/com/cyc/query/spi/QueryService.java", "license": "apache-2.0", "size": 7619 }
[ "com.cyc.query.Query", "com.cyc.query.exception.QueryConstructionException" ]
import com.cyc.query.Query; import com.cyc.query.exception.QueryConstructionException;
import com.cyc.query.*; import com.cyc.query.exception.*;
[ "com.cyc.query" ]
com.cyc.query;
752,106
@ServiceMethod(returns = ReturnType.SINGLE) Mono<ObjectReplicationPolicyInner> createOrUpdateAsync( String resourceGroupName, String accountName, String objectReplicationPolicyId, ObjectReplicationPolicyInner properties);
@ServiceMethod(returns = ReturnType.SINGLE) Mono<ObjectReplicationPolicyInner> createOrUpdateAsync( String resourceGroupName, String accountName, String objectReplicationPolicyId, ObjectReplicationPolicyInner properties);
/** * Create or update the object replication policy of the storage account. * * @param resourceGroupName The name of the resource group within the user's subscription. The name is case * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. * @param properties The object replication policy set to a storage account. A unique policy ID will be created if * absent. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the replication policy between two storage accounts. */
Create or update the object replication policy of the storage account
createOrUpdateAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-storage/src/main/java/com/azure/resourcemanager/storage/fluent/ObjectReplicationPoliciesOperationsClient.java", "license": "mit", "size": 18352 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.storage.fluent.models.ObjectReplicationPolicyInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.storage.fluent.models.ObjectReplicationPolicyInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.storage.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,178,550
@Test public void readEntitiesAndCheckResponse() { LOGGER.info(" readEntitiesAndCheckResponse"); for (EntityType entityType : serverSettings.getEnabledEntityTypes()) { String response = getEntities(entityType); checkEntitiesAllAspectsForResponse(entityType, response); } }
void function() { LOGGER.info(STR); for (EntityType entityType : serverSettings.getEnabledEntityTypes()) { String response = getEntities(entityType); checkEntitiesAllAspectsForResponse(entityType, response); } }
/** * This method is testing GET entities. It should return 200. Then the * response entities are tested for control information, mandatory * properties, and mandatory related entities. */
This method is testing GET entities. It should return 200. Then the response entities are tested for control information, mandatory properties, and mandatory related entities
readEntitiesAndCheckResponse
{ "repo_name": "FraunhoferIOSB/SensorThingsServer", "path": "FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c01sensingcore/Capability1Tests.java", "license": "lgpl-3.0", "size": 28458 }
[ "de.fraunhofer.iosb.ilt.statests.util.EntityType" ]
import de.fraunhofer.iosb.ilt.statests.util.EntityType;
import de.fraunhofer.iosb.ilt.statests.util.*;
[ "de.fraunhofer.iosb" ]
de.fraunhofer.iosb;
2,852,091
private static synchronized void registerProvider0(ZoneRulesProvider provider) { for (String zoneId : provider.provideZoneIds()) { Objects.requireNonNull(zoneId, "zoneId"); ZoneRulesProvider old = ZONES.putIfAbsent(zoneId, provider); if (old != null) { throw new ZoneRulesException( "Unable to register zone as one already registered with that ID: " + zoneId + ", currently loading from provider: " + provider); } } Set<String> combinedSet = new HashSet<String>(ZONES.keySet()); ZONE_IDS = Collections.unmodifiableSet(combinedSet); } /** * Refreshes the rules from the underlying data provider. * <p> * This method allows an application to request that the providers check * for any updates to the provided rules. * After calling this method, the offset stored in any {@link ZonedDateTime}
static synchronized void function(ZoneRulesProvider provider) { for (String zoneId : provider.provideZoneIds()) { Objects.requireNonNull(zoneId, STR); ZoneRulesProvider old = ZONES.putIfAbsent(zoneId, provider); if (old != null) { throw new ZoneRulesException( STR + zoneId + STR + provider); } } Set<String> combinedSet = new HashSet<String>(ZONES.keySet()); ZONE_IDS = Collections.unmodifiableSet(combinedSet); } /** * Refreshes the rules from the underlying data provider. * <p> * This method allows an application to request that the providers check * for any updates to the provided rules. * After calling this method, the offset stored in any {@link ZonedDateTime}
/** * Registers the provider. * * @param provider the provider to register, not null * @throws ZoneRulesException if unable to complete the registration */
Registers the provider
registerProvider0
{ "repo_name": "md-5/jdk10", "path": "src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java", "license": "gpl-2.0", "size": 20336 }
[ "java.time.ZonedDateTime", "java.util.Collections", "java.util.HashSet", "java.util.Objects", "java.util.Set" ]
import java.time.ZonedDateTime; import java.util.Collections; import java.util.HashSet; import java.util.Objects; import java.util.Set;
import java.time.*; import java.util.*;
[ "java.time", "java.util" ]
java.time; java.util;
137,087
@Override public Adapter createActivateFeatureActionAdapter() { if (activateFeatureActionItemProvider == null) { activateFeatureActionItemProvider = new ActivateFeatureActionItemProvider(this); } return activateFeatureActionItemProvider; } protected DeactivateFeatureActionItemProvider deactivateFeatureActionItemProvider;
Adapter function() { if (activateFeatureActionItemProvider == null) { activateFeatureActionItemProvider = new ActivateFeatureActionItemProvider(this); } return activateFeatureActionItemProvider; } protected DeactivateFeatureActionItemProvider deactivateFeatureActionItemProvider;
/** * This creates an adapter for a {@link org.tud.inf.st.mbt.actions.ActivateFeatureAction}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This creates an adapter for a <code>org.tud.inf.st.mbt.actions.ActivateFeatureAction</code>.
createActivateFeatureActionAdapter
{ "repo_name": "paetti1988/qmate", "path": "MATE/org.tud.inf.st.mbt.emf.edit/src-gen/org/tud/inf/st/mbt/actions/provider/ActionsItemProviderAdapterFactory.java", "license": "apache-2.0", "size": 18606 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,468,405
public void addParty(Party party) { parties.put(party.getName(), party); FileConfiguration partyConfig = dropParty.getConfigManager().getConfig(ConfigType.PARTY); String path = "Parties." + party.getName(); partyConfig.createSection(path); party.save(partyConfig.getConfigurationSection(path)); dropParty.getConfigManager().getConfigAccessor(ConfigType.PARTY).saveConfig(); updatePageList(); }
void function(Party party) { parties.put(party.getName(), party); FileConfiguration partyConfig = dropParty.getConfigManager().getConfig(ConfigType.PARTY); String path = STR + party.getName(); partyConfig.createSection(path); party.save(partyConfig.getConfigurationSection(path)); dropParty.getConfigManager().getConfigAccessor(ConfigType.PARTY).saveConfig(); updatePageList(); }
/** * Adds a party to the manager. * * @param party The party. */
Adds a party to the manager
addParty
{ "repo_name": "ampayne2/DropParty", "path": "src/main/java/ninja/amp/dropparty/PartyManager.java", "license": "lgpl-3.0", "size": 5227 }
[ "ninja.amp.dropparty.config.ConfigType", "ninja.amp.dropparty.parties.Party", "org.bukkit.configuration.file.FileConfiguration" ]
import ninja.amp.dropparty.config.ConfigType; import ninja.amp.dropparty.parties.Party; import org.bukkit.configuration.file.FileConfiguration;
import ninja.amp.dropparty.config.*; import ninja.amp.dropparty.parties.*; import org.bukkit.configuration.file.*;
[ "ninja.amp.dropparty", "org.bukkit.configuration" ]
ninja.amp.dropparty; org.bukkit.configuration;
1,087,078
@Test public void testAnonymousSelfRegistrationDisabled() throws IOException { String postUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/user.create.html"; String userId = "testUser" + random.nextInt(); List<NameValuePair> postParams = new ArrayList<NameValuePair>(); postParams.add(new NameValuePair(":name", userId)); postParams.add(new NameValuePair("pwd", "testPwd")); postParams.add(new NameValuePair("pwdConfirm", "testPwd")); //user create without logging in as a privileged user should return a 500 error H.getHttpClient().getState().clearCredentials(); H.assertPostStatus(postUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null); }
@Test void function() throws IOException { String postUrl = HttpTest.HTTP_BASE_URL + STR; String userId = STR + random.nextInt(); List<NameValuePair> postParams = new ArrayList<NameValuePair>(); postParams.add(new NameValuePair(":name", userId)); postParams.add(new NameValuePair("pwd", STR)); postParams.add(new NameValuePair(STR, STR)); H.getHttpClient().getState().clearCredentials(); H.assertPostStatus(postUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null); }
/** * Test for SLING-1642 to verify that user self-registration by the anonymous * user is not allowed by default. */
Test for SLING-1642 to verify that user self-registration by the anonymous user is not allowed by default
testAnonymousSelfRegistrationDisabled
{ "repo_name": "tmaret/sling", "path": "launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateUserTest.java", "license": "apache-2.0", "size": 10889 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "javax.servlet.http.HttpServletResponse", "org.apache.commons.httpclient.NameValuePair", "org.apache.sling.commons.testing.integration.HttpTest", "org.junit.Test" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.apache.commons.httpclient.NameValuePair; import org.apache.sling.commons.testing.integration.HttpTest; import org.junit.Test;
import java.io.*; import java.util.*; import javax.servlet.http.*; import org.apache.commons.httpclient.*; import org.apache.sling.commons.testing.integration.*; import org.junit.*;
[ "java.io", "java.util", "javax.servlet", "org.apache.commons", "org.apache.sling", "org.junit" ]
java.io; java.util; javax.servlet; org.apache.commons; org.apache.sling; org.junit;
858,464
public void setFile(File file) { this.file = file; // update configuration as well getConfiguration().setDirectory(FileUtil.isAbsolute(file) ? file.getAbsolutePath() : file.getPath()); }
void function(File file) { this.file = file; getConfiguration().setDirectory(FileUtil.isAbsolute(file) ? file.getAbsolutePath() : file.getPath()); }
/** * The starting directory */
The starting directory
setFile
{ "repo_name": "logzio/camel", "path": "camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java", "license": "apache-2.0", "size": 7175 }
[ "java.io.File", "org.apache.camel.util.FileUtil" ]
import java.io.File; import org.apache.camel.util.FileUtil;
import java.io.*; import org.apache.camel.util.*;
[ "java.io", "org.apache.camel" ]
java.io; org.apache.camel;
351,845
@SuppressWarnings({"BusyWait"}) private static void test(C2<Integer, ConcurrentLinkedHashMap<Integer, Integer>, Integer> readOp, int threadCnt, double writeProportion) { assert writeProportion < 1; ConcurrentLinkedHashMap<Integer, Integer> map = new ConcurrentLinkedHashMap<>(); CyclicBarrier barrier = new CyclicBarrier(threadCnt + 1); Collection<TestThread> threads = new ArrayList<>(threadCnt); for (int i = 0; i < threadCnt; i++) { TestThread thread = new TestThread(readOp, map, writeProportion, barrier); threads.add(thread); thread.start(); } long start; try { // Wait threads warm-up. while (barrier.getNumberWaiting() != threadCnt) Thread.sleep(1); // Starting test and letting it run for 1 minute. barrier.await(); start = System.currentTimeMillis(); Thread.sleep(60000); } catch (InterruptedException ignored) { return; } catch (BrokenBarrierException e) { e.printStackTrace(); return; } for (TestThread th : threads) th.interrupt(); try { for (TestThread th : threads) th.join(); } catch (InterruptedException ignored) { return; } long time = System.currentTimeMillis() - start; long iters = 0; for (TestThread th : threads) iters += th.iterations(); System.out.printf("%8s, %8d, %12d, %12d, %12d, %8.3f, %8.2f\n", readOp.toString(), threadCnt, 1000*iters/time, 1000*iters/(time*threadCnt), iters, time/(double)1000, writeProportion); } private static class TestThread extends Thread { private final C2<Integer, ConcurrentLinkedHashMap<Integer, Integer>, Integer> readOp; private final ConcurrentLinkedHashMap<Integer, Integer> map; private final double writeProportion; private final CyclicBarrier barrier; private final Random rnd = new Random(); private long iterations; TestThread(final C2<Integer, ConcurrentLinkedHashMap<Integer, Integer>, Integer> readOp, ConcurrentLinkedHashMap<Integer, Integer> map, double writeProportion, CyclicBarrier barrier) { this.readOp = readOp; this.map = map; this.writeProportion = writeProportion; this.barrier = barrier; }
@SuppressWarnings({STR}) static void function(C2<Integer, ConcurrentLinkedHashMap<Integer, Integer>, Integer> readOp, int threadCnt, double writeProportion) { assert writeProportion < 1; ConcurrentLinkedHashMap<Integer, Integer> map = new ConcurrentLinkedHashMap<>(); CyclicBarrier barrier = new CyclicBarrier(threadCnt + 1); Collection<TestThread> threads = new ArrayList<>(threadCnt); for (int i = 0; i < threadCnt; i++) { TestThread thread = new TestThread(readOp, map, writeProportion, barrier); threads.add(thread); thread.start(); } long start; try { while (barrier.getNumberWaiting() != threadCnt) Thread.sleep(1); barrier.await(); start = System.currentTimeMillis(); Thread.sleep(60000); } catch (InterruptedException ignored) { return; } catch (BrokenBarrierException e) { e.printStackTrace(); return; } for (TestThread th : threads) th.interrupt(); try { for (TestThread th : threads) th.join(); } catch (InterruptedException ignored) { return; } long time = System.currentTimeMillis() - start; long iters = 0; for (TestThread th : threads) iters += th.iterations(); System.out.printf(STR, readOp.toString(), threadCnt, 1000*iters/time, 1000*iters/(time*threadCnt), iters, time/(double)1000, writeProportion); } private static class TestThread extends Thread { private final C2<Integer, ConcurrentLinkedHashMap<Integer, Integer>, Integer> readOp; private final ConcurrentLinkedHashMap<Integer, Integer> map; private final double writeProportion; private final CyclicBarrier barrier; private final Random rnd = new Random(); private long iterations; TestThread(final C2<Integer, ConcurrentLinkedHashMap<Integer, Integer>, Integer> readOp, ConcurrentLinkedHashMap<Integer, Integer> map, double writeProportion, CyclicBarrier barrier) { this.readOp = readOp; this.map = map; this.writeProportion = writeProportion; this.barrier = barrier; }
/** * Test a generic access method on map. * * @param readOp Access method to test. * @param threadCnt Number of threads to run. * @param writeProportion Amount of writes from total number of iterations. */
Test a generic access method on map
test
{ "repo_name": "vldpyatkov/ignite", "path": "modules/core/src/test/java/org/apache/ignite/loadtests/lang/GridConcurrentLinkedHashMapBenchmark.java", "license": "apache-2.0", "size": 7582 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.Random", "java.util.concurrent.BrokenBarrierException", "java.util.concurrent.CyclicBarrier", "org.jsr166.ConcurrentLinkedHashMap" ]
import java.util.ArrayList; import java.util.Collection; import java.util.Random; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; import org.jsr166.ConcurrentLinkedHashMap;
import java.util.*; import java.util.concurrent.*; import org.jsr166.*;
[ "java.util", "org.jsr166" ]
java.util; org.jsr166;
111,736
public Annotation getAnnotation() { return annotation; }
Annotation function() { return annotation; }
/** * Get the underlying annotation. * * @return {@code non-null;} the annotation */
Get the underlying annotation
getAnnotation
{ "repo_name": "nikita36078/J2ME-Loader", "path": "dexlib/src/main/java/com/android/dx/rop/cst/CstAnnotation.java", "license": "apache-2.0", "size": 2411 }
[ "com.android.dx.rop.annotation.Annotation" ]
import com.android.dx.rop.annotation.Annotation;
import com.android.dx.rop.annotation.*;
[ "com.android.dx" ]
com.android.dx;
2,115,899
private void cursorChange(String sqlState, String initialCursor, String positionedStatement, String changeToCursor) throws SQLException { // Since these tests delete rows we add a couple more to // ensure any cursor we open has at least one row. Statement s = createStatement(); s.executeUpdate("insert into t values (425, 'apache db db')"); s.executeUpdate("insert into t values (280, 'db-user users')"); s.close(); commit(); cursorChange(sqlState, "CHANGE_ME", initialCursor, positionedStatement, changeToCursor); cursorChange(sqlState, null, initialCursor, positionedStatement, changeToCursor); }
void function(String sqlState, String initialCursor, String positionedStatement, String changeToCursor) throws SQLException { Statement s = createStatement(); s.executeUpdate(STR); s.executeUpdate(STR); s.close(); commit(); cursorChange(sqlState, STR, initialCursor, positionedStatement, changeToCursor); cursorChange(sqlState, null, initialCursor, positionedStatement, changeToCursor); }
/** * Run cursorChange() with an application provided name * and a system provided name. * */
Run cursorChange() with an application provided name and a system provided name
cursorChange
{ "repo_name": "splicemachine/spliceengine", "path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/lang/CurrentOfTest.java", "license": "agpl-3.0", "size": 23325 }
[ "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
755,521
public void lambda14() { int[] numbersA = {0, 2, 4, 5, 6, 8, 9}; int[] numbersB = {1, 3, 5, 7, 8}; System.out.println("Pairs where a < b:"); Arrays.stream(numbersA) .forEach(a -> Arrays.stream(numbersB) .filter(b -> a < b) .forEach(b -> { System.out.println(String.format("%d is less than %d", a, b)); }) ); } /** * A nested forEach to produce all customer/order entries. * * <p>Note that we can not use a * {@link java.util.stream.Stream#flatMap(java.util.function.Function) Stream.flatMap}
void function() { int[] numbersA = {0, 2, 4, 5, 6, 8, 9}; int[] numbersB = {1, 3, 5, 7, 8}; System.out.println(STR); Arrays.stream(numbersA) .forEach(a -> Arrays.stream(numbersB) .filter(b -> a < b) .forEach(b -> { System.out.println(String.format(STR, a, b)); }) ); } /** * A nested forEach to produce all customer/order entries. * * <p>Note that we can not use a * {@link java.util.stream.Stream#flatMap(java.util.function.Function) Stream.flatMap}
/** * Given two arrays we find all pairs where a is &lt; b. */
Given two arrays we find all pairs where a is &lt; b
lambda14
{ "repo_name": "brettryan/jdk8-lambda-samples", "path": "src/main/java/com/drunkendev/lambdas/ProjectionOperators.java", "license": "apache-2.0", "size": 10353 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,692,240
@EventHandler(value = "enter", target = "@txtPassword1") private void onEnter$txtPassword1() { txtPassword2.setFocus(true); txtPassword2.selectAll(); }
@EventHandler(value = "enter", target = STR) private void onEnter$txtPassword1() { txtPassword2.setFocus(true); txtPassword2.selectAll(); }
/** * Pressing return in the new password text box moves to the confirm password text box. */
Pressing return in the new password text box moves to the confirm password text box
onEnter$txtPassword1
{ "repo_name": "carewebframework/carewebframework-core", "path": "org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/controller/PasswordChangeController.java", "license": "apache-2.0", "size": 5402 }
[ "org.fujion.annotation.EventHandler" ]
import org.fujion.annotation.EventHandler;
import org.fujion.annotation.*;
[ "org.fujion.annotation" ]
org.fujion.annotation;
530,692
public void setContainerHLMarkingHLAPI( HLMarkingHLAPI elem){ if(elem!=null) item.setContainerHLMarking((HLMarking)elem.getContainedItem()); }
void function( HLMarkingHLAPI elem){ if(elem!=null) item.setContainerHLMarking((HLMarking)elem.getContainedItem()); }
/** * set ContainerHLMarking */
set ContainerHLMarking
setContainerHLMarkingHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/multisets/hlapi/EmptyHLAPI.java", "license": "epl-1.0", "size": 113920 }
[ "fr.lip6.move.pnml.hlpn.hlcorestructure.HLMarking", "fr.lip6.move.pnml.hlpn.hlcorestructure.hlapi.HLMarkingHLAPI" ]
import fr.lip6.move.pnml.hlpn.hlcorestructure.HLMarking; import fr.lip6.move.pnml.hlpn.hlcorestructure.hlapi.HLMarkingHLAPI;
import fr.lip6.move.pnml.hlpn.hlcorestructure.*; import fr.lip6.move.pnml.hlpn.hlcorestructure.hlapi.*;
[ "fr.lip6.move" ]
fr.lip6.move;
1,442,551
public boolean tryResetResponse() throws IOException { if (!super.tryResetResponse()) { try { if (!this.response.isCommitted()) { this.response.reset(); if (getLogger().isDebugEnabled()) { getLogger().debug("Response successfully reset"); } return true; } } catch (Exception e) { // Log the error, but don't transmit it getLogger().warn("Problem resetting response", e); } if (getLogger().isDebugEnabled()) { getLogger().debug("Response wasn't reset"); } return false; } return true; }
boolean function() throws IOException { if (!super.tryResetResponse()) { try { if (!this.response.isCommitted()) { this.response.reset(); if (getLogger().isDebugEnabled()) { getLogger().debug(STR); } return true; } } catch (Exception e) { getLogger().warn(STR, e); } if (getLogger().isDebugEnabled()) { getLogger().debug(STR); } return false; } return true; }
/** * Reset the response if possible. This allows error handlers to have * a higher chance to produce clean output if the pipeline that raised * the error has already output some data. * * @return true if the response was successfully reset */
Reset the response if possible. This allows error handlers to have a higher chance to produce clean output if the pipeline that raised the error has already output some data
tryResetResponse
{ "repo_name": "apache/cocoon", "path": "blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/environment/portlet/PortletEnvironment.java", "license": "apache-2.0", "size": 9723 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
189,620
private Object[] buildCategoryNodes(Collection<ChildAssociationRef> cars) { Object[] categoryNodes = new Object[cars.size()]; int i = 0; for (ChildAssociationRef car : cars) { categoryNodes[i++] = new CategoryNode(car.getChildRef(), this.services, getScope()); } return categoryNodes; }
Object[] function(Collection<ChildAssociationRef> cars) { Object[] categoryNodes = new Object[cars.size()]; int i = 0; for (ChildAssociationRef car : cars) { categoryNodes[i++] = new CategoryNode(car.getChildRef(), this.services, getScope()); } return categoryNodes; }
/** * Build category nodes. * * @param cars list of associations to category nodes * @return {@link Object}[] array of category nodes */
Build category nodes
buildCategoryNodes
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/repository/source/java/org/alfresco/repo/jscript/Classification.java", "license": "lgpl-3.0", "size": 7057 }
[ "java.util.Collection", "org.alfresco.service.cmr.repository.ChildAssociationRef" ]
import java.util.Collection; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import java.util.*; import org.alfresco.service.cmr.repository.*;
[ "java.util", "org.alfresco.service" ]
java.util; org.alfresco.service;
1,320,472
void responseCompleted() throws IOException, HttpException;
void responseCompleted() throws IOException, HttpException;
/** * Invoked to signal that the response has been fully processed. */
Invoked to signal that the response has been fully processed
responseCompleted
{ "repo_name": "viapp/httpasyncclient-android", "path": "src/main/java/org/apache/http/nio/protocol/HttpAsyncClientExchangeHandler.java", "license": "apache-2.0", "size": 6225 }
[ "java.io.IOException", "org.apache.http.HttpException" ]
import java.io.IOException; import org.apache.http.HttpException;
import java.io.*; import org.apache.http.*;
[ "java.io", "org.apache.http" ]
java.io; org.apache.http;
2,396,740
protected void callVerifyObjectTrust(Object obj, ClassLoader loader, Collection context) throws RemoteException { logger.fine("Call 'Security.verifyObjectTrust(" + obj + ", " + loader + ", " + context + ")'."); Security.verifyObjectTrust(obj, loader, context); }
void function(Object obj, ClassLoader loader, Collection context) throws RemoteException { logger.fine(STR + obj + STR + loader + STR + context + ")'."); Security.verifyObjectTrust(obj, loader, context); }
/** * Invokes 'Security.verifyObjectTrust' method with given arguments. * Rethrows any exception thrown by 'verifyObjectTrust' method. * * @param obj Object for 'verifyObjectTrust' method * @param loader ClassLoader for 'verifyObjectTrust' method * @param context Collection for 'verifyObjectTrust' method * @throws java.rmi.RemoteException */
Invokes 'Security.verifyObjectTrust' method with given arguments. Rethrows any exception thrown by 'verifyObjectTrust' method
callVerifyObjectTrust
{ "repo_name": "cdegroot/river", "path": "qa/src/com/sun/jini/test/spec/security/security/VerifyObjectTrustTest.java", "license": "apache-2.0", "size": 20564 }
[ "java.rmi.RemoteException", "java.util.Collection", "net.jini.security.Security" ]
import java.rmi.RemoteException; import java.util.Collection; import net.jini.security.Security;
import java.rmi.*; import java.util.*; import net.jini.security.*;
[ "java.rmi", "java.util", "net.jini.security" ]
java.rmi; java.util; net.jini.security;
712,210
public Report createReport(InputStream reportObjectiveAsXml) { accessChecker.checkIsLoggedInUserMemberOfGroup(ProjectForgeGroup.FINANCE_GROUP, ProjectForgeGroup.CONTROLLING_GROUP); ReportObjective reportObjective = deserializeFromXML(reportObjectiveAsXml); if (reportObjective == null) { return null; } Report report = new Report(reportObjective); return report; }
Report function(InputStream reportObjectiveAsXml) { accessChecker.checkIsLoggedInUserMemberOfGroup(ProjectForgeGroup.FINANCE_GROUP, ProjectForgeGroup.CONTROLLING_GROUP); ReportObjective reportObjective = deserializeFromXML(reportObjectiveAsXml); if (reportObjective == null) { return null; } Report report = new Report(reportObjective); return report; }
/** * Erzeugt einen Report ohne Zeitraumangabe. Es wird lediglich das ReportObjective als xml vom InputStream * deserialisiert und dem erzeugtem Report zugewiesen. * * @param reportObjectiveAsXml ReportObjective als XML. * @see #deserializeFromXML(InputStream) */
Erzeugt einen Report ohne Zeitraumangabe. Es wird lediglich das ReportObjective als xml vom InputStream deserialisiert und dem erzeugtem Report zugewiesen
createReport
{ "repo_name": "micromata/projectforge", "path": "projectforge-business/src/main/java/org/projectforge/business/fibu/kost/reporting/ReportDao.java", "license": "gpl-3.0", "size": 4603 }
[ "java.io.InputStream", "org.projectforge.business.user.ProjectForgeGroup" ]
import java.io.InputStream; import org.projectforge.business.user.ProjectForgeGroup;
import java.io.*; import org.projectforge.business.user.*;
[ "java.io", "org.projectforge.business" ]
java.io; org.projectforge.business;
883,537
public static boolean validateBinding(String valueSelector, Class<? extends Item> itemClass) throws IllegalArgumentException, InvalidClassException { for (RFXComValueSelector c : RFXComValueSelector.values()) { if (c.text.equals(valueSelector)) { if (c.getItemClass().equals(itemClass)) { return true; } else { throw new InvalidClassException("Not valid class for value selector"); } } } throw new IllegalArgumentException("Not valid value selector"); }
static boolean function(String valueSelector, Class<? extends Item> itemClass) throws IllegalArgumentException, InvalidClassException { for (RFXComValueSelector c : RFXComValueSelector.values()) { if (c.text.equals(valueSelector)) { if (c.getItemClass().equals(itemClass)) { return true; } else { throw new InvalidClassException(STR); } } } throw new IllegalArgumentException(STR); }
/** * Procedure to validate selector string. * * @param valueSelector * selector string e.g. RawData, Command, Temperature * @return true if item is valid. * @throws IllegalArgumentException * Not valid value selector. * @throws InvalidClassException * Not valid class for value selector. */
Procedure to validate selector string
validateBinding
{ "repo_name": "beowulfe/openhab", "path": "bundles/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComValueSelector.java", "license": "epl-1.0", "size": 4863 }
[ "java.io.InvalidClassException", "org.openhab.core.items.Item" ]
import java.io.InvalidClassException; import org.openhab.core.items.Item;
import java.io.*; import org.openhab.core.items.*;
[ "java.io", "org.openhab.core" ]
java.io; org.openhab.core;
2,676,133
private void addDevice(final FacesContext context) { device.setEnabled(Authorize.ENABLE); device.setPatient(patient); final DeviceManagerResult result = deviceFacade.add(device); final DeviceManagerStatus status = result.getStatus(); if (result.isSuccess()) { final String detail = String.format(MSG_NEW_PATIENT_SAVED_PATTERN, patient.getFullname(), device.getApiKey()); createInfoMessage(context, INFO_SUCCESSFULL, detail); LOGGER.info("A new device {} added to {} ", device.getApiKey(), patient); patient = null; device = new Device(); } else if (status.equals(DeviceManagerStatus.PATIENT_NOT_EXIST)) { createErrorMessage(context, ERROR_PATIENT_NOT_FOUND, MSG_PATIENT_NOT_FOUND); LOGGER.error("The patient not found!"); } else { createErrorMessage(context, ERROR_API_KEY, MSG_NON_UNIQUE_API_KEY); LOGGER.error("The api key is not unique!"); } }
void function(final FacesContext context) { device.setEnabled(Authorize.ENABLE); device.setPatient(patient); final DeviceManagerResult result = deviceFacade.add(device); final DeviceManagerStatus status = result.getStatus(); if (result.isSuccess()) { final String detail = String.format(MSG_NEW_PATIENT_SAVED_PATTERN, patient.getFullname(), device.getApiKey()); createInfoMessage(context, INFO_SUCCESSFULL, detail); LOGGER.info(STR, device.getApiKey(), patient); patient = null; device = new Device(); } else if (status.equals(DeviceManagerStatus.PATIENT_NOT_EXIST)) { createErrorMessage(context, ERROR_PATIENT_NOT_FOUND, MSG_PATIENT_NOT_FOUND); LOGGER.error(STR); } else { createErrorMessage(context, ERROR_API_KEY, MSG_NON_UNIQUE_API_KEY); LOGGER.error(STR); } }
/** * Sisteme yeni bir cihaz ekler * * @param context */
Sisteme yeni bir cihaz ekler
addDevice
{ "repo_name": "omerozkan/vipera", "path": "vipera-jsf/src/main/java/info/ozkan/vipera/views/device/DeviceAddBean.java", "license": "gpl-3.0", "size": 7061 }
[ "info.ozkan.vipera.business.device.DeviceManagerResult", "info.ozkan.vipera.business.device.DeviceManagerStatus", "info.ozkan.vipera.entities.Authorize", "info.ozkan.vipera.entities.Device", "javax.faces.context.FacesContext" ]
import info.ozkan.vipera.business.device.DeviceManagerResult; import info.ozkan.vipera.business.device.DeviceManagerStatus; import info.ozkan.vipera.entities.Authorize; import info.ozkan.vipera.entities.Device; import javax.faces.context.FacesContext;
import info.ozkan.vipera.business.device.*; import info.ozkan.vipera.entities.*; import javax.faces.context.*;
[ "info.ozkan.vipera", "javax.faces" ]
info.ozkan.vipera; javax.faces;
556,837
private void deleteBatch(List<String> messageIds) throws IOException { int retries = 0; List<String> errorMessages = new ArrayList<>(); Map<String, String> pendingReceipts = IntStream.range(0, messageIds.size()) .boxed() .filter(i -> inFlight.containsKey(messageIds.get(i))) .collect(toMap(Object::toString, i -> inFlight.get(messageIds.get(i)).receiptHandle)); while (!pendingReceipts.isEmpty()) { if (retries >= BATCH_OPERATION_MAX_RETIRES) { throw new IOException( "Failed to delete " + pendingReceipts.size() + " messages after " + retries + " retries: " + String.join(", ", errorMessages)); } List<DeleteMessageBatchRequestEntry> entries = pendingReceipts.entrySet().stream() .map(r -> new DeleteMessageBatchRequestEntry(r.getKey(), r.getValue())) .collect(Collectors.toList()); DeleteMessageBatchResult result = source.getSqs().deleteMessageBatch(source.getRead().queueUrl(), entries); // Retry errors except invalid handles Set<BatchResultErrorEntry> retryErrors = result.getFailed().stream() .filter(e -> !e.getCode().equals("ReceiptHandleIsInvalid")) .collect(Collectors.toSet()); pendingReceipts .keySet() .retainAll( retryErrors.stream().map(BatchResultErrorEntry::getId).collect(Collectors.toSet())); errorMessages = retryErrors.stream().map(BatchResultErrorEntry::getMessage).collect(Collectors.toList()); retries += 1; } deletedIds.add(messageIds); }
void function(List<String> messageIds) throws IOException { int retries = 0; List<String> errorMessages = new ArrayList<>(); Map<String, String> pendingReceipts = IntStream.range(0, messageIds.size()) .boxed() .filter(i -> inFlight.containsKey(messageIds.get(i))) .collect(toMap(Object::toString, i -> inFlight.get(messageIds.get(i)).receiptHandle)); while (!pendingReceipts.isEmpty()) { if (retries >= BATCH_OPERATION_MAX_RETIRES) { throw new IOException( STR + pendingReceipts.size() + STR + retries + STR + String.join(STR, errorMessages)); } List<DeleteMessageBatchRequestEntry> entries = pendingReceipts.entrySet().stream() .map(r -> new DeleteMessageBatchRequestEntry(r.getKey(), r.getValue())) .collect(Collectors.toList()); DeleteMessageBatchResult result = source.getSqs().deleteMessageBatch(source.getRead().queueUrl(), entries); Set<BatchResultErrorEntry> retryErrors = result.getFailed().stream() .filter(e -> !e.getCode().equals(STR)) .collect(Collectors.toSet()); pendingReceipts .keySet() .retainAll( retryErrors.stream().map(BatchResultErrorEntry::getId).collect(Collectors.toSet())); errorMessages = retryErrors.stream().map(BatchResultErrorEntry::getMessage).collect(Collectors.toList()); retries += 1; } deletedIds.add(messageIds); }
/** * delete the provided {@code messageIds} from SQS, blocking until all of the messages are * deleted. * * <p>CAUTION: May be invoked from a separate thread. * * <p>CAUTION: Retains {@code messageIds}. */
delete the provided messageIds from SQS, blocking until all of the messages are deleted
deleteBatch
{ "repo_name": "lukecwik/incubator-beam", "path": "sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/sqs/SqsUnboundedReader.java", "license": "apache-2.0", "size": 36369 }
[ "com.amazonaws.services.sqs.model.BatchResultErrorEntry", "com.amazonaws.services.sqs.model.DeleteMessageBatchRequestEntry", "com.amazonaws.services.sqs.model.DeleteMessageBatchResult", "java.io.IOException", "java.util.ArrayList", "java.util.List", "java.util.Map", "java.util.Set", "java.util.stream.Collectors", "java.util.stream.IntStream" ]
import com.amazonaws.services.sqs.model.BatchResultErrorEntry; import com.amazonaws.services.sqs.model.DeleteMessageBatchRequestEntry; import com.amazonaws.services.sqs.model.DeleteMessageBatchResult; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.IntStream;
import com.amazonaws.services.sqs.model.*; import java.io.*; import java.util.*; import java.util.stream.*;
[ "com.amazonaws.services", "java.io", "java.util" ]
com.amazonaws.services; java.io; java.util;
2,481,960
public void setUserPersistence(UserPersistence userPersistence) { this.userPersistence = userPersistence; }
void function(UserPersistence userPersistence) { this.userPersistence = userPersistence; }
/** * Sets the user persistence. * * @param userPersistence the user persistence */
Sets the user persistence
setUserPersistence
{ "repo_name": "RMarinDTI/CloubityRepo", "path": "Servicio-portlet/docroot/WEB-INF/src/es/davinciti/liferay/service/base/CurrencyServiceBaseImpl.java", "license": "unlicense", "size": 52888 }
[ "com.liferay.portal.service.persistence.UserPersistence" ]
import com.liferay.portal.service.persistence.UserPersistence;
import com.liferay.portal.service.persistence.*;
[ "com.liferay.portal" ]
com.liferay.portal;
2,247,464
private String computeRequestSubsettingLimits(GetCoverageRequest req, Metadata coverage) throws WCSException { int dims = coverage.getDimension(), i = 0; String[] limits = new String[dims]; Double[] high = new Double[dims]; Double[] low = new Double[dims]; String[] axesLabels = new String[dims]; boolean[] sliced = new boolean[dims]; boolean[] trimmed = new boolean[dims]; int axisIndex; String axis; Iterator<CellDomainElement> cdit = coverage.getCellDomainIterator(); Iterator<DomainElement> dit = coverage.getDomainIterator(); i = 0; while (cdit.hasNext() && dit.hasNext()) { CellDomainElement cell = cdit.next(); DomainElement dom = dit.next(); high[i] = cell.getHi().doubleValue(); low[i] = cell.getLo().doubleValue(); axesLabels[i] = dom.getName(); limits[i] = low[i] + ":" + high[i]; sliced[i] = false; trimmed[i] = false; i++; } for (DimensionSubset subset : req.getSubsets()) { axis = subset.getDimension(); axisIndex = coverage.getDomainIndexByName(axis); if (axisIndex == -1) { throw new WCSException(ExceptionCode.InvalidParameterValue, "Unknown axis: " + axis); } if (trimmed[axisIndex] || sliced[axisIndex]) { throw new WCSException(ExceptionCode.NoApplicableCode, "Already performed one subsetting operation on axis: " + axis); } if (subset instanceof DimensionTrim) { DimensionTrim trim = (DimensionTrim) subset; // low[axisIndex] = d2s(trim.getTrimLow()); // high[axisIndex] = trim.getTrimHigh(); limits[axisIndex] = low[axisIndex] + ":" + high[axisIndex]; trimmed[axisIndex] = true; } else if (subset instanceof DimensionSlice) { DimensionSlice slice = (DimensionSlice) subset; // low[axisIndex] = slice.getSlicePoint(); // high[axisIndex] = slice.getSlicePoint(); limits[axisIndex] = slice.getSlicePoint().toString(); sliced[axisIndex] = true; } log.debug("New limits for axis {}: {}", axis, limits[axisIndex]); } // Compute the lowest, highest point and the labels lowPoint = ""; highPoint = ""; newAxesLabels = ""; for (i = 0; i < dims; i++) { if (!sliced[i]) { lowPoint += low[i] + " "; highPoint += high[i] + " "; newAxesLabels += axesLabels[i] + " "; } } lowPoint = lowPoint.trim(); highPoint = highPoint.trim(); newAxesLabels = newAxesLabels.trim(); return StringUtil.combine(",", limits); }
String function(GetCoverageRequest req, Metadata coverage) throws WCSException { int dims = coverage.getDimension(), i = 0; String[] limits = new String[dims]; Double[] high = new Double[dims]; Double[] low = new Double[dims]; String[] axesLabels = new String[dims]; boolean[] sliced = new boolean[dims]; boolean[] trimmed = new boolean[dims]; int axisIndex; String axis; Iterator<CellDomainElement> cdit = coverage.getCellDomainIterator(); Iterator<DomainElement> dit = coverage.getDomainIterator(); i = 0; while (cdit.hasNext() && dit.hasNext()) { CellDomainElement cell = cdit.next(); DomainElement dom = dit.next(); high[i] = cell.getHi().doubleValue(); low[i] = cell.getLo().doubleValue(); axesLabels[i] = dom.getName(); limits[i] = low[i] + ":" + high[i]; sliced[i] = false; trimmed[i] = false; i++; } for (DimensionSubset subset : req.getSubsets()) { axis = subset.getDimension(); axisIndex = coverage.getDomainIndexByName(axis); if (axisIndex == -1) { throw new WCSException(ExceptionCode.InvalidParameterValue, STR + axis); } if (trimmed[axisIndex] sliced[axisIndex]) { throw new WCSException(ExceptionCode.NoApplicableCode, STR + axis); } if (subset instanceof DimensionTrim) { DimensionTrim trim = (DimensionTrim) subset; limits[axisIndex] = low[axisIndex] + ":" + high[axisIndex]; trimmed[axisIndex] = true; } else if (subset instanceof DimensionSlice) { DimensionSlice slice = (DimensionSlice) subset; limits[axisIndex] = slice.getSlicePoint().toString(); sliced[axisIndex] = true; } log.debug(STR, axis, limits[axisIndex]); } lowPoint = STRSTRSTR STR STR STR,", limits); }
/** * Computes the domain of the new coverage, and returns a string that can be * used to do subsetting on the original coverage. Also computes the low, high * and the axis labels for the new coverage. * * @param coverage * @return * @throws WCSException */
Computes the domain of the new coverage, and returns a string that can be used to do subsetting on the original coverage. Also computes the low, high and the axis labels for the new coverage
computeRequestSubsettingLimits
{ "repo_name": "dioptre/rasdaman", "path": "applications/petascope/src/main/java/petascope/wcs2/legacy/GetCoverageOld2.java", "license": "gpl-3.0", "size": 9035 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
536,034
public void start(String tag, String[] names, String[] values, int nattr) throws IOException { tag(tag, names, values, nattr, false); }
void function(String tag, String[] names, String[] values, int nattr) throws IOException { tag(tag, names, values, nattr, false); }
/** * Write a start tag with attributes. The tag will be followed by a newline, and the indentation * level will be increased. * * @param tag the tag name * @param names the names of the attributes * @param values the values of the attributes * @param nattr the number of attributes * @throws IOException unable to perform task for the stated reasons. */
Write a start tag with attributes. The tag will be followed by a newline, and the indentation level will be increased
start
{ "repo_name": "hsanchez/demodetect", "path": "src/edu/ucsc/twitter/util/XmlWriter.java", "license": "apache-2.0", "size": 15362 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,432,309
public User getRequestingUser();
User function();
/** * Returns the user which requested a resource. * * @return The user which requested a resource, never <code>null</code>. */
Returns the user which requested a resource
getRequestingUser
{ "repo_name": "AludraTest/cloud-manager-api", "path": "src/main/java/org/aludratest/cloud/request/ResourceRequest.java", "license": "apache-2.0", "size": 2372 }
[ "org.aludratest.cloud.user.User" ]
import org.aludratest.cloud.user.User;
import org.aludratest.cloud.user.*;
[ "org.aludratest.cloud" ]
org.aludratest.cloud;
1,618,863
private String lockRandomNamespace(final boolean readOnly) { final int k = r.nextInt((int) namespaceExistCounter.get()); int i = -1; while (true) { for (Map.Entry<String, ReadWriteLock> e : namespaces.entrySet()) { if (namespaceExistCounter.get() == 0) { throw new RuntimeException("No namespaces? readOnly=" + readOnly); } i++; if (i < k) { // log.info("Ignoring: i=" + i + "<k=" + k + // ", namespace=" // + e.getKey()); continue; } // We can accept this namespace. final String namespace = e.getKey(); final ReadWriteLock lock = e.getValue(); // Take the lock. final Lock takenLock; { if (readOnly) takenLock = lock.readLock();// read lock. else takenLock = lock.writeLock(); // write lock. // acquire the lock. takenLock.lock(); } if (namespaces.get(namespace) != lock) { takenLock.unlock(); continue; // continue looking. } return namespace; } } // We should never get here. }
String function(final boolean readOnly) { final int k = r.nextInt((int) namespaceExistCounter.get()); int i = -1; while (true) { for (Map.Entry<String, ReadWriteLock> e : namespaces.entrySet()) { if (namespaceExistCounter.get() == 0) { throw new RuntimeException(STR + readOnly); } i++; if (i < k) { continue; } final String namespace = e.getKey(); final ReadWriteLock lock = e.getValue(); final Lock takenLock; { if (readOnly) takenLock = lock.readLock(); else takenLock = lock.writeLock(); takenLock.lock(); } if (namespaces.get(namespace) != lock) { takenLock.unlock(); continue; } return namespace; } } }
/** * Return a namespace at random from the set of known to exist * namespaces. The caller will hold the appropriate lock. */
Return a namespace at random from the set of known to exist namespaces. The caller will hold the appropriate lock
lockRandomNamespace
{ "repo_name": "blazegraph/database", "path": "bigdata-sails-test/src/test/java/com/bigdata/rdf/sail/webapp/StressTestConcurrentRestApiRequests.java", "license": "gpl-2.0", "size": 69678 }
[ "java.util.Map", "java.util.concurrent.locks.Lock", "java.util.concurrent.locks.ReadWriteLock" ]
import java.util.Map; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock;
import java.util.*; import java.util.concurrent.locks.*;
[ "java.util" ]
java.util;
629,779
public final MetaProperty<Region> region() { return _region; }
final MetaProperty<Region> function() { return _region; }
/** * The meta-property for the {@code region} property. * @return the meta-property, not null */
The meta-property for the region property
region
{ "repo_name": "McLeodMoores/starling", "path": "projects/analytics/src/main/java/com/opengamma/analytics/financial/legalentity/LegalEntity.java", "license": "apache-2.0", "size": 16071 }
[ "org.joda.beans.MetaProperty" ]
import org.joda.beans.MetaProperty;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
349,627
public static String validateBagOperations(String bagName, String[] selectedBags, String operation) { try { ServletContext servletContext = WebContextFactory.get().getServletContext(); HttpSession session = WebContextFactory.get().getSession(); Profile profile = SessionMethods.getProfile(session); // TODO get error text from the properties file if (selectedBags.length == 0) { return "No lists are selected"; } if ("delete".equals(operation)) { for (int i = 0; i < selectedBags.length; i++) { Set<String> queries = new HashSet<String>(); queries.addAll(queriesThatMentionBag(profile.getSavedQueries(), selectedBags[i])); queries.addAll(queriesThatMentionBag(profile.getHistory(), selectedBags[i])); if (queries.size() > 0) { // TODO the javascript method relies on the content of this message. // which is dumb and should be fixed. in the meantime, don't change this. final String msg = "You are trying to delete the list: `" + selectedBags[i] + "`, which is used by these queries: " + queries + ". Select OK to delete the list and queries or Cancel " + "to cancel this operation."; return msg; } } } else if (!"copy".equals(operation)) { Properties properties = SessionMethods.getWebProperties(servletContext); String defaultName = properties.getProperty("lists.input.example"); if (bagName.equalsIgnoreCase(defaultName)) { return "New list name is required"; } else if (!NameUtil.isValidName(bagName)) { return NameUtil.INVALID_NAME_MSG; } } return ""; } catch (RuntimeException e) { processException(e); return null; } }
static String function(String bagName, String[] selectedBags, String operation) { try { ServletContext servletContext = WebContextFactory.get().getServletContext(); HttpSession session = WebContextFactory.get().getSession(); Profile profile = SessionMethods.getProfile(session); if (selectedBags.length == 0) { return STR; } if (STR.equals(operation)) { for (int i = 0; i < selectedBags.length; i++) { Set<String> queries = new HashSet<String>(); queries.addAll(queriesThatMentionBag(profile.getSavedQueries(), selectedBags[i])); queries.addAll(queriesThatMentionBag(profile.getHistory(), selectedBags[i])); if (queries.size() > 0) { final String msg = STR + selectedBags[i] + STR + queries + STR + STR; return msg; } } } else if (!"copy".equals(operation)) { Properties properties = SessionMethods.getWebProperties(servletContext); String defaultName = properties.getProperty(STR); if (bagName.equalsIgnoreCase(defaultName)) { return STR; } else if (!NameUtil.isValidName(bagName)) { return NameUtil.INVALID_NAME_MSG; } } return ""; } catch (RuntimeException e) { processException(e); return null; } }
/** * validation that happens before new bag is saved * @param bagName name of new list * @param selectedBags bags involved in operation * @param operation which operation is taking place - delete, union, intersect or subtract * @return error msg, if any */
validation that happens before new bag is saved
validateBagOperations
{ "repo_name": "julie-sullivan/phytomine", "path": "intermine/web/main/src/org/intermine/dwr/AjaxServices.java", "license": "lgpl-2.1", "size": 63770 }
[ "java.util.HashSet", "java.util.Properties", "java.util.Set", "javax.servlet.ServletContext", "javax.servlet.http.HttpSession", "org.directwebremoting.WebContextFactory", "org.intermine.api.profile.Profile", "org.intermine.api.util.NameUtil", "org.intermine.web.logic.session.SessionMethods" ]
import java.util.HashSet; import java.util.Properties; import java.util.Set; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import org.directwebremoting.WebContextFactory; import org.intermine.api.profile.Profile; import org.intermine.api.util.NameUtil; import org.intermine.web.logic.session.SessionMethods;
import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.directwebremoting.*; import org.intermine.api.profile.*; import org.intermine.api.util.*; import org.intermine.web.logic.session.*;
[ "java.util", "javax.servlet", "org.directwebremoting", "org.intermine.api", "org.intermine.web" ]
java.util; javax.servlet; org.directwebremoting; org.intermine.api; org.intermine.web;
2,101,289
protected void updateAccountAmount(KualiDecimal additionalAmount, PurchasingAccountsPayableLineAssetAccount targetAccount) { KualiDecimal baseAmount = targetAccount.getItemAccountTotalAmount(); targetAccount.setItemAccountTotalAmount(baseAmount != null ? baseAmount.add(additionalAmount) : additionalAmount); }
void function(KualiDecimal additionalAmount, PurchasingAccountsPayableLineAssetAccount targetAccount) { KualiDecimal baseAmount = targetAccount.getItemAccountTotalAmount(); targetAccount.setItemAccountTotalAmount(baseAmount != null ? baseAmount.add(additionalAmount) : additionalAmount); }
/** * Update targetAccount by additionalAmount. * * @param additionalAmount * @param targetAccount */
Update targetAccount by additionalAmount
updateAccountAmount
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/cab/document/service/impl/PurApLineServiceImpl.java", "license": "apache-2.0", "size": 62162 }
[ "org.kuali.kfs.module.cab.businessobject.PurchasingAccountsPayableLineAssetAccount", "org.kuali.rice.core.api.util.type.KualiDecimal" ]
import org.kuali.kfs.module.cab.businessobject.PurchasingAccountsPayableLineAssetAccount; import org.kuali.rice.core.api.util.type.KualiDecimal;
import org.kuali.kfs.module.cab.businessobject.*; import org.kuali.rice.core.api.util.type.*;
[ "org.kuali.kfs", "org.kuali.rice" ]
org.kuali.kfs; org.kuali.rice;
2,664,698
public void test_2515() throws Exception { Connection conn = getConnection(); PreparedStatement ps = conn.prepareStatement ( "create type price_2515 external name 'com.splicemachine.dbTesting.functionTests.tests.lang.Price' language java\n" ); ps.execute(); ps.close(); ps = conn.prepareStatement ( "create procedure proc_2515\n" + "(\n" + "\tin passNumber int,\n" + "\tout returnMessage varchar( 32672 ),\n" + "\tinout bigintArg bigint,\n" + "\tinout blobArg blob,\n" + "inout booleanArg boolean,\n" + "inout charArg char( 6 ),\n" + "inout charForBitDataArg char( 3 ) for bit data,\n" + "inout clobArg clob,\n" + "inout dateArg date,\n" + "inout decimalArg decimal,\n" + "inout doubleArg double,\n" + "inout intArg int,\n" + "inout longVarcharArg long varchar,\n" + "inout longVarcharForBitDataArg long varchar for bit data,\n" + "inout realArg real,\n" + "inout smallintArg smallint,\n" + "inout timeArg time,\n" + "inout timestampArg timestamp,\n" + "inout priceArg price_2515,\n" + "inout varcharArg varchar( 20 ),\n" + "inout varcharForBitDataArg varchar( 3 ) for bit data\n" + ")\n" + "parameter style java language java no sql\n" + "external name '" + ProcedureTest.class.getName() + ".proc_2515'" ); ps.execute(); ps.close(); CallableStatement cs = conn.prepareCall ( "call proc_2515( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ); AllTypesTuple firstArgs = makeFirstAllTypesTuple(); int idx = 2; cs.registerOutParameter( idx++, Types.VARCHAR ); cs.registerOutParameter( idx, Types.BIGINT ); cs.setLong( idx++, firstArgs.get_bigintArg().longValue() ); cs.registerOutParameter( idx, Types.BLOB ); cs.setBlob( idx++, firstArgs.get_blobArg() ); cs.registerOutParameter( idx, Types.BOOLEAN ); cs.setBoolean( idx++, firstArgs.get_booleanArg().booleanValue() ); cs.registerOutParameter( idx, Types.CHAR ); cs.setString( idx++, firstArgs.get_charArg() ); cs.registerOutParameter( idx, Types.BINARY ); cs.setBytes( idx++, firstArgs.get_charForBitDataArg() ); cs.registerOutParameter( idx, Types.CLOB ); cs.setClob( idx++, firstArgs.get_clobArg() ); cs.registerOutParameter( idx, Types.DATE ); cs.setDate( idx++, firstArgs.get_dateArg() ); cs.registerOutParameter( idx, Types.DECIMAL ); cs.setBigDecimal( idx++, firstArgs.get_decimalArg() ); cs.registerOutParameter( idx, Types.DOUBLE ); cs.setDouble( idx++, firstArgs.get_doubleArg().doubleValue() ); cs.registerOutParameter( idx, Types.INTEGER ); cs.setInt( idx++, firstArgs.get_intArg().intValue() ); cs.registerOutParameter( idx, Types.LONGVARCHAR ); cs.setString( idx++, firstArgs.get_longVarcharArg() ); cs.registerOutParameter( idx, Types.LONGVARBINARY ); cs.setBytes( idx++, firstArgs.get_longVarcharForBitDataArg() ); cs.registerOutParameter( idx, Types.REAL ); cs.setFloat( idx++, firstArgs.get_realArg().floatValue() ); cs.registerOutParameter( idx, Types.SMALLINT ); cs.setShort( idx++, firstArgs.get_smallintArg().shortValue() ); cs.registerOutParameter( idx, Types.TIME ); cs.setTime( idx++, firstArgs.get_timeArg() ); cs.registerOutParameter( idx, Types.TIMESTAMP ); cs.setTimestamp( idx++, firstArgs.get_timestampArg() ); cs.registerOutParameter( idx, Types.JAVA_OBJECT ); cs.setObject( idx++, firstArgs.get_priceArg() ); cs.registerOutParameter( idx, Types.VARCHAR ); cs.setString( idx++, firstArgs.get_varcharArg() ); cs.registerOutParameter( idx, Types.VARBINARY ); cs.setBytes( idx++, firstArgs.get_varcharForBitDataArg() ); cs.setInt( 1, 0 ); cs.execute(); assertEquals( "", cs.getString( 2 ) ); // the return message should be empty, meaning the call args were what the procedure expected assertEquals( "", makeSecondAllTypesTuple().compare( getActualReturnArgs( cs ) ) ); cs.setInt( 1, 1 ); cs.execute(); assertEquals( "", cs.getString( 2 ) ); // the return message should be empty, meaning the call args were what the procedure expected assertEquals( "", makeThirdAllTypesTuple().compare( getActualReturnArgs( cs ) ) ); cs.setInt( 1, 2 ); cs.execute(); assertEquals( "", cs.getString( 2 ) ); // the return message should be empty, meaning the call args were what the procedure expected assertEquals( "", makeFourthAllTypesTuple().compare( getActualReturnArgs( cs ) ) ); ps = conn.prepareStatement( "drop procedure proc_2515" ); ps.execute(); ps.close(); ps = conn.prepareStatement( "drop type price_2515 restrict" ); ps.execute(); ps.close(); }
void function() throws Exception { Connection conn = getConnection(); PreparedStatement ps = conn.prepareStatement ( STR ); ps.execute(); ps.close(); ps = conn.prepareStatement ( STR + "(\n" + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + ")\n" + STR + STR + ProcedureTest.class.getName() + STR ); ps.execute(); ps.close(); CallableStatement cs = conn.prepareCall ( STR ); AllTypesTuple firstArgs = makeFirstAllTypesTuple(); int idx = 2; cs.registerOutParameter( idx++, Types.VARCHAR ); cs.registerOutParameter( idx, Types.BIGINT ); cs.setLong( idx++, firstArgs.get_bigintArg().longValue() ); cs.registerOutParameter( idx, Types.BLOB ); cs.setBlob( idx++, firstArgs.get_blobArg() ); cs.registerOutParameter( idx, Types.BOOLEAN ); cs.setBoolean( idx++, firstArgs.get_booleanArg().booleanValue() ); cs.registerOutParameter( idx, Types.CHAR ); cs.setString( idx++, firstArgs.get_charArg() ); cs.registerOutParameter( idx, Types.BINARY ); cs.setBytes( idx++, firstArgs.get_charForBitDataArg() ); cs.registerOutParameter( idx, Types.CLOB ); cs.setClob( idx++, firstArgs.get_clobArg() ); cs.registerOutParameter( idx, Types.DATE ); cs.setDate( idx++, firstArgs.get_dateArg() ); cs.registerOutParameter( idx, Types.DECIMAL ); cs.setBigDecimal( idx++, firstArgs.get_decimalArg() ); cs.registerOutParameter( idx, Types.DOUBLE ); cs.setDouble( idx++, firstArgs.get_doubleArg().doubleValue() ); cs.registerOutParameter( idx, Types.INTEGER ); cs.setInt( idx++, firstArgs.get_intArg().intValue() ); cs.registerOutParameter( idx, Types.LONGVARCHAR ); cs.setString( idx++, firstArgs.get_longVarcharArg() ); cs.registerOutParameter( idx, Types.LONGVARBINARY ); cs.setBytes( idx++, firstArgs.get_longVarcharForBitDataArg() ); cs.registerOutParameter( idx, Types.REAL ); cs.setFloat( idx++, firstArgs.get_realArg().floatValue() ); cs.registerOutParameter( idx, Types.SMALLINT ); cs.setShort( idx++, firstArgs.get_smallintArg().shortValue() ); cs.registerOutParameter( idx, Types.TIME ); cs.setTime( idx++, firstArgs.get_timeArg() ); cs.registerOutParameter( idx, Types.TIMESTAMP ); cs.setTimestamp( idx++, firstArgs.get_timestampArg() ); cs.registerOutParameter( idx, Types.JAVA_OBJECT ); cs.setObject( idx++, firstArgs.get_priceArg() ); cs.registerOutParameter( idx, Types.VARCHAR ); cs.setString( idx++, firstArgs.get_varcharArg() ); cs.registerOutParameter( idx, Types.VARBINARY ); cs.setBytes( idx++, firstArgs.get_varcharForBitDataArg() ); cs.setInt( 1, 0 ); cs.execute(); assertEquals( STR", makeSecondAllTypesTuple().compare( getActualReturnArgs( cs ) ) ); cs.setInt( 1, 1 ); cs.execute(); assertEquals( STR", makeThirdAllTypesTuple().compare( getActualReturnArgs( cs ) ) ); cs.setInt( 1, 2 ); cs.execute(); assertEquals( STRSTRdrop procedure proc_2515STRdrop type price_2515 restrict" ); ps.execute(); ps.close(); }
/** * Test that INOUT args are preserved over procedure invocations. * See DERBY-2515. */
Test that INOUT args are preserved over procedure invocations. See DERBY-2515
test_2515
{ "repo_name": "splicemachine/spliceengine", "path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/jdbcapi/ProcedureTest.java", "license": "agpl-3.0", "size": 64568 }
[ "java.sql.CallableStatement", "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.Types" ]
import java.sql.CallableStatement; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Types;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,054,853
public void resetConfig(boolean resetTrans) { String dir = Bundles.getDirectory(); Bundles.setDirectory(null); try { try { ConfigBundle config = new ConfigBundle(); config.updateFile(configDir); } catch (IOException e) { tracer.error(e); } try { UiConfigBundle uiconfig = new UiConfigBundle(); uiconfig.updateFile(configDir); } catch (IOException e) { tracer.error(e); } if (resetTrans) { try { StringIdBundle trans = new StringIdBundle(null); trans.updateFile(configDir); } catch (IOException e) { tracer.error(e); } } } finally { Bundles.setDirectory(dir); } } /** * Get the (unique) {@link DataLoader} for the program. * * @return the {@link DataLoader}
void function(boolean resetTrans) { String dir = Bundles.getDirectory(); Bundles.setDirectory(null); try { try { ConfigBundle config = new ConfigBundle(); config.updateFile(configDir); } catch (IOException e) { tracer.error(e); } try { UiConfigBundle uiconfig = new UiConfigBundle(); uiconfig.updateFile(configDir); } catch (IOException e) { tracer.error(e); } if (resetTrans) { try { StringIdBundle trans = new StringIdBundle(null); trans.updateFile(configDir); } catch (IOException e) { tracer.error(e); } } } finally { Bundles.setDirectory(dir); } } /** * Get the (unique) {@link DataLoader} for the program. * * @return the {@link DataLoader}
/** * Reset the configuration. * * @param resetTrans * also reset the translation files */
Reset the configuration
resetConfig
{ "repo_name": "nikiroo/fanfix", "path": "src/be/nikiroo/fanfix/Instance.java", "license": "gpl-3.0", "size": 17731 }
[ "be.nikiroo.fanfix.bundles.ConfigBundle", "be.nikiroo.fanfix.bundles.StringIdBundle", "be.nikiroo.fanfix.bundles.UiConfigBundle", "be.nikiroo.utils.resources.Bundles", "java.io.IOException" ]
import be.nikiroo.fanfix.bundles.ConfigBundle; import be.nikiroo.fanfix.bundles.StringIdBundle; import be.nikiroo.fanfix.bundles.UiConfigBundle; import be.nikiroo.utils.resources.Bundles; import java.io.IOException;
import be.nikiroo.fanfix.bundles.*; import be.nikiroo.utils.resources.*; import java.io.*;
[ "be.nikiroo.fanfix", "be.nikiroo.utils", "java.io" ]
be.nikiroo.fanfix; be.nikiroo.utils; java.io;
2,810,645
public Builder withBulkhead(Bulkhead bulkhead) { addFeignDecorator(fn -> Bulkhead.decorateCheckedFunction(bulkhead, fn)); return this; }
Builder function(Bulkhead bulkhead) { addFeignDecorator(fn -> Bulkhead.decorateCheckedFunction(bulkhead, fn)); return this; }
/** * Adds a {@link Bulkhead} to the decorator chain. * * @param bulkhead a fully configured {@link Bulkhead}. * @return the builder */
Adds a <code>Bulkhead</code> to the decorator chain
withBulkhead
{ "repo_name": "RobWin/circuitbreaker-java8", "path": "resilience4j-feign/src/main/java/io/github/resilience4j/feign/FeignDecorators.java", "license": "apache-2.0", "size": 10209 }
[ "io.github.resilience4j.bulkhead.Bulkhead" ]
import io.github.resilience4j.bulkhead.Bulkhead;
import io.github.resilience4j.bulkhead.*;
[ "io.github.resilience4j" ]
io.github.resilience4j;
459,947
public Locale getMainLocale() { if (m_mainLocale != null) { return m_mainLocale; } try { CmsLocaleGroup localeGroup = m_cms.getLocaleGroupService().readLocaleGroup(this); m_mainLocale = localeGroup.getMainLocale(); return m_mainLocale; } catch (CmsException e) { return null; } }
Locale function() { if (m_mainLocale != null) { return m_mainLocale; } try { CmsLocaleGroup localeGroup = m_cms.getLocaleGroupService().readLocaleGroup(this); m_mainLocale = localeGroup.getMainLocale(); return m_mainLocale; } catch (CmsException e) { return null; } }
/** * Returns the main locale for this resource.<p> * * @return the main locale for this resource */
Returns the main locale for this resource
getMainLocale
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/jsp/CmsJspResourceWrapper.java", "license": "lgpl-2.1", "size": 34361 }
[ "java.util.Locale", "org.opencms.i18n.CmsLocaleGroup", "org.opencms.main.CmsException" ]
import java.util.Locale; import org.opencms.i18n.CmsLocaleGroup; import org.opencms.main.CmsException;
import java.util.*; import org.opencms.i18n.*; import org.opencms.main.*;
[ "java.util", "org.opencms.i18n", "org.opencms.main" ]
java.util; org.opencms.i18n; org.opencms.main;
1,592,891
private void createGeneratePane() { genPnl = paneEx(10, 10, 0, 10); genPnl.addColumn(); genPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS); genPnl.addColumn(35, 35, 35, Priority.NEVER); genPnl.addRow(100, 100, Double.MAX_VALUE, Priority.ALWAYS); genPnl.addRows(7); TableColumn<PojoDescriptor, Boolean> useCol = customColumn("Schema / Table", "use", "If checked then this table will be used for XML and POJOs generation", PojoDescriptorCell.cellFactory());
void function() { genPnl = paneEx(10, 10, 0, 10); genPnl.addColumn(); genPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS); genPnl.addColumn(35, 35, 35, Priority.NEVER); genPnl.addRow(100, 100, Double.MAX_VALUE, Priority.ALWAYS); genPnl.addRows(7); TableColumn<PojoDescriptor, Boolean> useCol = customColumn(STR, "use", STR, PojoDescriptorCell.cellFactory());
/** * Create generate pane with controls. */
Create generate pane with controls
createGeneratePane
{ "repo_name": "agura/incubator-ignite", "path": "modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java", "license": "apache-2.0", "size": 67649 }
[ "org.apache.ignite.schema.model.PojoDescriptor", "org.apache.ignite.schema.ui.Controls" ]
import org.apache.ignite.schema.model.PojoDescriptor; import org.apache.ignite.schema.ui.Controls;
import org.apache.ignite.schema.model.*; import org.apache.ignite.schema.ui.*;
[ "org.apache.ignite" ]
org.apache.ignite;
363,409
public int onMetric(ByteBuf buf);
int function(ByteBuf buf);
/** * Handles a buffer of messages * @param buf the buffer * @return the number of messages extracted and processed from the buffer */
Handles a buffer of messages
onMetric
{ "repo_name": "nickman/HeliosStreams", "path": "stream-common/src/main/java/com/heliosapm/streams/chronicle/MessageListener.java", "license": "apache-2.0", "size": 1247 }
[ "io.netty.buffer.ByteBuf" ]
import io.netty.buffer.ByteBuf;
import io.netty.buffer.*;
[ "io.netty.buffer" ]
io.netty.buffer;
1,153,827
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") public void createAnomalyAlertConfiguration(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { // Arrange client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion).buildClient(); final AtomicReference<String> alertConfigurationId = new AtomicReference<>(); creatAnomalyAlertRunner(inputAnomalyAlertConfig -> { // Act & Assert AnomalyAlertConfiguration createdAnomalyAlertConfig = client.createAnomalyAlertConfiguration(inputAnomalyAlertConfig); alertConfigurationId.set(createdAnomalyAlertConfig.getId()); validateAnomalyAlertResult(inputAnomalyAlertConfig, createdAnomalyAlertConfig); }); client.deleteAnomalyAlertConfiguration(alertConfigurationId.get()); }
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource(STR) void function(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion).buildClient(); final AtomicReference<String> alertConfigurationId = new AtomicReference<>(); creatAnomalyAlertRunner(inputAnomalyAlertConfig -> { AnomalyAlertConfiguration createdAnomalyAlertConfig = client.createAnomalyAlertConfiguration(inputAnomalyAlertConfig); alertConfigurationId.set(createdAnomalyAlertConfig.getId()); validateAnomalyAlertResult(inputAnomalyAlertConfig, createdAnomalyAlertConfig); }); client.deleteAnomalyAlertConfiguration(alertConfigurationId.get()); }
/** * Verifies valid anomaly alert configuration created for required anomaly alert configuration details. */
Verifies valid anomaly alert configuration created for required anomaly alert configuration details
createAnomalyAlertConfiguration
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java", "license": "mit", "size": 15897 }
[ "com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration", "com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion", "com.azure.core.http.HttpClient", "java.util.concurrent.atomic.AtomicReference", "org.junit.jupiter.params.ParameterizedTest", "org.junit.jupiter.params.provider.MethodSource" ]
import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import java.util.concurrent.atomic.AtomicReference; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource;
import com.azure.ai.metricsadvisor.models.*; import com.azure.core.http.*; import java.util.concurrent.atomic.*; import org.junit.jupiter.params.*; import org.junit.jupiter.params.provider.*;
[ "com.azure.ai", "com.azure.core", "java.util", "org.junit.jupiter" ]
com.azure.ai; com.azure.core; java.util; org.junit.jupiter;
1,494,826
public void removeThing(ThingUID thingUID, boolean force) { // Lookup the thing in the registry Thing thing = thingRegistry.get(thingUID); if (thing == null) { return; } // If this is a bridge, remove all child things, their items and links if (thing instanceof Bridge) { Bridge bridge = (Bridge) thing; for (Thing bridgeThing : bridge.getThings()) { ThingUID bridgeThingUID = bridgeThing.getUID(); removeThing(bridgeThingUID, force); } } if (force) { thingRegistry.forceRemove(thingUID); } else { thingRegistry.remove(thingUID); } }
void function(ThingUID thingUID, boolean force) { Thing thing = thingRegistry.get(thingUID); if (thing == null) { return; } if (thing instanceof Bridge) { Bridge bridge = (Bridge) thing; for (Thing bridgeThing : bridge.getThings()) { ThingUID bridgeThingUID = bridgeThing.getUID(); removeThing(bridgeThingUID, force); } } if (force) { thingRegistry.forceRemove(thingUID); } else { thingRegistry.remove(thingUID); } }
/** * Remove a thing and all its links and items. * If this is a bridge, also remove child things by calling * removeThing recursively * * @param thingUID thing UID * @param force if the thing should be removed without asking the binding */
Remove a thing and all its links and items. If this is a bridge, also remove child things by calling removeThing recursively
removeThing
{ "repo_name": "WetwareLabs/smarthome", "path": "bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/setup/ThingSetupManager.java", "license": "epl-1.0", "size": 27488 }
[ "org.eclipse.smarthome.core.thing.Bridge", "org.eclipse.smarthome.core.thing.Thing", "org.eclipse.smarthome.core.thing.ThingUID" ]
import org.eclipse.smarthome.core.thing.Bridge; import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingUID;
import org.eclipse.smarthome.core.thing.*;
[ "org.eclipse.smarthome" ]
org.eclipse.smarthome;
2,434,519
private synchronized int invalidateWorkForOneNode(String nodeId) { // blocks should not be replicated or removed if safe mode is on if (isInSafeMode()) return 0; // get blocks to invalidate for the nodeId assert nodeId != null; DatanodeDescriptor dn = datanodeMap.get(nodeId); if (dn == null) { recentInvalidateSets.remove(nodeId); return 0; } Collection<Block> invalidateSet = recentInvalidateSets.get(nodeId); if (invalidateSet == null) { return 0; } ArrayList<Block> blocksToInvalidate = new ArrayList<Block>(blockInvalidateLimit); // # blocks that can be sent in one message is limited Iterator<Block> it = invalidateSet.iterator(); for(int blkCount = 0; blkCount < blockInvalidateLimit && it.hasNext(); blkCount++) { blocksToInvalidate.add(it.next()); it.remove(); } // If we send everything in this message, remove this node entry if (!it.hasNext()) { recentInvalidateSets.remove(nodeId); } dn.addBlocksToBeInvalidated(blocksToInvalidate); if(NameNode.stateChangeLog.isInfoEnabled()) { StringBuffer blockList = new StringBuffer(); for(Block blk : blocksToInvalidate) { blockList.append(' '); blockList.append(blk); } NameNode.stateChangeLog.info("BLOCK* ask " + dn.getName() + " to delete " + blockList); } pendingDeletionBlocksCount -= blocksToInvalidate.size(); return blocksToInvalidate.size(); }
synchronized int function(String nodeId) { if (isInSafeMode()) return 0; assert nodeId != null; DatanodeDescriptor dn = datanodeMap.get(nodeId); if (dn == null) { recentInvalidateSets.remove(nodeId); return 0; } Collection<Block> invalidateSet = recentInvalidateSets.get(nodeId); if (invalidateSet == null) { return 0; } ArrayList<Block> blocksToInvalidate = new ArrayList<Block>(blockInvalidateLimit); Iterator<Block> it = invalidateSet.iterator(); for(int blkCount = 0; blkCount < blockInvalidateLimit && it.hasNext(); blkCount++) { blocksToInvalidate.add(it.next()); it.remove(); } if (!it.hasNext()) { recentInvalidateSets.remove(nodeId); } dn.addBlocksToBeInvalidated(blocksToInvalidate); if(NameNode.stateChangeLog.isInfoEnabled()) { StringBuffer blockList = new StringBuffer(); for(Block blk : blocksToInvalidate) { blockList.append(' '); blockList.append(blk); } NameNode.stateChangeLog.info(STR + dn.getName() + STR + blockList); } pendingDeletionBlocksCount -= blocksToInvalidate.size(); return blocksToInvalidate.size(); }
/** * Get blocks to invalidate for <i>nodeId</i> * in {@link #recentInvalidateSets}. * * @return number of blocks scheduled for removal during this iteration. */
Get blocks to invalidate for nodeId in <code>#recentInvalidateSets</code>
invalidateWorkForOneNode
{ "repo_name": "aseldawy/spatialhadoop", "path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java", "license": "apache-2.0", "size": 220549 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.Iterator", "org.apache.hadoop.hdfs.protocol.Block" ]
import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import org.apache.hadoop.hdfs.protocol.Block;
import java.util.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
398,669
public void removeItemDeleteListener(ItemDeleteListener listener) { PacketListener conListener = itemDeleteToListenerMap .remove(listener); if (conListener != null) con.removeSyncPacketListener(conListener); }
void function(ItemDeleteListener listener) { PacketListener conListener = itemDeleteToListenerMap .remove(listener); if (conListener != null) con.removeSyncPacketListener(conListener); }
/** * Unregister a listener for item delete events. * * @param listener The handler to unregister */
Unregister a listener for item delete events
removeItemDeleteListener
{ "repo_name": "magnetsystems/message-smack", "path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java", "license": "apache-2.0", "size": 24763 }
[ "org.jivesoftware.smack.PacketListener", "org.jivesoftware.smackx.pubsub.listener.ItemDeleteListener" ]
import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smackx.pubsub.listener.ItemDeleteListener;
import org.jivesoftware.smack.*; import org.jivesoftware.smackx.pubsub.listener.*;
[ "org.jivesoftware.smack", "org.jivesoftware.smackx" ]
org.jivesoftware.smack; org.jivesoftware.smackx;
1,488,651
// ========================================================================= // Multipart // ========================================================================= public static void flushMultiPartData(File file, OutputStream serverOutputStream, String boundary, boolean isGunzip) throws IOException { // connection.setRequestProperty("accept", "text/html,application/xhtml" // + "+xml,application/xml;q=0.9,*/*;q=0.8"); // TODO : chunks PrintWriter writer = null; try { // http://stackoverflow.com/a/2793153/281545 // true = autoFlush, important! writer = new PrintWriter(new OutputStreamWriter(serverOutputStream, charsetForMultipartHeaders), true); appendBinary(file, boundary, writer, serverOutputStream, isGunzip); // End of multipart/form-data. writer.append("--" + boundary + "--").append(CRLF); } finally { if (writer != null) writer.close(); // closes the serverOutputStream } }
static void function(File file, OutputStream serverOutputStream, String boundary, boolean isGunzip) throws IOException { PrintWriter writer = null; try { writer = new PrintWriter(new OutputStreamWriter(serverOutputStream, charsetForMultipartHeaders), true); appendBinary(file, boundary, writer, serverOutputStream, isGunzip); writer.append("--" + boundary + "--").append(CRLF); } finally { if (writer != null) writer.close(); } }
/** * Sends a binary file as part of a multipart form data over a socket * connection and closes the output stream of the connection. * * @param file * the binary file to send * @param serverOutputStream * the server connection output stream - WILL BE CLOSED by this * method * @param boundary * multipart boundary - needed cause must be shared with code * that creates the server connection * @param isGunzip * if true the content will be gunzipped * @throws IOException * if it can't create the writer, the file was not found or an * IO exception was thrown writing the data */
Sends a binary file as part of a multipart form data over a socket connection and closes the output stream of the connection
flushMultiPartData
{ "repo_name": "LittlePanpc/base-android-utils", "path": "src/me/pc/mobile/helper/v14/net/NetworkUtil.java", "license": "apache-2.0", "size": 7021 }
[ "java.io.File", "java.io.IOException", "java.io.OutputStream", "java.io.OutputStreamWriter", "java.io.PrintWriter" ]
import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
2,379,273
private MatrixCursor doListFiles(Uri uri) { MatrixCursor matrixCursor = BaseFileProviderUtils.newBaseFileCursor(); File dir = extractFile(uri); if (Utils.doLog()) Log.d(CLASSNAME, "srcFile = " + dir); if (!dir.isDirectory() || !dir.canRead()) return null; int taskId = ProviderUtils.getIntQueryParam(uri, BaseFile.PARAM_TASK_ID, 0); boolean showHiddenFiles = ProviderUtils.getBooleanQueryParam(uri, BaseFile.PARAM_SHOW_HIDDEN_FILES); boolean sortAscending = ProviderUtils.getBooleanQueryParam(uri, BaseFile.PARAM_SORT_ASCENDING, true); int sortBy = ProviderUtils.getIntQueryParam(uri, BaseFile.PARAM_SORT_BY, BaseFile.SORT_BY_NAME); int filterMode = ProviderUtils.getIntQueryParam(uri, BaseFile.PARAM_FILTER_MODE, BaseFile.FILTER_FILES_AND_DIRECTORIES); int limit = ProviderUtils.getIntQueryParam(uri, BaseFile.PARAM_LIMIT, 1000); String positiveRegex = uri .getQueryParameter(BaseFile.PARAM_POSITIVE_REGEX_FILTER); String negativeRegex = uri .getQueryParameter(BaseFile.PARAM_NEGATIVE_REGEX_FILTER); mMapInterruption.put(taskId, false); boolean[] hasMoreFiles = { false }; List<File> files = new ArrayList<File>(); listFiles(taskId, dir, showHiddenFiles, filterMode, limit, positiveRegex, negativeRegex, files, hasMoreFiles); if (!mMapInterruption.get(taskId)) { sortFiles(taskId, files, sortAscending, sortBy); if (!mMapInterruption.get(taskId)) { for (int i = 0; i < files.size(); i++) { if (mMapInterruption.get(taskId)) break; File f = files.get(i); int type = f.isFile() ? BaseFile.FILE_TYPE_FILE : (f .isDirectory() ? BaseFile.FILE_TYPE_DIRECTORY : BaseFile.FILE_TYPE_UNKNOWN); RowBuilder newRow = matrixCursor.newRow(); newRow.add(i);// _ID newRow.add(BaseFile .genContentIdUriBase( LocalFileContract .getAuthority(getContext())) .buildUpon().appendPath(Uri.fromFile(f).toString()) .build().toString()); newRow.add(Uri.fromFile(f).toString()); newRow.add(f.getName()); newRow.add(f.canRead() ? 1 : 0); newRow.add(f.canWrite() ? 1 : 0); newRow.add(f.length()); newRow.add(type); newRow.add(f.lastModified()); newRow.add(FileUtils.getResIcon(type, f.getName())); }// for files RowBuilder newRow = matrixCursor.newRow(); newRow.add(files.size());// _ID newRow.add(BaseFile .genContentIdUriBase( LocalFileContract.getAuthority(getContext())) .buildUpon() .appendPath(Uri.fromFile(dir).toString()) .appendQueryParameter(BaseFile.PARAM_HAS_MORE_FILES, Boolean.toString(hasMoreFiles[0])).build() .toString()); newRow.add(Uri.fromFile(dir).toString()); newRow.add(dir.getName()); } } try { if (mMapInterruption.get(taskId)) { if (Utils.doLog()) Log.d(CLASSNAME, "query() >> cancelled..."); return null; } } finally { mMapInterruption.delete(taskId); } if (mFileObserverEx != null) mFileObserverEx.stopWatching(); mFileObserverEx = new FileObserverEx(getContext(), dir.getAbsolutePath(), uri); mFileObserverEx.startWatching(); matrixCursor.setNotificationUri(getContext().getContentResolver(), uri); return matrixCursor; }// doListFiles()
MatrixCursor function(Uri uri) { MatrixCursor matrixCursor = BaseFileProviderUtils.newBaseFileCursor(); File dir = extractFile(uri); if (Utils.doLog()) Log.d(CLASSNAME, STR + dir); if (!dir.isDirectory() !dir.canRead()) return null; int taskId = ProviderUtils.getIntQueryParam(uri, BaseFile.PARAM_TASK_ID, 0); boolean showHiddenFiles = ProviderUtils.getBooleanQueryParam(uri, BaseFile.PARAM_SHOW_HIDDEN_FILES); boolean sortAscending = ProviderUtils.getBooleanQueryParam(uri, BaseFile.PARAM_SORT_ASCENDING, true); int sortBy = ProviderUtils.getIntQueryParam(uri, BaseFile.PARAM_SORT_BY, BaseFile.SORT_BY_NAME); int filterMode = ProviderUtils.getIntQueryParam(uri, BaseFile.PARAM_FILTER_MODE, BaseFile.FILTER_FILES_AND_DIRECTORIES); int limit = ProviderUtils.getIntQueryParam(uri, BaseFile.PARAM_LIMIT, 1000); String positiveRegex = uri .getQueryParameter(BaseFile.PARAM_POSITIVE_REGEX_FILTER); String negativeRegex = uri .getQueryParameter(BaseFile.PARAM_NEGATIVE_REGEX_FILTER); mMapInterruption.put(taskId, false); boolean[] hasMoreFiles = { false }; List<File> files = new ArrayList<File>(); listFiles(taskId, dir, showHiddenFiles, filterMode, limit, positiveRegex, negativeRegex, files, hasMoreFiles); if (!mMapInterruption.get(taskId)) { sortFiles(taskId, files, sortAscending, sortBy); if (!mMapInterruption.get(taskId)) { for (int i = 0; i < files.size(); i++) { if (mMapInterruption.get(taskId)) break; File f = files.get(i); int type = f.isFile() ? BaseFile.FILE_TYPE_FILE : (f .isDirectory() ? BaseFile.FILE_TYPE_DIRECTORY : BaseFile.FILE_TYPE_UNKNOWN); RowBuilder newRow = matrixCursor.newRow(); newRow.add(i); newRow.add(BaseFile .genContentIdUriBase( LocalFileContract .getAuthority(getContext())) .buildUpon().appendPath(Uri.fromFile(f).toString()) .build().toString()); newRow.add(Uri.fromFile(f).toString()); newRow.add(f.getName()); newRow.add(f.canRead() ? 1 : 0); newRow.add(f.canWrite() ? 1 : 0); newRow.add(f.length()); newRow.add(type); newRow.add(f.lastModified()); newRow.add(FileUtils.getResIcon(type, f.getName())); } RowBuilder newRow = matrixCursor.newRow(); newRow.add(files.size()); newRow.add(BaseFile .genContentIdUriBase( LocalFileContract.getAuthority(getContext())) .buildUpon() .appendPath(Uri.fromFile(dir).toString()) .appendQueryParameter(BaseFile.PARAM_HAS_MORE_FILES, Boolean.toString(hasMoreFiles[0])).build() .toString()); newRow.add(Uri.fromFile(dir).toString()); newRow.add(dir.getName()); } } try { if (mMapInterruption.get(taskId)) { if (Utils.doLog()) Log.d(CLASSNAME, STR); return null; } } finally { mMapInterruption.delete(taskId); } if (mFileObserverEx != null) mFileObserverEx.stopWatching(); mFileObserverEx = new FileObserverEx(getContext(), dir.getAbsolutePath(), uri); mFileObserverEx.startWatching(); matrixCursor.setNotificationUri(getContext().getContentResolver(), uri); return matrixCursor; }
/** * Lists the content of a directory, if available. * * @param uri * the URI pointing to a directory. * @return the content of a directory, or {@code null} if not available. */
Lists the content of a directory, if available
doListFiles
{ "repo_name": "red13dotnet/keepass2android", "path": "src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/providers/localfile/LocalFileProvider.java", "license": "gpl-3.0", "size": 28125 }
[ "android.database.MatrixCursor", "android.net.Uri", "android.util.Log", "group.pals.android.lib.ui.filechooser.providers.BaseFileProviderUtils", "group.pals.android.lib.ui.filechooser.providers.ProviderUtils", "group.pals.android.lib.ui.filechooser.providers.basefile.BaseFileContract", "group.pals.android.lib.ui.filechooser.utils.FileUtils", "group.pals.android.lib.ui.filechooser.utils.Utils", "java.io.File", "java.util.ArrayList", "java.util.List" ]
import android.database.MatrixCursor; import android.net.Uri; import android.util.Log; import group.pals.android.lib.ui.filechooser.providers.BaseFileProviderUtils; import group.pals.android.lib.ui.filechooser.providers.ProviderUtils; import group.pals.android.lib.ui.filechooser.providers.basefile.BaseFileContract; import group.pals.android.lib.ui.filechooser.utils.FileUtils; import group.pals.android.lib.ui.filechooser.utils.Utils; import java.io.File; import java.util.ArrayList; import java.util.List;
import android.database.*; import android.net.*; import android.util.*; import group.pals.android.lib.ui.filechooser.providers.*; import group.pals.android.lib.ui.filechooser.providers.basefile.*; import group.pals.android.lib.ui.filechooser.utils.*; import java.io.*; import java.util.*;
[ "android.database", "android.net", "android.util", "group.pals.android", "java.io", "java.util" ]
android.database; android.net; android.util; group.pals.android; java.io; java.util;
1,359,854
public void setJumpForce(Vector3f jumpForce) { this.jumpForce.set(jumpForce); }
void function(Vector3f jumpForce) { this.jumpForce.set(jumpForce); }
/** * Alter the jump force. The jump force is local to the character's * coordinate system, which normally is always z-forward (in world * coordinates, parent coordinates when set to applyLocalPhysics) * * @param jumpForce the desired jump force (not null, unaffected, * default=5*mass in +Y direction) */
Alter the jump force. The jump force is local to the character's coordinate system, which normally is always z-forward (in world coordinates, parent coordinates when set to applyLocalPhysics)
setJumpForce
{ "repo_name": "zzuegg/jmonkeyengine", "path": "jme3-bullet/src/common/java/com/jme3/bullet/control/BetterCharacterControl.java", "license": "bsd-3-clause", "size": 26477 }
[ "com.jme3.math.Vector3f" ]
import com.jme3.math.Vector3f;
import com.jme3.math.*;
[ "com.jme3.math" ]
com.jme3.math;
1,505,691
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<RelationInner>> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) .<PagedResponse<RelationInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<RelationInner>> function(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; return FluxUtil .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) .<PagedResponse<RelationInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
/** * Get the next page of items. * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of relations along with {@link PagedResponse} on successful completion of {@link Mono}. */
Get the next page of items
listNextSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesRelationsClientImpl.java", "license": "mit", "size": 21684 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.FluxUtil", "com.azure.resourcemanager.securityinsights.fluent.models.RelationInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.securityinsights.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,147,319
public void testGetConnectedClients() throws Exception { final String name = this.getUniqueName(); final int[] ports = new int[1]; // create BridgeServer in controller vm... getLogWriter().info("[testGetConnectedClients] Create BridgeServer"); getSystem(); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); Region region = createRegion(name, factory.create()); assertNotNull(region); assertNotNull(getRootRegion().getSubregion(name)); ports[0] = startBridgeServer(0); assertTrue(ports[0] != 0); String serverMemberId = getMemberId(); getLogWriter().info("[testGetConnectedClients] ports[0]=" + ports[0]); getLogWriter().info("[testGetConnectedClients] serverMemberId=" + serverMemberId);
void function() throws Exception { final String name = this.getUniqueName(); final int[] ports = new int[1]; getLogWriter().info(STR); getSystem(); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); Region region = createRegion(name, factory.create()); assertNotNull(region); assertNotNull(getRootRegion().getSubregion(name)); ports[0] = startBridgeServer(0); assertTrue(ports[0] != 0); String serverMemberId = getMemberId(); getLogWriter().info(STR + ports[0]); getLogWriter().info(STR + serverMemberId);
/** * Starts up server in controller vm and 4 clients, then calls and tests * BridgeMembership.getConnectedClients(). */
Starts up server in controller vm and 4 clients, then calls and tests BridgeMembership.getConnectedClients()
testGetConnectedClients
{ "repo_name": "nchandrappa/incubator-geode", "path": "gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeMembershipDUnitTest.java", "license": "apache-2.0", "size": 61755 }
[ "com.gemstone.gemfire.cache.AttributesFactory", "com.gemstone.gemfire.cache.Region", "com.gemstone.gemfire.cache.Scope" ]
import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
732,638
Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; String fileName = getFileName(query); FileOutputStream fos = new FileOutputStream(fileName); try { conn = pUtil.getConnection(query.getTenantId()); statement = conn.prepareStatement(query.getStatement()); boolean isQuery = statement.execute(); if (isQuery) { rs = statement.executeQuery(); int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { for (int columnNum = 1; columnNum <= columnCount; columnNum++) { fos.write((rs.getString(columnNum) + PherfConstants.RESULT_FILE_DELIMETER).getBytes()); } fos.write(PherfConstants.NEW_LINE.getBytes()); } } else { conn.commit(); } } catch (Exception e) { e.printStackTrace(); } finally { if (rs != null) rs.close(); if (statement != null) statement.close(); if (conn != null) conn.close(); fos.flush(); fos.close(); } return fileName; }
Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; String fileName = getFileName(query); FileOutputStream fos = new FileOutputStream(fileName); try { conn = pUtil.getConnection(query.getTenantId()); statement = conn.prepareStatement(query.getStatement()); boolean isQuery = statement.execute(); if (isQuery) { rs = statement.executeQuery(); int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { for (int columnNum = 1; columnNum <= columnCount; columnNum++) { fos.write((rs.getString(columnNum) + PherfConstants.RESULT_FILE_DELIMETER).getBytes()); } fos.write(PherfConstants.NEW_LINE.getBytes()); } } else { conn.commit(); } } catch (Exception e) { e.printStackTrace(); } finally { if (rs != null) rs.close(); if (statement != null) statement.close(); if (conn != null) conn.close(); fos.flush(); fos.close(); } return fileName; }
/*** * Export query resultSet to CSV file * @param query * @throws Exception */
Export query resultSet to CSV file
exportCSV
{ "repo_name": "AakashPradeep/phoenix", "path": "phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/QueryVerifier.java", "license": "apache-2.0", "size": 6014 }
[ "java.io.FileOutputStream", "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "org.apache.phoenix.pherf.PherfConstants" ]
import java.io.FileOutputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import org.apache.phoenix.pherf.PherfConstants;
import java.io.*; import java.sql.*; import org.apache.phoenix.pherf.*;
[ "java.io", "java.sql", "org.apache.phoenix" ]
java.io; java.sql; org.apache.phoenix;
1,086,062
public void complexMultipleJoinOfSameRelationship() { EntityManager em = createEntityManager(); String jpql = "SELECT p1, p2 FROM Employee emp JOIN emp.phoneNumbers p1 JOIN emp.phoneNumbers p2 " + "WHERE p1.type = 'Pager' AND p2.areaCode = '613'"; Query query = em.createQuery(jpql); Object[] result = (Object[]) query.getSingleResult(); Assert.assertTrue("Complex multiple JOIN of same relationship test failed", (result[0] != result[1])); }
void function() { EntityManager em = createEntityManager(); String jpql = STR + STR; Query query = em.createQuery(jpql); Object[] result = (Object[]) query.getSingleResult(); Assert.assertTrue(STR, (result[0] != result[1])); }
/** * glassfish issue 2867 */
glassfish issue 2867
complexMultipleJoinOfSameRelationship
{ "repo_name": "gameduell/eclipselink.runtime", "path": "jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java", "license": "epl-1.0", "size": 208595 }
[ "javax.persistence.EntityManager", "javax.persistence.Query", "junit.framework.Assert" ]
import javax.persistence.EntityManager; import javax.persistence.Query; import junit.framework.Assert;
import javax.persistence.*; import junit.framework.*;
[ "javax.persistence", "junit.framework" ]
javax.persistence; junit.framework;
2,721,964
public Collection ejbFindAll() throws FinderException { IDOQuery sql = idoQuery(); sql.appendSelectAllFrom(this); sql.appendOrderBy(); String[] s = {COLUMN_PERIOD_FROM + " desc", COLUMN_PERIOD_TO + " desc", COLUMN_DESCRIPTION}; sql.appendCommaDelimited(s); return idoFindPKsBySQL(sql.toString()); }
Collection function() throws FinderException { IDOQuery sql = idoQuery(); sql.appendSelectAllFrom(this); sql.appendOrderBy(); String[] s = {COLUMN_PERIOD_FROM + STR, COLUMN_PERIOD_TO + STR, COLUMN_DESCRIPTION}; sql.appendCommaDelimited(s); return idoFindPKsBySQL(sql.toString()); }
/** * Finds all VAT regulations. * @return collection of all VAT regulation objects * @throws FinderException */
Finds all VAT regulations
ejbFindAll
{ "repo_name": "idega/platform2", "path": "src/se/idega/idegaweb/commune/accounting/regulations/data/VATRegulationBMPBean.java", "license": "gpl-3.0", "size": 6866 }
[ "com.idega.data.IDOQuery", "java.util.Collection", "javax.ejb.FinderException" ]
import com.idega.data.IDOQuery; import java.util.Collection; import javax.ejb.FinderException;
import com.idega.data.*; import java.util.*; import javax.ejb.*;
[ "com.idega.data", "java.util", "javax.ejb" ]
com.idega.data; java.util; javax.ejb;
586,517
@Override public int doRead(ByteChunk chunk, Request req ) throws IOException { if (pos >= lastValid) { if (!fill()) return -1; } int length = lastValid - pos; chunk.setBytes(buf, pos, length); pos = lastValid; return (length); } }
int function(ByteChunk chunk, Request req ) throws IOException { if (pos >= lastValid) { if (!fill()) return -1; } int length = lastValid - pos; chunk.setBytes(buf, pos, length); pos = lastValid; return (length); } }
/** * Read bytes into the specified chunk. */
Read bytes into the specified chunk
doRead
{ "repo_name": "mayonghui2112/helloWorld", "path": "sourceCode/apache-tomcat-7.0.82-src/java/org/apache/coyote/http11/InternalAprInputBuffer.java", "license": "apache-2.0", "size": 19689 }
[ "java.io.IOException", "org.apache.coyote.Request", "org.apache.tomcat.util.buf.ByteChunk" ]
import java.io.IOException; import org.apache.coyote.Request; import org.apache.tomcat.util.buf.ByteChunk;
import java.io.*; import org.apache.coyote.*; import org.apache.tomcat.util.buf.*;
[ "java.io", "org.apache.coyote", "org.apache.tomcat" ]
java.io; org.apache.coyote; org.apache.tomcat;
2,238,746
@Override public Adapter createProvidedArtefactsAdapter() { if (providedArtefactsItemProvider == null) { providedArtefactsItemProvider = new ProvidedArtefactsItemProvider(this); } return providedArtefactsItemProvider; } protected QuestionnaireInnerItemProvider questionnaireInnerItemProvider;
Adapter function() { if (providedArtefactsItemProvider == null) { providedArtefactsItemProvider = new ProvidedArtefactsItemProvider(this); } return providedArtefactsItemProvider; } protected QuestionnaireInnerItemProvider questionnaireInnerItemProvider;
/** * This creates an adapter for a {@link br.ufpe.ines.decode.decode.artifacts.ProvidedArtefacts}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This creates an adapter for a <code>br.ufpe.ines.decode.decode.artifacts.ProvidedArtefacts</code>.
createProvidedArtefactsAdapter
{ "repo_name": "netuh/DecodePlatformPlugin", "path": "br.ufpe.ines.decode/bundles/br.ufpe.ines.decode.model.edit/src/br/ufpe/ines/decode/decode/artifacts/provider/ArtifactsItemProviderAdapterFactory.java", "license": "gpl-3.0", "size": 10194 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
280,682
public static UserBase getUser() { return threadLocal.get(); }
static UserBase function() { return threadLocal.get(); }
/** * Gets the user. * * @return the user */
Gets the user
getUser
{ "repo_name": "clstoulouse/motu", "path": "motu-library-cas/src/main/java/fr/cls/atoll/motu/library/cas/util/AuthenticationHolder.java", "license": "lgpl-3.0", "size": 4052 }
[ "fr.cls.atoll.motu.library.cas.UserBase" ]
import fr.cls.atoll.motu.library.cas.UserBase;
import fr.cls.atoll.motu.library.cas.*;
[ "fr.cls.atoll" ]
fr.cls.atoll;
504,981
default T load(@WillNotClose InputStream inputStream) { return this.load(new InputStreamReader(inputStream, this.getDefaultDecoder())); } // // default T load(Node node) // { // T implementation = this.create(); // implementation.load(node); // return implementation; // }
default T load(@WillNotClose InputStream inputStream) { return this.load(new InputStreamReader(inputStream, this.getDefaultDecoder())); }
/** * Load config from stream. * Stream isn't automatically closed here! * * @param inputStream * stream to use. * * @return loaded config file. */
Load config from stream. Stream isn't automatically closed here
load
{ "repo_name": "GotoFinal/diorite-configs-java8", "path": "src/main/java/org/diorite/config/ConfigTemplate.java", "license": "mit", "size": 7022 }
[ "java.io.InputStream", "java.io.InputStreamReader", "javax.annotation.WillNotClose" ]
import java.io.InputStream; import java.io.InputStreamReader; import javax.annotation.WillNotClose;
import java.io.*; import javax.annotation.*;
[ "java.io", "javax.annotation" ]
java.io; javax.annotation;
1,329,784
public void start(BundleContext bc) throws Exception { context = bc; logger.debug("XMPP action has been started."); }
void function(BundleContext bc) throws Exception { context = bc; logger.debug(STR); }
/** * Called whenever the OSGi framework starts our bundle */
Called whenever the OSGi framework starts our bundle
start
{ "repo_name": "Cougar/mirror-openhab", "path": "bundles/action/org.openhab.action.xmpp/src/main/java/org/openhab/action/xmpp/internal/XMPPActivator.java", "license": "gpl-3.0", "size": 2252 }
[ "org.osgi.framework.BundleContext" ]
import org.osgi.framework.BundleContext;
import org.osgi.framework.*;
[ "org.osgi.framework" ]
org.osgi.framework;
2,137,982
protected void validateOrderList(SqlSelect select) { // ORDER BY is validated in a scope where aliases in the SELECT clause // are visible. For example, "SELECT empno AS x FROM emp ORDER BY x" // is valid. SqlNodeList orderList = select.getOrderList(); if (orderList == null) { return; } if (!shouldAllowIntermediateOrderBy()) { if (!cursorSet.contains(select)) { throw newValidationError(select, RESOURCE.invalidOrderByPos()); } } final SqlValidatorScope orderScope = getOrderScope(select); Util.permAssert(orderScope != null, "orderScope != null"); for (SqlNode orderItem : orderList) { validateOrderItem(select, orderItem); } }
void function(SqlSelect select) { SqlNodeList orderList = select.getOrderList(); if (orderList == null) { return; } if (!shouldAllowIntermediateOrderBy()) { if (!cursorSet.contains(select)) { throw newValidationError(select, RESOURCE.invalidOrderByPos()); } } final SqlValidatorScope orderScope = getOrderScope(select); Util.permAssert(orderScope != null, STR); for (SqlNode orderItem : orderList) { validateOrderItem(select, orderItem); } }
/** * Validates the ORDER BY clause of a SELECT statement. * * @param select Select statement */
Validates the ORDER BY clause of a SELECT statement
validateOrderList
{ "repo_name": "jinfengni/optiq", "path": "core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java", "license": "apache-2.0", "size": 143512 }
[ "org.apache.calcite.sql.SqlNode", "org.apache.calcite.sql.SqlNodeList", "org.apache.calcite.sql.SqlSelect", "org.apache.calcite.util.Static", "org.apache.calcite.util.Util" ]
import org.apache.calcite.sql.SqlNode; import org.apache.calcite.sql.SqlNodeList; import org.apache.calcite.sql.SqlSelect; import org.apache.calcite.util.Static; import org.apache.calcite.util.Util;
import org.apache.calcite.sql.*; import org.apache.calcite.util.*;
[ "org.apache.calcite" ]
org.apache.calcite;
2,228,788
public void commentRemoved(CommentEvent event) { Comment comment = event.getComment(); comment.getBlogEntry().getBlog().getResponseIndex().unindex(comment); }
void function(CommentEvent event) { Comment comment = event.getComment(); comment.getBlogEntry().getBlog().getResponseIndex().unindex(comment); }
/** * Called when a comment has been removed. * * @param event a CommentEvent instance */
Called when a comment has been removed
commentRemoved
{ "repo_name": "arshadalisoomro/pebble", "path": "src/main/java/net/sourceforge/pebble/index/ResponseIndexListener.java", "license": "bsd-3-clause", "size": 4760 }
[ "net.sourceforge.pebble.api.event.comment.CommentEvent", "net.sourceforge.pebble.domain.Comment" ]
import net.sourceforge.pebble.api.event.comment.CommentEvent; import net.sourceforge.pebble.domain.Comment;
import net.sourceforge.pebble.api.event.comment.*; import net.sourceforge.pebble.domain.*;
[ "net.sourceforge.pebble" ]
net.sourceforge.pebble;
971,365
private String generateUri(String uid) { try { MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); digest.update(uid.getBytes()); byte hash[] = digest.digest(); char[] hex = Hex.encodeHex(hash); // create a hex value of the hash return personUriPrefix + new String(hex); } catch (NoSuchAlgorithmException ex) { throw new RuntimeException(ex); } } Logger log = Logger.getLogger(org.ilrt.mca.services.ldap.BasicLdapSearch.class); private final Hashtable env; private int RESULT_LIMIT; private String baseDN; private String personUriPrefix; private String uidMapping; private String displayNameMapping; private String titleMapping; private String ouMapping; private String postalAddressMapping; private String postCodeMapping; private String mailMapping; private String telephoneNumberMapping;
String function(String uid) { try { MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); digest.update(uid.getBytes()); byte hash[] = digest.digest(); char[] hex = Hex.encodeHex(hash); return personUriPrefix + new String(hex); } catch (NoSuchAlgorithmException ex) { throw new RuntimeException(ex); } } Logger log = Logger.getLogger(org.ilrt.mca.services.ldap.BasicLdapSearch.class); private final Hashtable env; private int RESULT_LIMIT; private String baseDN; private String personUriPrefix; private String uidMapping; private String displayNameMapping; private String titleMapping; private String ouMapping; private String postalAddressMapping; private String postCodeMapping; private String mailMapping; private String telephoneNumberMapping;
/** * In Bristol, policy dictates we can't advertise the UID externally. * I'd like a unique identifier, so hash the UID. Performance issues? * * @param uid the unique identifier of a person in the directory. * @return a URI to represented the person based in a hash of the URI. */
In Bristol, policy dictates we can't advertise the UID externally. I'd like a unique identifier, so hash the UID. Performance issues
generateUri
{ "repo_name": "MikeJ1971/mobile-campus-assistant", "path": "MobileWeb/mca-services-ldap/src/main/java/org/ilrt/mca/services/ldap/BasicLdapSearch.java", "license": "bsd-3-clause", "size": 7994 }
[ "java.security.MessageDigest", "java.security.NoSuchAlgorithmException", "java.util.Hashtable", "org.apache.commons.codec.binary.Hex", "org.apache.log4j.Logger" ]
import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Hashtable; import org.apache.commons.codec.binary.Hex; import org.apache.log4j.Logger;
import java.security.*; import java.util.*; import org.apache.commons.codec.binary.*; import org.apache.log4j.*;
[ "java.security", "java.util", "org.apache.commons", "org.apache.log4j" ]
java.security; java.util; org.apache.commons; org.apache.log4j;
624,776
public static Element [] getElements(Element e, String name) { NodeList listNodes = e.getElementsByTagName(name); int l = listNodes.getLength(); Element r [] = new Element [l]; for(int i=0; i < l; i++) r[i] = (Element) listNodes.item(i); return r; }
static Element [] function(Element e, String name) { NodeList listNodes = e.getElementsByTagName(name); int l = listNodes.getLength(); Element r [] = new Element [l]; for(int i=0; i < l; i++) r[i] = (Element) listNodes.item(i); return r; }
/** * Extracts the set of XML elements having a given name in a given XML element * @param e the element to explore * @param name the name of the elements searched * @return an array of elements */
Extracts the set of XML elements having a given name in a given XML element
getElements
{ "repo_name": "Orange-OpenSource/matos-tool", "path": "matos/src/main/java/com/orange/matos/core/XMLParser.java", "license": "apache-2.0", "size": 5844 }
[ "org.w3c.dom.Element", "org.w3c.dom.NodeList" ]
import org.w3c.dom.Element; import org.w3c.dom.NodeList;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,260,083
public final MetaProperty<Long> securityId() { return _securityId; }
final MetaProperty<Long> function() { return _securityId; }
/** * The meta-property for the {@code securityId} property. * @return the meta-property, not null */
The meta-property for the securityId property
securityId
{ "repo_name": "McLeodMoores/starling", "path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/SecurityBean.java", "license": "apache-2.0", "size": 6966 }
[ "org.joda.beans.MetaProperty" ]
import org.joda.beans.MetaProperty;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
1,889,234
BigInteger getNext();
BigInteger getNext();
/** * Returns pseudo-random number. * * @return the random number */
Returns pseudo-random number
getNext
{ "repo_name": "jamesewoo/hasu-crypto", "path": "src/main/java/org/hasu/prng/Prng.java", "license": "gpl-2.0", "size": 391 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
1,336,567
private boolean getTranslatedPoint(Point corner, Point p, int dx, int dy) { int diff = (int) corner.getDistance(p); if (diff < arcRadius) { Point t = corner.getTranslated(dx, dy); p.setLocation(t.x, t.y); return true; } return false; }
boolean function(Point corner, Point p, int dx, int dy) { int diff = (int) corner.getDistance(p); if (diff < arcRadius) { Point t = corner.getTranslated(dx, dy); p.setLocation(t.x, t.y); return true; } return false; }
/** * Calculates the distance from the corner to the Point p. * If it is less than the minimum then it translates it and returns the new Point. * @param corner The corner Point. * @param p The point to translate if close to the corner. * @param dx The amount to translate in the x direcion. * @param dy The amount to translate in the y direcion. * @return boolean If the translation occured. */
Calculates the distance from the corner to the Point p. If it is less than the minimum then it translates it and returns the new Point
getTranslatedPoint
{ "repo_name": "archimatetool/archi", "path": "org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/RoundedChopboxAnchor.java", "license": "mit", "size": 2807 }
[ "org.eclipse.draw2d.geometry.Point" ]
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.*;
[ "org.eclipse.draw2d" ]
org.eclipse.draw2d;
1,782,528
public IType getType(Expression expression) { return getResolver(expression).getType(); }
IType function(Expression expression) { return getResolver(expression).getType(); }
/** * Returns the {@link IType} of the given {@link Expression}. * * @param expression The {@link Expression} for which its type will be calculated * @return Either the {@link IType} that was resolved by this {@link Resolver} or the * {@link IType} for {@link IType#UNRESOLVABLE_TYPE} if it could not be resolved */
Returns the <code>IType</code> of the given <code>Expression</code>
getType
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "jpa/org.eclipse.persistence.jpa.jpql/src/org/eclipse/persistence/jpa/jpql/tools/JPQLQueryContext.java", "license": "epl-1.0", "size": 33626 }
[ "org.eclipse.persistence.jpa.jpql.parser.Expression", "org.eclipse.persistence.jpa.jpql.tools.spi.IType" ]
import org.eclipse.persistence.jpa.jpql.parser.Expression; import org.eclipse.persistence.jpa.jpql.tools.spi.IType;
import org.eclipse.persistence.jpa.jpql.parser.*; import org.eclipse.persistence.jpa.jpql.tools.spi.*;
[ "org.eclipse.persistence" ]
org.eclipse.persistence;
2,129,218
void removeTrustDomain(TrustDomainEntity trustDomain);
void removeTrustDomain(TrustDomainEntity trustDomain);
/** * Remove the specified {@link TrustDomainEntity}. * * @param trustDomain */
Remove the specified <code>TrustDomainEntity</code>
removeTrustDomain
{ "repo_name": "tectronics/eid-trust-service", "path": "eid-trust-service-model/src/main/java/be/fedict/trust/service/TrustDomainService.java", "license": "gpl-3.0", "size": 8776 }
[ "be.fedict.trust.service.entity.TrustDomainEntity" ]
import be.fedict.trust.service.entity.TrustDomainEntity;
import be.fedict.trust.service.entity.*;
[ "be.fedict.trust" ]
be.fedict.trust;
2,913,337
public void accumulate(Collection<ConfusionMatrix> cms) { if (cms.size() == 0) throw new IllegalArgumentException("Cannot accumulate empty collection."); Iterator<ConfusionMatrix> iter = cms.iterator(); while (iter.hasNext()) accumulate(iter.next()); }
void function(Collection<ConfusionMatrix> cms) { if (cms.size() == 0) throw new IllegalArgumentException(STR); Iterator<ConfusionMatrix> iter = cms.iterator(); while (iter.hasNext()) accumulate(iter.next()); }
/** * Accumulates the scores from a collection of confusion matrices. */
Accumulates the scores from a collection of confusion matrices
accumulate
{ "repo_name": "linqs/psl-utils", "path": "psl-evaluation-extended/src/main/java/org/linqs/psl/utils/evaluation/statistics/ConfusionMatrix.java", "license": "apache-2.0", "size": 4998 }
[ "java.util.Collection", "java.util.Iterator" ]
import java.util.Collection; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,836,507
@Test(expected = InstantiationException.class) public void testConstructorIsAbstract() throws Exception { Constructor<AbstractDataEncoder> constructor = AbstractDataEncoder.class.getDeclaredConstructor(); // Try to create an instance constructor.newInstance(); }
@Test(expected = InstantiationException.class) void function() throws Exception { Constructor<AbstractDataEncoder> constructor = AbstractDataEncoder.class.getDeclaredConstructor(); constructor.newInstance(); }
/** * Ensure the constructor is abstract. * * @throws Exception Tests throw exceptions. */
Ensure the constructor is abstract
testConstructorIsAbstract
{ "repo_name": "krotscheck/data-file-reader", "path": "data-file-reader-base/src/test/java/net/krotscheck/dfr/stream/AbstractStreamEncoderTest.java", "license": "apache-2.0", "size": 3662 }
[ "java.lang.reflect.Constructor", "net.krotscheck.dfr.AbstractDataEncoder", "org.junit.Test" ]
import java.lang.reflect.Constructor; import net.krotscheck.dfr.AbstractDataEncoder; import org.junit.Test;
import java.lang.reflect.*; import net.krotscheck.dfr.*; import org.junit.*;
[ "java.lang", "net.krotscheck.dfr", "org.junit" ]
java.lang; net.krotscheck.dfr; org.junit;
1,475,533
public Builder rename(Node n, String name) { return rename(n, name, false); }
Builder function(Node n, String name) { return rename(n, name, false); }
/** * Renames a given node to the provided name. * @param n The node to rename. * @param name The new name for the node. */
Renames a given node to the provided name
rename
{ "repo_name": "phistuck/closure-compiler", "path": "src/com/google/javascript/refactoring/SuggestedFix.java", "license": "apache-2.0", "size": 15882 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
1,981,648
public Range getDomainBounds(boolean includeInterval) { // first get the range without the interval, then expand it for the // interval width Range range = DatasetUtilities.findDomainBounds(this.dataset, false); if (includeInterval && range != null) { double lowerAdj = getIntervalWidth() * getIntervalPositionFactor(); double upperAdj = getIntervalWidth() - lowerAdj; range = new Range(range.getLowerBound() - lowerAdj, range.getUpperBound() + upperAdj); } return range; }
Range function(boolean includeInterval) { Range range = DatasetUtilities.findDomainBounds(this.dataset, false); if (includeInterval && range != null) { double lowerAdj = getIntervalWidth() * getIntervalPositionFactor(); double upperAdj = getIntervalWidth() - lowerAdj; range = new Range(range.getLowerBound() - lowerAdj, range.getUpperBound() + upperAdj); } return range; }
/** * Returns the range of the values in the dataset's domain, including * or excluding the interval around each x-value as specified. * * @param includeInterval a flag that determines whether or not the * x-interval should be taken into account. * * @return The range. */
Returns the range of the values in the dataset's domain, including or excluding the interval around each x-value as specified
getDomainBounds
{ "repo_name": "Epsilon2/Memetic-Algorithm-for-TSP", "path": "jfreechart-1.0.16/source/org/jfree/data/xy/IntervalXYDelegate.java", "license": "mit", "size": 16528 }
[ "org.jfree.data.Range", "org.jfree.data.general.DatasetUtilities" ]
import org.jfree.data.Range; import org.jfree.data.general.DatasetUtilities;
import org.jfree.data.*; import org.jfree.data.general.*;
[ "org.jfree.data" ]
org.jfree.data;
1,331,840