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
public void setFeature(String featureId, boolean state) throws XMLConfigurationException { if (!fRecognizedFeatures.contains(featureId)) { short type = XMLConfigurationException.NOT_RECOGNIZED; throw new XMLConfigurationException(type, featureId); } fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE); int length = fComponents.size(); for (int i = 0; i < length; i++) { XMLComponent component = (XMLComponent)fComponents.elementAt(i); component.setFeature(featureId, state); } } // setFeature(String,boolean)
void function(String featureId, boolean state) throws XMLConfigurationException { if (!fRecognizedFeatures.contains(featureId)) { short type = XMLConfigurationException.NOT_RECOGNIZED; throw new XMLConfigurationException(type, featureId); } fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE); int length = fComponents.size(); for (int i = 0; i < length; i++) { XMLComponent component = (XMLComponent)fComponents.elementAt(i); component.setFeature(featureId, state); } }
/** * Sets the state of a feature. This method is called by the parser * and gets propagated to components in this parser configuration. * * @param featureId The feature identifier. * @param state The state of the feature. * * @throws XMLConfigurationException Thrown if there is a configuration * error. */
Sets the state of a feature. This method is called by the parser and gets propagated to components in this parser configuration
setFeature
{ "repo_name": "Baltasarq/Gia", "path": "src/JDom/Xerces-J-bin.2.9.1/samples/xni/parser/AbstractConfiguration.java", "license": "mit", "size": 14826 }
[ "org.apache.xerces.xni.parser.XMLComponent", "org.apache.xerces.xni.parser.XMLConfigurationException" ]
import org.apache.xerces.xni.parser.XMLComponent; import org.apache.xerces.xni.parser.XMLConfigurationException;
import org.apache.xerces.xni.parser.*;
[ "org.apache.xerces" ]
org.apache.xerces;
1,928,576
public static BluetoothAdvertisementData parseLEAdvertisement(byte[] b) { BluetoothAdvertisementData btAdData = null; if (b[0] != 0x04 || b[1] != 0x3E) { // Not and Advertisement Packet return btAdData; } // LE Advertisement Subevent Code: 0x02 if (b[3] != 0x02) { // Not a Advertisement Sub Event return btAdData; } // Start building Advertisement Data btAdData = new BluetoothAdvertisementData(); btAdData.setRawData(b); btAdData.setPacketType(b[0]); btAdData.setEventType(b[1]); btAdData.setParameterLength(b[2]); btAdData.setSubEventCode(b[3]); // Number of reports in this advertisement btAdData.setNumberOfReports(b[4]); // Parse each report int ptr = 5; for (int nr = 0; nr < btAdData.getNumberOfReports(); nr++) { AdvertisingReportRecord arr = new AdvertisingReportRecord(); arr.setEventType(b[ptr++]); arr.setAddressType(b[ptr++]); // Extract remote address String address = String.format("%02X:%02X:%02X:%02X:%02X:%02X", b[ptr + 5], b[ptr + 4], b[ptr + 3], b[ptr + 2], b[ptr + 1], b[ptr + 0]); arr.setAddress(address); ptr += 6; int arrDataLength = b[ptr++]; arr.setLength(b[ptr++]); byte[] arrData = new byte[arrDataLength]; System.arraycopy(b, ptr, arrData, 0, arrDataLength); arr.setReportData(arrData); btAdData.addReportRecord(arr); ptr += arrDataLength; } return btAdData; }
static BluetoothAdvertisementData function(byte[] b) { BluetoothAdvertisementData btAdData = null; if (b[0] != 0x04 b[1] != 0x3E) { return btAdData; } if (b[3] != 0x02) { return btAdData; } btAdData = new BluetoothAdvertisementData(); btAdData.setRawData(b); btAdData.setPacketType(b[0]); btAdData.setEventType(b[1]); btAdData.setParameterLength(b[2]); btAdData.setSubEventCode(b[3]); btAdData.setNumberOfReports(b[4]); int ptr = 5; for (int nr = 0; nr < btAdData.getNumberOfReports(); nr++) { AdvertisingReportRecord arr = new AdvertisingReportRecord(); arr.setEventType(b[ptr++]); arr.setAddressType(b[ptr++]); String address = String.format(STR, b[ptr + 5], b[ptr + 4], b[ptr + 3], b[ptr + 2], b[ptr + 1], b[ptr + 0]); arr.setAddress(address); ptr += 6; int arrDataLength = b[ptr++]; arr.setLength(b[ptr++]); byte[] arrData = new byte[arrDataLength]; System.arraycopy(b, ptr, arrData, 0, arrDataLength); arr.setReportData(arrData); btAdData.addReportRecord(arr); ptr += arrDataLength; } return btAdData; }
/** * Check for advertisement out of an HCL LE Advertising Report Event * * See Bluetooth Core 4.0; 7.7.65.2 LE Advertising Report Event * * @param b * @return */
Check for advertisement out of an HCL LE Advertising Report Event See Bluetooth Core 4.0; 7.7.65.2 LE Advertising Report Event
parseLEAdvertisement
{ "repo_name": "nicolatimeus/kura", "path": "kura/org.eclipse.kura.linux.bluetooth/src/main/java/org/eclipse/kura/linux/bluetooth/util/BluetoothUtil.java", "license": "epl-1.0", "size": 19604 }
[ "org.eclipse.kura.bluetooth.listener.AdvertisingReportRecord", "org.eclipse.kura.bluetooth.listener.BluetoothAdvertisementData" ]
import org.eclipse.kura.bluetooth.listener.AdvertisingReportRecord; import org.eclipse.kura.bluetooth.listener.BluetoothAdvertisementData;
import org.eclipse.kura.bluetooth.listener.*;
[ "org.eclipse.kura" ]
org.eclipse.kura;
1,102,796
List<Datum> getAllData();
List<Datum> getAllData();
/** * Gets all data in this data set. * * @return the list of all data points. */
Gets all data in this data set
getAllData
{ "repo_name": "laccore/coretools", "path": "coretools-data/src/main/java/org/andrill/coretools/data/DataSet.java", "license": "apache-2.0", "size": 3972 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,083,995
void onLoadingFailed(String imageUri, View view, FailReason failReason);
void onLoadingFailed(String imageUri, View view, FailReason failReason);
/** * Is called when an error was occurred during image loading * * @param imageUri Loading image URI * @param view View for image. Can be <b>null</b>. * @param failReason {@linkplain FailReason The reason} why image loading was failed */
Is called when an error was occurred during image loading
onLoadingFailed
{ "repo_name": "nulibj/android-project-wo2b", "path": "wo2b-common-api/src/opensource/component/imageloader/core/assist/ImageLoadingListener.java", "license": "apache-2.0", "size": 2311 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
474,747
protected List<AbstractArtefact> getArtefacts(PortfolioStructure structure) { return getArtefacts(structure, -1, -1); }
List<AbstractArtefact> function(PortfolioStructure structure) { return getArtefacts(structure, -1, -1); }
/** * Return the list of artefacts glued to this structure element * @param structure * @return A list of artefacts */
Return the list of artefacts glued to this structure element
getArtefacts
{ "repo_name": "stevenhva/InfoLearn_OpenOLAT", "path": "src/main/java/org/olat/portfolio/manager/EPStructureManager.java", "license": "apache-2.0", "size": 75865 }
[ "java.util.List", "org.olat.portfolio.model.artefacts.AbstractArtefact", "org.olat.portfolio.model.structel.PortfolioStructure" ]
import java.util.List; import org.olat.portfolio.model.artefacts.AbstractArtefact; import org.olat.portfolio.model.structel.PortfolioStructure;
import java.util.*; import org.olat.portfolio.model.artefacts.*; import org.olat.portfolio.model.structel.*;
[ "java.util", "org.olat.portfolio" ]
java.util; org.olat.portfolio;
1,045,214
static String getArrayElementStringValue(Node n) { return (NodeUtil.isNullOrUndefined(n) || n.isEmpty()) ? "" : getStringValue(n); }
static String getArrayElementStringValue(Node n) { return (NodeUtil.isNullOrUndefined(n) n.isEmpty()) ? "" : getStringValue(n); }
/** * When converting arrays to string using Array.prototype.toString or * Array.prototype.join, the rules for conversion to String are different * than converting each element individually. Specifically, "null" and * "undefined" are converted to an empty string. * @param n A node that is a member of an Array. * @return The string representation. */
When converting arrays to string using Array.prototype.toString or Array.prototype.join, the rules for conversion to String are different than converting each element individually. Specifically, "null" and "undefined" are converted to an empty string
getArrayElementStringValue
{ "repo_name": "thurday/closure-compiler", "path": "src/com/google/javascript/jscomp/NodeUtil.java", "license": "apache-2.0", "size": 118862 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,374,095
public final ReadOnlyObjectProperty<LocalTime> endTimeProperty() { if (endTime == null) { endTime = new ReadOnlyObjectWrapper<>(this, "endTime", getInterval().getEndTime()); //$NON-NLS-1$ } return endTime.getReadOnlyProperty(); }
final ReadOnlyObjectProperty<LocalTime> function() { if (endTime == null) { endTime = new ReadOnlyObjectWrapper<>(this, STR, getInterval().getEndTime()); } return endTime.getReadOnlyProperty(); }
/** * A read-only property used for retrieving the end time of the entry. The * property gets updated whenever the end time inside the entry interval * changes (see {@link #intervalProperty()}). * * @return the end time of the entry */
A read-only property used for retrieving the end time of the entry. The property gets updated whenever the end time inside the entry interval changes (see <code>#intervalProperty()</code>)
endTimeProperty
{ "repo_name": "TeHenua/Atea", "path": "src/com/calendarfx/model/Entry.java", "license": "gpl-3.0", "size": 65659 }
[ "java.time.LocalTime" ]
import java.time.LocalTime;
import java.time.*;
[ "java.time" ]
java.time;
1,121,317
public Motorist getMotoristById(Integer id) { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { conn = dataSource.getConnection(); stmt = conn.prepareStatement(MOTORIST_QUERY); stmt.setInt(1, id); rs = stmt.executeQuery(); Motorist motorist = null; if (rs.next()) { motorist = new Motorist(); motorist.setId(rs.getInt("id")); motorist.setEmail(rs.getString("email")); motorist.setPassword(rs.getString("password")); motorist.setFirstName(rs.getString("firstName")); motorist.setLastName(rs.getString("lastName")); } return motorist; } catch (SQLException e) {} finally { try { if (rs != null) { rs.close(); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (SQLException e) {} } return null; }
Motorist function(Integer id) { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { conn = dataSource.getConnection(); stmt = conn.prepareStatement(MOTORIST_QUERY); stmt.setInt(1, id); rs = stmt.executeQuery(); Motorist motorist = null; if (rs.next()) { motorist = new Motorist(); motorist.setId(rs.getInt("id")); motorist.setEmail(rs.getString("email")); motorist.setPassword(rs.getString(STR)); motorist.setFirstName(rs.getString(STR)); motorist.setLastName(rs.getString(STR)); } return motorist; } catch (SQLException e) {} finally { try { if (rs != null) { rs.close(); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (SQLException e) {} } return null; }
/** * Retrieves a Motorist from the database using conventional (e.g., * non-Spring) JDBC. * * From Listing 5.3 * * @param id * The ID of the Motorist to retrieve * @return */
Retrieves a Motorist from the database using conventional (e.g., non-Spring) JDBC. From Listing 5.3
getMotoristById
{ "repo_name": "Alexoner/learning-web", "path": "java/spring/sia2/RoadRantz/src/main/java/com/roadrantz/dao/jdbc/ConventionalJdbcRantDao.java", "license": "gpl-2.0", "size": 6080 }
[ "com.roadrantz.domain.Motorist", "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException" ]
import com.roadrantz.domain.Motorist; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException;
import com.roadrantz.domain.*; import java.sql.*;
[ "com.roadrantz.domain", "java.sql" ]
com.roadrantz.domain; java.sql;
1,551,453
@JsonAnySetter @SuppressWarnings("unchecked") public void set(String name, Object value) { if ( value instanceof Map ) { setMapValue( name, (Map<String, Object>) value ); } else { properties.put( name, value ); } }
@SuppressWarnings(STR) void function(String name, Object value) { if ( value instanceof Map ) { setMapValue( name, (Map<String, Object>) value ); } else { properties.put( name, value ); } }
/** * Invoked by Jackson for any non-static property. * <p> * A {@link Map} creates an additional set of properties, one for each entry of the map. * * @param name the property name * @param value the property value */
Invoked by Jackson for any non-static property. A <code>Map</code> creates an additional set of properties, one for each entry of the map
set
{ "repo_name": "emmanuelbernard/hibernate-ogm", "path": "couchdb/src/main/java/org/hibernate/ogm/datastore/couchdb/dialect/backend/json/impl/EntityDocument.java", "license": "lgpl-2.1", "size": 7178 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
439,550
public UpdateRequestBuilder setUpsert(Map source, XContentType contentType) { request.upsert(source, contentType); return this; }
UpdateRequestBuilder function(Map source, XContentType contentType) { request.upsert(source, contentType); return this; }
/** * Sets the doc source of the update request to be used when the document does not exists. */
Sets the doc source of the update request to be used when the document does not exists
setUpsert
{ "repo_name": "qwerty4030/elasticsearch", "path": "server/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java", "license": "apache-2.0", "size": 12591 }
[ "java.util.Map", "org.elasticsearch.common.xcontent.XContentType" ]
import java.util.Map; import org.elasticsearch.common.xcontent.XContentType;
import java.util.*; import org.elasticsearch.common.xcontent.*;
[ "java.util", "org.elasticsearch.common" ]
java.util; org.elasticsearch.common;
2,733,294
@Test public void handle_integerMessage_integerSagaNeverInvoked() throws InvocationTargetException, IllegalAccessException { // given Integer message = new Random().nextInt(); // when sut.handle(message); // then assertThat("Number saga is never called.", calledSagas, not(hasItem(IntegerSaga.class.getName()))); }
void function() throws InvocationTargetException, IllegalAccessException { Integer message = new Random().nextInt(); sut.handle(message); assertThat(STR, calledSagas, not(hasItem(IntegerSaga.class.getName()))); }
/** * <pre> * Given => Message of type integer. Base class handler (Number) stops message dispatching. * When => Message is handled. * Then => Concrete handler saga for integer is never called. * </pre> */
<code> Given => Message of type integer. Base class handler (Number) stops message dispatching. When => Message is handled. Then => Concrete handler saga for integer is never called. </code>
handle_integerMessage_integerSagaNeverInvoked
{ "repo_name": "Domo42/saga-lib", "path": "saga-lib/src/test/java/com/codebullets/sagalib/MessageStreamTest.java", "license": "apache-2.0", "size": 14116 }
[ "java.lang.reflect.InvocationTargetException", "java.util.Random", "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers" ]
import java.lang.reflect.InvocationTargetException; import java.util.Random; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
import java.lang.reflect.*; import java.util.*; import org.hamcrest.*;
[ "java.lang", "java.util", "org.hamcrest" ]
java.lang; java.util; org.hamcrest;
2,466,710
public Q not(Predicate<T> predicate) { return function(new FilterFunction<T>(new RejectingPredicate<T>(predicate))); }
Q function(Predicate<T> predicate) { return function(new FilterFunction<T>(new RejectingPredicate<T>(predicate))); }
/** * Remove elements from the collection. * * @param predicate Selector used to remove Resources * @return new SlingQuery object transformed by this operation */
Remove elements from the collection
not
{ "repo_name": "headwirecom/sling", "path": "contrib/extensions/sling-query/src/main/java/org/apache/sling/query/AbstractQuery.java", "license": "apache-2.0", "size": 26338 }
[ "org.apache.sling.query.api.Predicate", "org.apache.sling.query.function.FilterFunction", "org.apache.sling.query.predicate.RejectingPredicate" ]
import org.apache.sling.query.api.Predicate; import org.apache.sling.query.function.FilterFunction; import org.apache.sling.query.predicate.RejectingPredicate;
import org.apache.sling.query.api.*; import org.apache.sling.query.function.*; import org.apache.sling.query.predicate.*;
[ "org.apache.sling" ]
org.apache.sling;
699,954
protected Map<String, String> makeExportParams() { final HashMap<String, String> params = new HashMap<>(); final RyaExportParameters ryaParams = new RyaExportParameters(params); ryaParams.setUseRyaBindingSetExporter(true); ryaParams.setAccumuloInstanceName(instanceName); ryaParams.setZookeeperServers(zookeepers); ryaParams.setExporterUsername(clusterInstance.getUsername()); ryaParams.setExporterPassword(clusterInstance.getPassword()); ryaParams.setRyaInstanceName(getRyaInstanceName()); return params; }
Map<String, String> function() { final HashMap<String, String> params = new HashMap<>(); final RyaExportParameters ryaParams = new RyaExportParameters(params); ryaParams.setUseRyaBindingSetExporter(true); ryaParams.setAccumuloInstanceName(instanceName); ryaParams.setZookeeperServers(zookeepers); ryaParams.setExporterUsername(clusterInstance.getUsername()); ryaParams.setExporterPassword(clusterInstance.getPassword()); ryaParams.setRyaInstanceName(getRyaInstanceName()); return params; }
/** * Override this method to provide an output configuration to the Fluo application. * <p> * Exports to the Rya instance by default. * * @return The parameters that will be passed to {@link QueryResultObserver} at startup. */
Override this method to provide an output configuration to the Fluo application. Exports to the Rya instance by default
makeExportParams
{ "repo_name": "kchilton2/incubator-rya", "path": "extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/FluoITBase.java", "license": "apache-2.0", "size": 12794 }
[ "java.util.HashMap", "java.util.Map", "org.apache.rya.indexing.pcj.fluo.app.export.rya.RyaExportParameters" ]
import java.util.HashMap; import java.util.Map; import org.apache.rya.indexing.pcj.fluo.app.export.rya.RyaExportParameters;
import java.util.*; import org.apache.rya.indexing.pcj.fluo.app.export.rya.*;
[ "java.util", "org.apache.rya" ]
java.util; org.apache.rya;
1,907,465
public void setClasses(String names) { illegalClasses.clear(); final StringTokenizer tok = new StringTokenizer(names, ","); while (tok.hasMoreTokens()) { illegalClasses.add(tok.nextToken()); } }
void function(String names) { illegalClasses.clear(); final StringTokenizer tok = new StringTokenizer(names, ","); while (tok.hasMoreTokens()) { illegalClasses.add(tok.nextToken()); } }
/** * Sets the classes that are illegal to instantiate. * @param names a comma seperate list of class names */
Sets the classes that are illegal to instantiate
setClasses
{ "repo_name": "Godin/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java", "license": "lgpl-2.1", "size": 12137 }
[ "java.util.StringTokenizer" ]
import java.util.StringTokenizer;
import java.util.*;
[ "java.util" ]
java.util;
1,149,215
public static DataResult<Map<String, Object>> availableSystemGroups(Server server, User user) { SelectMode m = ModeFactory.getMode("SystemGroup_queries", "visible_to_system", Map.class); Map<String, Object> params = new HashMap<String, Object>(); params.put("sid", server.getId()); params.put("org_id", user.getOrg().getId()); params.put("user_id", user.getId()); return m.execute(params); }
static DataResult<Map<String, Object>> function(Server server, User user) { SelectMode m = ModeFactory.getMode(STR, STR, Map.class); Map<String, Object> params = new HashMap<String, Object>(); params.put("sid", server.getId()); params.put(STR, user.getOrg().getId()); params.put(STR, user.getId()); return m.execute(params); }
/** * Returns a list of available server groups for a given server * @param server The server in question * @param user The user requesting the information * @return Returns a list of system groups available for this server/user */
Returns a list of available server groups for a given server
availableSystemGroups
{ "repo_name": "renner/spacewalk", "path": "java/code/src/com/redhat/rhn/manager/system/SystemManager.java", "license": "gpl-2.0", "size": 132498 }
[ "com.redhat.rhn.common.db.datasource.DataResult", "com.redhat.rhn.common.db.datasource.ModeFactory", "com.redhat.rhn.common.db.datasource.SelectMode", "com.redhat.rhn.domain.server.Server", "com.redhat.rhn.domain.user.User", "java.util.HashMap", "java.util.Map" ]
import com.redhat.rhn.common.db.datasource.DataResult; import com.redhat.rhn.common.db.datasource.ModeFactory; import com.redhat.rhn.common.db.datasource.SelectMode; import com.redhat.rhn.domain.server.Server; import com.redhat.rhn.domain.user.User; import java.util.HashMap; import java.util.Map;
import com.redhat.rhn.common.db.datasource.*; import com.redhat.rhn.domain.server.*; import com.redhat.rhn.domain.user.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
1,058,343
private void loadImageIfNecessary(final boolean isInLayoutPass) { int width = getWidth(); int height = getHeight(); boolean isFullyWrapContent = getLayoutParams() != null && getLayoutParams().height == LayoutParams.WRAP_CONTENT && getLayoutParams().width == LayoutParams.WRAP_CONTENT; // if the view's bounds aren't known yet, and this is not a // wrap-content/wrap-content // view, hold off on loading the image. if (width == 0 && height == 0 && !isFullyWrapContent) { return; } // if the URL to be loaded in this view is empty, cancel any old // requests and clear the // currently loaded image. if (TextUtils.isEmpty(mUrl)) { if (mImageContainer != null) { mImageContainer.cancelRequest(); mImageContainer = null; } setDefaultImageOrNull(); return; } // if there was an old request in this view, check if it needs to be // canceled. if (mImageContainer != null && mImageContainer.getRequestUrl() != null) { if (mImageContainer.getRequestUrl().equals(mUrl)) { // if the request is from the same URL, return. return; } else { // if there is a pre-existing request, cancel it if it's // fetching a different URL. mImageContainer.cancelRequest(); setDefaultImageOrNull(); } } // The pre-existing content of this view didn't match the current URL. // Load the new image // from the network. ImageContainer newContainer = mImageLoader.get(mUrl, new ImageListener() {
void function(final boolean isInLayoutPass) { int width = getWidth(); int height = getHeight(); boolean isFullyWrapContent = getLayoutParams() != null && getLayoutParams().height == LayoutParams.WRAP_CONTENT && getLayoutParams().width == LayoutParams.WRAP_CONTENT; if (width == 0 && height == 0 && !isFullyWrapContent) { return; } if (TextUtils.isEmpty(mUrl)) { if (mImageContainer != null) { mImageContainer.cancelRequest(); mImageContainer = null; } setDefaultImageOrNull(); return; } if (mImageContainer != null && mImageContainer.getRequestUrl() != null) { if (mImageContainer.getRequestUrl().equals(mUrl)) { return; } else { mImageContainer.cancelRequest(); setDefaultImageOrNull(); } } ImageContainer newContainer = mImageLoader.get(mUrl, new ImageListener() {
/** * Loads the image for the view if it isn't already loaded. * * @param isInLayoutPass * True if this was invoked from a layout pass, false otherwise. */
Loads the image for the view if it isn't already loaded
loadImageIfNecessary
{ "repo_name": "dim1989/zhangzhoujun.github.io", "path": "MyVolley/app/src/main/java/com/android/myvolley/volley/toolbox/NetworkImageView.java", "license": "epl-1.0", "size": 7808 }
[ "android.text.TextUtils", "android.view.ViewGroup", "com.android.myvolley.volley.toolbox.ImageLoader" ]
import android.text.TextUtils; import android.view.ViewGroup; import com.android.myvolley.volley.toolbox.ImageLoader;
import android.text.*; import android.view.*; import com.android.myvolley.volley.toolbox.*;
[ "android.text", "android.view", "com.android.myvolley" ]
android.text; android.view; com.android.myvolley;
1,127,971
public static <K, V> Map<K, V> unmodifiableMap(final Map<? extends K, ? extends V> map) { return UnmodifiableMap.unmodifiableMap(map); }
static <K, V> Map<K, V> function(final Map<? extends K, ? extends V> map) { return UnmodifiableMap.unmodifiableMap(map); }
/** * Returns an unmodifiable map backed by the given map. * <p> * This method uses the implementation in the decorators subpackage. * * @param <K> the key type * @param <V> the value type * @param map the map to make unmodifiable, must not be null * @return an unmodifiable map backed by the given map * @throws IllegalArgumentException if the map is null */
Returns an unmodifiable map backed by the given map. This method uses the implementation in the decorators subpackage
unmodifiableMap
{ "repo_name": "gonmarques/commons-collections", "path": "src/main/java/org/apache/commons/collections4/MapUtils.java", "license": "apache-2.0", "size": 72285 }
[ "java.util.Map", "org.apache.commons.collections4.map.UnmodifiableMap" ]
import java.util.Map; import org.apache.commons.collections4.map.UnmodifiableMap;
import java.util.*; import org.apache.commons.collections4.map.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
138,584
@Test public void testHasNext() { try { // create the resettable Iterator SpillingResettableIterator<IntValue> iterator = new SpillingResettableIterator<IntValue>( this.reader, this.serializer, this.memman, this.ioman, 2, this.memOwner); // open the iterator iterator.open(); int cnt = 0; while (iterator.hasNext()) { iterator.hasNext(); iterator.next(); cnt++; } Assert.assertTrue(cnt + " elements read from iterator, but " + NUM_TESTRECORDS + " expected", cnt == NUM_TESTRECORDS); iterator.close(); } catch (Exception ex) { ex.printStackTrace(); Assert.fail("Test encountered an exception."); } }
void function() { try { SpillingResettableIterator<IntValue> iterator = new SpillingResettableIterator<IntValue>( this.reader, this.serializer, this.memman, this.ioman, 2, this.memOwner); iterator.open(); int cnt = 0; while (iterator.hasNext()) { iterator.hasNext(); iterator.next(); cnt++; } Assert.assertTrue(cnt + STR + NUM_TESTRECORDS + STR, cnt == NUM_TESTRECORDS); iterator.close(); } catch (Exception ex) { ex.printStackTrace(); Assert.fail(STR); } }
/** * Tests whether multiple call of hasNext() changes the state of the iterator */
Tests whether multiple call of hasNext() changes the state of the iterator
testHasNext
{ "repo_name": "fhueske/flink", "path": "flink-runtime/src/test/java/org/apache/flink/runtime/operators/resettable/SpillingResettableIteratorTest.java", "license": "apache-2.0", "size": 7176 }
[ "org.apache.flink.types.IntValue", "org.junit.Assert" ]
import org.apache.flink.types.IntValue; import org.junit.Assert;
import org.apache.flink.types.*; import org.junit.*;
[ "org.apache.flink", "org.junit" ]
org.apache.flink; org.junit;
701,035
public static DERIA5String getInstance( ASN1TaggedObject obj, boolean explicit) { ASN1Primitive o = obj.getObject(); if (explicit || o instanceof DERIA5String) { return getInstance(o); } else { return new DERIA5String(((ASN1OctetString)o).getOctets()); } } DERIA5String( byte[] string) { this.string = string; } public DERIA5String( String string) { this(string, false); } public DERIA5String( String string, boolean validate) { if (string == null) { throw new NullPointerException("string cannot be null"); } if (validate && !isIA5String(string)) { throw new IllegalArgumentException("string contains illegal characters"); } this.string = Strings.toByteArray(string); }
static DERIA5String function( ASN1TaggedObject obj, boolean explicit) { ASN1Primitive o = obj.getObject(); if (explicit o instanceof DERIA5String) { return getInstance(o); } else { return new DERIA5String(((ASN1OctetString)o).getOctets()); } } DERIA5String( byte[] string) { this.string = string; } public DERIA5String( String string) { this(string, false); } public DERIA5String( String string, boolean validate) { if (string == null) { throw new NullPointerException(STR); } if (validate && !isIA5String(string)) { throw new IllegalArgumentException(STR); } this.string = Strings.toByteArray(string); }
/** * return an IA5 String from a tagged object. * * @param obj the tagged object holding the object we want * @param explicit true if the object is meant to be explicitly * tagged false otherwise. * @exception IllegalArgumentException if the tagged object cannot * be converted. * @return a DERIA5String instance, or null. */
return an IA5 String from a tagged object
getInstance
{ "repo_name": "ripple/ripple-lib-java", "path": "ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERIA5String.java", "license": "isc", "size": 4587 }
[ "org.ripple.bouncycastle.util.Strings" ]
import org.ripple.bouncycastle.util.Strings;
import org.ripple.bouncycastle.util.*;
[ "org.ripple.bouncycastle" ]
org.ripple.bouncycastle;
1,921,141
EReference getSubConversation_ConversationNodes();
EReference getSubConversation_ConversationNodes();
/** * Returns the meta object for the containment reference list '{@link org.eclipse.bpmn2.SubConversation#getConversationNodes <em>Conversation Nodes</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Conversation Nodes</em>'. * @see org.eclipse.bpmn2.SubConversation#getConversationNodes() * @see #getSubConversation() * @generated */
Returns the meta object for the containment reference list '<code>org.eclipse.bpmn2.SubConversation#getConversationNodes Conversation Nodes</code>'.
getSubConversation_ConversationNodes
{ "repo_name": "Rikkola/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 929298 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,124,496
private EObject createObject(EClass eClass) { EObject eObject = eClass.getEPackage().getEFactoryInstance().create(eClass); // if the object has an "id", assign it now. String id = ModelUtil.setID(eObject,containingResource); // also set a default name EStructuralFeature feature = eObject.eClass().getEStructuralFeature("name"); if (feature!=null) { if (id!=null) eObject.eSet(feature, ModelUtil.toDisplayName(id)); else eObject.eSet(feature, "New "+ModelUtil.toDisplayName(eObject.eClass().getName())); } return eObject; }
EObject function(EClass eClass) { EObject eObject = eClass.getEPackage().getEFactoryInstance().create(eClass); String id = ModelUtil.setID(eObject,containingResource); EStructuralFeature feature = eObject.eClass().getEStructuralFeature("name"); if (feature!=null) { if (id!=null) eObject.eSet(feature, ModelUtil.toDisplayName(id)); else eObject.eSet(feature, STR+ModelUtil.toDisplayName(eObject.eClass().getName())); } return eObject; }
/** * Create and initialize an object of the given EClass. Initialization consists * of assigning an ID and setting a default name if the EClass has those features. * * @param eClass - type of object to create * @return an initialized EObject */
Create and initialize an object of the given EClass. Initialization consists of assigning an ID and setting a default name if the EClass has those features
createObject
{ "repo_name": "camunda/camunda-eclipse-plugin", "path": "org.camunda.bpm.modeler/src/org/camunda/bpm/modeler/core/runtime/ModelExtensionDescriptor.java", "license": "epl-1.0", "size": 14715 }
[ "org.camunda.bpm.modeler.core.utils.ModelUtil", "org.eclipse.emf.ecore.EClass", "org.eclipse.emf.ecore.EObject", "org.eclipse.emf.ecore.EStructuralFeature" ]
import org.camunda.bpm.modeler.core.utils.ModelUtil; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature;
import org.camunda.bpm.modeler.core.utils.*; import org.eclipse.emf.ecore.*;
[ "org.camunda.bpm", "org.eclipse.emf" ]
org.camunda.bpm; org.eclipse.emf;
2,549,040
public Set<Node> getListCopy() { final List<Node> l; synchronized (this) { l = this.list; } return new HashSet<Node>(l); }
Set<Node> function() { final List<Node> l; synchronized (this) { l = this.list; } return new HashSet<Node>(l); }
/** * Returns a copy of the arraylist contained. * * @return ArrayList */
Returns a copy of the arraylist contained
getListCopy
{ "repo_name": "smanvi-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/util/VersionedArrayList.java", "license": "apache-2.0", "size": 8839 }
[ "java.util.HashSet", "java.util.List", "java.util.Set", "org.apache.geode.internal.cache.Node" ]
import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.geode.internal.cache.Node;
import java.util.*; import org.apache.geode.internal.cache.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
891,607
public void clear() { _values.clear(); _expireTime = CurrentTime.getCurrentTime(); }
void function() { _values.clear(); _expireTime = CurrentTime.getCurrentTime(); }
/** * Clears the collection. */
Clears the collection
clear
{ "repo_name": "mdaniel/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/amber/collection/MapImpl.java", "license": "gpl-2.0", "size": 4453 }
[ "com.caucho.util.CurrentTime" ]
import com.caucho.util.CurrentTime;
import com.caucho.util.*;
[ "com.caucho.util" ]
com.caucho.util;
672,465
double amount(Random rand, T seed);
double amount(Random rand, T seed);
/** * Gets an instance of the variable amount depending on the given random * object and the seed object. * * @param rand The random object * @param seed The seed object * @return The amount */
Gets an instance of the variable amount depending on the given random object and the seed object
amount
{ "repo_name": "SpongePowered/SpongeAPI", "path": "src/main/java/org/spongepowered/api/util/weighted/SeededVariableAmount.java", "license": "mit", "size": 4341 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
376,686
public String getFullName() throws VException { return String.format(TMPL, get(MemberHome.KEY_FIRSTNAME), get(MemberHome.KEY_NAME)); }
String function() throws VException { return String.format(TMPL, get(MemberHome.KEY_FIRSTNAME), get(MemberHome.KEY_NAME)); }
/** Returns the member's full name, i.e. <code>firstname name</code>. * * @return String the member's full name * @throws VException */
Returns the member's full name, i.e. <code>firstname name</code>
getFullName
{ "repo_name": "aktion-hip/vif", "path": "org.hip.vif.core/src/org/hip/vif/core/bom/impl/JoinRatingsToRater.java", "license": "gpl-2.0", "size": 3363 }
[ "org.hip.kernel.exc.VException", "org.hip.vif.core.bom.MemberHome" ]
import org.hip.kernel.exc.VException; import org.hip.vif.core.bom.MemberHome;
import org.hip.kernel.exc.*; import org.hip.vif.core.bom.*;
[ "org.hip.kernel", "org.hip.vif" ]
org.hip.kernel; org.hip.vif;
720,060
void onDownMotionEvent(MotionEvent ev);
void onDownMotionEvent(MotionEvent ev);
/** * Called if the down motion event is intercepted by this layout. * * @param ev Motion event. */
Called if the down motion event is intercepted by this layout
onDownMotionEvent
{ "repo_name": "YongHuiLuo/Android-ObservableScrollView", "path": "library/src/main/java/com/github/ksoichiro/android/observablescrollview/TouchInterceptionFrameLayout.java", "license": "apache-2.0", "size": 12531 }
[ "android.view.MotionEvent" ]
import android.view.MotionEvent;
import android.view.*;
[ "android.view" ]
android.view;
1,180,348
@Override public void updateConfiguration(IProject project, IProgressMonitor monitor) throws CoreException { if (!xtextBuilderFound(project)) { if (!project.hasNature(XtextProjectHelper.NATURE_ID)) { OfsCore.addNature(project, XtextProjectHelper.NATURE_ID); } OfsCore.addProjectBuilder(project, XtextProjectHelper.BUILDER_ID); } }
void function(IProject project, IProgressMonitor monitor) throws CoreException { if (!xtextBuilderFound(project)) { if (!project.hasNature(XtextProjectHelper.NATURE_ID)) { OfsCore.addNature(project, XtextProjectHelper.NATURE_ID); } OfsCore.addProjectBuilder(project, XtextProjectHelper.BUILDER_ID); } }
/** * add the xtextbuilder to the project along with the xtext nature */
add the xtextbuilder to the project along with the xtext nature
updateConfiguration
{ "repo_name": "debabratahazra/DS", "path": "designstudio/components/workbench/ui/com.odcgroup.workbench.dsl.ui/src/com/odcgroup/workbench/dsl/ui/quickfix/CommonXtextBuilderInitializer.java", "license": "epl-1.0", "size": 2188 }
[ "com.odcgroup.workbench.core.OfsCore", "org.eclipse.core.resources.IProject", "org.eclipse.core.runtime.CoreException", "org.eclipse.core.runtime.IProgressMonitor", "org.eclipse.xtext.ui.XtextProjectHelper" ]
import com.odcgroup.workbench.core.OfsCore; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.xtext.ui.XtextProjectHelper;
import com.odcgroup.workbench.core.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.xtext.ui.*;
[ "com.odcgroup.workbench", "org.eclipse.core", "org.eclipse.xtext" ]
com.odcgroup.workbench; org.eclipse.core; org.eclipse.xtext;
2,652,889
private static String javaCharset(String charset) { // nothing in, nothing out. if (charset == null) { return null; } String mappedCharset = MIME2JAVA.get(charset.toLowerCase(Locale.ENGLISH)); // if there is no mapping, then the original name is used. Many of the MIME character set // names map directly back into Java. The reverse isn't necessarily true. if (mappedCharset == null) { return charset; } return mappedCharset; }
static String function(String charset) { if (charset == null) { return null; } String mappedCharset = MIME2JAVA.get(charset.toLowerCase(Locale.ENGLISH)); if (mappedCharset == null) { return charset; } return mappedCharset; }
/** * Translate a MIME standard character set name into the Java * equivalent. * * @param charset The MIME standard name. * * @return The Java equivalent for this name. */
Translate a MIME standard character set name into the Java equivalent
javaCharset
{ "repo_name": "wenzhucjy/tomcat_source", "path": "tomcat-8.0.9-sourcecode/java/org/apache/tomcat/util/http/fileupload/util/mime/MimeUtility.java", "license": "apache-2.0", "size": 11219 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
2,389,014
public void put(K k, V v, Location loc, Environment env) throws EvalException { checkMutable(loc, env); EvalUtils.checkValidDictKey(k); contents.put(k, v); }
void function(K k, V v, Location loc, Environment env) throws EvalException { checkMutable(loc, env); EvalUtils.checkValidDictKey(k); contents.put(k, v); }
/** * Put an entry into a SkylarkDict. * @param k the key * @param v the associated value * @param loc a {@link Location} in case of error * @param env an {@link Environment}, to check Mutability * @throws EvalException if the key is invalid */
Put an entry into a SkylarkDict
put
{ "repo_name": "anupcshan/bazel", "path": "src/main/java/com/google/devtools/build/lib/syntax/SkylarkDict.java", "license": "apache-2.0", "size": 8777 }
[ "com.google.devtools.build.lib.events.Location" ]
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.events.*;
[ "com.google.devtools" ]
com.google.devtools;
214,319
public static ComponentVersionBI getComponentVersion(int nid, ViewCoordinate vc) { LOG.debug("Get component by nid: '{}'", nid); if (nid == 0) { return null; } try { ComponentChronicleBI<?> componentChronicle = getComponentChronicle(nid); Optional<? extends ComponentVersionBI> componentVersion = componentChronicle.getVersion(vc); // Nothing like an undocumented getter which, rather than returning null when // the thing you are asking for doesn't exist - it goes off and returns // essentially a new, empty, useless node. Sigh. if (!componentVersion.isPresent() || componentVersion.get().getUuidList().size() == 0) { return null; } else { return componentVersion.get(); } } catch (ContradictionException e) { LOG.error("Trouble getting concept " + nid + ". Caught " + e.getClass().getName() + " " + e.getLocalizedMessage(), e); return null; } }
static ComponentVersionBI function(int nid, ViewCoordinate vc) { LOG.debug(STR, nid); if (nid == 0) { return null; } try { ComponentChronicleBI<?> componentChronicle = getComponentChronicle(nid); Optional<? extends ComponentVersionBI> componentVersion = componentChronicle.getVersion(vc); if (!componentVersion.isPresent() componentVersion.get().getUuidList().size() == 0) { return null; } else { return componentVersion.get(); } } catch (ContradictionException e) { LOG.error(STR + nid + STR + e.getClass().getName() + " " + e.getLocalizedMessage(), e); return null; } }
/** * Get the ComponentVersionBI identified by NID on the ViewCoordinate configured by {@link #getViewCoordinate()} but * only if the Component exists at that point. Returns null otherwise. */
Get the ComponentVersionBI identified by NID on the ViewCoordinate configured by <code>#getViewCoordinate()</code> but only if the Component exists at that point. Returns null otherwise
getComponentVersion
{ "repo_name": "Apelon-VA/va-isaac-gui", "path": "otf-util/src/main/java/gov/va/isaac/util/OTFUtility.java", "license": "apache-2.0", "size": 26835 }
[ "java.util.Optional", "org.ihtsdo.otf.tcc.api.chronicle.ComponentChronicleBI", "org.ihtsdo.otf.tcc.api.chronicle.ComponentVersionBI", "org.ihtsdo.otf.tcc.api.contradiction.ContradictionException", "org.ihtsdo.otf.tcc.api.coordinate.ViewCoordinate" ]
import java.util.Optional; import org.ihtsdo.otf.tcc.api.chronicle.ComponentChronicleBI; import org.ihtsdo.otf.tcc.api.chronicle.ComponentVersionBI; import org.ihtsdo.otf.tcc.api.contradiction.ContradictionException; import org.ihtsdo.otf.tcc.api.coordinate.ViewCoordinate;
import java.util.*; import org.ihtsdo.otf.tcc.api.chronicle.*; import org.ihtsdo.otf.tcc.api.contradiction.*; import org.ihtsdo.otf.tcc.api.coordinate.*;
[ "java.util", "org.ihtsdo.otf" ]
java.util; org.ihtsdo.otf;
1,025,769
@Override public void parseExit(SpanObject span, SegmentObject segmentObject) { if (span.getSkipAnalysis()) { return; } SourceBuilder sourceBuilder = new SourceBuilder(namingControl); final String networkAddress = span.getPeer(); if (StringUtil.isEmpty(networkAddress)) { return; } sourceBuilder.setSourceServiceName(segmentObject.getService()); sourceBuilder.setSourceNodeType(NodeType.Normal); sourceBuilder.setSourceServiceInstanceName(segmentObject.getServiceInstance()); final NetworkAddressAlias networkAddressAlias = networkAddressAliasCache.get(networkAddress); if (networkAddressAlias == null) { sourceBuilder.setDestServiceName(networkAddress); sourceBuilder.setDestServiceInstanceName(networkAddress); sourceBuilder.setDestNodeType(NodeType.fromSpanLayerValue(span.getSpanLayer())); } else { final IDManager.ServiceID.ServiceIDDefinition serviceIDDefinition = IDManager.ServiceID.analysisId( networkAddressAlias.getRepresentServiceId()); final IDManager.ServiceInstanceID.InstanceIDDefinition instanceIDDefinition = IDManager.ServiceInstanceID .analysisId( networkAddressAlias.getRepresentServiceInstanceId()); sourceBuilder.setDestServiceName(serviceIDDefinition.getName()); if (!config.shouldIgnorePeerIPDue2Virtual(span.getComponentId())) { sourceBuilder.setDestServiceInstanceName(instanceIDDefinition.getName()); } sourceBuilder.setDestNodeType(NodeType.Normal); } sourceBuilder.setDetectPoint(DetectPoint.CLIENT); sourceBuilder.setComponentId(span.getComponentId()); setPublicAttrs(sourceBuilder, span); exitSourceBuilders.add(sourceBuilder); if (RequestType.DATABASE.equals(sourceBuilder.getType())) { boolean isSlowDBAccess = false; DatabaseSlowStatementBuilder slowStatementBuilder = new DatabaseSlowStatementBuilder(namingControl); slowStatementBuilder.setServiceName(networkAddress); slowStatementBuilder.setId(segmentObject.getTraceSegmentId() + "-" + span.getSpanId()); slowStatementBuilder.setLatency(sourceBuilder.getLatency()); slowStatementBuilder.setTimeBucket(TimeBucket.getRecordTimeBucket(span.getStartTime())); slowStatementBuilder.setTraceId(segmentObject.getTraceId()); for (KeyStringValuePair tag : span.getTagsList()) { if (SpanTags.DB_STATEMENT.equals(tag.getKey())) { String sqlStatement = tag.getValue(); if (StringUtil.isNotEmpty(sqlStatement)) { if (sqlStatement.length() > config.getMaxSlowSQLLength()) { slowStatementBuilder.setStatement(sqlStatement.substring(0, config.getMaxSlowSQLLength())); } else { slowStatementBuilder.setStatement(sqlStatement); } } } else if (SpanTags.DB_TYPE.equals(tag.getKey())) { String dbType = tag.getValue(); DBLatencyThresholdsAndWatcher thresholds = config.getDbLatencyThresholdsAndWatcher(); int threshold = thresholds.getThreshold(dbType); if (sourceBuilder.getLatency() > threshold) { isSlowDBAccess = true; } } } if (StringUtil.isEmpty(slowStatementBuilder.getStatement())) { String statement = StringUtil.isEmpty( span.getOperationName()) ? "[No statement]" : "[No statement]/" + span.getOperationName(); slowStatementBuilder.setStatement(statement); } if (isSlowDBAccess) { dbSlowStatementBuilders.add(slowStatementBuilder); } } }
void function(SpanObject span, SegmentObject segmentObject) { if (span.getSkipAnalysis()) { return; } SourceBuilder sourceBuilder = new SourceBuilder(namingControl); final String networkAddress = span.getPeer(); if (StringUtil.isEmpty(networkAddress)) { return; } sourceBuilder.setSourceServiceName(segmentObject.getService()); sourceBuilder.setSourceNodeType(NodeType.Normal); sourceBuilder.setSourceServiceInstanceName(segmentObject.getServiceInstance()); final NetworkAddressAlias networkAddressAlias = networkAddressAliasCache.get(networkAddress); if (networkAddressAlias == null) { sourceBuilder.setDestServiceName(networkAddress); sourceBuilder.setDestServiceInstanceName(networkAddress); sourceBuilder.setDestNodeType(NodeType.fromSpanLayerValue(span.getSpanLayer())); } else { final IDManager.ServiceID.ServiceIDDefinition serviceIDDefinition = IDManager.ServiceID.analysisId( networkAddressAlias.getRepresentServiceId()); final IDManager.ServiceInstanceID.InstanceIDDefinition instanceIDDefinition = IDManager.ServiceInstanceID .analysisId( networkAddressAlias.getRepresentServiceInstanceId()); sourceBuilder.setDestServiceName(serviceIDDefinition.getName()); if (!config.shouldIgnorePeerIPDue2Virtual(span.getComponentId())) { sourceBuilder.setDestServiceInstanceName(instanceIDDefinition.getName()); } sourceBuilder.setDestNodeType(NodeType.Normal); } sourceBuilder.setDetectPoint(DetectPoint.CLIENT); sourceBuilder.setComponentId(span.getComponentId()); setPublicAttrs(sourceBuilder, span); exitSourceBuilders.add(sourceBuilder); if (RequestType.DATABASE.equals(sourceBuilder.getType())) { boolean isSlowDBAccess = false; DatabaseSlowStatementBuilder slowStatementBuilder = new DatabaseSlowStatementBuilder(namingControl); slowStatementBuilder.setServiceName(networkAddress); slowStatementBuilder.setId(segmentObject.getTraceSegmentId() + "-" + span.getSpanId()); slowStatementBuilder.setLatency(sourceBuilder.getLatency()); slowStatementBuilder.setTimeBucket(TimeBucket.getRecordTimeBucket(span.getStartTime())); slowStatementBuilder.setTraceId(segmentObject.getTraceId()); for (KeyStringValuePair tag : span.getTagsList()) { if (SpanTags.DB_STATEMENT.equals(tag.getKey())) { String sqlStatement = tag.getValue(); if (StringUtil.isNotEmpty(sqlStatement)) { if (sqlStatement.length() > config.getMaxSlowSQLLength()) { slowStatementBuilder.setStatement(sqlStatement.substring(0, config.getMaxSlowSQLLength())); } else { slowStatementBuilder.setStatement(sqlStatement); } } } else if (SpanTags.DB_TYPE.equals(tag.getKey())) { String dbType = tag.getValue(); DBLatencyThresholdsAndWatcher thresholds = config.getDbLatencyThresholdsAndWatcher(); int threshold = thresholds.getThreshold(dbType); if (sourceBuilder.getLatency() > threshold) { isSlowDBAccess = true; } } } if (StringUtil.isEmpty(slowStatementBuilder.getStatement())) { String statement = StringUtil.isEmpty( span.getOperationName()) ? STR : STR + span.getOperationName(); slowStatementBuilder.setStatement(statement); } if (isSlowDBAccess) { dbSlowStatementBuilders.add(slowStatementBuilder); } } }
/** * The exit span should be transferred to the service, instance and relationships from the client side detect * point. */
The exit span should be transferred to the service, instance and relationships from the client side detect point
parseExit
{ "repo_name": "OpenSkywalking/skywalking", "path": "oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/MultiScopesAnalysisListener.java", "license": "apache-2.0", "size": 20476 }
[ "org.apache.skywalking.apm.network.common.v3.KeyStringValuePair", "org.apache.skywalking.apm.network.language.agent.v3.SegmentObject", "org.apache.skywalking.apm.network.language.agent.v3.SpanObject", "org.apache.skywalking.oap.server.analyzer.provider.trace.DBLatencyThresholdsAndWatcher", "org.apache.skywalking.oap.server.analyzer.provider.trace.parser.SpanTags", "org.apache.skywalking.oap.server.core.analysis.IDManager", "org.apache.skywalking.oap.server.core.analysis.NodeType", "org.apache.skywalking.oap.server.core.analysis.TimeBucket", "org.apache.skywalking.oap.server.core.analysis.manual.networkalias.NetworkAddressAlias", "org.apache.skywalking.oap.server.core.source.DetectPoint", "org.apache.skywalking.oap.server.core.source.RequestType", "org.apache.skywalking.oap.server.library.util.StringUtil" ]
import org.apache.skywalking.apm.network.common.v3.KeyStringValuePair; import org.apache.skywalking.apm.network.language.agent.v3.SegmentObject; import org.apache.skywalking.apm.network.language.agent.v3.SpanObject; import org.apache.skywalking.oap.server.analyzer.provider.trace.DBLatencyThresholdsAndWatcher; import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.SpanTags; import org.apache.skywalking.oap.server.core.analysis.IDManager; import org.apache.skywalking.oap.server.core.analysis.NodeType; import org.apache.skywalking.oap.server.core.analysis.TimeBucket; import org.apache.skywalking.oap.server.core.analysis.manual.networkalias.NetworkAddressAlias; import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.core.source.RequestType; import org.apache.skywalking.oap.server.library.util.StringUtil;
import org.apache.skywalking.apm.network.common.v3.*; import org.apache.skywalking.apm.network.language.agent.v3.*; import org.apache.skywalking.oap.server.analyzer.provider.trace.*; import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.*; import org.apache.skywalking.oap.server.core.analysis.*; import org.apache.skywalking.oap.server.core.analysis.manual.networkalias.*; import org.apache.skywalking.oap.server.core.source.*; import org.apache.skywalking.oap.server.library.util.*;
[ "org.apache.skywalking" ]
org.apache.skywalking;
848,500
@Override public IFraction add(IFraction other) { if (isZero()) { return other; } if (other instanceof BigFractionSym) { return ((BigFractionSym) other).add(this); } else { FractionSym fs = (FractionSym) other; if (fs.fNumerator == 0) { return this; } if (fDenominator == fs.fDenominator) { return valueOf((long) fNumerator + fs.fNumerator, fDenominator); } int gcd = ArithmeticUtils.gcd(fDenominator, fs.fDenominator); if (gcd == 1) { long denomgcd = fDenominator; long otherdenomgcd = fs.fDenominator; long newdenom = denomgcd * otherdenomgcd; long newnum = otherdenomgcd * fNumerator + (long) fDenominator * (long) fs.fNumerator; return valueOf(newnum, newdenom); } long denomgcd = ((long) fDenominator) / gcd; long otherdenomgcd = ((long) fs.fDenominator) / gcd; long newdenom = denomgcd * fs.fDenominator; long newnum = otherdenomgcd * fNumerator + denomgcd * fs.fNumerator; return valueOf(newnum, newdenom); } }
IFraction function(IFraction other) { if (isZero()) { return other; } if (other instanceof BigFractionSym) { return ((BigFractionSym) other).add(this); } else { FractionSym fs = (FractionSym) other; if (fs.fNumerator == 0) { return this; } if (fDenominator == fs.fDenominator) { return valueOf((long) fNumerator + fs.fNumerator, fDenominator); } int gcd = ArithmeticUtils.gcd(fDenominator, fs.fDenominator); if (gcd == 1) { long denomgcd = fDenominator; long otherdenomgcd = fs.fDenominator; long newdenom = denomgcd * otherdenomgcd; long newnum = otherdenomgcd * fNumerator + (long) fDenominator * (long) fs.fNumerator; return valueOf(newnum, newdenom); } long denomgcd = ((long) fDenominator) / gcd; long otherdenomgcd = ((long) fs.fDenominator) / gcd; long newdenom = denomgcd * fs.fDenominator; long newnum = otherdenomgcd * fNumerator + denomgcd * fs.fNumerator; return valueOf(newnum, newdenom); } }
/** * Return a new rational representing <code>this + other</code>. * * @param other Rational to add. * @return Sum of <code>this</code> and <code>other</code>. */
Return a new rational representing <code>this + other</code>
add
{ "repo_name": "axkr/symja_android_library", "path": "symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/FractionSym.java", "license": "gpl-3.0", "size": 19007 }
[ "org.hipparchus.util.ArithmeticUtils", "org.matheclipse.core.interfaces.IFraction" ]
import org.hipparchus.util.ArithmeticUtils; import org.matheclipse.core.interfaces.IFraction;
import org.hipparchus.util.*; import org.matheclipse.core.interfaces.*;
[ "org.hipparchus.util", "org.matheclipse.core" ]
org.hipparchus.util; org.matheclipse.core;
484,938
Gson gson = new GsonBuilder().create(); String json = gson.toJson(incident); StringEntity stringEntity = new StringEntity(json, ContentType.APPLICATION_OCTET_STREAM.withCharset(StandardCharsets.UTF_8)); HttpEntity entity = new GzipCompressingEntity(stringEntity); URI target = null; try { target = new URI(uri); } catch (URISyntaxException e) { throw new IOException("Bad URI", e); } Request request = Request.Post(target) .body(entity) .connectTimeout(CONNECTION_TIMEOUT_MS) .staleConnectionCheck(true) .socketTimeout(CONNECTION_TIMEOUT_MS); return Executor.newInstance().execute(request).returnContent().asString(); }
Gson gson = new GsonBuilder().create(); String json = gson.toJson(incident); StringEntity stringEntity = new StringEntity(json, ContentType.APPLICATION_OCTET_STREAM.withCharset(StandardCharsets.UTF_8)); HttpEntity entity = new GzipCompressingEntity(stringEntity); URI target = null; try { target = new URI(uri); } catch (URISyntaxException e) { throw new IOException(STR, e); } Request request = Request.Post(target) .body(entity) .connectTimeout(CONNECTION_TIMEOUT_MS) .staleConnectionCheck(true) .socketTimeout(CONNECTION_TIMEOUT_MS); return Executor.newInstance().execute(request).returnContent().asString(); }
/** * Sends an incident to the given URI, compressed as {@link GzipCompressingEntity}. Returns the server response as * string or throws an exception if anything goes wrong. */
Sends an incident to the given URI, compressed as <code>GzipCompressingEntity</code>. Returns the server response as string or throws an exception if anything goes wrong
send
{ "repo_name": "codetrails/ctrlflow-aer-client", "path": "bundles/com.ctrlflow.aer.client.simple/src/main/java/com/ctrlflow/aer/client/simple/SimpleAerClient.java", "license": "epl-1.0", "size": 1737 }
[ "com.google.gson.Gson", "com.google.gson.GsonBuilder", "java.io.IOException", "java.net.URISyntaxException", "java.nio.charset.StandardCharsets", "org.apache.http.HttpEntity", "org.apache.http.client.entity.GzipCompressingEntity", "org.apache.http.client.fluent.Executor", "org.apache.http.client.fluent.Request", "org.apache.http.entity.ContentType", "org.apache.http.entity.StringEntity" ]
import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.IOException; import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; import org.apache.http.HttpEntity; import org.apache.http.client.entity.GzipCompressingEntity; import org.apache.http.client.fluent.Executor; import org.apache.http.client.fluent.Request; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity;
import com.google.gson.*; import java.io.*; import java.net.*; import java.nio.charset.*; import org.apache.http.*; import org.apache.http.client.entity.*; import org.apache.http.client.fluent.*; import org.apache.http.entity.*;
[ "com.google.gson", "java.io", "java.net", "java.nio", "org.apache.http" ]
com.google.gson; java.io; java.net; java.nio; org.apache.http;
2,904,608
@Test public void testUpdateDoesntChangeExternalId() { DbGroup groupBefore = dao.get(existingGroup.getId()); dao.update(groupBefore); DbGroup groupAfter = dao.get(existingGroup.getId()); assertEquals(groupBefore.getExternalId(), groupAfter.getExternalId()); }
void function() { DbGroup groupBefore = dao.get(existingGroup.getId()); dao.update(groupBefore); DbGroup groupAfter = dao.get(existingGroup.getId()); assertEquals(groupBefore.getExternalId(), groupAfter.getExternalId()); }
/** * Ensures that update cycle doesn't change the external identifier. */
Ensures that update cycle doesn't change the external identifier
testUpdateDoesntChangeExternalId
{ "repo_name": "jtux270/translate", "path": "ovirt/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbGroupDAOTest.java", "license": "gpl-3.0", "size": 4892 }
[ "org.junit.Assert", "org.ovirt.engine.core.common.businessentities.aaa.DbGroup" ]
import org.junit.Assert; import org.ovirt.engine.core.common.businessentities.aaa.DbGroup;
import org.junit.*; import org.ovirt.engine.core.common.businessentities.aaa.*;
[ "org.junit", "org.ovirt.engine" ]
org.junit; org.ovirt.engine;
2,690,345
public Event next() throws IOException;
Event function() throws IOException;
/** * Returns the next Event object held in this EventStream. * * @return the Event object which is next in this EventStream */
Returns the next Event object held in this EventStream
next
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/opennlp/opennlp-tools/src/main/java/opennlp/tools/ml/model/EventStream.java", "license": "apache-2.0", "size": 1609 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
601,895
protected void checkParams(X509Credential untrustedCredential, CriteriaSet trustBasisCriteria) throws SecurityException { if (untrustedCredential == null) { throw new SecurityException("Untrusted credential was null"); } if (trustBasisCriteria == null) { throw new SecurityException("Trust basis criteria set was null"); } if (trustBasisCriteria.isEmpty()) { throw new SecurityException("Trust basis criteria set was empty"); } }
void function(X509Credential untrustedCredential, CriteriaSet trustBasisCriteria) throws SecurityException { if (untrustedCredential == null) { throw new SecurityException(STR); } if (trustBasisCriteria == null) { throw new SecurityException(STR); } if (trustBasisCriteria.isEmpty()) { throw new SecurityException(STR); } }
/** * Check the parameters for required values. * * @param untrustedCredential the signature to be evaluated * @param trustBasisCriteria the set of trusted credential criteria * @throws SecurityException thrown if required values are absent or otherwise invalid */
Check the parameters for required values
checkParams
{ "repo_name": "duck1123/java-xmltooling", "path": "src/main/java/org/opensaml/xml/security/trust/ExplicitX509CertificateTrustEngine.java", "license": "apache-2.0", "size": 3728 }
[ "org.opensaml.xml.security.CriteriaSet", "org.opensaml.xml.security.SecurityException", "org.opensaml.xml.security.x509.X509Credential" ]
import org.opensaml.xml.security.CriteriaSet; import org.opensaml.xml.security.SecurityException; import org.opensaml.xml.security.x509.X509Credential;
import org.opensaml.xml.security.*; import org.opensaml.xml.security.x509.*;
[ "org.opensaml.xml" ]
org.opensaml.xml;
2,811,630
@Test public void test5g () { final MetaKey key1 = new MetaKey ( "mock", "5g1" ); final MetaKey key2 = new MetaKey ( "mock", "5g2" ); this.mgr.registerModel ( 1, key1, new MockStorageProvider ( key1.getKey (), "foo" ) ); this.mgr.registerModel ( 2, key2, new MockStorageProvider ( key2.getKey (), "foo" ) ); this.mgr.modifyRun ( key1, MockStorageModel.class, m1 -> { this.mgr.accessRun ( key2, MockStorageViewModel.class, m2 -> { this.mgr.modifyRun ( key1, MockStorageModel.class, m1a -> { m1a.setValue ( "bar" ); } ); } ); } ); this.mgr.accessRun ( key1, MockStorageViewModel.class, m1 -> { assertEquals ( "bar", m1.getValue () ); } ); }
void function () { final MetaKey key1 = new MetaKey ( "mock", "5g1" ); final MetaKey key2 = new MetaKey ( "mock", "5g2" ); this.mgr.registerModel ( 1, key1, new MockStorageProvider ( key1.getKey (), "foo" ) ); this.mgr.registerModel ( 2, key2, new MockStorageProvider ( key2.getKey (), "foo" ) ); this.mgr.modifyRun ( key1, MockStorageModel.class, m1 -> { this.mgr.accessRun ( key2, MockStorageViewModel.class, m2 -> { this.mgr.modifyRun ( key1, MockStorageModel.class, m1a -> { m1a.setValue ( "bar" ); } ); } ); } ); this.mgr.accessRun ( key1, MockStorageViewModel.class, m1 -> { assertEquals ( "bar", m1.getValue () ); } ); }
/** * Re-lock a model and make changes. Only the outer lock should persist. */
Re-lock a model and make changes. Only the outer lock should persist
test5g
{ "repo_name": "ctron/package-drone", "path": "bundles/org.eclipse.packagedrone.storage.apm.tests/src/org/eclipse/packagedrone/storage/apm/BaseTest.java", "license": "epl-1.0", "size": 22200 }
[ "org.eclipse.packagedrone.repo.MetaKey" ]
import org.eclipse.packagedrone.repo.MetaKey;
import org.eclipse.packagedrone.repo.*;
[ "org.eclipse.packagedrone" ]
org.eclipse.packagedrone;
2,180,050
private void addChildNodeDef(QNodeDefinition def) throws NamespaceException { builder.startElement(Constants.CHILDNODEDEFINITION_ELEMENT); // simple attributes builder.setAttribute( Constants.NAME_ATTRIBUTE, resolver.getJCRName(def.getName())); builder.setAttribute( Constants.AUTOCREATED_ATTRIBUTE, def.isAutoCreated()); builder.setAttribute( Constants.MANDATORY_ATTRIBUTE, def.isMandatory()); builder.setAttribute( Constants.PROTECTED_ATTRIBUTE, def.isProtected()); builder.setAttribute( Constants.ONPARENTVERSION_ATTRIBUTE, OnParentVersionAction.nameFromValue(def.getOnParentVersion())); builder.setAttribute( Constants.SAMENAMESIBLINGS_ATTRIBUTE, def.allowsSameNameSiblings()); // default primary type Name type = def.getDefaultPrimaryType(); if (type != null) { builder.setAttribute( Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE, resolver.getJCRName(type)); } else { builder.setAttribute(Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE, ""); } // required primary types Name[] requiredTypes = def.getRequiredPrimaryTypes(); builder.startElement(Constants.REQUIREDPRIMARYTYPES_ELEMENT); for (Name requiredType : requiredTypes) { builder.addContentElement( Constants.REQUIREDPRIMARYTYPE_ELEMENT, resolver.getJCRName(requiredType)); } builder.endElement(); builder.endElement(); }
void function(QNodeDefinition def) throws NamespaceException { builder.startElement(Constants.CHILDNODEDEFINITION_ELEMENT); builder.setAttribute( Constants.NAME_ATTRIBUTE, resolver.getJCRName(def.getName())); builder.setAttribute( Constants.AUTOCREATED_ATTRIBUTE, def.isAutoCreated()); builder.setAttribute( Constants.MANDATORY_ATTRIBUTE, def.isMandatory()); builder.setAttribute( Constants.PROTECTED_ATTRIBUTE, def.isProtected()); builder.setAttribute( Constants.ONPARENTVERSION_ATTRIBUTE, OnParentVersionAction.nameFromValue(def.getOnParentVersion())); builder.setAttribute( Constants.SAMENAMESIBLINGS_ATTRIBUTE, def.allowsSameNameSiblings()); Name type = def.getDefaultPrimaryType(); if (type != null) { builder.setAttribute( Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE, resolver.getJCRName(type)); } else { builder.setAttribute(Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE, ""); } Name[] requiredTypes = def.getRequiredPrimaryTypes(); builder.startElement(Constants.REQUIREDPRIMARYTYPES_ELEMENT); for (Name requiredType : requiredTypes) { builder.addContentElement( Constants.REQUIREDPRIMARYTYPE_ELEMENT, resolver.getJCRName(requiredType)); } builder.endElement(); builder.endElement(); }
/** * Builds a child node definition element under the current element. * * @param def child node definition * @throws NamespaceException if the child node definition contains * invalid namespace references */
Builds a child node definition element under the current element
addChildNodeDef
{ "repo_name": "tripodsan/jackrabbit", "path": "jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java", "license": "apache-2.0", "size": 14150 }
[ "javax.jcr.NamespaceException", "javax.jcr.version.OnParentVersionAction", "org.apache.jackrabbit.spi.Name", "org.apache.jackrabbit.spi.QNodeDefinition" ]
import javax.jcr.NamespaceException; import javax.jcr.version.OnParentVersionAction; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.QNodeDefinition;
import javax.jcr.*; import javax.jcr.version.*; import org.apache.jackrabbit.spi.*;
[ "javax.jcr", "org.apache.jackrabbit" ]
javax.jcr; org.apache.jackrabbit;
2,635,127
public String getCharacterEncoding() { return characterEncoding; } // ---------------------------------------------------------------- constructors public MultipartRequest(HttpServletRequest request, FileUploadFactory fileUploadFactory, String encoding) { super(fileUploadFactory); this.request = request; if (encoding != null) { this.characterEncoding = encoding; } else { this.characterEncoding = request.getCharacterEncoding(); } if (this.characterEncoding == null) { this.characterEncoding = JoddCore.encoding; } } // ---------------------------------------------------------------- factories private static final String MREQ_ATTR_NAME = MultipartRequest.class.getName();
String function() { return characterEncoding; } public MultipartRequest(HttpServletRequest request, FileUploadFactory fileUploadFactory, String encoding) { super(fileUploadFactory); this.request = request; if (encoding != null) { this.characterEncoding = encoding; } else { this.characterEncoding = request.getCharacterEncoding(); } if (this.characterEncoding == null) { this.characterEncoding = JoddCore.encoding; } } private static final String MREQ_ATTR_NAME = MultipartRequest.class.getName();
/** * Returns current encoding. */
Returns current encoding
getCharacterEncoding
{ "repo_name": "wjw465150/jodd", "path": "jodd-servlet/src/main/java/jodd/servlet/upload/MultipartRequest.java", "license": "bsd-2-clause", "size": 6250 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
655,490
public void renderFrame() { double offY = 0; if (cell.isMultiPage()) { offY = pageNo * MULTIPAGESEPARATION; } for (int i = 0; i < lineFromEnd.size(); i++) { Point2D from = lineFromEnd.get(i); Point2D to = lineToEnd.get(i); if (offY != 0) { from = new Point2D.Double(from.getX(), from.getY() + offY); to = new Point2D.Double(to.getX(), to.getY() + offY); } showFrameLine(from, to); } for (int i = 0; i < textPoint.size(); i++) { Point2D at = textPoint.get(i); if (offY != 0) { at = new Point2D.Double(at.getX(), at.getY() + offY); } double size = textSize.get(i).doubleValue(); Point2D box = textBox.get(i); double width = box.getX(); double height = box.getY(); String msg = textMessage.get(i); showFrameText(at, size, width, height, msg); } }
void function() { double offY = 0; if (cell.isMultiPage()) { offY = pageNo * MULTIPAGESEPARATION; } for (int i = 0; i < lineFromEnd.size(); i++) { Point2D from = lineFromEnd.get(i); Point2D to = lineToEnd.get(i); if (offY != 0) { from = new Point2D.Double(from.getX(), from.getY() + offY); to = new Point2D.Double(to.getX(), to.getY() + offY); } showFrameLine(from, to); } for (int i = 0; i < textPoint.size(); i++) { Point2D at = textPoint.get(i); if (offY != 0) { at = new Point2D.Double(at.getX(), at.getY() + offY); } double size = textSize.get(i).doubleValue(); Point2D box = textBox.get(i); double width = box.getX(); double height = box.getY(); String msg = textMessage.get(i); showFrameText(at, size, width, height, msg); } }
/** * Method called to render the frame information. * It makes calls to "renderInit()", "showFrameLine()", and "showFrameText()". */
Method called to render the frame information. It makes calls to "renderInit()", "showFrameLine()", and "showFrameText()"
renderFrame
{ "repo_name": "imr/Electric8", "path": "com/sun/electric/database/hierarchy/Cell.java", "license": "gpl-3.0", "size": 185659 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
475,997
static void runIntentInService(Context context, Intent intent, String className) { synchronized (LOCK) { if (sWakeLock == null) { // This is called from BroadcastReceiver, there is no init. PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); sWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY); } } Log.v(TAG, "Acquiring wakelock"); sWakeLock.acquire(); intent.setClassName(context, className); context.startService(intent); }
static void runIntentInService(Context context, Intent intent, String className) { synchronized (LOCK) { if (sWakeLock == null) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); sWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY); } } Log.v(TAG, STR); sWakeLock.acquire(); intent.setClassName(context, className); context.startService(intent); }
/** * Called from the broadcast receiver. * <p> * Will process the received intent, call handleMessage(), registered(), * etc. in background threads, with a wake lock, while keeping the service * alive. */
Called from the broadcast receiver. Will process the received intent, call handleMessage(), registered(), etc. in background threads, with a wake lock, while keeping the service alive
runIntentInService
{ "repo_name": "shwarzes89/SowonBell", "path": "src/com/google/android/gcm/GCMBaseIntentService.java", "license": "gpl-2.0", "size": 13669 }
[ "android.content.Context", "android.content.Intent", "android.os.PowerManager", "android.util.Log" ]
import android.content.Context; import android.content.Intent; import android.os.PowerManager; import android.util.Log;
import android.content.*; import android.os.*; import android.util.*;
[ "android.content", "android.os", "android.util" ]
android.content; android.os; android.util;
943,272
private void setKeyAndType(Entity entity) { if (entity == null) { int viewRowIndex = table.getSelectedRow(); if (viewRowIndex >= 0) { int modelRowIndex = table.convertRowIndexToModel(viewRowIndex); entity = (Entity) table.getModel().getValueAt(modelRowIndex, ENTITY_COLUMN); type = (String) table.getModel().getValueAt(modelRowIndex, ENTITY_TYPE_COLUMN); } } else { type = ((EntityType) entity.getEntityTypes() .getEntityType().get(0).getEntityType()) .getName(); } key = entity.getUrl(); }
void function(Entity entity) { if (entity == null) { int viewRowIndex = table.getSelectedRow(); if (viewRowIndex >= 0) { int modelRowIndex = table.convertRowIndexToModel(viewRowIndex); entity = (Entity) table.getModel().getValueAt(modelRowIndex, ENTITY_COLUMN); type = (String) table.getModel().getValueAt(modelRowIndex, ENTITY_TYPE_COLUMN); } } else { type = ((EntityType) entity.getEntityTypes() .getEntityType().get(0).getEntityType()) .getName(); } key = entity.getUrl(); }
/** * Sets the key and type using the current selected entity. * * @param e * the entity. If null uses the current selected entity */
Sets the key and type using the current selected entity
setKeyAndType
{ "repo_name": "ajenhl/eats", "path": "client/java/lookup/src/uk/ac/kcl/cch/eats/lookup/LookupController.java", "license": "gpl-3.0", "size": 27508 }
[ "uk.ac.kcl.cch.eats.eatsml.Collection", "uk.ac.kcl.cch.eats.eatsml.Entity" ]
import uk.ac.kcl.cch.eats.eatsml.Collection; import uk.ac.kcl.cch.eats.eatsml.Entity;
import uk.ac.kcl.cch.eats.eatsml.*;
[ "uk.ac.kcl" ]
uk.ac.kcl;
2,122,635
@Test public void nodeUniqueIdWithDeletions() { final MembershipView mview = new MembershipView(K); final Endpoint n1 = Utils.hostFromParts("127.0.0.1", 1); final NodeId id1 = Utils.nodeIdFromUUID(UUID.randomUUID()); mview.ringAdd(n1, id1); final Endpoint n2 = Utils.hostFromParts("127.0.0.1", 2); final NodeId id2 = Utils.nodeIdFromUUID(UUID.randomUUID()); // Same host, same ID mview.ringAdd(n2, id2); // Node is removed from the ring mview.ringDelete(n2); assertEquals(1, mview.getRing(0).size()); int numExceptions = 0; // Node rejoins with id2 try { mview.ringAdd(n2, id2); } catch (final MembershipView.UUIDAlreadySeenException e) { numExceptions++; } assertEquals(1, numExceptions); // Re-attempt with new ID mview.ringAdd(n2, Utils.nodeIdFromUUID(UUID.randomUUID())); assertEquals(2, mview.getRing(0).size()); }
void function() { final MembershipView mview = new MembershipView(K); final Endpoint n1 = Utils.hostFromParts(STR, 1); final NodeId id1 = Utils.nodeIdFromUUID(UUID.randomUUID()); mview.ringAdd(n1, id1); final Endpoint n2 = Utils.hostFromParts(STR, 2); final NodeId id2 = Utils.nodeIdFromUUID(UUID.randomUUID()); mview.ringAdd(n2, id2); mview.ringDelete(n2); assertEquals(1, mview.getRing(0).size()); int numExceptions = 0; try { mview.ringAdd(n2, id2); } catch (final MembershipView.UUIDAlreadySeenException e) { numExceptions++; } assertEquals(1, numExceptions); mview.ringAdd(n2, Utils.nodeIdFromUUID(UUID.randomUUID())); assertEquals(2, mview.getRing(0).size()); }
/** * Test for different combinations of a host and unique ID * after it was removed */
Test for different combinations of a host and unique ID after it was removed
nodeUniqueIdWithDeletions
{ "repo_name": "lalithsuresh/rapid", "path": "rapid/src/test/java/com/vrg/rapid/MembershipViewTest.java", "license": "apache-2.0", "size": 17874 }
[ "com.vrg.rapid.pb.Endpoint", "com.vrg.rapid.pb.NodeId", "java.util.UUID", "org.junit.Assert" ]
import com.vrg.rapid.pb.Endpoint; import com.vrg.rapid.pb.NodeId; import java.util.UUID; import org.junit.Assert;
import com.vrg.rapid.pb.*; import java.util.*; import org.junit.*;
[ "com.vrg.rapid", "java.util", "org.junit" ]
com.vrg.rapid; java.util; org.junit;
111,162
void removeAllAttributes(PerunSession sess, UserExtSource ues) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException;
void removeAllAttributes(PerunSession sess, UserExtSource ues) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException;
/** * Unset all attributes for the user external source. * * @param sess perun session * @param ues remove attributes from this user external source * * @throws InternalErrorException if an exception raise in concrete implementation, the exception is wrapped in InternalErrorException */
Unset all attributes for the user external source
removeAllAttributes
{ "repo_name": "jirmauritz/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/AttributesManagerBl.java", "license": "bsd-2-clause", "size": 193360 }
[ "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.UserExtSource", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException", "cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException" ]
import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.UserExtSource; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException; import cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
1,296,669
public BigInteger bigIntegerValue() { return BigInteger.valueOf(longValue()); }
BigInteger function() { return BigInteger.valueOf(longValue()); }
/** * Returns the value of this {@code UnsignedInteger} as a {@link BigInteger}. */
Returns the value of this UnsignedInteger as a <code>BigInteger</code>
bigIntegerValue
{ "repo_name": "wolffcm/voltdb", "path": "third_party/java/src/com/google_voltpatches/common/primitives/UnsignedInteger.java", "license": "agpl-3.0", "size": 8699 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
267,723
public Image getImage( String location ) { return getImage( location, ConstUI.SMALL_ICON_SIZE, ConstUI.SMALL_ICON_SIZE ); }
Image function( String location ) { return getImage( location, ConstUI.SMALL_ICON_SIZE, ConstUI.SMALL_ICON_SIZE ); }
/** * Loads an image from a location once. The second time, the image comes from a cache. Because of this, it's important * to never dispose of the image you get from here. (easy!) The images are automatically disposed when the application * ends. * * @param location the location of the image resource to load * @return the loaded image */
Loads an image from a location once. The second time, the image comes from a cache. Because of this, it's important to never dispose of the image you get from here. (easy!) The images are automatically disposed when the application ends
getImage
{ "repo_name": "IvanNikolaychuk/pentaho-kettle", "path": "ui/src/org/pentaho/di/ui/core/gui/GUIResource.java", "license": "apache-2.0", "size": 73191 }
[ "org.eclipse.swt.graphics.Image", "org.pentaho.di.ui.core.ConstUI" ]
import org.eclipse.swt.graphics.Image; import org.pentaho.di.ui.core.ConstUI;
import org.eclipse.swt.graphics.*; import org.pentaho.di.ui.core.*;
[ "org.eclipse.swt", "org.pentaho.di" ]
org.eclipse.swt; org.pentaho.di;
2,190,880
EList<ThoroughfareNumberSuffixType> getThoroughfareNumberSuffix();
EList<ThoroughfareNumberSuffixType> getThoroughfareNumberSuffix();
/** * Returns the value of the '<em><b>Thoroughfare Number Suffix</b></em>' containment reference list. * The list contents are of type {@link org.oasis.xAL.ThoroughfareNumberSuffixType}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Suffix after the number. A in 12A Archer Street * <!-- end-model-doc --> * @return the value of the '<em>Thoroughfare Number Suffix</em>' containment reference list. * @see org.oasis.xAL.XALPackage#getThoroughfareNumberFromType_ThoroughfareNumberSuffix() * @model containment="true" transient="true" volatile="true" derived="true" * extendedMetaData="kind='element' name='ThoroughfareNumberSuffix' namespace='##targetNamespace'" * @generated */
Returns the value of the 'Thoroughfare Number Suffix' containment reference list. The list contents are of type <code>org.oasis.xAL.ThoroughfareNumberSuffixType</code>. Suffix after the number. A in 12A Archer Street
getThoroughfareNumberSuffix
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore/src/org/oasis/xAL/ThoroughfareNumberFromType.java", "license": "apache-2.0", "size": 6976 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,219,314
@SuppressLint({ "AddJavascriptInterface", "SetJavaScriptEnabled" }) protected WebView createWebView() { WebView webView = new WebView(context); //webView.addJavascriptInterface(new JsApi(), "promoApi"); webView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); webView.setScrollbarFadingEnabled(true); webView.setWebViewClient(new PromoWebViewClient()); webView.setWebChromeClient(new PromoWebChromeClient()); webView.setVisibility(View.INVISIBLE); webView.setBackgroundColor(0); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); }
@SuppressLint({ STR, STR }) WebView function() { WebView webView = new WebView(context); webView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); webView.setScrollbarFadingEnabled(true); webView.setWebViewClient(new PromoWebViewClient()); webView.setWebChromeClient(new PromoWebChromeClient()); webView.setVisibility(View.INVISIBLE); webView.setBackgroundColor(0); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); }
/** * Creates a WebView * @return Nothing because it's disabled */
Creates a WebView
createWebView
{ "repo_name": "FonsecaUniba/progettoMMQS", "path": "src/main/java/zame/promo/PromoView.java", "license": "mit", "size": 16457 }
[ "android.annotation.SuppressLint", "android.os.Build", "android.view.View", "android.webkit.WebView" ]
import android.annotation.SuppressLint; import android.os.Build; import android.view.View; import android.webkit.WebView;
import android.annotation.*; import android.os.*; import android.view.*; import android.webkit.*;
[ "android.annotation", "android.os", "android.view", "android.webkit" ]
android.annotation; android.os; android.view; android.webkit;
2,652,636
public Optional<UniformPath> getWorkingDirectory() { return workingDir; }
Optional<UniformPath> function() { return workingDir; }
/** * Returns this context's working directory. If the returned * {@code Optional} is not present, this context uses the system-dependent * default working directory. */
Returns this context's working directory. If the returned Optional is not present, this context uses the system-dependent default working directory
getWorkingDirectory
{ "repo_name": "afchang/giraffe-circle", "path": "core/src/main/java/com/palantir/giraffe/command/CommandContext.java", "license": "apache-2.0", "size": 10413 }
[ "com.google.common.base.Optional", "com.palantir.giraffe.file.UniformPath" ]
import com.google.common.base.Optional; import com.palantir.giraffe.file.UniformPath;
import com.google.common.base.*; import com.palantir.giraffe.file.*;
[ "com.google.common", "com.palantir.giraffe" ]
com.google.common; com.palantir.giraffe;
1,893,344
public void getData() { int i; if(log.isDebug()) logDebug(BaseMessages.getString(PKG, "AnalyticQueryDialog.Log.GettingKeyInfo")); //$NON-NLS-1$ if (input.getGroupField()!=null) for (i=0;i<input.getGroupField().length;i++) { TableItem item = wGroup.table.getItem(i); if (input.getGroupField()[i] !=null) item.setText(1, input.getGroupField()[i]); } if (input.getAggregateField()!=null) for (i=0;i<input.getAggregateField().length;i++) { TableItem item = wAgg.table.getItem(i); if (input.getAggregateField()[i]!=null ) item.setText(1, input.getAggregateField()[i]); if (input.getSubjectField()[i]!=null ) item.setText(2, input.getSubjectField()[i]); item.setText(3, AnalyticQueryMeta.getTypeDescLong(input.getAggregateType()[i])); int value = input.getValueField()[i]; String valuetext = Integer.toString(value); if (valuetext != null ){ item.setText(4, valuetext); } } wStepname.selectAll(); wGroup.setRowNums(); wGroup.optWidth(true); wAgg.setRowNums(); wAgg.optWidth(true); }
void function() { int i; if(log.isDebug()) logDebug(BaseMessages.getString(PKG, STR)); if (input.getGroupField()!=null) for (i=0;i<input.getGroupField().length;i++) { TableItem item = wGroup.table.getItem(i); if (input.getGroupField()[i] !=null) item.setText(1, input.getGroupField()[i]); } if (input.getAggregateField()!=null) for (i=0;i<input.getAggregateField().length;i++) { TableItem item = wAgg.table.getItem(i); if (input.getAggregateField()[i]!=null ) item.setText(1, input.getAggregateField()[i]); if (input.getSubjectField()[i]!=null ) item.setText(2, input.getSubjectField()[i]); item.setText(3, AnalyticQueryMeta.getTypeDescLong(input.getAggregateType()[i])); int value = input.getValueField()[i]; String valuetext = Integer.toString(value); if (valuetext != null ){ item.setText(4, valuetext); } } wStepname.selectAll(); wGroup.setRowNums(); wGroup.optWidth(true); wAgg.setRowNums(); wAgg.optWidth(true); }
/** * Copy information from the meta-data input to the dialog fields. */
Copy information from the meta-data input to the dialog fields
getData
{ "repo_name": "juanmjacobs/kettle", "path": "src-ui/org/pentaho/di/ui/trans/steps/analyticquery/AnalyticQueryDialog.java", "license": "lgpl-2.1", "size": 16125 }
[ "org.eclipse.swt.widgets.TableItem", "org.pentaho.di.i18n.BaseMessages", "org.pentaho.di.trans.steps.analyticquery.AnalyticQueryMeta" ]
import org.eclipse.swt.widgets.TableItem; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.trans.steps.analyticquery.AnalyticQueryMeta;
import org.eclipse.swt.widgets.*; import org.pentaho.di.i18n.*; import org.pentaho.di.trans.steps.analyticquery.*;
[ "org.eclipse.swt", "org.pentaho.di" ]
org.eclipse.swt; org.pentaho.di;
1,739,656
private boolean isRootGroup( final ProcessState state ) { return state.getCurrentGroupIndex() == ReportState.BEFORE_FIRST_GROUP; }
boolean function( final ProcessState state ) { return state.getCurrentGroupIndex() == ReportState.BEFORE_FIRST_GROUP; }
/** * Checks whether there are more groups active. * * @return true if this is the last (outer-most) group. */
Checks whether there are more groups active
isRootGroup
{ "repo_name": "EgorZhuk/pentaho-reporting", "path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/states/process/PrintSummaryJoinEndCrosstabColumnAxisHandler.java", "license": "lgpl-2.1", "size": 5002 }
[ "org.pentaho.reporting.engine.classic.core.states.ReportState" ]
import org.pentaho.reporting.engine.classic.core.states.ReportState;
import org.pentaho.reporting.engine.classic.core.states.*;
[ "org.pentaho.reporting" ]
org.pentaho.reporting;
123,805
List<AttributeDefinition> getAttributesDefinitionByNamespace(PerunSession sess, String namespace) throws InternalErrorException;
List<AttributeDefinition> getAttributesDefinitionByNamespace(PerunSession sess, String namespace) throws InternalErrorException;
/** * Get attributes definition (attribute without defined value) with specified namespace. * * @param namespace get only attributes with this namespace * @return List of attributes * * @throws InternalErrorException if an exception raise in concrete implementation, the exception is wrapped in InternalErrorException */
Get attributes definition (attribute without defined value) with specified namespace
getAttributesDefinitionByNamespace
{ "repo_name": "Simcsa/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/AttributesManagerImplApi.java", "license": "bsd-2-clause", "size": 98325 }
[ "cz.metacentrum.perun.core.api.AttributeDefinition", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "java.util.List" ]
import cz.metacentrum.perun.core.api.AttributeDefinition; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.List;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
2,424,606
protected double getEclipse(Calendar cal, double type, double midnightJd, int mode) { double tz = 0; double eclipseJd = 0; do { double k = var_k(cal, tz); tz += 1; eclipseJd = getEclipse(k, type, mode); } while (eclipseJd <= midnightJd); return eclipseJd; }
double function(Calendar cal, double type, double midnightJd, int mode) { double tz = 0; double eclipseJd = 0; do { double k = var_k(cal, tz); tz += 1; eclipseJd = getEclipse(k, type, mode); } while (eclipseJd <= midnightJd); return eclipseJd; }
/** * Calculates the next eclipse. */
Calculates the next eclipse
getEclipse
{ "repo_name": "AchimHentschel/smarthome", "path": "extensions/binding/org.eclipse.smarthome.binding.astro/src/main/java/org/eclipse/smarthome/binding/astro/internal/calc/MoonCalc.java", "license": "epl-1.0", "size": 38163 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
30,704
super.onCreate(savedInstanceState); setContentView(R.layout.select_artist); if ("Madsonic Flawless".equals(theme) || "Madsonic Flawless Fullscreen".equals(theme)) { mainBar = findViewById(R.id.button_bar); mainBar.setBackgroundResource(R.drawable.menubar_button_normal_green); } String theme = Util.getTheme(getBaseContext()); if ("Madsonic Pink".equals(theme) || "Madsonic Pink Fullscreen".equals(theme)) { mainBar = findViewById(R.id.button_bar); mainBar.setBackgroundResource(R.drawable.menubar_button_normal_pink); } if ("Madsonic Light".equals(theme) || "Madsonic Light Fullscreen".equals(theme)) { mainBar = findViewById(R.id.button_bar); mainBar.setBackgroundResource(R.drawable.menubar_button_light); } Util.changeLanguage(getBaseContext()); artistList = (ListView) findViewById(R.id.select_artist_list); artistList.setOnItemClickListener(this); folderButton = LayoutInflater.from(this).inflate(R.layout.select_artist_header, artistList, false); folderName = (TextView) folderButton.findViewById(R.id.select_artist_folder_2); if (!Util.isOffline(this)) { artistList.addHeaderView(folderButton); } registerForContextMenu(artistList); setTitle(Util.isOffline(this) ? R.string.music_library_label_offline : R.string.music_library_label);
super.onCreate(savedInstanceState); setContentView(R.layout.select_artist); if (STR.equals(theme) STR.equals(theme)) { mainBar = findViewById(R.id.button_bar); mainBar.setBackgroundResource(R.drawable.menubar_button_normal_green); } String theme = Util.getTheme(getBaseContext()); if (STR.equals(theme) STR.equals(theme)) { mainBar = findViewById(R.id.button_bar); mainBar.setBackgroundResource(R.drawable.menubar_button_normal_pink); } if (STR.equals(theme) STR.equals(theme)) { mainBar = findViewById(R.id.button_bar); mainBar.setBackgroundResource(R.drawable.menubar_button_light); } Util.changeLanguage(getBaseContext()); artistList = (ListView) findViewById(R.id.select_artist_list); artistList.setOnItemClickListener(this); folderButton = LayoutInflater.from(this).inflate(R.layout.select_artist_header, artistList, false); folderName = (TextView) folderButton.findViewById(R.id.select_artist_folder_2); if (!Util.isOffline(this)) { artistList.addHeaderView(folderButton); } registerForContextMenu(artistList); setTitle(Util.isOffline(this) ? R.string.music_library_label_offline : R.string.music_library_label);
/** * Called when the activity is first created. */
Called when the activity is first created
onCreate
{ "repo_name": "treejames/madsonic-5.5", "path": "src/github/madmarty/madsonic/activity/SelectArtistActivity.java", "license": "gpl-3.0", "size": 14352 }
[ "android.view.LayoutInflater", "android.widget.ListView", "android.widget.TextView", "github.madmarty.madsonic.util.Util" ]
import android.view.LayoutInflater; import android.widget.ListView; import android.widget.TextView; import github.madmarty.madsonic.util.Util;
import android.view.*; import android.widget.*; import github.madmarty.madsonic.util.*;
[ "android.view", "android.widget", "github.madmarty.madsonic" ]
android.view; android.widget; github.madmarty.madsonic;
1,361,834
public void init(Matrix w, Random rand);
void function(Matrix w, Random rand);
/** * Initializes the values of the given weight matrix * @param w the matrix to initialize * @param rand the source of randomness for the initialization */
Initializes the values of the given weight matrix
init
{ "repo_name": "TKlerx/JSAT", "path": "JSAT/src/jsat/classifiers/neuralnetwork/initializers/WeightInitializer.java", "license": "gpl-3.0", "size": 629 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
2,188,778
public static byte[] createIV(Configuration conf) throws IOException { CryptoCodec cryptoCodec = CryptoCodec.getInstance(conf); if (isShuffleEncrypted(conf)) { byte[] iv = new byte[cryptoCodec.getCipherSuite().getAlgorithmBlockSize()]; cryptoCodec.generateSecureRandom(iv); return iv; } else { return null; } }
static byte[] function(Configuration conf) throws IOException { CryptoCodec cryptoCodec = CryptoCodec.getInstance(conf); if (isShuffleEncrypted(conf)) { byte[] iv = new byte[cryptoCodec.getCipherSuite().getAlgorithmBlockSize()]; cryptoCodec.generateSecureRandom(iv); return iv; } else { return null; } }
/** * This method creates and initializes an IV (Initialization Vector) * * @param conf * @return byte[] * @throws IOException */
This method creates and initializes an IV (Initialization Vector)
createIV
{ "repo_name": "bysslord/hadoop", "path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/CryptoUtils.java", "license": "apache-2.0", "size": 7340 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.crypto.CryptoCodec" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.crypto.CryptoCodec;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.crypto.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,047,210
private JPanel getSelectorPanel() { FormBuilder builder = FormBuilder.create() .layout(new FormLayout("left:pref:grow, 4dlu, left:pref:grow, 4dlu, pref:grow, 4dlu, right:pref", "pref, 2dlu, pref:grow, 2dlu")); List<String> fieldNames = new ArrayList<>(InternalBibtexFields.getAllFieldNames()); fieldNames.add(BibEntry.KEY_FIELD); fieldNames.add("all"); Collections.sort(fieldNames); String[] allPlusKey = fieldNames.toArray(new String[fieldNames.size()]); selectFieldCombobox = new JComboBox<>(allPlusKey); selectFieldCombobox.setEditable(true); builder.add(selectFieldCombobox).xy(1, 1); List<String> formatterNames = fieldFormatterCleanups.getAvailableFormatters().stream() .map(Formatter::getName).collect(Collectors.toList()); List<String> formatterDescriptions = fieldFormatterCleanups.getAvailableFormatters().stream() .map(Formatter::getDescription).collect(Collectors.toList()); formattersCombobox = new JComboBox<>(formatterNames.toArray()); formattersCombobox.setRenderer(new DefaultListCellRenderer() {
JPanel function() { FormBuilder builder = FormBuilder.create() .layout(new FormLayout(STR, STR)); List<String> fieldNames = new ArrayList<>(InternalBibtexFields.getAllFieldNames()); fieldNames.add(BibEntry.KEY_FIELD); fieldNames.add("all"); Collections.sort(fieldNames); String[] allPlusKey = fieldNames.toArray(new String[fieldNames.size()]); selectFieldCombobox = new JComboBox<>(allPlusKey); selectFieldCombobox.setEditable(true); builder.add(selectFieldCombobox).xy(1, 1); List<String> formatterNames = fieldFormatterCleanups.getAvailableFormatters().stream() .map(Formatter::getName).collect(Collectors.toList()); List<String> formatterDescriptions = fieldFormatterCleanups.getAvailableFormatters().stream() .map(Formatter::getDescription).collect(Collectors.toList()); formattersCombobox = new JComboBox<>(formatterNames.toArray()); formattersCombobox.setRenderer(new DefaultListCellRenderer() {
/** * This panel contains the two comboboxes and the Add button * @return Returns the created JPanel */
This panel contains the two comboboxes and the Add button
getSelectorPanel
{ "repo_name": "matheusvervloet/DC-UFSCar-ES2-201601-Grupo3", "path": "src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java", "license": "gpl-2.0", "size": 12681 }
[ "com.jgoodies.forms.builder.FormBuilder", "com.jgoodies.forms.layout.FormLayout", "java.util.ArrayList", "java.util.Collections", "java.util.List", "java.util.stream.Collectors", "javax.swing.DefaultListCellRenderer", "javax.swing.JComboBox", "javax.swing.JPanel", "net.sf.jabref.bibtex.InternalBibtexFields", "net.sf.jabref.logic.formatter.Formatter", "net.sf.jabref.model.entry.BibEntry" ]
import com.jgoodies.forms.builder.FormBuilder; import com.jgoodies.forms.layout.FormLayout; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import javax.swing.DefaultListCellRenderer; import javax.swing.JComboBox; import javax.swing.JPanel; import net.sf.jabref.bibtex.InternalBibtexFields; import net.sf.jabref.logic.formatter.Formatter; import net.sf.jabref.model.entry.BibEntry;
import com.jgoodies.forms.builder.*; import com.jgoodies.forms.layout.*; import java.util.*; import java.util.stream.*; import javax.swing.*; import net.sf.jabref.bibtex.*; import net.sf.jabref.logic.formatter.*; import net.sf.jabref.model.entry.*;
[ "com.jgoodies.forms", "java.util", "javax.swing", "net.sf.jabref" ]
com.jgoodies.forms; java.util; javax.swing; net.sf.jabref;
1,281,803
public void sqlToArrowTestSelectedNullColumnsValues(String[] vectors, VectorSchemaRoot root, int rowCount) { assertNullValues((BigIntVector) root.getVector(vectors[0]), rowCount); assertNullValues((DecimalVector) root.getVector(vectors[1]), rowCount); assertNullValues((Float8Vector) root.getVector(vectors[2]), rowCount); assertNullValues((Float4Vector) root.getVector(vectors[3]), rowCount); assertNullValues((TimeMilliVector) root.getVector(vectors[4]), rowCount); assertNullValues((DateDayVector) root.getVector(vectors[5]), rowCount); assertNullValues((TimeStampVector) root.getVector(vectors[6]), rowCount); assertNullValues((VarBinaryVector) root.getVector(vectors[7]), rowCount); assertNullValues((VarCharVector) root.getVector(vectors[8]), rowCount); assertNullValues((VarBinaryVector) root.getVector(vectors[9]), rowCount); assertNullValues((VarCharVector) root.getVector(vectors[10]), rowCount); assertNullValues((VarCharVector) root.getVector(vectors[11]), rowCount); assertNullValues((BitVector) root.getVector(vectors[12]), rowCount); }
void function(String[] vectors, VectorSchemaRoot root, int rowCount) { assertNullValues((BigIntVector) root.getVector(vectors[0]), rowCount); assertNullValues((DecimalVector) root.getVector(vectors[1]), rowCount); assertNullValues((Float8Vector) root.getVector(vectors[2]), rowCount); assertNullValues((Float4Vector) root.getVector(vectors[3]), rowCount); assertNullValues((TimeMilliVector) root.getVector(vectors[4]), rowCount); assertNullValues((DateDayVector) root.getVector(vectors[5]), rowCount); assertNullValues((TimeStampVector) root.getVector(vectors[6]), rowCount); assertNullValues((VarBinaryVector) root.getVector(vectors[7]), rowCount); assertNullValues((VarCharVector) root.getVector(vectors[8]), rowCount); assertNullValues((VarBinaryVector) root.getVector(vectors[9]), rowCount); assertNullValues((VarCharVector) root.getVector(vectors[10]), rowCount); assertNullValues((VarCharVector) root.getVector(vectors[11]), rowCount); assertNullValues((BitVector) root.getVector(vectors[12]), rowCount); }
/** * This method assert tests null values in vectors for some selected datatypes. * * @param vectors Vectors to test * @param root VectorSchemaRoot for test * @param rowCount number of rows */
This method assert tests null values in vectors for some selected datatypes
sqlToArrowTestSelectedNullColumnsValues
{ "repo_name": "kou/arrow", "path": "java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowNullTest.java", "license": "apache-2.0", "size": 13407 }
[ "org.apache.arrow.adapter.jdbc.JdbcToArrowTestHelper", "org.apache.arrow.vector.BigIntVector", "org.apache.arrow.vector.BitVector", "org.apache.arrow.vector.DateDayVector", "org.apache.arrow.vector.DecimalVector", "org.apache.arrow.vector.Float4Vector", "org.apache.arrow.vector.Float8Vector", "org.apache.arrow.vector.TimeMilliVector", "org.apache.arrow.vector.TimeStampVector", "org.apache.arrow.vector.VarBinaryVector", "org.apache.arrow.vector.VarCharVector", "org.apache.arrow.vector.VectorSchemaRoot" ]
import org.apache.arrow.adapter.jdbc.JdbcToArrowTestHelper; import org.apache.arrow.vector.BigIntVector; import org.apache.arrow.vector.BitVector; import org.apache.arrow.vector.DateDayVector; import org.apache.arrow.vector.DecimalVector; import org.apache.arrow.vector.Float4Vector; import org.apache.arrow.vector.Float8Vector; import org.apache.arrow.vector.TimeMilliVector; import org.apache.arrow.vector.TimeStampVector; import org.apache.arrow.vector.VarBinaryVector; import org.apache.arrow.vector.VarCharVector; import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.adapter.jdbc.*; import org.apache.arrow.vector.*;
[ "org.apache.arrow" ]
org.apache.arrow;
522,004
private static void fixRectangleOrientation(double[] m, Rectangle2D clip) { if (clip.getWidth() > 0 != (m[2] - m[0] > 0)) { double t = m[0]; m[0] = m[2]; m[2] = t; } if (clip.getHeight() > 0 != (m[3] - m[1] > 0)) { double t = m[1]; m[1] = m[3]; m[3] = t; } }
static void function(double[] m, Rectangle2D clip) { if (clip.getWidth() > 0 != (m[2] - m[0] > 0)) { double t = m[0]; m[0] = m[2]; m[2] = t; } if (clip.getHeight() > 0 != (m[3] - m[1] > 0)) { double t = m[1]; m[1] = m[3]; m[3] = t; } }
/** * Sets orientation of the rectangle according to the clip. */
Sets orientation of the rectangle according to the clip
fixRectangleOrientation
{ "repo_name": "openjdk/jdk7u", "path": "jdk/src/share/classes/sun/java2d/SunGraphics2D.java", "license": "gpl-2.0", "size": 133716 }
[ "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
2,406,677
private void openAddDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setCancelable(true); builder.setTitle(R.string.dialog_add_origin_title); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { builder.setItems(R.array.allowlist_menu_origin_pre_marshmallow, (dialog, which) -> { dialog.dismiss(); Context context = getActivity(); if (context == null) { return; } switch (which) { case 0: openListDialog(context, getAllBookmarksOfChrome()); break; case 1: openListDialog(context, getInstalledNativeApplications()); break; case 2: ManualEntryDialogBuilder builders = new ManualEntryDialogBuilder(context); builders.mDialogTitle = getString(R.string.dialog_add_origin_title); builders.mDefaultOrigin = ""; builders.mDefaultOriginTitle = ""; builders.mPositiveButtonName = getString(R.string.dialog_add_origin_positive); builders.mNegativeButtonName = getString(R.string.dialog_add_origin_negative); builders.mListener = (origin, title) -> { try { addOrigin(origin, title); if (BuildConfig.DEBUG) { mLogger.info("Updated origin=" + origin + " title=" + title); } } catch (AllowlistException e) { mLogger.log(Level.WARNING, "Failed to add origin.", e); showPopup(e.getMessage()); } }; builders.create().show(); break; default: // nothing to do break; } }); } else { builder.setItems(R.array.allowlist_menu_origin_post_marshmallow, (dialog, which) -> { dialog.dismiss(); Context context = getActivity(); if (context == null) { return; } switch (which) { case 0: openListDialog(context, getInstalledNativeApplications()); break; case 1: ManualEntryDialogBuilder builders = new ManualEntryDialogBuilder(context); builders.mDialogTitle = getString(R.string.dialog_add_origin_title); builders.mDefaultOrigin = ""; builders.mDefaultOriginTitle = ""; builders.mPositiveButtonName = getString(R.string.dialog_add_origin_positive); builders.mNegativeButtonName = getString(R.string.dialog_add_origin_negative); builders.mListener = (origin, title) -> { try { addOrigin(origin, title); if (BuildConfig.DEBUG) { mLogger.info("Updated origin=" + origin + " title=" + title); } } catch (AllowlistException e) { mLogger.log(Level.WARNING, "Failed to add origin.", e); showPopup(e.getMessage()); } }; builders.create().show(); break; default: // nothing to do break; } }); } builder.create().show(); }
void function() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setCancelable(true); builder.setTitle(R.string.dialog_add_origin_title); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { builder.setItems(R.array.allowlist_menu_origin_pre_marshmallow, (dialog, which) -> { dialog.dismiss(); Context context = getActivity(); if (context == null) { return; } switch (which) { case 0: openListDialog(context, getAllBookmarksOfChrome()); break; case 1: openListDialog(context, getInstalledNativeApplications()); break; case 2: ManualEntryDialogBuilder builders = new ManualEntryDialogBuilder(context); builders.mDialogTitle = getString(R.string.dialog_add_origin_title); builders.mDefaultOrigin = STRSTRUpdated origin=STR title=STRFailed to add origin.", e); showPopup(e.getMessage()); } }; builders.create().show(); break; default: break; } }); } else { builder.setItems(R.array.allowlist_menu_origin_post_marshmallow, (dialog, which) -> { dialog.dismiss(); Context context = getActivity(); if (context == null) { return; } switch (which) { case 0: openListDialog(context, getInstalledNativeApplications()); break; case 1: ManualEntryDialogBuilder builders = new ManualEntryDialogBuilder(context); builders.mDialogTitle = getString(R.string.dialog_add_origin_title); builders.mDefaultOrigin = STRSTRUpdated origin=STR title=STRFailed to add origin.", e); showPopup(e.getMessage()); } }; builders.create().show(); break; default: break; } }); } builder.create().show(); }
/** * Opens the origin addition dialog. */
Opens the origin addition dialog
openAddDialog
{ "repo_name": "TakayukiHoshi1984/DeviceConnect-Android", "path": "dConnectManager/dConnectManager/dconnect-manager-app/src/main/java/org/deviceconnect/android/manager/setting/AllowlistFragment.java", "license": "mit", "size": 25579 }
[ "android.content.Context", "android.os.Build", "androidx.appcompat.app.AlertDialog" ]
import android.content.Context; import android.os.Build; import androidx.appcompat.app.AlertDialog;
import android.content.*; import android.os.*; import androidx.appcompat.app.*;
[ "android.content", "android.os", "androidx.appcompat" ]
android.content; android.os; androidx.appcompat;
1,226,894
@Test public void testListSerialization() throws Exception { final long key = 0L; // objects for heap state list serialisation final HeapKeyedStateBackend<Long> longHeapKeyedStateBackend = new HeapKeyedStateBackend<>( mock(TaskKvStateRegistry.class), LongSerializer.INSTANCE, ClassLoader.getSystemClassLoader(), 1, new KeyGroupRange(0, 0), async, new ExecutionConfig() ); longHeapKeyedStateBackend.setCurrentKey(key); final InternalListState<VoidNamespace, Long> listState = longHeapKeyedStateBackend.createListState( VoidNamespaceSerializer.INSTANCE, new ListStateDescriptor<>("test", LongSerializer.INSTANCE)); testListSerialization(key, listState); }
void function() throws Exception { final long key = 0L; final HeapKeyedStateBackend<Long> longHeapKeyedStateBackend = new HeapKeyedStateBackend<>( mock(TaskKvStateRegistry.class), LongSerializer.INSTANCE, ClassLoader.getSystemClassLoader(), 1, new KeyGroupRange(0, 0), async, new ExecutionConfig() ); longHeapKeyedStateBackend.setCurrentKey(key); final InternalListState<VoidNamespace, Long> listState = longHeapKeyedStateBackend.createListState( VoidNamespaceSerializer.INSTANCE, new ListStateDescriptor<>("test", LongSerializer.INSTANCE)); testListSerialization(key, listState); }
/** * Tests list serialization utils. */
Tests list serialization utils
testListSerialization
{ "repo_name": "mtunique/flink", "path": "flink-runtime/src/test/java/org/apache/flink/runtime/query/netty/message/KvStateRequestSerializerTest.java", "license": "apache-2.0", "size": 20016 }
[ "org.apache.flink.api.common.ExecutionConfig", "org.apache.flink.api.common.state.ListStateDescriptor", "org.apache.flink.api.common.typeutils.base.LongSerializer", "org.apache.flink.runtime.query.TaskKvStateRegistry", "org.apache.flink.runtime.state.KeyGroupRange", "org.apache.flink.runtime.state.VoidNamespace", "org.apache.flink.runtime.state.VoidNamespaceSerializer", "org.apache.flink.runtime.state.heap.HeapKeyedStateBackend", "org.apache.flink.runtime.state.internal.InternalListState", "org.mockito.Mockito" ]
import org.apache.flink.api.common.ExecutionConfig; import org.apache.flink.api.common.state.ListStateDescriptor; import org.apache.flink.api.common.typeutils.base.LongSerializer; import org.apache.flink.runtime.query.TaskKvStateRegistry; import org.apache.flink.runtime.state.KeyGroupRange; import org.apache.flink.runtime.state.VoidNamespace; import org.apache.flink.runtime.state.VoidNamespaceSerializer; import org.apache.flink.runtime.state.heap.HeapKeyedStateBackend; import org.apache.flink.runtime.state.internal.InternalListState; import org.mockito.Mockito;
import org.apache.flink.api.common.*; import org.apache.flink.api.common.state.*; import org.apache.flink.api.common.typeutils.base.*; import org.apache.flink.runtime.query.*; import org.apache.flink.runtime.state.*; import org.apache.flink.runtime.state.heap.*; import org.apache.flink.runtime.state.internal.*; import org.mockito.*;
[ "org.apache.flink", "org.mockito" ]
org.apache.flink; org.mockito;
1,488,333
public static String toJsSanitizedContentOrdainerForInternalBlocks( ContentKind contentKind) { // Functions are defined in soyutils{,_usegoog}.js. return Preconditions.checkNotNull( KIND_TO_JS_ORDAINER_NAME_FOR_INTERNAL_BLOCKS.get(contentKind)); }
static String function( ContentKind contentKind) { return Preconditions.checkNotNull( KIND_TO_JS_ORDAINER_NAME_FOR_INTERNAL_BLOCKS.get(contentKind)); }
/** * Returns the ordainer function for param and let blocks, which behaves subtly differently than * the normal ordainers to ease migration. */
Returns the ordainer function for param and let blocks, which behaves subtly differently than the normal ordainers to ease migration
toJsSanitizedContentOrdainerForInternalBlocks
{ "repo_name": "oujesky/closure-templates", "path": "java/src/com/google/template/soy/data/internalutils/NodeContentKinds.java", "license": "apache-2.0", "size": 9259 }
[ "com.google.common.base.Preconditions", "com.google.template.soy.data.SanitizedContent" ]
import com.google.common.base.Preconditions; import com.google.template.soy.data.SanitizedContent;
import com.google.common.base.*; import com.google.template.soy.data.*;
[ "com.google.common", "com.google.template" ]
com.google.common; com.google.template;
774,660
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<RoleDefinitionInner> listAsync(String scope);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<RoleDefinitionInner> listAsync(String scope);
/** * Get all role definitions that are applicable at scope and above. * * @param scope The scope of the role definition. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all role definitions that are applicable at scope and above. */
Get all role definitions that are applicable at scope and above
listAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/RoleDefinitionsClient.java", "license": "mit", "size": 15940 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.resourcemanager.authorization.fluent.models.RoleDefinitionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.authorization.fluent.models.RoleDefinitionInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.authorization.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
272,441
public void run() { try { Thread thisthread = Thread.currentThread(); while (true) { try { Object msg = inputStream.readObject(); handleIncomingMessage(msg); } catch (EOFException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } catch (IOException ex) { ex.printStackTrace(); } finally { thread = null; try { outputStream.close(); } catch (IOException ex) { ex.printStackTrace(); } } }
void function() { try { Thread thisthread = Thread.currentThread(); while (true) { try { Object msg = inputStream.readObject(); handleIncomingMessage(msg); } catch (EOFException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } catch (IOException ex) { ex.printStackTrace(); } finally { thread = null; try { outputStream.close(); } catch (IOException ex) { ex.printStackTrace(); } } }
/** * main method. waits for incoming messages. */
main method. waits for incoming messages
run
{ "repo_name": "SergiyKolesnikov/fuji", "path": "examples/Chat_casestudies/chat-yinxiao-liang/features/Base/client/Client.java", "license": "lgpl-3.0", "size": 4038 }
[ "java.io.EOFException", "java.io.IOException" ]
import java.io.EOFException; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,226,308
@Deprecated public static File renderTileMetricsFileFromBasecallingDirectory(final File illuminaRunDirectory, int numCycles, boolean isNovaSeq) { return findTileMetricsFiles(illuminaRunDirectory, numCycles, isNovaSeq).get(0); }
static File function(final File illuminaRunDirectory, int numCycles, boolean isNovaSeq) { return findTileMetricsFiles(illuminaRunDirectory, numCycles, isNovaSeq).get(0); }
/** * Returns the path to the TileMetrics file given the basecalling directory. * * @deprecated use {@link #findTileMetricsFiles(File, int, boolean)} instead */
Returns the path to the TileMetrics file given the basecalling directory
renderTileMetricsFileFromBasecallingDirectory
{ "repo_name": "alecw/picard", "path": "src/main/java/picard/illumina/parser/TileMetricsUtil.java", "license": "mit", "size": 23731 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,013,319
public ServiceFuture<Void> deleteAsync(String resourceGroupName, String crossConnectionName, String peeringName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String crossConnectionName, String peeringName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName), serviceCallback); }
/** * Deletes the specified peering from the ExpressRouteCrossConnection. * * @param resourceGroupName The name of the resource group. * @param crossConnectionName The name of the ExpressRouteCrossConnection. * @param peeringName The name of the peering. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Deletes the specified peering from the ExpressRouteCrossConnection
deleteAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java", "license": "mit", "size": 49218 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,451,705
public void moveMouseTo(Component c) { Point p = c.getLocationOnScreen(); Dimension size = c.getSize(); p.x += size.width / 2; p.y += size.height / 2; mouseMove(p.x, p.y); delay(); }
void function(Component c) { Point p = c.getLocationOnScreen(); Dimension size = c.getSize(); p.x += size.width / 2; p.y += size.height / 2; mouseMove(p.x, p.y); delay(); }
/** * Move mouse cursor to the center of the Component. * @param c Component the mouse is placed over */
Move mouse cursor to the center of the Component
moveMouseTo
{ "repo_name": "md-5/jdk10", "path": "test/jdk/javax/swing/regtesthelpers/JRobot.java", "license": "gpl-2.0", "size": 8807 }
[ "java.awt.Component", "java.awt.Dimension", "java.awt.Point" ]
import java.awt.Component; import java.awt.Dimension; import java.awt.Point;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,343,442
public static java.util.List extractIntraOperativeCareRecordList(ims.domain.ILightweightDomainFactory domainFactory, ims.careuk.vo.ClinicalOutcomeProcedureVoCollection voCollection) { return extractIntraOperativeCareRecordList(domainFactory, voCollection, null, new HashMap()); }
static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.careuk.vo.ClinicalOutcomeProcedureVoCollection voCollection) { return extractIntraOperativeCareRecordList(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.core.clinical.domain.objects.IntraOperativeCareRecord list from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.core.clinical.domain.objects.IntraOperativeCareRecord list from the value object collection
extractIntraOperativeCareRecordList
{ "repo_name": "openhealthcare/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/careuk/vo/domain/ClinicalOutcomeProcedureVoAssembler.java", "license": "agpl-3.0", "size": 18788 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,779,304
public Component createRenderer(MetaData metaData) { // handle the case when we get null metadata if (metaData == null) { return null; } // first of all, we need to check that factories contains or doesn't contain render for // metadata if (factories.containsKey(metaData.getClass())) { // if there is a renderer factory element in factories then we need to check that it is // null or not MetaDataRendererFactory factory = factories.get(metaData.getClass()); if (factory == null) { // if it is null then return with null return null; } else { // it it is not null then call the createRenderer function on the renderer factory return factory.createRenderer(metaData); } } else { // there is no factory in factories for the given metadata, so let's try to find // one // find the closest (inheritance) renderer from the factories int distance = Integer.MAX_VALUE; Iterator<Class<? extends MetaData>> iterator = factories.keySet().iterator(); Class<?> rendererCandidateMetaDataClass = null; while (iterator.hasNext()) { // get the next key from the factories Class<?> metaDataClass = iterator.next(); // calculate the distance between key MD and parameter MD int currentDistance = getInheritenceLevelDistance(metaData.getClass(), metaDataClass); // find the closest one if (currentDistance != -1 && currentDistance < distance) { distance = currentDistance; rendererCandidateMetaDataClass = metaDataClass; } } // if an appropriate renderer is exist, then register it for this metadata if (rendererCandidateMetaDataClass != null) { MetaDataRendererFactory factory = factories.get(rendererCandidateMetaDataClass); factories.put(metaData.getClass(), factory); return factory.createRenderer(metaData); } else { // else add null to this metadata (to avoid further lookups) factories.put(metaData.getClass(), null); return null; } } }
Component function(MetaData metaData) { if (metaData == null) { return null; } if (factories.containsKey(metaData.getClass())) { MetaDataRendererFactory factory = factories.get(metaData.getClass()); if (factory == null) { return null; } else { return factory.createRenderer(metaData); } } else { int distance = Integer.MAX_VALUE; Iterator<Class<? extends MetaData>> iterator = factories.keySet().iterator(); Class<?> rendererCandidateMetaDataClass = null; while (iterator.hasNext()) { Class<?> metaDataClass = iterator.next(); int currentDistance = getInheritenceLevelDistance(metaData.getClass(), metaDataClass); if (currentDistance != -1 && currentDistance < distance) { distance = currentDistance; rendererCandidateMetaDataClass = metaDataClass; } } if (rendererCandidateMetaDataClass != null) { MetaDataRendererFactory factory = factories.get(rendererCandidateMetaDataClass); factories.put(metaData.getClass(), factory); return factory.createRenderer(metaData); } else { factories.put(metaData.getClass(), null); return null; } } }
/** * Creates a renderer for this meta data object or null if there is no suitable renderer or if * the meta data is null. */
Creates a renderer for this meta data object or null if there is no suitable renderer or if the meta data is null
createRenderer
{ "repo_name": "aborg0/rapidminer-studio", "path": "src/main/java/com/rapidminer/gui/metadata/MetaDataRendererFactoryRegistry.java", "license": "agpl-3.0", "size": 7017 }
[ "com.rapidminer.operator.ports.metadata.MetaData", "java.awt.Component", "java.util.Iterator" ]
import com.rapidminer.operator.ports.metadata.MetaData; import java.awt.Component; import java.util.Iterator;
import com.rapidminer.operator.ports.metadata.*; import java.awt.*; import java.util.*;
[ "com.rapidminer.operator", "java.awt", "java.util" ]
com.rapidminer.operator; java.awt; java.util;
1,039,823
private void registerDebugEvents() throws FloodlightModuleException { if (debugEventService == null) { debugEventService = new MockDebugEventService(); } evSwitch = debugEventService.buildEvent(SwitchEvent.class) .setModuleName(this.counters.getPrefix()) .setEventName("switch-event") .setEventDescription("Switch connected, disconnected or port changed") .setEventType(EventType.ALWAYS_LOG) .setBufferCapacity(100) .register(); }
void function() throws FloodlightModuleException { if (debugEventService == null) { debugEventService = new MockDebugEventService(); } evSwitch = debugEventService.buildEvent(SwitchEvent.class) .setModuleName(this.counters.getPrefix()) .setEventName(STR) .setEventDescription(STR) .setEventType(EventType.ALWAYS_LOG) .setBufferCapacity(100) .register(); }
/** * Registers an event handler with the debug event service * for switch events. * @throws FloodlightModuleException */
Registers an event handler with the debug event service for switch events
registerDebugEvents
{ "repo_name": "zy-sdn/savi-floodlight", "path": "src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java", "license": "apache-2.0", "size": 41066 }
[ "net.floodlightcontroller.core.module.FloodlightModuleException", "net.floodlightcontroller.debugevent.IDebugEventService", "net.floodlightcontroller.debugevent.MockDebugEventService" ]
import net.floodlightcontroller.core.module.FloodlightModuleException; import net.floodlightcontroller.debugevent.IDebugEventService; import net.floodlightcontroller.debugevent.MockDebugEventService;
import net.floodlightcontroller.core.module.*; import net.floodlightcontroller.debugevent.*;
[ "net.floodlightcontroller.core", "net.floodlightcontroller.debugevent" ]
net.floodlightcontroller.core; net.floodlightcontroller.debugevent;
2,539,097
private DateList getHourVariants(final DateList dates) { if (getHourList().isEmpty()) { return dates; } final DateList hourlyDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); final Calendar cal = Dates.getCalendarInstance(date); cal.setTime(date); for (final Iterator j = getHourList().iterator(); j.hasNext();) { final Integer hour = (Integer) j.next(); cal.set(Calendar.HOUR_OF_DAY, hour.intValue()); hourlyDates.add(Dates.getInstance(cal.getTime(), hourlyDates.getType())); } } return hourlyDates; }
DateList function(final DateList dates) { if (getHourList().isEmpty()) { return dates; } final DateList hourlyDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); final Calendar cal = Dates.getCalendarInstance(date); cal.setTime(date); for (final Iterator j = getHourList().iterator(); j.hasNext();) { final Integer hour = (Integer) j.next(); cal.set(Calendar.HOUR_OF_DAY, hour.intValue()); hourlyDates.add(Dates.getInstance(cal.getTime(), hourlyDates.getType())); } } return hourlyDates; }
/** * Applies BYHOUR rules specified in this Recur instance to the specified date list. If no BYHOUR rules are * specified the date list is returned unmodified. * @param dates * @return */
Applies BYHOUR rules specified in this Recur instance to the specified date list. If no BYHOUR rules are specified the date list is returned unmodified
getHourVariants
{ "repo_name": "benfortuna/ical4j", "path": "src/main/java/net/fortuna/ical4j/model/Recur.java", "license": "bsd-3-clause", "size": 44023 }
[ "java.util.Calendar", "java.util.Iterator", "net.fortuna.ical4j.util.Dates" ]
import java.util.Calendar; import java.util.Iterator; import net.fortuna.ical4j.util.Dates;
import java.util.*; import net.fortuna.ical4j.util.*;
[ "java.util", "net.fortuna.ical4j" ]
java.util; net.fortuna.ical4j;
2,266,960
public List getCompleterNames() { List names = new ArrayList(); for (Iterator iter = attributeCollections.iterator(); iter.hasNext();) { AttributeCollection acol = (AttributeCollection) iter.next(); if (acol.getHidden() != null && acol.getHidden().equals("true")) continue; if (acol.getDisplay() != null && acol.getDisplay().equals("true")) continue; // hacky special case for sequence supported pointers in // sequences.header_info.gene,transcript,exon if (getInternalName().equals("header_info")) { names.addAll(acol.getHiddenCompleterNames()); } else { names.addAll(acol.getCompleterNames()); } } return names; }
List function() { List names = new ArrayList(); for (Iterator iter = attributeCollections.iterator(); iter.hasNext();) { AttributeCollection acol = (AttributeCollection) iter.next(); if (acol.getHidden() != null && acol.getHidden().equals("true")) continue; if (acol.getDisplay() != null && acol.getDisplay().equals("true")) continue; if (getInternalName().equals(STR)) { names.addAll(acol.getHiddenCompleterNames()); } else { names.addAll(acol.getCompleterNames()); } } return names; }
/** * Returns a List of internalNames for the MartCompleter command completion system. * @return List of internalNames */
Returns a List of internalNames for the MartCompleter command completion system
getCompleterNames
{ "repo_name": "pubmed2ensembl/MartScript", "path": "src/org/ensembl/mart/lib/config/AttributeGroup.java", "license": "lgpl-2.1", "size": 19005 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
932,754
private EventMessageBundle deserializeEvents(HttpServletRequest req) throws IOException { String json = readRequestBody(req); LOG.info("Incoming events: " + json); EventMessageBundle bundle = SERIALIZER.fromJson(json, EventMessageBundle.class); if (bundle.getRpcServerUrl() == null) { throw new IllegalArgumentException("RPC server URL is not set in the event bundle."); } // Get the OAuth credentials for the given RPC server URL. ConsumerData consumerDataObj = consumerData.get(bundle.getRpcServerUrl()); if (consumerDataObj == null && !isUnsignedRequestsAllowed()) { throw new IllegalArgumentException("No consumer key is found for the RPC server URL: " + bundle.getRpcServerUrl()); } // Validates the request. if (consumerDataObj != null) { try { @SuppressWarnings("unchecked") Map<String, String[]> parameterMap = req.getParameterMap(); validateOAuthRequest(req.getRequestURL().toString(), parameterMap, json, consumerDataObj.getConsumerKey(), consumerDataObj.getConsumerSecret()); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Error validating OAuth request", e); } catch (URISyntaxException e) { throw new IllegalArgumentException("Error validating OAuth request", e); } catch (OAuthException e) { throw new IllegalArgumentException("Error validating OAuth request", e); } } return bundle; }
EventMessageBundle function(HttpServletRequest req) throws IOException { String json = readRequestBody(req); LOG.info(STR + json); EventMessageBundle bundle = SERIALIZER.fromJson(json, EventMessageBundle.class); if (bundle.getRpcServerUrl() == null) { throw new IllegalArgumentException(STR); } ConsumerData consumerDataObj = consumerData.get(bundle.getRpcServerUrl()); if (consumerDataObj == null && !isUnsignedRequestsAllowed()) { throw new IllegalArgumentException(STR + bundle.getRpcServerUrl()); } if (consumerDataObj != null) { try { @SuppressWarnings(STR) Map<String, String[]> parameterMap = req.getParameterMap(); validateOAuthRequest(req.getRequestURL().toString(), parameterMap, json, consumerDataObj.getConsumerKey(), consumerDataObj.getConsumerSecret()); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(STR, e); } catch (URISyntaxException e) { throw new IllegalArgumentException(STR, e); } catch (OAuthException e) { throw new IllegalArgumentException(STR, e); } } return bundle; }
/** * Deserializes the given HTTP request's JSON body into an event message * bundle. * * @param req the HTTP request to be deserialized. * @return an event message bundle. * * @throws IOException if there is a problem reading the request's body. * @throws IllegalArgumentException if the request is not signed properly. */
Deserializes the given HTTP request's JSON body into an event message bundle
deserializeEvents
{ "repo_name": "processone/google-wave-api", "path": "wave-robot-api/src/main/java/com/google/wave/api/AbstractRobot.java", "license": "apache-2.0", "size": 52162 }
[ "com.google.wave.api.impl.EventMessageBundle", "java.io.IOException", "java.net.URISyntaxException", "java.security.NoSuchAlgorithmException", "java.util.Map", "javax.servlet.http.HttpServletRequest", "net.oauth.OAuthException" ]
import com.google.wave.api.impl.EventMessageBundle; import java.io.IOException; import java.net.URISyntaxException; import java.security.NoSuchAlgorithmException; import java.util.Map; import javax.servlet.http.HttpServletRequest; import net.oauth.OAuthException;
import com.google.wave.api.impl.*; import java.io.*; import java.net.*; import java.security.*; import java.util.*; import javax.servlet.http.*; import net.oauth.*;
[ "com.google.wave", "java.io", "java.net", "java.security", "java.util", "javax.servlet", "net.oauth" ]
com.google.wave; java.io; java.net; java.security; java.util; javax.servlet; net.oauth;
1,457,262
protected List parseLocators() { // assumes host[port] format, delimited by "," List locatorIds = new ArrayList(); if (isMcastEnabled()) { String mcastId = new StringBuffer(this.getMcastAddress()).append("[") .append(this.getMcastPort()).append("]").toString(); locatorIds.add(new DistributionLocatorId(mcastId)); } StringTokenizer st = new StringTokenizer(this.getLocators(), ","); while (st.hasMoreTokens()) { locatorIds.add(new DistributionLocatorId(st.nextToken())); } if (logger.isDebugEnabled()) { StringBuffer sb = new StringBuffer("Locator set is: "); for (Iterator iter = locatorIds.iterator(); iter.hasNext();) { sb.append(iter.next()); sb.append(" "); } logger.debug(sb); } return locatorIds; }
List function() { List locatorIds = new ArrayList(); if (isMcastEnabled()) { String mcastId = new StringBuffer(this.getMcastAddress()).append("[") .append(this.getMcastPort()).append("]").toString(); locatorIds.add(new DistributionLocatorId(mcastId)); } StringTokenizer st = new StringTokenizer(this.getLocators(), ","); while (st.hasMoreTokens()) { locatorIds.add(new DistributionLocatorId(st.nextToken())); } if (logger.isDebugEnabled()) { StringBuffer sb = new StringBuffer(STR); for (Iterator iter = locatorIds.iterator(); iter.hasNext();) { sb.append(iter.next()); sb.append(" "); } logger.debug(sb); } return locatorIds; }
/** * Returns List of Locators including Locators or Multicast. * * @return list of locators or multicast values */
Returns List of Locators including Locators or Multicast
parseLocators
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/admin/internal/AdminDistributedSystemImpl.java", "license": "apache-2.0", "size": 81159 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "java.util.StringTokenizer", "org.apache.geode.internal.admin.remote.DistributionLocatorId" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import org.apache.geode.internal.admin.remote.DistributionLocatorId;
import java.util.*; import org.apache.geode.internal.admin.remote.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
921,865
protected void stop() throws IOException { _chat.shutdown(); }
void function() throws IOException { _chat.shutdown(); }
/** * Called by window thread when when window closes */
Called by window thread when when window closes
stop
{ "repo_name": "gujianxiao/gatewayForMulticom", "path": "apps/ndnChat/src/org/ndnx/ndn/apps/ndnchat/NDNChat.java", "license": "lgpl-2.1", "size": 5344 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,430,129
protected final boolean scanDecls(boolean complete) throws IOException, XNIException { skipSeparator(false, true); boolean again = true; //System.out.println("scanDecls"+fScannerState); while (again && fScannerState == SCANNER_STATE_MARKUP_DECL) { again = complete; if (fEntityScanner.skipChar('<', null)) { fMarkUpDepth++; if (fEntityScanner.skipChar('?', null)) { fStringBuffer.clear(); scanPI(fStringBuffer); fMarkUpDepth--; // we're done with this decl } else if (fEntityScanner.skipChar('!', null)) { if (fEntityScanner.skipChar('-', null)) { if (!fEntityScanner.skipChar('-', null)) { reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null); } else { scanComment(); } } else if (fEntityScanner.skipString("ELEMENT")) { scanElementDecl(); } else if (fEntityScanner.skipString("ATTLIST")) { scanAttlistDecl(); } else if (fEntityScanner.skipString("ENTITY")) { scanEntityDecl(); } else if (fEntityScanner.skipString("NOTATION")) { scanNotationDecl(); } else if (fEntityScanner.skipChar('[', null) && !scanningInternalSubset()) { scanConditionalSect(fPEDepth); } else { fMarkUpDepth--; reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null); } } else { fMarkUpDepth--; reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null); } } else if (fIncludeSectDepth > 0 && fEntityScanner.skipChar(']', null)) { // end of conditional section? if (!fEntityScanner.skipChar(']', null) || !fEntityScanner.skipChar('>', null)) { reportFatalError("IncludeSectUnterminated", null); } // call handler if (fDTDHandler != null) { fDTDHandler.endConditional(null); } // decreaseMarkupDepth(); fIncludeSectDepth--; fMarkUpDepth--; } else if (scanningInternalSubset() && fEntityScanner.peekChar() == ']') { // this is the end of the internal subset, let's stop here return false; } else if (fEntityScanner.skipSpaces()) { // simply skip } else { reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null); } skipSeparator(false, true); } return fScannerState != SCANNER_STATE_END_OF_INPUT; }
final boolean function(boolean complete) throws IOException, XNIException { skipSeparator(false, true); boolean again = true; while (again && fScannerState == SCANNER_STATE_MARKUP_DECL) { again = complete; if (fEntityScanner.skipChar('<', null)) { fMarkUpDepth++; if (fEntityScanner.skipChar('?', null)) { fStringBuffer.clear(); scanPI(fStringBuffer); fMarkUpDepth--; } else if (fEntityScanner.skipChar('!', null)) { if (fEntityScanner.skipChar('-', null)) { if (!fEntityScanner.skipChar('-', null)) { reportFatalError(STR, null); } else { scanComment(); } } else if (fEntityScanner.skipString(STR)) { scanElementDecl(); } else if (fEntityScanner.skipString(STR)) { scanAttlistDecl(); } else if (fEntityScanner.skipString(STR)) { scanEntityDecl(); } else if (fEntityScanner.skipString(STR)) { scanNotationDecl(); } else if (fEntityScanner.skipChar('[', null) && !scanningInternalSubset()) { scanConditionalSect(fPEDepth); } else { fMarkUpDepth--; reportFatalError(STR, null); } } else { fMarkUpDepth--; reportFatalError(STR, null); } } else if (fIncludeSectDepth > 0 && fEntityScanner.skipChar(']', null)) { if (!fEntityScanner.skipChar(']', null) !fEntityScanner.skipChar('>', null)) { reportFatalError(STR, null); } if (fDTDHandler != null) { fDTDHandler.endConditional(null); } fIncludeSectDepth--; fMarkUpDepth--; } else if (scanningInternalSubset() && fEntityScanner.peekChar() == ']') { return false; } else if (fEntityScanner.skipSpaces()) { } else { reportFatalError(STR, null); } skipSeparator(false, true); } return fScannerState != SCANNER_STATE_END_OF_INPUT; }
/** * Dispatch an XML "event". * * @param complete True if this method is intended to scan * and dispatch as much as possible. * * @return True if there is more to scan. * * @throws IOException Thrown on i/o error. * @throws XNIException Thrown on parse error. * */
Dispatch an XML "event"
scanDecls
{ "repo_name": "FauxFaux/jdk9-jaxp", "path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java", "license": "gpl-2.0", "size": 80825 }
[ "com.sun.org.apache.xerces.internal.xni.XNIException", "java.io.IOException" ]
import com.sun.org.apache.xerces.internal.xni.XNIException; import java.io.IOException;
import com.sun.org.apache.xerces.internal.xni.*; import java.io.*;
[ "com.sun.org", "java.io" ]
com.sun.org; java.io;
1,381,013
public org.omg.CORBA.TypeCode _type() { return DynAnySeqHelper.type(); }
org.omg.CORBA.TypeCode function() { return DynAnySeqHelper.type(); }
/** * Get the typecode of the DynAny. */
Get the typecode of the DynAny
_type
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/gnu/CORBA/DynAnySeqHolder.java", "license": "gpl-2.0", "size": 3521 }
[ "org.omg.DynamicAny" ]
import org.omg.DynamicAny;
import org.omg.*;
[ "org.omg" ]
org.omg;
2,135,500
@Override public void exitImportDeclaration(@NotNull Java7Parser.ImportDeclarationContext ctx) { }
@Override public void exitImportDeclaration(@NotNull Java7Parser.ImportDeclarationContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterImportDeclaration
{ "repo_name": "jsteenbeeke/antlr-java-parser", "path": "src/main/java/com/github/antlrjavaparser/Java7ParserBaseListener.java", "license": "lgpl-3.0", "size": 53492 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,899,236
@Override public Set<Type> getTypes() { return null; }
Set<Type> function() { return null; }
/** * Returns the types that the bean implements */
Returns the types that the bean implements
getTypes
{ "repo_name": "dlitz/resin", "path": "modules/kernel/src/com/caucho/config/inject/InterceptorRuntimeBean.java", "license": "gpl-2.0", "size": 11455 }
[ "java.lang.reflect.Type", "java.util.Set" ]
import java.lang.reflect.Type; import java.util.Set;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,218,466
public EnvironmentLandAndWaterAreaClient landAndWaterArea() { return (EnvironmentLandAndWaterAreaClient) getClient("landandwaterarea"); }
EnvironmentLandAndWaterAreaClient function() { return (EnvironmentLandAndWaterAreaClient) getClient(STR); }
/** * <p>Retrieve the client for interacting with environment land and water area * data.</p> * * @return a client for environment land and water area data */
Retrieve the client for interacting with environment land and water area data
landAndWaterArea
{ "repo_name": "dannil/scb-api", "path": "src/main/java/com/github/dannil/scbjavaclient/client/environment/EnvironmentClient.java", "license": "apache-2.0", "size": 8071 }
[ "com.github.dannil.scbjavaclient.client.environment.landandwaterarea.EnvironmentLandAndWaterAreaClient" ]
import com.github.dannil.scbjavaclient.client.environment.landandwaterarea.EnvironmentLandAndWaterAreaClient;
import com.github.dannil.scbjavaclient.client.environment.landandwaterarea.*;
[ "com.github.dannil" ]
com.github.dannil;
2,412,050
private void setResponseHeader(final RequestContext context) { final Credential credential = WebUtils.getCredential(context); if (credential == null) { LOGGER.debug("No credential was provided. No response header set."); return; } final HttpServletResponse response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); final SpnegoCredential spnegoCredentials = (SpnegoCredential) credential; final byte[] nextToken = spnegoCredentials.getNextToken(); if (nextToken != null) { LOGGER.debug("Obtained output token: [{}]", new String(nextToken, Charset.defaultCharset())); response.setHeader(SpnegoConstants.HEADER_AUTHENTICATE, (this.ntlm ? SpnegoConstants.NTLM : SpnegoConstants.NEGOTIATE) + ' ' + EncodingUtils.encodeBase64(nextToken)); } else { LOGGER.debug("Unable to obtain the output token required."); } if (spnegoCredentials.getPrincipal() == null && this.send401OnAuthenticationFailure) { LOGGER.debug("Setting HTTP Status to 401"); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); } }
void function(final RequestContext context) { final Credential credential = WebUtils.getCredential(context); if (credential == null) { LOGGER.debug(STR); return; } final HttpServletResponse response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); final SpnegoCredential spnegoCredentials = (SpnegoCredential) credential; final byte[] nextToken = spnegoCredentials.getNextToken(); if (nextToken != null) { LOGGER.debug(STR, new String(nextToken, Charset.defaultCharset())); response.setHeader(SpnegoConstants.HEADER_AUTHENTICATE, (this.ntlm ? SpnegoConstants.NTLM : SpnegoConstants.NEGOTIATE) + ' ' + EncodingUtils.encodeBase64(nextToken)); } else { LOGGER.debug(STR); } if (spnegoCredentials.getPrincipal() == null && this.send401OnAuthenticationFailure) { LOGGER.debug(STR); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); } }
/** * Sets the response header based on the retrieved token. * * @param context the context */
Sets the response header based on the retrieved token
setResponseHeader
{ "repo_name": "Unicon/cas", "path": "support/cas-server-support-spnego-webflow/src/main/java/org/apereo/cas/web/flow/SpnegoCredentialsAction.java", "license": "apache-2.0", "size": 5867 }
[ "java.nio.charset.Charset", "javax.servlet.http.HttpServletResponse", "org.apereo.cas.authentication.Credential", "org.apereo.cas.support.spnego.authentication.principal.SpnegoCredential", "org.apereo.cas.support.spnego.util.SpnegoConstants", "org.apereo.cas.util.EncodingUtils", "org.apereo.cas.web.support.WebUtils", "org.springframework.webflow.execution.RequestContext" ]
import java.nio.charset.Charset; import javax.servlet.http.HttpServletResponse; import org.apereo.cas.authentication.Credential; import org.apereo.cas.support.spnego.authentication.principal.SpnegoCredential; import org.apereo.cas.support.spnego.util.SpnegoConstants; import org.apereo.cas.util.EncodingUtils; import org.apereo.cas.web.support.WebUtils; import org.springframework.webflow.execution.RequestContext;
import java.nio.charset.*; import javax.servlet.http.*; import org.apereo.cas.authentication.*; import org.apereo.cas.support.spnego.authentication.principal.*; import org.apereo.cas.support.spnego.util.*; import org.apereo.cas.util.*; import org.apereo.cas.web.support.*; import org.springframework.webflow.execution.*;
[ "java.nio", "javax.servlet", "org.apereo.cas", "org.springframework.webflow" ]
java.nio; javax.servlet; org.apereo.cas; org.springframework.webflow;
209,427
List<String> getGroupAuths(String[] groups, boolean systemCall) throws IOException;
List<String> getGroupAuths(String[] groups, boolean systemCall) throws IOException;
/** * Retrieve the visibility labels for the groups. * @param groups * Name of the groups whose authorization to be retrieved * @param systemCall * Whether a system or user originated call. * @return Visibility labels authorized for the given group. */
Retrieve the visibility labels for the groups
getGroupAuths
{ "repo_name": "grokcoder/pbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityLabelService.java", "license": "apache-2.0", "size": 9028 }
[ "java.io.IOException", "java.util.List" ]
import java.io.IOException; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,572,077
private OpenStackUser getCredentials() { if (systemPropertiesProvider.getProperty(SystemPropertiesProvider.CLOUD_SYSTEM).equals("FIWARE")) { return (OpenStackUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); } else { return null; } }
OpenStackUser function() { if (systemPropertiesProvider.getProperty(SystemPropertiesProvider.CLOUD_SYSTEM).equals(STR)) { return (OpenStackUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); } else { return null; } }
/** * Get the Credentials (FIWARE) from the Spring SecurityContext */
Get the Credentials (FIWARE) from the Spring SecurityContext
getCredentials
{ "repo_name": "hmunfru/fiware-sdc", "path": "rest-api/src/main/java/com/telefonica/euro_iaas/sdc/rest/validation/ProductInstanceResourceValidatorImpl.java", "license": "apache-2.0", "size": 6345 }
[ "com.telefonica.euro_iaas.sdc.model.dto.OpenStackUser", "com.telefonica.euro_iaas.sdc.util.SystemPropertiesProvider", "org.springframework.security.core.context.SecurityContextHolder" ]
import com.telefonica.euro_iaas.sdc.model.dto.OpenStackUser; import com.telefonica.euro_iaas.sdc.util.SystemPropertiesProvider; import org.springframework.security.core.context.SecurityContextHolder;
import com.telefonica.euro_iaas.sdc.model.dto.*; import com.telefonica.euro_iaas.sdc.util.*; import org.springframework.security.core.context.*;
[ "com.telefonica.euro_iaas", "org.springframework.security" ]
com.telefonica.euro_iaas; org.springframework.security;
2,432,885
public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException;
T function(PreparedQuery<T> preparedQuery) throws SQLException;
/** * Query for and return the first item in the object table which matches the PreparedQuery. See * {@link #queryBuilder()} for more information. This can be used to return the object that matches a single unique * column. You should use {@link #queryForId(Object)} if you want to query for the id column. * * @param preparedQuery * Query used to match the objects in the database. * @return The first object that matches the query. * @throws SQLException * on any SQL problems. */
Query for and return the first item in the object table which matches the PreparedQuery. See <code>#queryBuilder()</code> for more information. This can be used to return the object that matches a single unique column. You should use <code>#queryForId(Object)</code> if you want to query for the id column
queryForFirst
{ "repo_name": "dankito/ormlite-jpa-core", "path": "src/main/java/com/j256/ormlite/dao/Dao.java", "license": "isc", "size": 36726 }
[ "com.j256.ormlite.stmt.PreparedQuery", "java.sql.SQLException" ]
import com.j256.ormlite.stmt.PreparedQuery; import java.sql.SQLException;
import com.j256.ormlite.stmt.*; import java.sql.*;
[ "com.j256.ormlite", "java.sql" ]
com.j256.ormlite; java.sql;
863,534
public static ArrayList<Phone> getPhones(String searchedText) { ArrayList<Phone> res = new ArrayList<Phone>(); if (isCellPhoneNumber(searchedText)) { Phone phone = new Phone(); phone.number = searchedText; phone.cleanNumber = cleanPhoneNumber(phone.number); phone.contactName = getContactName(searchedText); phone.isCellPhoneNumber = true; phone.type = Contacts.Phones.TYPE_MOBILE; res.add(phone); } else { // get the matching contacts, dictionary of < id, names > ArrayList<Contact> contacts = getMatchingContacts(searchedText); if (contacts.size() > 0) { for (Contact contact : contacts) { ArrayList<Phone> phones = getPhones(contact.id); for (Phone phone : phones) { phone.contactName = getContactName(contact.name); res.add(phone); } } } } return res; }
static ArrayList<Phone> function(String searchedText) { ArrayList<Phone> res = new ArrayList<Phone>(); if (isCellPhoneNumber(searchedText)) { Phone phone = new Phone(); phone.number = searchedText; phone.cleanNumber = cleanPhoneNumber(phone.number); phone.contactName = getContactName(searchedText); phone.isCellPhoneNumber = true; phone.type = Contacts.Phones.TYPE_MOBILE; res.add(phone); } else { ArrayList<Contact> contacts = getMatchingContacts(searchedText); if (contacts.size() > 0) { for (Contact contact : contacts) { ArrayList<Phone> phones = getPhones(contact.id); for (Phone phone : phones) { phone.contactName = getContactName(contact.name); res.add(phone); } } } } return res; }
/** * Returns a ArrayList < Phone > * with all matching phones for the argument */
Returns a ArrayList with all matching phones for the argument
getPhones
{ "repo_name": "alexsalas/talkmyphone", "path": "src/com/googlecode/talkmyphone/contacts/ContactsManager.java", "license": "gpl-3.0", "size": 8605 }
[ "android.provider.Contacts", "java.util.ArrayList" ]
import android.provider.Contacts; import java.util.ArrayList;
import android.provider.*; import java.util.*;
[ "android.provider", "java.util" ]
android.provider; java.util;
1,429,677
protected void setAlgorithmForce(final String alg) { if (StringUtils.isNotBlank(alg)) { LOGGER.debug("Configured Jasypt algorithm [{}]", alg); jasyptInstance.setAlgorithm(alg); } }
void function(final String alg) { if (StringUtils.isNotBlank(alg)) { LOGGER.debug(STR, alg); jasyptInstance.setAlgorithm(alg); } }
/** * Sets algorithm (possibly to bad algorithm, for unit test usage). * * @param alg the alg */
Sets algorithm (possibly to bad algorithm, for unit test usage)
setAlgorithmForce
{ "repo_name": "rkorn86/cas", "path": "api/cas-server-core-api-configuration-model/src/main/java/org/apereo/cas/configuration/support/CasConfigurationJasyptCipherExecutor.java", "license": "apache-2.0", "size": 9252 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
1,523,328
public TimePeriod getDelay() { return _delay; }
TimePeriod function() { return _delay; }
/** * Gets delay. * @return return delay */
Gets delay
getDelay
{ "repo_name": "GeoinformationSystems/GeoprocessingAppstore", "path": "src/com/esri/gpt/framework/scheduler/ThreadDefinition.java", "license": "apache-2.0", "size": 7682 }
[ "com.esri.gpt.framework.util.TimePeriod" ]
import com.esri.gpt.framework.util.TimePeriod;
import com.esri.gpt.framework.util.*;
[ "com.esri.gpt" ]
com.esri.gpt;
991,214
protected void createContents() { shlMojoLoader = new Shell(); shlMojoLoader.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/icon.png")); shlMojoLoader.setSize(450, 178); shlMojoLoader.setMinimumSize(450, 178); shlMojoLoader.setText("Mojo Loader Version " + VERSION); GridLayout gl_shlMojoLoader = new GridLayout(4, false); gl_shlMojoLoader.marginHeight = 10; gl_shlMojoLoader.marginWidth = 10; shlMojoLoader.setLayout(gl_shlMojoLoader); Label lblNewLabel = new Label(shlMojoLoader, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel.setText("Serial Port:");
void function() { shlMojoLoader = new Shell(); shlMojoLoader.setImage(SWTResourceManager.getImage(MainWindow.class, STR)); shlMojoLoader.setSize(450, 178); shlMojoLoader.setMinimumSize(450, 178); shlMojoLoader.setText(STR + VERSION); GridLayout gl_shlMojoLoader = new GridLayout(4, false); gl_shlMojoLoader.marginHeight = 10; gl_shlMojoLoader.marginWidth = 10; shlMojoLoader.setLayout(gl_shlMojoLoader); Label lblNewLabel = new Label(shlMojoLoader, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel.setText(STR);
/** * Create contents of the window. * @wbp.parser.entryPoint */
Create contents of the window
createContents
{ "repo_name": "embmicro/mojo-loader", "path": "src/com/embeddedmicro/mojo/MainWindow.java", "license": "mit", "size": 7337 }
[ "org.eclipse.swt.layout.GridData", "org.eclipse.swt.layout.GridLayout", "org.eclipse.swt.widgets.Label", "org.eclipse.swt.widgets.Shell", "org.eclipse.wb.swt.SWTResourceManager" ]
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.wb.swt.*;
[ "org.eclipse.swt", "org.eclipse.wb" ]
org.eclipse.swt; org.eclipse.wb;
765,845
clientBuilderWithInvalidApiKeyCredentialRunner(httpClient, serviceVersion, clientBuilder -> (input, output) -> assertThrows(output.getClass(), () -> clientBuilder.buildClient().getAccountProperties())); }
clientBuilderWithInvalidApiKeyCredentialRunner(httpClient, serviceVersion, clientBuilder -> (input, output) -> assertThrows(output.getClass(), () -> clientBuilder.buildClient().getAccountProperties())); }
/** * Test client builder with invalid API key */
Test client builder with invalid API key
trainingClientBuilderInvalidKeyCredential
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientBuilderTest.java", "license": "mit", "size": 10024 }
[ "org.junit.jupiter.api.Assertions" ]
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.*;
[ "org.junit.jupiter" ]
org.junit.jupiter;
2,023,348
public Properties defaultOutputProperties() { Properties properties = new Properties(); properties.put(OutputKeys.ENCODING, defaultCharset); properties.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); return properties; }
Properties function() { Properties properties = new Properties(); properties.put(OutputKeys.ENCODING, defaultCharset); properties.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); return properties; }
/** * Returns the default set of output properties for conversions. */
Returns the default set of output properties for conversions
defaultOutputProperties
{ "repo_name": "chicagozer/rheosoft", "path": "camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java", "license": "apache-2.0", "size": 29472 }
[ "java.util.Properties", "javax.xml.transform.OutputKeys" ]
import java.util.Properties; import javax.xml.transform.OutputKeys;
import java.util.*; import javax.xml.transform.*;
[ "java.util", "javax.xml" ]
java.util; javax.xml;
1,765,107
@Override public Number parse(String source) throws ParseException { return Strings.isBlank(source) ? emptyValue : super.parse(source); }
Number function(String source) throws ParseException { return Strings.isBlank(source) ? emptyValue : super.parse(source); }
/** * {@inheritDoc}<p> * * If {@code source} is empty or whitespace, the <em>emptyValue</em> * is returned. Otherwise parsing is forwarded to the delegate * - indirectly via {@link #parse(String, ParsePosition)}. */
If source is empty or whitespace, the emptyValue is returned. Otherwise parsing is forwarded to the delegate - indirectly via <code>#parse(String, ParsePosition)</code>
parse
{ "repo_name": "javachen/IBMDataMovementTool", "path": "src/com/jgoodies/common/format/EmptyNumberFormat.java", "license": "apache-2.0", "size": 6193 }
[ "com.jgoodies.common.base.Strings", "java.text.ParseException" ]
import com.jgoodies.common.base.Strings; import java.text.ParseException;
import com.jgoodies.common.base.*; import java.text.*;
[ "com.jgoodies.common", "java.text" ]
com.jgoodies.common; java.text;
1,794,977
private static byte[] toPNG(Bitmap image) throws IOException { int imageSize = image.getWidth() * image.getHeight(); int[] rgbs = new int[imageSize]; byte[] a, r, g, b; int colorToDecode; image.getARGB(rgbs, 0, image.getWidth() , 0, 0, image.getWidth(), image.getHeight()); a = new byte[imageSize]; r = new byte[imageSize]; g = new byte[imageSize]; b = new byte[imageSize]; for (int i = 0; i < imageSize; i++) { colorToDecode = rgbs[i]; a[i] = (byte) ((colorToDecode & 0xFF000000) >>> 24); r[i] = (byte) ((colorToDecode & 0x00FF0000) >>> 16); g[i] = (byte) ((colorToDecode & 0x0000FF00) >>> 8); b[i] = (byte) ((colorToDecode & 0x000000FF)); } return MinimalPNGEncoder.toPNG(image.getWidth(), image.getHeight(), a, r, g, b); }
static byte[] function(Bitmap image) throws IOException { int imageSize = image.getWidth() * image.getHeight(); int[] rgbs = new int[imageSize]; byte[] a, r, g, b; int colorToDecode; image.getARGB(rgbs, 0, image.getWidth() , 0, 0, image.getWidth(), image.getHeight()); a = new byte[imageSize]; r = new byte[imageSize]; g = new byte[imageSize]; b = new byte[imageSize]; for (int i = 0; i < imageSize; i++) { colorToDecode = rgbs[i]; a[i] = (byte) ((colorToDecode & 0xFF000000) >>> 24); r[i] = (byte) ((colorToDecode & 0x00FF0000) >>> 16); g[i] = (byte) ((colorToDecode & 0x0000FF00) >>> 8); b[i] = (byte) ((colorToDecode & 0x000000FF)); } return MinimalPNGEncoder.toPNG(image.getWidth(), image.getHeight(), a, r, g, b); }
/** * Returns a PNG stored in a byte array from the supplied Bitmap. * * @param image an Bitmap object * @return a byte array containing PNG data * @throws IOException * */
Returns a PNG stored in a byte array from the supplied Bitmap
toPNG
{ "repo_name": "wordpress-mobile/WordPress-BlackBerry-Legacy", "path": "src/com/wordpress/utils/ImageUtils.java", "license": "gpl-2.0", "size": 10405 }
[ "java.io.IOException", "net.rim.device.api.system.Bitmap" ]
import java.io.IOException; import net.rim.device.api.system.Bitmap;
import java.io.*; import net.rim.device.api.system.*;
[ "java.io", "net.rim.device" ]
java.io; net.rim.device;
71,804
private static void copyIfNotPresent(Configuration config, String deprecatedKey, String newKey) { String deprecatedValue = config.get(deprecatedKey); if (config.get(newKey) == null && deprecatedValue != null) { LOG.warn( "Key {} is deprecated. Copying the value of key {} to new key {}", deprecatedKey, deprecatedKey, newKey); config.set(newKey, deprecatedValue); } }
static void function(Configuration config, String deprecatedKey, String newKey) { String deprecatedValue = config.get(deprecatedKey); if (config.get(newKey) == null && deprecatedValue != null) { LOG.warn( STR, deprecatedKey, deprecatedKey, newKey); config.set(newKey, deprecatedValue); } }
/** * Copy the value of the deprecated key to the new key if a value is present for the deprecated * key, but not the new key. */
Copy the value of the deprecated key to the new key if a value is present for the deprecated key, but not the new key
copyIfNotPresent
{ "repo_name": "peltekster/bigdata-interop-leanplum", "path": "gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java", "license": "apache-2.0", "size": 72488 }
[ "org.apache.hadoop.conf.Configuration" ]
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,983,565
EClass getExitEvent();
EClass getExitEvent();
/** * Returns the meta object for class '{@link org.yakindu.sct.model.stext.stext.ExitEvent <em>Exit Event</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Exit Event</em>'. * @see org.yakindu.sct.model.stext.stext.ExitEvent * @generated */
Returns the meta object for class '<code>org.yakindu.sct.model.stext.stext.ExitEvent Exit Event</code>'.
getExitEvent
{ "repo_name": "Yakindu/statecharts", "path": "plugins/org.yakindu.sct.model.stext/emf-gen/org/yakindu/sct/model/stext/stext/StextPackage.java", "license": "epl-1.0", "size": 92325 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,525,165
@Test public void detectBroadphase() { List<BroadphasePair<CollidableTest>> pairs; // create some collidables CollidableTest ct1 = new CollidableTest(c1); CollidableTest ct2 = new CollidableTest(c2); this.sapI.add(ct1); this.sapI.add(ct2); this.sapBF.add(ct1); this.sapBF.add(ct2); this.sapT.add(ct1); this.sapT.add(ct2); this.dynT.add(ct1); this.dynT.add(ct2); // test containment pairs = this.sapI.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapBF.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapT.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.dynT.detect(); TestCase.assertEquals(1, pairs.size()); // test overlap ct1.translate(-1.0, 0.0); this.sapI.update(ct1); this.sapBF.update(ct1); this.sapT.update(ct1); this.dynT.update(ct1); pairs = this.sapI.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapBF.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapT.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.dynT.detect(); TestCase.assertEquals(1, pairs.size()); // test only AABB overlap ct2.translate(0.0, 1.5); this.sapI.update(ct2); this.sapBF.update(ct2); this.sapT.update(ct2); this.dynT.update(ct2); pairs = this.sapI.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapBF.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapT.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.dynT.detect(); TestCase.assertEquals(1, pairs.size()); // test no overlap ct1.translate(-1.0, 0.0); this.sapI.update(ct1); this.sapBF.update(ct1); this.sapT.update(ct1); this.dynT.update(ct1); pairs = this.sapI.detect(); TestCase.assertEquals(0, pairs.size()); pairs = this.sapBF.detect(); TestCase.assertEquals(0, pairs.size()); pairs = this.sapT.detect(); TestCase.assertEquals(0, pairs.size()); pairs = this.dynT.detect(); TestCase.assertEquals(0, pairs.size()); }
void function() { List<BroadphasePair<CollidableTest>> pairs; CollidableTest ct1 = new CollidableTest(c1); CollidableTest ct2 = new CollidableTest(c2); this.sapI.add(ct1); this.sapI.add(ct2); this.sapBF.add(ct1); this.sapBF.add(ct2); this.sapT.add(ct1); this.sapT.add(ct2); this.dynT.add(ct1); this.dynT.add(ct2); pairs = this.sapI.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapBF.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapT.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.dynT.detect(); TestCase.assertEquals(1, pairs.size()); ct1.translate(-1.0, 0.0); this.sapI.update(ct1); this.sapBF.update(ct1); this.sapT.update(ct1); this.dynT.update(ct1); pairs = this.sapI.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapBF.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapT.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.dynT.detect(); TestCase.assertEquals(1, pairs.size()); ct2.translate(0.0, 1.5); this.sapI.update(ct2); this.sapBF.update(ct2); this.sapT.update(ct2); this.dynT.update(ct2); pairs = this.sapI.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapBF.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.sapT.detect(); TestCase.assertEquals(1, pairs.size()); pairs = this.dynT.detect(); TestCase.assertEquals(1, pairs.size()); ct1.translate(-1.0, 0.0); this.sapI.update(ct1); this.sapBF.update(ct1); this.sapT.update(ct1); this.dynT.update(ct1); pairs = this.sapI.detect(); TestCase.assertEquals(0, pairs.size()); pairs = this.sapBF.detect(); TestCase.assertEquals(0, pairs.size()); pairs = this.sapT.detect(); TestCase.assertEquals(0, pairs.size()); pairs = this.dynT.detect(); TestCase.assertEquals(0, pairs.size()); }
/** * Tests the broadphase detectors. */
Tests the broadphase detectors
detectBroadphase
{ "repo_name": "satishbabusee/dyn4j", "path": "junit/org/dyn4j/collision/CircleCircleTest.java", "license": "bsd-3-clause", "size": 16007 }
[ "java.util.List", "junit.framework.TestCase", "org.dyn4j.collision.broadphase.BroadphasePair" ]
import java.util.List; import junit.framework.TestCase; import org.dyn4j.collision.broadphase.BroadphasePair;
import java.util.*; import junit.framework.*; import org.dyn4j.collision.broadphase.*;
[ "java.util", "junit.framework", "org.dyn4j.collision" ]
java.util; junit.framework; org.dyn4j.collision;
1,775,593
public void flush() throws IOException { this.accumulator.flush(); }
void function() throws IOException { this.accumulator.flush(); }
/** * Flushes all pending writes */
Flushes all pending writes
flush
{ "repo_name": "jack-moseley/gobblin", "path": "gobblin-core-base/src/main/java/org/apache/gobblin/writer/BufferedAsyncDataWriter.java", "license": "apache-2.0", "size": 6659 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
242,758
public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; // Call a static method for drawing picture 2 switch (this.whichPicture) { case 1: AllMyDrawings.drawPicture1(g2); break; case 2: AllMyDrawings.drawPicture2(g2); break; case 3: AllMyDrawings.drawPicture3(g2); break; default: throw new IllegalArgumentException("Unknown value for whichPicture in MultiPictureComponent" + this.whichPicture); } // switch } // paintComponent
void function(Graphics g) { Graphics2D g2 = (Graphics2D) g; switch (this.whichPicture) { case 1: AllMyDrawings.drawPicture1(g2); break; case 2: AllMyDrawings.drawPicture2(g2); break; case 3: AllMyDrawings.drawPicture3(g2); break; default: throw new IllegalArgumentException(STR + this.whichPicture); } }
/** The paintComponent method is always required if you want * any graphics to appear in your JComponent. * * There is a paintComponent * method that is created for you in the JComponent class, but it * doesn't do what we want, so we have to "override" that method with * our own method. */
The paintComponent method is always required if you want any graphics to appear in your JComponent. There is a paintComponent method that is created for you in the JComponent class, but it doesn't do what we want, so we have to "override" that method with our own method
paintComponent
{ "repo_name": "UCSB-CS56-W15/W15-lab04", "path": "src/edu/ucsb/cs56/w15/drawings/jazariethach/advanced/MultiPictureComponent.java", "license": "mit", "size": 2035 }
[ "java.awt.Graphics", "java.awt.Graphics2D" ]
import java.awt.Graphics; import java.awt.Graphics2D;
import java.awt.*;
[ "java.awt" ]
java.awt;
475,472
private void rebalance(final Cache cache) { if (isRebalancing()) { cache.getResourceManager().createRebalanceFactory().start(); } }
void function(final Cache cache) { if (isRebalancing()) { cache.getResourceManager().createRebalanceFactory().start(); } }
/** * Causes a rebalance operation to occur on the given Cache. * * @param cache the reference to the Cache to rebalance. * @see ResourceManager#createRebalanceFactory() */
Causes a rebalance operation to occur on the given Cache
rebalance
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java", "license": "apache-2.0", "size": 107004 }
[ "org.apache.geode.cache.Cache" ]
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.*;
[ "org.apache.geode" ]
org.apache.geode;
1,339,661
@Test public void testGetVerb () { assertEquals(Verb.POST, showGrade.getVerb()); assertEquals(Verb.POST, showGradeTVDB.getVerb()); }
void function () { assertEquals(Verb.POST, showGrade.getVerb()); assertEquals(Verb.POST, showGradeTVDB.getVerb()); }
/** * Test method for {@link Request#getVerb()}. */
Test method for <code>Request#getVerb()</code>
testGetVerb
{ "repo_name": "AlexRNL/jSeries", "path": "src/test/java/com/alexrnl/jseries/request/shows/ShowGradeTest.java", "license": "bsd-3-clause", "size": 1645 }
[ "com.alexrnl.jseries.request.Verb", "org.junit.Assert" ]
import com.alexrnl.jseries.request.Verb; import org.junit.Assert;
import com.alexrnl.jseries.request.*; import org.junit.*;
[ "com.alexrnl.jseries", "org.junit" ]
com.alexrnl.jseries; org.junit;
2,537,282
public void runInCurrentThread( final BuckCommandHandler handler, @Nullable final Runnable postStartAction) { handler.runInCurrentThread(postStartAction); }
void function( final BuckCommandHandler handler, @Nullable final Runnable postStartAction) { handler.runInCurrentThread(postStartAction); }
/** * Run handler in the current thread. * * @param handler a handler to run * @param postStartAction an action that is executed */
Run handler in the current thread
runInCurrentThread
{ "repo_name": "JoelMarcey/buck", "path": "tools/ideabuck/src/com/facebook/buck/intellij/ideabuck/build/BuckBuildManager.java", "license": "apache-2.0", "size": 7609 }
[ "org.jetbrains.annotations.Nullable" ]
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
622,209