method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
protected InputStream getResourceInputStream(final Resource resource, final String entityId) throws IOException { LOGGER.debug("Locating metadata resource from input stream."); if (!resource.exists() || !resource.isReadable()) { throw new FileNotFoundException("Resource does not exist or is unreadable"); } return resource.getInputStream(); }
InputStream function(final Resource resource, final String entityId) throws IOException { LOGGER.debug(STR); if (!resource.exists() !resource.isReadable()) { throw new FileNotFoundException(STR); } return resource.getInputStream(); }
/** * Retrieve the remote source's input stream to parse data. * * @param resource the resource * @param entityId the entity id * @return the input stream * @throws IOException if stream cannot be read */
Retrieve the remote source's input stream to parse data
getResourceInputStream
{ "repo_name": "pmarasse/cas", "path": "support/cas-server-support-saml-mdui-core/src/main/java/org/apereo/cas/support/saml/mdui/AbstractMetadataResolverAdapter.java", "license": "apache-2.0", "size": 8333 }
[ "java.io.FileNotFoundException", "java.io.IOException", "java.io.InputStream", "org.springframework.core.io.Resource" ]
import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import org.springframework.core.io.Resource;
import java.io.*; import org.springframework.core.io.*;
[ "java.io", "org.springframework.core" ]
java.io; org.springframework.core;
115,860
@ApiModelProperty(value = "The unique ID of the wallet") public Integer getId() { return id; }
@ApiModelProperty(value = STR) Integer function() { return id; }
/** * The unique ID of the wallet * @return id **/
The unique ID of the wallet
getId
{ "repo_name": "knetikmedia/knetikcloud-java-client", "path": "src/main/java/com/knetikcloud/model/SimpleWallet.java", "license": "apache-2.0", "size": 4583 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,896,050
public void testFromXContent() throws IOException { SmoothingModel testModel = createTestModel(); XContentBuilder contentBuilder = XContentFactory.contentBuilder(randomFrom(XContentType.values())); if (randomBoolean()) { contentBuilder.prettyPrint(); } contentBuilder.startObject(); testModel.innerToXContent(contentBuilder, ToXContent.EMPTY_PARAMS); contentBuilder.endObject(); try (XContentParser parser = createParser(shuffleXContent(contentBuilder))) { parser.nextToken(); // go to start token, real parsing would do that in the outer element parser SmoothingModel parsedModel = fromXContent(parser); assertNotSame(testModel, parsedModel); assertEquals(testModel, parsedModel); assertEquals(testModel.hashCode(), parsedModel.hashCode()); } }
void function() throws IOException { SmoothingModel testModel = createTestModel(); XContentBuilder contentBuilder = XContentFactory.contentBuilder(randomFrom(XContentType.values())); if (randomBoolean()) { contentBuilder.prettyPrint(); } contentBuilder.startObject(); testModel.innerToXContent(contentBuilder, ToXContent.EMPTY_PARAMS); contentBuilder.endObject(); try (XContentParser parser = createParser(shuffleXContent(contentBuilder))) { parser.nextToken(); SmoothingModel parsedModel = fromXContent(parser); assertNotSame(testModel, parsedModel); assertEquals(testModel, parsedModel); assertEquals(testModel.hashCode(), parsedModel.hashCode()); } }
/** * Test that creates new smoothing model from a random test smoothing model and checks both for equality */
Test that creates new smoothing model from a random test smoothing model and checks both for equality
testFromXContent
{ "repo_name": "GlenRSmith/elasticsearch", "path": "server/src/test/java/org/elasticsearch/search/suggest/phrase/SmoothingModelTestCase.java", "license": "apache-2.0", "size": 5861 }
[ "java.io.IOException", "org.elasticsearch.xcontent.ToXContent", "org.elasticsearch.xcontent.XContentBuilder", "org.elasticsearch.xcontent.XContentFactory", "org.elasticsearch.xcontent.XContentParser", "org.elasticsearch.xcontent.XContentType" ]
import java.io.IOException; import org.elasticsearch.xcontent.ToXContent; import org.elasticsearch.xcontent.XContentBuilder; import org.elasticsearch.xcontent.XContentFactory; import org.elasticsearch.xcontent.XContentParser; import org.elasticsearch.xcontent.XContentType;
import java.io.*; import org.elasticsearch.xcontent.*;
[ "java.io", "org.elasticsearch.xcontent" ]
java.io; org.elasticsearch.xcontent;
427,589
@JSFunction public static String decrypt(String aString, Object key) throws Exception { if (key == null || key instanceof Undefined) key = AFBase.K; if (key instanceof String) key = ((String) key).getBytes(); if (((byte[]) key).length < 16) throw new Exception("Invalid key size. Key should be, at least, 16 bytes."); String initVector = aString.substring(aString.length() - 32); IvParameterSpec iv = new IvParameterSpec(Hex.decodeHex(initVector.toCharArray())); SecretKeySpec skeySpec = new SecretKeySpec((byte[]) key, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); byte[] original = cipher.doFinal(Hex.decodeHex(aString.substring(0, aString.length()-32).toCharArray())); return new String(original); }
static String function(String aString, Object key) throws Exception { if (key == null key instanceof Undefined) key = AFBase.K; if (key instanceof String) key = ((String) key).getBytes(); if (((byte[]) key).length < 16) throw new Exception(STR); String initVector = aString.substring(aString.length() - 32); IvParameterSpec iv = new IvParameterSpec(Hex.decodeHex(initVector.toCharArray())); SecretKeySpec skeySpec = new SecretKeySpec((byte[]) key, "AES"); Cipher cipher = Cipher.getInstance(STR); cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); byte[] original = cipher.doFinal(Hex.decodeHex(aString.substring(0, aString.length()-32).toCharArray())); return new String(original); }
/** * <odoc> * <key>af.decrypt(aString, aKey) : String</key> * Decrypts the provided aString with the provided aKey. * </odoc> * @throws Exception */
af.decrypt(aString, aKey) : String Decrypts the provided aString with the provided aKey.
decrypt
{ "repo_name": "OpenAF/openaf", "path": "src/openaf/AFBase.java", "license": "apache-2.0", "size": 53748 }
[ "java.lang.String", "javax.crypto.Cipher", "javax.crypto.spec.IvParameterSpec", "javax.crypto.spec.SecretKeySpec", "org.apache.commons.codec.binary.Hex", "org.mozilla.javascript.Undefined" ]
import java.lang.String; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Hex; import org.mozilla.javascript.Undefined;
import java.lang.*; import javax.crypto.*; import javax.crypto.spec.*; import org.apache.commons.codec.binary.*; import org.mozilla.javascript.*;
[ "java.lang", "javax.crypto", "org.apache.commons", "org.mozilla.javascript" ]
java.lang; javax.crypto; org.apache.commons; org.mozilla.javascript;
1,381,453
private I getRaw(ResourceLocation loc) { I ret = superType.cast(super.getObject(loc)); if (ret == null) // no match, try aliases recursively { String name = aliases.get(loc.toString()); if (name != null) return getRaw(name); } return ret; }
I function(ResourceLocation loc) { I ret = superType.cast(super.getObject(loc)); if (ret == null) { String name = aliases.get(loc.toString()); if (name != null) return getRaw(name); } return ret; }
/** * Get the object identified by the specified name. * * @param name Block/Item name. * @return Block/Item object or null if it wasn't found. */
Get the object identified by the specified name
getRaw
{ "repo_name": "Vorquel/MinecraftForge", "path": "src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java", "license": "lgpl-2.1", "size": 23351 }
[ "net.minecraft.util.ResourceLocation" ]
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.*;
[ "net.minecraft.util" ]
net.minecraft.util;
2,498,340
@Test(timeout = 10000) public void coneTranslateGroupLightOnTest() { selectType(LodTestAbstractApp.ShapeType.Cone); setLight(true); moveGroup(STANDARD_DELTA); checkLod(getChangedLod(LodTestAbstractApp.ShapeType.Cone)); }
@Test(timeout = 10000) void function() { selectType(LodTestAbstractApp.ShapeType.Cone); setLight(true); moveGroup(STANDARD_DELTA); checkLod(getChangedLod(LodTestAbstractApp.ShapeType.Cone)); }
/** * Test for LOD of Cone(custom) with z-transltation of parent Group and with * light. */
Test for LOD of Cone(custom) with z-transltation of parent Group and with light
coneTranslateGroupLightOnTest
{ "repo_name": "teamfx/openjfx-8u-dev-tests", "path": "functional/3DTests/test/test/scenegraph/fx3d/lod/LodTests.java", "license": "gpl-2.0", "size": 23589 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,852,192
public Correlation getFirstAuthorityCorrelation(String tag, char firstIndicator, char secondIndicator, int categoryCode) throws DataAccessException { List l = null; if (categoryCode != 0) { l = find( "from AuthorityCorrelation as ac " + "where ac.key.marcTag = ? and " + "(ac.key.marcFirstIndicator = ? or ac.key.marcFirstIndicator in ('S', 'O')) and " + "(ac.key.marcSecondIndicator = ? or ac.key.marcSecondIndicator in ('S', 'O') ) and " + "ac.key.marcTagCategoryCode = ?", new Object[]{ tag, firstIndicator, secondIndicator, categoryCode}, new Type[]{ Hibernate.STRING, Hibernate.CHARACTER, Hibernate.CHARACTER, Hibernate.INTEGER}); } else { l = find( "from AuthorityCorrelation as ac " + "where ac.key.marcTag = ? and " + "(ac.key.marcFirstIndicator = ? or ac.key.marcFirstIndicator in ('S', 'O') )and " + "(ac.key.marcSecondIndicator = ? or ac.key.marcSecondIndicator in ('S', 'O') ) order by ac.key.marcTagCategoryCode asc", new Object[]{new String(tag), firstIndicator, secondIndicator}, new Type[]{ Hibernate.STRING, Hibernate.CHARACTER, Hibernate.CHARACTER}); } if (l != null && !l.isEmpty()) { return (Correlation) l.get(0); } else { return null; } }
Correlation function(String tag, char firstIndicator, char secondIndicator, int categoryCode) throws DataAccessException { List l = null; if (categoryCode != 0) { l = find( STR + STR + STR + STR + STR, new Object[]{ tag, firstIndicator, secondIndicator, categoryCode}, new Type[]{ Hibernate.STRING, Hibernate.CHARACTER, Hibernate.CHARACTER, Hibernate.INTEGER}); } else { l = find( STR + STR + STR + STR, new Object[]{new String(tag), firstIndicator, secondIndicator}, new Type[]{ Hibernate.STRING, Hibernate.CHARACTER, Hibernate.CHARACTER}); } if (l != null && !l.isEmpty()) { return (Correlation) l.get(0); } else { return null; } }
/** * Returns the Correlation based on MARC encoding and category code * * @param tag -- * marc tag * @param firstIndicator -- * marc first indicator * @param secondIndicator -- * marc second indicator * @param categoryCode -- * category code * @return a Correlation object or null when none found */
Returns the Correlation based on MARC encoding and category code
getFirstAuthorityCorrelation
{ "repo_name": "atcult/mod-cataloging", "path": "src/main/java/org/folio/marccat/dao/DAOAuthorityCorrelation.java", "license": "apache-2.0", "size": 12245 }
[ "java.util.List", "net.sf.hibernate.Hibernate", "net.sf.hibernate.type.Type", "org.folio.marccat.dao.persistence.Correlation", "org.folio.marccat.exception.DataAccessException" ]
import java.util.List; import net.sf.hibernate.Hibernate; import net.sf.hibernate.type.Type; import org.folio.marccat.dao.persistence.Correlation; import org.folio.marccat.exception.DataAccessException;
import java.util.*; import net.sf.hibernate.*; import net.sf.hibernate.type.*; import org.folio.marccat.dao.persistence.*; import org.folio.marccat.exception.*;
[ "java.util", "net.sf.hibernate", "org.folio.marccat" ]
java.util; net.sf.hibernate; org.folio.marccat;
794,439
public static String escape(String name) { String ret = cleanup(name); // Fix XSS issues ret = Encode.forHtml(ret); return ret; }
static String function(String name) { String ret = cleanup(name); ret = Encode.forHtml(ret); return ret; }
/** * Eliminate dangerous chars in node name. * TODO Keep on sync with uploader:com.openkm.applet.Util.escape(String) * TODO Keep on sync with wsImporter:com.openkm.importer.Util.escape(String) */
Eliminate dangerous chars in node name. TODO Keep on sync with uploader:com.openkm.applet.Util.escape(String) TODO Keep on sync with wsImporter:com.openkm.importer.Util.escape(String)
escape
{ "repo_name": "Beau-M/document-management-system", "path": "src/main/java/com/openkm/util/PathUtils.java", "license": "gpl-2.0", "size": 4372 }
[ "org.owasp.encoder.Encode" ]
import org.owasp.encoder.Encode;
import org.owasp.encoder.*;
[ "org.owasp.encoder" ]
org.owasp.encoder;
2,545,538
public void setLocale(String locale) { try { m_locale = LocaleUtils.toLocale(locale); } catch (IllegalArgumentException e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, "cms:navigation"), e); m_locale = null; } }
void function(String locale) { try { m_locale = LocaleUtils.toLocale(locale); } catch (IllegalArgumentException e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, STR), e); m_locale = null; } }
/** * Sets the locale for which the property should be read. * * @param locale the locale for which the property should be read. */
Sets the locale for which the property should be read
setLocale
{ "repo_name": "ggiudetti/opencms-core", "path": "src/org/opencms/jsp/CmsJspTagNavigation.java", "license": "lgpl-2.1", "size": 8416 }
[ "org.apache.commons.lang3.LocaleUtils" ]
import org.apache.commons.lang3.LocaleUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
57,158
private String getVersionInfo() { String versionName = ""; try { PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); versionName = packageInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return versionName; }
String function() { String versionName = ""; try { PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); versionName = packageInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return versionName; }
/** * Get the current version name of the app * @return the current version name (Ex. 1.2) */
Get the current version name of the app
getVersionInfo
{ "repo_name": "ravuthlong/BackpackerBuddyApp", "path": "app/src/main/java/ravtrix/backpackerbuddy/application/BaseApplication.java", "license": "apache-2.0", "size": 4300 }
[ "android.content.pm.PackageInfo", "android.content.pm.PackageManager" ]
import android.content.pm.PackageInfo; import android.content.pm.PackageManager;
import android.content.pm.*;
[ "android.content" ]
android.content;
994,680
private ParticipantId getLoggedInUser(Subject subject) throws InvalidParticipantAddress { String address = null; for (Principal p : subject.getPrincipals()) { // TODO(josephg): When we support other authentication types (LDAP, etc), // this method will need to read the address portion out of the other principal types. if (p instanceof ParticipantPrincipal) { address = ((ParticipantPrincipal) p).getName(); break; } else if (p instanceof X500Principal) { return attemptClientCertificateLogin((X500Principal)p); } } return address == null ? null : ParticipantId.of(address); }
ParticipantId function(Subject subject) throws InvalidParticipantAddress { String address = null; for (Principal p : subject.getPrincipals()) { if (p instanceof ParticipantPrincipal) { address = ((ParticipantPrincipal) p).getName(); break; } else if (p instanceof X500Principal) { return attemptClientCertificateLogin((X500Principal)p); } } return address == null ? null : ParticipantId.of(address); }
/** * Get the participant id of the given subject. * * The subject is searched for compatible principals. When other * authentication types are added, this method will need to be updated to * support their principal types. * * @throws InvalidParticipantAddress The subject's address is invalid */
Get the participant id of the given subject. The subject is searched for compatible principals. When other authentication types are added, this method will need to be updated to support their principal types
getLoggedInUser
{ "repo_name": "wisebaldone/incubator-wave", "path": "wave/src/main/java/org/waveprotocol/box/server/rpc/AuthenticationServlet.java", "license": "apache-2.0", "size": 16637 }
[ "java.security.Principal", "javax.security.auth.Subject", "javax.security.auth.x500.X500Principal", "org.waveprotocol.box.server.authentication.ParticipantPrincipal", "org.waveprotocol.wave.model.wave.InvalidParticipantAddress", "org.waveprotocol.wave.model.wave.ParticipantId" ]
import java.security.Principal; import javax.security.auth.Subject; import javax.security.auth.x500.X500Principal; import org.waveprotocol.box.server.authentication.ParticipantPrincipal; import org.waveprotocol.wave.model.wave.InvalidParticipantAddress; import org.waveprotocol.wave.model.wave.ParticipantId;
import java.security.*; import javax.security.auth.*; import javax.security.auth.x500.*; import org.waveprotocol.box.server.authentication.*; import org.waveprotocol.wave.model.wave.*;
[ "java.security", "javax.security", "org.waveprotocol.box", "org.waveprotocol.wave" ]
java.security; javax.security; org.waveprotocol.box; org.waveprotocol.wave;
752,316
public ApiResponse<List<String>> kinaseGroupsGetWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = kinaseGroupsGetCall(null, null); Type localVarReturnType = new TypeToken<List<String>>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
ApiResponse<List<String>> function() throws ApiException { com.squareup.okhttp.Call call = kinaseGroupsGetCall(null, null); Type localVarReturnType = new TypeToken<List<String>>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
/** * Kinase groups * The Kinase groups endpoint returns a list of all available kinase groups in KLIFS. * @return ApiResponse&lt;List&lt;String&gt;&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */
Kinase groups The Kinase groups endpoint returns a list of all available kinase groups in KLIFS
kinaseGroupsGetWithHttpInfo
{ "repo_name": "3D-e-Chem/knime-klifs", "path": "nl.vu_compmedchem.klifs.client/src/main/java/io/swagger/client/api/InformationApi.java", "license": "apache-2.0", "size": 32627 }
[ "com.google.gson.reflect.TypeToken", "io.swagger.client.ApiException", "io.swagger.client.ApiResponse", "java.lang.reflect.Type", "java.util.List" ]
import com.google.gson.reflect.TypeToken; import io.swagger.client.ApiException; import io.swagger.client.ApiResponse; import java.lang.reflect.Type; import java.util.List;
import com.google.gson.reflect.*; import io.swagger.client.*; import java.lang.reflect.*; import java.util.*;
[ "com.google.gson", "io.swagger.client", "java.lang", "java.util" ]
com.google.gson; io.swagger.client; java.lang; java.util;
386,793
@ThreadSafe public void wssMessage(WebSocket ws, String message);
void function(WebSocket ws, String message);
/** * Callback for string messages received from the remote host * * @param ws * @param message * @see #onMessage(WebSocket, ByteBuffer) * */
Callback for string messages received from the remote host
wssMessage
{ "repo_name": "Periapsis/aphelion", "path": "src/main/java/aphelion/shared/net/HttpWebSocketServerListener.java", "license": "agpl-3.0", "size": 4820 }
[ "org.java_websocket.WebSocket" ]
import org.java_websocket.WebSocket;
import org.java_websocket.*;
[ "org.java_websocket" ]
org.java_websocket;
1,269,293
public static Map.Entry<String, Map<String, ?>> getDisplayDensityCommand() { return new AbstractMap.SimpleEntry<>(GET_DISPLAY_DENSITY, ImmutableMap.of()); }
static Map.Entry<String, Map<String, ?>> function() { return new AbstractMap.SimpleEntry<>(GET_DISPLAY_DENSITY, ImmutableMap.of()); }
/** * This method forms a {@link Map} of parameters to * Retrieve the display density of the Android device. * * @return a key-value pair. The key is the command name. The value is a * {@link Map} command arguments. */
This method forms a <code>Map</code> of parameters to Retrieve the display density of the Android device
getDisplayDensityCommand
{ "repo_name": "SrinivasanTarget/java-client", "path": "src/main/java/io/appium/java_client/android/AndroidMobileCommandHelper.java", "license": "apache-2.0", "size": 19196 }
[ "com.google.common.collect.ImmutableMap", "java.util.AbstractMap", "java.util.Map" ]
import com.google.common.collect.ImmutableMap; import java.util.AbstractMap; import java.util.Map;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,910,992
public void closeTablePool(final byte[] tableName) throws IOException { closeTablePool(Bytes.toString(tableName)); }
void function(final byte[] tableName) throws IOException { closeTablePool(Bytes.toString(tableName)); }
/** * See {@link #closeTablePool(String)}. * * @param tableName */
See <code>#closeTablePool(String)</code>
closeTablePool
{ "repo_name": "StumbleUponArchive/hbase", "path": "src/main/java/org/apache/hadoop/hbase/client/HTablePool.java", "license": "apache-2.0", "size": 16222 }
[ "java.io.IOException", "org.apache.hadoop.hbase.util.Bytes" ]
import java.io.IOException; import org.apache.hadoop.hbase.util.Bytes;
import java.io.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,518,868
public JTree getComplexRulesTree() { return this.complexRulesTree; }
JTree function() { return this.complexRulesTree; }
/** * Gets the complex rules tree. * * @return the complexRulesTree */
Gets the complex rules tree
getComplexRulesTree
{ "repo_name": "PDavid/aTunes", "path": "aTunes/src/main/java/net/sourceforge/atunes/gui/views/dialogs/CustomSearchDialog.java", "license": "gpl-2.0", "size": 9468 }
[ "javax.swing.JTree" ]
import javax.swing.JTree;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
504,545
public static String encodeMessage(String xmlString) throws IOException, UnsupportedEncodingException { // first DEFLATE compress the document (saml-bindings-2.0, // section 3.4.4.1) byte[] xmlBytes = xmlString.getBytes("UTF-8"); ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream( byteOutputStream); deflaterOutputStream.write(xmlBytes, 0, xmlBytes.length); deflaterOutputStream.close(); // next, base64 encode it Base64 base64Encoder = new Base64(); byte[] base64EncodedByteArray = base64Encoder.encode(byteOutputStream .toByteArray()); String base64EncodedMessage = new String(base64EncodedByteArray); // finally, URL encode it String urlEncodedMessage = URLEncoder.encode(base64EncodedMessage, "UTF-8"); return urlEncodedMessage; }
static String function(String xmlString) throws IOException, UnsupportedEncodingException { byte[] xmlBytes = xmlString.getBytes("UTF-8"); ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream( byteOutputStream); deflaterOutputStream.write(xmlBytes, 0, xmlBytes.length); deflaterOutputStream.close(); Base64 base64Encoder = new Base64(); byte[] base64EncodedByteArray = base64Encoder.encode(byteOutputStream .toByteArray()); String base64EncodedMessage = new String(base64EncodedByteArray); String urlEncodedMessage = URLEncoder.encode(base64EncodedMessage, "UTF-8"); return urlEncodedMessage; }
/** * Generates an encoded and compressed String from the specified XML-formatted * String. The String is encoded in the following order: * <p> * 1. URL encode <br> * 2. Base64 encode <br> * 3. Deflate <br> * * @param xmlString XML-formatted String that is to be encoded * @return String containing the encoded contents of the specified XML String */
Generates an encoded and compressed String from the specified XML-formatted String. The String is encoded in the following order: 1. URL encode 2. Base64 encode 3. Deflate
encodeMessage
{ "repo_name": "Guuuo/samltools", "path": "src/main/java/util/RequestUtil.java", "license": "apache-2.0", "size": 3129 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.io.UnsupportedEncodingException", "java.net.URLEncoder", "java.util.zip.DeflaterOutputStream", "org.apache.commons.codec.binary.Base64" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.zip.DeflaterOutputStream; import org.apache.commons.codec.binary.Base64;
import java.io.*; import java.net.*; import java.util.zip.*; import org.apache.commons.codec.binary.*;
[ "java.io", "java.net", "java.util", "org.apache.commons" ]
java.io; java.net; java.util; org.apache.commons;
2,851,296
public void ackReceived(AndesAckData ackData) throws AndesException { //Tracing Message MessageTracer.trace(ackData.getAcknowledgedMessage().getMessageID(), ackData.getAcknowledgedMessage() .getDestination(), MessageTracer.ACK_RECEIVED_FROM_PROTOCOL); //Adding metrics meter for ack rate Meter ackMeter = MetricManager.meter(Level.INFO, MetricsConstants.ACK_RECEIVE_RATE); ackMeter.mark(); //We call this later as this call removes the ackData.getAcknowledgedMessage() message inboundEventManager.ackReceived(ackData); }
void function(AndesAckData ackData) throws AndesException { MessageTracer.trace(ackData.getAcknowledgedMessage().getMessageID(), ackData.getAcknowledgedMessage() .getDestination(), MessageTracer.ACK_RECEIVED_FROM_PROTOCOL); Meter ackMeter = MetricManager.meter(Level.INFO, MetricsConstants.ACK_RECEIVE_RATE); ackMeter.mark(); inboundEventManager.ackReceived(ackData); }
/** * Acknowledgement received from clients for sent messages should be notified to Andes using this method * @param ackData AndesAckData * @throws AndesException */
Acknowledgement received from clients for sent messages should be notified to Andes using this method
ackReceived
{ "repo_name": "ThilankaBowala/andes", "path": "modules/andes-core/broker/src/main/java/org/wso2/andes/kernel/Andes.java", "license": "apache-2.0", "size": 27956 }
[ "org.wso2.andes.metrics.MetricsConstants", "org.wso2.andes.tools.utils.MessageTracer", "org.wso2.carbon.metrics.manager.Level", "org.wso2.carbon.metrics.manager.Meter", "org.wso2.carbon.metrics.manager.MetricManager" ]
import org.wso2.andes.metrics.MetricsConstants; import org.wso2.andes.tools.utils.MessageTracer; import org.wso2.carbon.metrics.manager.Level; import org.wso2.carbon.metrics.manager.Meter; import org.wso2.carbon.metrics.manager.MetricManager;
import org.wso2.andes.metrics.*; import org.wso2.andes.tools.utils.*; import org.wso2.carbon.metrics.manager.*;
[ "org.wso2.andes", "org.wso2.carbon" ]
org.wso2.andes; org.wso2.carbon;
1,919,845
void merge( final Map<String, Configuration> extraConfiguration, final Map<String, Requirement> extraRequirements ) { configurationMap = addIfMissing( configurationMap, extraConfiguration ); requirementMap = addIfMissing( requirementMap, extraRequirements ); } // ---------------------------------------------------------------------- // Implementation methods // ----------------------------------------------------------------------
void merge( final Map<String, Configuration> extraConfiguration, final Map<String, Requirement> extraRequirements ) { configurationMap = addIfMissing( configurationMap, extraConfiguration ); requirementMap = addIfMissing( requirementMap, extraRequirements ); }
/** * Merges the given configuration and requirements with the current metadata, without overwriting existing entries. * * @param extraConfiguration The extra configuration * @param extraRequirements The extra requirements */
Merges the given configuration and requirements with the current metadata, without overwriting existing entries
merge
{ "repo_name": "eclipse/sisu.plexus", "path": "org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusXmlMetadata.java", "license": "epl-1.0", "size": 4274 }
[ "java.util.Map", "org.codehaus.plexus.component.annotations.Configuration", "org.codehaus.plexus.component.annotations.Requirement" ]
import java.util.Map; import org.codehaus.plexus.component.annotations.Configuration; import org.codehaus.plexus.component.annotations.Requirement;
import java.util.*; import org.codehaus.plexus.component.annotations.*;
[ "java.util", "org.codehaus.plexus" ]
java.util; org.codehaus.plexus;
2,505,148
public void addPredicates(List<P> predicateList) { this.predicates.addAll(predicateList); }
void function(List<P> predicateList) { this.predicates.addAll(predicateList); }
/** * Add a list of predicates * * @param predicateList the predicaes to be added */
Add a list of predicates
addPredicates
{ "repo_name": "galpha/gradoop", "path": "gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/matching/common/query/predicates/PredicateCollection.java", "license": "apache-2.0", "size": 4180 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,723,224
private void ensureNoPre019State() throws Exception { for (Path dataLocation : nodeEnv.nodeDataPaths()) { final Path stateLocation = dataLocation.resolve(MetaDataStateFormat.STATE_DIR_NAME); if (!Files.exists(stateLocation)) { continue; } try (DirectoryStream<Path> stream = Files.newDirectoryStream(stateLocation)) { for (Path stateFile : stream) { if (logger.isTraceEnabled()) { logger.trace("[upgrade]: processing [{}]", stateFile.getFileName()); } final String name = stateFile.getFileName().toString(); if (name.startsWith("metadata-")) { throw new IllegalStateException("Detected pre 0.19 metadata file please upgrade to a version before " + Version.CURRENT.minimumCompatibilityVersion() + " first to upgrade state structures - metadata found: [" + stateFile.getParent().toAbsolutePath()); } } } } }
void function() throws Exception { for (Path dataLocation : nodeEnv.nodeDataPaths()) { final Path stateLocation = dataLocation.resolve(MetaDataStateFormat.STATE_DIR_NAME); if (!Files.exists(stateLocation)) { continue; } try (DirectoryStream<Path> stream = Files.newDirectoryStream(stateLocation)) { for (Path stateFile : stream) { if (logger.isTraceEnabled()) { logger.trace(STR, stateFile.getFileName()); } final String name = stateFile.getFileName().toString(); if (name.startsWith(STR)) { throw new IllegalStateException(STR + Version.CURRENT.minimumCompatibilityVersion() + STR + stateFile.getParent().toAbsolutePath()); } } } } }
/** * Throws an IAE if a pre 0.19 state is detected */
Throws an IAE if a pre 0.19 state is detected
ensureNoPre019State
{ "repo_name": "dpursehouse/elasticsearch", "path": "core/src/main/java/org/elasticsearch/gateway/GatewayMetaState.java", "license": "apache-2.0", "size": 17045 }
[ "java.nio.file.DirectoryStream", "java.nio.file.Files", "java.nio.file.Path", "org.elasticsearch.Version" ]
import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import org.elasticsearch.Version;
import java.nio.file.*; import org.elasticsearch.*;
[ "java.nio", "org.elasticsearch" ]
java.nio; org.elasticsearch;
2,279,390
public static double[] parseBoundingBox(XContentParser parser) throws IOException, ElasticsearchParseException { XContentParser.Token token = parser.currentToken(); if (token != XContentParser.Token.START_OBJECT) { throw new ElasticsearchParseException("failed to parse bounding box. Expected start object but found [{}]", token); } double top = Double.NaN; double bottom = Double.NaN; double left = Double.NaN; double right = Double.NaN; String currentFieldName; GeoPoint sparse = new GeoPoint(); EnvelopeBuilder envelope = null; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); token = parser.nextToken(); if (WKT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { envelope = (EnvelopeBuilder)(GeoWKTParser.parseExpectedType(parser, GeoShapeType.ENVELOPE)); } else if (TOP_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { top = parser.doubleValue(); } else if (BOTTOM_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { bottom = parser.doubleValue(); } else if (LEFT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { left = parser.doubleValue(); } else if (RIGHT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { right = parser.doubleValue(); } else { if (TOP_LEFT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { GeoUtils.parseGeoPoint(parser, sparse, false, GeoUtils.EffectivePoint.TOP_LEFT); top = sparse.getLat(); left = sparse.getLon(); } else if (BOTTOM_RIGHT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { GeoUtils.parseGeoPoint(parser, sparse, false, GeoUtils.EffectivePoint.BOTTOM_RIGHT); bottom = sparse.getLat(); right = sparse.getLon(); } else if (TOP_RIGHT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { GeoUtils.parseGeoPoint(parser, sparse, false, GeoUtils.EffectivePoint.TOP_RIGHT); top = sparse.getLat(); right = sparse.getLon(); } else if (BOTTOM_LEFT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { GeoUtils.parseGeoPoint(parser, sparse, false, GeoUtils.EffectivePoint.BOTTOM_LEFT); bottom = sparse.getLat(); left = sparse.getLon(); } else { throw new ElasticsearchParseException("failed to parse bounding box. unexpected field [{}]", currentFieldName); } } } else { throw new ElasticsearchParseException("failed to parse bounding box. field name expected but [{}] found", token); } } if (envelope != null) { if (Double.isNaN(top) == false || Double.isNaN(bottom) == false || Double.isNaN(left) == false || Double.isNaN(right) == false) { throw new ElasticsearchParseException("failed to parse bounding box. Conflicting definition found " + "using well-known text and explicit corners."); } org.locationtech.spatial4j.shape.Rectangle r = envelope.buildS4J(); return new double[]{r.getMinY(), r.getMaxY(), r.getMinX(), r.getMaxX()}; } return new double[]{bottom, top, left, right}; }
static double[] function(XContentParser parser) throws IOException, ElasticsearchParseException { XContentParser.Token token = parser.currentToken(); if (token != XContentParser.Token.START_OBJECT) { throw new ElasticsearchParseException(STR, token); } double top = Double.NaN; double bottom = Double.NaN; double left = Double.NaN; double right = Double.NaN; String currentFieldName; GeoPoint sparse = new GeoPoint(); EnvelopeBuilder envelope = null; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); token = parser.nextToken(); if (WKT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { envelope = (EnvelopeBuilder)(GeoWKTParser.parseExpectedType(parser, GeoShapeType.ENVELOPE)); } else if (TOP_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { top = parser.doubleValue(); } else if (BOTTOM_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { bottom = parser.doubleValue(); } else if (LEFT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { left = parser.doubleValue(); } else if (RIGHT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { right = parser.doubleValue(); } else { if (TOP_LEFT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { GeoUtils.parseGeoPoint(parser, sparse, false, GeoUtils.EffectivePoint.TOP_LEFT); top = sparse.getLat(); left = sparse.getLon(); } else if (BOTTOM_RIGHT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { GeoUtils.parseGeoPoint(parser, sparse, false, GeoUtils.EffectivePoint.BOTTOM_RIGHT); bottom = sparse.getLat(); right = sparse.getLon(); } else if (TOP_RIGHT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { GeoUtils.parseGeoPoint(parser, sparse, false, GeoUtils.EffectivePoint.TOP_RIGHT); top = sparse.getLat(); right = sparse.getLon(); } else if (BOTTOM_LEFT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { GeoUtils.parseGeoPoint(parser, sparse, false, GeoUtils.EffectivePoint.BOTTOM_LEFT); bottom = sparse.getLat(); left = sparse.getLon(); } else { throw new ElasticsearchParseException(STR, currentFieldName); } } } else { throw new ElasticsearchParseException(STR, token); } } if (envelope != null) { if (Double.isNaN(top) == false Double.isNaN(bottom) == false Double.isNaN(left) == false Double.isNaN(right) == false) { throw new ElasticsearchParseException(STR + STR); } org.locationtech.spatial4j.shape.Rectangle r = envelope.buildS4J(); return new double[]{r.getMinY(), r.getMaxY(), r.getMinX(), r.getMaxX()}; } return new double[]{bottom, top, left, right}; }
/** * Parses the bounding box and returns bottom, top, left, right coordinates */
Parses the bounding box and returns bottom, top, left, right coordinates
parseBoundingBox
{ "repo_name": "coding0011/elasticsearch", "path": "server/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java", "license": "apache-2.0", "size": 23612 }
[ "java.io.IOException", "org.apache.lucene.geo.Rectangle", "org.elasticsearch.ElasticsearchParseException", "org.elasticsearch.common.geo.GeoPoint", "org.elasticsearch.common.geo.GeoShapeType", "org.elasticsearch.common.geo.GeoUtils", "org.elasticsearch.common.geo.builders.EnvelopeBuilder", "org.elasticsearch.common.geo.parsers.GeoWKTParser", "org.elasticsearch.common.xcontent.XContentParser", "org.elasticsearch.geometry.Rectangle" ]
import java.io.IOException; import org.apache.lucene.geo.Rectangle; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.geo.GeoShapeType; import org.elasticsearch.common.geo.GeoUtils; import org.elasticsearch.common.geo.builders.EnvelopeBuilder; import org.elasticsearch.common.geo.parsers.GeoWKTParser; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.geometry.Rectangle;
import java.io.*; import org.apache.lucene.geo.*; import org.elasticsearch.*; import org.elasticsearch.common.geo.*; import org.elasticsearch.common.geo.builders.*; import org.elasticsearch.common.geo.parsers.*; import org.elasticsearch.common.xcontent.*; import org.elasticsearch.geometry.*;
[ "java.io", "org.apache.lucene", "org.elasticsearch", "org.elasticsearch.common", "org.elasticsearch.geometry" ]
java.io; org.apache.lucene; org.elasticsearch; org.elasticsearch.common; org.elasticsearch.geometry;
1,753,487
protected void setMailetContext(MailetContext mailetContext) { fieldMailetContext = mailetContext; }
void function(MailetContext mailetContext) { fieldMailetContext = mailetContext; }
/** * Sets the mailetContext. * * @param mailetContext * The mailetContext to set */
Sets the mailetContext
setMailetContext
{ "repo_name": "gtrak/hedwig", "path": "hedwig-server/src/main/java/com/hs/mail/sieve/SieveMailAdapter.java", "license": "apache-2.0", "size": 8412 }
[ "com.hs.mail.mailet.MailetContext" ]
import com.hs.mail.mailet.MailetContext;
import com.hs.mail.mailet.*;
[ "com.hs.mail" ]
com.hs.mail;
1,654,917
public String path(Map<String, String> parameters) { StringBuilder path = new StringBuilder(); path.append("/"); for (int i = 1, size = tests.length; i < size; i++) { if (path.charAt(path.length() - 1) != '/') { path.append('/'); } tests[i].append(path, parameters); } return path.toString(); }
String function(Map<String, String> parameters) { StringBuilder path = new StringBuilder(); path.append("/"); for (int i = 1, size = tests.length; i < size; i++) { if (path.charAt(path.length() - 1) != '/') { path.append('/'); } tests[i].append(path, parameters); } return path.toString(); }
/** * Recreate a path from this glob using the parameters in the given * parameter map to replace the parameter captures in glob pattern. * * @param parameters * The parameters used to replace parameter captures in the glob * pattern. */
Recreate a path from this glob using the parameters in the given parameter map to replace the parameter captures in glob pattern
path
{ "repo_name": "defunct/dovetail", "path": "src/main/java/com/goodworkalan/dovetail/Path.java", "license": "mit", "size": 7275 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,420,707
public VirtualHostBuilder tls(InputStream keyCertChainInputStream, InputStream keyInputStream) { return tls(keyCertChainInputStream, keyInputStream, null); }
VirtualHostBuilder function(InputStream keyCertChainInputStream, InputStream keyInputStream) { return tls(keyCertChainInputStream, keyInputStream, null); }
/** * Configures SSL or TLS of this {@link VirtualHost} with the specified {@code keyCertChainInputStream} and * cleartext {@code keyInputStream}. * * @see #tlsCustomizer(Consumer) */
Configures SSL or TLS of this <code>VirtualHost</code> with the specified keyCertChainInputStream and cleartext keyInputStream
tls
{ "repo_name": "anuraaga/armeria", "path": "core/src/main/java/com/linecorp/armeria/server/VirtualHostBuilder.java", "license": "apache-2.0", "size": 46914 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,402,860
@Test public void testBuckProjectSliceWithTestsProjectInDifferentBuckFile() throws IOException { ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario( this, "project_slice_with_tests_project_in_different_buck_file", temporaryFolder); workspace.setUp(); ProcessResult result = workspace.runBuckCommand( "project", "--deprecated-ij-generation", "//modules/dep1:dep1", "-v", "5"); result.assertSuccess("buck project should exit cleanly"); workspace.verify(); assertEquals( "`buck project` should report the files it modified.", Joiner.on('\n').join( "MODIFIED FILES:", ".idea/compiler.xml", ".idea/misc.xml", ".idea/modules.xml", ".idea/runConfigurations/Debug_Buck_test.xml", "modules/dep1/module_modules_dep1.iml", "tests/module_tests_test1.iml" ) + '\n', result.getStdout()); assertThat( "`buck project` should contain warning to synchronize IntelliJ.", result.getStderr(), containsString( " :: Please resynchronize IntelliJ via File->Synchronize " + "or Cmd-Opt-Y (Mac) or Ctrl-Alt-Y (PC/Linux)")); }
void function() throws IOException { ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario( this, STR, temporaryFolder); workspace.setUp(); ProcessResult result = workspace.runBuckCommand( STR, STR, " "-vSTR5STRbuck project should exit cleanlySTR`buck project` should report the files it modified.STRMODIFIED FILES:STR.idea/compiler.xmlSTR.idea/misc.xmlSTR.idea/modules.xmlSTR.idea/runConfigurations/Debug_Buck_test.xmlSTRmodules/dep1/module_modules_dep1.imlSTRtests/module_tests_test1.imlSTR`buck project` should contain warning to synchronize IntelliJ.STR :: Please resynchronize IntelliJ via File->Synchronize STRor Cmd-Opt-Y (Mac) or Ctrl-Alt-Y (PC/Linux)")); }
/** * Verify that if we build a project by specifying a target, the tests' projects rules are * referenced even if they are defined in a different buck file from the tests. */
Verify that if we build a project by specifying a target, the tests' projects rules are referenced even if they are defined in a different buck file from the tests
testBuckProjectSliceWithTestsProjectInDifferentBuckFile
{ "repo_name": "janicduplessis/buck", "path": "test/com/facebook/buck/jvm/java/intellij/ProjectIntegrationTest.java", "license": "apache-2.0", "size": 26820 }
[ "com.facebook.buck.testutil.integration.ProjectWorkspace", "com.facebook.buck.testutil.integration.TestDataHelper", "java.io.IOException" ]
import com.facebook.buck.testutil.integration.ProjectWorkspace; import com.facebook.buck.testutil.integration.TestDataHelper; import java.io.IOException;
import com.facebook.buck.testutil.integration.*; import java.io.*;
[ "com.facebook.buck", "java.io" ]
com.facebook.buck; java.io;
1,663,806
protected void fireTimeEvent(String eventType, float time, int detail) { Calendar t = (Calendar) root.getDocumentBeginTime().clone(); t.add(Calendar.MILLISECOND, (int) Math.round(time * 1e3)); fireTimeEvent(eventType, t, detail); }
void function(String eventType, float time, int detail) { Calendar t = (Calendar) root.getDocumentBeginTime().clone(); t.add(Calendar.MILLISECOND, (int) Math.round(time * 1e3)); fireTimeEvent(eventType, t, detail); }
/** * Fires a TimeEvent of the given type on this element. * @param eventType the type of TimeEvent ("beginEvent", "endEvent" * or "repeatEvent"). * @param time the timestamp of the event object * @param detail the repeat iteration, if this event is a repeat event */
Fires a TimeEvent of the given type on this element
fireTimeEvent
{ "repo_name": "Uni-Sol/batik", "path": "sources/org/apache/batik/anim/timing/TimedElement.java", "license": "apache-2.0", "size": 45786 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
2,894,360
Future<Exchange> asyncSend(String endpointUri, Exchange exchange);
Future<Exchange> asyncSend(String endpointUri, Exchange exchange);
/** * Sends an asynchronous exchange to the given endpoint. * * @param endpointUri the endpoint URI to send the exchange to * @param exchange the exchange to send * @return a handle to be used to get the response in the future */
Sends an asynchronous exchange to the given endpoint
asyncSend
{ "repo_name": "chicagozer/rheosoft", "path": "camel-core/src/main/java/org/apache/camel/ProducerTemplate.java", "license": "apache-2.0", "size": 52960 }
[ "java.util.concurrent.Future" ]
import java.util.concurrent.Future;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,739,832
protected Date calculateNextWeeklyDate(String dayOfWeekFromFrequencyCode, Date currentDate) { Calendar calendar = Calendar.getInstance(); calendar.setTime(currentDate); int daysToAdd = 0; int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // today's day of the week int maximumDaysInWeek = calendar.getActualMaximum(Calendar.DAY_OF_WEEK); if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.MONDAY)) { if (dayOfWeek < Calendar.MONDAY) daysToAdd = Calendar.MONDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.MONDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.TUESDAY)) { if (dayOfWeek < Calendar.TUESDAY) daysToAdd = Calendar.TUESDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.TUESDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.WEDNESDAY)) { if (dayOfWeek < Calendar.WEDNESDAY) daysToAdd = Calendar.WEDNESDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.WEDNESDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.THURSDAY)) { if (dayOfWeek < Calendar.THURSDAY) daysToAdd = Calendar.THURSDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.THURSDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.FRIDAY)) { if (dayOfWeek < Calendar.FRIDAY) daysToAdd = Calendar.FRIDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.FRIDAY; } calendar.add(Calendar.DAY_OF_MONTH, daysToAdd); return new java.sql.Date(calendar.getTimeInMillis()); }
Date function(String dayOfWeekFromFrequencyCode, Date currentDate) { Calendar calendar = Calendar.getInstance(); calendar.setTime(currentDate); int daysToAdd = 0; int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); int maximumDaysInWeek = calendar.getActualMaximum(Calendar.DAY_OF_WEEK); if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.MONDAY)) { if (dayOfWeek < Calendar.MONDAY) daysToAdd = Calendar.MONDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.MONDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.TUESDAY)) { if (dayOfWeek < Calendar.TUESDAY) daysToAdd = Calendar.TUESDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.TUESDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.WEDNESDAY)) { if (dayOfWeek < Calendar.WEDNESDAY) daysToAdd = Calendar.WEDNESDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.WEDNESDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.THURSDAY)) { if (dayOfWeek < Calendar.THURSDAY) daysToAdd = Calendar.THURSDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.THURSDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.FRIDAY)) { if (dayOfWeek < Calendar.FRIDAY) daysToAdd = Calendar.FRIDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.FRIDAY; } calendar.add(Calendar.DAY_OF_MONTH, daysToAdd); return new java.sql.Date(calendar.getTimeInMillis()); }
/** * Method to calculate the next processing week date based on the frequency type * adds the appropriate number of days to the current date * @param dayOfWeek * @return next processing date */
Method to calculate the next processing week date based on the frequency type adds the appropriate number of days to the current date
calculateNextWeeklyDate
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/endow/businessobject/lookup/CalculateProcessDateUsingFrequencyCodeService.java", "license": "agpl-3.0", "size": 14812 }
[ "java.sql.Date", "java.util.Calendar", "org.kuali.kfs.module.endow.EndowConstants" ]
import java.sql.Date; import java.util.Calendar; import org.kuali.kfs.module.endow.EndowConstants;
import java.sql.*; import java.util.*; import org.kuali.kfs.module.endow.*;
[ "java.sql", "java.util", "org.kuali.kfs" ]
java.sql; java.util; org.kuali.kfs;
773,925
@Override public FieldReader getReader() { return reader; } /** * Get minor type for this vector. The vector holds values belonging * to a particular type. * * @return {@link org.apache.arrow.vector.types.Types.MinorType}
FieldReader function() { return reader; } /** * Get minor type for this vector. The vector holds values belonging * to a particular type. * * @return {@link org.apache.arrow.vector.types.Types.MinorType}
/** * Get a reader that supports reading values from this vector. * * @return Field Reader for this vector */
Get a reader that supports reading values from this vector
getReader
{ "repo_name": "renesugar/arrow", "path": "java/vector/src/main/java/org/apache/arrow/vector/TimeStampNanoTZVector.java", "license": "apache-2.0", "size": 8357 }
[ "org.apache.arrow.vector.complex.reader.FieldReader", "org.apache.arrow.vector.types.Types" ]
import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.types.Types;
import org.apache.arrow.vector.complex.reader.*; import org.apache.arrow.vector.types.*;
[ "org.apache.arrow" ]
org.apache.arrow;
1,382,009
private static <T extends AccessibleObject> T setAccessible(T object) { object.setAccessible(true); return object; }
static <T extends AccessibleObject> T function(T object) { object.setAccessible(true); return object; }
/** * Sets accessibleobject accessible state an returns this object * * @param <T> * @param object * @return */
Sets accessibleobject accessible state an returns this object
setAccessible
{ "repo_name": "NavidK0/PSCiv", "path": "src/main/java/com/lastabyss/psciv/util/Reflect.java", "license": "mit", "size": 7222 }
[ "java.lang.reflect.AccessibleObject" ]
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
279,304
public PathStat createOnceExt(final String path, byte[] data, List<ACL> acl, CreateMode createMode, boolean recursive) throws KeeperException, InterruptedException { String createdPath = null; Stat setStat = null; try { createdPath = createExt(path, data, acl, createMode, recursive); } catch (KeeperException.NodeExistsException e) { if (LOG.isDebugEnabled()) { LOG.debug("createOnceExt: Node already exists on path " + path); } } return new PathStat(createdPath, setStat); }
PathStat function(final String path, byte[] data, List<ACL> acl, CreateMode createMode, boolean recursive) throws KeeperException, InterruptedException { String createdPath = null; Stat setStat = null; try { createdPath = createExt(path, data, acl, createMode, recursive); } catch (KeeperException.NodeExistsException e) { if (LOG.isDebugEnabled()) { LOG.debug(STR + path); } } return new PathStat(createdPath, setStat); }
/** * Create a znode if there is no other znode there * * @param path path to create * @param data data to set on the final znode * @param acl acls on each znode created * @param createMode only affects the final znode * @param recursive if true, creates all ancestors * @return Path of created znode or Stat of set znode * @throws InterruptedException * @throws KeeperException */
Create a znode if there is no other znode there
createOnceExt
{ "repo_name": "zfighter/giraph-research", "path": "giraph-core/target/munged/munged/main/org/apache/giraph/zk/ZooKeeperExt.java", "license": "apache-2.0", "size": 20576 }
[ "java.util.List", "org.apache.zookeeper.CreateMode", "org.apache.zookeeper.KeeperException", "org.apache.zookeeper.data.Stat" ]
import java.util.List; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.data.Stat;
import java.util.*; import org.apache.zookeeper.*; import org.apache.zookeeper.data.*;
[ "java.util", "org.apache.zookeeper" ]
java.util; org.apache.zookeeper;
1,192,723
@AfterThrowing(pointcut = "loggingPointcut()", throwing = "e") public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { log.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL", e.getMessage(), e); } else { log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL"); } }
@AfterThrowing(pointcut = STR, throwing = "e") void function(JoinPoint joinPoint, Throwable e) { if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { log.error(STR, joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL", e.getMessage(), e); } else { log.error(STR, joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL"); } }
/** * Advice that logs methods throwing exceptions. * * @param joinPoint join point for advice * @param e exception */
Advice that logs methods throwing exceptions
logAfterThrowing
{ "repo_name": "jbadeau/jhipster-brooklyn", "path": "src/main/java/org/jhipster/brooklyn/aop/logging/LoggingAspect.java", "license": "apache-2.0", "size": 3276 }
[ "io.github.jhipster.config.JHipsterConstants", "org.aspectj.lang.JoinPoint", "org.aspectj.lang.annotation.AfterThrowing" ]
import io.github.jhipster.config.JHipsterConstants; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterThrowing;
import io.github.jhipster.config.*; import org.aspectj.lang.*; import org.aspectj.lang.annotation.*;
[ "io.github.jhipster", "org.aspectj.lang" ]
io.github.jhipster; org.aspectj.lang;
2,029,216
public ServiceFuture<Void> deleteAsync(String resourceGroupName, String integrationAccountName, String batchConfigurationName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, integrationAccountName, batchConfigurationName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String integrationAccountName, String batchConfigurationName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, integrationAccountName, batchConfigurationName), serviceCallback); }
/** * Delete a batch configuration for an integration account. * * @param resourceGroupName The resource group name. * @param integrationAccountName The integration account name. * @param batchConfigurationName The batch configuration name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Delete a batch configuration for an integration account
deleteAsync
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/logic/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/logic/v2018_07_01_preview/implementation/IntegrationAccountBatchConfigurationsInner.java", "license": "mit", "size": 27898 }
[ "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;
1,881,423
public ServerSocket createServerSocket(int port) throws IOException { // TODO was wenn das mehrmals aufgerufen wird? RelayClient relayClient = new RelayClient(relayServerEndpoint, port); RelayServerSocket rss = new RelayServerSocket(relayClient); peerRelayEndpoint = rss.createAllocation(); return rss; }
ServerSocket function(int port) throws IOException { RelayClient relayClient = new RelayClient(relayServerEndpoint, port); RelayServerSocket rss = new RelayServerSocket(relayClient); peerRelayEndpoint = rss.createAllocation(); return rss; }
/** * Returns a new {@link RelayServerSocket} and creates a new allocation on * the relay server by using it. */
Returns a new <code>RelayServerSocket</code> and creates a new allocation on the relay server by using it
createServerSocket
{ "repo_name": "htwg/UCE_deprecated", "path": "rmi/de.htwg_konstanz.in.uce.rmi.relay.socket_factories/src/main/java/de/htwg_konstanz/in/uce/rmi/relay/socket_factories/RelaySocketFactory.java", "license": "gpl-3.0", "size": 2779 }
[ "de.htwg_konstanz.in.uce.socket.relay.client.RelayClient", "java.io.IOException", "java.net.ServerSocket" ]
import de.htwg_konstanz.in.uce.socket.relay.client.RelayClient; import java.io.IOException; import java.net.ServerSocket;
import de.htwg_konstanz.in.uce.socket.relay.client.*; import java.io.*; import java.net.*;
[ "de.htwg_konstanz.in", "java.io", "java.net" ]
de.htwg_konstanz.in; java.io; java.net;
39,547
public void setType(org.ontoware.rdf2go.model.node.Node value) { Base.set(this.model, this.getResource(), TYPE, value); }
void function(org.ontoware.rdf2go.model.node.Node value) { Base.set(this.model, this.getResource(), TYPE, value); }
/** * Sets a value of property Type from an RDF2Go node. First, all existing * values are removed, then this value is added. Cardinality constraints are * not checked, but this method exists only for properties with no * minCardinality or minCardinality == 1. * * @param value the value to be added * * [Generated from RDFReactor template rule #set1dynamic] */
Sets a value of property Type from an RDF2Go node. First, all existing values are removed, then this value is added. Cardinality constraints are not checked, but this method exists only for properties with no minCardinality or minCardinality == 1
setType
{ "repo_name": "semweb4j/semweb4j", "path": "org.semweb4j.rdfreactor.generator/src/main/java/org/ontoware/rdfreactor/schema/bootstrap/Resource.java", "license": "bsd-2-clause", "size": 83665 }
[ "org.ontoware.rdfreactor.runtime.Base" ]
import org.ontoware.rdfreactor.runtime.Base;
import org.ontoware.rdfreactor.runtime.*;
[ "org.ontoware.rdfreactor" ]
org.ontoware.rdfreactor;
1,541,739
private void createAsConsole(final String factionName, final String factionTag, final CommandSource commandSource) { final Faction faction = FactionImpl.builder(factionName, Text.of(this.chatConfig.getDefaultTagColor(), factionTag), new UUID(0, 0)).build(); super.getPlugin().getFactionLogic().addFaction(faction); commandSource.sendMessage(Text.of(PluginInfo.PLUGIN_PREFIX, MessageLoader.parseMessage(Messages.FACTION_HAS_BEEN_CREATED, TextColors.GREEN, Collections.singletonMap(Placeholders.FACTION_NAME, Text.of(TextColors.GOLD, faction.getName()))))); }
void function(final String factionName, final String factionTag, final CommandSource commandSource) { final Faction faction = FactionImpl.builder(factionName, Text.of(this.chatConfig.getDefaultTagColor(), factionTag), new UUID(0, 0)).build(); super.getPlugin().getFactionLogic().addFaction(faction); commandSource.sendMessage(Text.of(PluginInfo.PLUGIN_PREFIX, MessageLoader.parseMessage(Messages.FACTION_HAS_BEEN_CREATED, TextColors.GREEN, Collections.singletonMap(Placeholders.FACTION_NAME, Text.of(TextColors.GOLD, faction.getName()))))); }
/** * CommandSource can actually be one of the following: console, command block, RCON client or proxy. */
CommandSource can actually be one of the following: console, command block, RCON client or proxy
createAsConsole
{ "repo_name": "Aquerr/EagleFactions", "path": "src/main/java/io/github/aquerr/eaglefactions/commands/management/CreateCommand.java", "license": "mit", "size": 8368 }
[ "io.github.aquerr.eaglefactions.PluginInfo", "io.github.aquerr.eaglefactions.api.entities.Faction", "io.github.aquerr.eaglefactions.entities.FactionImpl", "io.github.aquerr.eaglefactions.messaging.MessageLoader", "io.github.aquerr.eaglefactions.messaging.Messages", "io.github.aquerr.eaglefactions.messaging.Placeholders", "java.util.Collections", "org.spongepowered.api.command.CommandSource", "org.spongepowered.api.text.Text", "org.spongepowered.api.text.format.TextColors" ]
import io.github.aquerr.eaglefactions.PluginInfo; import io.github.aquerr.eaglefactions.api.entities.Faction; import io.github.aquerr.eaglefactions.entities.FactionImpl; import io.github.aquerr.eaglefactions.messaging.MessageLoader; import io.github.aquerr.eaglefactions.messaging.Messages; import io.github.aquerr.eaglefactions.messaging.Placeholders; import java.util.Collections; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.format.TextColors;
import io.github.aquerr.eaglefactions.*; import io.github.aquerr.eaglefactions.api.entities.*; import io.github.aquerr.eaglefactions.entities.*; import io.github.aquerr.eaglefactions.messaging.*; import java.util.*; import org.spongepowered.api.command.*; import org.spongepowered.api.text.*; import org.spongepowered.api.text.format.*;
[ "io.github.aquerr", "java.util", "org.spongepowered.api" ]
io.github.aquerr; java.util; org.spongepowered.api;
2,491,523
public OCFile getInitialDirectory(); /** * Callback method invoked when a the 'transfer state' of a file changes. * * This happens when a download or upload is started or ended for a file. * * This method is necessary by now to update the user interface of the double-pane layout in tablets * because methods {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and {@link FileUploaderBinder#isUploading(Account, OCFile)}
OCFile function(); /** * Callback method invoked when a the 'transfer state' of a file changes. * * This happens when a download or upload is started or ended for a file. * * This method is necessary by now to update the user interface of the double-pane layout in tablets * because methods {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and {@link FileUploaderBinder#isUploading(Account, OCFile)}
/** * Callback method invoked when the parent activity is fully created to get the directory to list firstly. * * @return Directory to list firstly. Can be NULL. */
Callback method invoked when the parent activity is fully created to get the directory to list firstly
getInitialDirectory
{ "repo_name": "SmruthiManjunath/owncloud_friends", "path": "src/com/owncloud/android/ui/fragment/OCFileListFragment.java", "license": "gpl-2.0", "size": 22800 }
[ "android.accounts.Account", "com.owncloud.android.datamodel.OCFile", "com.owncloud.android.files.services.FileDownloader", "com.owncloud.android.files.services.FileUploader" ]
import android.accounts.Account; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.files.services.FileUploader;
import android.accounts.*; import com.owncloud.android.datamodel.*; import com.owncloud.android.files.services.*;
[ "android.accounts", "com.owncloud.android" ]
android.accounts; com.owncloud.android;
1,252,137
public void addConstraintChangeListener(ConstraintChangeListener aListener) { listeners.add(aListener); }
void function(ConstraintChangeListener aListener) { listeners.add(aListener); }
/** * Adds a <code>ConstraintChangeListener</code> instance to this <code>LinearConstraint</code> listeneners. * It will recieve this constraint boudaries changes. * @param aListener <code>ConstraintChangeListener</code> instance to add. */
Adds a <code>ConstraintChangeListener</code> instance to this <code>LinearConstraint</code> listeneners. It will recieve this constraint boudaries changes
addConstraintChangeListener
{ "repo_name": "altsoft/PlatypusJS", "path": "platypus-js-grid/src/main/java/com/bearsoft/gui/grid/constraints/LinearConstraint.java", "license": "apache-2.0", "size": 4540 }
[ "com.bearsoft.gui.grid.events.constraints.ConstraintChangeListener" ]
import com.bearsoft.gui.grid.events.constraints.ConstraintChangeListener;
import com.bearsoft.gui.grid.events.constraints.*;
[ "com.bearsoft.gui" ]
com.bearsoft.gui;
219,853
private boolean queryTime(String serverList[]) throws IllegalArgumentException { long found[] = new long[_concurringServers]; long now = -1; int stratum = -1; long expectedDelta = 0; _wellSynced = false; for (int i = 0; i < _concurringServers; i++) { if (i > 0) { // this delays startup when net is disconnected or the timeserver list is bad, don't make it too long try { Thread.sleep(2*1000); } catch (InterruptedException ie) {} } long[] timeAndStratum = NtpClient.currentTimeAndStratum(serverList); now = timeAndStratum[0]; stratum = (int) timeAndStratum[1]; long delta = now - _context.clock().now(); found[i] = delta; if (i == 0) { if (Math.abs(delta) < MAX_VARIANCE) { if (_log.shouldLog(Log.INFO)) _log.info("a single SNTP query was within the tolerance (" + delta + "ms)"); // If less than a half second on the first try, we're in good shape _wellSynced = Math.abs(delta) < 500; break; } else { // outside the tolerance, lets iterate across the concurring queries expectedDelta = delta; } } else { if (Math.abs(delta - expectedDelta) > MAX_VARIANCE) { if (_log.shouldLog(Log.ERROR)) { StringBuilder err = new StringBuilder(96); err.append("SNTP client variance exceeded at query ").append(i); err.append(". expected = "); err.append(expectedDelta); err.append(", found = "); err.append(delta); err.append(" all deltas: "); for (int j = 0; j < found.length; j++) err.append(found[j]).append(' '); _log.error(err.toString()); } return false; } } } stampTime(now, stratum); if (_log.shouldLog(Log.DEBUG)) { StringBuilder buf = new StringBuilder(64); buf.append("Deltas: "); for (int i = 0; i < found.length; i++) buf.append(found[i]).append(' '); _log.debug(buf.toString()); } return true; }
boolean function(String serverList[]) throws IllegalArgumentException { long found[] = new long[_concurringServers]; long now = -1; int stratum = -1; long expectedDelta = 0; _wellSynced = false; for (int i = 0; i < _concurringServers; i++) { if (i > 0) { try { Thread.sleep(2*1000); } catch (InterruptedException ie) {} } long[] timeAndStratum = NtpClient.currentTimeAndStratum(serverList); now = timeAndStratum[0]; stratum = (int) timeAndStratum[1]; long delta = now - _context.clock().now(); found[i] = delta; if (i == 0) { if (Math.abs(delta) < MAX_VARIANCE) { if (_log.shouldLog(Log.INFO)) _log.info(STR + delta + "ms)"); _wellSynced = Math.abs(delta) < 500; break; } else { expectedDelta = delta; } } else { if (Math.abs(delta - expectedDelta) > MAX_VARIANCE) { if (_log.shouldLog(Log.ERROR)) { StringBuilder err = new StringBuilder(96); err.append(STR).append(i); err.append(STR); err.append(expectedDelta); err.append(STR); err.append(delta); err.append(STR); for (int j = 0; j < found.length; j++) err.append(found[j]).append(' '); _log.error(err.toString()); } return false; } } } stampTime(now, stratum); if (_log.shouldLog(Log.DEBUG)) { StringBuilder buf = new StringBuilder(64); buf.append(STR); for (int i = 0; i < found.length; i++) buf.append(found[i]).append(' '); _log.debug(buf.toString()); } return true; }
/** * True if the time was queried successfully, false if it couldn't be */
True if the time was queried successfully, false if it couldn't be
queryTime
{ "repo_name": "oakes/Nightweb", "path": "common/java/router/net/i2p/router/time/RouterTimestamper.java", "license": "unlicense", "size": 13519 }
[ "net.i2p.util.Log" ]
import net.i2p.util.Log;
import net.i2p.util.*;
[ "net.i2p.util" ]
net.i2p.util;
950,143
public HttpResponse sendRequest(String schema, String uri, int portNumber, HttpPost request) throws IOException { HttpHost target = new HttpHost(uri, portNumber, schema); LOGGER.debug("Sending POST request to " + schema + "://" + uri + ":" + portNumber); LOGGER.debug("Available headers:"); for (Header header : request.getAllHeaders()) { LOGGER.debug(header.getName() + ": " + header.getValue()); } return client.execute(target, request); }
HttpResponse function(String schema, String uri, int portNumber, HttpPost request) throws IOException { HttpHost target = new HttpHost(uri, portNumber, schema); LOGGER.debug(STR + schema + STRAvailable headers:STR: " + header.getValue()); } return client.execute(target, request); }
/** * Send a post request to splunk server, including event to be logged, in JSON String. * * @param schema to be used. Possible values are http, https * @param uri server uri(hostname or ip-address) * @param portNumber which is listened by Splunk server http event collector * @param request to be sent * @return response from the server * @throws ClientProtocolException * @throws IOException */
Send a post request to splunk server, including event to be logged, in JSON String
sendRequest
{ "repo_name": "Talend/components", "path": "components/components-splunk/src/main/java/org/talend/components/splunk/connection/TSplunkEventCollectorConnection.java", "license": "apache-2.0", "size": 3137 }
[ "java.io.IOException", "org.apache.http.HttpHost", "org.apache.http.HttpResponse", "org.apache.http.client.methods.HttpPost" ]
import java.io.IOException; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost;
import java.io.*; import org.apache.http.*; import org.apache.http.client.methods.*;
[ "java.io", "org.apache.http" ]
java.io; org.apache.http;
557,302
for (String prop : conf.getTrimmedStringCollection( MRJobConfig.MR_JOB_REDACTED_PROPERTIES)) { conf.set(prop, REDACTION_REPLACEMENT_VAL); } } private MRJobConfUtil() { }
for (String prop : conf.getTrimmedStringCollection( MRJobConfig.MR_JOB_REDACTED_PROPERTIES)) { conf.set(prop, REDACTION_REPLACEMENT_VAL); } } private MRJobConfUtil() { }
/** * Redact job configuration properties. * @param conf the job configuration to redact */
Redact job configuration properties
redact
{ "repo_name": "plusplusjiajia/hadoop", "path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/MRJobConfUtil.java", "license": "apache-2.0", "size": 5061 }
[ "org.apache.hadoop.mapreduce.MRJobConfig" ]
import org.apache.hadoop.mapreduce.MRJobConfig;
import org.apache.hadoop.mapreduce.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,370,122
@GwtIncompatible("Unnecessary") private Writer fileNameToOutputWriter2(String fileName) throws IOException { if (fileName == null) { return null; } if (isInTestMode()) { return new StringWriter(); } return streamToOutputWriter2(filenameToOutputStream(fileName)); }
@GwtIncompatible(STR) Writer function(String fileName) throws IOException { if (fileName == null) { return null; } if (isInTestMode()) { return new StringWriter(); } return streamToOutputWriter2(filenameToOutputStream(fileName)); }
/** * Converts a file name into a Writer taking in account the output charset. Returns null if the * file name is null. */
Converts a file name into a Writer taking in account the output charset. Returns null if the file name is null
fileNameToOutputWriter2
{ "repo_name": "monetate/closure-compiler", "path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java", "license": "apache-2.0", "size": 111958 }
[ "com.google.common.annotations.GwtIncompatible", "java.io.IOException", "java.io.StringWriter", "java.io.Writer" ]
import com.google.common.annotations.GwtIncompatible; import java.io.IOException; import java.io.StringWriter; import java.io.Writer;
import com.google.common.annotations.*; import java.io.*;
[ "com.google.common", "java.io" ]
com.google.common; java.io;
2,393,481
protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt) throws Exception { ctx.fireUserEventTriggered(evt); } private final class ReaderIdleTimeoutTask implements Runnable { private final ChannelHandlerContext ctx; ReaderIdleTimeoutTask(ChannelHandlerContext ctx) { this.ctx = ctx; }
void function(ChannelHandlerContext ctx, IdleStateEvent evt) throws Exception { ctx.fireUserEventTriggered(evt); } private final class ReaderIdleTimeoutTask implements Runnable { private final ChannelHandlerContext ctx; ReaderIdleTimeoutTask(ChannelHandlerContext ctx) { this.ctx = ctx; }
/** * Is called when an {@link IdleStateEvent} should be fired. This implementation calls * {@link ChannelHandlerContext#fireUserEventTriggered(Object)}. */
Is called when an <code>IdleStateEvent</code> should be fired. This implementation calls <code>ChannelHandlerContext#fireUserEventTriggered(Object)</code>
channelIdle
{ "repo_name": "Sandyarathi/Lab2gRPC", "path": "lib/netty/handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java", "license": "bsd-3-clause", "size": 16702 }
[ "io.netty.channel.ChannelHandlerContext" ]
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.*;
[ "io.netty.channel" ]
io.netty.channel;
556,056
public void mapTbFincialyearorgMapToTbFincialyearorgMapEntity(TbFincialyearorgMap tbFincialyearorgMap, TbFincialyearorgMapEntity tbFincialyearorgMapEntity) { if(tbFincialyearorgMap == null) { return; } //--- Generic mapping map(tbFincialyearorgMap, tbFincialyearorgMapEntity); //--- Link mapping ( link : tbFincialyearorgMap ) if( hasLinkToTbFinancialyear(tbFincialyearorgMap) ) { FinancialYear tbFinancialyear1 = new FinancialYear(); tbFinancialyear1.setFaYear( tbFincialyearorgMap.getFaYearid() ); tbFincialyearorgMapEntity.setTbFinancialyear( tbFinancialyear1 ); } else { tbFincialyearorgMapEntity.setTbFinancialyear( null ); } }
void function(TbFincialyearorgMap tbFincialyearorgMap, TbFincialyearorgMapEntity tbFincialyearorgMapEntity) { if(tbFincialyearorgMap == null) { return; } map(tbFincialyearorgMap, tbFincialyearorgMapEntity); if( hasLinkToTbFinancialyear(tbFincialyearorgMap) ) { FinancialYear tbFinancialyear1 = new FinancialYear(); tbFinancialyear1.setFaYear( tbFincialyearorgMap.getFaYearid() ); tbFincialyearorgMapEntity.setTbFinancialyear( tbFinancialyear1 ); } else { tbFincialyearorgMapEntity.setTbFinancialyear( null ); } }
/** * Mapping from 'TbFincialyearorgMap' to 'TbFincialyearorgMapEntity' * @param tbFincialyearorgMap * @param tbFincialyearorgMapEntity */
Mapping from 'TbFincialyearorgMap' to 'TbFincialyearorgMapEntity'
mapTbFincialyearorgMapToTbFincialyearorgMapEntity
{ "repo_name": "abmindiarepomanager/ABMOpenMainet", "path": "Mainet1.0/MainetServiceParent/MainetServiceCommon/src/main/java/com/abm/mainet/common/master/mapper/TbFincialyearorgMapServiceMapper.java", "license": "gpl-3.0", "size": 2972 }
[ "com.abm.mainet.common.domain.FinancialYear", "com.abm.mainet.common.domain.TbFincialyearorgMapEntity", "com.abm.mainet.common.master.dto.TbFincialyearorgMap" ]
import com.abm.mainet.common.domain.FinancialYear; import com.abm.mainet.common.domain.TbFincialyearorgMapEntity; import com.abm.mainet.common.master.dto.TbFincialyearorgMap;
import com.abm.mainet.common.domain.*; import com.abm.mainet.common.master.dto.*;
[ "com.abm.mainet" ]
com.abm.mainet;
2,874,117
@Override public T visitMethodInvocation_lf_primary(@NotNull Java8Parser.MethodInvocation_lf_primaryContext ctx) { return visitChildren(ctx); }
@Override public T visitMethodInvocation_lf_primary(@NotNull Java8Parser.MethodInvocation_lf_primaryContext ctx) { return visitChildren(ctx); }
/** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */
The default implementation returns the result of calling <code>#visitChildren</code> on ctx
visitAnnotationTypeElementDeclaration
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/Java8BaseVisitor.java", "license": "gpl-3.0", "size": 65479 }
[ "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,462,703
@Override protected boolean isStaticFieldConstant(ResolvedJavaField field) { return super.isStaticFieldConstant(field) && (!ImmutableCode.getValue() || ImmutableCodeLazy.isEmbeddable(field)); }
boolean function(ResolvedJavaField field) { return super.isStaticFieldConstant(field) && (!ImmutableCode.getValue() ImmutableCodeLazy.isEmbeddable(field)); }
/** * In AOT mode, some fields should never be embedded even for snippets/replacements. */
In AOT mode, some fields should never be embedded even for snippets/replacements
isStaticFieldConstant
{ "repo_name": "YouDiSN/OpenJDK-Research", "path": "jdk9/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraalConstantFieldProvider.java", "license": "gpl-2.0", "size": 10977 }
[ "org.graalvm.compiler.core.common.GraalOptions" ]
import org.graalvm.compiler.core.common.GraalOptions;
import org.graalvm.compiler.core.common.*;
[ "org.graalvm.compiler" ]
org.graalvm.compiler;
1,891,490
public ComponentDefinitionsFactory getFactory() { return factory; }
ComponentDefinitionsFactory function() { return factory; }
/** * Get underlying factory instance. * @return ComponentDefinitionsFactory */
Get underlying factory instance
getFactory
{ "repo_name": "davcamer/clients", "path": "projects-for-testing/struts/tiles/src/main/java/org/apache/struts/tiles/definition/ReloadableDefinitionsFactory.java", "license": "apache-2.0", "size": 10358 }
[ "org.apache.struts.tiles.ComponentDefinitionsFactory" ]
import org.apache.struts.tiles.ComponentDefinitionsFactory;
import org.apache.struts.tiles.*;
[ "org.apache.struts" ]
org.apache.struts;
953,992
private JTabbedPane getTaPanel() { if (taPanel == null) { taPanel = new JTabbedPane(); taPanel.addTab("Properties", null, getPropertiesNorthPanel(), null); taPanel.addTab("Level of Assurance", null, getTrustLevels(), null); taPanel.addTab("Certificate", null, getCertificatePanel(), null); taPanel.addTab("Certificate Revocation List", null, getCrlPanel(), null); } return taPanel; }
JTabbedPane function() { if (taPanel == null) { taPanel = new JTabbedPane(); taPanel.addTab(STR, null, getPropertiesNorthPanel(), null); taPanel.addTab(STR, null, getTrustLevels(), null); taPanel.addTab(STR, null, getCertificatePanel(), null); taPanel.addTab(STR, null, getCrlPanel(), null); } return taPanel; }
/** * This method initializes taPanel * * @return javax.swing.JTabbedPane */
This method initializes taPanel
getTaPanel
{ "repo_name": "NCIP/cagrid-core", "path": "caGrid/projects/gaards-ui/src/org/cagrid/gaards/ui/gts/TrustedAuthorityWindow.java", "license": "bsd-3-clause", "size": 33893 }
[ "javax.swing.JTabbedPane" ]
import javax.swing.JTabbedPane;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
1,101,873
public RasterTile getRasterImage() { return rasterImage; } } private class RasterImageDownloadCallable implements Callable<ImageResult> { private ImageResult result; private int retries; private String url; public RasterImageDownloadCallable(int retries, RasterTile rasterImage) { this.result = new ImageResult(rasterImage); this.retries = retries; String externalUrl = rasterImage.getUrl(); url = dispatcherUrlService.localize(externalUrl); }
RasterTile function() { return rasterImage; } } private class RasterImageDownloadCallable implements Callable<ImageResult> { private ImageResult result; private int retries; private String url; public RasterImageDownloadCallable(int retries, RasterTile rasterImage) { this.result = new ImageResult(rasterImage); this.retries = retries; String externalUrl = rasterImage.getUrl(); url = dispatcherUrlService.localize(externalUrl); }
/** * Get image for which the exception occurred. * * @return image for which the exception occurred */
Get image for which the exception occurred
getRasterImage
{ "repo_name": "geomajas/geomajas-project-server", "path": "plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/impl/RasterLayerComponentImpl.java", "license": "agpl-3.0", "size": 20540 }
[ "java.util.concurrent.Callable", "org.geomajas.layer.tile.RasterTile" ]
import java.util.concurrent.Callable; import org.geomajas.layer.tile.RasterTile;
import java.util.concurrent.*; import org.geomajas.layer.tile.*;
[ "java.util", "org.geomajas.layer" ]
java.util; org.geomajas.layer;
2,191,718
EClass getRuntime();
EClass getRuntime();
/** * Returns the meta object for class '{@link org.nasdanika.osgi.model.Runtime <em>Runtime</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Runtime</em>'. * @see org.nasdanika.osgi.model.Runtime * @generated */
Returns the meta object for class '<code>org.nasdanika.osgi.model.Runtime Runtime</code>'.
getRuntime
{ "repo_name": "Nasdanika/server", "path": "org.nasdanika.osgi.model/src/org/nasdanika/osgi/model/ModelPackage.java", "license": "epl-1.0", "size": 29859 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,492,421
public void addTWorkFlowRelatedByStateFrom(TWorkFlow l) throws TorqueException { getTWorkFlowsRelatedByStateFrom().add(l); l.setTStateRelatedByStateFrom((TState) this); }
void function(TWorkFlow l) throws TorqueException { getTWorkFlowsRelatedByStateFrom().add(l); l.setTStateRelatedByStateFrom((TState) this); }
/** * Method called to associate a TWorkFlow object to this object * through the TWorkFlow foreign key attribute * * @param l TWorkFlow * @throws TorqueException */
Method called to associate a TWorkFlow object to this object through the TWorkFlow foreign key attribute
addTWorkFlowRelatedByStateFrom
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTState.java", "license": "gpl-3.0", "size": 188907 }
[ "org.apache.torque.TorqueException" ]
import org.apache.torque.TorqueException;
import org.apache.torque.*;
[ "org.apache.torque" ]
org.apache.torque;
1,729,494
public void setRequestXMLToJava(PixManagerRequestXMLToJava requestXMLToJava) { this.requestXMLToJava = requestXMLToJava; }
void function(PixManagerRequestXMLToJava requestXMLToJava) { this.requestXMLToJava = requestXMLToJava; }
/** * Sets the request xml to java. * * @param requestXMLToJava * the new request xml to java */
Sets the request xml to java
setRequestXMLToJava
{ "repo_name": "OBHITA/Consent2Share", "path": "DS4P/acs-showcase/web-pg/src/main/java/gov/samhsa/consent2share/showcase/service/PixOperationsServiceImpl.java", "license": "bsd-3-clause", "size": 20714 }
[ "gov.samhsa.consent2share.pixclient.util.PixManagerRequestXMLToJava" ]
import gov.samhsa.consent2share.pixclient.util.PixManagerRequestXMLToJava;
import gov.samhsa.consent2share.pixclient.util.*;
[ "gov.samhsa.consent2share" ]
gov.samhsa.consent2share;
312,022
public static synchronized YamlAction of( AbstractProject project) throws IOException { YamlProperty property = (YamlProperty) project.getProperty(YamlProperty.class); if (property != null) { return property.getAction(); } YamlAction yaml = new YamlAction(project); project.addProperty(new YamlProperty(yaml)); return yaml; } private static class YamlProperty extends JobProperty<AbstractProject<?, ?>> { public YamlProperty(YamlAction action) { this.action = checkNotNull(action); }
static synchronized YamlAction function( AbstractProject project) throws IOException { YamlProperty property = (YamlProperty) project.getProperty(YamlProperty.class); if (property != null) { return property.getAction(); } YamlAction yaml = new YamlAction(project); project.addProperty(new YamlProperty(yaml)); return yaml; } private static class YamlProperty extends JobProperty<AbstractProject<?, ?>> { public YamlProperty(YamlAction action) { this.action = checkNotNull(action); }
/** * This handles fetching/attaching a {@link YamlAction} to the given * {@link AbstractProject}. Since the project may have an * immutable action list (e.g. {@link hudson.model.FreeStyleProject}), * this will attach a {@link JobProperty} to the project that * surfaces our {@link Action} when asked. */
This handles fetching/attaching a <code>YamlAction</code> to the given <code>AbstractProject</code>. Since the project may have an immutable action list (e.g. <code>hudson.model.FreeStyleProject</code>), this will attach a <code>JobProperty</code> to the project that surfaces our <code>Action</code> when asked
of
{ "repo_name": "jenkinsci/yaml-project-plugin", "path": "src/main/java/com/google/jenkins/plugins/dsl/YamlAction.java", "license": "apache-2.0", "size": 4380 }
[ "com.google.common.base.Preconditions", "hudson.model.AbstractProject", "hudson.model.JobProperty", "java.io.IOException" ]
import com.google.common.base.Preconditions; import hudson.model.AbstractProject; import hudson.model.JobProperty; import java.io.IOException;
import com.google.common.base.*; import hudson.model.*; import java.io.*;
[ "com.google.common", "hudson.model", "java.io" ]
com.google.common; hudson.model; java.io;
2,462,610
public @C.VideoScalingMode int getVideoScalingMode() { return videoScalingMode; } /** * Clears any {@link Surface}, {@link SurfaceHolder}, {@link SurfaceView} or {@link TextureView}
@C.VideoScalingMode int function() { return videoScalingMode; } /** * Clears any {@link Surface}, {@link SurfaceHolder}, {@link SurfaceView} or {@link TextureView}
/** * Returns the video scaling mode. */
Returns the video scaling mode
getVideoScalingMode
{ "repo_name": "michalliu/ExoPlayer", "path": "library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java", "license": "apache-2.0", "size": 26843 }
[ "android.view.Surface", "android.view.SurfaceHolder", "android.view.SurfaceView", "android.view.TextureView" ]
import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.TextureView;
import android.view.*;
[ "android.view" ]
android.view;
2,863,274
public static org.topbraid.spin.model.Query parseQuery(String str, Model model) { Query arq = ARQFactory.get().createQuery(model, str); ARQ2SPIN a2s = new ARQ2SPIN(model); return a2s.createQuery(arq, null); }
static org.topbraid.spin.model.Query function(String str, Model model) { Query arq = ARQFactory.get().createQuery(model, str); ARQ2SPIN a2s = new ARQ2SPIN(model); return a2s.createQuery(arq, null); }
/** * Parses a given partial query string and converts it into a SPIN structure * inside a given Model. * * @param str * the partial query string * @param model * the Model to operate on * @return the new SPIN Query */
Parses a given partial query string and converts it into a SPIN structure inside a given Model
parseQuery
{ "repo_name": "keski/rsp-spin", "path": "src/main/java/org/topbraid/spin/arq/ARQ2SPIN.java", "license": "mit", "size": 43674 }
[ "org.apache.jena.query.Query", "org.apache.jena.rdf.model.Model" ]
import org.apache.jena.query.Query; import org.apache.jena.rdf.model.Model;
import org.apache.jena.query.*; import org.apache.jena.rdf.model.*;
[ "org.apache.jena" ]
org.apache.jena;
2,054,333
private void outputSourceMap(B options, String associatedName) throws IOException { if (Strings.isNullOrEmpty(options.sourceMapOutputPath)) { return; } String outName = expandSourceMapPath(options, null); Writer out = fileNameToOutputWriter2(outName); compiler.getSourceMap().appendTo(out, associatedName); out.close(); }
void function(B options, String associatedName) throws IOException { if (Strings.isNullOrEmpty(options.sourceMapOutputPath)) { return; } String outName = expandSourceMapPath(options, null); Writer out = fileNameToOutputWriter2(outName); compiler.getSourceMap().appendTo(out, associatedName); out.close(); }
/** * Outputs the source map found in the compiler to the proper path if one * exists. * * @param options The options to the Compiler. */
Outputs the source map found in the compiler to the proper path if one exists
outputSourceMap
{ "repo_name": "wenzowski/closure-compiler", "path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java", "license": "apache-2.0", "size": 65519 }
[ "com.google.common.base.Strings", "java.io.IOException", "java.io.Writer" ]
import com.google.common.base.Strings; import java.io.IOException; import java.io.Writer;
import com.google.common.base.*; import java.io.*;
[ "com.google.common", "java.io" ]
com.google.common; java.io;
2,026,291
public String encodeList(ArrayList<T> sa, char delim) { Iterator<T> si = sa.iterator(); return encodeList(si, delim); }
String function(ArrayList<T> sa, char delim) { Iterator<T> si = sa.iterator(); return encodeList(si, delim); }
/** * Encode a list of strings by 'escaping' all instances of: delim, '\', \r, \n. The * escape char is '\'. * * This is used to build text lists separated by 'delim'. * * @param sa String array to convert * @return Converted string */
Encode a list of strings by 'escaping' all instances of: delim, '\', \r, \n. The escape char is '\'. This is used to build text lists separated by 'delim'
encodeList
{ "repo_name": "eleybourn/Book-Catalogue", "path": "src/com/eleybourn/bookcatalogue/utils/Utils.java", "license": "gpl-3.0", "size": 70928 }
[ "java.util.ArrayList", "java.util.Iterator" ]
import java.util.ArrayList; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,492,914
public WireFormatParser createParser(InputProperties inProps, XmlEventSource source) { throw new UnsupportedOperationException( "Wire format does not support xml event sources."); }
WireFormatParser function(InputProperties inProps, XmlEventSource source) { throw new UnsupportedOperationException( STR); }
/** * Create a wire format parser for a given xml event source. By default this * throws {@link UnsupportedOperationException}, subclasses can implement this * if they choose to. */
Create a wire format parser for a given xml event source. By default this throws <code>UnsupportedOperationException</code>, subclasses can implement this if they choose to
createParser
{ "repo_name": "simonrrr/gdata-java-client", "path": "java/src/com/google/gdata/wireformats/WireFormat.java", "license": "apache-2.0", "size": 3036 }
[ "com.google.gdata.data.XmlEventSource", "com.google.gdata.wireformats.input.InputProperties" ]
import com.google.gdata.data.XmlEventSource; import com.google.gdata.wireformats.input.InputProperties;
import com.google.gdata.data.*; import com.google.gdata.wireformats.input.*;
[ "com.google.gdata" ]
com.google.gdata;
1,093,070
public void testCoordinatorChange() throws Exception { // Start servers. Ignite srv1 = Ignition.start(serverConfiguration(1)); Ignite srv2 = Ignition.start(serverConfiguration(2)); Ignition.start(serverConfiguration(3, true)); Ignition.start(serverConfiguration(4)); UUID srv1Id = srv1.cluster().localNode().id(); UUID srv2Id = srv2.cluster().localNode().id(); // Start client which will execute operations. Ignite cli = Ignition.start(clientConfiguration(5)); cli.getOrCreateCache(cacheConfiguration()); put(srv1, 0, KEY_AFTER); // Test migration between normal servers. blockIndexing(srv1Id); QueryIndex idx1 = index(IDX_NAME_1, field(FIELD_NAME_1)); IgniteInternalFuture<?> idxFut1 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx1, false); Thread.sleep(100); //srv1.close(); Ignition.stop(srv1.name(), true); unblockIndexing(srv1Id); idxFut1.get(); assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1)); assertIndexUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_1, SQL_ARG_1); assertSqlSimpleData(SQL_SIMPLE_FIELD_1, KEY_AFTER - SQL_ARG_1); // Test migration from normal server to non-affinity server. blockIndexing(srv2Id); QueryIndex idx2 = index(IDX_NAME_2, field(alias(FIELD_NAME_2))); IgniteInternalFuture<?> idxFut2 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false); Thread.sleep(100); //srv2.close(); Ignition.stop(srv2.name(), true); unblockIndexing(srv2Id); idxFut2.get(); assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_2, field(alias(FIELD_NAME_2))); assertIndexUsed(IDX_NAME_2, SQL_SIMPLE_FIELD_2, SQL_ARG_1); assertSqlSimpleData(SQL_SIMPLE_FIELD_2, KEY_AFTER - SQL_ARG_1); }
void function() throws Exception { Ignite srv1 = Ignition.start(serverConfiguration(1)); Ignite srv2 = Ignition.start(serverConfiguration(2)); Ignition.start(serverConfiguration(3, true)); Ignition.start(serverConfiguration(4)); UUID srv1Id = srv1.cluster().localNode().id(); UUID srv2Id = srv2.cluster().localNode().id(); Ignite cli = Ignition.start(clientConfiguration(5)); cli.getOrCreateCache(cacheConfiguration()); put(srv1, 0, KEY_AFTER); blockIndexing(srv1Id); QueryIndex idx1 = index(IDX_NAME_1, field(FIELD_NAME_1)); IgniteInternalFuture<?> idxFut1 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx1, false); Thread.sleep(100); Ignition.stop(srv1.name(), true); unblockIndexing(srv1Id); idxFut1.get(); assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1)); assertIndexUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_1, SQL_ARG_1); assertSqlSimpleData(SQL_SIMPLE_FIELD_1, KEY_AFTER - SQL_ARG_1); blockIndexing(srv2Id); QueryIndex idx2 = index(IDX_NAME_2, field(alias(FIELD_NAME_2))); IgniteInternalFuture<?> idxFut2 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false); Thread.sleep(100); Ignition.stop(srv2.name(), true); unblockIndexing(srv2Id); idxFut2.get(); assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_2, field(alias(FIELD_NAME_2))); assertIndexUsed(IDX_NAME_2, SQL_SIMPLE_FIELD_2, SQL_ARG_1); assertSqlSimpleData(SQL_SIMPLE_FIELD_2, KEY_AFTER - SQL_ARG_1); }
/** * Make sure that coordinator migrates correctly between nodes. * * @throws Exception If failed. */
Make sure that coordinator migrates correctly between nodes
testCoordinatorChange
{ "repo_name": "mcherkasov/ignite", "path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java", "license": "apache-2.0", "size": 35122 }
[ "org.apache.ignite.Ignite", "org.apache.ignite.Ignition", "org.apache.ignite.cache.QueryIndex", "org.apache.ignite.internal.IgniteInternalFuture" ]
import org.apache.ignite.Ignite; import org.apache.ignite.Ignition; import org.apache.ignite.cache.QueryIndex; import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,369,929
public void layoutContainer(Container container) { Component[] buttonList = container.getComponents(); int x = container.getInsets().left; if (getCentersChildren()) x += (int) ((double) (container.getSize().width) / 2 - (double) (buttonRowLength(container)) / 2); for (int i = 0; i < buttonList.length; i++) { Dimension dims = buttonList[i].getPreferredSize(); if (syncAllWidths) { buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height); x += widthOfWidestButton + getPadding(); } else { buttonList[i].setBounds(x, 0, dims.width, dims.height); x += dims.width + getPadding(); } } }
void function(Container container) { Component[] buttonList = container.getComponents(); int x = container.getInsets().left; if (getCentersChildren()) x += (int) ((double) (container.getSize().width) / 2 - (double) (buttonRowLength(container)) / 2); for (int i = 0; i < buttonList.length; i++) { Dimension dims = buttonList[i].getPreferredSize(); if (syncAllWidths) { buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height); x += widthOfWidestButton + getPadding(); } else { buttonList[i].setBounds(x, 0, dims.width, dims.height); x += dims.width + getPadding(); } } }
/** * This method lays out the given container. * * @param container The container to lay out. */
This method lays out the given container
layoutContainer
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java", "license": "bsd-3-clause", "size": 39328 }
[ "java.awt.Component", "java.awt.Container", "java.awt.Dimension" ]
import java.awt.Component; import java.awt.Container; import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,193,214
void paintPanel(WebcamPanel panel, Graphics2D g2);
void paintPanel(WebcamPanel panel, Graphics2D g2);
/** * Paints panel without image. * * @param g2 the graphics 2D object used for drawing */
Paints panel without image
paintPanel
{ "repo_name": "amoschov/webcam-capture", "path": "webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamPanel.java", "license": "mit", "size": 22059 }
[ "java.awt.Graphics2D" ]
import java.awt.Graphics2D;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,003,150
public Builder putAllExtraParam(Map<String, Object> map) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.putAll(map); return this; }
Builder function(Map<String, Object> map) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.putAll(map); return this; }
/** * Add all map key/value pairs to `extraParams` map. A map is initialized for the first * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. * See {@link FeeRefundUpdateParams#extraParams} for the field documentation. */
Add all map key/value pairs to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See <code>FeeRefundUpdateParams#extraParams</code> for the field documentation
putAllExtraParam
{ "repo_name": "stripe/stripe-java", "path": "src/main/java/com/stripe/param/FeeRefundUpdateParams.java", "license": "mit", "size": 6137 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
670,361
public static File prepareFile(final String name) { return prepareFile(name, "this is a sample test upload file"); }
static File function(final String name) { return prepareFile(name, STR); }
/** * Prepare a text file in system temp directory to be used * in test for uploads, containing default content. * * @param name Name to give the file, without the file extension. If null a default name will be used. * @return {@link File} simple text file. */
Prepare a text file in system temp directory to be used in test for uploads, containing default content
prepareFile
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/share-po/src/test/java/org/alfresco/po/share/util/SiteUtil.java", "license": "lgpl-3.0", "size": 10523 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,390,500
private synchronized void startNewTask(SwingWorker<ViewUpdate, Void> task) { String[][] waitRow = new String[1][3]; waitRow[0] = new String[]{"", WAIT_TEXT, ""}; DefaultTableModel tModel = ((DefaultTableModel) resultsTable.getModel()); tModel.setDataVector(waitRow, COLUMN_HEADERS); updateColumnSizes(); updateRowHeights(); resultsTable.clearSelection(); // The output of the previous task is no longer relevant. if (currentTask != null) { // This call sets a cancellation flag. It does not terminate the background thread running the task. // The task must check the cancellation flag and react appropriately. currentTask.cancel(false); } // Start the new task. currentTask = task; currentTask.execute(); }
synchronized void function(SwingWorker<ViewUpdate, Void> task) { String[][] waitRow = new String[1][3]; waitRow[0] = new String[]{STR"}; DefaultTableModel tModel = ((DefaultTableModel) resultsTable.getModel()); tModel.setDataVector(waitRow, COLUMN_HEADERS); updateColumnSizes(); updateRowHeights(); resultsTable.clearSelection(); if (currentTask != null) { currentTask.cancel(false); } currentTask = task; currentTask.execute(); }
/** * Start a new task on its own background thread, canceling the previous * task. * * @param task A new SwingWorker object to execute as a background thread. */
Start a new task on its own background thread, canceling the previous task
startNewTask
{ "repo_name": "esaunders/autopsy", "path": "Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java", "license": "apache-2.0", "size": 44982 }
[ "javax.swing.SwingWorker", "javax.swing.table.DefaultTableModel" ]
import javax.swing.SwingWorker; import javax.swing.table.DefaultTableModel;
import javax.swing.*; import javax.swing.table.*;
[ "javax.swing" ]
javax.swing;
2,869,630
public List<IconType<FacesConfigRenderKitType<T>>> getAllIcon();
List<IconType<FacesConfigRenderKitType<T>>> function();
/** * Returns all <code>icon</code> elements * @return list of <code>icon</code> */
Returns all <code>icon</code> elements
getAllIcon
{ "repo_name": "forge/javaee-descriptors", "path": "api/src/main/java/org/jboss/shrinkwrap/descriptor/api/facesconfig20/FacesConfigRenderKitType.java", "license": "epl-1.0", "size": 11652 }
[ "java.util.List", "org.jboss.shrinkwrap.descriptor.api.javaee5.IconType" ]
import java.util.List; import org.jboss.shrinkwrap.descriptor.api.javaee5.IconType;
import java.util.*; import org.jboss.shrinkwrap.descriptor.api.javaee5.*;
[ "java.util", "org.jboss.shrinkwrap" ]
java.util; org.jboss.shrinkwrap;
1,880,345
@Test public void skipTestMore() throws IOException, WrongStreamTypeException { final long skipped = stream.skip(Integer.MAX_VALUE); final int len = TEST_FILE_CONTENT_LEN; final byte[] content = stream.read(len); assertEquals(len, skipped); assertNull(content); }
void function() throws IOException, WrongStreamTypeException { final long skipped = stream.skip(Integer.MAX_VALUE); final int len = TEST_FILE_CONTENT_LEN; final byte[] content = stream.read(len); assertEquals(len, skipped); assertNull(content); }
/** * Override it if reading is not supported. */
Override it if reading is not supported
skipTestMore
{ "repo_name": "moliva/proactive", "path": "src/Tests/unitTests/vfsprovider/AbstractStreamBase.java", "license": "agpl-3.0", "size": 9143 }
[ "java.io.IOException", "org.junit.Assert", "org.objectweb.proactive.extensions.vfsprovider.exceptions.WrongStreamTypeException" ]
import java.io.IOException; import org.junit.Assert; import org.objectweb.proactive.extensions.vfsprovider.exceptions.WrongStreamTypeException;
import java.io.*; import org.junit.*; import org.objectweb.proactive.extensions.vfsprovider.exceptions.*;
[ "java.io", "org.junit", "org.objectweb.proactive" ]
java.io; org.junit; org.objectweb.proactive;
2,574,337
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @VisibleForTesting static int networkToNetId(Network network) { // NOTE(pauljensen): This depends on Android framework implementation details. // Fortunately this functionality is unlikely to ever change. // TODO(pauljensen): When we update to Android M SDK, use Network.getNetworkHandle(). return Integer.parseInt(network.toString()); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) static int networkToNetId(Network network) { return Integer.parseInt(network.toString()); }
/** * Extracts NetID of network. Only available on Lollipop and newer releases. */
Extracts NetID of network. Only available on Lollipop and newer releases
networkToNetId
{ "repo_name": "axinging/chromium-crosswalk", "path": "net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java", "license": "bsd-3-clause", "size": 38640 }
[ "android.annotation.TargetApi", "android.net.Network", "android.os.Build" ]
import android.annotation.TargetApi; import android.net.Network; import android.os.Build;
import android.annotation.*; import android.net.*; import android.os.*;
[ "android.annotation", "android.net", "android.os" ]
android.annotation; android.net; android.os;
235,807
public void close() throws SQLException;
void function() throws SQLException;
/** * Free any resource reserved in the open method * * @throws SQLException If the free fails */
Free any resource reserved in the open method
close
{ "repo_name": "iCarto/siga", "path": "libGDBMS/src/main/java/com/hardcode/gdbms/engine/data/driver/DBDriver.java", "license": "gpl-3.0", "size": 2301 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,690,330
public UserRenderer statusColorInto(ImageView imageView) { if (!shouldHandle(imageView)) { return this; } String status = object.getStatus(); if (User.STATUS_ONLINE.equals(status)) { imageView.setImageResource(R.drawable.userstatus_online); } else if (User.STATUS_AWAY.equals(status)) { imageView.setImageResource(R.drawable.userstatus_away); } else if (User.STATUS_BUSY.equals(status)) { imageView.setImageResource(R.drawable.userstatus_busy); } else if (User.STATUS_OFFLINE.equals(status)) { imageView.setImageResource(R.drawable.userstatus_offline); } else { // unknown status is rendered as "offline" status. imageView.setImageResource(R.drawable.userstatus_offline); } return this; }
UserRenderer function(ImageView imageView) { if (!shouldHandle(imageView)) { return this; } String status = object.getStatus(); if (User.STATUS_ONLINE.equals(status)) { imageView.setImageResource(R.drawable.userstatus_online); } else if (User.STATUS_AWAY.equals(status)) { imageView.setImageResource(R.drawable.userstatus_away); } else if (User.STATUS_BUSY.equals(status)) { imageView.setImageResource(R.drawable.userstatus_busy); } else if (User.STATUS_OFFLINE.equals(status)) { imageView.setImageResource(R.drawable.userstatus_offline); } else { imageView.setImageResource(R.drawable.userstatus_offline); } return this; }
/** * show user's status color into imageView. */
show user's status color into imageView
statusColorInto
{ "repo_name": "YusukeIwaki/Rocket.Chat.Android", "path": "app/src/main/java/chat/rocket/android/renderer/UserRenderer.java", "license": "mit", "size": 1937 }
[ "android.widget.ImageView", "chat.rocket.android.model.ddp.User" ]
import android.widget.ImageView; import chat.rocket.android.model.ddp.User;
import android.widget.*; import chat.rocket.android.model.ddp.*;
[ "android.widget", "chat.rocket.android" ]
android.widget; chat.rocket.android;
2,347,276
@Override @PUT public RoutingConfigMessageWrapper put(final Context context, final Request request, final Response response, final Object payload) throws ResourceException { try { final MavenProxyRepository mavenProxyRepository = getMavenRepository( request, MavenProxyRepository.class); final DiscoveryConfig oldConfig = getManager() .getRemoteDiscoveryConfig(mavenProxyRepository); final RoutingConfigMessageWrapper wrapper = RoutingConfigMessageWrapper.class .cast(payload); // NEXUS-5567 related and some other cases (like scripting and // sending partial message to enable/disable only). // The error range of the interval value is (>0) since it's defined // in hours, and 0 or negative value would be // undefined. But still, due to unmarshalling, the field in the bean // would be 0 (or is -1 like in NEXUS-5567). // Hence, if non valid value sent, we use the "old" value to keep // it. final DiscoveryConfig config = new DiscoveryConfig( wrapper.getData().isDiscoveryEnabled(), wrapper.getData().getDiscoveryIntervalHours() > 0 ? TimeUnit.HOURS .toMillis(wrapper.getData() .getDiscoveryIntervalHours()) : oldConfig .getDiscoveryInterval()); getManager().setRemoteDiscoveryConfig(mavenProxyRepository, config); return wrapper; } catch (ClassCastException e) { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Message not recognized!", e); } catch (IllegalArgumentException e) { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Invalid or illegal configuration!", e); } catch (IOException e) { throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e); } }
RoutingConfigMessageWrapper function(final Context context, final Request request, final Response response, final Object payload) throws ResourceException { try { final MavenProxyRepository mavenProxyRepository = getMavenRepository( request, MavenProxyRepository.class); final DiscoveryConfig oldConfig = getManager() .getRemoteDiscoveryConfig(mavenProxyRepository); final RoutingConfigMessageWrapper wrapper = RoutingConfigMessageWrapper.class .cast(payload); final DiscoveryConfig config = new DiscoveryConfig( wrapper.getData().isDiscoveryEnabled(), wrapper.getData().getDiscoveryIntervalHours() > 0 ? TimeUnit.HOURS .toMillis(wrapper.getData() .getDiscoveryIntervalHours()) : oldConfig .getDiscoveryInterval()); getManager().setRemoteDiscoveryConfig(mavenProxyRepository, config); return wrapper; } catch (ClassCastException e) { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, STR, e); } catch (IllegalArgumentException e) { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, STR, e); } catch (IOException e) { throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e); } }
/** * Sets the autorouting configuration for given repository. */
Sets the autorouting configuration for given repository
put
{ "repo_name": "scmod/nexus-public", "path": "plugins/restlet1x/nexus-restlet1x-plugin/src/main/java/org/sonatype/nexus/rest/routing/RoutingConfigResource.java", "license": "epl-1.0", "size": 5110 }
[ "java.io.IOException", "java.util.concurrent.TimeUnit", "org.restlet.Context", "org.restlet.data.Request", "org.restlet.data.Response", "org.restlet.data.Status", "org.restlet.resource.ResourceException", "org.sonatype.nexus.proxy.maven.MavenProxyRepository", "org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig", "org.sonatype.nexus.rest.model.RoutingConfigMessageWrapper" ]
import java.io.IOException; import java.util.concurrent.TimeUnit; import org.restlet.Context; import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.resource.ResourceException; import org.sonatype.nexus.proxy.maven.MavenProxyRepository; import org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig; import org.sonatype.nexus.rest.model.RoutingConfigMessageWrapper;
import java.io.*; import java.util.concurrent.*; import org.restlet.*; import org.restlet.data.*; import org.restlet.resource.*; import org.sonatype.nexus.proxy.maven.*; import org.sonatype.nexus.proxy.maven.routing.*; import org.sonatype.nexus.rest.model.*;
[ "java.io", "java.util", "org.restlet", "org.restlet.data", "org.restlet.resource", "org.sonatype.nexus" ]
java.io; java.util; org.restlet; org.restlet.data; org.restlet.resource; org.sonatype.nexus;
902,844
protected void eatEof() throws IOException { int tok = st.nextToken(); if (tok != StreamTokenizer.TT_EOF) parseError("garbage at end of file, expecting EOF, " + gotWhat(tok)); }
void function() throws IOException { int tok = st.nextToken(); if (tok != StreamTokenizer.TT_EOF) parseError(STR + gotWhat(tok)); }
/** * Read EOF or report garbage at end of file. */
Read EOF or report garbage at end of file
eatEof
{ "repo_name": "margaritis/gs-core", "path": "src/org/graphstream/stream/file/FileSourceBase.java", "license": "lgpl-3.0", "size": 32992 }
[ "java.io.IOException", "java.io.StreamTokenizer" ]
import java.io.IOException; import java.io.StreamTokenizer;
import java.io.*;
[ "java.io" ]
java.io;
2,597,179
public static DatagramPacket createFromString(String Str) { byte[] buff = Str.getBytes(); DatagramPacket pack = new DatagramPacket(buff, buff.length); return pack; }
static DatagramPacket function(String Str) { byte[] buff = Str.getBytes(); DatagramPacket pack = new DatagramPacket(buff, buff.length); return pack; }
/** * Creates a new UDP packet from the provided string. * @param Str is a String to set. * @return A new DatagramPacket object. */
Creates a new UDP packet from the provided string
createFromString
{ "repo_name": "ic9/ic9", "path": "src/com/lehman/ic9/net/udpPacket.java", "license": "apache-2.0", "size": 5112 }
[ "java.net.DatagramPacket" ]
import java.net.DatagramPacket;
import java.net.*;
[ "java.net" ]
java.net;
1,567,596
protected String getFanByteReadable(int i){ return Bytes.toStringBinary(block, fanOffset + i, 1); }
String function(int i){ return Bytes.toStringBinary(block, fanOffset + i, 1); }
/** * for debugging */
for debugging
getFanByteReadable
{ "repo_name": "Jackygq1982/hbase_src", "path": "hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/decode/row/RowNodeReader.java", "license": "apache-2.0", "size": 9107 }
[ "org.apache.hadoop.hbase.util.Bytes" ]
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,891,715
public void glUniform2(int location, FloatBuffer value);
void function(int location, FloatBuffer value);
/** * <p><a target="_blank" href="http://docs.gl/gl4/glUniform">Reference Page</a></p> * <p> * Specifies the value of a single vec2 uniform variable or a vec2 uniform variable array for the current program object. * * @param location the location of the uniform variable to be modified. * @param value a pointer to an array of {@code count} values that will be used to update the specified uniform variable. */
Reference Page Specifies the value of a single vec2 uniform variable or a vec2 uniform variable array for the current program object
glUniform2
{ "repo_name": "zzuegg/jmonkeyengine", "path": "jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java", "license": "bsd-3-clause", "size": 69318 }
[ "java.nio.FloatBuffer" ]
import java.nio.FloatBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
1,666,951
@Endpoint( describeByClass = true ) public static DenseToSparseBatchDataset create(Scope scope, Operand<? extends TType> inputDataset, Operand<TInt64> batchSize, Operand<TInt64> rowShape, List<Class<? extends TType>> outputTypes, List<Shape> outputShapes) { OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DenseToSparseBatchDataset"); opBuilder.addInput(inputDataset.asOutput()); opBuilder.addInput(batchSize.asOutput()); opBuilder.addInput(rowShape.asOutput()); opBuilder.setAttr("output_types", Operands.toDataTypes(outputTypes)); Shape[] outputShapesArray = new Shape[outputShapes.size()]; for (int i = 0 ; i < outputShapesArray.length ; i++) { outputShapesArray[i] = outputShapes.get(i); } opBuilder.setAttr("output_shapes", outputShapesArray); return new DenseToSparseBatchDataset(opBuilder.build()); }
@Endpoint( describeByClass = true ) static DenseToSparseBatchDataset function(Scope scope, Operand<? extends TType> inputDataset, Operand<TInt64> batchSize, Operand<TInt64> rowShape, List<Class<? extends TType>> outputTypes, List<Shape> outputShapes) { OperationBuilder opBuilder = scope.opBuilder(OP_NAME, STR); opBuilder.addInput(inputDataset.asOutput()); opBuilder.addInput(batchSize.asOutput()); opBuilder.addInput(rowShape.asOutput()); opBuilder.setAttr(STR, Operands.toDataTypes(outputTypes)); Shape[] outputShapesArray = new Shape[outputShapes.size()]; for (int i = 0 ; i < outputShapesArray.length ; i++) { outputShapesArray[i] = outputShapes.get(i); } opBuilder.setAttr(STR, outputShapesArray); return new DenseToSparseBatchDataset(opBuilder.build()); }
/** * Factory method to create a class wrapping a new DenseToSparseBatchDataset operation. * * @param scope current scope * @param inputDataset A handle to an input dataset. Must have a single component. * @param batchSize A scalar representing the number of elements to accumulate in a * batch. * @param rowShape A vector representing the dense shape of each row in the produced * SparseTensor. The shape may be partially specified, using {@code -1} to indicate * that a particular dimension should use the maximum size of all batch elements. * @param outputTypes The value of the outputTypes attribute * @param outputShapes The value of the outputShapes attribute * @return a new instance of DenseToSparseBatchDataset */
Factory method to create a class wrapping a new DenseToSparseBatchDataset operation
create
{ "repo_name": "tensorflow/java", "path": "tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DenseToSparseBatchDataset.java", "license": "apache-2.0", "size": 5491 }
[ "java.util.List", "org.tensorflow.Operand", "org.tensorflow.OperationBuilder", "org.tensorflow.ndarray.Shape", "org.tensorflow.op.Operands", "org.tensorflow.op.Scope", "org.tensorflow.op.annotation.Endpoint", "org.tensorflow.types.TInt64", "org.tensorflow.types.family.TType" ]
import java.util.List; import org.tensorflow.Operand; import org.tensorflow.OperationBuilder; import org.tensorflow.ndarray.Shape; import org.tensorflow.op.Operands; import org.tensorflow.op.Scope; import org.tensorflow.op.annotation.Endpoint; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType;
import java.util.*; import org.tensorflow.*; import org.tensorflow.ndarray.*; import org.tensorflow.op.*; import org.tensorflow.op.annotation.*; import org.tensorflow.types.*; import org.tensorflow.types.family.*;
[ "java.util", "org.tensorflow", "org.tensorflow.ndarray", "org.tensorflow.op", "org.tensorflow.types" ]
java.util; org.tensorflow; org.tensorflow.ndarray; org.tensorflow.op; org.tensorflow.types;
2,783,434
void dispatchCommand(int reactTag, int commandId, @Nullable ReadableArray commandArgs);
void dispatchCommand(int reactTag, int commandId, @Nullable ReadableArray commandArgs);
/** * Dispatches the commandId received by parameter to the view associated with the reactTag. The * command will be processed in the UIThread. * * <p>Receiving commands as ints is deprecated and will be removed in a future release. * * <p>Pre-Fabric, this is only called on the Native Module Thread. * * @param reactTag {@link int} that identifies the view that will receive this command * @param commandId {@link int} command id * @param commandArgs {@link ReadableArray} parameters associated with the command */
Dispatches the commandId received by parameter to the view associated with the reactTag. The command will be processed in the UIThread. Receiving commands as ints is deprecated and will be removed in a future release. Pre-Fabric, this is only called on the Native Module Thread
dispatchCommand
{ "repo_name": "arthuralee/react-native", "path": "ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java", "license": "bsd-3-clause", "size": 5664 }
[ "androidx.annotation.Nullable" ]
import androidx.annotation.Nullable;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
352,243
public static TreeNode makeFunction(String function, List<TreeNode> children, ArrowType retType) { return new FunctionNode(function, children, retType); }
static TreeNode function(String function, List<TreeNode> children, ArrowType retType) { return new FunctionNode(function, children, retType); }
/** * Invoke this function to create a node representing a function. * * @param function Name of the function, e.g. add * @param children The arguments to the function * @param retType The type of the return value of the operator * @return Node representing a function */
Invoke this function to create a node representing a function
makeFunction
{ "repo_name": "xhochy/arrow", "path": "java/gandiva/src/main/java/org/apache/arrow/gandiva/expression/TreeBuilder.java", "license": "apache-2.0", "size": 7404 }
[ "java.util.List", "org.apache.arrow.vector.types.pojo.ArrowType" ]
import java.util.List; import org.apache.arrow.vector.types.pojo.ArrowType;
import java.util.*; import org.apache.arrow.vector.types.pojo.*;
[ "java.util", "org.apache.arrow" ]
java.util; org.apache.arrow;
2,856,769
public HttpResponse deleteFeedConnectionsForHttpResponse( String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling deleteFeedConnections"); } // verify the required parameter 'feedConnections' is set if (feedConnections == null) { throw new IllegalArgumentException( "Missing the required parameter 'feedConnections' when calling deleteFeedConnections"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling deleteFeedConnections"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FeedConnections/DeleteRequests"); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } HttpContent content = null; content = apiClient.new JacksonJsonHttpContent(feedConnections); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory .buildRequest(HttpMethods.POST, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); }
HttpResponse function( String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { if (xeroTenantId == null) { throw new IllegalArgumentException( STR); } if (feedConnections == null) { throw new IllegalArgumentException( STR); } if (accessToken == null) { throw new IllegalArgumentException( STR); } HttpHeaders headers = new HttpHeaders(); headers.set(STR, xeroTenantId); headers.setAccept(STR); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + STR); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug(STR + genericUrl.toString()); } HttpContent content = null; content = apiClient.new JacksonJsonHttpContent(feedConnections); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory .buildRequest(HttpMethods.POST, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); }
/** * Delete an existing feed connection By passing in FeedConnections array object in the body, you * can delete a feed connection. * * <p><b>202</b> - Success response for deleted feed connection * * <p><b>400</b> - bad input parameter * * @param xeroTenantId Xero identifier for Tenant * @param feedConnections Feed Connections array object in the body * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */
Delete an existing feed connection By passing in FeedConnections array object in the body, you can delete a feed connection. 202 - Success response for deleted feed connection 400 - bad input parameter
deleteFeedConnectionsForHttpResponse
{ "repo_name": "XeroAPI/Xero-Java", "path": "src/main/java/com/xero/api/client/BankFeedsApi.java", "license": "mit", "size": 35862 }
[ "com.google.api.client.auth.oauth2.BearerToken", "com.google.api.client.auth.oauth2.Credential", "com.google.api.client.http.GenericUrl", "com.google.api.client.http.HttpContent", "com.google.api.client.http.HttpHeaders", "com.google.api.client.http.HttpMethods", "com.google.api.client.http.HttpRequestFactory", "com.google.api.client.http.HttpResponse", "com.google.api.client.http.HttpTransport", "com.xero.models.bankfeeds.FeedConnections", "java.io.IOException", "javax.ws.rs.core.UriBuilder" ]
import com.google.api.client.auth.oauth2.BearerToken; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.xero.models.bankfeeds.FeedConnections; import java.io.IOException; import javax.ws.rs.core.UriBuilder;
import com.google.api.client.auth.oauth2.*; import com.google.api.client.http.*; import com.xero.models.bankfeeds.*; import java.io.*; import javax.ws.rs.core.*;
[ "com.google.api", "com.xero.models", "java.io", "javax.ws" ]
com.google.api; com.xero.models; java.io; javax.ws;
1,159,563
public void spawn(){ try{ if(myLairTemplate != null && getPlanetID() != -1 && bPositionSet) { //System.out.println("Spawning lair on planet " + getPlanetID() + ", coords " + getX() + ", " + getY()); //lSpawnTime = System.currentTimeMillis(); //lDeSpawnTime = System.currentTimeMillis() + SWGGui.getRandomLong(1000 * 60 * 60, 1000 * 60 * 60 * 12); iWaveID = 0; iMaxChildren = myLairTemplate.getIMaxWaves() + myLairTemplate.getIMaxPerWave() + 1; iBabyCount = 0; //EquipmentList = new Vector<TangibleItem>(); //PropList = new Vector<TangibleItem>(); vSpawnedChildren = new ConcurrentHashMap<Long,NPC>(); vHateList = new Vector<SOEObject>(); //LootList = new Vector<TangibleItem>(); bIsLairSpawned = false; //iLairId = -1; setTemplateID(myLairTemplate.getILairTemplate()); setID(server.getNextObjectID()); //if(getID() >= 20000000) // This will now always be true -- don't check it. //{ //setTemplateID(myLairTemplate.getILairTemplate()); setVehicleMaxHealth(myLairTemplate.getILairMaxCondition()); setVehicleMaxHealthKK(PacketUtils.toKK(myLairTemplate.getILairMaxCondition())); setVehicleDamage(0); setVehicleDamageKK(0); //} //set the lair template information. ItemTemplate cT = server.getTemplateData(getTemplateID()); if(cT!=null) { setCRC(cT.getCRC()); setIFFFileName(cT.getIFFFileName()); setMaxVelocity(0f); //setSTFDetailIdentifier(cT.getSTFDetailIdentifier()); //setSTFDetailName(cT.getSTFDetailName()); //setSTFFileIdentifier(cT.getSTFFileIdentifier()); // setSTFFileName(cT.getSTFFileName()); //setSTFLookAtIdentifier(cT.getSTFLookAtIdentifier()); //setSTFLookAtName(cT.getSTFLookAtName()); //setSTFLookAtName(cT.getSTFLookAtName()); server.addObjectToAllObjects(this,true,false); lMobSpawnDelayTime += (1000 * 30); } bIsLairSpawned = true; //System.out.println("Lair Spawned " + bIsLairSpawned ); Vector<Player> vPL = server.getPlayersAroundNPC(this); if(!vPL.isEmpty()) { for(int c =0; c < vPL.size();c++) { Player p = vPL.get(c); p.spawnItem(this); p.getClient().insertPacket(PacketFactory.buildNPCUpdateTransformMessage(this)); } } } }catch(Exception e){ System.out.println("Exception Caught in Lair.spawn() " + e); e.printStackTrace(); } }
void function(){ try{ if(myLairTemplate != null && getPlanetID() != -1 && bPositionSet) { iWaveID = 0; iMaxChildren = myLairTemplate.getIMaxWaves() + myLairTemplate.getIMaxPerWave() + 1; iBabyCount = 0; vSpawnedChildren = new ConcurrentHashMap<Long,NPC>(); vHateList = new Vector<SOEObject>(); bIsLairSpawned = false; setTemplateID(myLairTemplate.getILairTemplate()); setID(server.getNextObjectID()); setVehicleMaxHealth(myLairTemplate.getILairMaxCondition()); setVehicleMaxHealthKK(PacketUtils.toKK(myLairTemplate.getILairMaxCondition())); setVehicleDamage(0); setVehicleDamageKK(0); ItemTemplate cT = server.getTemplateData(getTemplateID()); if(cT!=null) { setCRC(cT.getCRC()); setIFFFileName(cT.getIFFFileName()); setMaxVelocity(0f); server.addObjectToAllObjects(this,true,false); lMobSpawnDelayTime += (1000 * 30); } bIsLairSpawned = true; Vector<Player> vPL = server.getPlayersAroundNPC(this); if(!vPL.isEmpty()) { for(int c =0; c < vPL.size();c++) { Player p = vPL.get(c); p.spawnItem(this); p.getClient().insertPacket(PacketFactory.buildNPCUpdateTransformMessage(this)); } } } }catch(Exception e){ System.out.println(STR + e); e.printStackTrace(); } }
/** * Spawns the lair and creates the mobs for it so they spawn * when the lair is ready. * @return True if successful. */
Spawns the lair and creates the mobs for it so they spawn when the lair is ready
spawn
{ "repo_name": "oswin06082/SwgAnh1.0a", "path": "documents/SWGCombined/src/Lair.java", "license": "gpl-3.0", "size": 46538 }
[ "java.util.Vector", "java.util.concurrent.ConcurrentHashMap" ]
import java.util.Vector; import java.util.concurrent.ConcurrentHashMap;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
918,350
@Override public final void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { RMIClientSocketFactory csf = null; int readCsf = in.readByte(); String host = in.readUTF(); int port = in.readInt(); if (readCsf == 0x01) { csf = (RMIClientSocketFactory) in.readObject(); } Endpoint ep = new Endpoint(host, port, csf); this.ep = ep; this.objId = ObjID.read(in); // This value is read without any purpose, only because is specified. in.readBoolean(); DGCClient dgcClient = DGCClient.getDGCClient(); dgcClient.registerRemoteRef(this, ep, objId); }
final void function(ObjectInput in) throws IOException, ClassNotFoundException { RMIClientSocketFactory csf = null; int readCsf = in.readByte(); String host = in.readUTF(); int port = in.readInt(); if (readCsf == 0x01) { csf = (RMIClientSocketFactory) in.readObject(); } Endpoint ep = new Endpoint(host, port, csf); this.ep = ep; this.objId = ObjID.read(in); in.readBoolean(); DGCClient dgcClient = DGCClient.getDGCClient(); dgcClient.registerRemoteRef(this, ep, objId); }
/** * Reads a reference from an <code>inputStream</code> during reference * deserialization. * * @param in * the stream to read data from to restore the reference * @throws IOException * if an I/O Error occur during deserialization * @throws ClassNotFoundException * If the class for this restored object is not found */
Reads a reference from an <code>inputStream</code> during reference deserialization
readExternal
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/modules/rmi2/src/ar/org/fitc/rmi/server/UnicastRemoteRef2Impl.java", "license": "apache-2.0", "size": 4192 }
[ "ar.org.fitc.rmi.dgc.client.DGCClient", "ar.org.fitc.rmi.transport.Endpoint", "java.io.IOException", "java.io.ObjectInput", "java.rmi.server.ObjID", "java.rmi.server.RMIClientSocketFactory" ]
import ar.org.fitc.rmi.dgc.client.DGCClient; import ar.org.fitc.rmi.transport.Endpoint; import java.io.IOException; import java.io.ObjectInput; import java.rmi.server.ObjID; import java.rmi.server.RMIClientSocketFactory;
import ar.org.fitc.rmi.dgc.client.*; import ar.org.fitc.rmi.transport.*; import java.io.*; import java.rmi.server.*;
[ "ar.org.fitc", "java.io", "java.rmi" ]
ar.org.fitc; java.io; java.rmi;
92,912
public static GraalDebugConfig forceInitialization(OptionValues options, Object... capabilities) { return ensureInitializedHelper(options, true, capabilities); }
static GraalDebugConfig function(OptionValues options, Object... capabilities) { return ensureInitializedHelper(options, true, capabilities); }
/** * Create a new GraalDebugConfig if {@link Debug#isEnabled()} is true, even if one had already * been created. Additionally add {@code extraArgs} as capabilities to the * {@link DebugDumpHandler}s associated with the current config. Capabilities can be added at * any time. * * @return the current {@link GraalDebugConfig} or null if nothing was done */
Create a new GraalDebugConfig if <code>Debug#isEnabled()</code> is true, even if one had already been created. Additionally add extraArgs as capabilities to the <code>DebugDumpHandler</code>s associated with the current config. Capabilities can be added at any time
forceInitialization
{ "repo_name": "graalvm/graal-core", "path": "graal/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DebugEnvironment.java", "license": "gpl-2.0", "size": 4770 }
[ "org.graalvm.compiler.options.OptionValues" ]
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.options.*;
[ "org.graalvm.compiler" ]
org.graalvm.compiler;
2,174,715
public void merge(Object on) { if (on instanceof Cube) { ObjectUtils.updateProperties(o, ((Cube) on).o); } else { ObjectUtils.updateProperties(o, on); } }
void function(Object on) { if (on instanceof Cube) { ObjectUtils.updateProperties(o, ((Cube) on).o); } else { ObjectUtils.updateProperties(o, on); } }
/** * Merges this object's attributes with another Object, ignoring null values. * * @param on * This object will have its properties updated, according to this object's values. * @author wonka * @since 14/04/2013 */
Merges this object's attributes with another Object, ignoring null values
merge
{ "repo_name": "ulisseslima/cuber", "path": "src/main/java/com/dvlcube/cuber/Cube.java", "license": "gpl-3.0", "size": 2665 }
[ "com.dvlcube.cuber.utils.ObjectUtils" ]
import com.dvlcube.cuber.utils.ObjectUtils;
import com.dvlcube.cuber.utils.*;
[ "com.dvlcube.cuber" ]
com.dvlcube.cuber;
847,381
public void sort(Object propertyId, SortDirection direction) { sort(Sort.by(propertyId, direction)); }
void function(Object propertyId, SortDirection direction) { sort(Sort.by(propertyId, direction)); }
/** * Sort this Grid in user-specified {@link SortOrder} by a property. * <p> * <em>Note:</em> Sorting by a property that has no column in Grid will hide * all possible sorting indicators. * * @param propertyId * a property ID * @param direction * a sort order value (ascending/descending) * * @throws IllegalStateException * if container is not sortable (does not implement * Container.Sortable) * @throws IllegalArgumentException * if trying to sort by non-existing property */
Sort this Grid in user-specified <code>SortOrder</code> by a property. Note: Sorting by a property that has no column in Grid will hide all possible sorting indicators
sort
{ "repo_name": "synes/vaadin", "path": "server/src/com/vaadin/ui/Grid.java", "license": "apache-2.0", "size": 239096 }
[ "com.vaadin.data.sort.Sort", "com.vaadin.shared.data.sort.SortDirection" ]
import com.vaadin.data.sort.Sort; import com.vaadin.shared.data.sort.SortDirection;
import com.vaadin.data.sort.*; import com.vaadin.shared.data.sort.*;
[ "com.vaadin.data", "com.vaadin.shared" ]
com.vaadin.data; com.vaadin.shared;
1,974,331
public NNClassificationModel withStrategy(NNStrategy stgy) { this.stgy = stgy; return this; }
NNClassificationModel function(NNStrategy stgy) { this.stgy = stgy; return this; }
/** * Set up parameter of the NN model. * @param stgy Strategy of calculations. * @return Model. */
Set up parameter of the NN model
withStrategy
{ "repo_name": "amirakhmedov/ignite", "path": "modules/ml/src/main/java/org/apache/ignite/ml/knn/NNClassificationModel.java", "license": "apache-2.0", "size": 7953 }
[ "org.apache.ignite.ml.knn.classification.NNStrategy" ]
import org.apache.ignite.ml.knn.classification.NNStrategy;
import org.apache.ignite.ml.knn.classification.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,453,157
if(annotationClassName==null || annotationClassName.trim().isEmpty()) throw new IllegalArgumentException("The passed class name was null or empty"); try { @SuppressWarnings("unchecked") Class<Annotation> annotationClass = (Class<Annotation>) (classLoader==null ? Class.forName(annotationClassName, true, Thread.currentThread().getContextClassLoader()) : Class.forName(annotationClassName, true, classLoader)); return new AnnotationBuilder(annotationClass); } catch (Exception ex) { throw new RuntimeException("Failed to load class [" + annotationClassName + "]", ex); } }
if(annotationClassName==null annotationClassName.trim().isEmpty()) throw new IllegalArgumentException(STR); try { @SuppressWarnings(STR) Class<Annotation> annotationClass = (Class<Annotation>) (classLoader==null ? Class.forName(annotationClassName, true, Thread.currentThread().getContextClassLoader()) : Class.forName(annotationClassName, true, classLoader)); return new AnnotationBuilder(annotationClass); } catch (Exception ex) { throw new RuntimeException(STR + annotationClassName + "]", ex); } }
/** * Creates a new AnnotationBuilder * @param annotationClassName The class name of the annotation to build * @param classLoader The optional class loader * @return an annotation builder */
Creates a new AnnotationBuilder
newBuilder
{ "repo_name": "nickman/retransformer", "path": "src/main/java/com/heliosapm/aop/retransformer/AnnotationBuilder.java", "license": "apache-2.0", "size": 35730 }
[ "java.lang.annotation.Annotation" ]
import java.lang.annotation.Annotation;
import java.lang.annotation.*;
[ "java.lang" ]
java.lang;
2,203,844
boolean canSubmitCalendarDocument(String principalId, CalendarDocumentContract calendarDocument);
boolean canSubmitCalendarDocument(String principalId, CalendarDocumentContract calendarDocument);
/** * Checks whether the given {@code principalId} can submit the LeaveCalendar specified by {@code documentId}. * * @param principalId The person to check * @param calendarDocument The id of the document * * @return true if {@code principalId} can submit the LeaveCalendar specified by {@code documentId}, false otherwise. */
Checks whether the given principalId can submit the LeaveCalendar specified by documentId
canSubmitCalendarDocument
{ "repo_name": "kuali/kpme", "path": "core/api/src/main/java/org/kuali/kpme/core/api/permission/HRPermissionService.java", "license": "apache-2.0", "size": 12451 }
[ "org.kuali.kpme.core.api.document.calendar.CalendarDocumentContract" ]
import org.kuali.kpme.core.api.document.calendar.CalendarDocumentContract;
import org.kuali.kpme.core.api.document.calendar.*;
[ "org.kuali.kpme" ]
org.kuali.kpme;
505,453
public Map<String, List<FileItem>> parseParameterMap(final RequestContext ctx) throws FileUploadException { final List<FileItem> items = parseRequest(ctx); final Map<String, List<FileItem>> itemsMap = new HashMap<>(items.size()); for (final FileItem fileItem : items) { final String fieldName = fileItem.getFieldName(); final List<FileItem> mappedItems = itemsMap.computeIfAbsent(fieldName, k -> new ArrayList<>()); mappedItems.add(fileItem); } return itemsMap; } // ------------------------------------------------------ Protected methods
Map<String, List<FileItem>> function(final RequestContext ctx) throws FileUploadException { final List<FileItem> items = parseRequest(ctx); final Map<String, List<FileItem>> itemsMap = new HashMap<>(items.size()); for (final FileItem fileItem : items) { final String fieldName = fileItem.getFieldName(); final List<FileItem> mappedItems = itemsMap.computeIfAbsent(fieldName, k -> new ArrayList<>()); mappedItems.add(fileItem); } return itemsMap; }
/** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> * compliant {@code multipart/form-data} stream. * * @param ctx The context for the request to be parsed. * * @return A map of {@code FileItem} instances parsed from the request. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * * @since 1.3 */
Processes an RFC 1867 compliant multipart/form-data stream
parseParameterMap
{ "repo_name": "apache/commons-fileupload", "path": "src/main/java/org/apache/commons/fileupload2/FileUploadBase.java", "license": "apache-2.0", "size": 24256 }
[ "java.util.ArrayList", "java.util.HashMap", "java.util.List", "java.util.Map" ]
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,352,223
@Test public void intoDateDefaultUnused() { final Date date = new Date(); final Date defaultValue = null; Assert.assertEquals(date, Convert.intoDate(date, defaultValue)); Assert.assertEquals(date, Convert.intoDate(date.getTime(), defaultValue)); Assert.assertEquals(date, Convert.intoDate(Long.toString(date.getTime()), defaultValue)); final Calendar calendar = Calendar.getInstance(); Assert.assertEquals(calendar.getTime(), Convert.intoDate(calendar, defaultValue)); Assert.assertEquals(calendar.getTime(), Convert.intoDate(calendar.getTime(), defaultValue)); Assert.assertEquals(calendar.getTime(), Convert.intoDate(calendar.getTime().getTime(), defaultValue)); final String timeString = Long.toString(calendar.getTime().getTime()); Assert.assertEquals(calendar.getTime(), Convert.intoDate(timeString, defaultValue)); }
void function() { final Date date = new Date(); final Date defaultValue = null; Assert.assertEquals(date, Convert.intoDate(date, defaultValue)); Assert.assertEquals(date, Convert.intoDate(date.getTime(), defaultValue)); Assert.assertEquals(date, Convert.intoDate(Long.toString(date.getTime()), defaultValue)); final Calendar calendar = Calendar.getInstance(); Assert.assertEquals(calendar.getTime(), Convert.intoDate(calendar, defaultValue)); Assert.assertEquals(calendar.getTime(), Convert.intoDate(calendar.getTime(), defaultValue)); Assert.assertEquals(calendar.getTime(), Convert.intoDate(calendar.getTime().getTime(), defaultValue)); final String timeString = Long.toString(calendar.getTime().getTime()); Assert.assertEquals(calendar.getTime(), Convert.intoDate(timeString, defaultValue)); }
/** * Tests {@link Convert#intoDate(Object, Date)} with valid attributes. */
Tests <code>Convert#intoDate(Object, Date)</code> with valid attributes
intoDateDefaultUnused
{ "repo_name": "cosmocode/cosmocode-commons", "path": "src/test/java/de/cosmocode/collections/utility/convert/ConvertDateTest.java", "license": "apache-2.0", "size": 7435 }
[ "de.cosmocode.collections.utility.Convert", "java.util.Calendar", "java.util.Date", "org.junit.Assert" ]
import de.cosmocode.collections.utility.Convert; import java.util.Calendar; import java.util.Date; import org.junit.Assert;
import de.cosmocode.collections.utility.*; import java.util.*; import org.junit.*;
[ "de.cosmocode.collections", "java.util", "org.junit" ]
de.cosmocode.collections; java.util; org.junit;
1,671,255
public void initializeLocalFileResources() { String resourcePath = this._loadTrack.getResourcePath(); if( !resourcePath.endsWith( File.separator ) ) { resourcePath += File.separator; } this.eventImg = new File(resourcePath + "event.jpg"); this.eventThumb = new File(resourcePath + "event_thumb.jpg"); this.eventPdf = new File(resourcePath + "event.pdf"); this.personImg = new File(resourcePath + "person.jpg"); this.personThumb = new File(resourcePath + "person_thumb.jpg"); }
void function() { String resourcePath = this._loadTrack.getResourcePath(); if( !resourcePath.endsWith( File.separator ) ) { resourcePath += File.separator; } this.eventImg = new File(resourcePath + STR); this.eventThumb = new File(resourcePath + STR); this.eventPdf = new File(resourcePath + STR); this.personImg = new File(resourcePath + STR); this.personThumb = new File(resourcePath + STR); }
/** * Initialize local resources (e.g. files that we need to submit). */
Initialize local resources (e.g. files that we need to submit)
initializeLocalFileResources
{ "repo_name": "krady/rain-workload-toolkit", "path": "src/radlab/rain/workload/olio/OlioGenerator.java", "license": "bsd-3-clause", "size": 17042 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,921,374
public void close() { try { gen.close(); } catch(Exception e) { throw new SerializeException("Low level write serialization error", e); } }
void function() { try { gen.close(); } catch(Exception e) { throw new SerializeException(STR, e); } }
/** * Close (prevents any further writing) */
Close (prevents any further writing)
close
{ "repo_name": "jimmutable/core", "path": "core/src/main/java/org/jimmutable/core/serialization/writer/LowLevelWriter.java", "license": "bsd-3-clause", "size": 14432 }
[ "org.jimmutable.core.exceptions.SerializeException" ]
import org.jimmutable.core.exceptions.SerializeException;
import org.jimmutable.core.exceptions.*;
[ "org.jimmutable.core" ]
org.jimmutable.core;
968,002
public static List<String> retrieveList(int paoType, String paoPathName) { int SUBDIRS = 10; int FILES = 20; List<String> rtFileNames = new ArrayList<String>(); File crtFile = new File(paoPathName); File[] files = crtFile.listFiles(); if (files != null) { int numFiles = files.length; for (int i = 0; i < numFiles; i++) { if (paoType == SUBDIRS) { // We will pass back all // subdirectories within the path if (files[i].isDirectory()) { rtFileNames.add(files[i].getName()); } } else if (paoType == FILES) { // We will pass back all files // within the path if (files[i].isFile()) { rtFileNames.add(files[i].getName()); } } } } return rtFileNames; }
static List<String> function(int paoType, String paoPathName) { int SUBDIRS = 10; int FILES = 20; List<String> rtFileNames = new ArrayList<String>(); File crtFile = new File(paoPathName); File[] files = crtFile.listFiles(); if (files != null) { int numFiles = files.length; for (int i = 0; i < numFiles; i++) { if (paoType == SUBDIRS) { if (files[i].isDirectory()) { rtFileNames.add(files[i].getName()); } } else if (paoType == FILES) { if (files[i].isFile()) { rtFileNames.add(files[i].getName()); } } } } return rtFileNames; }
/** * Description: This method will return to the user a list of directories * within a path if the type specified is SUBDIRS. If the type specified is * FILES then the method will return to the user a list of files within the * specified path * * @param paoType * : This is a values representing either SUBDIRS or FILES. * * @param paoPathName * : This is the directory which will be searched. * * @return An arraylist of names or null if no data is to be returned. */
Description: This method will return to the user a list of directories within a path if the type specified is SUBDIRS. If the type specified is FILES then the method will return to the user a list of files within the specified path
retrieveList
{ "repo_name": "ehensin/ehensin-tunnel", "path": "tunnel-client/src/main/java/com/ehensin/tunnel/client/util/file/FileUtil.java", "license": "apache-2.0", "size": 15068 }
[ "java.io.File", "java.util.ArrayList", "java.util.List" ]
import java.io.File; import java.util.ArrayList; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
749,604
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(" ").append(policyIdentifier.toString()).append("\n"); for(PolicyQualifierInfo info : policyQualifiers) { sb.append(" PolicyQualifierInfo: ["); switch (info.getPolicyQualifierId()) { case "1.3.6.1.5.5.7.2.1": sb.append("Certification Practice Statement"); break; case "1.3.6.1.5.5.7.2.2": sb.append("User Notice"); break; } // TODO Want to actually display decoded policy qualifier //sb.append(HexUtils.toHexString(info.getPolicyQualifier())); sb.append("]\n"); } return sb.toString(); }
String function() { StringBuilder sb = new StringBuilder(); sb.append(" ").append(policyIdentifier.toString()).append("\n"); for(PolicyQualifierInfo info : policyQualifiers) { sb.append(STR); switch (info.getPolicyQualifierId()) { case STR: sb.append(STR); break; case STR: sb.append(STR); break; } sb.append("]\n"); } return sb.toString(); }
/** * Return a printable representation of the PolicyInformation. */
Return a printable representation of the PolicyInformation
toString
{ "repo_name": "cfloersch/keytool", "path": "src/main/java/xpertss/crypto/x509/PolicyInformation.java", "license": "gpl-2.0", "size": 9202 }
[ "java.security.cert.PolicyQualifierInfo" ]
import java.security.cert.PolicyQualifierInfo;
import java.security.cert.*;
[ "java.security" ]
java.security;
1,951,910
public void nextDay() { Iterator<HvZPlayer> itr = zombies.iterator(); while (itr.hasNext()) { HvZPlayer zombie = itr.next(); if (!lastKill.containsKey(zombie)) { throw new IllegalStateException("zombie is missing from map: " + zombie); } int last = lastKill.get(zombie); if (last >= ZOMBIE_STARVE) { // zombie did not eat anybody, so it starves System.out.println(zombie.getName() + " dies of starvation"); // itr.remove(); zombies.remove(zombie); players.remove(zombie.getName()); kills.remove(zombie); lastKill.remove(zombie); } else { lastKill.put(zombie, last + 1); } } System.out.println("End of day " + day); day++; }
void function() { Iterator<HvZPlayer> itr = zombies.iterator(); while (itr.hasNext()) { HvZPlayer zombie = itr.next(); if (!lastKill.containsKey(zombie)) { throw new IllegalStateException(STR + zombie); } int last = lastKill.get(zombie); if (last >= ZOMBIE_STARVE) { System.out.println(zombie.getName() + STR); zombies.remove(zombie); players.remove(zombie.getName()); kills.remove(zombie); lastKill.remove(zombie); } else { lastKill.put(zombie, last + 1); } } System.out.println(STR + day); day++; }
/** * Advances the state of the game by one day. * Most significantly, any zombies that have not killed a human recently * die of starvation and are removed from the game. */
Advances the state of the game by one day. Most significantly, any zombies that have not killed a human recently die of starvation and are removed from the game
nextDay
{ "repo_name": "Amblamps/School-Projects", "path": "CSE373_DataStructures_and_Aglorithms/Assignment6_TheRotatingDead/src/HvZSimulation.java", "license": "mit", "size": 5847 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,214,597
void httpDelete(String urlPath, Map<String, String> urlVariables) throws Exception;
void httpDelete(String urlPath, Map<String, String> urlVariables) throws Exception;
/** * Invoke HTTP Delete operation. * * @param urlPath * URL path for service including template variables. * @param urlVariables * URL variables to be expanded by template. */
Invoke HTTP Delete operation
httpDelete
{ "repo_name": "athrane/pineapple", "path": "plugins/pineapple-agent-plugin/src/main/java/com/alpha/pineapple/plugin/agent/session/AgentSession.java", "license": "gpl-3.0", "size": 4758 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
511,625
public void open() { display = Display.getDefault(); shell = new Shell(); shell.setLayout(new FormLayout()); shell.open(); shell.setSize(800, 600); shell.setText("日志分析系统"); shell.setImage(SWTResourceManager.getImage(".\\icons\\log.png")); createToolBar(); createSashForm(); createStatusBar(); loadLogs(); shell.layout(); while (shell!=null&!shell.isDisposed()) { if (display!=null&&!display.readAndDispatch()) { display.sleep(); } } }
void function() { display = Display.getDefault(); shell = new Shell(); shell.setLayout(new FormLayout()); shell.open(); shell.setSize(800, 600); shell.setText(STR); shell.setImage(SWTResourceManager.getImage(STR)); createToolBar(); createSashForm(); createStatusBar(); loadLogs(); shell.layout(); while (shell!=null&!shell.isDisposed()) { if (display!=null&&!display.readAndDispatch()) { display.sleep(); } } }
/** * Open the window. */
Open the window
open
{ "repo_name": "caizhenxing/androidrobot", "path": "AndroidRobot_Spider3/src/com/android/robot/LogAnalysis.java", "license": "apache-2.0", "size": 7994 }
[ "org.eclipse.swt.layout.FormLayout", "org.eclipse.swt.widgets.Display", "org.eclipse.swt.widgets.Shell", "org.eclipse.wb.swt.SWTResourceManager" ]
import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Display; 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;
1,267,331
public void messageLocale_unknown() throws SQLException { String url = getReadWriteJDBCURL("rrTTdb"); url += ";create=true"; Connection locConn = DriverManager.getConnection(url); Statement s = locConn.createStatement(); createLocaleProcedures(locConn); // check this current database was created with the default locale rr_TT s.executeUpdate("call checkDefaultLoc()"); // check database Locale s.executeUpdate("call checkDatabaseLoc('rr_TT')"); // Expect an error in English because rr_TT has no translated messages. // Language is determined by choosing a random word (that we hope // won't change) in the current try { s.executeUpdate("create table t1 oops (i int)"); } catch (SQLException se) { assertSQLState("42X01", se); assertTrue("Expected English Message with \"Encountered\" " , (se.getMessage().indexOf("Encountered") != -1)); } // Setup for warning s.executeUpdate("create table t2 (i int)"); s.executeUpdate("create index i2_a on t2(i)"); // Expect WARNING to also be English. Index is a duplicate s.executeUpdate("create index i2_b on t2(i)"); SQLWarning sqlw = s.getWarnings(); assertSQLState("01504", sqlw); assertTrue("Expected English warning", sqlw.getMessage().indexOf("duplicate") != -1); s.close(); locConn.close(); }
void function() throws SQLException { String url = getReadWriteJDBCURL(STR); url += STR; Connection locConn = DriverManager.getConnection(url); Statement s = locConn.createStatement(); createLocaleProcedures(locConn); s.executeUpdate(STR); s.executeUpdate(STR); try { s.executeUpdate(STR); } catch (SQLException se) { assertSQLState("42X01", se); assertTrue(STREncountered\" " , (se.getMessage().indexOf(STR) != -1)); } s.executeUpdate(STR); s.executeUpdate(STR); s.executeUpdate(STR); SQLWarning sqlw = s.getWarnings(); assertSQLState("01504", sqlw); assertTrue(STR, sqlw.getMessage().indexOf(STR) != -1); s.close(); locConn.close(); }
/** * Test valid message resolution for an unknown Locale. * converted from i18n/messageLocale.sql * * This test case must run in a decorator that sets the locale to one * that is not recognized by Derby. */
Test valid message resolution for an unknown Locale. converted from i18n/messageLocale.sql This test case must run in a decorator that sets the locale to one that is not recognized by Derby
messageLocale_unknown
{ "repo_name": "viaper/DBPlus", "path": "DerbyHodgepodge/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/UrlLocaleTest.java", "license": "apache-2.0", "size": 13021 }
[ "java.sql.Connection", "java.sql.DriverManager", "java.sql.SQLException", "java.sql.SQLWarning", "java.sql.Statement" ]
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
118,986
HashMap getDestroyedSubregionSerialNumbers() { if (!isDestroyed) { throw new IllegalStateException( String.format( "Region %s must be destroyed before calling getDestroyedSubregionSerialNumbers", getFullPath())); } return destroyedSubregionSerialNumbers; }
HashMap getDestroyedSubregionSerialNumbers() { if (!isDestroyed) { throw new IllegalStateException( String.format( STR, getFullPath())); } return destroyedSubregionSerialNumbers; }
/** * Returns a map of subregions that were destroyed when this region was destroyed. Map contains * subregion full paths to SerialNumbers. Return is defined as HashMap because * DestroyRegionOperation will provide the map to DataSerializer.writeHashMap which requires * HashMap. Returns {@link #destroyedSubregionSerialNumbers}. * * @return HashMap of subregions to SerialNumbers * @throws IllegalStateException if this region has not been destroyed */
Returns a map of subregions that were destroyed when this region was destroyed. Map contains subregion full paths to SerialNumbers. Return is defined as HashMap because DestroyRegionOperation will provide the map to DataSerializer.writeHashMap which requires HashMap. Returns <code>#destroyedSubregionSerialNumbers</code>
getDestroyedSubregionSerialNumbers
{ "repo_name": "PurelyApplied/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java", "license": "apache-2.0", "size": 391137 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,585,850
private static boolean isPositionGreater(DetailAST ast1, DetailAST ast2) { if (ast1.getLineNo() > ast2.getLineNo()) { return true; } if (ast1.getLineNo() < ast2.getLineNo()) { return false; } return ast1.getColumnNo() > ast2.getColumnNo(); }
static boolean function(DetailAST ast1, DetailAST ast2) { if (ast1.getLineNo() > ast2.getLineNo()) { return true; } if (ast1.getLineNo() < ast2.getLineNo()) { return false; } return ast1.getColumnNo() > ast2.getColumnNo(); }
/** * Checks if position of first DetailAST is greater than position of * second DetailAST. Position is line number and column number in source * file. * @param ast1 * first DetailAST node. * @param ast2 * second DetailAST node. * @return true if position of ast1 is greater than position of ast2. */
Checks if position of first DetailAST is greater than position of second DetailAST. Position is line number and column number in source file
isPositionGreater
{ "repo_name": "cs1331/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java", "license": "apache-2.0", "size": 23517 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
989,274
protected void buildTreeGraph( final Object object, final TreeNode treeNode, final String nodeId, final Map ruleMap, final UndigesterUtils undigesterUtils, final StringValidator stringValidator, final EqualityComparator equalityComparator) throws UndigesterException { Object t_Key = undigesterUtils.buildPatternKey(nodeId); Collection t_cRules = (Collection) ruleMap.get(t_Key); if (t_cRules != null) { Iterator t_itRuleIterator = t_cRules.iterator(); while (t_itRuleIterator.hasNext()) { Rule t_CurrentRule = (Rule) t_itRuleIterator.next(); if (t_CurrentRule instanceof StructureShaperRule) { applyRule( t_CurrentRule, treeNode, ruleMap, undigesterUtils, stringValidator, equalityComparator); } } applyNewBornChildRules( treeNode, ruleMap, undigesterUtils, stringValidator, equalityComparator); } }
void function( final Object object, final TreeNode treeNode, final String nodeId, final Map ruleMap, final UndigesterUtils undigesterUtils, final StringValidator stringValidator, final EqualityComparator equalityComparator) throws UndigesterException { Object t_Key = undigesterUtils.buildPatternKey(nodeId); Collection t_cRules = (Collection) ruleMap.get(t_Key); if (t_cRules != null) { Iterator t_itRuleIterator = t_cRules.iterator(); while (t_itRuleIterator.hasNext()) { Rule t_CurrentRule = (Rule) t_itRuleIterator.next(); if (t_CurrentRule instanceof StructureShaperRule) { applyRule( t_CurrentRule, treeNode, ruleMap, undigesterUtils, stringValidator, equalityComparator); } } applyNewBornChildRules( treeNode, ruleMap, undigesterUtils, stringValidator, equalityComparator); } }
/** * Builds the object graph starting by given object, * according to the configured rules. * @param object the object to unparse. * @param treeNode the root of the (sub)graph to serialize. * @param nodeId the node identifier. * @param ruleMap the rule map. * @param undigesterUtils the UndigesterUtils instance. * @param stringValidator the StringValidator instance. * @param equalityComparator the EqualityComparator instance. * @throws UndigesterException if the serialization process fails. * @precondition object != null * @precondition treeNode != null * @precondition nodeId != null * @precondition ruleMap != null * @precondition undigesterUtils != null * @precondition stringValidator != null * @precondition equalityComparator != null */
Builds the object graph starting by given object, according to the configured rules
buildTreeGraph
{ "repo_name": "rydnr/undigester", "path": "src/main/java/org/acmsl/undigester/Undigester.java", "license": "gpl-2.0", "size": 30335 }
[ "java.util.Collection", "java.util.Iterator", "java.util.Map", "org.acmsl.commons.utils.EqualityComparator", "org.acmsl.commons.utils.StringValidator", "org.acmsl.undigester.Rule", "org.acmsl.undigester.TreeNode", "org.acmsl.undigester.UndigesterException", "org.acmsl.undigester.utils.UndigesterUtils" ]
import java.util.Collection; import java.util.Iterator; import java.util.Map; import org.acmsl.commons.utils.EqualityComparator; import org.acmsl.commons.utils.StringValidator; import org.acmsl.undigester.Rule; import org.acmsl.undigester.TreeNode; import org.acmsl.undigester.UndigesterException; import org.acmsl.undigester.utils.UndigesterUtils;
import java.util.*; import org.acmsl.commons.utils.*; import org.acmsl.undigester.*; import org.acmsl.undigester.utils.*;
[ "java.util", "org.acmsl.commons", "org.acmsl.undigester" ]
java.util; org.acmsl.commons; org.acmsl.undigester;
1,757,204