method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
public default Configuration getConfiguration() {
return new BaseConfiguration();
}
|
default Configuration function() { return new BaseConfiguration(); }
|
/**
* Get the configuration representation of this strategy.
* This is useful for converting a strategy into a serialized form.
*
* @return the configuration used to create this strategy
*/
|
Get the configuration representation of this strategy. This is useful for converting a strategy into a serialized form
|
getConfiguration
|
{
"repo_name": "samiunn/incubator-tinkerpop",
"path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java",
"license": "apache-2.0",
"size": 10514
}
|
[
"org.apache.commons.configuration.BaseConfiguration",
"org.apache.commons.configuration.Configuration"
] |
import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.Configuration;
|
import org.apache.commons.configuration.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 1,173,198
|
@Test
public void testCalculate() throws Exception {
final int mass = 30;
final int num_jj = 3;
final JumpJet jj = (JumpJet) ItemDB.lookup("JUMP JETS - CLASS I");
final double t = jj.getDuration();
final double F = jj.getForce();
final double h = F * t * t / (2 * mass) * num_jj;
items.add(jj);
when(mlc.chassis.getMassMax()).thenReturn(mass);
when(mlc.loadout.getJumpJetCount()).thenReturn(num_jj);
assertEquals(h, cut.calculate(), 0.5);
}
|
void function() throws Exception { final int mass = 30; final int num_jj = 3; final JumpJet jj = (JumpJet) ItemDB.lookup(STR); final double t = jj.getDuration(); final double F = jj.getForce(); final double h = F * t * t / (2 * mass) * num_jj; items.add(jj); when(mlc.chassis.getMassMax()).thenReturn(mass); when(mlc.loadout.getJumpJetCount()).thenReturn(num_jj); assertEquals(h, cut.calculate(), 0.5); }
|
/**
* The jump jet definitions in the xml list forces in kilo Newton. When weights are taken as tons, the calculations
* can be done without compensating for factor 1000 (surprise, how convenient!). F = m*a h = a*t^2/2 = F*t*t/(2*m)
* TODO: Does not take into account the impulse yet!
*/
|
The jump jet definitions in the xml list forces in kilo Newton. When weights are taken as tons, the calculations can be done without compensating for factor 1000 (surprise, how convenient!). F = m*a h = a*t^2/2 = F*t*t/(2*m)
|
testCalculate
|
{
"repo_name": "EmilyBjoerk/lsml",
"path": "src/test/java/org/lisoft/lsml/model/metrics/JumpDistanceTest.java",
"license": "gpl-3.0",
"size": 2712
}
|
[
"org.junit.Assert",
"org.lisoft.lsml.model.database.ItemDB",
"org.lisoft.lsml.model.item.JumpJet",
"org.mockito.Mockito"
] |
import org.junit.Assert; import org.lisoft.lsml.model.database.ItemDB; import org.lisoft.lsml.model.item.JumpJet; import org.mockito.Mockito;
|
import org.junit.*; import org.lisoft.lsml.model.database.*; import org.lisoft.lsml.model.item.*; import org.mockito.*;
|
[
"org.junit",
"org.lisoft.lsml",
"org.mockito"
] |
org.junit; org.lisoft.lsml; org.mockito;
| 720,341
|
@LogValue
public Object toLogValue() {
return LogValueMapFactory.of(
"id", Integer.toHexString(System.identityHashCode(this)),
"class", this.getClass(),
"Factories", _factories);
}
/**
* {@inheritDoc}
|
Object function() { return LogValueMapFactory.of( "id", Integer.toHexString(System.identityHashCode(this)), "class", this.getClass(), STR, _factories); } /** * {@inheritDoc}
|
/**
* Generate a Steno log compatible representation.
*
* @return Steno log compatible representation.
*/
|
Generate a Steno log compatible representation
|
toLogValue
|
{
"repo_name": "groupon/metrics",
"path": "tsd/tsd-core/src/main/java/com/arpnetworking/configuration/jackson/MergingDynamicConfigurationFactory.java",
"license": "apache-2.0",
"size": 3238
}
|
[
"com.arpnetworking.steno.LogValueMapFactory"
] |
import com.arpnetworking.steno.LogValueMapFactory;
|
import com.arpnetworking.steno.*;
|
[
"com.arpnetworking.steno"
] |
com.arpnetworking.steno;
| 523,256
|
public void setPriority(int priority) {
checkArgument(priority > 0, "property must be strictly positive");
this.priority = priority;
}
|
void function(int priority) { checkArgument(priority > 0, STR); this.priority = priority; }
|
/**
* Set layer at which this iterator applies.
*
* @param priority
* determines the order in which iterators are applied (system iterators are always
* applied first, then user-configured iterators, lowest priority first)
*/
|
Set layer at which this iterator applies
|
setPriority
|
{
"repo_name": "lstav/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java",
"license": "apache-2.0",
"size": 12516
}
|
[
"com.google.common.base.Preconditions"
] |
import com.google.common.base.Preconditions;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 1,439,830
|
protected HttpURLConnection getConnection(String url) throws IOException {
return (HttpURLConnection) new URL(url).openConnection();
}
|
HttpURLConnection function(String url) throws IOException { return (HttpURLConnection) new URL(url).openConnection(); }
|
/**
* Gets an {@link HttpURLConnection} given an URL.
*/
|
Gets an <code>HttpURLConnection</code> given an URL
|
getConnection
|
{
"repo_name": "robbStarkTFG4/gcm",
"path": "client-libraries/java/rest-client/src/com/google/android/gcm/server/Sender.java",
"license": "apache-2.0",
"size": 22806
}
|
[
"java.io.IOException",
"java.net.HttpURLConnection"
] |
import java.io.IOException; import java.net.HttpURLConnection;
|
import java.io.*; import java.net.*;
|
[
"java.io",
"java.net"
] |
java.io; java.net;
| 1,332,890
|
protected Set<Region> rawAccumulateAllValuesOfrg(final Object[] parameters) {
Set<Region> results = new HashSet<Region>();
rawAccumulateAllValues(POSITION_RG, parameters, results);
return results;
}
|
Set<Region> function(final Object[] parameters) { Set<Region> results = new HashSet<Region>(); rawAccumulateAllValues(POSITION_RG, parameters, results); return results; }
|
/**
* Retrieve the set of values that occur in matches for rg.
* @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
*
*/
|
Retrieve the set of values that occur in matches for rg
|
rawAccumulateAllValuesOfrg
|
{
"repo_name": "ELTE-Soft/xUML-RT-Executor",
"path": "plugins/hu.eltesoft.modelexecution.validation/src-gen/hu/eltesoft/modelexecution/validation/MultipleInitialStateMatcher.java",
"license": "epl-1.0",
"size": 16443
}
|
[
"java.util.HashSet",
"java.util.Set",
"org.eclipse.uml2.uml.Region"
] |
import java.util.HashSet; import java.util.Set; import org.eclipse.uml2.uml.Region;
|
import java.util.*; import org.eclipse.uml2.uml.*;
|
[
"java.util",
"org.eclipse.uml2"
] |
java.util; org.eclipse.uml2;
| 804,434
|
private static void validateDataHeader(DataHeader dataHeader) {
if (dataHeader.elementsOrVersion < SIMPLE_MESSAGE_VERSION) {
throw new DeserializationException("Incorrect number of fields, expecting at least "
+ SIMPLE_MESSAGE_VERSION + ", but got: " + dataHeader.elementsOrVersion);
}
if (dataHeader.size < SIMPLE_MESSAGE_SIZE) {
throw new DeserializationException(
"Incorrect message size, expecting at least " + SIMPLE_MESSAGE_SIZE
+ ", but got: " + dataHeader.size);
}
if (dataHeader.elementsOrVersion == SIMPLE_MESSAGE_VERSION
&& dataHeader.size != SIMPLE_MESSAGE_SIZE) {
throw new DeserializationException("Incorrect message size for a message with "
+ SIMPLE_MESSAGE_VERSION + " fields, expecting " + SIMPLE_MESSAGE_SIZE
+ ", but got: " + dataHeader.size);
}
if (dataHeader.elementsOrVersion == MESSAGE_WITH_REQUEST_ID_VERSION
&& dataHeader.size != MESSAGE_WITH_REQUEST_ID_SIZE) {
throw new DeserializationException("Incorrect message size for a message with "
+ MESSAGE_WITH_REQUEST_ID_VERSION + " fields, expecting "
+ MESSAGE_WITH_REQUEST_ID_SIZE + ", but got: " + dataHeader.size);
}
}
|
static void function(DataHeader dataHeader) { if (dataHeader.elementsOrVersion < SIMPLE_MESSAGE_VERSION) { throw new DeserializationException(STR + SIMPLE_MESSAGE_VERSION + STR + dataHeader.elementsOrVersion); } if (dataHeader.size < SIMPLE_MESSAGE_SIZE) { throw new DeserializationException( STR + SIMPLE_MESSAGE_SIZE + STR + dataHeader.size); } if (dataHeader.elementsOrVersion == SIMPLE_MESSAGE_VERSION && dataHeader.size != SIMPLE_MESSAGE_SIZE) { throw new DeserializationException(STR + SIMPLE_MESSAGE_VERSION + STR + SIMPLE_MESSAGE_SIZE + STR + dataHeader.size); } if (dataHeader.elementsOrVersion == MESSAGE_WITH_REQUEST_ID_VERSION && dataHeader.size != MESSAGE_WITH_REQUEST_ID_SIZE) { throw new DeserializationException(STR + MESSAGE_WITH_REQUEST_ID_VERSION + STR + MESSAGE_WITH_REQUEST_ID_SIZE + STR + dataHeader.size); } }
|
/**
* Validate that the given {@link DataHeader} can be the data header of a message header.
*/
|
Validate that the given <code>DataHeader</code> can be the data header of a message header
|
validateDataHeader
|
{
"repo_name": "sgraham/nope",
"path": "third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/MessageHeader.java",
"license": "bsd-3-clause",
"size": 8120
}
|
[
"org.chromium.mojo.bindings.Struct"
] |
import org.chromium.mojo.bindings.Struct;
|
import org.chromium.mojo.bindings.*;
|
[
"org.chromium.mojo"
] |
org.chromium.mojo;
| 607,600
|
return Long.parseLong(DOMUtils.getTextValue(element));
}
|
return Long.parseLong(DOMUtils.getTextValue(element)); }
|
/**
* Get the content length.
*
* @throws NumberFormatException
*/
|
Get the content length
|
getLength
|
{
"repo_name": "markkimsal/pengyou-clients",
"path": "webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/GetContentLengthProperty.java",
"license": "apache-2.0",
"size": 1538
}
|
[
"org.apache.webdav.lib.util.DOMUtils"
] |
import org.apache.webdav.lib.util.DOMUtils;
|
import org.apache.webdav.lib.util.*;
|
[
"org.apache.webdav"
] |
org.apache.webdav;
| 1,931,365
|
public static Transaction getTransaction(String wallet_file_name, String blockchain_file_name, String hex_string) throws Exception{
MyWallet wallet = new MyWallet(wallet_file_name, blockchain_file_name);
wallet.openWallet();
Transaction transaction = wallet.getWallet().getTransaction(new Sha256Hash(hex_string));
wallet.closeWallet();
return transaction;
}
|
static Transaction function(String wallet_file_name, String blockchain_file_name, String hex_string) throws Exception{ MyWallet wallet = new MyWallet(wallet_file_name, blockchain_file_name); wallet.openWallet(); Transaction transaction = wallet.getWallet().getTransaction(new Sha256Hash(hex_string)); wallet.closeWallet(); return transaction; }
|
/**
* Gets a transaction.
*
* @param wallet_file_name The wallet file.
* @param blockchain_file_name The blockchain file.
* @param hex_string The transaction hash as hex string.
* @param passphrase The passphrase for encryption and decryption.
* @return The corresponding transaction.
*
* @throws Exception Throws exception if something goes wrong.
*/
|
Gets a transaction
|
getTransaction
|
{
"repo_name": "kiebitz/KeyBits",
"path": "src/MyWallet.java",
"license": "gpl-3.0",
"size": 29471
}
|
[
"com.google.bitcoin.core.Sha256Hash",
"com.google.bitcoin.core.Transaction"
] |
import com.google.bitcoin.core.Sha256Hash; import com.google.bitcoin.core.Transaction;
|
import com.google.bitcoin.core.*;
|
[
"com.google.bitcoin"
] |
com.google.bitcoin;
| 1,157,349
|
public static String ts2string(Timeseries ts, int paaSize, Alphabet alphabet, int alphabetSize)
throws TSException, CloneNotSupportedException {
if (alphabetSize > alphabet.getMaxSize()) {
throw new TSException("Unable to set the alphabet size greater than " + alphabet.getMaxSize());
}
int tsLength = ts.size();
if (tsLength == paaSize) {
return new String(TSUtils.ts2String(TSUtils.zNormalize(ts), alphabet, alphabetSize));
} else {
// perform PAA conversion
Timeseries PAA;
try {
PAA = TSUtils.paa(TSUtils.zNormalize(ts), paaSize);
} catch (CloneNotSupportedException e) {
throw new TSException("Unable to clone: " + StackTrace.toString(e));
}
return new String(TSUtils.ts2String(PAA, alphabet, alphabetSize));
}
}
|
static String function(Timeseries ts, int paaSize, Alphabet alphabet, int alphabetSize) throws TSException, CloneNotSupportedException { if (alphabetSize > alphabet.getMaxSize()) { throw new TSException(STR + alphabet.getMaxSize()); } int tsLength = ts.size(); if (tsLength == paaSize) { return new String(TSUtils.ts2String(TSUtils.zNormalize(ts), alphabet, alphabetSize)); } else { Timeseries PAA; try { PAA = TSUtils.paa(TSUtils.zNormalize(ts), paaSize); } catch (CloneNotSupportedException e) { throw new TSException(STR + StackTrace.toString(e)); } return new String(TSUtils.ts2String(PAA, alphabet, alphabetSize)); } }
|
/**
* Convert the timeseries into SAX string representation.
*
* @param ts The timeseries given.
* @param paaSize The number of the points used in the PAA reduction of the
* time series.
* @param alphabet The alphabet to use.
* @param alphabetSize The alphabet size used.
* @return The SAX representation of the timeseries.
* @throws TSException If error occurs.
* @throws CloneNotSupportedException
*/
|
Convert the timeseries into SAX string representation
|
ts2string
|
{
"repo_name": "ianmalcolm/HOTSAX",
"path": "src/SAXFactory/SAXFactory.java",
"license": "gpl-2.0",
"size": 25126
}
|
[
"edu.hawaii.jmotif.sax.alphabet.Alphabet",
"edu.hawaii.jmotif.timeseries.TSException",
"edu.hawaii.jmotif.timeseries.TSUtils",
"edu.hawaii.jmotif.timeseries.Timeseries",
"org.hackystat.utilities.stacktrace.StackTrace"
] |
import edu.hawaii.jmotif.sax.alphabet.Alphabet; import edu.hawaii.jmotif.timeseries.TSException; import edu.hawaii.jmotif.timeseries.TSUtils; import edu.hawaii.jmotif.timeseries.Timeseries; import org.hackystat.utilities.stacktrace.StackTrace;
|
import edu.hawaii.jmotif.sax.alphabet.*; import edu.hawaii.jmotif.timeseries.*; import org.hackystat.utilities.stacktrace.*;
|
[
"edu.hawaii.jmotif",
"org.hackystat.utilities"
] |
edu.hawaii.jmotif; org.hackystat.utilities;
| 1,724,161
|
public void reset(GlowLivingEntity entity) {
end(entity);
duration = 0;
executing = false;
}
|
void function(GlowLivingEntity entity) { end(entity); duration = 0; executing = false; }
|
/**
* Resets the progress of this task for this entity.
*
* @param entity the entity in question.
*/
|
Resets the progress of this task for this entity
|
reset
|
{
"repo_name": "GlowstoneMC/GlowstonePlusPlus",
"path": "src/main/java/net/glowstone/entity/ai/EntityTask.java",
"license": "mit",
"size": 4263
}
|
[
"net.glowstone.entity.GlowLivingEntity"
] |
import net.glowstone.entity.GlowLivingEntity;
|
import net.glowstone.entity.*;
|
[
"net.glowstone.entity"
] |
net.glowstone.entity;
| 1,670,276
|
private boolean unregisterMBean(ObjectName mbean) {
assert !U.IGNITE_MBEANS_DISABLED;
try {
cfg.getMBeanServer().unregisterMBean(mbean);
if (log.isDebugEnabled())
log.debug("Unregistered MBean: " + mbean);
return true;
}
catch (JMException e) {
U.error(log, "Failed to unregister MBean.", e);
return false;
}
}
}
|
boolean function(ObjectName mbean) { assert !U.IGNITE_MBEANS_DISABLED; try { cfg.getMBeanServer().unregisterMBean(mbean); if (log.isDebugEnabled()) log.debug(STR + mbean); return true; } catch (JMException e) { U.error(log, STR, e); return false; } } }
|
/**
* Unregisters given MBean.
*
* @param mbean MBean to unregister.
* @return {@code true} if successfully unregistered, {@code false} otherwise.
*/
|
Unregisters given MBean
|
unregisterMBean
|
{
"repo_name": "alexzaitzev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java",
"license": "apache-2.0",
"size": 150672
}
|
[
"javax.management.JMException",
"javax.management.ObjectName",
"org.apache.ignite.internal.util.typedef.internal.U"
] |
import javax.management.JMException; import javax.management.ObjectName; import org.apache.ignite.internal.util.typedef.internal.U;
|
import javax.management.*; import org.apache.ignite.internal.util.typedef.internal.*;
|
[
"javax.management",
"org.apache.ignite"
] |
javax.management; org.apache.ignite;
| 83,862
|
AdaptrisMessageListener configuredMessageListener();
|
AdaptrisMessageListener configuredMessageListener();
|
/**
* return the current configured MessageListener.
*
* @return the adaptris message listener instance.
*/
|
return the current configured MessageListener
|
configuredMessageListener
|
{
"repo_name": "adaptris/interlok",
"path": "interlok-core/src/main/java/com/adaptris/core/jms/JmsActorConfig.java",
"license": "apache-2.0",
"size": 2019
}
|
[
"com.adaptris.core.AdaptrisMessageListener"
] |
import com.adaptris.core.AdaptrisMessageListener;
|
import com.adaptris.core.*;
|
[
"com.adaptris.core"
] |
com.adaptris.core;
| 584,113
|
public final void setReader(final HardwareAbstraction reader) {
this.reader = reader;
}
|
final void function(final HardwareAbstraction reader) { this.reader = reader; }
|
/**
* Set the reader instance.
* @param reader
* The reader to set
*/
|
Set the reader instance
|
setReader
|
{
"repo_name": "tavlima/fosstrak-reader",
"path": "reader-rprm-core/src/main/java/org/fosstrak/reader/rprm/core/Source.java",
"license": "lgpl-2.1",
"size": 100250
}
|
[
"org.fosstrak.hal.HardwareAbstraction"
] |
import org.fosstrak.hal.HardwareAbstraction;
|
import org.fosstrak.hal.*;
|
[
"org.fosstrak.hal"
] |
org.fosstrak.hal;
| 2,168,347
|
JMXManagementITCase it = new JMXManagementITCase();
it.setUp();
System.setProperty("inkstand.http.port", String.valueOf(it.port));
System.setProperty("inkstand.mgmt.port", String.valueOf(it.mgmtPort));
Inkstand.main();
}
|
JMXManagementITCase it = new JMXManagementITCase(); it.setUp(); System.setProperty(STR, String.valueOf(it.port)); System.setProperty(STR, String.valueOf(it.mgmtPort)); Inkstand.main(); }
|
/**
* method to start the instance for demo purposes.
* @param args
* @throws Exception
*/
|
method to start the instance for demo purposes
|
main
|
{
"repo_name": "inkstand-io/inkstand",
"path": "inkstand-it/inkstand-it-jmxmgmt/src/test/java/io/inkstand/it/JMXManagementITCase.java",
"license": "apache-2.0",
"size": 5291
}
|
[
"io.inkstand.Inkstand"
] |
import io.inkstand.Inkstand;
|
import io.inkstand.*;
|
[
"io.inkstand"
] |
io.inkstand;
| 2,594,360
|
public final MetaProperty<ZonedDateTime> fixingDate() {
return _fixingDate;
}
|
final MetaProperty<ZonedDateTime> function() { return _fixingDate; }
|
/**
* The meta-property for the {@code fixingDate} property.
* @return the meta-property, not null
*/
|
The meta-property for the fixingDate property
|
fixingDate
|
{
"repo_name": "ChinaQuants/OG-Platform",
"path": "projects/OG-FinancialTypes/src/main/java/com/opengamma/financial/security/fra/FRASecurity.java",
"license": "apache-2.0",
"size": 19980
}
|
[
"org.joda.beans.MetaProperty",
"org.threeten.bp.ZonedDateTime"
] |
import org.joda.beans.MetaProperty; import org.threeten.bp.ZonedDateTime;
|
import org.joda.beans.*; import org.threeten.bp.*;
|
[
"org.joda.beans",
"org.threeten.bp"
] |
org.joda.beans; org.threeten.bp;
| 955,241
|
public static gPSTOWhourType fromPerUnaligned(byte[] encodedBytes) {
gPSTOWhourType result = new gPSTOWhourType();
result.decodePerUnaligned(new BitStreamReader(encodedBytes));
return result;
}
|
static gPSTOWhourType function(byte[] encodedBytes) { gPSTOWhourType result = new gPSTOWhourType(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; }
|
/**
* Creates a new gPSTOWhourType from encoded stream.
*/
|
Creates a new gPSTOWhourType from encoded stream
|
fromPerUnaligned
|
{
"repo_name": "google/supl-client",
"path": "src/main/java/com/google/location/suplclient/asn1/supl2/ulp_version_2_parameter_extensions/GPSTime.java",
"license": "apache-2.0",
"size": 11647
}
|
[
"com.google.location.suplclient.asn1.base.BitStreamReader"
] |
import com.google.location.suplclient.asn1.base.BitStreamReader;
|
import com.google.location.suplclient.asn1.base.*;
|
[
"com.google.location"
] |
com.google.location;
| 1,293,139
|
int insert(Users record);
|
int insert(Users record);
|
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table users
*
* @mbggenerated
*/
|
This method was generated by MyBatis Generator. This method corresponds to the database table users
|
insert
|
{
"repo_name": "salvatorecoluccia/shareIT",
"path": "ShareItDataAccess/src/it/coluccia/shareit/dao/users/shareitdb/UsersMapper.java",
"license": "gpl-3.0",
"size": 2701
}
|
[
"it.coluccia.shareit.dto.users.shareitdb.Users"
] |
import it.coluccia.shareit.dto.users.shareitdb.Users;
|
import it.coluccia.shareit.dto.users.shareitdb.*;
|
[
"it.coluccia.shareit"
] |
it.coluccia.shareit;
| 1,794,272
|
public void setNpnProtocols(List<Protocol> protocols) {
protocols = Util.immutableList(protocols);
if (!protocols.contains(Protocol.HTTP_11)) {
throw new IllegalArgumentException("protocols doesn't contain http/1.1: " + protocols);
}
if (protocols.contains(null)) {
throw new IllegalArgumentException("protocols must not contain null");
}
this.npnProtocols = Util.immutableList(protocols);
}
|
void function(List<Protocol> protocols) { protocols = Util.immutableList(protocols); if (!protocols.contains(Protocol.HTTP_11)) { throw new IllegalArgumentException(STR + protocols); } if (protocols.contains(null)) { throw new IllegalArgumentException(STR); } this.npnProtocols = Util.immutableList(protocols); }
|
/**
* Indicates the protocols supported by NPN on incoming HTTPS connections.
* This list is ignored when npn is disabled.
*
* @param protocols the protocols to use, in order of preference. The list
* must contain "http/1.1". It must not contain null.
*/
|
Indicates the protocols supported by NPN on incoming HTTPS connections. This list is ignored when npn is disabled
|
setNpnProtocols
|
{
"repo_name": "DirtyUnicorns/android_external_okhttp",
"path": "mockwebserver/src/main/java/com/squareup/okhttp/mockwebserver/MockWebServer.java",
"license": "apache-2.0",
"size": 28383
}
|
[
"com.squareup.okhttp.Protocol",
"com.squareup.okhttp.internal.Util",
"java.util.List"
] |
import com.squareup.okhttp.Protocol; import com.squareup.okhttp.internal.Util; import java.util.List;
|
import com.squareup.okhttp.*; import com.squareup.okhttp.internal.*; import java.util.*;
|
[
"com.squareup.okhttp",
"java.util"
] |
com.squareup.okhttp; java.util;
| 2,434,138
|
protected List<Dependency> scanDirectory(File dir) {
final File[] files = dir.listFiles();
final List<Dependency> deps = new ArrayList<Dependency>();
if (files != null) {
for (File f : files) {
if (f.isDirectory()) {
final List<Dependency> d = scanDirectory(f);
if (d != null) {
deps.addAll(d);
}
} else {
final Dependency d = scanFile(f);
deps.add(d);
}
}
}
return deps;
}
|
List<Dependency> function(File dir) { final File[] files = dir.listFiles(); final List<Dependency> deps = new ArrayList<Dependency>(); if (files != null) { for (File f : files) { if (f.isDirectory()) { final List<Dependency> d = scanDirectory(f); if (d != null) { deps.addAll(d); } } else { final Dependency d = scanFile(f); deps.add(d); } } } return deps; }
|
/**
* Recursively scans files and directories. Any dependencies identified are added to the dependency collection.
*
* @param dir the directory to scan
* @return the list of Dependency objects scanned
*/
|
Recursively scans files and directories. Any dependencies identified are added to the dependency collection
|
scanDirectory
|
{
"repo_name": "wmaintw/DependencyCheck",
"path": "dependency-check-core/src/main/java/org/owasp/dependencycheck/Engine.java",
"license": "apache-2.0",
"size": 18726
}
|
[
"java.io.File",
"java.util.ArrayList",
"java.util.List",
"org.owasp.dependencycheck.dependency.Dependency"
] |
import java.io.File; import java.util.ArrayList; import java.util.List; import org.owasp.dependencycheck.dependency.Dependency;
|
import java.io.*; import java.util.*; import org.owasp.dependencycheck.dependency.*;
|
[
"java.io",
"java.util",
"org.owasp.dependencycheck"
] |
java.io; java.util; org.owasp.dependencycheck;
| 2,560,839
|
InputSplitProvider getInputSplitProvider();
|
InputSplitProvider getInputSplitProvider();
|
/**
* Returns the input split provider assigned to this environment.
*
* @return the input split provider or <code>null</code> if no such provider has been assigned to this environment.
*/
|
Returns the input split provider assigned to this environment
|
getInputSplitProvider
|
{
"repo_name": "citlab/vs.msc.ws14",
"path": "flink-0-7-custom/flink-runtime/src/main/java/org/apache/flink/runtime/execution/Environment.java",
"license": "apache-2.0",
"size": 7093
}
|
[
"org.apache.flink.runtime.jobgraph.tasks.InputSplitProvider"
] |
import org.apache.flink.runtime.jobgraph.tasks.InputSplitProvider;
|
import org.apache.flink.runtime.jobgraph.tasks.*;
|
[
"org.apache.flink"
] |
org.apache.flink;
| 1,981,595
|
private static void throwParse(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
ParserUtils.getToken(builder, kTHROW);
if (!AssignmentExpression.parse(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
}
marker.done(THROW_STATEMENT);
}
|
static void function(PsiBuilder builder, GroovyParser parser) { PsiBuilder.Marker marker = builder.mark(); ParserUtils.getToken(builder, kTHROW); if (!AssignmentExpression.parse(builder, parser)) { builder.error(GroovyBundle.message(STR)); } marker.done(THROW_STATEMENT); }
|
/**
* throw [Expression]
*
* @param builder
* @return
*/
|
throw [Expression]
|
throwParse
|
{
"repo_name": "android-ia/platform_tools_idea",
"path": "plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/BranchStatement.java",
"license": "apache-2.0",
"size": 4013
}
|
[
"com.intellij.lang.PsiBuilder",
"org.jetbrains.plugins.groovy.GroovyBundle",
"org.jetbrains.plugins.groovy.lang.parser.GroovyParser",
"org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.AssignmentExpression",
"org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils"
] |
import com.intellij.lang.PsiBuilder; import org.jetbrains.plugins.groovy.GroovyBundle; import org.jetbrains.plugins.groovy.lang.parser.GroovyParser; import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.AssignmentExpression; import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
|
import com.intellij.lang.*; import org.jetbrains.plugins.groovy.*; import org.jetbrains.plugins.groovy.lang.parser.*; import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.*; import org.jetbrains.plugins.groovy.lang.parser.parsing.util.*;
|
[
"com.intellij.lang",
"org.jetbrains.plugins"
] |
com.intellij.lang; org.jetbrains.plugins;
| 1,863,741
|
private static ThriftAgentConfiguration loadConfigXML() {
String carbonHome = System.getProperty(AgentConstants.CARBON_CONFIG_DIR_PATH);
String path = carbonHome + File.separator + AgentConstants.AGENT_CONF_DIR + File.separator
+ AgentConstants.AGENT_CONF;
// if the agent config file not exists then simply return null.
File agentConfigFile = new File(path);
if (!agentConfigFile.exists()) {
return null;
}
try {
JAXBContext jaxbContext = JAXBContext.newInstance(ThriftAgentConfiguration.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
return (ThriftAgentConfiguration)
jaxbUnmarshaller.unmarshal(agentConfigFile);
} catch (JAXBException e) {
String errorMessage = "Unable to unmarshal config xml.";
log.error(errorMessage, e);
}
return null;
}
|
static ThriftAgentConfiguration function() { String carbonHome = System.getProperty(AgentConstants.CARBON_CONFIG_DIR_PATH); String path = carbonHome + File.separator + AgentConstants.AGENT_CONF_DIR + File.separator + AgentConstants.AGENT_CONF; File agentConfigFile = new File(path); if (!agentConfigFile.exists()) { return null; } try { JAXBContext jaxbContext = JAXBContext.newInstance(ThriftAgentConfiguration.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); return (ThriftAgentConfiguration) jaxbUnmarshaller.unmarshal(agentConfigFile); } catch (JAXBException e) { String errorMessage = STR; log.error(errorMessage, e); } return null; }
|
/**
* Helper method to load the agent config
*
* @return ThriftAgentConfiguration representation of the agent config in xml file
*/
|
Helper method to load the agent config
|
loadConfigXML
|
{
"repo_name": "shazni/carbon-commons",
"path": "components/data-bridge/org.wso2.carbon.databridge.agent.thrift/src/main/java/org/wso2/carbon/databridge/agent/thrift/internal/utils/AgentBuilder.java",
"license": "apache-2.0",
"size": 4692
}
|
[
"java.io.File",
"javax.xml.bind.JAXBContext",
"javax.xml.bind.JAXBException",
"javax.xml.bind.Unmarshaller",
"org.wso2.carbon.databridge.agent.thrift.internal.conf.ThriftAgentConfiguration"
] |
import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import org.wso2.carbon.databridge.agent.thrift.internal.conf.ThriftAgentConfiguration;
|
import java.io.*; import javax.xml.bind.*; import org.wso2.carbon.databridge.agent.thrift.internal.conf.*;
|
[
"java.io",
"javax.xml",
"org.wso2.carbon"
] |
java.io; javax.xml; org.wso2.carbon;
| 752,599
|
@Deprecated
public Put addImmutable(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value) {
if (ts < 0) {
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + ts);
}
List<Cell> list = getCellList(family);
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, null);
list.add(kv);
return this;
}
|
Put function(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value) { if (ts < 0) { throw new IllegalArgumentException(STR + ts); } List<Cell> list = getCellList(family); KeyValue kv = createPutKeyValue(family, qualifier, ts, value, null); list.add(kv); return this; }
|
/**
* See {@link #addColumn(byte[], ByteBuffer, long, ByteBuffer)}. This version expects
* that the underlying arrays won't change. It's intended
* for usage internal HBase to and for advanced client applications.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
* Use {@link #add(Cell)} and {@link org.apache.hadoop.hbase.CellBuilder} instead
*/
|
See <code>#addColumn(byte[], ByteBuffer, long, ByteBuffer)</code>. This version expects that the underlying arrays won't change. It's intended for usage internal HBase to and for advanced client applications
|
addImmutable
|
{
"repo_name": "ultratendency/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java",
"license": "apache-2.0",
"size": 11232
}
|
[
"java.nio.ByteBuffer",
"java.util.List",
"org.apache.hadoop.hbase.Cell",
"org.apache.hadoop.hbase.KeyValue"
] |
import java.nio.ByteBuffer; import java.util.List; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.KeyValue;
|
import java.nio.*; import java.util.*; import org.apache.hadoop.hbase.*;
|
[
"java.nio",
"java.util",
"org.apache.hadoop"
] |
java.nio; java.util; org.apache.hadoop;
| 203,244
|
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<SuppressionContractInner>> getWithResponseAsync(
String resourceUri, String recommendationId, String name) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceUri == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null."));
}
if (recommendationId == null) {
return Mono
.error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
resourceUri,
recommendationId,
name,
this.client.getApiVersion(),
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
|
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<SuppressionContractInner>> function( String resourceUri, String recommendationId, String name) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceUri == null) { return Mono.error(new IllegalArgumentException(STR)); } if (recommendationId == null) { return Mono .error(new IllegalArgumentException(STR)); } if (name == null) { return Mono.error(new IllegalArgumentException(STR)); } final String accept = STR; return FluxUtil .withContext( context -> service .get( this.client.getEndpoint(), resourceUri, recommendationId, name, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
|
/**
* Obtains the details of a suppression.
*
* @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the
* recommendation applies.
* @param recommendationId The recommendation ID.
* @param name The name of the suppression.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with
* the rule.
*/
|
Obtains the details of a suppression
|
getWithResponseAsync
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java",
"license": "mit",
"size": 43738
}
|
[
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner"
] |
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner;
|
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.advisor.fluent.models.*;
|
[
"com.azure.core",
"com.azure.resourcemanager"
] |
com.azure.core; com.azure.resourcemanager;
| 1,658,658
|
@MediumTest
@UiThreadTest
public void testNewConditionSaveOn() throws Throwable
{
assertTitle();
assertSelectedPositionAutoSync(AdapterView.INVALID_POSITION);
setSelectedPositionAutoSync(R.string.list_on);
assertActivityResultAutoSync(true);
}
|
void function() throws Throwable { assertTitle(); assertSelectedPositionAutoSync(AdapterView.INVALID_POSITION); setSelectedPositionAutoSync(R.string.list_on); assertActivityResultAutoSync(true); }
|
/**
* Tests creation of a new condition, that the UI is initialized to the right state, and that changes are
* properly saved
*/
|
Tests creation of a new condition, that the UI is initialized to the right state, and that changes are properly saved
|
testNewConditionSaveOn
|
{
"repo_name": "gitaiQAQ/SmsCodeHelper",
"path": "localeapi/demo/display/locale-display_condition_plugin-test/src/com/yourcompany/yourcondition/ui/EditActivityTest.java",
"license": "lgpl-3.0",
"size": 23571
}
|
[
"android.widget.AdapterView"
] |
import android.widget.AdapterView;
|
import android.widget.*;
|
[
"android.widget"
] |
android.widget;
| 1,731,761
|
public static String TO_DATE (Timestamp day)
{
return TO_DATE(day, true);
} // TO_DATE
|
static String function (Timestamp day) { return TO_DATE(day, true); }
|
/**
* Create SQL TO Date String from Timestamp
* @param day day time
* @return TO_DATE String (day only)
*/
|
Create SQL TO Date String from Timestamp
|
TO_DATE
|
{
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiere_360/base/src/org/compiere/util/DB.java",
"license": "gpl-2.0",
"size": 69445
}
|
[
"java.sql.Timestamp"
] |
import java.sql.Timestamp;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 303,917
|
public StorageTargetsInner storageTargets() {
return this.storageTargets;
}
public StorageCacheManagementClientImpl(ServiceClientCredentials credentials) {
this("https://management.azure.com", credentials);
}
public StorageCacheManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) {
super(baseUrl, credentials);
initialize();
}
public StorageCacheManagementClientImpl(RestClient restClient) {
super(restClient);
initialize();
}
|
StorageTargetsInner function() { return this.storageTargets; } public StorageCacheManagementClientImpl(ServiceClientCredentials credentials) { this("https: } public StorageCacheManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { super(baseUrl, credentials); initialize(); } public StorageCacheManagementClientImpl(RestClient restClient) { super(restClient); initialize(); }
|
/**
* Gets the StorageTargetsInner object to access its operations.
* @return the StorageTargetsInner object.
*/
|
Gets the StorageTargetsInner object to access its operations
|
storageTargets
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManagementClientImpl.java",
"license": "mit",
"size": 8341
}
|
[
"com.microsoft.rest.RestClient",
"com.microsoft.rest.credentials.ServiceClientCredentials"
] |
import com.microsoft.rest.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials;
|
import com.microsoft.rest.*; import com.microsoft.rest.credentials.*;
|
[
"com.microsoft.rest"
] |
com.microsoft.rest;
| 1,606,118
|
@Override
public Collection<String> getScopes() {
return ImmutableSet.<String>builder()
.addAll(BinaryAuthorizationScopes.all())
.addAll(CloudKMSScopes.all())
.addAll(ContainerAnalysisScopes.all())
.addAll(CloudResourceManagerScopes.all())
.build();
}
|
Collection<String> function() { return ImmutableSet.<String>builder() .addAll(BinaryAuthorizationScopes.all()) .addAll(CloudKMSScopes.all()) .addAll(ContainerAnalysisScopes.all()) .addAll(CloudResourceManagerScopes.all()) .build(); }
|
/**
* Returns the scopes that clients will need to use for this plugin.
*
* @return The set of required scopes.
*/
|
Returns the scopes that clients will need to use for this plugin
|
getScopes
|
{
"repo_name": "GoogleCloudPlatform/jenkins-gcr-plugin",
"path": "src/main/java/com/google/jenkins/plugins/containersecurity/client/ContainerSecurityScopeRequirement.java",
"license": "apache-2.0",
"size": 1773
}
|
[
"com.google.api.services.binaryauthorization.v1beta1.BinaryAuthorizationScopes",
"com.google.api.services.cloudkms.v1.CloudKMSScopes",
"com.google.api.services.cloudresourcemanager.CloudResourceManagerScopes",
"com.google.api.services.containeranalysis.v1beta1.ContainerAnalysisScopes",
"com.google.common.collect.ImmutableSet",
"java.util.Collection"
] |
import com.google.api.services.binaryauthorization.v1beta1.BinaryAuthorizationScopes; import com.google.api.services.cloudkms.v1.CloudKMSScopes; import com.google.api.services.cloudresourcemanager.CloudResourceManagerScopes; import com.google.api.services.containeranalysis.v1beta1.ContainerAnalysisScopes; import com.google.common.collect.ImmutableSet; import java.util.Collection;
|
import com.google.api.services.binaryauthorization.v1beta1.*; import com.google.api.services.cloudkms.v1.*; import com.google.api.services.cloudresourcemanager.*; import com.google.api.services.containeranalysis.v1beta1.*; import com.google.common.collect.*; import java.util.*;
|
[
"com.google.api",
"com.google.common",
"java.util"
] |
com.google.api; com.google.common; java.util;
| 435,426
|
public static ImmutableSet<SourcePath> getClasspathsFromLibraries(
Iterable<JavaLibrary> libraries) {
ImmutableSet.Builder<SourcePath> classpathEntries = ImmutableSet.builder();
for (JavaLibrary library : libraries) {
classpathEntries.addAll(library.getImmediateClasspaths());
}
return classpathEntries.build();
}
|
static ImmutableSet<SourcePath> function( Iterable<JavaLibrary> libraries) { ImmutableSet.Builder<SourcePath> classpathEntries = ImmutableSet.builder(); for (JavaLibrary library : libraries) { classpathEntries.addAll(library.getImmediateClasspaths()); } return classpathEntries.build(); }
|
/**
* Given libraries that may contribute classpaths, visit them and collect the classpaths.
*
* <p>This is used to generate transitive classpaths from library discovered in a previous
* traversal.
*/
|
Given libraries that may contribute classpaths, visit them and collect the classpaths. This is used to generate transitive classpaths from library discovered in a previous traversal
|
getClasspathsFromLibraries
|
{
"repo_name": "facebook/buck",
"path": "src/com/facebook/buck/jvm/java/JavaLibraryClasspathProvider.java",
"license": "apache-2.0",
"size": 5497
}
|
[
"com.facebook.buck.core.sourcepath.SourcePath",
"com.facebook.buck.jvm.core.JavaLibrary",
"com.google.common.collect.ImmutableSet"
] |
import com.facebook.buck.core.sourcepath.SourcePath; import com.facebook.buck.jvm.core.JavaLibrary; import com.google.common.collect.ImmutableSet;
|
import com.facebook.buck.core.sourcepath.*; import com.facebook.buck.jvm.core.*; import com.google.common.collect.*;
|
[
"com.facebook.buck",
"com.google.common"
] |
com.facebook.buck; com.google.common;
| 20,686
|
Router router = new Router(getContext());
router.attach("/", RootServerResource.class);
router.attach("/accounts/", AccountsServerResource.class);
router.attach("/accounts/{accountId}", AccountServerResource.class);
return router;
}
|
Router router = new Router(getContext()); router.attach("/", RootServerResource.class); router.attach(STR, AccountsServerResource.class); router.attach(STR, AccountServerResource.class); return router; }
|
/**
* Creates a root Router to dispatch call to server resources.
*/
|
Creates a root Router to dispatch call to server resources
|
createInboundRoot
|
{
"repo_name": "alastrina123/debrief",
"path": "org.mwc.asset.comms/docs/restlet_src/org.restlet.example/org/restlet/example/book/restlet/ch03/sect5/sub5/server/MailServerApplication.java",
"license": "epl-1.0",
"size": 1010
}
|
[
"org.restlet.routing.Router"
] |
import org.restlet.routing.Router;
|
import org.restlet.routing.*;
|
[
"org.restlet.routing"
] |
org.restlet.routing;
| 2,424,813
|
@Test
public void clickRightArrow(){
l(this, "@Test clickRightArrow");
try {
// Click on the (not) green arrow
for ( int i = 1; i <= steps; i++ ){
// Get the selector
UiObject rightArrow = mDevice.findObject(
new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/swipeselector_layout_rightButton")
);
rightArrow.click();
}
// Check the last item
String[] titles = InstrumentationRegistry.getTargetContext().getResources().getStringArray(R.array.standalone_mode_titles);
String[] descs = InstrumentationRegistry.getTargetContext().getResources().getStringArray(R.array.standalone_mode_descriptions);
String expectedLastItemTitle = titles[steps];
String expectedLastItemDesc = descs[steps];
UiObject lastItemTitle = mDevice.findObject(
new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/swipeselector_content_title")
);
assertEquals(expectedLastItemTitle, lastItemTitle.getText());
UiObject lastItemDesc = mDevice.findObject(
new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/swipeselector_content_description")
);
assertEquals(expectedLastItemDesc, lastItemDesc.getText());
} catch ( UiObjectNotFoundException uonfe ){
uonfe.printStackTrace();
fail( uonfe.getMessage() );
}
}
|
void function(){ l(this, STR); try { for ( int i = 1; i <= steps; i++ ){ UiObject rightArrow = mDevice.findObject( new UiSelector().resourceId(PACKAGE_APP_PATH + STR) ); rightArrow.click(); } String[] titles = InstrumentationRegistry.getTargetContext().getResources().getStringArray(R.array.standalone_mode_titles); String[] descs = InstrumentationRegistry.getTargetContext().getResources().getStringArray(R.array.standalone_mode_descriptions); String expectedLastItemTitle = titles[steps]; String expectedLastItemDesc = descs[steps]; UiObject lastItemTitle = mDevice.findObject( new UiSelector().resourceId(PACKAGE_APP_PATH + STR) ); assertEquals(expectedLastItemTitle, lastItemTitle.getText()); UiObject lastItemDesc = mDevice.findObject( new UiSelector().resourceId(PACKAGE_APP_PATH + STR) ); assertEquals(expectedLastItemDesc, lastItemDesc.getText()); } catch ( UiObjectNotFoundException uonfe ){ uonfe.printStackTrace(); fail( uonfe.getMessage() ); } }
|
/**
* Test the click on the cursor's right arrow
*
* <i>If the user clicks on then cursor's right arrow, the next item in the swipe cursor must be displayed</i>
*/
|
Test the click on the cursor's right arrow If the user clicks on then cursor's right arrow, the next item in the swipe cursor must be displayed
|
clickRightArrow
|
{
"repo_name": "pylapp/SmoothClicker",
"path": "app/app/src/androidTest/java/pylapp/smoothclicker/android/views/ItStandaloneModeDialog.java",
"license": "mit",
"size": 17573
}
|
[
"android.support.test.InstrumentationRegistry",
"android.support.test.uiautomator.UiObject",
"android.support.test.uiautomator.UiObjectNotFoundException",
"android.support.test.uiautomator.UiSelector",
"junit.framework.Assert"
] |
import android.support.test.InstrumentationRegistry; import android.support.test.uiautomator.UiObject; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.UiSelector; import junit.framework.Assert;
|
import android.support.test.*; import android.support.test.uiautomator.*; import junit.framework.*;
|
[
"android.support",
"junit.framework"
] |
android.support; junit.framework;
| 227,379
|
public SimulatePipelineResponse simulate(SimulatePipelineRequest request, RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(request, IngestRequestConverters::simulatePipeline, options,
SimulatePipelineResponse::fromXContent, emptySet());
}
|
SimulatePipelineResponse function(SimulatePipelineRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, IngestRequestConverters::simulatePipeline, options, SimulatePipelineResponse::fromXContent, emptySet()); }
|
/**
* Simulate a pipeline on a set of documents provided in the request
* <p>
* See
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html">
* Simulate Pipeline API on elastic.co</a>
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
|
Simulate a pipeline on a set of documents provided in the request See Simulate Pipeline API on elastic.co
|
simulate
|
{
"repo_name": "ern/elasticsearch",
"path": "client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java",
"license": "apache-2.0",
"size": 9223
}
|
[
"java.io.IOException",
"java.util.Collections",
"org.elasticsearch.action.ingest.SimulatePipelineRequest",
"org.elasticsearch.action.ingest.SimulatePipelineResponse"
] |
import java.io.IOException; import java.util.Collections; import org.elasticsearch.action.ingest.SimulatePipelineRequest; import org.elasticsearch.action.ingest.SimulatePipelineResponse;
|
import java.io.*; import java.util.*; import org.elasticsearch.action.ingest.*;
|
[
"java.io",
"java.util",
"org.elasticsearch.action"
] |
java.io; java.util; org.elasticsearch.action;
| 2,397,026
|
@Test
public void testDuplicateResourceRequirementDeclarationAfterSuccessfulAllocation()
throws Exception {
final ResourceManagerId resourceManagerId = ResourceManagerId.generate();
final AtomicInteger allocateResourceCalls = new AtomicInteger(0);
final ResourceActions resourceManagerActions =
new TestingResourceActionsBuilder()
.setAllocateResourceConsumer(
ignored -> allocateResourceCalls.incrementAndGet())
.build();
ResourceRequirements requirements = createResourceRequirementsForSingleSlot();
final TaskExecutorGateway taskExecutorGateway =
new TestingTaskExecutorGatewayBuilder().createTestingTaskExecutorGateway();
final ResourceID resourceID = ResourceID.generate();
final TaskExecutorConnection taskManagerConnection =
new TaskExecutorConnection(resourceID, taskExecutorGateway);
final SlotID slotId = new SlotID(resourceID, 0);
final SlotReport slotReport = new SlotReport(createFreeSlotStatus(slotId));
final DefaultSlotTracker slotTracker = new DefaultSlotTracker();
try (DeclarativeSlotManager slotManager =
createDeclarativeSlotManagerBuilder()
.setSlotTracker(slotTracker)
.buildAndStartWithDirectExec(resourceManagerId, resourceManagerActions)) {
slotManager.registerTaskManager(
taskManagerConnection, slotReport, ResourceProfile.ANY, ResourceProfile.ANY);
slotManager.processResourceRequirements(requirements);
DeclarativeTaskManagerSlot slot = slotTracker.getSlot(slotId);
assertThat(slot.getState(), is(SlotState.ALLOCATED));
slotManager.processResourceRequirements(requirements);
}
// check that we have only called the resource allocation only for the first slot request,
// since the second request is a duplicate
assertThat(allocateResourceCalls.get(), is(0));
}
|
void function() throws Exception { final ResourceManagerId resourceManagerId = ResourceManagerId.generate(); final AtomicInteger allocateResourceCalls = new AtomicInteger(0); final ResourceActions resourceManagerActions = new TestingResourceActionsBuilder() .setAllocateResourceConsumer( ignored -> allocateResourceCalls.incrementAndGet()) .build(); ResourceRequirements requirements = createResourceRequirementsForSingleSlot(); final TaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder().createTestingTaskExecutorGateway(); final ResourceID resourceID = ResourceID.generate(); final TaskExecutorConnection taskManagerConnection = new TaskExecutorConnection(resourceID, taskExecutorGateway); final SlotID slotId = new SlotID(resourceID, 0); final SlotReport slotReport = new SlotReport(createFreeSlotStatus(slotId)); final DefaultSlotTracker slotTracker = new DefaultSlotTracker(); try (DeclarativeSlotManager slotManager = createDeclarativeSlotManagerBuilder() .setSlotTracker(slotTracker) .buildAndStartWithDirectExec(resourceManagerId, resourceManagerActions)) { slotManager.registerTaskManager( taskManagerConnection, slotReport, ResourceProfile.ANY, ResourceProfile.ANY); slotManager.processResourceRequirements(requirements); DeclarativeTaskManagerSlot slot = slotTracker.getSlot(slotId); assertThat(slot.getState(), is(SlotState.ALLOCATED)); slotManager.processResourceRequirements(requirements); } assertThat(allocateResourceCalls.get(), is(0)); }
|
/**
* Tests that duplicate resource requirement declaration do not result in additional slots being
* allocated after a pending slot request has been fulfilled but not yet freed.
*/
|
Tests that duplicate resource requirement declaration do not result in additional slots being allocated after a pending slot request has been fulfilled but not yet freed
|
testDuplicateResourceRequirementDeclarationAfterSuccessfulAllocation
|
{
"repo_name": "apache/flink",
"path": "flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/DeclarativeSlotManagerTest.java",
"license": "apache-2.0",
"size": 73161
}
|
[
"java.util.concurrent.atomic.AtomicInteger",
"org.apache.flink.runtime.clusterframework.types.ResourceID",
"org.apache.flink.runtime.clusterframework.types.ResourceProfile",
"org.apache.flink.runtime.clusterframework.types.SlotID",
"org.apache.flink.runtime.resourcemanager.ResourceManagerId",
"org.apache.flink.runtime.resourcemanager.registration.TaskExecutorConnection",
"org.apache.flink.runtime.slots.ResourceRequirements",
"org.apache.flink.runtime.taskexecutor.SlotReport",
"org.apache.flink.runtime.taskexecutor.TaskExecutorGateway",
"org.apache.flink.runtime.taskexecutor.TestingTaskExecutorGatewayBuilder",
"org.hamcrest.Matchers",
"org.junit.Assert"
] |
import java.util.concurrent.atomic.AtomicInteger; import org.apache.flink.runtime.clusterframework.types.ResourceID; import org.apache.flink.runtime.clusterframework.types.ResourceProfile; import org.apache.flink.runtime.clusterframework.types.SlotID; import org.apache.flink.runtime.resourcemanager.ResourceManagerId; import org.apache.flink.runtime.resourcemanager.registration.TaskExecutorConnection; import org.apache.flink.runtime.slots.ResourceRequirements; import org.apache.flink.runtime.taskexecutor.SlotReport; import org.apache.flink.runtime.taskexecutor.TaskExecutorGateway; import org.apache.flink.runtime.taskexecutor.TestingTaskExecutorGatewayBuilder; import org.hamcrest.Matchers; import org.junit.Assert;
|
import java.util.concurrent.atomic.*; import org.apache.flink.runtime.clusterframework.types.*; import org.apache.flink.runtime.resourcemanager.*; import org.apache.flink.runtime.resourcemanager.registration.*; import org.apache.flink.runtime.slots.*; import org.apache.flink.runtime.taskexecutor.*; import org.hamcrest.*; import org.junit.*;
|
[
"java.util",
"org.apache.flink",
"org.hamcrest",
"org.junit"
] |
java.util; org.apache.flink; org.hamcrest; org.junit;
| 1,086,188
|
void setValidation(Source value);
|
void setValidation(Source value);
|
/**
* Sets the value of the '{@link org.nasdanika.amur.it.js.foundation.UserTask#getValidation <em>Validation</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Validation</em>' containment reference.
* @see #getValidation()
* @generated
*/
|
Sets the value of the '<code>org.nasdanika.amur.it.js.foundation.UserTask#getValidation Validation</code>' containment reference.
|
setValidation
|
{
"repo_name": "Nasdanika/amur-it-js",
"path": "org.nasdanika.amur.it.js.foundation/src/org/nasdanika/amur/it/js/foundation/UserTask.java",
"license": "epl-1.0",
"size": 4400
}
|
[
"org.nasdanika.amur.lang.Source"
] |
import org.nasdanika.amur.lang.Source;
|
import org.nasdanika.amur.lang.*;
|
[
"org.nasdanika.amur"
] |
org.nasdanika.amur;
| 697,862
|
private void convertToWPath(PathIterator pathIter) {
float[] segment = new float[6];
int segmentType;
WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
int polyFillRule;
if (pathIter.getWindingRule() == PathIterator.WIND_EVEN_ODD) {
polyFillRule = WPrinterJob.POLYFILL_ALTERNATE;
} else {
polyFillRule = WPrinterJob.POLYFILL_WINDING;
}
wPrinterJob.setPolyFillMode(polyFillRule);
wPrinterJob.beginPath();
while (pathIter.isDone() == false) {
segmentType = pathIter.currentSegment(segment);
switch (segmentType) {
case PathIterator.SEG_MOVETO:
wPrinterJob.moveTo(segment[0], segment[1]);
break;
case PathIterator.SEG_LINETO:
wPrinterJob.lineTo(segment[0], segment[1]);
break;
case PathIterator.SEG_QUADTO:
int lastX = wPrinterJob.getPenX();
int lastY = wPrinterJob.getPenY();
float c1x = lastX + (segment[0] - lastX) * 2 / 3;
float c1y = lastY + (segment[1] - lastY) * 2 / 3;
float c2x = segment[2] - (segment[2] - segment[0]) * 2/ 3;
float c2y = segment[3] - (segment[3] - segment[1]) * 2/ 3;
wPrinterJob.polyBezierTo(c1x, c1y,
c2x, c2y,
segment[2], segment[3]);
break;
case PathIterator.SEG_CUBICTO:
wPrinterJob.polyBezierTo(segment[0], segment[1],
segment[2], segment[3],
segment[4], segment[5]);
break;
case PathIterator.SEG_CLOSE:
wPrinterJob.closeFigure();
break;
}
pathIter.next();
}
wPrinterJob.endPath();
}
|
void function(PathIterator pathIter) { float[] segment = new float[6]; int segmentType; WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); int polyFillRule; if (pathIter.getWindingRule() == PathIterator.WIND_EVEN_ODD) { polyFillRule = WPrinterJob.POLYFILL_ALTERNATE; } else { polyFillRule = WPrinterJob.POLYFILL_WINDING; } wPrinterJob.setPolyFillMode(polyFillRule); wPrinterJob.beginPath(); while (pathIter.isDone() == false) { segmentType = pathIter.currentSegment(segment); switch (segmentType) { case PathIterator.SEG_MOVETO: wPrinterJob.moveTo(segment[0], segment[1]); break; case PathIterator.SEG_LINETO: wPrinterJob.lineTo(segment[0], segment[1]); break; case PathIterator.SEG_QUADTO: int lastX = wPrinterJob.getPenX(); int lastY = wPrinterJob.getPenY(); float c1x = lastX + (segment[0] - lastX) * 2 / 3; float c1y = lastY + (segment[1] - lastY) * 2 / 3; float c2x = segment[2] - (segment[2] - segment[0]) * 2/ 3; float c2y = segment[3] - (segment[3] - segment[1]) * 2/ 3; wPrinterJob.polyBezierTo(c1x, c1y, c2x, c2y, segment[2], segment[3]); break; case PathIterator.SEG_CUBICTO: wPrinterJob.polyBezierTo(segment[0], segment[1], segment[2], segment[3], segment[4], segment[5]); break; case PathIterator.SEG_CLOSE: wPrinterJob.closeFigure(); break; } pathIter.next(); } wPrinterJob.endPath(); }
|
/**
* Given a Java2D <code>PathIterator</code> instance,
* this method translates that into a Window's path
* in the printer device context.
*/
|
Given a Java2D <code>PathIterator</code> instance, this method translates that into a Window's path in the printer device context
|
convertToWPath
|
{
"repo_name": "isaacl/openjdk-jdk",
"path": "src/windows/classes/sun/awt/windows/WPathGraphics.java",
"license": "gpl-2.0",
"size": 75305
}
|
[
"java.awt.geom.PathIterator"
] |
import java.awt.geom.PathIterator;
|
import java.awt.geom.*;
|
[
"java.awt"
] |
java.awt;
| 1,836,799
|
public void setDocumentHandler(XMLDocumentHandler documentHandler) {
fDocumentHandler = documentHandler;
} // setDocumentHandler(XMLDocumentHandler)
|
void function(XMLDocumentHandler documentHandler) { fDocumentHandler = documentHandler; }
|
/**
* Sets the document handler on the last component in the pipeline
* to receive information about the document.
*
* @param documentHandler The document handler.
*/
|
Sets the document handler on the last component in the pipeline to receive information about the document
|
setDocumentHandler
|
{
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java",
"license": "apache-2.0",
"size": 45565
}
|
[
"com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler"
] |
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
|
import com.sun.org.apache.xerces.internal.xni.*;
|
[
"com.sun.org"
] |
com.sun.org;
| 1,720,952
|
public PublicKey getPublicKey() throws XMLSecurityException, IOException {
X509Certificate cert = this.getX509Certificate();
if (cert != null) {
return cert.getPublicKey();
}
return null;
}
|
PublicKey function() throws XMLSecurityException, IOException { X509Certificate cert = this.getX509Certificate(); if (cert != null) { return cert.getPublicKey(); } return null; }
|
/**
* Method getPublicKey
*
* @return the publickey
* @throws XMLSecurityException
*/
|
Method getPublicKey
|
getPublicKey
|
{
"repo_name": "apache/santuario-java",
"path": "src/main/java/org/apache/xml/security/keys/content/x509/XMLX509Certificate.java",
"license": "apache-2.0",
"size": 4709
}
|
[
"java.io.IOException",
"java.security.PublicKey",
"java.security.cert.X509Certificate",
"org.apache.xml.security.exceptions.XMLSecurityException"
] |
import java.io.IOException; import java.security.PublicKey; import java.security.cert.X509Certificate; import org.apache.xml.security.exceptions.XMLSecurityException;
|
import java.io.*; import java.security.*; import java.security.cert.*; import org.apache.xml.security.exceptions.*;
|
[
"java.io",
"java.security",
"org.apache.xml"
] |
java.io; java.security; org.apache.xml;
| 2,170,507
|
private void generateTypeClassReference(HTMLBuilder builder, ModuleName moduleName, String unqualifiedName, String moduleNameInSource) {
generateTypeClassReference(builder, null, moduleName, unqualifiedName, moduleNameInSource);
}
|
void function(HTMLBuilder builder, ModuleName moduleName, String unqualifiedName, String moduleNameInSource) { generateTypeClassReference(builder, null, moduleName, unqualifiedName, moduleNameInSource); }
|
/**
* Generates a reference to a type class, appropriately hyperlinked.
* @param builder the HTMLBuilder for generating the reference.
* @param moduleName the name of the type class's module. Can be null.
* @param unqualifiedName the unqualified name of the type class.
* @param moduleNameInSource how the module name portion of the reference appears in source. Could be the empty string if the reference is unqualified in source.
*/
|
Generates a reference to a type class, appropriately hyperlinked
|
generateTypeClassReference
|
{
"repo_name": "levans/Open-Quark",
"path": "src/CAL_Platform/src/org/openquark/cal/caldoc/HTMLDocumentationGenerator.java",
"license": "bsd-3-clause",
"size": 414134
}
|
[
"org.openquark.cal.compiler.ModuleName"
] |
import org.openquark.cal.compiler.ModuleName;
|
import org.openquark.cal.compiler.*;
|
[
"org.openquark.cal"
] |
org.openquark.cal;
| 669,375
|
@Test
public void caseInsensitiveListing() throws Throwable {
GetClientsOptions opts = new GetClientsOptions();
opts.setCaseInsensitiveNameFilter("client*");
List<IClientSummary> clients = server.getClients(opts);
// we should get two clients here
assertThat("wrong number of clients", clients.size(), is(2));
}
|
void function() throws Throwable { GetClientsOptions opts = new GetClientsOptions(); opts.setCaseInsensitiveNameFilter(STR); List<IClientSummary> clients = server.getClients(opts); assertThat(STR, clients.size(), is(2)); }
|
/**
* *verify job046825: case-insensitive name matching
* @throws Throwable
*/
|
verify job046825: case-insensitive name matching
|
caseInsensitiveListing
|
{
"repo_name": "groboclown/p4ic4idea",
"path": "p4java/src/test/java/com/perforce/p4java/tests/qa/GetClientsTest.java",
"license": "apache-2.0",
"size": 3990
}
|
[
"com.perforce.p4java.client.IClientSummary",
"com.perforce.p4java.option.server.GetClientsOptions",
"java.util.List",
"org.hamcrest.MatcherAssert",
"org.hamcrest.core.Is"
] |
import com.perforce.p4java.client.IClientSummary; import com.perforce.p4java.option.server.GetClientsOptions; import java.util.List; import org.hamcrest.MatcherAssert; import org.hamcrest.core.Is;
|
import com.perforce.p4java.client.*; import com.perforce.p4java.option.server.*; import java.util.*; import org.hamcrest.*; import org.hamcrest.core.*;
|
[
"com.perforce.p4java",
"java.util",
"org.hamcrest",
"org.hamcrest.core"
] |
com.perforce.p4java; java.util; org.hamcrest; org.hamcrest.core;
| 1,137,461
|
private void init(@NonNull final Context context, @NonNull AttributeSet attrs) {
scaleGestureDetector = new ScaleGestureDetector(context, new ScaleGestureDetector.SimpleOnScaleGestureListener() {
|
void function(@NonNull final Context context, @NonNull AttributeSet attrs) { scaleGestureDetector = new ScaleGestureDetector(context, new ScaleGestureDetector.SimpleOnScaleGestureListener() {
|
/**
* Initialize all gesture detectors
* @param context instance of context
*/
|
Initialize all gesture detectors
|
init
|
{
"repo_name": "Iojjj/AndroidBootstrap",
"path": "widgets/src/main/java/iojjj/android/bootstrap/widgets/scalewidget/ResizeRotationView.java",
"license": "mit",
"size": 9359
}
|
[
"android.content.Context",
"android.support.annotation.NonNull",
"android.util.AttributeSet",
"android.view.ScaleGestureDetector"
] |
import android.content.Context; import android.support.annotation.NonNull; import android.util.AttributeSet; import android.view.ScaleGestureDetector;
|
import android.content.*; import android.support.annotation.*; import android.util.*; import android.view.*;
|
[
"android.content",
"android.support",
"android.util",
"android.view"
] |
android.content; android.support; android.util; android.view;
| 1,824,635
|
ResourceSet estimateResourceConsumption(CppCompileAction action);
|
ResourceSet estimateResourceConsumption(CppCompileAction action);
|
/**
* Returns the estimated resource consumption of the action.
*/
|
Returns the estimated resource consumption of the action
|
estimateResourceConsumption
|
{
"repo_name": "abergmeier-dsfishlabs/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionContext.java",
"license": "apache-2.0",
"size": 2942
}
|
[
"com.google.devtools.build.lib.actions.ResourceSet"
] |
import com.google.devtools.build.lib.actions.ResourceSet;
|
import com.google.devtools.build.lib.actions.*;
|
[
"com.google.devtools"
] |
com.google.devtools;
| 1,550,795
|
private ArrayList<AlarmDecoderBindingConfig> getItems(String itemName) {
ArrayList<AlarmDecoderBindingConfig> al = new ArrayList<AlarmDecoderBindingConfig>();
for (AlarmDecoderBindingProvider bp : providers) {
al.add(bp.getBindingConfig(itemName));
}
return al;
}
|
ArrayList<AlarmDecoderBindingConfig> function(String itemName) { ArrayList<AlarmDecoderBindingConfig> al = new ArrayList<AlarmDecoderBindingConfig>(); for (AlarmDecoderBindingProvider bp : providers) { al.add(bp.getBindingConfig(itemName)); } return al; }
|
/**
* Find binding configurations for a given item
*
* @param itemName name of item to look for
* @return array with binding configurations
*/
|
Find binding configurations for a given item
|
getItems
|
{
"repo_name": "paolodenti/openhab",
"path": "bundles/binding/org.openhab.binding.alarmdecoder/src/main/java/org/openhab/binding/alarmdecoder/internal/AlarmDecoderBinding.java",
"license": "epl-1.0",
"size": 28389
}
|
[
"java.util.ArrayList",
"org.openhab.binding.alarmdecoder.AlarmDecoderBindingProvider"
] |
import java.util.ArrayList; import org.openhab.binding.alarmdecoder.AlarmDecoderBindingProvider;
|
import java.util.*; import org.openhab.binding.alarmdecoder.*;
|
[
"java.util",
"org.openhab.binding"
] |
java.util; org.openhab.binding;
| 2,616,223
|
public static OUser updateUserData(Context context, OUser newData) {
OUser user = getDetails(context, newData.getAndroidName());
return updateUserData(context, user, newData);
}
|
static OUser function(Context context, OUser newData) { OUser user = getDetails(context, newData.getAndroidName()); return updateUserData(context, user, newData); }
|
/**
* Updates user bundle data in accounts
*
* @param context
* @param newData instance of OUser class
* @return new user object with updated values
*/
|
Updates user bundle data in accounts
|
updateUserData
|
{
"repo_name": "js-superion/framework-master",
"path": "app/src/main/java/com/odoo/core/auth/OdooAccountManager.java",
"license": "agpl-3.0",
"size": 8310
}
|
[
"android.content.Context",
"com.odoo.core.support.OUser"
] |
import android.content.Context; import com.odoo.core.support.OUser;
|
import android.content.*; import com.odoo.core.support.*;
|
[
"android.content",
"com.odoo.core"
] |
android.content; com.odoo.core;
| 2,005,931
|
public String getDefaultNamespace( final XmlDocumentInfo documentInfo ) {
return ClassicEngineBoot.METADATA_NAMESPACE;
}
|
String function( final XmlDocumentInfo documentInfo ) { return ClassicEngineBoot.METADATA_NAMESPACE; }
|
/**
* Returns the default namespace for a document with the characteristics given in the XmlDocumentInfo.
*
* @param documentInfo
* the document information.
* @return the default namespace uri for the document.
*/
|
Returns the default namespace for a document with the characteristics given in the XmlDocumentInfo
|
getDefaultNamespace
|
{
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/metadata/parser/ExpressionMetaDataXmlFactoryModule.java",
"license": "lgpl-2.1",
"size": 3105
}
|
[
"org.pentaho.reporting.engine.classic.core.ClassicEngineBoot",
"org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo"
] |
import org.pentaho.reporting.engine.classic.core.ClassicEngineBoot; import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
|
import org.pentaho.reporting.engine.classic.core.*; import org.pentaho.reporting.libraries.xmlns.parser.*;
|
[
"org.pentaho.reporting"
] |
org.pentaho.reporting;
| 364,580
|
private void writeExpanded() throws IOException {
String contents;
File targetDir;
FileWriter writer;
BufferedWriter buf_writer;
SnippetFile sf;
Enumeration my_enum = this.m_snippets.elements();
while (my_enum.hasMoreElements()) {
sf = (SnippetFile)my_enum.nextElement();
contents = sf.getCode();
// Make target directory
targetDir = new File(sf.getPath());
if (!targetDir.exists()) {
targetDir.mkdirs();
}
writer = new FileWriter(sf.getPath() + File.separatorChar + sf.getFileName());
buf_writer = new BufferedWriter(writer);
buf_writer.write(contents);
buf_writer.close();
}
}
private FileManager() {
m_snippets = new Hashtable();
}
|
void function() throws IOException { String contents; File targetDir; FileWriter writer; BufferedWriter buf_writer; SnippetFile sf; Enumeration my_enum = this.m_snippets.elements(); while (my_enum.hasMoreElements()) { sf = (SnippetFile)my_enum.nextElement(); contents = sf.getCode(); targetDir = new File(sf.getPath()); if (!targetDir.exists()) { targetDir.mkdirs(); } writer = new FileWriter(sf.getPath() + File.separatorChar + sf.getFileName()); buf_writer = new BufferedWriter(writer); buf_writer.write(contents); buf_writer.close(); } } private FileManager() { m_snippets = new Hashtable(); }
|
/**
* Prints the source code using the expanded way.
* @throws IOException
*/
|
Prints the source code using the expanded way
|
writeExpanded
|
{
"repo_name": "AlvaroVega/TIDIdlc",
"path": "source/es/tid/TIDIdlc/util/FileManager.java",
"license": "agpl-3.0",
"size": 40152
}
|
[
"java.io.BufferedWriter",
"java.io.File",
"java.io.FileWriter",
"java.io.IOException",
"java.util.Enumeration",
"java.util.Hashtable"
] |
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Enumeration; import java.util.Hashtable;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 2,545,795
|
@Deprecated
void createQueue(SimpleString address,
SimpleString queueName,
SimpleString filter,
boolean durable,
boolean autoCreated) throws ActiveMQException;
|
void createQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated) throws ActiveMQException;
|
/**
* Creates a <em>non-temporary</em> queue.
*
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @param filter only messages which match this filter will be put in the queue
* @param durable whether the queue is durable or not
* @param autoCreated whether to mark this queue as autoCreated or not
* @throws ActiveMQException in an exception occurs while creating the queue
*/
|
Creates a non-temporary queue
|
createQueue
|
{
"repo_name": "gtully/activemq-artemis",
"path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java",
"license": "apache-2.0",
"size": 41588
}
|
[
"org.apache.activemq.artemis.api.core.ActiveMQException",
"org.apache.activemq.artemis.api.core.SimpleString"
] |
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.SimpleString;
|
import org.apache.activemq.artemis.api.core.*;
|
[
"org.apache.activemq"
] |
org.apache.activemq;
| 2,789,316
|
public void treeCollapsed(TreeExpansionEvent e)
{
fireTreeCollapsed(e.getPath());
}
|
void function(TreeExpansionEvent e) { fireTreeCollapsed(e.getPath()); }
|
/**
* Tree Collapsed notification
*
* @param e - the event
*/
|
Tree Collapsed notification
|
treeCollapsed
|
{
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/JTree.java",
"license": "gpl-2.0",
"size": 83318
}
|
[
"javax.swing.event.TreeExpansionEvent"
] |
import javax.swing.event.TreeExpansionEvent;
|
import javax.swing.event.*;
|
[
"javax.swing"
] |
javax.swing;
| 2,075,633
|
private ILineRange computeDirtyWidgetLines(PaintEvent event) {
int firstLine= fStyledText.getLineIndex(event.y);
int lastLine= fStyledText.getLineIndex(event.y + event.height - 1);
return new LineRange(firstLine, lastLine - firstLine + 1);
}
|
ILineRange function(PaintEvent event) { int firstLine= fStyledText.getLineIndex(event.y); int lastLine= fStyledText.getLineIndex(event.y + event.height - 1); return new LineRange(firstLine, lastLine - firstLine + 1); }
|
/**
* Computes the widget lines that need repainting given the clipping region of a paint event.
*
* @param event the paint event
* @return the lines in widget coordinates that need repainting
*/
|
Computes the widget lines that need repainting given the clipping region of a paint event
|
computeDirtyWidgetLines
|
{
"repo_name": "brunyuriy/quick-fix-scout",
"path": "org.eclipse.jface.text_3.8.1.v20120828-155502/src/org/eclipse/jface/text/source/AbstractRulerColumn.java",
"license": "mit",
"size": 21568
}
|
[
"org.eclipse.swt.events.PaintEvent"
] |
import org.eclipse.swt.events.PaintEvent;
|
import org.eclipse.swt.events.*;
|
[
"org.eclipse.swt"
] |
org.eclipse.swt;
| 650,935
|
public BigDecimal getApprovalAmt()
{
return getGrandTotal();
} // getApprovalAmt
|
BigDecimal function() { return getGrandTotal(); }
|
/**
* Get Document Approval Amount
* @return amount
*/
|
Get Document Approval Amount
|
getApprovalAmt
|
{
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/MOrder.java",
"license": "gpl-2.0",
"size": 73338
}
|
[
"java.math.BigDecimal"
] |
import java.math.BigDecimal;
|
import java.math.*;
|
[
"java.math"
] |
java.math;
| 1,250,994
|
@Deprecated
public ArrayList<View> findViewsByText(String text) {
ArrayList<View> allViews = getViews();
ArrayList<View> views = new ArrayList<View>();
int viewNumber = allViews.size();
for (int i = 0; i < viewNumber; i++) {
View view = allViews.get(i);
String t = getViewText(view);
if (t.indexOf(text) != -1) {
views.add(view);
}
}
return views;
}
|
ArrayList<View> function(String text) { ArrayList<View> allViews = getViews(); ArrayList<View> views = new ArrayList<View>(); int viewNumber = allViews.size(); for (int i = 0; i < viewNumber; i++) { View view = allViews.get(i); String t = getViewText(view); if (t.indexOf(text) != -1) { views.add(view); } } return views; }
|
/**
* find views via view's text, it only needs part of target view's text
*
* @param text
* the text of the view
* @return a ArrayList<View> contains views found
*/
|
find views via view's text, it only needs part of target view's text
|
findViewsByText
|
{
"repo_name": "0359xiaodong/Cafe",
"path": "testrunner/src/com/baidu/cafe/local/LocalLib.java",
"license": "apache-2.0",
"size": 84428
}
|
[
"android.view.View",
"java.util.ArrayList"
] |
import android.view.View; import java.util.ArrayList;
|
import android.view.*; import java.util.*;
|
[
"android.view",
"java.util"
] |
android.view; java.util;
| 2,437,887
|
public JspContext getJspContext()
{
return this.pageContext;
}
|
JspContext function() { return this.pageContext; }
|
/**
* Returns the context.
*/
|
Returns the context
|
getJspContext
|
{
"repo_name": "christianchristensen/resin",
"path": "modules/resin/src/com/caucho/jsp/JspFragmentSupport.java",
"license": "gpl-2.0",
"size": 2910
}
|
[
"javax.servlet.jsp.JspContext"
] |
import javax.servlet.jsp.JspContext;
|
import javax.servlet.jsp.*;
|
[
"javax.servlet"
] |
javax.servlet;
| 2,432,349
|
Vector getMean();
|
Vector getMean();
|
/**
* This should (usually) be backed by the distribution object. I.e. changes
* will "write through".
*
* @return
*/
|
This should (usually) be backed by the distribution object. I.e. changes will "write through"
|
getMean
|
{
"repo_name": "sodash/open-code",
"path": "winterwell.maths/src/com/winterwell/maths/stats/distributions/IDistribution.java",
"license": "mit",
"size": 1623
}
|
[
"no.uib.cipr.matrix.Vector"
] |
import no.uib.cipr.matrix.Vector;
|
import no.uib.cipr.matrix.*;
|
[
"no.uib.cipr"
] |
no.uib.cipr;
| 957,772
|
@IgniteSpiConfiguration(optional = true)
public TcpCommunicationSpi setConnectTimeout(long connTimeout) {
this.connTimeout = connTimeout;
failureDetectionTimeoutEnabled(false);
return this;
}
|
@IgniteSpiConfiguration(optional = true) TcpCommunicationSpi function(long connTimeout) { this.connTimeout = connTimeout; failureDetectionTimeoutEnabled(false); return this; }
|
/**
* Sets connect timeout used when establishing connection
* with remote nodes.
* <p>
* {@code 0} is interpreted as infinite timeout.
* <p>
* If not provided, default value is {@link #DFLT_CONN_TIMEOUT}.
* <p>
* When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
*
* @param connTimeout Connect timeout.
* @return {@code this} for chaining.
*/
|
Sets connect timeout used when establishing connection with remote nodes. 0 is interpreted as infinite timeout. If not provided, default value is <code>#DFLT_CONN_TIMEOUT</code>. When this property is explicitly set <code>IgniteConfiguration#getFailureDetectionTimeout()</code> is ignored
|
setConnectTimeout
|
{
"repo_name": "SharplEr/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java",
"license": "apache-2.0",
"size": 182111
}
|
[
"org.apache.ignite.spi.IgniteSpiConfiguration"
] |
import org.apache.ignite.spi.IgniteSpiConfiguration;
|
import org.apache.ignite.spi.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 1,577,401
|
@Test
public void testLoadCoreInetOrgPersonAndBad() throws Exception
{
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
SchemaManager schemaManager = new DefaultSchemaManager( loader );
assertTrue( schemaManager.load( "system" ) );
try
{
assertFalse( schemaManager.load( "core", "bad", "cosine", "InetOrgPerson" ) );
fail();
}
catch ( LdapUnwillingToPerformException lonse )
{
// expected
}
assertTrue( schemaManager.getErrors().isEmpty() );
assertEquals( 38, schemaManager.getAttributeTypeRegistry().size() );
assertEquals( 35, schemaManager.getComparatorRegistry().size() );
assertEquals( 35, schemaManager.getMatchingRuleRegistry().size() );
assertEquals( 35, schemaManager.getNormalizerRegistry().size() );
assertEquals( 9, schemaManager.getObjectClassRegistry().size() );
assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() );
assertEquals( 59, schemaManager.getLdapSyntaxRegistry().size() );
assertEquals( 141, schemaManager.getGlobalOidRegistry().size() );
assertEquals( 1, schemaManager.getRegistries().getLoadedSchemas().size() );
assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) );
assertNull( schemaManager.getRegistries().getLoadedSchema( "core" ) );
assertNull( schemaManager.getRegistries().getLoadedSchema( "cosine" ) );
assertNull( schemaManager.getRegistries().getLoadedSchema( "InetOrgPerson" ) );
}
|
void function() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( STR ) ); try { assertFalse( schemaManager.load( "core", "bad", STR, STR ) ); fail(); } catch ( LdapUnwillingToPerformException lonse ) { } assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 38, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 35, schemaManager.getComparatorRegistry().size() ); assertEquals( 35, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 9, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 59, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 141, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 1, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( STR ) ); assertNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNull( schemaManager.getRegistries().getLoadedSchema( STR ) ); assertNull( schemaManager.getRegistries().getLoadedSchema( STR ) ); }
|
/**
* test loading the "InetOrgPerson", "core" and a bad schema
*/
|
test loading the "InetOrgPerson", "core" and a bad schema
|
testLoadCoreInetOrgPersonAndBad
|
{
"repo_name": "darranl/directory-shared",
"path": "ldap/schema/data/src/test/java/org/apache/directory/api/ldap/schemaloader/SchemaManagerLoadTest.java",
"license": "apache-2.0",
"size": 33764
}
|
[
"org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException",
"org.apache.directory.api.ldap.model.schema.SchemaManager",
"org.apache.directory.api.ldap.schemaloader.LdifSchemaLoader",
"org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager",
"org.junit.Assert"
] |
import org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException; import org.apache.directory.api.ldap.model.schema.SchemaManager; import org.apache.directory.api.ldap.schemaloader.LdifSchemaLoader; import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager; import org.junit.Assert;
|
import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.api.ldap.model.schema.*; import org.apache.directory.api.ldap.schemaloader.*; import org.apache.directory.api.ldap.schemamanager.impl.*; import org.junit.*;
|
[
"org.apache.directory",
"org.junit"
] |
org.apache.directory; org.junit;
| 1,534,461
|
@SuppressWarnings("unchecked")
public default THIS withDataProvider(FetchItemsCallback<ITEM> fetchItems, SerializableSupplier<Integer> sizeCallback) {
((Grid<ITEM>) this).setDataProvider(fetchItems, sizeCallback);
return (THIS) this;
}
|
@SuppressWarnings(STR) default THIS function(FetchItemsCallback<ITEM> fetchItems, SerializableSupplier<Integer> sizeCallback) { ((Grid<ITEM>) this).setDataProvider(fetchItems, sizeCallback); return (THIS) this; }
|
/**
* Sets a CallbackDataProvider using the given fetch items callback and a
* size callback.
* <p>
* This method is a shorthand for making a {@link CallbackDataProvider} that
* handles a partial {@link Query} object.
*
* @param fetchItems
* a callback for fetching items
* @param sizeCallback
* a callback for getting the count of items
*
* @return this for method chaining
* @see Grid#setDataProvider(FetchItemsCallback, SerializableSupplier)
* @see CallbackDataProvider
*/
|
Sets a CallbackDataProvider using the given fetch items callback and a size callback. This method is a shorthand for making a <code>CallbackDataProvider</code> that handles a partial <code>Query</code> object
|
withDataProvider
|
{
"repo_name": "viydaag/vaadin-fluent-api",
"path": "src/main/java/com/vaadin/fluent/api/FluentGrid.java",
"license": "apache-2.0",
"size": 18344
}
|
[
"com.vaadin.server.SerializableSupplier",
"com.vaadin.ui.Grid"
] |
import com.vaadin.server.SerializableSupplier; import com.vaadin.ui.Grid;
|
import com.vaadin.server.*; import com.vaadin.ui.*;
|
[
"com.vaadin.server",
"com.vaadin.ui"
] |
com.vaadin.server; com.vaadin.ui;
| 1,447,920
|
public void updateOpenIDUserRPInfo(OpenIDUserRPDTO rpdto) throws IdentityProviderException {
String userName = null;
try {
userName = OpenIDUtil.getUserName(rpdto.getOpenID());
} catch (MalformedURLException e) {
throw new IdentityProviderException("Failed to get username from OpenID " + rpdto.getOpenID(), e);
}
String domainName = MultitenantUtils.getDomainNameFromOpenId(rpdto.getOpenID());
OpenIDUserRPDO rpdo = new OpenIDUserRPDO();
OpenIDUserRPDAO dao = new OpenIDUserRPDAO();
try {
rpdo.setUserName(userName);
rpdo.setRpUrl(rpdto.getRpUrl());
rpdo.setTrustedAlways(rpdto.isTrustedAlways());
rpdo.setDefaultProfileName(rpdto.getDefaultProfileName());
MessageDigest sha = MessageDigest.getInstance("SHA-1");
byte[] digest = sha.digest((userName + ":" + rpdto.getRpUrl()).getBytes());
rpdo.setUuid(new String(Hex.encodeHex(digest)));
dao.createOrUpdate(rpdo);
} catch (NoSuchAlgorithmException e) {
throw new IdentityProviderException("Error while updating DAO for " + domainName, e);
}
}
|
void function(OpenIDUserRPDTO rpdto) throws IdentityProviderException { String userName = null; try { userName = OpenIDUtil.getUserName(rpdto.getOpenID()); } catch (MalformedURLException e) { throw new IdentityProviderException(STR + rpdto.getOpenID(), e); } String domainName = MultitenantUtils.getDomainNameFromOpenId(rpdto.getOpenID()); OpenIDUserRPDO rpdo = new OpenIDUserRPDO(); OpenIDUserRPDAO dao = new OpenIDUserRPDAO(); try { rpdo.setUserName(userName); rpdo.setRpUrl(rpdto.getRpUrl()); rpdo.setTrustedAlways(rpdto.isTrustedAlways()); rpdo.setDefaultProfileName(rpdto.getDefaultProfileName()); MessageDigest sha = MessageDigest.getInstance("SHA-1"); byte[] digest = sha.digest((userName + ":" + rpdto.getRpUrl()).getBytes()); rpdo.setUuid(new String(Hex.encodeHex(digest))); dao.createOrUpdate(rpdo); } catch (NoSuchAlgorithmException e) { throw new IdentityProviderException(STR + domainName, e); } }
|
/**
* This method tracks RPs
*
* @param rpdto
* @throws IdentityProviderException
*/
|
This method tracks RPs
|
updateOpenIDUserRPInfo
|
{
"repo_name": "prabathabey/carbon-identity",
"path": "components/openid/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/OpenIDProviderService.java",
"license": "apache-2.0",
"size": 35013
}
|
[
"java.net.MalformedURLException",
"java.security.MessageDigest",
"java.security.NoSuchAlgorithmException",
"org.apache.commons.codec.binary.Hex",
"org.wso2.carbon.identity.core.model.OpenIDUserRPDO",
"org.wso2.carbon.identity.provider.dto.OpenIDUserRPDTO",
"org.wso2.carbon.identity.provider.openid.OpenIDUtil",
"org.wso2.carbon.identity.provider.openid.dao.OpenIDUserRPDAO",
"org.wso2.carbon.utils.multitenancy.MultitenantUtils"
] |
import java.net.MalformedURLException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.apache.commons.codec.binary.Hex; import org.wso2.carbon.identity.core.model.OpenIDUserRPDO; import org.wso2.carbon.identity.provider.dto.OpenIDUserRPDTO; import org.wso2.carbon.identity.provider.openid.OpenIDUtil; import org.wso2.carbon.identity.provider.openid.dao.OpenIDUserRPDAO; import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
|
import java.net.*; import java.security.*; import org.apache.commons.codec.binary.*; import org.wso2.carbon.identity.core.model.*; import org.wso2.carbon.identity.provider.dto.*; import org.wso2.carbon.identity.provider.openid.*; import org.wso2.carbon.identity.provider.openid.dao.*; import org.wso2.carbon.utils.multitenancy.*;
|
[
"java.net",
"java.security",
"org.apache.commons",
"org.wso2.carbon"
] |
java.net; java.security; org.apache.commons; org.wso2.carbon;
| 139,936
|
private static void assertReadingCompressedFileMatchesExpected(
File file, Compression compression, List<String> expected, Pipeline p) {
TextIO.Read read = TextIO.read().from(file.getPath()).withCompression(compression);
PAssert.that(p.apply("Read_" + file + "_" + compression.toString(), read))
.containsInAnyOrder(expected);
PAssert.that(
p.apply(
"Read_" + file + "_" + compression.toString() + "_many",
read.withHintMatchesManyFiles()))
.containsInAnyOrder(expected);
PAssert.that(
p.apply("Create_Paths_ReadFiles_" + file, Create.of(file.getPath()))
.apply("Match_" + file, FileIO.matchAll())
.apply("ReadMatches_" + file, FileIO.readMatches().withCompression(compression))
.apply("ReadFiles_" + compression.toString(), TextIO.readFiles()))
.containsInAnyOrder(expected);
PAssert.that(
p.apply("Create_Paths_ReadAll_" + file, Create.of(file.getPath()))
.apply(
"ReadAll_" + compression.toString(),
TextIO.readAll().withCompression(compression)))
.containsInAnyOrder(expected);
}
|
static void function( File file, Compression compression, List<String> expected, Pipeline p) { TextIO.Read read = TextIO.read().from(file.getPath()).withCompression(compression); PAssert.that(p.apply("Read_" + file + "_" + compression.toString(), read)) .containsInAnyOrder(expected); PAssert.that( p.apply( "Read_" + file + "_" + compression.toString() + "_many", read.withHintMatchesManyFiles())) .containsInAnyOrder(expected); PAssert.that( p.apply(STR + file, Create.of(file.getPath())) .apply(STR + file, FileIO.matchAll()) .apply(STR + file, FileIO.readMatches().withCompression(compression)) .apply(STR + compression.toString(), TextIO.readFiles())) .containsInAnyOrder(expected); PAssert.that( p.apply(STR + file, Create.of(file.getPath())) .apply( STR + compression.toString(), TextIO.readAll().withCompression(compression))) .containsInAnyOrder(expected); }
|
/**
* Helper method that runs a variety of ways to read a single file using TextIO and checks that
* they all match the given expected output.
*
* <p>The transforms being verified are:
*
* <ul>
* <li>TextIO.read().from(filename).withCompression(compressionType)
* <li>TextIO.read().from(filename).withCompression(compressionType) .withHintMatchesManyFiles()
* <li>TextIO.readFiles().withCompression(compressionType)
* <li>TextIO.readAll().withCompression(compressionType)
* </ul>
*/
|
Helper method that runs a variety of ways to read a single file using TextIO and checks that they all match the given expected output. The transforms being verified are: TextIO.read().from(filename).withCompression(compressionType) TextIO.read().from(filename).withCompression(compressionType) .withHintMatchesManyFiles() TextIO.readFiles().withCompression(compressionType) TextIO.readAll().withCompression(compressionType)
|
assertReadingCompressedFileMatchesExpected
|
{
"repo_name": "lukecwik/incubator-beam",
"path": "sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOReadTest.java",
"license": "apache-2.0",
"size": 39127
}
|
[
"java.io.File",
"java.util.List",
"org.apache.beam.sdk.Pipeline",
"org.apache.beam.sdk.testing.PAssert",
"org.apache.beam.sdk.transforms.Create",
"org.hamcrest.Matchers"
] |
import java.io.File; import java.util.List; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.testing.PAssert; import org.apache.beam.sdk.transforms.Create; import org.hamcrest.Matchers;
|
import java.io.*; import java.util.*; import org.apache.beam.sdk.*; import org.apache.beam.sdk.testing.*; import org.apache.beam.sdk.transforms.*; import org.hamcrest.*;
|
[
"java.io",
"java.util",
"org.apache.beam",
"org.hamcrest"
] |
java.io; java.util; org.apache.beam; org.hamcrest;
| 1,301,251
|
@Test
@MediumTest
public void testShowCastOnDocumentElement() throws Exception {
SelectorProto element = toCssSelector("#touch_area_one");
ArrayList<ActionProto> list = new ArrayList<>();
list.add(ActionProto.newBuilder()
.setShowCast(ShowCastProto.newBuilder()
.setElementToPresent(element)
.setTouchableElementArea(
ElementAreaProto.newBuilder().addTouchable(
Rectangle.newBuilder().addElements(
element))))
.build());
list.add(ActionProto.newBuilder()
.setPrompt(PromptProto.newBuilder().setMessage("Prompt").addChoices(
PromptProto.Choice.newBuilder()))
.build());
AutofillAssistantTestScript script = new AutofillAssistantTestScript(
SupportedScriptProto.newBuilder()
.setPath("autofill_assistant_target_website.html")
.setPresentation(PresentationProto.newBuilder().setAutostart(true))
.build(),
list);
runScript(script);
waitUntil(() -> checkElementOnScreen(mTestRule, "touch_area_one"));
waitUntilViewMatchesCondition(withText("Prompt"), isCompletelyDisplayed());
// Tapping on the element should remove it from the DOM.
assertThat(checkElementExists(mTestRule.getWebContents(), "touch_area_one"), is(true));
tapElement(mTestRule, "touch_area_one");
waitUntil(() -> !checkElementExists(mTestRule.getWebContents(), "touch_area_one"));
// Tapping on the element should be blocked by the overlay.
tapElement(mTestRule, "touch_area_four");
assertThat(checkElementExists(mTestRule.getWebContents(), "touch_area_four"), is(true));
}
|
void function() throws Exception { SelectorProto element = toCssSelector(STR); ArrayList<ActionProto> list = new ArrayList<>(); list.add(ActionProto.newBuilder() .setShowCast(ShowCastProto.newBuilder() .setElementToPresent(element) .setTouchableElementArea( ElementAreaProto.newBuilder().addTouchable( Rectangle.newBuilder().addElements( element)))) .build()); list.add(ActionProto.newBuilder() .setPrompt(PromptProto.newBuilder().setMessage(STR).addChoices( PromptProto.Choice.newBuilder())) .build()); AutofillAssistantTestScript script = new AutofillAssistantTestScript( SupportedScriptProto.newBuilder() .setPath(STR) .setPresentation(PresentationProto.newBuilder().setAutostart(true)) .build(), list); runScript(script); waitUntil(() -> checkElementOnScreen(mTestRule, STR)); waitUntilViewMatchesCondition(withText(STR), isCompletelyDisplayed()); assertThat(checkElementExists(mTestRule.getWebContents(), STR), is(true)); tapElement(mTestRule, STR); waitUntil(() -> !checkElementExists(mTestRule.getWebContents(), STR)); tapElement(mTestRule, STR); assertThat(checkElementExists(mTestRule.getWebContents(), STR), is(true)); }
|
/**
* Tests that clicking on a document element works with a showcast.
*/
|
Tests that clicking on a document element works with a showcast
|
testShowCastOnDocumentElement
|
{
"repo_name": "scheib/chromium",
"path": "chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java",
"license": "bsd-3-clause",
"size": 24673
}
|
[
"androidx.test.espresso.matcher.ViewMatchers",
"java.util.ArrayList",
"org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil",
"org.chromium.chrome.browser.autofill_assistant.ProtoTestUtil",
"org.chromium.chrome.browser.autofill_assistant.proto.ActionProto",
"org.chromium.chrome.browser.autofill_assistant.proto.ElementAreaProto",
"org.chromium.chrome.browser.autofill_assistant.proto.PromptProto",
"org.chromium.chrome.browser.autofill_assistant.proto.SelectorProto",
"org.chromium.chrome.browser.autofill_assistant.proto.ShowCastProto",
"org.chromium.chrome.browser.autofill_assistant.proto.SupportedScriptProto",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] |
import androidx.test.espresso.matcher.ViewMatchers; import java.util.ArrayList; import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil; import org.chromium.chrome.browser.autofill_assistant.ProtoTestUtil; import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto; import org.chromium.chrome.browser.autofill_assistant.proto.ElementAreaProto; import org.chromium.chrome.browser.autofill_assistant.proto.PromptProto; import org.chromium.chrome.browser.autofill_assistant.proto.SelectorProto; import org.chromium.chrome.browser.autofill_assistant.proto.ShowCastProto; import org.chromium.chrome.browser.autofill_assistant.proto.SupportedScriptProto; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
|
import androidx.test.espresso.matcher.*; import java.util.*; import org.chromium.chrome.browser.autofill_assistant.*; import org.chromium.chrome.browser.autofill_assistant.proto.*; import org.hamcrest.*;
|
[
"androidx.test",
"java.util",
"org.chromium.chrome",
"org.hamcrest"
] |
androidx.test; java.util; org.chromium.chrome; org.hamcrest;
| 470,089
|
private boolean isSuppressed(HashGroupifyEntry<StringArray> entry) {
String[] array = entry.getElement().values;
for (int i=1; i<array.length; i++) {
if (!array[i-1].equals(array[i])) {
return false;
}
}
return true;
}
|
boolean function(HashGroupifyEntry<StringArray> entry) { String[] array = entry.getElement().values; for (int i=1; i<array.length; i++) { if (!array[i-1].equals(array[i])) { return false; } } return true; }
|
/**
* We assume that an entry is suppressed, if all values are equal
* @param entry
* @return
*/
|
We assume that an entry is suppressed, if all values are equal
|
isSuppressed
|
{
"repo_name": "arx-deidentifier/risk-benchmark",
"path": "src/org/deidentifier/arx/utility/UtilityMeasureDiscernibility.java",
"license": "apache-2.0",
"size": 2626
}
|
[
"org.deidentifier.arx.utility.util.HashGroupifyEntry",
"org.deidentifier.arx.utility.util.StringArray"
] |
import org.deidentifier.arx.utility.util.HashGroupifyEntry; import org.deidentifier.arx.utility.util.StringArray;
|
import org.deidentifier.arx.utility.util.*;
|
[
"org.deidentifier.arx"
] |
org.deidentifier.arx;
| 1,325,958
|
public Builder putAll(Predicate<? super ValidationContext> predicate,
XMLValidators... validators)
{
for (XMLValidators validator : validators)
{
put(predicate, validator);
}
return this;
}
|
Builder function(Predicate<? super ValidationContext> predicate, XMLValidators... validators) { for (XMLValidators validator : validators) { put(predicate, validator); } return this; }
|
/**
* Puts all the given validators in this map and determines their
* applicability to a validation context by the given predicate.
*/
|
Puts all the given validators in this map and determines their applicability to a validation context by the given predicate
|
putAll
|
{
"repo_name": "e10/epubcheck",
"path": "src/main/java/com/adobe/epubcheck/util/ValidatorMap.java",
"license": "mit",
"size": 4779
}
|
[
"com.adobe.epubcheck.opf.ValidationContext",
"com.adobe.epubcheck.xml.XMLValidators",
"com.google.common.base.Predicate"
] |
import com.adobe.epubcheck.opf.ValidationContext; import com.adobe.epubcheck.xml.XMLValidators; import com.google.common.base.Predicate;
|
import com.adobe.epubcheck.opf.*; import com.adobe.epubcheck.xml.*; import com.google.common.base.*;
|
[
"com.adobe.epubcheck",
"com.google.common"
] |
com.adobe.epubcheck; com.google.common;
| 952,894
|
@Nullable
private List<String> computeArgs(CommandEnvironment env, ConfiguredTarget targetToRun,
List<String> commandLineArgs) {
List<String> args = Lists.newArrayList();
FilesToRunProvider provider = targetToRun.getProvider(FilesToRunProvider.class);
RunfilesSupport runfilesSupport = provider == null ? null : provider.getRunfilesSupport();
if (runfilesSupport != null && runfilesSupport.getArgs() != null) {
CommandLine targetArgs = runfilesSupport.getArgs();
try {
Iterables.addAll(args, targetArgs.arguments());
} catch (CommandLineExpansionException e) {
env.getReporter().handle(Event.error("Could not expand target command line: " + e));
return null;
}
}
args.addAll(commandLineArgs);
return args;
}
|
List<String> function(CommandEnvironment env, ConfiguredTarget targetToRun, List<String> commandLineArgs) { List<String> args = Lists.newArrayList(); FilesToRunProvider provider = targetToRun.getProvider(FilesToRunProvider.class); RunfilesSupport runfilesSupport = provider == null ? null : provider.getRunfilesSupport(); if (runfilesSupport != null && runfilesSupport.getArgs() != null) { CommandLine targetArgs = runfilesSupport.getArgs(); try { Iterables.addAll(args, targetArgs.arguments()); } catch (CommandLineExpansionException e) { env.getReporter().handle(Event.error(STR + e)); return null; } } args.addAll(commandLineArgs); return args; }
|
/**
* Compute the arguments the binary should be run with by concatenating the arguments in its
* {@code args=} attribute and the arguments on the Blaze command line.
*/
|
Compute the arguments the binary should be run with by concatenating the arguments in its args= attribute and the arguments on the Blaze command line
|
computeArgs
|
{
"repo_name": "ulfjack/bazel",
"path": "src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java",
"license": "apache-2.0",
"size": 36328
}
|
[
"com.google.common.collect.Iterables",
"com.google.common.collect.Lists",
"com.google.devtools.build.lib.actions.CommandLine",
"com.google.devtools.build.lib.actions.CommandLineExpansionException",
"com.google.devtools.build.lib.analysis.ConfiguredTarget",
"com.google.devtools.build.lib.analysis.FilesToRunProvider",
"com.google.devtools.build.lib.analysis.RunfilesSupport",
"com.google.devtools.build.lib.events.Event",
"com.google.devtools.build.lib.runtime.CommandEnvironment",
"java.util.List"
] |
import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.devtools.build.lib.actions.CommandLine; import com.google.devtools.build.lib.actions.CommandLineExpansionException; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.FilesToRunProvider; import com.google.devtools.build.lib.analysis.RunfilesSupport; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.runtime.CommandEnvironment; import java.util.List;
|
import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.events.*; import com.google.devtools.build.lib.runtime.*; import java.util.*;
|
[
"com.google.common",
"com.google.devtools",
"java.util"
] |
com.google.common; com.google.devtools; java.util;
| 2,771,843
|
public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {
return decode(image, null);
}
|
Result function(BinaryBitmap image) throws NotFoundException, FormatException { return decode(image, null); }
|
/**
* Locates and decodes a PDF417 code in an image.
*
* @return a String representing the content encoded by the PDF417 code
* @throws NotFoundException if a PDF417 code cannot be found,
* @throws FormatException if a PDF417 cannot be decoded
*/
|
Locates and decodes a PDF417 code in an image
|
decode
|
{
"repo_name": "saqimtiaz/BibSearch",
"path": "com.google.zxing.client.android.CaptureActivity/src/com/google/zxing/pdf417/PDF417Reader.java",
"license": "mit",
"size": 6151
}
|
[
"com.google.zxing.BinaryBitmap",
"com.google.zxing.FormatException",
"com.google.zxing.NotFoundException",
"com.google.zxing.Result"
] |
import com.google.zxing.BinaryBitmap; import com.google.zxing.FormatException; import com.google.zxing.NotFoundException; import com.google.zxing.Result;
|
import com.google.zxing.*;
|
[
"com.google.zxing"
] |
com.google.zxing;
| 495,581
|
public static void deleteFile(File f) throws IOException {
if (!f.delete()) {
if(!f.exists())
// we are trying to delete a file that no longer exists, so this is not an error
return;
// perhaps this file is read-only?
makeWritable(f);
makeWritable(f.getParentFile());
if(!f.delete() && f.exists()) {
// trouble-shooting.
// see http://www.nabble.com/Sometimes-can%27t-delete-files-from-hudson.scm.SubversionSCM%24CheckOutTask.invoke%28%29-tt17333292.html
// I suspect other processes putting files in this directory
File[] files = f.listFiles();
if(files!=null && files.length>0)
throw new IOException("Unable to delete " + f.getPath()+" - files in dir: "+Arrays.asList(files));
throw new IOException("Unable to delete " + f.getPath());
}
}
}
|
static void function(File f) throws IOException { if (!f.delete()) { if(!f.exists()) return; makeWritable(f); makeWritable(f.getParentFile()); if(!f.delete() && f.exists()) { File[] files = f.listFiles(); if(files!=null && files.length>0) throw new IOException(STR + f.getPath()+STR+Arrays.asList(files)); throw new IOException(STR + f.getPath()); } } }
|
/**
* Deletes this file (and does not take no for an answer).
* @param f a file to delete
* @throws IOException if it exists but could not be successfully deleted
*/
|
Deletes this file (and does not take no for an answer)
|
deleteFile
|
{
"repo_name": "stefanbrausch/hudson-main",
"path": "core/src/main/java/hudson/Util.java",
"license": "mit",
"size": 42243
}
|
[
"java.io.File",
"java.io.IOException",
"java.util.Arrays"
] |
import java.io.File; import java.io.IOException; import java.util.Arrays;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 2,593,431
|
public static void createPersistentZKNodes(ZooKeeper zk) {
LinkedList<ZKUtil.StringCallback> callbacks = new LinkedList<ZKUtil.StringCallback>();
for (int i=0; i < VoltZK.ZK_HIERARCHY.length; i++) {
ZKUtil.StringCallback cb = new ZKUtil.StringCallback();
callbacks.add(cb);
zk.create(VoltZK.ZK_HIERARCHY[i], null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, cb, null);
}
try {
for (ZKUtil.StringCallback cb : callbacks) {
cb.get();
}
} catch (org.apache.zookeeper_voltpatches.KeeperException.NodeExistsException e) {
// this is an expected race.
} catch (Exception e) {
VoltDB.crashLocalVoltDB(e.getMessage(), true, e);
}
}
|
static void function(ZooKeeper zk) { LinkedList<ZKUtil.StringCallback> callbacks = new LinkedList<ZKUtil.StringCallback>(); for (int i=0; i < VoltZK.ZK_HIERARCHY.length; i++) { ZKUtil.StringCallback cb = new ZKUtil.StringCallback(); callbacks.add(cb); zk.create(VoltZK.ZK_HIERARCHY[i], null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, cb, null); } try { for (ZKUtil.StringCallback cb : callbacks) { cb.get(); } } catch (org.apache.zookeeper_voltpatches.KeeperException.NodeExistsException e) { } catch (Exception e) { VoltDB.crashLocalVoltDB(e.getMessage(), true, e); } }
|
/**
* Race to create the persistent nodes.
*/
|
Race to create the persistent nodes
|
createPersistentZKNodes
|
{
"repo_name": "paulmartel/voltdb",
"path": "src/frontend/org/voltdb/VoltZK.java",
"license": "agpl-3.0",
"size": 12001
}
|
[
"java.util.LinkedList",
"org.apache.zookeeper_voltpatches.CreateMode",
"org.apache.zookeeper_voltpatches.KeeperException",
"org.apache.zookeeper_voltpatches.ZooDefs",
"org.apache.zookeeper_voltpatches.ZooKeeper",
"org.voltcore.zk.ZKUtil"
] |
import java.util.LinkedList; import org.apache.zookeeper_voltpatches.CreateMode; import org.apache.zookeeper_voltpatches.KeeperException; import org.apache.zookeeper_voltpatches.ZooDefs; import org.apache.zookeeper_voltpatches.ZooKeeper; import org.voltcore.zk.ZKUtil;
|
import java.util.*; import org.apache.zookeeper_voltpatches.*; import org.voltcore.zk.*;
|
[
"java.util",
"org.apache.zookeeper_voltpatches",
"org.voltcore.zk"
] |
java.util; org.apache.zookeeper_voltpatches; org.voltcore.zk;
| 465,954
|
public static void updateProgressDialog(String title, String text,
int progress) {
if (G.base_handler != null) {
Message msg = Message.obtain();
msg.what = Constants.BASE_UPDATE_PROGESS_DIALOG;
Bundle bundle = new Bundle();
bundle.putString(Constants.ALERT_TITLE, title);
bundle.putString(Constants.ALERT_MESSAGE, text);
bundle.putInt(Constants.DIALOG_PROGRESS, progress);
msg.setData(bundle);
msg.setTarget(G.base_handler);
msg.sendToTarget();
}
}
|
static void function(String title, String text, int progress) { if (G.base_handler != null) { Message msg = Message.obtain(); msg.what = Constants.BASE_UPDATE_PROGESS_DIALOG; Bundle bundle = new Bundle(); bundle.putString(Constants.ALERT_TITLE, title); bundle.putString(Constants.ALERT_MESSAGE, text); bundle.putInt(Constants.DIALOG_PROGRESS, progress); msg.setData(bundle); msg.setTarget(G.base_handler); msg.sendToTarget(); } }
|
/**
* Updates the progress for a progress dialog.
* @param title
* @param text
* @param progress
*/
|
Updates the progress for a progress dialog
|
updateProgressDialog
|
{
"repo_name": "lbouma/Cyclopath",
"path": "android/src/org/cyclopath/android/G.java",
"license": "apache-2.0",
"size": 35238
}
|
[
"android.os.Bundle",
"android.os.Message",
"org.cyclopath.android.conf.Constants"
] |
import android.os.Bundle; import android.os.Message; import org.cyclopath.android.conf.Constants;
|
import android.os.*; import org.cyclopath.android.conf.*;
|
[
"android.os",
"org.cyclopath.android"
] |
android.os; org.cyclopath.android;
| 1,330,879
|
private static <T> T loadSpecificExtension(Class<? extends T> cl, Object... args) throws InstantiationException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException, Xception
{
// search constructor
Constructor<?> constructor = null;
Constructor<?>[] cons = cl.getConstructors();
for (Constructor<?> con : cons)
{
Class<?>[] parms = con.getParameterTypes();
if (parms.length == args.length)
{
boolean ok = true;
for (int i = 0; i < parms.length; i++)
{
ok &= ((args[i] == null) || (parms[i].isAssignableFrom(args[i].getClass())));
}
if (ok)
{
constructor = con;
}
}
}
// create instance
@SuppressWarnings("unchecked")
T t = (T) constructor.newInstance();
XMessages.addAssociatedBundle(t);
return t;
}
|
static <T> T function(Class<? extends T> cl, Object... args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, Xception { Constructor<?> constructor = null; Constructor<?>[] cons = cl.getConstructors(); for (Constructor<?> con : cons) { Class<?>[] parms = con.getParameterTypes(); if (parms.length == args.length) { boolean ok = true; for (int i = 0; i < parms.length; i++) { ok &= ((args[i] == null) (parms[i].isAssignableFrom(args[i].getClass()))); } if (ok) { constructor = con; } } } @SuppressWarnings(STR) T t = (T) constructor.newInstance(); XMessages.addAssociatedBundle(t); return t; }
|
/**
* Load specific extension.
*
* @param <T> the generic type
* @param cl the cl
* @param args the args
* @return the extension instance
* @throws InstantiationException the instantiation exception
* @throws IllegalAccessException the illegal access exception
* @throws IllegalArgumentException the illegal argument exception
* @throws InvocationTargetException the invocation target exception
* @throws Xception the xception
*/
|
Load specific extension
|
loadSpecificExtension
|
{
"repo_name": "jrebillat/Xtend",
"path": "Xtend/src/net/alantea/xtend/XManager.java",
"license": "lgpl-3.0",
"size": 14040
}
|
[
"java.lang.reflect.Constructor",
"java.lang.reflect.InvocationTargetException",
"net.alantea.xmessages.XMessages"
] |
import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import net.alantea.xmessages.XMessages;
|
import java.lang.reflect.*; import net.alantea.xmessages.*;
|
[
"java.lang",
"net.alantea.xmessages"
] |
java.lang; net.alantea.xmessages;
| 804,959
|
String filename = UNITTEST + "normalization-test-1.csv";
AttributeWiseVarianceNormalization<DoubleVector> filter = new ELKIBuilder<AttributeWiseVarianceNormalization<DoubleVector>>(AttributeWiseVarianceNormalization.class).build();
MultipleObjectsBundle bundle = readBundle(filename, filter);
int dim = getFieldDimensionality(bundle, 0, TypeUtil.NUMBER_VECTOR_FIELD);
// We verify that the resulting data has mean 0 and variance 1 in each
// column:
MeanVariance[] mvs = MeanVariance.newArray(dim);
for(int row = 0; row < bundle.dataLength(); row++) {
DoubleVector d = get(bundle, row, 0, DoubleVector.class);
for(int col = 0; col < dim; col++) {
final double v = d.doubleValue(col);
if(v > Double.NEGATIVE_INFINITY && v < Double.POSITIVE_INFINITY) {
mvs[col].put(v);
}
}
}
for(int col = 0; col < dim; col++) {
assertEquals("Mean not as expected", 0., mvs[col].getMean(), 1e-14);
assertEquals("Variance not as expected", 1., mvs[col].getPopulationVariance(), 1e-14);
}
}
|
String filename = UNITTEST + STR; AttributeWiseVarianceNormalization<DoubleVector> filter = new ELKIBuilder<AttributeWiseVarianceNormalization<DoubleVector>>(AttributeWiseVarianceNormalization.class).build(); MultipleObjectsBundle bundle = readBundle(filename, filter); int dim = getFieldDimensionality(bundle, 0, TypeUtil.NUMBER_VECTOR_FIELD); MeanVariance[] mvs = MeanVariance.newArray(dim); for(int row = 0; row < bundle.dataLength(); row++) { DoubleVector d = get(bundle, row, 0, DoubleVector.class); for(int col = 0; col < dim; col++) { final double v = d.doubleValue(col); if(v > Double.NEGATIVE_INFINITY && v < Double.POSITIVE_INFINITY) { mvs[col].put(v); } } } for(int col = 0; col < dim; col++) { assertEquals(STR, 0., mvs[col].getMean(), 1e-14); assertEquals(STR, 1., mvs[col].getPopulationVariance(), 1e-14); } }
|
/**
* Test with default parameters.
*/
|
Test with default parameters
|
defaultParameters
|
{
"repo_name": "elki-project/elki",
"path": "elki-input/src/test/java/elki/datasource/filter/normalization/columnwise/AttributeWiseVarianceNormalizationTest.java",
"license": "agpl-3.0",
"size": 4035
}
|
[
"org.junit.Assert"
] |
import org.junit.Assert;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 793,937
|
@Test
public void testInsertOverwriteWithDynamicPartition() throws Exception {
FileSystem fs = FileSystem.get(hiveConf);
FileStatus[] status;
// 1. Insert two rows to a partitioned MM table.
int[][] valuesOdd = {{5,6},{7,8}};
int[][] valuesEven = {{2,1},{4,3}};
runStatementOnDriver("insert into " + TableExtended.MMTBLPART + " PARTITION(p='odd') " + makeValuesClause(valuesOdd));
runStatementOnDriver("insert into " + TableExtended.MMTBLPART + " PARTITION(p='even') " + makeValuesClause(valuesEven));
// Verify dirs
String[] pStrings = {"/p=odd", "/p=even"};
for(int i=0; i < pStrings.length; i++) {
status = fs.listStatus(new Path(getWarehouseDir() + "/" +
(TableExtended.MMTBLPART).toString().toLowerCase() + pStrings[i]), FileUtils.STAGING_DIR_PATH_FILTER);
// There should be 1 delta dir per partition location
Assert.assertEquals(1, status.length);
Assert.assertTrue(status[0].getPath().getName().matches("delta_.*"));
}
// 2. INSERT OVERWRITE
// Prepare data for the source table
int[][] newValsOdd = {{5,5},{11,11}};
int[][] newValsEven = {{2,2}};
runStatementOnDriver("insert into " + TableExtended.NONACIDPART + " PARTITION(p='odd') " + makeValuesClause(newValsOdd));
runStatementOnDriver("insert into " + TableExtended.NONACIDPART + " PARTITION(p='even') " + makeValuesClause(newValsEven));
runStatementOnDriver("insert overwrite table " + TableExtended.MMTBLPART + " partition(p) select a,b,p from " + TableExtended.NONACIDPART);
// Verify resulting dirs.
boolean sawBase = false;
String[] baseDirs = {"", ""};
int deltaCount = 0;
for(int h=0; h < pStrings.length; h++) {
status = fs.listStatus(new Path(getWarehouseDir() + "/" +
(TableExtended.MMTBLPART).toString().toLowerCase() + pStrings[h]), FileUtils.STAGING_DIR_PATH_FILTER);
// There should be 1 delta dir, plus a base dir in the location
Assert.assertEquals(2, status.length); // steve
for (int i = 0; i < status.length; i++) {
String dirName = status[i].getPath().getName();
if (dirName.matches("delta_.*")) {
deltaCount++;
} else {
sawBase = true;
baseDirs[h] = dirName;
Assert.assertTrue(baseDirs[h].matches("base_.*"));
}
}
Assert.assertEquals(1, deltaCount);
Assert.assertTrue(sawBase);
deltaCount = 0;
sawBase = false;
}
// Verify query result
List<String> rs = null;
rs = runStatementOnDriver("select a,b from " + TableExtended.MMTBLPART + " where p='even' order by a,b");
int [][] rExpectedEven = new int[][] {{2,2}};
Assert.assertEquals(stringifyValues(rExpectedEven), rs);
rs = runStatementOnDriver("select a,b from " + TableExtended.MMTBLPART + " where p='odd' order by a,b");
int [][] rExpectedOdd = new int[][] {{5,5},{11,11}};
Assert.assertEquals(stringifyValues(rExpectedOdd), rs);
// Verify query result
rs = runStatementOnDriver("select a,b from " + TableExtended.MMTBLPART + " order by a,b");
int[][] rExpected = new int[][] {{2,2},{5,5},{11,11}};
Assert.assertEquals(stringifyValues(rExpected), rs);
}
|
void function() throws Exception { FileSystem fs = FileSystem.get(hiveConf); FileStatus[] status; int[][] valuesOdd = {{5,6},{7,8}}; int[][] valuesEven = {{2,1},{4,3}}; runStatementOnDriver(STR + TableExtended.MMTBLPART + STR + makeValuesClause(valuesOdd)); runStatementOnDriver(STR + TableExtended.MMTBLPART + STR + makeValuesClause(valuesEven)); String[] pStrings = {STR, STR}; for(int i=0; i < pStrings.length; i++) { status = fs.listStatus(new Path(getWarehouseDir() + "/" + (TableExtended.MMTBLPART).toString().toLowerCase() + pStrings[i]), FileUtils.STAGING_DIR_PATH_FILTER); Assert.assertEquals(1, status.length); Assert.assertTrue(status[0].getPath().getName().matches(STR)); } int[][] newValsOdd = {{5,5},{11,11}}; int[][] newValsEven = {{2,2}}; runStatementOnDriver(STR + TableExtended.NONACIDPART + STR + makeValuesClause(newValsOdd)); runStatementOnDriver(STR + TableExtended.NONACIDPART + STR + makeValuesClause(newValsEven)); runStatementOnDriver(STR + TableExtended.MMTBLPART + STR + TableExtended.NONACIDPART); boolean sawBase = false; String[] baseDirs = {STRSTR/" + (TableExtended.MMTBLPART).toString().toLowerCase() + pStrings[h]), FileUtils.STAGING_DIR_PATH_FILTER); Assert.assertEquals(2, status.length); for (int i = 0; i < status.length; i++) { String dirName = status[i].getPath().getName(); if (dirName.matches(STR)) { deltaCount++; } else { sawBase = true; baseDirs[h] = dirName; Assert.assertTrue(baseDirs[h].matches("base_.*STRselect a,b from STR where p='even' order by a,bSTRselect a,b from STR where p='odd' order by a,bSTRselect a,b from STR order by a,b"); int[][] rExpected = new int[][] {{2,2},{5,5},{11,11}}; Assert.assertEquals(stringifyValues(rExpected), rs); }
|
/**
* Test a scenario, on a dynamically partitioned micro-managed table, that an IOW comes in
* before a MAJOR compaction happens.
*
* @throws Exception
*/
|
Test a scenario, on a dynamically partitioned micro-managed table, that an IOW comes in before a MAJOR compaction happens
|
testInsertOverwriteWithDynamicPartition
|
{
"repo_name": "sankarh/hive",
"path": "ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommandsForMmTable.java",
"license": "apache-2.0",
"size": 28753
}
|
[
"org.apache.hadoop.fs.FileStatus",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hive.common.FileUtils",
"org.junit.Assert"
] |
import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.common.FileUtils; import org.junit.Assert;
|
import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.common.*; import org.junit.*;
|
[
"org.apache.hadoop",
"org.junit"
] |
org.apache.hadoop; org.junit;
| 1,753,660
|
@Override
@Deprecated
public List<BufferBacked> getFieldInnerVectors() {
throw new UnsupportedOperationException("There are no inner vectors. Use getFieldBuffers");
}
|
List<BufferBacked> function() { throw new UnsupportedOperationException(STR); }
|
/**
* Get the inner vectors.
*
* @deprecated This API will be removed as the current implementations no longer support inner vectors.
*
* @return the inner vectors for this field as defined by the TypeLayout
*/
|
Get the inner vectors
|
getFieldInnerVectors
|
{
"repo_name": "apache/arrow",
"path": "java/vector/src/main/java/org/apache/arrow/vector/BaseLargeVariableWidthVector.java",
"license": "apache-2.0",
"size": 48671
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 235,877
|
AuraContext establish(Mode mode, MasterDefRegistry masterRegistry, Map<DefType, String> defaultPrefixes,
Format format, Authentication access, JsonSerializationContext jsonContext,
Map<ValueProviderType, GlobalValueProvider> globalProviders,
DefDescriptor<? extends BaseComponentDef> appDesc,
boolean isDebugToolEnabled);
|
AuraContext establish(Mode mode, MasterDefRegistry masterRegistry, Map<DefType, String> defaultPrefixes, Format format, Authentication access, JsonSerializationContext jsonContext, Map<ValueProviderType, GlobalValueProvider> globalProviders, DefDescriptor<? extends BaseComponentDef> appDesc, boolean isDebugToolEnabled);
|
/**
* Establish a new context.
*
* @param mode the mode for the context.
* @param masterRegistry the master def registry.
* @param defaultPrefixes
* @param format the format expected as a result.
* @param access the access mode for the context.
* @param jsonContext a serialization context for serializing data.
* @param globalProviders global value providers.
* @param appDesc the controlling application descriptor.
* @param isDebugToolEnabled a broken parameter that should not be here.
*/
|
Establish a new context
|
establish
|
{
"repo_name": "lhong375/aura",
"path": "aura/src/main/java/org/auraframework/adapter/ContextAdapter.java",
"license": "apache-2.0",
"size": 3773
}
|
[
"java.util.Map",
"org.auraframework.def.BaseComponentDef",
"org.auraframework.def.DefDescriptor",
"org.auraframework.instance.GlobalValueProvider",
"org.auraframework.instance.ValueProviderType",
"org.auraframework.system.AuraContext",
"org.auraframework.system.MasterDefRegistry",
"org.auraframework.util.json.JsonSerializationContext"
] |
import java.util.Map; import org.auraframework.def.BaseComponentDef; import org.auraframework.def.DefDescriptor; import org.auraframework.instance.GlobalValueProvider; import org.auraframework.instance.ValueProviderType; import org.auraframework.system.AuraContext; import org.auraframework.system.MasterDefRegistry; import org.auraframework.util.json.JsonSerializationContext;
|
import java.util.*; import org.auraframework.def.*; import org.auraframework.instance.*; import org.auraframework.system.*; import org.auraframework.util.json.*;
|
[
"java.util",
"org.auraframework.def",
"org.auraframework.instance",
"org.auraframework.system",
"org.auraframework.util"
] |
java.util; org.auraframework.def; org.auraframework.instance; org.auraframework.system; org.auraframework.util;
| 909,388
|
@Test
public void testMultiFilesOneMapper() throws IOException, SQLException {
multiFileTest(2, 10, 1);
}
|
void function() throws IOException, SQLException { multiFileTest(2, 10, 1); }
|
/** Make sure we can use CombineFileInputFormat to handle multiple
* files in a single mapper.
*/
|
Make sure we can use CombineFileInputFormat to handle multiple files in a single mapper
|
testMultiFilesOneMapper
|
{
"repo_name": "apache/sqoop",
"path": "src/test/org/apache/sqoop/TestExport.java",
"license": "apache-2.0",
"size": 34314
}
|
[
"java.io.IOException",
"java.sql.SQLException"
] |
import java.io.IOException; import java.sql.SQLException;
|
import java.io.*; import java.sql.*;
|
[
"java.io",
"java.sql"
] |
java.io; java.sql;
| 2,753,629
|
String out = String.format("%s %s %s", DATE_FORMAT.format(new Date()), tag, msg);
mHandler.post(() -> {
synchronized (this) {
PrintWriter writer = getWriter();
if (writer != null) {
writer.println(out);
}
}
});
}
|
String out = String.format(STR, DATE_FORMAT.format(new Date()), tag, msg); mHandler.post(() -> { synchronized (this) { PrintWriter writer = getWriter(); if (writer != null) { writer.println(out); } } }); }
|
/**
* Prints log values to disk
*/
|
Prints log values to disk
|
log
|
{
"repo_name": "Deletescape-Media/Lawnchair",
"path": "quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java",
"license": "gpl-3.0",
"size": 4070
}
|
[
"java.io.PrintWriter",
"java.util.Date"
] |
import java.io.PrintWriter; import java.util.Date;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 2,629,096
|
protected void verify(Checker checker,
File[] processedFiles,
String messageFileName,
String... expected)
throws Exception {
stream.flush();
final List<File> theFiles = Lists.newArrayList();
Collections.addAll(theFiles, processedFiles);
final int errs = checker.process(theFiles);
// process each of the lines
final ByteArrayInputStream inputStream =
new ByteArrayInputStream(stream.toByteArray());
try (final LineNumberReader lnr = new LineNumberReader(
new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
for (int i = 0; i < expected.length; i++) {
final String expectedResult = messageFileName + ":" + expected[i];
final String actual = lnr.readLine();
assertEquals("error message " + i, expectedResult, actual);
}
assertEquals("unexpected output: " + lnr.readLine(),
expected.length, errs);
}
checker.destroy();
}
|
void function(Checker checker, File[] processedFiles, String messageFileName, String... expected) throws Exception { stream.flush(); final List<File> theFiles = Lists.newArrayList(); Collections.addAll(theFiles, processedFiles); final int errs = checker.process(theFiles); final ByteArrayInputStream inputStream = new ByteArrayInputStream(stream.toByteArray()); try (final LineNumberReader lnr = new LineNumberReader( new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { for (int i = 0; i < expected.length; i++) { final String expectedResult = messageFileName + ":" + expected[i]; final String actual = lnr.readLine(); assertEquals(STR + i, expectedResult, actual); } assertEquals(STR + lnr.readLine(), expected.length, errs); } checker.destroy(); }
|
/**
* We keep two verify methods with separate logic only for convenience of debuging
* We have minimum amount of multi-file test cases
*/
|
We keep two verify methods with separate logic only for convenience of debuging We have minimum amount of multi-file test cases
|
verify
|
{
"repo_name": "jasonchaffee/checkstyle",
"path": "src/test/java/com/puppycrawl/tools/checkstyle/BaseCheckTestSupport.java",
"license": "lgpl-2.1",
"size": 12138
}
|
[
"com.google.common.collect.Lists",
"java.io.ByteArrayInputStream",
"java.io.File",
"java.io.InputStreamReader",
"java.io.LineNumberReader",
"java.nio.charset.StandardCharsets",
"java.util.Collections",
"java.util.List",
"org.junit.Assert"
] |
import com.google.common.collect.Lists; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.List; import org.junit.Assert;
|
import com.google.common.collect.*; import java.io.*; import java.nio.charset.*; import java.util.*; import org.junit.*;
|
[
"com.google.common",
"java.io",
"java.nio",
"java.util",
"org.junit"
] |
com.google.common; java.io; java.nio; java.util; org.junit;
| 195,305
|
static Parameters parse(String[] args) {
BalancingPolicy policy = Parameters.DEFALUT.policy;
double threshold = Parameters.DEFALUT.threshold;
if (args != null) {
try {
for (int i = 0; i < args.length; i++) {
if ("-threshold".equalsIgnoreCase(args[i])) {
i++;
try {
threshold = Double.parseDouble(args[i]);
if (threshold < 1 || threshold > 100) {
throw new IllegalArgumentException(
"Number out of range: threshold = " + threshold);
}
LOG.info("Using a threshold of " + threshold);
} catch (IllegalArgumentException e) {
System.err.println(
"Expecting a number in the range of [1.0, 100.0]: " +
args[i]);
throw e;
}
} else if ("-policy".equalsIgnoreCase(args[i])) {
i++;
try {
policy = BalancingPolicy.parse(args[i]);
} catch (IllegalArgumentException e) {
System.err.println("Illegal policy name: " + args[i]);
throw e;
}
} else {
throw new IllegalArgumentException(
"args = " + Arrays.toString(args));
}
}
} catch (RuntimeException e) {
printUsage(System.err);
throw e;
}
}
return new Parameters(policy, threshold);
}
|
static Parameters parse(String[] args) { BalancingPolicy policy = Parameters.DEFALUT.policy; double threshold = Parameters.DEFALUT.threshold; if (args != null) { try { for (int i = 0; i < args.length; i++) { if (STR.equalsIgnoreCase(args[i])) { i++; try { threshold = Double.parseDouble(args[i]); if (threshold < 1 threshold > 100) { throw new IllegalArgumentException( STR + threshold); } LOG.info(STR + threshold); } catch (IllegalArgumentException e) { System.err.println( STR + args[i]); throw e; } } else if (STR.equalsIgnoreCase(args[i])) { i++; try { policy = BalancingPolicy.parse(args[i]); } catch (IllegalArgumentException e) { System.err.println(STR + args[i]); throw e; } } else { throw new IllegalArgumentException( STR + Arrays.toString(args)); } } } catch (RuntimeException e) { printUsage(System.err); throw e; } } return new Parameters(policy, threshold); }
|
/**
* parse command line arguments
*/
|
parse command line arguments
|
parse
|
{
"repo_name": "robzor92/hops",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java",
"license": "apache-2.0",
"size": 57272
}
|
[
"java.util.Arrays"
] |
import java.util.Arrays;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,257,635
|
@Override
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
activeEditorPart = part;
// Switch to the new selection provider.
//
if (selectionProvider != null) {
selectionProvider.removeSelectionChangedListener(this);
}
if (part == null) {
selectionProvider = null;
}
else {
selectionProvider = part.getSite().getSelectionProvider();
selectionProvider.addSelectionChangedListener(this);
// Fake a selection changed event to update the menus.
//
if (selectionProvider.getSelection() != null) {
selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
}
}
}
|
void function(IEditorPart part) { super.setActiveEditor(part); activeEditorPart = part; if (selectionProvider != null) { selectionProvider.removeSelectionChangedListener(this); } if (part == null) { selectionProvider = null; } else { selectionProvider = part.getSite().getSelectionProvider(); selectionProvider.addSelectionChangedListener(this); if (selectionProvider.getSelection() != null) { selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); } } }
|
/**
* When the active editor changes, this remembers the change and registers with it as a selection provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
|
When the active editor changes, this remembers the change and registers with it as a selection provider.
|
setActiveEditor
|
{
"repo_name": "KAMP-Research/KAMP4APS",
"path": "edu.kit.ipd.sdq.kamp4aps.aps.editor/src/edu/kit/ipd/sdq/kamp4aps/model/aPS/BusComponents/presentation/BusComponentsActionBarContributor.java",
"license": "apache-2.0",
"size": 14527
}
|
[
"org.eclipse.jface.viewers.SelectionChangedEvent",
"org.eclipse.ui.IEditorPart"
] |
import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.ui.IEditorPart;
|
import org.eclipse.jface.viewers.*; import org.eclipse.ui.*;
|
[
"org.eclipse.jface",
"org.eclipse.ui"
] |
org.eclipse.jface; org.eclipse.ui;
| 1,146,189
|
public static WritableRaster createWritableRaster(SampleModel sm, Point location) {
if (sm == null) {
// awt.280=SampleModel is null
throw new NullPointerException(Messages.getString("awt.280")); //$NON-NLS-1$
}
if (location == null) {
location = new Point(0, 0);
}
return createWritableRaster(sm, sm.createDataBuffer(), location);
}
protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin) {
this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(),
sampleModel.getHeight()), origin, null);
}
protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion,
Point sampleModelTranslate, Raster parent) {
if (sampleModel == null || dataBuffer == null || aRegion == null
|| sampleModelTranslate == null) {
// awt.281=sampleModel, dataBuffer, aRegion or sampleModelTranslate
// is null
throw new NullPointerException(Messages.getString("awt.281")); //$NON-NLS-1$
}
if (aRegion.width <= 0 || aRegion.height <= 0) {
// awt.282=aRegion has width or height less than or equal to zero
throw new RasterFormatException(Messages.getString("awt.282")); //$NON-NLS-1$
}
if ((long)aRegion.x + (long)aRegion.width > Integer.MAX_VALUE) {
// awt.283=Overflow X coordinate of Raster
throw new RasterFormatException(Messages.getString("awt.283")); //$NON-NLS-1$
}
if ((long)aRegion.y + (long)aRegion.height > Integer.MAX_VALUE) {
// awt.284=Overflow Y coordinate of Raster
throw new RasterFormatException(Messages.getString("awt.284")); //$NON-NLS-1$
}
if (sampleModel instanceof ComponentSampleModel) {
validateDataBuffer(dataBuffer, aRegion.width, aRegion.height,
((ComponentSampleModel)sampleModel).getScanlineStride());
} else if (sampleModel instanceof MultiPixelPackedSampleModel) {
validateDataBuffer(dataBuffer, aRegion.width, aRegion.height,
((MultiPixelPackedSampleModel)sampleModel).getScanlineStride());
} else if (sampleModel instanceof SinglePixelPackedSampleModel) {
validateDataBuffer(dataBuffer, aRegion.width, aRegion.height,
((SinglePixelPackedSampleModel)sampleModel).getScanlineStride());
}
this.sampleModel = sampleModel;
this.dataBuffer = dataBuffer;
this.minX = aRegion.x;
this.minY = aRegion.y;
this.width = aRegion.width;
this.height = aRegion.height;
this.sampleModelTranslateX = sampleModelTranslate.x;
this.sampleModelTranslateY = sampleModelTranslate.y;
this.parent = parent;
this.numBands = sampleModel.getNumBands();
this.numDataElements = sampleModel.getNumDataElements();
}
protected Raster(SampleModel sampleModel, Point origin) {
this(sampleModel, sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y,
sampleModel.getWidth(), sampleModel.getHeight()), origin, null);
}
|
static WritableRaster function(SampleModel sm, Point location) { if (sm == null) { throw new NullPointerException(Messages.getString(STR)); } if (location == null) { location = new Point(0, 0); } return createWritableRaster(sm, sm.createDataBuffer(), location); } protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin) { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin, null); } protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, Raster parent) { if (sampleModel == null dataBuffer == null aRegion == null sampleModelTranslate == null) { throw new NullPointerException(Messages.getString(STR)); } if (aRegion.width <= 0 aRegion.height <= 0) { throw new RasterFormatException(Messages.getString(STR)); } if ((long)aRegion.x + (long)aRegion.width > Integer.MAX_VALUE) { throw new RasterFormatException(Messages.getString(STR)); } if ((long)aRegion.y + (long)aRegion.height > Integer.MAX_VALUE) { throw new RasterFormatException(Messages.getString(STR)); } if (sampleModel instanceof ComponentSampleModel) { validateDataBuffer(dataBuffer, aRegion.width, aRegion.height, ((ComponentSampleModel)sampleModel).getScanlineStride()); } else if (sampleModel instanceof MultiPixelPackedSampleModel) { validateDataBuffer(dataBuffer, aRegion.width, aRegion.height, ((MultiPixelPackedSampleModel)sampleModel).getScanlineStride()); } else if (sampleModel instanceof SinglePixelPackedSampleModel) { validateDataBuffer(dataBuffer, aRegion.width, aRegion.height, ((SinglePixelPackedSampleModel)sampleModel).getScanlineStride()); } this.sampleModel = sampleModel; this.dataBuffer = dataBuffer; this.minX = aRegion.x; this.minY = aRegion.y; this.width = aRegion.width; this.height = aRegion.height; this.sampleModelTranslateX = sampleModelTranslate.x; this.sampleModelTranslateY = sampleModelTranslate.y; this.parent = parent; this.numBands = sampleModel.getNumBands(); this.numDataElements = sampleModel.getNumDataElements(); } protected Raster(SampleModel sampleModel, Point origin) { this(sampleModel, sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin, null); }
|
/**
* Creates a WritableRaster with the specified SampleModel.
*
* @param sm
* the specified SampleModel.
* @param location
* the location which defines the upper left corner of the
* Raster.
* @return the WritableRaster.
*/
|
Creates a WritableRaster with the specified SampleModel
|
createWritableRaster
|
{
"repo_name": "dritanlatifi/AndroidPrefuse",
"path": "src/awt/java/awt/image/Raster.java",
"license": "bsd-3-clause",
"size": 54179
}
|
[
"org.apache.harmony.awt.internal.nls.Messages"
] |
import org.apache.harmony.awt.internal.nls.Messages;
|
import org.apache.harmony.awt.internal.nls.*;
|
[
"org.apache.harmony"
] |
org.apache.harmony;
| 2,216,044
|
public static ResultDistributor createDistributor(Formatter.Type outputFormat,
OutputStream output) {
if (outputFormat == null) {
LOG.error("Specified output format is null...");
return null;
}
if (output == null) {
LOG.error("Output stream is null...");
return null;
}
ResultDistributor distributor = new DefaultResultDistributor(output);
LOG.info("Creating Distributor...");
try {
switch (outputFormat) {
case PLAIN:
distributor.setFormatter(new PlainFormatter());
break;
case XML:
distributor.setFormatter(new XMLFormatter());
break;
default :
LOG.error("No specified distributor...");
return null;
}
} catch (DocumentValidatorException e) {
LOG.error(e.getMessage());
return null;
}
return distributor;
}
private ResultDistributorFactory() {
// for safe
}
private static final Logger LOG =
LoggerFactory.getLogger(ResultDistributor.class);
|
static ResultDistributor function(Formatter.Type outputFormat, OutputStream output) { if (outputFormat == null) { LOG.error(STR); return null; } if (output == null) { LOG.error(STR); return null; } ResultDistributor distributor = new DefaultResultDistributor(output); LOG.info(STR); try { switch (outputFormat) { case PLAIN: distributor.setFormatter(new PlainFormatter()); break; case XML: distributor.setFormatter(new XMLFormatter()); break; default : LOG.error(STR); return null; } } catch (DocumentValidatorException e) { LOG.error(e.getMessage()); return null; } return distributor; } private ResultDistributorFactory() { } private static final Logger LOG = LoggerFactory.getLogger(ResultDistributor.class);
|
/**
* Create ResultDistributor object.
*
* @param outputFormat syntax of output
* @param output output stream
* @return ResultDistributor object when succeeded to create, null otherwise
*/
|
Create ResultDistributor object
|
createDistributor
|
{
"repo_name": "jmoriya/redpen",
"path": "redpen-core/src/main/java/org/unigram/docvalidator/distributor/ResultDistributorFactory.java",
"license": "apache-2.0",
"size": 2455
}
|
[
"java.io.OutputStream",
"org.slf4j.Logger",
"org.slf4j.LoggerFactory",
"org.unigram.docvalidator.DocumentValidatorException",
"org.unigram.docvalidator.formatter.Formatter",
"org.unigram.docvalidator.formatter.PlainFormatter",
"org.unigram.docvalidator.formatter.XMLFormatter"
] |
import java.io.OutputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.unigram.docvalidator.DocumentValidatorException; import org.unigram.docvalidator.formatter.Formatter; import org.unigram.docvalidator.formatter.PlainFormatter; import org.unigram.docvalidator.formatter.XMLFormatter;
|
import java.io.*; import org.slf4j.*; import org.unigram.docvalidator.*; import org.unigram.docvalidator.formatter.*;
|
[
"java.io",
"org.slf4j",
"org.unigram.docvalidator"
] |
java.io; org.slf4j; org.unigram.docvalidator;
| 440,447
|
protected void photoSuccess(final File png) {
System.out.println("Saved screenshot in " + png);
}
private HUDRenderpass pauseHUD;
|
void function(final File png) { System.out.println(STR + png); } private HUDRenderpass pauseHUD;
|
/**
* Is called when a photo was created.
*
* @param png The photo file.
*/
|
Is called when a photo was created
|
photoSuccess
|
{
"repo_name": "JosuaKrause/JKanvas",
"path": "src/main/java/jkanvas/DefaultMessageHandler.java",
"license": "mit",
"size": 7272
}
|
[
"java.io.File"
] |
import java.io.File;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,501,426
|
Compass getIndexCompass();
|
Compass getIndexCompass();
|
/**
* Returns the <code>Compass</code> instance used for indexing. Note that
* no operations that will affect the index should be made using it, use
* {@link #executeForIndex(org.compass.core.CompassCallback)} operation instead.
*/
|
Returns the <code>Compass</code> instance used for indexing. Note that no operations that will affect the index should be made using it, use <code>#executeForIndex(org.compass.core.CompassCallback)</code> operation instead
|
getIndexCompass
|
{
"repo_name": "unkascrack/compass-fork",
"path": "compass-gps/src/main/java/org/compass/gps/spi/CompassGpsInterfaceDevice.java",
"license": "apache-2.0",
"size": 3395
}
|
[
"org.compass.core.Compass"
] |
import org.compass.core.Compass;
|
import org.compass.core.*;
|
[
"org.compass.core"
] |
org.compass.core;
| 2,278,822
|
public String getStringProperty(String name,
Hashtable valueSet,
String defaultKey)
{
return this.getStringAttribute(name, valueSet, defaultKey, false);
}
|
String function(String name, Hashtable valueSet, String defaultKey) { return this.getStringAttribute(name, valueSet, defaultKey, false); }
|
/**
* Returns an attribute by looking up a key in a hashtable.
*
* @deprecated Use {@link #getStringAttribute(java.lang.String,
* java.util.Hashtable, java.lang.String, boolean)
* getStringAttribute} instead.
*/
|
Returns an attribute by looking up a key in a hashtable
|
getStringProperty
|
{
"repo_name": "lsilvestre/Jogre",
"path": "api/src/nanoxml/XMLElement.java",
"license": "gpl-2.0",
"size": 99514
}
|
[
"java.util.Hashtable"
] |
import java.util.Hashtable;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,896,475
|
private void cycleThroughDescendentsBreadthReverse(IItem item)
{
List<IItem> reverseList = item.getChildItems();
Collections.reverse(reverseList);
for (IItem descendent : reverseList)
{
action(descendent);
}
for (IItem descendent : reverseList)
{
cycleThroughDescendentsBreadthReverse(descendent);
}
}
|
void function(IItem item) { List<IItem> reverseList = item.getChildItems(); Collections.reverse(reverseList); for (IItem descendent : reverseList) { action(descendent); } for (IItem descendent : reverseList) { cycleThroughDescendentsBreadthReverse(descendent); } }
|
/**
* Cycle through descendents breadth reverse.
*
* @param item
* the item
*/
|
Cycle through descendents breadth reverse
|
cycleThroughDescendentsBreadthReverse
|
{
"repo_name": "synergynet/synergynet3.1",
"path": "synergynet3.1-parent/synergynet3-appsystem-core/src/main/java/synergynet3/additionalitems/PerformActionOnAllDescendents.java",
"license": "bsd-3-clause",
"size": 2781
}
|
[
"java.util.Collections",
"java.util.List"
] |
import java.util.Collections; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,833,152
|
public int doStartTag()
throws JspException
{
ELContext env = pageContext.getELContext();
Object value = _valueExpr.evalObject(env);
long time = 0;
Object result = null;
if (value == null) {
}
else if (value instanceof Number)
time = ((Number) value).longValue();
else if (value instanceof java.util.Date)
time = ((java.util.Date) value).getTime();
else if (value instanceof java.sql.Date)
time = ((java.sql.Date) value).getTime();
else
throw new JspException(L.l("sql:dateParam requires at date at `{0}'", value));
if (value == null)
result = null;
else if (_typeExpr == null)
result = new java.sql.Timestamp(time);
else {
String type = _typeExpr.evalString(env);
if (type.equals("time"))
result = new java.sql.Time(time);
else if (type.equals("date"))
result = new java.sql.Date(time);
else
result = new java.sql.Timestamp(time);
}
Tag parent = getParent();
for (;
parent != null && ! (parent instanceof SQLExecutionTag);
parent = parent.getParent()) {
}
if (parent == null)
throw new JspException(L.l("sql:dateParam requires sql:query parent."));
SQLExecutionTag tag = (SQLExecutionTag) parent;
tag.addSQLParameter(result);
return SKIP_BODY;
}
|
int function() throws JspException { ELContext env = pageContext.getELContext(); Object value = _valueExpr.evalObject(env); long time = 0; Object result = null; if (value == null) { } else if (value instanceof Number) time = ((Number) value).longValue(); else if (value instanceof java.util.Date) time = ((java.util.Date) value).getTime(); else if (value instanceof java.sql.Date) time = ((java.sql.Date) value).getTime(); else throw new JspException(L.l(STR, value)); if (value == null) result = null; else if (_typeExpr == null) result = new java.sql.Timestamp(time); else { String type = _typeExpr.evalString(env); if (type.equals("time")) result = new java.sql.Time(time); else if (type.equals("date")) result = new java.sql.Date(time); else result = new java.sql.Timestamp(time); } Tag parent = getParent(); for (; parent != null && ! (parent instanceof SQLExecutionTag); parent = parent.getParent()) { } if (parent == null) throw new JspException(L.l(STR)); SQLExecutionTag tag = (SQLExecutionTag) parent; tag.addSQLParameter(result); return SKIP_BODY; }
|
/**
* Process the tag.
*/
|
Process the tag
|
doStartTag
|
{
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/jstl/el/SqlDateParamTag.java",
"license": "gpl-2.0",
"size": 3268
}
|
[
"javax.el.ELContext",
"javax.servlet.jsp.JspException",
"javax.servlet.jsp.jstl.sql.SQLExecutionTag",
"javax.servlet.jsp.tagext.Tag"
] |
import javax.el.ELContext; import javax.servlet.jsp.JspException; import javax.servlet.jsp.jstl.sql.SQLExecutionTag; import javax.servlet.jsp.tagext.Tag;
|
import javax.el.*; import javax.servlet.jsp.*; import javax.servlet.jsp.jstl.sql.*; import javax.servlet.jsp.tagext.*;
|
[
"javax.el",
"javax.servlet"
] |
javax.el; javax.servlet;
| 2,731,324
|
public String buildDataPoints() {
StringBuilder data = new StringBuilder();
data.append("t:");
int i = 0;
for (ChartAxisPoints axisPoint : axisPoints) {
List<String> xValues = new ArrayList<>();
List<String> yValues = new ArrayList<>();
for (ChartPoint point : axisPoint.seriesDataPoints) {
xValues.add("" + scaleXValue(Long.valueOf(point.xValue)));
yValues.add("" + scaleYValue(point.yValue));
}
if (i != 0) {
data.append("|");
}
i++;
data.append(StringUtils.join(xValues.iterator(), ",") + "|" + StringUtils.join(yValues.iterator(), ","));
}
return data.toString();
}
|
String function() { StringBuilder data = new StringBuilder(); data.append("t:"); int i = 0; for (ChartAxisPoints axisPoint : axisPoints) { List<String> xValues = new ArrayList<>(); List<String> yValues = new ArrayList<>(); for (ChartPoint point : axisPoint.seriesDataPoints) { xValues.add(STRSTR STR,STR STR,")); } return data.toString(); }
|
/**
* Encodes a list of values into the Google Charts API "extended encoding",
* scaling to the supplied max value.
* http://code.google.com/apis/chart/docs/data_formats.html#extended
*
* Try and dig into their data formats sometime. They're pretty annoying.
*/
|
Encodes a list of values into the Google Charts API "extended encoding", scaling to the supplied max value. HREF Try and dig into their data formats sometime. They're pretty annoying
|
buildDataPoints
|
{
"repo_name": "DebalinaDey/AuraDevelopDeb",
"path": "aura-util/src/test/java/org/auraframework/util/perfomance/PTestGoogleChart.java",
"license": "apache-2.0",
"size": 10720
}
|
[
"java.util.ArrayList",
"java.util.List"
] |
import java.util.ArrayList; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 64,226
|
protected String[] removeDuplicates(String[] array){
HashSet<String> roles = new HashSet<String>();
Iterator<String> i_roles = Arrays.asList(array).iterator();
while(i_roles.hasNext()){
roles.add(i_roles.next());
}
return roles.toArray(new String[]{});
}
|
String[] function(String[] array){ HashSet<String> roles = new HashSet<String>(); Iterator<String> i_roles = Arrays.asList(array).iterator(); while(i_roles.hasNext()){ roles.add(i_roles.next()); } return roles.toArray(new String[]{}); }
|
/**
* Takes a String array and removes any duplicate strings in the array.
* The underlying implementation of this method uses a Hashset, so
* expect the resulting array to be ordered differently than the
* original array.
*
* @param array - an array of String items. Duplicates will be removed.
* @return Returns an array of unique String items.
*/
|
Takes a String array and removes any duplicate strings in the array. The underlying implementation of this method uses a Hashset, so expect the resulting array to be ordered differently than the original array
|
removeDuplicates
|
{
"repo_name": "bbsync/BbSyncClientWS",
"path": "BbSyncClientWS/src/main/java/org/bbsync/webservice/client/proxytool/AbstractProxyTool.java",
"license": "apache-2.0",
"size": 6272
}
|
[
"java.util.Arrays",
"java.util.HashSet",
"java.util.Iterator"
] |
import java.util.Arrays; import java.util.HashSet; import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 609,025
|
public void datasetChanged(DatasetChangeEvent e) {
// TODO: by coding the event with some information about what changed
// in the dataset, we could make the recalculation of the interval
// more efficient in some cases...
if (this.autoWidth) {
this.autoIntervalWidth = recalculateInterval();
}
}
|
void function(DatasetChangeEvent e) { if (this.autoWidth) { this.autoIntervalWidth = recalculateInterval(); } }
|
/**
* Handles events from the dataset by recalculating the interval if
* necessary.
*
* @param e the event.
*/
|
Handles events from the dataset by recalculating the interval if necessary
|
datasetChanged
|
{
"repo_name": "SpoonLabs/astor",
"path": "examples/chart_11/source/org/jfree/data/xy/IntervalXYDelegate.java",
"license": "gpl-2.0",
"size": 16323
}
|
[
"org.jfree.data.general.DatasetChangeEvent"
] |
import org.jfree.data.general.DatasetChangeEvent;
|
import org.jfree.data.general.*;
|
[
"org.jfree.data"
] |
org.jfree.data;
| 989,116
|
@Exported
public String getUrl() {
// first look in update center metadata
List<UpdateSite.Plugin> siteMetadataList = getInfoFromAllSites();
String firstSiteUrl = null;
if (!siteMetadataList.isEmpty()) {
firstSiteUrl = siteMetadataList.get(0).wiki;
if (allUrlsMatch(firstSiteUrl, siteMetadataList)) {
return firstSiteUrl;
}
}
// if update sites give different / empty results,
// use manifest (since maven-hpi-plugin 1.30)
String url = manifest.getMainAttributes().getValue("Url");
if (url != null) {
return url;
}
return firstSiteUrl;
}
|
String function() { List<UpdateSite.Plugin> siteMetadataList = getInfoFromAllSites(); String firstSiteUrl = null; if (!siteMetadataList.isEmpty()) { firstSiteUrl = siteMetadataList.get(0).wiki; if (allUrlsMatch(firstSiteUrl, siteMetadataList)) { return firstSiteUrl; } } String url = manifest.getMainAttributes().getValue("Url"); if (url != null) { return url; } return firstSiteUrl; }
|
/**
* Gets the URL that shows more information about this plugin.
* @return
* null if this information is unavailable.
* @since 1.283
*/
|
Gets the URL that shows more information about this plugin
|
getUrl
|
{
"repo_name": "patbos/jenkins",
"path": "core/src/main/java/hudson/PluginWrapper.java",
"license": "mit",
"size": 46479
}
|
[
"hudson.model.UpdateSite",
"java.util.List"
] |
import hudson.model.UpdateSite; import java.util.List;
|
import hudson.model.*; import java.util.*;
|
[
"hudson.model",
"java.util"
] |
hudson.model; java.util;
| 1,183,651
|
public java.util.Map<String, AttributeValue> getExpressionAttributeValues() {
return expressionAttributeValues;
}
|
java.util.Map<String, AttributeValue> function() { return expressionAttributeValues; }
|
/**
* One or more values that can be substituted in an expression.
*
* @return One or more values that can be substituted in an expression.
*
* @see QueryRequest#getExpressionAttributeValues()
*/
|
One or more values that can be substituted in an expression
|
getExpressionAttributeValues
|
{
"repo_name": "dagnir/aws-sdk-java",
"path": "aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBQueryExpression.java",
"license": "apache-2.0",
"size": 58474
}
|
[
"com.amazonaws.services.dynamodbv2.model.AttributeValue",
"java.util.Map"
] |
import com.amazonaws.services.dynamodbv2.model.AttributeValue; import java.util.Map;
|
import com.amazonaws.services.dynamodbv2.model.*; import java.util.*;
|
[
"com.amazonaws.services",
"java.util"
] |
com.amazonaws.services; java.util;
| 602,065
|
T getCurrentSession()
throws SessionConfigurationException, SessionCommunicationException,
SessionInitializationException;
|
T getCurrentSession() throws SessionConfigurationException, SessionCommunicationException, SessionInitializationException;
|
/**
* Returns the CycSession currently assigned to this thread. If no CycSession object currently
* exists, one will be created from a configuration drawn from {@link #getSessionConfiguration()} and
* assigned to the local thread.
*
* @return a (possibly new) CycSession object for the current thread.
*
* @throws SessionConfigurationException if the application is not sufficiently configured for
* the CycConfigurationManager to connect to a Cyc server.
* @throws SessionCommunicationException if the application encounters problems communicating
* with a Cyc server.
* @throws SessionInitializationException if the application encounters problems initializing the
* CycSession.
*/
|
Returns the CycSession currently assigned to this thread. If no CycSession object currently exists, one will be created from a configuration drawn from <code>#getSessionConfiguration()</code> and assigned to the local thread
|
getCurrentSession
|
{
"repo_name": "cycorp/CycCoreAPI",
"path": "core-api/src/main/java/com/cyc/session/SessionManager.java",
"license": "apache-2.0",
"size": 6981
}
|
[
"com.cyc.session.exception.SessionCommunicationException",
"com.cyc.session.exception.SessionConfigurationException",
"com.cyc.session.exception.SessionInitializationException"
] |
import com.cyc.session.exception.SessionCommunicationException; import com.cyc.session.exception.SessionConfigurationException; import com.cyc.session.exception.SessionInitializationException;
|
import com.cyc.session.exception.*;
|
[
"com.cyc.session"
] |
com.cyc.session;
| 2,326,239
|
private double computeHelixTemplateLength(RNATemplateHelix helix) {
return Math.hypot(helix.getStartPosition().x - helix.getEndPosition().x,
helix.getStartPosition().y - helix.getEndPosition().y);
}
|
double function(RNATemplateHelix helix) { return Math.hypot(helix.getStartPosition().x - helix.getEndPosition().x, helix.getStartPosition().y - helix.getEndPosition().y); }
|
/**
* Get helix length in template.
*/
|
Get helix length in template
|
computeHelixTemplateLength
|
{
"repo_name": "statalign/statalign",
"path": "src/fr/orsay/lri/varna/models/rna/RNA.java",
"license": "gpl-3.0",
"size": 146442
}
|
[
"fr.orsay.lri.varna.models.templates.RNATemplate",
"java.lang.Math"
] |
import fr.orsay.lri.varna.models.templates.RNATemplate; import java.lang.Math;
|
import fr.orsay.lri.varna.models.templates.*; import java.lang.*;
|
[
"fr.orsay.lri",
"java.lang"
] |
fr.orsay.lri; java.lang;
| 2,149,698
|
protected Size2D arrangeFF(BlockContainer container, Graphics2D g2,
RectangleConstraint constraint) {
// TODO: implement this properly
return arrangeFN(container, g2, constraint);
}
|
Size2D function(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { return arrangeFN(container, g2, constraint); }
|
/**
* Arranges the blocks in the container with the overall height and width
* specified as fixed constraints.
*
* @param container the container.
* @param g2 the graphics device.
* @param constraint the constraint.
*
* @return The size following the arrangement.
*/
|
Arranges the blocks in the container with the overall height and width specified as fixed constraints
|
arrangeFF
|
{
"repo_name": "simon04/jfreechart",
"path": "src/main/java/org/jfree/chart/block/CenterArrangement.java",
"license": "lgpl-2.1",
"size": 11818
}
|
[
"java.awt.Graphics2D",
"org.jfree.ui.Size2D"
] |
import java.awt.Graphics2D; import org.jfree.ui.Size2D;
|
import java.awt.*; import org.jfree.ui.*;
|
[
"java.awt",
"org.jfree.ui"
] |
java.awt; org.jfree.ui;
| 1,182,566
|
public Builder maybeSetArtworkData(byte[] artworkData, @PictureType int artworkDataType) {
if (this.artworkData == null
|| Util.areEqual(artworkDataType, PICTURE_TYPE_FRONT_COVER)
|| !Util.areEqual(this.artworkDataType, PICTURE_TYPE_FRONT_COVER)) {
this.artworkData = artworkData.clone();
this.artworkDataType = artworkDataType;
}
return this;
}
|
Builder function(byte[] artworkData, @PictureType int artworkDataType) { if (this.artworkData == null Util.areEqual(artworkDataType, PICTURE_TYPE_FRONT_COVER) !Util.areEqual(this.artworkDataType, PICTURE_TYPE_FRONT_COVER)) { this.artworkData = artworkData.clone(); this.artworkDataType = artworkDataType; } return this; }
|
/**
* Sets the artwork data as a compressed byte array in the event that the associated {@link
* PictureType} is {@link #PICTURE_TYPE_FRONT_COVER}, the existing {@link PictureType} is not
* {@link #PICTURE_TYPE_FRONT_COVER}, or the current artworkData is not set.
*
* <p>Use {@link #setArtworkData(byte[], Integer)} to set the artwork data without checking the
* {@link PictureType}.
*/
|
Sets the artwork data as a compressed byte array in the event that the associated <code>PictureType</code> is <code>#PICTURE_TYPE_FRONT_COVER</code>, the existing <code>PictureType</code> is not <code>#PICTURE_TYPE_FRONT_COVER</code>, or the current artworkData is not set. Use <code>#setArtworkData(byte[], Integer)</code> to set the artwork data without checking the <code>PictureType</code>
|
maybeSetArtworkData
|
{
"repo_name": "ened/ExoPlayer",
"path": "library/common/src/main/java/com/google/android/exoplayer2/MediaMetadata.java",
"license": "apache-2.0",
"size": 34144
}
|
[
"com.google.android.exoplayer2.util.Util"
] |
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.*;
|
[
"com.google.android"
] |
com.google.android;
| 1,089,896
|
public ArrayList<Entity> getList() {
return this.list;
}
|
ArrayList<Entity> function() { return this.list; }
|
/**
* Gets the list of entities in the Collection object.
*
* @return the list of entities
*/
|
Gets the list of entities in the Collection object
|
getList
|
{
"repo_name": "RobertWalsh/apigee-android-sdk",
"path": "source/src/main/java/com/apigee/sdk/data/client/entities/Collection.java",
"license": "apache-2.0",
"size": 8280
}
|
[
"java.util.ArrayList"
] |
import java.util.ArrayList;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,907,309
|
public List<JRStyle> getStylesList()
{
return stylesList;
}
|
List<JRStyle> function() { return stylesList; }
|
/**
* Gets a list of report styles.
*/
|
Gets a list of report styles
|
getStylesList
|
{
"repo_name": "MHTaleb/Encologim",
"path": "lib/JasperReport/src/net/sf/jasperreports/engine/JasperPrint.java",
"license": "gpl-3.0",
"size": 18913
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 446,166
|
@Override
public Collection<?> getContainerPropertyIds() {
return items.getContainerPropertyIds();
}
|
Collection<?> function() { return items.getContainerPropertyIds(); }
|
/**
* Gets the property Id collection from the container.
*
* @return the Collection of property ids.
*/
|
Gets the property Id collection from the container
|
getContainerPropertyIds
|
{
"repo_name": "jdahlstrom/vaadin.react",
"path": "server/src/main/java/com/vaadin/ui/AbstractSelect.java",
"license": "apache-2.0",
"size": 76957
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 295,520
|
@SuppressWarnings({"rawtypes", "unchecked"})
public static TypeDescriptor getCodedType(TypeDescriptor coderDescriptor) {
ParameterizedType coderType =
(ParameterizedType) coderDescriptor.getSupertype(Coder.class).getType();
TypeDescriptor codedType = TypeDescriptor.of(coderType.getActualTypeArguments()[0]);
return codedType;
}
|
@SuppressWarnings({STR, STR}) static TypeDescriptor function(TypeDescriptor coderDescriptor) { ParameterizedType coderType = (ParameterizedType) coderDescriptor.getSupertype(Coder.class).getType(); TypeDescriptor codedType = TypeDescriptor.of(coderType.getActualTypeArguments()[0]); return codedType; }
|
/**
* If {@code coderType} is a subclass of {@code Coder<T>} for a specific type {@code T}, returns
* {@code T.class}.
*/
|
If coderType is a subclass of Coder for a specific type T, returns T.class
|
getCodedType
|
{
"repo_name": "mxm/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/util/CoderUtils.java",
"license": "apache-2.0",
"size": 7060
}
|
[
"java.lang.reflect.ParameterizedType",
"org.apache.beam.sdk.coders.Coder",
"org.apache.beam.sdk.values.TypeDescriptor"
] |
import java.lang.reflect.ParameterizedType; import org.apache.beam.sdk.coders.Coder; import org.apache.beam.sdk.values.TypeDescriptor;
|
import java.lang.reflect.*; import org.apache.beam.sdk.coders.*; import org.apache.beam.sdk.values.*;
|
[
"java.lang",
"org.apache.beam"
] |
java.lang; org.apache.beam;
| 2,585,736
|
public static final long gtsId(long[] key, long classId, long labelsId) {
byte[] buf = new byte[8 + 8 + 2 + 3];
buf[0] = 'G';
buf[1] = 'T';
buf[2] = 'S';
buf[3] = ':';
for (int i = 0; i < 8; i++) {
buf[11-i] = (byte) (classId & 0xffL);
classId >>>= 8;
}
buf[12] = ':';
for (int i = 0; i < 8; i++) {
buf[20-i] = (byte) (labelsId & 0xffL);
labelsId >>>= 8;
}
return SipHashInline.hash24_palindromic(key[0], key[1], buf);
}
|
static final long function(long[] key, long classId, long labelsId) { byte[] buf = new byte[8 + 8 + 2 + 3]; buf[0] = 'G'; buf[1] = 'T'; buf[2] = 'S'; buf[3] = ':'; for (int i = 0; i < 8; i++) { buf[11-i] = (byte) (classId & 0xffL); classId >>>= 8; } buf[12] = ':'; for (int i = 0; i < 8; i++) { buf[20-i] = (byte) (labelsId & 0xffL); labelsId >>>= 8; } return SipHashInline.hash24_palindromic(key[0], key[1], buf); }
|
/**
* Compute a gts Id from given classId/labelsId.
*
* We compute the palindromic SipHash of 'GTS:' + <classId> + ':' + <labelsId>
*
* @param classId
* @param labelsId
* @return
*/
|
Compute a gts Id from given classId/labelsId
|
gtsId
|
{
"repo_name": "StevenLeRoux/warp10-platform",
"path": "warp10/src/main/java/io/warp10/continuum/gts/GTSHelper.java",
"license": "apache-2.0",
"size": 304137
}
|
[
"io.warp10.crypto.SipHashInline"
] |
import io.warp10.crypto.SipHashInline;
|
import io.warp10.crypto.*;
|
[
"io.warp10.crypto"
] |
io.warp10.crypto;
| 1,425,731
|
protected void removeEventListener(NodeImpl node, String type,
EventListener listener,
boolean useCapture)
{
// If this couldn't be a valid listener registration, ignore request
if (type == null || type.equals("") || listener == null)
return;
Vector nodeListeners = getEventListeners(node);
if (nodeListeners == null)
return;
// Note that addListener has previously ensured that
// each listener may be registered only once per type per phase.
// count-down is OK for deletions!
for (int i = nodeListeners.size() - 1; i >= 0; --i) {
LEntry le = (LEntry) nodeListeners.elementAt(i);
if (le.useCapture == useCapture && le.listener == listener &&
le.type.equals(type)) {
nodeListeners.removeElementAt(i);
// Storage management: Discard empty listener lists
if (nodeListeners.size() == 0)
setEventListeners(node, null);
// Remove active listener
LCount lc = LCount.lookup(type);
if (useCapture) {
--lc.captures;
--lc.total;
}
else {
--lc.bubbles;
--lc.total;
}
break; // Found it; no need to loop farther.
}
}
} // removeEventListener(NodeImpl,String,EventListener,boolean) :void
|
void function(NodeImpl node, String type, EventListener listener, boolean useCapture) { if (type == null type.equals("") listener == null) return; Vector nodeListeners = getEventListeners(node); if (nodeListeners == null) return; for (int i = nodeListeners.size() - 1; i >= 0; --i) { LEntry le = (LEntry) nodeListeners.elementAt(i); if (le.useCapture == useCapture && le.listener == listener && le.type.equals(type)) { nodeListeners.removeElementAt(i); if (nodeListeners.size() == 0) setEventListeners(node, null); LCount lc = LCount.lookup(type); if (useCapture) { --lc.captures; --lc.total; } else { --lc.bubbles; --lc.total; } break; } } }
|
/**
* Introduced in DOM Level 2. <p> Deregister an event listener previously
* registered with this Node. A listener must be independently removed
* from the Capturing and Bubbling roles. Redundant removals (of listeners
* not currently registered for this role) are ignored.
* @param node node to remove listener from
* @param type Event name (NOT event group!) to listen for.
* @param listener Who gets called when event is dispatched
* @param useCapture True iff listener is registered on
* capturing phase rather than at-target or bubbling
*/
|
Introduced in DOM Level 2. Deregister an event listener previously registered with this Node. A listener must be independently removed from the Capturing and Bubbling roles. Redundant removals (of listeners not currently registered for this role) are ignored
|
removeEventListener
|
{
"repo_name": "lostdj/Jaklin-OpenJDK-JAXP",
"path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DocumentImpl.java",
"license": "gpl-2.0",
"size": 50945
}
|
[
"java.util.Vector",
"org.w3c.dom.events.EventListener"
] |
import java.util.Vector; import org.w3c.dom.events.EventListener;
|
import java.util.*; import org.w3c.dom.events.*;
|
[
"java.util",
"org.w3c.dom"
] |
java.util; org.w3c.dom;
| 1,501,840
|
@SafeVarargs
public static CompletableFuture<Void> allOf(Collection<? extends CompletionStage<?>>... futureCollections) {
List<CompletableFuture<Void>> fvs = new ArrayList<>();
for (Collection<? extends CompletionStage<?>> futureCollection : futureCollections) {
if (!futureCollection.isEmpty()) {
fvs.add(CompletableFuture.allOf(futureCollection.toArray(new CompletableFuture[0])));
}
}
return CompletableFuture.allOf(fvs.toArray(new CompletableFuture[0]));
}
|
static CompletableFuture<Void> function(Collection<? extends CompletionStage<?>>... futureCollections) { List<CompletableFuture<Void>> fvs = new ArrayList<>(); for (Collection<? extends CompletionStage<?>> futureCollection : futureCollections) { if (!futureCollection.isEmpty()) { fvs.add(CompletableFuture.allOf(futureCollection.toArray(new CompletableFuture[0]))); } } return CompletableFuture.allOf(fvs.toArray(new CompletableFuture[0])); }
|
/**
* Returns a future that completes when all the futures in the provided collections of futures are complete.
* @param futureCollections collections of futures to complete before the returned future is complete
*/
|
Returns a future that completes when all the futures in the provided collections of futures are complete
|
allOf
|
{
"repo_name": "prateekm/samza",
"path": "samza-core/src/main/java/org/apache/samza/util/FutureUtil.java",
"license": "apache-2.0",
"size": 7837
}
|
[
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.CompletionStage"
] |
import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage;
|
import java.util.*; import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 237,862
|
@Override
protected void onPostExecute(BitmapDrawable value) {
//BEGIN_INCLUDE(complete_background_work)
// if cancel was called on this task or the "exit early" flag is set then we're done
if (isCancelled() || mExitTasksEarly) {
value = null;
}
final ImageView imageView = getAttachedImageView();
if (value != null && imageView != null) {
setImageDrawable(imageView, value);
}
//END_INCLUDE(complete_background_work)
}
|
void function(BitmapDrawable value) { if (isCancelled() mExitTasksEarly) { value = null; } final ImageView imageView = getAttachedImageView(); if (value != null && imageView != null) { setImageDrawable(imageView, value); } }
|
/**
* Once the image is processed, associates it to the imageView
*/
|
Once the image is processed, associates it to the imageView
|
onPostExecute
|
{
"repo_name": "fenfir/mtg-familiar",
"path": "mobile/src/main/java/com/gelakinetic/mtgfam/helpers/lruCache/ImageWorker.java",
"license": "mit",
"size": 17752
}
|
[
"android.graphics.drawable.BitmapDrawable",
"android.widget.ImageView"
] |
import android.graphics.drawable.BitmapDrawable; import android.widget.ImageView;
|
import android.graphics.drawable.*; import android.widget.*;
|
[
"android.graphics",
"android.widget"
] |
android.graphics; android.widget;
| 2,182,252
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.