method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void onDeath(DamageSource cause)
{
super.onDeath(cause);
if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer)
{
EntityPlayer var2 = (EntityPlayer)cause.getEntity();
double var3 = var2.posX - this.posX;
double var5 = var2.posZ - this.posZ;
if (var3 * var3 + var5 * var5 >= 2500.0D)
{
var2.triggerAchievement(AchievementList.snipeSkeleton);
}
}
else if (cause.getEntity() instanceof EntityCreeper && ((EntityCreeper)cause.getEntity()).getPowered() && ((EntityCreeper)cause.getEntity()).isAIEnabled())
{
((EntityCreeper)cause.getEntity()).func_175493_co();
this.entityDropItem(new ItemStack(Items.skull, 1, this.getSkeletonType() == 1 ? 1 : 0), 0.0F);
}
} | void function(DamageSource cause) { super.onDeath(cause); if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer) { EntityPlayer var2 = (EntityPlayer)cause.getEntity(); double var3 = var2.posX - this.posX; double var5 = var2.posZ - this.posZ; if (var3 * var3 + var5 * var5 >= 2500.0D) { var2.triggerAchievement(AchievementList.snipeSkeleton); } } else if (cause.getEntity() instanceof EntityCreeper && ((EntityCreeper)cause.getEntity()).getPowered() && ((EntityCreeper)cause.getEntity()).isAIEnabled()) { ((EntityCreeper)cause.getEntity()).func_175493_co(); this.entityDropItem(new ItemStack(Items.skull, 1, this.getSkeletonType() == 1 ? 1 : 0), 0.0F); } } | /**
* Called when the mob's health reaches 0.
*/ | Called when the mob's health reaches 0 | onDeath | {
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/entity/monster/EntitySkeleton.java",
"license": "mit",
"size": 14173
} | [
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.entity.projectile.EntityArrow",
"net.minecraft.init.Items",
"net.minecraft.item.ItemStack",
"net.minecraft.stats.AchievementList",
"net.minecraft.util.DamageSource"
] | import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.stats.AchievementList; import net.minecraft.util.DamageSource; | import net.minecraft.entity.player.*; import net.minecraft.entity.projectile.*; import net.minecraft.init.*; import net.minecraft.item.*; import net.minecraft.stats.*; import net.minecraft.util.*; | [
"net.minecraft.entity",
"net.minecraft.init",
"net.minecraft.item",
"net.minecraft.stats",
"net.minecraft.util"
] | net.minecraft.entity; net.minecraft.init; net.minecraft.item; net.minecraft.stats; net.minecraft.util; | 1,076,807 |
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EmrMasterSecurityGroup addSecurityGroupsToClusterMaster(EmrMasterSecurityGroupAddRequest request) throws Exception
{
return addSecurityGroupsToClusterMasterImpl(request);
} | @Transactional(propagation = Propagation.REQUIRES_NEW) EmrMasterSecurityGroup function(EmrMasterSecurityGroupAddRequest request) throws Exception { return addSecurityGroupsToClusterMasterImpl(request); } | /**
* Adds security groups to the master node of an existing EMR Cluster. Creates its own transaction.
*
* @param request the EMR master security group add request
*
* @return the added EMR master security groups
* @throws Exception if there were any errors adding the security groups to the cluster master.
*/ | Adds security groups to the master node of an existing EMR Cluster. Creates its own transaction | addSecurityGroupsToClusterMaster | {
"repo_name": "seoj/herd",
"path": "herd-code/herd-service/src/main/java/org/finra/herd/service/impl/EmrServiceImpl.java",
"license": "apache-2.0",
"size": 55398
} | [
"org.finra.herd.model.api.xml.EmrMasterSecurityGroup",
"org.finra.herd.model.api.xml.EmrMasterSecurityGroupAddRequest",
"org.springframework.transaction.annotation.Propagation",
"org.springframework.transaction.annotation.Transactional"
] | import org.finra.herd.model.api.xml.EmrMasterSecurityGroup; import org.finra.herd.model.api.xml.EmrMasterSecurityGroupAddRequest; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; | import org.finra.herd.model.api.xml.*; import org.springframework.transaction.annotation.*; | [
"org.finra.herd",
"org.springframework.transaction"
] | org.finra.herd; org.springframework.transaction; | 2,631,803 |
static long parseSnapshotSize(Cell c) throws InvalidProtocolBufferException {
ByteString bs = UnsafeByteOperations.unsafeWrap(
c.getValueArray(), c.getValueOffset(), c.getValueLength());
return QuotaProtos.SpaceQuotaSnapshot.parseFrom(bs).getQuotaUsage();
} | static long parseSnapshotSize(Cell c) throws InvalidProtocolBufferException { ByteString bs = UnsafeByteOperations.unsafeWrap( c.getValueArray(), c.getValueOffset(), c.getValueLength()); return QuotaProtos.SpaceQuotaSnapshot.parseFrom(bs).getQuotaUsage(); } | /**
* Parses the snapshot size from the given Cell's value.
*/ | Parses the snapshot size from the given Cell's value | parseSnapshotSize | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java",
"license": "apache-2.0",
"size": 33532
} | [
"org.apache.hadoop.hbase.Cell",
"org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString",
"org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException",
"org.apache.hadoop.hbase.shaded.com.google.protobuf.UnsafeByteOperations",
"org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos"
] | import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString; import org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException; import org.apache.hadoop.hbase.shaded.com.google.protobuf.UnsafeByteOperations; import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos; | import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.shaded.com.google.protobuf.*; import org.apache.hadoop.hbase.shaded.protobuf.generated.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 711,798 |
public void setDescriptors(DataTypeDescriptor[] descriptors)
{
userParameterTypes = descriptors;
} | void function(DataTypeDescriptor[] descriptors) { userParameterTypes = descriptors; } | /**
* Set the descriptor array
*
* @param descriptors The array of DataTypeServices to fill in when the parameters
* are bound.
*/ | Set the descriptor array | setDescriptors | {
"repo_name": "gemxd/gemfirexd-oss",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/compile/ParameterNode.java",
"license": "apache-2.0",
"size": 19343
} | [
"com.pivotal.gemfirexd.internal.iapi.types.DataTypeDescriptor"
] | import com.pivotal.gemfirexd.internal.iapi.types.DataTypeDescriptor; | import com.pivotal.gemfirexd.internal.iapi.types.*; | [
"com.pivotal.gemfirexd"
] | com.pivotal.gemfirexd; | 614,478 |
public Set<FilteredConnectPoint> filteredEgressPoints() {
return filteredEgressPoints;
} | Set<FilteredConnectPoint> function() { return filteredEgressPoints; } | /**
* Returns the filtered connected points on which the traffic should egress.
*
* @return filtered egress connect points
*/ | Returns the filtered connected points on which the traffic should egress | filteredEgressPoints | {
"repo_name": "sdnwiselab/onos",
"path": "core/api/src/main/java/org/onosproject/net/domain/DomainIntent.java",
"license": "apache-2.0",
"size": 6191
} | [
"java.util.Set",
"org.onosproject.net.FilteredConnectPoint"
] | import java.util.Set; import org.onosproject.net.FilteredConnectPoint; | import java.util.*; import org.onosproject.net.*; | [
"java.util",
"org.onosproject.net"
] | java.util; org.onosproject.net; | 420,266 |
private List<View> addView(View view, List<View> cache) {
if (cache == null) {
cache = new LinkedList<View>();
}
cache.add(view);
return cache;
} | List<View> function(View view, List<View> cache) { if (cache == null) { cache = new LinkedList<View>(); } cache.add(view); return cache; } | /**
* Adds view to specified cache. Creates a cache list if it is null.
*
* @param view the view to be cached
* @param cache the cache list
* @return the cache list
*/ | Adds view to specified cache. Creates a cache list if it is null | addView | {
"repo_name": "JZXiang/TimePickerDialog",
"path": "TimePickerDialog/src/main/java/com/jzxiang/pickerview/wheel/WheelRecycle.java",
"license": "apache-2.0",
"size": 2998
} | [
"android.view.View",
"java.util.LinkedList",
"java.util.List"
] | import android.view.View; import java.util.LinkedList; import java.util.List; | import android.view.*; import java.util.*; | [
"android.view",
"java.util"
] | android.view; java.util; | 1,711,659 |
protected final void setFile(final File file) throws DBException {
this.file = file;
fileIsNew = !file.exists();
try {
if ((!file.exists()) || file.canWrite()) {
try {
raf = new RandomAccessFile(file, "rw");
FileChannel channel = raf.getChannel();
FileLock lock = channel.tryLock();
if (lock == null) {
LOG.warn("Failed to acquire a file lock on " + file.getName() +
". Probably another process is holding the lock. Switching to " +
"read-only mode.");
readOnly = true;
}
//TODO : who will release the lock ? -pb
} catch (NonWritableChannelException e) {
//No way : switch to read-only mode
readOnly = true;
raf = new RandomAccessFile(file, "r");
//TODO : log this !!!
LOG.warn("Failed to open " + file.getName() + " for writing. Switching to read-only mode.", e);
}
} else {
LOG.warn("Cannot write to file " + file.getName() + ". Switching to read-only mode.");
readOnly = true;
raf = new RandomAccessFile(file, "r");
}
} catch (IOException e) {
LOG.warn("An exception occured while opening database file " + file.getAbsolutePath() +
": " + e.getMessage(), e);
}
} | final void function(final File file) throws DBException { this.file = file; fileIsNew = !file.exists(); try { if ((!file.exists()) file.canWrite()) { try { raf = new RandomAccessFile(file, "rw"); FileChannel channel = raf.getChannel(); FileLock lock = channel.tryLock(); if (lock == null) { LOG.warn(STR + file.getName() + STR + STR); readOnly = true; } } catch (NonWritableChannelException e) { readOnly = true; raf = new RandomAccessFile(file, "r"); LOG.warn(STR + file.getName() + STR, e); } } else { LOG.warn(STR + file.getName() + STR); readOnly = true; raf = new RandomAccessFile(file, "r"); } } catch (IOException e) { LOG.warn(STR + file.getAbsolutePath() + STR + e.getMessage(), e); } } | /**
* setFile sets the file object for this Paged.
*
*@param file The File
*/ | setFile sets the file object for this Paged | setFile | {
"repo_name": "orbeon/eXist-1.4.x",
"path": "src/org/exist/storage/btree/Paged.java",
"license": "lgpl-2.1",
"size": 34205
} | [
"java.io.File",
"java.io.IOException",
"java.io.RandomAccessFile",
"java.nio.channels.FileChannel",
"java.nio.channels.FileLock",
"java.nio.channels.NonWritableChannelException"
] | import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import java.nio.channels.NonWritableChannelException; | import java.io.*; import java.nio.channels.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 2,269,261 |
private List<Konsultation> getAllKonsultationen(IProgressMonitor monitor){
Query<Konsultation> qbe = new Query<Konsultation>(Konsultation.class);
qbe.add(Konsultation.FLD_BILL_ID, StringConstants.EMPTY, null);
qbe.add(Konsultation.FLD_BILLABLE, Query.EQUALS, "1");
monitor.beginTask(Messages.Rechnungslauf_analyzingConsultations, IProgressMonitor.UNKNOWN); //$NON-NLS-1$
monitor.subTask(Messages.Rechnungslauf_readingConsultations); //$NON-NLS-1$
return qbe.execute();
}
| List<Konsultation> function(IProgressMonitor monitor){ Query<Konsultation> qbe = new Query<Konsultation>(Konsultation.class); qbe.add(Konsultation.FLD_BILL_ID, StringConstants.EMPTY, null); qbe.add(Konsultation.FLD_BILLABLE, Query.EQUALS, "1"); monitor.beginTask(Messages.Rechnungslauf_analyzingConsultations, IProgressMonitor.UNKNOWN); monitor.subTask(Messages.Rechnungslauf_readingConsultations); return qbe.execute(); } | /**
* get all kons. that are not billed yet
*
* @param monitor
* @return list of all not yet billed konsultationen
*/ | get all kons. that are not billed yet | getAllKonsultationen | {
"repo_name": "elexis/elexis-3-core",
"path": "bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/rechnung/Rechnungslauf.java",
"license": "epl-1.0",
"size": 12634
} | [
"ch.elexis.core.constants.StringConstants",
"ch.elexis.data.Konsultation",
"ch.elexis.data.Query",
"java.util.List",
"org.eclipse.core.runtime.IProgressMonitor"
] | import ch.elexis.core.constants.StringConstants; import ch.elexis.data.Konsultation; import ch.elexis.data.Query; import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; | import ch.elexis.core.constants.*; import ch.elexis.data.*; import java.util.*; import org.eclipse.core.runtime.*; | [
"ch.elexis.core",
"ch.elexis.data",
"java.util",
"org.eclipse.core"
] | ch.elexis.core; ch.elexis.data; java.util; org.eclipse.core; | 2,298,996 |
public Object getObject() {
try {
InputStream is = new ByteArrayInputStream(m_Serialized);
if (m_Compressed) {
is = new GZIPInputStream(is);
}
is = new BufferedInputStream(is);
ObjectInputStream oi = new ObjectInputStream(is);
Object result = oi.readObject();
oi.close();
return result;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
} | Object function() { try { InputStream is = new ByteArrayInputStream(m_Serialized); if (m_Compressed) { is = new GZIPInputStream(is); } is = new BufferedInputStream(is); ObjectInputStream oi = new ObjectInputStream(is); Object result = oi.readObject(); oi.close(); return result; } catch (Exception ex) { ex.printStackTrace(); } return null; } | /**
* Gets the object stored in this SerializedObject. The object returned
* will be a deep copy of the original stored object.
*
* @return the deserialized Object.
*/ | Gets the object stored in this SerializedObject. The object returned will be a deep copy of the original stored object | getObject | {
"repo_name": "adofsauron/KEEL",
"path": "src/keel/Algorithms/Decision_Trees/M5/SerializedObject.java",
"license": "gpl-3.0",
"size": 8799
} | [
"java.io.BufferedInputStream",
"java.io.ByteArrayInputStream",
"java.io.InputStream",
"java.io.ObjectInputStream",
"java.util.zip.GZIPInputStream"
] | import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.ObjectInputStream; import java.util.zip.GZIPInputStream; | import java.io.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,693,891 |
@Test
public void retrieveTest() {
Contact contact = persistence.retrieve(getContact().getName());
Assert.assertNotNull(contact);
} | void function() { Contact contact = persistence.retrieve(getContact().getName()); Assert.assertNotNull(contact); } | /**
* run the test.
*/ | run the test | retrieveTest | {
"repo_name": "gustavoleitao/Easy-Cassandra",
"path": "src/test/java/org/easycassandra/bean/ContactsDAOTest.java",
"license": "apache-2.0",
"size": 1352
} | [
"junit.framework.Assert",
"org.easycassandra.bean.model.Contact"
] | import junit.framework.Assert; import org.easycassandra.bean.model.Contact; | import junit.framework.*; import org.easycassandra.bean.model.*; | [
"junit.framework",
"org.easycassandra.bean"
] | junit.framework; org.easycassandra.bean; | 2,569,245 |
public static String escapeLikeLiteral(String literal, char escapeChar) {
// escape instances of the escape char, '%' or '_'
String escapeStr = String.valueOf(escapeChar);
return literal.replaceAll("([%_" + Pattern.quote(escapeStr) + "])",
Matcher.quoteReplacement(escapeStr) + "$1");
} | static String function(String literal, char escapeChar) { String escapeStr = String.valueOf(escapeChar); return literal.replaceAll("([%_" + Pattern.quote(escapeStr) + "])", Matcher.quoteReplacement(escapeStr) + "$1"); } | /**
* Escapes the special chars '%', '_', and the given char itself in the
* given literal string using the given escape character.
*
* @param literal string to escape as a literal pattern
* @param escapeChar escape character to use to escape the literal
* @return the escaped string
*/ | Escapes the special chars '%', '_', and the given char itself in the given literal string using the given escape character | escapeLikeLiteral | {
"repo_name": "jahlborn/sqlbuilder",
"path": "src/main/java/com/healthmarketscience/sqlbuilder/BinaryCondition.java",
"license": "apache-2.0",
"size": 8752
} | [
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,194,647 |
public void storeEnvelopeString (String s) throws UnsupportedEncodingException, EncodingFailedException, DecodingFailedException {
cache = new Envelope ( (String) s, getActiveAgent());
cache.close();
}
private Envelope groupCache = null;
| void function (String s) throws UnsupportedEncodingException, EncodingFailedException, DecodingFailedException { cache = new Envelope ( (String) s, getActiveAgent()); cache.close(); } private Envelope groupCache = null; | /**
* test for envelopes: get stored String
*
* @param s
* @throws UnsupportedEncodingException
* @throws EncodingFailedException
* @throws DecodingFailedException
*/ | test for envelopes: get stored String | storeEnvelopeString | {
"repo_name": "AlexRuppert/las2peer_project",
"path": "java/i5/las2peer/testing/TestService.java",
"license": "mit",
"size": 8124
} | [
"java.io.UnsupportedEncodingException"
] | import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 556,291 |
public static ClosableIterator<String> getAllSubject(Model model,
org.ontoware.rdf2go.model.node.Resource instanceResource) {
return Base.getAll(model, instanceResource, SUBJECT, String.class);
} | static ClosableIterator<String> function(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource) { return Base.getAll(model, instanceResource, SUBJECT, String.class); } | /**
* Get all values of property Subject * @param model an RDF2Go model
*
* @param resource
* an RDF2Go resource
* @return a ClosableIterator of $type
*
* [Generated from RDFReactor template rule #get11static]
*/ | Get all values of property Subject | getAllSubject | {
"repo_name": "m0ep/master-thesis",
"path": "source/apis/rdf2go/rdf2go-sioc/src/main/java/org/rdfs/sioc/Thing.java",
"license": "mit",
"size": 317844
} | [
"org.ontoware.aifbcommons.collection.ClosableIterator",
"org.ontoware.rdf2go.model.Model",
"org.ontoware.rdfreactor.runtime.Base"
] | import org.ontoware.aifbcommons.collection.ClosableIterator; import org.ontoware.rdf2go.model.Model; import org.ontoware.rdfreactor.runtime.Base; | import org.ontoware.aifbcommons.collection.*; import org.ontoware.rdf2go.model.*; import org.ontoware.rdfreactor.runtime.*; | [
"org.ontoware.aifbcommons",
"org.ontoware.rdf2go",
"org.ontoware.rdfreactor"
] | org.ontoware.aifbcommons; org.ontoware.rdf2go; org.ontoware.rdfreactor; | 1,084,041 |
private void register(Path dir) throws IOException {
WatchKey key = dir.register(watcher, new WatchEvent.Kind[]{ENTRY_CREATE, ENTRY_MODIFY}, SensitivityWatchEventModifier.HIGH);
Path prev = keys.get(key);
if (prev == null) {
log.debug("Directory : '{}' will be monitored for changes", dir);
}
keys.put(key, dir);
} | void function(Path dir) throws IOException { WatchKey key = dir.register(watcher, new WatchEvent.Kind[]{ENTRY_CREATE, ENTRY_MODIFY}, SensitivityWatchEventModifier.HIGH); Path prev = keys.get(key); if (prev == null) { log.debug(STR, dir); } keys.put(key, dir); } | /**
* Register the given directory with the WatchService.
*/ | Register the given directory with the WatchService | register | {
"repo_name": "jfiala/swagger-spring-demo",
"path": "sandbox/user-rest-service-1.0.2-sandbox/src/main/java/at/fwd/swagger/spring/demo/user/jhipsterclone/FjxJHipsterFileWatcher.java",
"license": "apache-2.0",
"size": 9265
} | [
"com.sun.nio.file.SensitivityWatchEventModifier",
"java.io.IOException",
"java.nio.file.Path",
"java.nio.file.WatchEvent",
"java.nio.file.WatchKey"
] | import com.sun.nio.file.SensitivityWatchEventModifier; import java.io.IOException; import java.nio.file.Path; import java.nio.file.WatchEvent; import java.nio.file.WatchKey; | import com.sun.nio.file.*; import java.io.*; import java.nio.file.*; | [
"com.sun.nio",
"java.io",
"java.nio"
] | com.sun.nio; java.io; java.nio; | 1,458,655 |
private void assertCurrentIdentityColumnValueBetween(long minValue, long maxValue) {
SQLTestUtils.executeUpdate("delete from test_table1", dataSource);
SQLTestUtils.executeUpdate("insert into test_table1(col2) values('test')", dataSource);
long currentValue = SQLTestUtils.getItemAsLong("select col1 from test_table1 where col2 = 'test'", dataSource);
assertTrue("Current sequence value is not between " + minValue + " and " + maxValue, (currentValue >= minValue && currentValue <= maxValue));
}
| void function(long minValue, long maxValue) { SQLTestUtils.executeUpdate(STR, dataSource); SQLTestUtils.executeUpdate(STR, dataSource); long currentValue = SQLTestUtils.getItemAsLong(STR, dataSource); assertTrue(STR + minValue + STR + maxValue, (currentValue >= minValue && currentValue <= maxValue)); } | /**
* Asserts that the current value for the identity column test_table.col1 is between the given values.
*
* @param minValue The minimum value (included)
* @param maxValue The maximum value (included)
*/ | Asserts that the current value for the identity column test_table.col1 is between the given values | assertCurrentIdentityColumnValueBetween | {
"repo_name": "intouchfollowup/dbmaintain",
"path": "dbmaintain/src/test/java/org/dbmaintain/structure/SequenceUpdaterTest.java",
"license": "apache-2.0",
"size": 14056
} | [
"org.dbmaintain.util.SQLTestUtils",
"org.junit.Assert"
] | import org.dbmaintain.util.SQLTestUtils; import org.junit.Assert; | import org.dbmaintain.util.*; import org.junit.*; | [
"org.dbmaintain.util",
"org.junit"
] | org.dbmaintain.util; org.junit; | 132,128 |
public Point getPosition() {
return position;
} | Point function() { return position; } | /**
* Gets the Position, that is stored in the message from the client.
*
* @return The position of the client
*/ | Gets the Position, that is stored in the message from the client | getPosition | {
"repo_name": "flyroom/PeerfactSimKOM_Clone",
"path": "src/org/peerfact/impl/overlay/informationdissemination/cs/messages/JoinMessage.java",
"license": "gpl-2.0",
"size": 3580
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,844,201 |
public static String getRedirect(String urlstring) throws IOException {
return getRedirect(urlstring, true);
} | static String function(String urlstring) throws IOException { return getRedirect(urlstring, true); } | /**
* get a redirect for an url: this method shall be called if it is expected that a url
* is redirected to another url. This method then discovers the redirect.
* @param urlstring URL String for redirection
* @return
* @throws IOException
*/ | get a redirect for an url: this method shall be called if it is expected that a url is redirected to another url. This method then discovers the redirect | getRedirect | {
"repo_name": "DravitLochan/susi_server",
"path": "src/ai/susi/server/ClientConnection.java",
"license": "lgpl-2.1",
"size": 14430
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,148,168 |
public JobInformation build(String accountName, BuildJobParameters parameters) {
return buildWithServiceResponseAsync(accountName, parameters).toBlocking().single().body();
} | JobInformation function(String accountName, BuildJobParameters parameters) { return buildWithServiceResponseAsync(accountName, parameters).toBlocking().single().body(); } | /**
* Builds (compiles) the specified job in the specified Data Lake Analytics account for job correctness and validation.
*
* @param accountName The Azure Data Lake Analytics account to execute job operations on.
* @param parameters The parameters to build a job.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the JobInformation object if successful.
*/ | Builds (compiles) the specified job in the specified Data Lake Analytics account for job correctness and validation | build | {
"repo_name": "martinsawicki/azure-sdk-for-java",
"path": "azure-mgmt-datalake-analytics/src/main/java/com/microsoft/azure/management/datalake/analytics/implementation/JobsImpl.java",
"license": "mit",
"size": 61017
} | [
"com.microsoft.azure.management.datalake.analytics.models.BuildJobParameters",
"com.microsoft.azure.management.datalake.analytics.models.JobInformation"
] | import com.microsoft.azure.management.datalake.analytics.models.BuildJobParameters; import com.microsoft.azure.management.datalake.analytics.models.JobInformation; | import com.microsoft.azure.management.datalake.analytics.models.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 801,329 |
void enterSingleAlias(@NotNull CQLParser.SingleAliasContext ctx);
void exitSingleAlias(@NotNull CQLParser.SingleAliasContext ctx); | void enterSingleAlias(@NotNull CQLParser.SingleAliasContext ctx); void exitSingleAlias(@NotNull CQLParser.SingleAliasContext ctx); | /**
* Exit a parse tree produced by {@link CQLParser#singleAlias}.
*/ | Exit a parse tree produced by <code>CQLParser#singleAlias</code> | exitSingleAlias | {
"repo_name": "HuaweiBigData/StreamCQL",
"path": "cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLParserListener.java",
"license": "apache-2.0",
"size": 58667
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,798,859 |
protected List<Command> buildCommandChain(Config rootConfig, String configKey, Command finalChild, boolean ignoreNotifications) {
Preconditions.checkNotNull(rootConfig);
Preconditions.checkNotNull(configKey);
Preconditions.checkNotNull(finalChild);
List<? extends Config> commandConfigs = new Configs().getConfigList(rootConfig, configKey, Collections.<Config>emptyList());
List<Command> commands = Lists.newArrayList();
Command currentParent = this;
Connector lastConnector = null;
for (int i = 0; i < commandConfigs.size(); i++) {
boolean isLast = (i == commandConfigs.size() - 1);
Connector connector = new Connector(ignoreNotifications && isLast);
if (isLast) {
connector.setChild(finalChild);
}
Config cmdConfig = commandConfigs.get(i);
Command cmd = buildCommand(cmdConfig, currentParent, connector);
commands.add(cmd);
if (i > 0) {
lastConnector.setChild(cmd);
}
connector.setParent(cmd);
currentParent = connector;
lastConnector = connector;
}
return commands;
} | List<Command> function(Config rootConfig, String configKey, Command finalChild, boolean ignoreNotifications) { Preconditions.checkNotNull(rootConfig); Preconditions.checkNotNull(configKey); Preconditions.checkNotNull(finalChild); List<? extends Config> commandConfigs = new Configs().getConfigList(rootConfig, configKey, Collections.<Config>emptyList()); List<Command> commands = Lists.newArrayList(); Command currentParent = this; Connector lastConnector = null; for (int i = 0; i < commandConfigs.size(); i++) { boolean isLast = (i == commandConfigs.size() - 1); Connector connector = new Connector(ignoreNotifications && isLast); if (isLast) { connector.setChild(finalChild); } Config cmdConfig = commandConfigs.get(i); Command cmd = buildCommand(cmdConfig, currentParent, connector); commands.add(cmd); if (i > 0) { lastConnector.setChild(cmd); } connector.setParent(cmd); currentParent = connector; lastConnector = connector; } return commands; } | /**
* Factory method to create the chain of commands rooted at the given rootConfig. The last command
* in the chain will feed records into finalChild.
*
* @param ignoreNotifications
* if true indicates don't forward notifications at the end of the chain of commands.
* This is a feature that multi-branch commands like tryRules and ifThenElse need to
* avoid sending a notification multiple times to finalChild, once from each branch.
*/ | Factory method to create the chain of commands rooted at the given rootConfig. The last command in the chain will feed records into finalChild | buildCommandChain | {
"repo_name": "whoschek/kite",
"path": "kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/base/AbstractCommand.java",
"license": "apache-2.0",
"size": 10926
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.Lists",
"com.typesafe.config.Config",
"java.util.Collections",
"java.util.List",
"org.kitesdk.morphline.api.Command"
] | import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.typesafe.config.Config; import java.util.Collections; import java.util.List; import org.kitesdk.morphline.api.Command; | import com.google.common.base.*; import com.google.common.collect.*; import com.typesafe.config.*; import java.util.*; import org.kitesdk.morphline.api.*; | [
"com.google.common",
"com.typesafe.config",
"java.util",
"org.kitesdk.morphline"
] | com.google.common; com.typesafe.config; java.util; org.kitesdk.morphline; | 494,243 |
public static ResourceSchema avroSchemaToResourceSchema(
final Schema s, final Boolean allowRecursiveSchema)
throws IOException {
return avroSchemaToResourceSchema(s, Sets.<Schema> newHashSet(),
Maps.<String, ResourceSchema> newHashMap(),
allowRecursiveSchema);
} | static ResourceSchema function( final Schema s, final Boolean allowRecursiveSchema) throws IOException { return avroSchemaToResourceSchema(s, Sets.<Schema> newHashSet(), Maps.<String, ResourceSchema> newHashMap(), allowRecursiveSchema); } | /**
* Translates an Avro schema to a Resource Schema (for Pig).
* @param s The avro schema for which to determine the type
* @param allowRecursiveSchema Flag indicating whether to
* throw an error if a recursive schema definition is found
* @throws IOException
* @return the corresponding pig schema
*/ | Translates an Avro schema to a Resource Schema (for Pig) | avroSchemaToResourceSchema | {
"repo_name": "hxquangnhat/PIG-ROLLUP-MRCUBE",
"path": "src/org/apache/pig/impl/util/avro/AvroStorageSchemaConversionUtilities.java",
"license": "apache-2.0",
"size": 22779
} | [
"com.google.common.collect.Maps",
"com.google.common.collect.Sets",
"java.io.IOException",
"org.apache.avro.Schema",
"org.apache.pig.ResourceSchema"
] | import com.google.common.collect.Maps; import com.google.common.collect.Sets; import java.io.IOException; import org.apache.avro.Schema; import org.apache.pig.ResourceSchema; | import com.google.common.collect.*; import java.io.*; import org.apache.avro.*; import org.apache.pig.*; | [
"com.google.common",
"java.io",
"org.apache.avro",
"org.apache.pig"
] | com.google.common; java.io; org.apache.avro; org.apache.pig; | 1,373,784 |
public void start() {
synchronized (HostStatSampler.class) {
if (statThread != null) {
try {
int msToWait = getSampleRate() + 100;
statThread.join(msToWait);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
if (statThread.isAlive()) {
throw new IllegalStateException(
LocalizedStrings.HostStatSampler_STATISTICS_SAMPLING_THREAD_IS_ALREADY_RUNNING_INDICATING_AN_INCOMPLETE_SHUTDOWN_OF_A_PREVIOUS_CACHE
.toLocalizedString());
}
}
ThreadGroup group = LoggingThreadGroup.createThreadGroup("StatSampler Threads");
this.callbackSampler.start(getStatisticsManager(), group, getSampleRate(),
TimeUnit.MILLISECONDS);
statThread = new Thread(group, this);
statThread.setName(statThread.getName() + " StatSampler");
statThread.setPriority(Thread.MAX_PRIORITY);
statThread.setDaemon(true);
statThread.start();
// fix #46310 (race between management and sampler init) by waiting for init here
try {
waitForInitialization(INITIALIZATION_TIMEOUT_MILLIS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
} | void function() { synchronized (HostStatSampler.class) { if (statThread != null) { try { int msToWait = getSampleRate() + 100; statThread.join(msToWait); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } if (statThread.isAlive()) { throw new IllegalStateException( LocalizedStrings.HostStatSampler_STATISTICS_SAMPLING_THREAD_IS_ALREADY_RUNNING_INDICATING_AN_INCOMPLETE_SHUTDOWN_OF_A_PREVIOUS_CACHE .toLocalizedString()); } } ThreadGroup group = LoggingThreadGroup.createThreadGroup(STR); this.callbackSampler.start(getStatisticsManager(), group, getSampleRate(), TimeUnit.MILLISECONDS); statThread = new Thread(group, this); statThread.setName(statThread.getName() + STR); statThread.setPriority(Thread.MAX_PRIORITY); statThread.setDaemon(true); statThread.start(); try { waitForInitialization(INITIALIZATION_TIMEOUT_MILLIS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } | /**
* Starts the main thread for this service.
*
* @throws IllegalStateException if an instance of the {@link #statThread} is still running from a
* previous DistributedSystem.
*/ | Starts the main thread for this service | start | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java",
"license": "apache-2.0",
"size": 18700
} | [
"java.util.concurrent.TimeUnit",
"org.apache.geode.internal.i18n.LocalizedStrings",
"org.apache.geode.internal.logging.LoggingThreadGroup"
] | import java.util.concurrent.TimeUnit; import org.apache.geode.internal.i18n.LocalizedStrings; import org.apache.geode.internal.logging.LoggingThreadGroup; | import java.util.concurrent.*; import org.apache.geode.internal.i18n.*; import org.apache.geode.internal.logging.*; | [
"java.util",
"org.apache.geode"
] | java.util; org.apache.geode; | 2,125,546 |
public void onEffectPageChangePage(View view, int currentPage);
| void function(View view, int currentPage); | /**
* Switch to new page.
*
* @param view Page content view.
* @param currentPage new page index.
*/ | Switch to new page | onEffectPageChangePage | {
"repo_name": "mingming-killer/K7UI",
"path": "K7UI/src/com/eebbk/mingming/k7ui/effect/view/EffectPageContainer.java",
"license": "apache-2.0",
"size": 50146
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,087,571 |
private void performChecks()
{
if (!DefaultConnectorTypes.isValid(getItem().getType()))
{
LOGGER.error("Connector type '{}' not recognized, setting to 'left-input'.", getItem().getType());
getItem().setType(DefaultConnectorTypes.LEFT_INPUT);
}
} | void function() { if (!DefaultConnectorTypes.isValid(getItem().getType())) { LOGGER.error(STR, getItem().getType()); getItem().setType(DefaultConnectorTypes.LEFT_INPUT); } } | /**
* Checks that the connector has the correct values to be displayed using this skin.
*/ | Checks that the connector has the correct values to be displayed using this skin | performChecks | {
"repo_name": "eckig/graph-editor",
"path": "core/src/main/java/de/tesis/dynaware/grapheditor/core/skins/defaults/DefaultConnectorSkin.java",
"license": "epl-1.0",
"size": 6640
} | [
"de.tesis.dynaware.grapheditor.core.connectors.DefaultConnectorTypes"
] | import de.tesis.dynaware.grapheditor.core.connectors.DefaultConnectorTypes; | import de.tesis.dynaware.grapheditor.core.connectors.*; | [
"de.tesis.dynaware"
] | de.tesis.dynaware; | 2,501,530 |
@Test
public void testClientRetriesSucceedsSecondTime() throws Exception {
Configuration conf = new Configuration();
conf.setInt(
CommonConfigurationKeysPublic.KMS_CLIENT_FAILOVER_MAX_RETRIES_KEY, 3);
KMSClientProvider p1 = mock(KMSClientProvider.class);
when(p1.createKey(Mockito.anyString(), Mockito.any(Options.class)))
.thenThrow(new ConnectTimeoutException("p1"))
.thenReturn(new KMSClientProvider.KMSKeyVersion("test3", "v1",
new byte[0]));
KMSClientProvider p2 = mock(KMSClientProvider.class);
when(p2.createKey(Mockito.anyString(), Mockito.any(Options.class)))
.thenThrow(new ConnectTimeoutException("p2"));
when(p1.getKMSUrl()).thenReturn("p1");
when(p2.getKMSUrl()).thenReturn("p2");
LoadBalancingKMSClientProvider kp = new LoadBalancingKMSClientProvider(
new KMSClientProvider[] {p1, p2}, 0, conf);
try {
kp.createKey("test3", new Options(conf));
} catch (Exception e) {
fail("Provider p1 should have answered the request second time.");
}
verify(p1, Mockito.times(2)).createKey(Mockito.eq("test3"),
Mockito.any(Options.class));
verify(p2, Mockito.times(1)).createKey(Mockito.eq("test3"),
Mockito.any(Options.class));
} | void function() throws Exception { Configuration conf = new Configuration(); conf.setInt( CommonConfigurationKeysPublic.KMS_CLIENT_FAILOVER_MAX_RETRIES_KEY, 3); KMSClientProvider p1 = mock(KMSClientProvider.class); when(p1.createKey(Mockito.anyString(), Mockito.any(Options.class))) .thenThrow(new ConnectTimeoutException("p1")) .thenReturn(new KMSClientProvider.KMSKeyVersion("test3", "v1", new byte[0])); KMSClientProvider p2 = mock(KMSClientProvider.class); when(p2.createKey(Mockito.anyString(), Mockito.any(Options.class))) .thenThrow(new ConnectTimeoutException("p2")); when(p1.getKMSUrl()).thenReturn("p1"); when(p2.getKMSUrl()).thenReturn("p2"); LoadBalancingKMSClientProvider kp = new LoadBalancingKMSClientProvider( new KMSClientProvider[] {p1, p2}, 0, conf); try { kp.createKey("test3", new Options(conf)); } catch (Exception e) { fail(STR); } verify(p1, Mockito.times(2)).createKey(Mockito.eq("test3"), Mockito.any(Options.class)); verify(p2, Mockito.times(1)).createKey(Mockito.eq("test3"), Mockito.any(Options.class)); } | /**
* Tests the operation succeeds second time after ConnectTimeoutException.
* @throws Exception
*/ | Tests the operation succeeds second time after ConnectTimeoutException | testClientRetriesSucceedsSecondTime | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/kms/TestLoadBalancingKMSClientProvider.java",
"license": "apache-2.0",
"size": 36062
} | [
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.crypto.key.KeyProvider",
"org.apache.hadoop.fs.CommonConfigurationKeysPublic",
"org.apache.hadoop.net.ConnectTimeoutException",
"org.junit.Assert",
"org.mockito.Mockito"
] | import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.crypto.key.KeyProvider; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.net.ConnectTimeoutException; import org.junit.Assert; import org.mockito.Mockito; | import org.apache.hadoop.conf.*; import org.apache.hadoop.crypto.key.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.net.*; import org.junit.*; import org.mockito.*; | [
"org.apache.hadoop",
"org.junit",
"org.mockito"
] | org.apache.hadoop; org.junit; org.mockito; | 1,401,104 |
T visitSql_update(@NotNull sqlParser.Sql_updateContext ctx);
| T visitSql_update(@NotNull sqlParser.Sql_updateContext ctx); | /**
* Visit a parse tree produced by {@link sqlParser#sql_update}.
* @param ctx the parse tree
* @return the visitor result
*/ | Visit a parse tree produced by <code>sqlParser#sql_update</code> | visitSql_update | {
"repo_name": "GreatStone/Mini-DBMS",
"path": "MySql/src/DBMS/parser/sqlVisitor.java",
"license": "gpl-2.0",
"size": 8062
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 309,007 |
private boolean systemListenerChange(Object topic, GridMessageListener exp, GridMessageListener newVal) {
assert Thread.holdsLock(sysLsnrsMux);
assert topic instanceof GridTopic;
int idx = systemListenerIndex(topic);
GridMessageListener old = sysLsnrs[idx];
if (old != null && old.equals(exp)) {
changeSystemListener(idx, newVal);
return true;
}
return false;
} | boolean function(Object topic, GridMessageListener exp, GridMessageListener newVal) { assert Thread.holdsLock(sysLsnrsMux); assert topic instanceof GridTopic; int idx = systemListenerIndex(topic); GridMessageListener old = sysLsnrs[idx]; if (old != null && old.equals(exp)) { changeSystemListener(idx, newVal); return true; } return false; } | /**
* Change system listener.
*
* @param topic Topic.
* @param exp Expected value.
* @param newVal New value.
* @return Result.
*/ | Change system listener | systemListenerChange | {
"repo_name": "alexzaitzev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java",
"license": "apache-2.0",
"size": 102499
} | [
"org.apache.ignite.internal.GridTopic"
] | import org.apache.ignite.internal.GridTopic; | import org.apache.ignite.internal.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,382,448 |
public static <T> Stream<T> stream(Cycle<T> source) {
return stream(source, Cycle::next);
}
/**
* Uses {@code source} as a supplier for a stream of pairs of {@code T} | static <T> Stream<T> function(Cycle<T> source) { return stream(source, Cycle::next); } /** * Uses {@code source} as a supplier for a stream of pairs of {@code T} | /**
* Uses {@code source} as a supplier for a stream of {@code T} elements
* produced by invocations of {@link Cycle#next() source.next()}.
* @param source the elements supply.
* @return a stream of {@code T}'s as produced by {@code source}.
* @throws NullPointerException if {@code null} arguments.
*/ | Uses source as a supplier for a stream of T elements produced by invocations of <code>Cycle#next() source.next()</code> | stream | {
"repo_name": "c0c0n3/spring-doh",
"path": "src/main/java/app/core/cyclic/Cycles.java",
"license": "gpl-3.0",
"size": 2567
} | [
"java.util.stream.Stream"
] | import java.util.stream.Stream; | import java.util.stream.*; | [
"java.util"
] | java.util; | 2,773,657 |
private boolean fighting()
{
if (entity.getAttackTarget() == null || !entity.getAttackTarget().isAlive())
{
entity.getNavigator().clearPath();
attackPath = null;
return true;
}
if (attacktimer > 0)
{
attacktimer--;
}
if (attackPath == null || !attackPath.isInProgress())
{
entity.getNavigator().moveToLivingEntity(entity.getAttackTarget(), 1);
entity.getLookController().setLookPositionWithEntity(entity.getAttackTarget(), 180f, 180f);
}
final int distance = BlockPosUtil.getMaxDistance2D(entity.getPosition(), new BlockPos(entity.getAttackTarget().getPositionVec()));
// Check if we can attack
if (distance < MELEE_ATTACK_DIST && attacktimer == 0)
{
entity.swingArm(Hand.MAIN_HAND);
entity.playSound(SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, 0.55f, 1.0f);
entity.getAttackTarget().attackEntityFrom(new EntityDamageSource(entity.getType().getTranslationKey(), entity), 15);
entity.getAttackTarget().setFire(3);
attacktimer = ATTACK_DELAY;
}
else if (distance > MAX_BLOCK_CHASE_DISTANCE)
{
entity.setAttackTarget(null);
entity.getNavigator().clearPath();
attackPath = null;
return true;
}
return false;
} | boolean function() { if (entity.getAttackTarget() == null !entity.getAttackTarget().isAlive()) { entity.getNavigator().clearPath(); attackPath = null; return true; } if (attacktimer > 0) { attacktimer--; } if (attackPath == null !attackPath.isInProgress()) { entity.getNavigator().moveToLivingEntity(entity.getAttackTarget(), 1); entity.getLookController().setLookPositionWithEntity(entity.getAttackTarget(), 180f, 180f); } final int distance = BlockPosUtil.getMaxDistance2D(entity.getPosition(), new BlockPos(entity.getAttackTarget().getPositionVec())); if (distance < MELEE_ATTACK_DIST && attacktimer == 0) { entity.swingArm(Hand.MAIN_HAND); entity.playSound(SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, 0.55f, 1.0f); entity.getAttackTarget().attackEntityFrom(new EntityDamageSource(entity.getType().getTranslationKey(), entity), 15); entity.getAttackTarget().setFire(3); attacktimer = ATTACK_DELAY; } else if (distance > MAX_BLOCK_CHASE_DISTANCE) { entity.setAttackTarget(null); entity.getNavigator().clearPath(); attackPath = null; return true; } return false; } | /**
* Fighting against a target
*
* @return false if we are still fighting
*/ | Fighting against a target | fighting | {
"repo_name": "Minecolonies/minecolonies",
"path": "src/main/java/com/minecolonies/coremod/entity/mobs/EntityMercenaryAI.java",
"license": "gpl-3.0",
"size": 8596
} | [
"com.minecolonies.api.util.BlockPosUtil",
"net.minecraft.util.EntityDamageSource",
"net.minecraft.util.Hand",
"net.minecraft.util.SoundEvents",
"net.minecraft.util.math.BlockPos"
] | import com.minecolonies.api.util.BlockPosUtil; import net.minecraft.util.EntityDamageSource; import net.minecraft.util.Hand; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; | import com.minecolonies.api.util.*; import net.minecraft.util.*; import net.minecraft.util.math.*; | [
"com.minecolonies.api",
"net.minecraft.util"
] | com.minecolonies.api; net.minecraft.util; | 2,265,984 |
public Location getLocation() {
return location;
} | Location function() { return location; } | /**
* Gets the location of the inventory, if there is one. Returns null if no location could be found.
* @return location of the inventory
*/ | Gets the location of the inventory, if there is one. Returns null if no location could be found | getLocation | {
"repo_name": "Spoutcraft/SpoutcraftPlugin",
"path": "src/main/java/org/getspout/spoutapi/event/inventory/InventoryEvent.java",
"license": "lgpl-3.0",
"size": 2086
} | [
"org.bukkit.Location"
] | import org.bukkit.Location; | import org.bukkit.*; | [
"org.bukkit"
] | org.bukkit; | 859,321 |
public void addSeeAlso() {
Base.removeAll(this.model, this.getResource(), SEEALSO);
}
| void function() { Base.removeAll(this.model, this.getResource(), SEEALSO); } | /**
* Removes all values of property SeeAlso * [Generated from RDFReactor
* template rule #removeall1dynamic]
*/ | Removes all values of property SeeAlso * [Generated from RDFReactor template rule #removeall1dynamic] | addSeeAlso | {
"repo_name": "semweb4j/semweb4j",
"path": "org.semweb4j.rdfreactor.generator/src/main/java/org/ontoware/rdfreactor/schema/bootstrap/Resource.java",
"license": "bsd-2-clause",
"size": 83665
} | [
"org.ontoware.rdfreactor.runtime.Base"
] | import org.ontoware.rdfreactor.runtime.Base; | import org.ontoware.rdfreactor.runtime.*; | [
"org.ontoware.rdfreactor"
] | org.ontoware.rdfreactor; | 1,541,725 |
private PermissibleValue getPermissibleValueObject(Set permissibleValues, String conceptCode)
{
PermissibleValue permissibleValue = null ;
Iterator iterator = permissibleValues.iterator();
while (iterator.hasNext())
{
permissibleValue = (PermissibleValue) iterator.next();
if (permissibleValue.getValue().equals(conceptCode))
{
//return permissibleValue;
break ;
}
}
return permissibleValue;
}
| PermissibleValue function(Set permissibleValues, String conceptCode) { PermissibleValue permissibleValue = null ; Iterator iterator = permissibleValues.iterator(); while (iterator.hasNext()) { permissibleValue = (PermissibleValue) iterator.next(); if (permissibleValue.getValue().equals(conceptCode)) { break ; } } return permissibleValue; } | /**
* Returns the permissible value object for the concept code from the Set of permissible values.
* @param permissibleValues The Set of permissible values.
* @param conceptCode The conceptCode whose permissible value object is required.
* @return the permissible value object for the concept code from the Set of permissible values.
*/ | Returns the permissible value object for the concept code from the Set of permissible values | getPermissibleValueObject | {
"repo_name": "NCIP/commons-module",
"path": "software/washu-commons/src/main/java/edu/wustl/common/cde/CDECacheManager.java",
"license": "bsd-3-clause",
"size": 8107
} | [
"java.util.Iterator",
"java.util.Set"
] | import java.util.Iterator; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 370,789 |
public Paint getItemOutlinePaint(int row, int column);
| Paint function(int row, int column); | /**
* Returns the paint used to outline data items as they are drawn.
*
* @param row the row (or series) index (zero-based).
* @param column the column (or category) index (zero-based).
*
* @return The paint (never <code>null</code>).
*/ | Returns the paint used to outline data items as they are drawn | getItemOutlinePaint | {
"repo_name": "SpoonLabs/astor",
"path": "examples/chart_11/source/org/jfree/chart/renderer/category/CategoryItemRenderer.java",
"license": "gpl-2.0",
"size": 64985
} | [
"java.awt.Paint"
] | import java.awt.Paint; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,678,463 |
public static <T> Set<T> createHashSet() {
return new HashSet<T>();
} | static <T> Set<T> function() { return new HashSet<T>(); } | /**
* Returns a hash set typed to the generics specified in the method call
*/ | Returns a hash set typed to the generics specified in the method call | createHashSet | {
"repo_name": "dbolser-ebi/ensj-healthcheck",
"path": "src/org/ensembl/healthcheck/util/CollectionUtils.java",
"license": "apache-2.0",
"size": 6277
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,109,177 |
public int compareTo(Object obj) {
Trigger other = (Trigger) obj;
Date myTime = getNextFireTime();
Date otherTime = other.getNextFireTime();
if (myTime == null && otherTime == null) {
return 0;
}
if (myTime == null) {
return 1;
}
if (otherTime == null) {
return -1;
}
if(myTime.before(otherTime)) {
return -1;
}
if(myTime.after(otherTime)) {
return 1;
}
return 0;
} | int function(Object obj) { Trigger other = (Trigger) obj; Date myTime = getNextFireTime(); Date otherTime = other.getNextFireTime(); if (myTime == null && otherTime == null) { return 0; } if (myTime == null) { return 1; } if (otherTime == null) { return -1; } if(myTime.before(otherTime)) { return -1; } if(myTime.after(otherTime)) { return 1; } return 0; } | /**
* <p>
* Compare the next fire time of this <code>Trigger</code> to that of
* another.
* </p>
*/ | Compare the next fire time of this <code>Trigger</code> to that of another. | compareTo | {
"repo_name": "feigeai/opensymphony-quartz-backup",
"path": "src/java/org/quartz/Trigger.java",
"license": "apache-2.0",
"size": 31513
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 501,830 |
private Object writeReplace() {
return new SerializationProxy(this);
}
private static class SerializationProxy implements Serializable {
public SerializationProxy() {}
public SerializationProxy(Write write) {
configuration = write.configuration;
tableId = write.tableId;
} | Object function() { return new SerializationProxy(this); } private static class SerializationProxy implements Serializable { public SerializationProxy() {} public SerializationProxy(Write write) { configuration = write.configuration; tableId = write.tableId; } | /**
* The writeReplace method allows the developer to provide a replacement object that will be
* serialized instead of the original one. We use this to keep the enclosed class immutable. For
* more details on the technique see <a
* href="https://lingpipe-blog.com/2009/08/10/serializing-immutable-singletons-serialization-proxy/">this
* article</a>.
*/ | The writeReplace method allows the developer to provide a replacement object that will be serialized instead of the original one. We use this to keep the enclosed class immutable. For more details on the technique see this article | writeReplace | {
"repo_name": "iemejia/incubator-beam",
"path": "sdks/java/io/hbase/src/main/java/org/apache/beam/sdk/io/hbase/HBaseIO.java",
"license": "apache-2.0",
"size": 27217
} | [
"java.io.Serializable"
] | import java.io.Serializable; | import java.io.*; | [
"java.io"
] | java.io; | 2,057,962 |
public void setContactCommunication(Collection<ContactCommunication> contactCommunication){
this.contactCommunication = contactCommunication;
}
| void function(Collection<ContactCommunication> contactCommunication){ this.contactCommunication = contactCommunication; } | /**
* Sets the value of contactCommunication attribue
**/ | Sets the value of contactCommunication attribue | setContactCommunication | {
"repo_name": "NCIP/cagrid2",
"path": "cagrid-mms/cagrid-mms-cadsr-impl/src/main/java/gov/nih/nci/cadsr/domain/Organization.java",
"license": "bsd-3-clause",
"size": 6005
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,333,256 |
private void addVariable (String varName, V[] dom) {
// Initialize the last messages received from and sent to this variable node
this.lastMsgsIn.put(varName, zeroSpace(varName, dom));
}
}
private HashMap<String, FunctionInfo> functionInfos;
private final int maxNbrIter;
private Queue queue;
private DCOPProblemInterface<V, U> problem;
private boolean silent = false;
private boolean started = false;
private U zero;
private HashMap<String, V> solution;
private U optCost;
private final boolean maximize;
private final U infeasibleUtil;
private final boolean randomInit;
private final boolean convergence;
private final HashMap< String, ArrayList< CurrentAssignment<V> > > assignmentHistoriesMap;
private HashMap<String, Message> pendingMsgs = new HashMap<String, Message> ();
public MaxSum (DCOPProblemInterface<V, U> problem, Element parameters) {
this.problem = (DCOPProblemInterface<V, U>) problem;
this.maximize = problem.maximize();
this.infeasibleUtil = (this.maximize ? problem.getMinInfUtility() : problem.getPlusInfUtility());
this.zero = this.problem.getZeroUtility();
String convergence = parameters.getAttributeValue("convergence");
if(convergence != null)
this.convergence = Boolean.parseBoolean(convergence);
else
this.convergence = false;
this.assignmentHistoriesMap = (this.convergence ? new HashMap< String, ArrayList< CurrentAssignment<V> > >() : null);
String maxNbrIter = parameters.getAttributeValue("maxNbrIter");
if(maxNbrIter == null)
this.maxNbrIter = 200;
else
this.maxNbrIter = Integer.parseInt(maxNbrIter);
String randomInitStr = parameters.getAttributeValue("randomInit");
if (randomInitStr != null)
this.randomInit = Boolean.parseBoolean(randomInitStr);
else
this.randomInit = true;
}
public MaxSum (Element parameters, DCOPProblemInterface<V, U> problem) {
this.problem = problem;
this.solution = new HashMap<String, V> ();
this.optCost = problem.getZeroUtility();
this.started = true;
this.maximize = this.problem.maximize();
this.infeasibleUtil = (this.maximize ? problem.getMinInfUtility() : problem.getPlusInfUtility());
this.maxNbrIter = 0;
this.randomInit = false;
this.convergence = false;
this.assignmentHistoriesMap = new HashMap< String, ArrayList< CurrentAssignment<V> > > ();
} | void function (String varName, V[] dom) { this.lastMsgsIn.put(varName, zeroSpace(varName, dom)); } } private HashMap<String, FunctionInfo> functionInfos; private final int maxNbrIter; private Queue queue; private DCOPProblemInterface<V, U> problem; private boolean silent = false; private boolean started = false; private U zero; private HashMap<String, V> solution; private U optCost; private final boolean maximize; private final U infeasibleUtil; private final boolean randomInit; private final boolean convergence; private final HashMap< String, ArrayList< CurrentAssignment<V> > > assignmentHistoriesMap; private HashMap<String, Message> pendingMsgs = new HashMap<String, Message> (); public MaxSum (DCOPProblemInterface<V, U> problem, Element parameters) { this.problem = (DCOPProblemInterface<V, U>) problem; this.maximize = problem.maximize(); this.infeasibleUtil = (this.maximize ? problem.getMinInfUtility() : problem.getPlusInfUtility()); this.zero = this.problem.getZeroUtility(); String convergence = parameters.getAttributeValue(STR); if(convergence != null) this.convergence = Boolean.parseBoolean(convergence); else this.convergence = false; this.assignmentHistoriesMap = (this.convergence ? new HashMap< String, ArrayList< CurrentAssignment<V> > >() : null); String maxNbrIter = parameters.getAttributeValue(STR); if(maxNbrIter == null) this.maxNbrIter = 200; else this.maxNbrIter = Integer.parseInt(maxNbrIter); String randomInitStr = parameters.getAttributeValue(STR); if (randomInitStr != null) this.randomInit = Boolean.parseBoolean(randomInitStr); else this.randomInit = true; } public MaxSum (Element parameters, DCOPProblemInterface<V, U> problem) { this.problem = problem; this.solution = new HashMap<String, V> (); this.optCost = problem.getZeroUtility(); this.started = true; this.maximize = this.problem.maximize(); this.infeasibleUtil = (this.maximize ? problem.getMinInfUtility() : problem.getPlusInfUtility()); this.maxNbrIter = 0; this.randomInit = false; this.convergence = false; this.assignmentHistoriesMap = new HashMap< String, ArrayList< CurrentAssignment<V> > > (); } | /** Adds a variable to this FunctionInfo
* @param varName the variable name
* @param dom the variable domain
*/ | Adds a variable to this FunctionInfo | addVariable | {
"repo_name": "heniancheng/FRODO",
"path": "src/frodo2/algorithms/maxsum/MaxSum.java",
"license": "agpl-3.0",
"size": 24965
} | [
"java.util.ArrayList",
"java.util.HashMap",
"org.jdom2.Element"
] | import java.util.ArrayList; import java.util.HashMap; import org.jdom2.Element; | import java.util.*; import org.jdom2.*; | [
"java.util",
"org.jdom2"
] | java.util; org.jdom2; | 1,483,702 |
@Test
public void debugExceptionAndFormattedStringWithTwoInts() {
RuntimeException exception = new RuntimeException();
logger.debugf(exception, "%d + %d", 1, 2);
if (debugEnabled) {
verify(provider).log(eq(2), isNull(), eq(Level.DEBUG), same(exception), any(PrintfStyleFormatter.class), eq("%d + %d"), eq(1),
eq(2));
} else {
verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any());
}
} | void function() { RuntimeException exception = new RuntimeException(); logger.debugf(exception, STR, 1, 2); if (debugEnabled) { verify(provider).log(eq(2), isNull(), eq(Level.DEBUG), same(exception), any(PrintfStyleFormatter.class), eq(STR), eq(1), eq(2)); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } } | /**
* Verifies that an exception and a formatted string with two integer arguments will be logged correctly at
* {@link Level#DEBUG DEBUG} level.
*/ | Verifies that an exception and a formatted string with two integer arguments will be logged correctly at <code>Level#DEBUG DEBUG</code> level | debugExceptionAndFormattedStringWithTwoInts | {
"repo_name": "pmwmedia/tinylog",
"path": "jboss-tinylog/src/test/java/org/tinylog/jboss/TinylogLoggerTest.java",
"license": "apache-2.0",
"size": 189291
} | [
"org.mockito.ArgumentMatchers",
"org.mockito.Mockito",
"org.tinylog.Level",
"org.tinylog.format.PrintfStyleFormatter"
] | import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.tinylog.Level; import org.tinylog.format.PrintfStyleFormatter; | import org.mockito.*; import org.tinylog.*; import org.tinylog.format.*; | [
"org.mockito",
"org.tinylog",
"org.tinylog.format"
] | org.mockito; org.tinylog; org.tinylog.format; | 1,061,132 |
static List<HpackHeader> headers(HpackHeadersSize size, boolean limitToAscii) {
return headersMap.get(new HeadersKey(size, limitToAscii));
} | static List<HpackHeader> headers(HpackHeadersSize size, boolean limitToAscii) { return headersMap.get(new HeadersKey(size, limitToAscii)); } | /**
* Gets headers for the given size and whether the key/values should be limited to ASCII.
*/ | Gets headers for the given size and whether the key/values should be limited to ASCII | headers | {
"repo_name": "s-gheldd/netty",
"path": "microbench/src/main/java/io/netty/handler/codec/http2/HpackUtil.java",
"license": "apache-2.0",
"size": 3783
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,612,978 |
return new KieRuntimeFactory(kieBase);
}
private KieRuntimeFactory(KieBase kieBase) {
this.kieBase = kieBase;
} | return new KieRuntimeFactory(kieBase); } private KieRuntimeFactory(KieBase kieBase) { this.kieBase = kieBase; } | /**
* Creates an instance of this factory for the given KieBase
*/ | Creates an instance of this factory for the given KieBase | of | {
"repo_name": "droolsjbpm/droolsjbpm-knowledge",
"path": "kie-api/src/main/java/org/kie/api/runtime/KieRuntimeFactory.java",
"license": "apache-2.0",
"size": 2559
} | [
"org.kie.api.KieBase"
] | import org.kie.api.KieBase; | import org.kie.api.*; | [
"org.kie.api"
] | org.kie.api; | 797,461 |
public List getGlobalJobListeners() {
return sched.getGlobalJobListeners();
} | List function() { return sched.getGlobalJobListeners(); } | /**
* <p>
* Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
* </p>
*/ | Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>. | getGlobalJobListeners | {
"repo_name": "feigeai/opensymphony-quartz-backup",
"path": "trunk/src/java/org/quartz/impl/StdScheduler.java",
"license": "apache-2.0",
"size": 24746
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,465,547 |
// [START print_results]
private static void printResults(List<TableRow> rows) {
System.out.print("\nQuery Results:\n------------\n");
for (TableRow row : rows) {
for (TableCell field : row.getF()) {
System.out.printf("%-50s", field.getV());
}
System.out.println();
}
}
// [END print_results] | static void function(List<TableRow> rows) { System.out.print(STR); for (TableRow row : rows) { for (TableCell field : row.getF()) { System.out.printf("%-50s", field.getV()); } System.out.println(); } } | /**
* Prints the results to standard out.
*
* @param rows the rows to print.
*/ | Prints the results to standard out | printResults | {
"repo_name": "tswast/java-docs-samples",
"path": "bigquery/src/main/java/com/google/cloud/bigquery/samples/GettingStarted.java",
"license": "apache-2.0",
"size": 5423
} | [
"com.google.api.services.bigquery.model.TableCell",
"com.google.api.services.bigquery.model.TableRow",
"java.util.List"
] | import com.google.api.services.bigquery.model.TableCell; import com.google.api.services.bigquery.model.TableRow; import java.util.List; | import com.google.api.services.bigquery.model.*; import java.util.*; | [
"com.google.api",
"java.util"
] | com.google.api; java.util; | 860,305 |
public void voidVisitInt(IStrategoInt arg) {
currentBuffer.put(getHeader(arg));
writeInt(arg.intValue());
} | void function(IStrategoInt arg) { currentBuffer.put(getHeader(arg)); writeInt(arg.intValue()); } | /**
* Serializes the given int. Ints will always be serialized in one piece.
*/ | Serializes the given int. Ints will always be serialized in one piece | voidVisitInt | {
"repo_name": "metaborg/mb-rep",
"path": "org.spoofax.terms/src/org/spoofax/terms/io/binary/SAFWriter.java",
"license": "apache-2.0",
"size": 17722
} | [
"org.spoofax.interpreter.terms.IStrategoInt"
] | import org.spoofax.interpreter.terms.IStrategoInt; | import org.spoofax.interpreter.terms.*; | [
"org.spoofax.interpreter"
] | org.spoofax.interpreter; | 503,304 |
ServiceResponse<Void> getMethodLocalNull() throws ErrorException, IOException; | ServiceResponse<Void> getMethodLocalNull() throws ErrorException, IOException; | /**
* Get method with api-version modeled in the method. pass in api-version = null to succeed.
*
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the {@link ServiceResponse} object if successful.
*/ | Get method with api-version modeled in the method. pass in api-version = null to succeed | getMethodLocalNull | {
"repo_name": "haocs/autorest",
"path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocals.java",
"license": "mit",
"size": 6039
} | [
"com.microsoft.rest.ServiceResponse",
"java.io.IOException"
] | import com.microsoft.rest.ServiceResponse; import java.io.IOException; | import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.rest",
"java.io"
] | com.microsoft.rest; java.io; | 854,037 |
public void test_format_LString$LObject_GeneralConversionS() {
final Object[][] triple = {
{ Boolean.FALSE, "%2.3s", "fal", },
{ Boolean.FALSE, "%-6.4s", "fals ", },
{ Boolean.FALSE, "%.5s", "false", },
{ Boolean.TRUE, "%2.3s", "tru", },
{ Boolean.TRUE, "%-6.4s", "true ", },
{ Boolean.TRUE, "%.5s", "true", },
{ new Character('c'), "%2.3s", " c", },
{ new Character('c'), "%-6.4s", "c ", },
{ new Character('c'), "%.5s", "c", },
{ new Byte((byte) 0x01), "%2.3s", " 1", },
{ new Byte((byte) 0x01), "%-6.4s", "1 ", },
{ new Byte((byte) 0x01), "%.5s", "1", },
{ new Short((short) 0x0001), "%2.3s", " 1", },
{ new Short((short) 0x0001), "%-6.4s", "1 ", },
{ new Short((short) 0x0001), "%.5s", "1", },
{ new Integer(1), "%2.3s", " 1", },
{ new Integer(1), "%-6.4s", "1 ", },
{ new Integer(1), "%.5s", "1", },
{ new Float(1.1f), "%2.3s", "1.1", },
{ new Float(1.1f), "%-6.4s", "1.1 ", },
{ new Float(1.1f), "%.5s", "1.1", },
{ new Double(1.1d), "%2.3s", "1.1", },
{ new Double(1.1d), "%-6.4s", "1.1 ", },
{ new Double(1.1d), "%.5s", "1.1", },
{ "", "%2.3s", " ", },
{ "", "%-6.4s", " ", },
{ "", "%.5s", "", },
{ "string content", "%2.3s", "str", },
{ "string content", "%-6.4s", "stri ", },
{ "string content", "%.5s", "strin", },
{ new MockFormattable(), "%2.3s", "customized format function width: 2 precision: 3", },
{ new MockFormattable(), "%-6.4s", "customized format function width: 6 precision: 4", },
{ new MockFormattable(), "%.5s", "customized format function width: -1 precision: 5", },
{ (Object) null, "%2.3s", "nul", },
{ (Object) null, "%-6.4s", "null ", },
{ (Object) null, "%.5s", "null", },
};
final int input = 0;
final int pattern = 1;
final int output = 2;
Formatter f = null;
for (int i = 0; i < triple.length; i++) {
f = new Formatter(Locale.FRANCE);
f.format((String) triple[i][pattern], triple[i][input]);
assertEquals("triple[" + i + "]:" + triple[i][input]
+ ",pattern[" + i + "]:" + triple[i][pattern], triple[i][output], f.toString());
f = new Formatter(Locale.GERMAN);
f.format(((String) triple[i][pattern]).toUpperCase(Locale.US), triple[i][input]);
assertEquals("triple[" + i + "]:" + triple[i][input]
+ ",pattern[" + i + "]:" + triple[i][pattern], ((String) triple[i][output])
.toUpperCase(Locale.US), f.toString());
}
} | public void test_format_LString$LObject_GeneralConversionS() { final Object[][] triple = { { Boolean.FALSE, "%2.3sSTRfal", }, { Boolean.FALSE, STR, STR, }, { Boolean.FALSE, "%.5sSTRfalse", }, { Boolean.TRUE, "%2.3sSTRtru", }, { Boolean.TRUE, STR, STR, }, { Boolean.TRUE, "%.5sSTRtrue", }, { new Character('c'), "%2.3s", STR, }, { new Character('c'), STR, STR, }, { new Character('c'), "%.5sSTRc", }, { new Byte((byte) 0x01), "%2.3s", STR, }, { new Byte((byte) 0x01), STR, STR, }, { new Byte((byte) 0x01), "%.5sSTR1", }, { new Short((short) 0x0001), "%2.3s", STR, }, { new Short((short) 0x0001), STR, STR, }, { new Short((short) 0x0001), "%.5sSTR1", }, { new Integer(1), "%2.3s", STR, }, { new Integer(1), STR, STR, }, { new Integer(1), "%.5sSTR1", }, { new Float(1.1f), "%2.3sSTR1.1", }, { new Float(1.1f), STR, STR, }, { new Float(1.1f), "%.5sSTR1.1", }, { new Double(1.1d), "%2.3sSTR1.1", }, { new Double(1.1d), STR, STR, }, { new Double(1.1d), "%.5sSTR1.1", }, { STR%2.3sSTR STR", STR, " ", }, { STR%.5sSTRSTRstring contentSTR%2.3sSTRstrSTRstring content", STR, "stri STRstring contentSTR%.5sSTRstrinSTR%2.3sSTRcustomized format function width: 2 precision: 3", }, { new MockFormattable(), STR, "customized format function width: 6 precision: 4STR%.5sSTRcustomized format function width: -1 precision: 5STR%2.3sSTRnul", }, { (Object) null, STR, "null STR%.5sSTRnullSTRtriple[STR]:STR,pattern[STR]:STRtriple[STR]:STR,pattern[STR]:" + triple[i][pattern], ((String) triple[i][output]) .toUpperCase(Locale.US), f.toString()); } } | /**
* java.util.Formatter#format(String, Object...) for general
* conversion type 's' and 'S'
*/ | java.util.Formatter#format(String, Object...) for general conversion type 's' and 'S' | test_format_LString$LObject_GeneralConversionS | {
"repo_name": "mirego/j2objc",
"path": "jre_emul/android/platform/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/FormatterTest.java",
"license": "apache-2.0",
"size": 189619
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 760,638 |
@JsonProperty("pool_hit_file")
public Handle getPoolHitFile() {
return poolHitFile;
} | @JsonProperty(STR) Handle function() { return poolHitFile; } | /**
* <p>Original spec-file type: Handle</p>
* <pre>
* @optional hid file_name type url remote_md5 remote_sha1
* </pre>
*
*/ | Original spec-file type: Handle <code> | getPoolHitFile | {
"repo_name": "jmchandonia/RBTnSeq",
"path": "lib/src/us/kbase/kbaserbtnseq/Pool.java",
"license": "mit",
"size": 6976
} | [
"com.fasterxml.jackson.annotation.JsonProperty",
"us.kbase.kbaseassembly.Handle"
] | import com.fasterxml.jackson.annotation.JsonProperty; import us.kbase.kbaseassembly.Handle; | import com.fasterxml.jackson.annotation.*; import us.kbase.kbaseassembly.*; | [
"com.fasterxml.jackson",
"us.kbase.kbaseassembly"
] | com.fasterxml.jackson; us.kbase.kbaseassembly; | 2,363,344 |
@Test
@JUnitSnmpAgents(value={
@JUnitSnmpAgent(host=FOREIGN_NODE_IP_ADDRESS, resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="149.134.45.45", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.16.201.2", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.17.1.230", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.1.1", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.1", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.9", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.17", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.25", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.33", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.41", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.49", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.57", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.65", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.31.3.73", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="172.100.10.1", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="203.19.73.1", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties"),
@JUnitSnmpAgent(host="203.220.17.53", resource="classpath:org/opennms/netmgt/snmp/stonegate.properties")
})
@JUnitTemporaryDatabase(tempDbClass=MockDatabase.class)
public final void testStartStop() throws MarshalException, ValidationException, IOException {
m_capsd.start();
m_capsd.scanSuspectInterface(FOREIGN_NODE_IP_ADDRESS);
m_capsd.stop();
} | @JUnitSnmpAgents(value={ @JUnitSnmpAgent(host=FOREIGN_NODE_IP_ADDRESS, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR), @JUnitSnmpAgent(host=STR, resource=STR) }) @JUnitTemporaryDatabase(tempDbClass=MockDatabase.class) final void function() throws MarshalException, ValidationException, IOException { m_capsd.start(); m_capsd.scanSuspectInterface(FOREIGN_NODE_IP_ADDRESS); m_capsd.stop(); } | /**
* Refactored from org.opennms.netmgt.capsd.ScanSuspectTest
*
* TODO: Add checks to this unit test to make sure that the suspect scan works correctly
*/ | Refactored from org.opennms.netmgt.capsd.ScanSuspectTest | testStartStop | {
"repo_name": "RangerRick/opennms",
"path": "opennms-services/src/test/java/org/opennms/netmgt/capsd/CapsdIntegrationTest.java",
"license": "gpl-2.0",
"size": 8972
} | [
"java.io.IOException",
"org.exolab.castor.xml.MarshalException",
"org.exolab.castor.xml.ValidationException",
"org.opennms.core.test.db.MockDatabase",
"org.opennms.core.test.db.annotations.JUnitTemporaryDatabase",
"org.opennms.core.test.snmp.annotations.JUnitSnmpAgent",
"org.opennms.core.test.snmp.annotations.JUnitSnmpAgents"
] | import java.io.IOException; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.ValidationException; import org.opennms.core.test.db.MockDatabase; import org.opennms.core.test.db.annotations.JUnitTemporaryDatabase; import org.opennms.core.test.snmp.annotations.JUnitSnmpAgent; import org.opennms.core.test.snmp.annotations.JUnitSnmpAgents; | import java.io.*; import org.exolab.castor.xml.*; import org.opennms.core.test.db.*; import org.opennms.core.test.db.annotations.*; import org.opennms.core.test.snmp.annotations.*; | [
"java.io",
"org.exolab.castor",
"org.opennms.core"
] | java.io; org.exolab.castor; org.opennms.core; | 1,005,644 |
interface GoogleBigqueryComponentBuilder
extends
ComponentBuilder<GoogleBigQueryComponent> {
default GoogleBigqueryComponentBuilder connectionFactory(
org.apache.camel.component.google.bigquery.GoogleBigQueryConnectionFactory connectionFactory) {
doSetProperty("connectionFactory", connectionFactory);
return this;
} | interface GoogleBigqueryComponentBuilder extends ComponentBuilder<GoogleBigQueryComponent> { default GoogleBigqueryComponentBuilder connectionFactory( org.apache.camel.component.google.bigquery.GoogleBigQueryConnectionFactory connectionFactory) { doSetProperty(STR, connectionFactory); return this; } | /**
* ConnectionFactory to obtain connection to Bigquery Service. If non
* provided the default one will be used.
*
* The option is a:
* <code>org.apache.camel.component.google.bigquery.GoogleBigQueryConnectionFactory</code> type.
*
* Group: producer
*/ | ConnectionFactory to obtain connection to Bigquery Service. If non provided the default one will be used. The option is a: <code>org.apache.camel.component.google.bigquery.GoogleBigQueryConnectionFactory</code> type. Group: producer | connectionFactory | {
"repo_name": "adessaigne/camel",
"path": "core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleBigqueryComponentBuilderFactory.java",
"license": "apache-2.0",
"size": 6169
} | [
"org.apache.camel.builder.component.ComponentBuilder",
"org.apache.camel.component.google.bigquery.GoogleBigQueryComponent"
] | import org.apache.camel.builder.component.ComponentBuilder; import org.apache.camel.component.google.bigquery.GoogleBigQueryComponent; | import org.apache.camel.builder.component.*; import org.apache.camel.component.google.bigquery.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,680,751 |
@Test
public void testNestedOk() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(NestedForDepthCheck.class);
checkConfig.addAttribute("max", "4");
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputNestedForDepth.java"),
expected);
} | void function() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NestedForDepthCheck.class); checkConfig.addAttribute("max", "4"); final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath(STR), expected); } | /**
* Call the check allowing 4 layers of nested for-statements. This
* means the top-level for can contain up to 4 levels of nested for
* statements. As the test input has 4 layers of for-statements below
* the top-level for statement, this must not cause an
* error-message.
*
* @throws Exception necessary to fulfill JUnit's
* interface-requirements for test-methods.
*/ | Call the check allowing 4 layers of nested for-statements. This means the top-level for can contain up to 4 levels of nested for statements. As the test input has 4 layers of for-statements below the top-level for statement, this must not cause an error-message | testNestedOk | {
"repo_name": "rmswimkktt/checkstyle",
"path": "src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java",
"license": "lgpl-2.1",
"size": 3579
} | [
"com.puppycrawl.tools.checkstyle.DefaultConfiguration",
"org.apache.commons.lang3.ArrayUtils"
] | import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import org.apache.commons.lang3.ArrayUtils; | import com.puppycrawl.tools.checkstyle.*; import org.apache.commons.lang3.*; | [
"com.puppycrawl.tools",
"org.apache.commons"
] | com.puppycrawl.tools; org.apache.commons; | 1,222,895 |
public OutputStream getOutputStream() throws IOException {
return mCaller != null ? mCaller.getOutputStream() : null;
} | OutputStream function() throws IOException { return mCaller != null ? mCaller.getOutputStream() : null; } | /**
* Delegate to calling template.
*/ | Delegate to calling template | getOutputStream | {
"repo_name": "ncso/openmarker",
"path": "src/main/java/openmarker/tea/compiler/CompiledTemplate.java",
"license": "apache-2.0",
"size": 8446
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,014,546 |
public void testIsDebit_errorCorrection_source_expense_positveAmount() throws Exception {
AccountingDocument accountingDocument = IsDebitTestUtils.getErrorCorrectionDocument(SpringContext.getBean(DocumentService.class), InternalBillingDocument.class);
AccountingLine accountingLine = IsDebitTestUtils.getExpenseLine(accountingDocument, SourceAccountingLine.class, POSITIVE);
assertFalse(IsDebitTestUtils.isDebit(SpringContext.getBean(DataDictionaryService.class), SpringContext.getBean(DataDictionaryService.class), accountingDocument, accountingLine));
}
| void function() throws Exception { AccountingDocument accountingDocument = IsDebitTestUtils.getErrorCorrectionDocument(SpringContext.getBean(DocumentService.class), InternalBillingDocument.class); AccountingLine accountingLine = IsDebitTestUtils.getExpenseLine(accountingDocument, SourceAccountingLine.class, POSITIVE); assertFalse(IsDebitTestUtils.isDebit(SpringContext.getBean(DataDictionaryService.class), SpringContext.getBean(DataDictionaryService.class), accountingDocument, accountingLine)); } | /**
* tests false is returned for positive expense
*
* @throws Exception
*/ | tests false is returned for positive expense | testIsDebit_errorCorrection_source_expense_positveAmount | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "test/unit/src/org/kuali/kfs/fp/document/validation/impl/InternalBillingDocumentRuleTest.java",
"license": "agpl-3.0",
"size": 67511
} | [
"org.kuali.kfs.fp.document.InternalBillingDocument",
"org.kuali.kfs.sys.businessobject.AccountingLine",
"org.kuali.kfs.sys.businessobject.SourceAccountingLine",
"org.kuali.kfs.sys.context.SpringContext",
"org.kuali.kfs.sys.document.AccountingDocument",
"org.kuali.kfs.sys.service.IsDebitTestUtils",
"org.kuali.rice.kns.service.DataDictionaryService",
"org.kuali.rice.krad.service.DocumentService"
] | import org.kuali.kfs.fp.document.InternalBillingDocument; import org.kuali.kfs.sys.businessobject.AccountingLine; import org.kuali.kfs.sys.businessobject.SourceAccountingLine; import org.kuali.kfs.sys.context.SpringContext; import org.kuali.kfs.sys.document.AccountingDocument; import org.kuali.kfs.sys.service.IsDebitTestUtils; import org.kuali.rice.kns.service.DataDictionaryService; import org.kuali.rice.krad.service.DocumentService; | import org.kuali.kfs.fp.document.*; import org.kuali.kfs.sys.businessobject.*; import org.kuali.kfs.sys.context.*; import org.kuali.kfs.sys.document.*; import org.kuali.kfs.sys.service.*; import org.kuali.rice.kns.service.*; import org.kuali.rice.krad.service.*; | [
"org.kuali.kfs",
"org.kuali.rice"
] | org.kuali.kfs; org.kuali.rice; | 1,944,101 |
@Test (timeout = 30000)
public void testDestroyProcessTree() throws IOException {
// test process
String pid = "100";
// create the fake procfs root directory.
File procfsRootDir = new File(TEST_ROOT_DIR, "proc");
try {
setupProcfsRootDir(procfsRootDir);
// crank up the process tree class.
createProcessTree(pid, procfsRootDir.getAbsolutePath());
// Let us not create stat file for pid 100.
Assert.assertTrue(ProcfsBasedProcessTree.checkPidPgrpidForMatch(
pid, procfsRootDir.getAbsolutePath()));
} finally {
FileUtil.fullyDelete(procfsRootDir);
}
} | @Test (timeout = 30000) void function() throws IOException { String pid = "100"; File procfsRootDir = new File(TEST_ROOT_DIR, "proc"); try { setupProcfsRootDir(procfsRootDir); createProcessTree(pid, procfsRootDir.getAbsolutePath()); Assert.assertTrue(ProcfsBasedProcessTree.checkPidPgrpidForMatch( pid, procfsRootDir.getAbsolutePath())); } finally { FileUtil.fullyDelete(procfsRootDir); } } | /**
* Verifies ProcfsBasedProcessTree.checkPidPgrpidForMatch() in case of
* 'constructProcessInfo() returning null' by not writing stat file for the
* mock process
* @throws IOException if there was a problem setting up the
* fake procfs directories or files.
*/ | Verifies ProcfsBasedProcessTree.checkPidPgrpidForMatch() in case of 'constructProcessInfo() returning null' by not writing stat file for the mock process | testDestroyProcessTree | {
"repo_name": "JuntaoZhang/myhadoop-2.2.0",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestProcfsBasedProcessTree.java",
"license": "apache-2.0",
"size": 28195
} | [
"java.io.File",
"java.io.IOException",
"org.apache.hadoop.fs.FileUtil",
"org.apache.hadoop.yarn.util.ProcfsBasedProcessTree",
"org.junit.Assert",
"org.junit.Test"
] | import java.io.File; import java.io.IOException; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.yarn.util.ProcfsBasedProcessTree; import org.junit.Assert; import org.junit.Test; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.yarn.util.*; import org.junit.*; | [
"java.io",
"org.apache.hadoop",
"org.junit"
] | java.io; org.apache.hadoop; org.junit; | 440,964 |
public static String getReadableFileSize(int size) {
final int BYTES_IN_KILOBYTES = 1024;
final DecimalFormat dec = new DecimalFormat("###.#");
final String KILOBYTES = " KB";
final String MEGABYTES = " MB";
final String GIGABYTES = " GB";
float fileSize = 0;
String suffix = KILOBYTES;
if (size > BYTES_IN_KILOBYTES) {
fileSize = size / BYTES_IN_KILOBYTES;
if (fileSize > BYTES_IN_KILOBYTES) {
fileSize = fileSize / BYTES_IN_KILOBYTES;
if (fileSize > BYTES_IN_KILOBYTES) {
fileSize = fileSize / BYTES_IN_KILOBYTES;
suffix = GIGABYTES;
} else {
suffix = MEGABYTES;
}
}
}
return String.valueOf(dec.format(fileSize) + suffix);
}
| static String function(int size) { final int BYTES_IN_KILOBYTES = 1024; final DecimalFormat dec = new DecimalFormat("###.#"); final String KILOBYTES = STR; final String MEGABYTES = STR; final String GIGABYTES = STR; float fileSize = 0; String suffix = KILOBYTES; if (size > BYTES_IN_KILOBYTES) { fileSize = size / BYTES_IN_KILOBYTES; if (fileSize > BYTES_IN_KILOBYTES) { fileSize = fileSize / BYTES_IN_KILOBYTES; if (fileSize > BYTES_IN_KILOBYTES) { fileSize = fileSize / BYTES_IN_KILOBYTES; suffix = GIGABYTES; } else { suffix = MEGABYTES; } } } return String.valueOf(dec.format(fileSize) + suffix); } | /**
* Get the file size in a human-readable string.
*
* @param size
* @return
* @author paulburke
*/ | Get the file size in a human-readable string | getReadableFileSize | {
"repo_name": "redleaf2002/magic_imageloader_network",
"path": "sample/MagicNetwork/magic/src/main/java/com/leaf/magic/utils/FileUtils.java",
"license": "mit",
"size": 23335
} | [
"java.text.DecimalFormat"
] | import java.text.DecimalFormat; | import java.text.*; | [
"java.text"
] | java.text; | 2,407,670 |
@Test
public void testJSSimple() {
Processor processor = new Processor();
processor.setProperty("alpha", "25");
assertEquals("3", processor.getReplacer()
.process("${js;1+2;}"));
assertEquals("25", processor.getReplacer()
.process("${js;domain.get('alpha');}"));
assertEquals("5", processor.getReplacer()
.process("${js;domain.get('alpha')/5;}"));
} | void function() { Processor processor = new Processor(); processor.setProperty("alpha", "25"); assertEquals("3", processor.getReplacer() .process(STR)); assertEquals("25", processor.getReplacer() .process(STR)); assertEquals("5", processor.getReplacer() .process(STR)); } | /**
* Test Javascript stuff
*/ | Test Javascript stuff | testJSSimple | {
"repo_name": "psoreide/bnd",
"path": "biz.aQute.bndlib.tests/test/test/MacroTest.java",
"license": "apache-2.0",
"size": 62632
} | [
"org.junit.jupiter.api.Assertions"
] | import org.junit.jupiter.api.Assertions; | import org.junit.jupiter.api.*; | [
"org.junit.jupiter"
] | org.junit.jupiter; | 1,811,203 |
public static void convertSocket(FileDescriptor fd) throws IOException {
if (!isSupported)
throw new UnsupportedOperationException("SDP not supported on this platform");
int fdVal = fdAccess.get(fd);
convert0(fdVal);
} | static void function(FileDescriptor fd) throws IOException { if (!isSupported) throw new UnsupportedOperationException(STR); int fdVal = fdAccess.get(fd); convert0(fdVal); } | /**
* Converts an existing file descriptor, that references an unbound TCP socket,
* to SDP.
*/ | Converts an existing file descriptor, that references an unbound TCP socket, to SDP | convertSocket | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "src/java.base/share/classes/sun/net/sdp/SdpSupport.java",
"license": "gpl-2.0",
"size": 3189
} | [
"java.io.FileDescriptor",
"java.io.IOException"
] | import java.io.FileDescriptor; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,380,187 |
mergeEntries = new MergeEntries(this.originalEntry, this.fetchedEntry, Localization.lang("Original entry"),
Localization.lang("Entry from %0", type), panel.getBibDatabaseContext().getMode());
// Create undo-compound
ce = new NamedCompound(Localization.lang("Merge entry with %0 information", type));
FormLayout layout = new FormLayout("fill:700px:grow", "fill:400px:grow, 4px, p, 5px, p");
this.setLayout(layout);
this.add(mergeEntries.getMergeEntryPanel(), cc.xy(1, 1));
this.add(new JSeparator(), cc.xy(1, 3));
// Create buttons
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
JButton cancel = new JButton(new CancelAction());
JButton replaceEntry = new JButton(new ReplaceAction());
bb.addButton(replaceEntry, cancel);
this.add(bb.getPanel(), cc.xy(1, 5));
// Add some margin around the layout
layout.appendRow(RowSpec.decode(MARGIN));
layout.appendColumn(ColumnSpec.decode(MARGIN));
layout.insertRow(1, RowSpec.decode(MARGIN));
layout.insertColumn(1, ColumnSpec.decode(MARGIN));
WindowLocation pw = new WindowLocation(this, JabRefPreferences.MERGEENTRIES_POS_X,
JabRefPreferences.MERGEENTRIES_POS_Y, JabRefPreferences.MERGEENTRIES_SIZE_X,
JabRefPreferences.MERGEENTRIES_SIZE_Y);
pw.displayWindowAtStoredLocation();
}
private class CancelAction extends AbstractAction {
CancelAction() {
putValue(Action.NAME, Localization.lang("Cancel"));
} | mergeEntries = new MergeEntries(this.originalEntry, this.fetchedEntry, Localization.lang(STR), Localization.lang(STR, type), panel.getBibDatabaseContext().getMode()); ce = new NamedCompound(Localization.lang(STR, type)); FormLayout layout = new FormLayout(STR, STR); this.setLayout(layout); this.add(mergeEntries.getMergeEntryPanel(), cc.xy(1, 1)); this.add(new JSeparator(), cc.xy(1, 3)); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); JButton cancel = new JButton(new CancelAction()); JButton replaceEntry = new JButton(new ReplaceAction()); bb.addButton(replaceEntry, cancel); this.add(bb.getPanel(), cc.xy(1, 5)); layout.appendRow(RowSpec.decode(MARGIN)); layout.appendColumn(ColumnSpec.decode(MARGIN)); layout.insertRow(1, RowSpec.decode(MARGIN)); layout.insertColumn(1, ColumnSpec.decode(MARGIN)); WindowLocation pw = new WindowLocation(this, JabRefPreferences.MERGEENTRIES_POS_X, JabRefPreferences.MERGEENTRIES_POS_Y, JabRefPreferences.MERGEENTRIES_SIZE_X, JabRefPreferences.MERGEENTRIES_SIZE_Y); pw.displayWindowAtStoredLocation(); } private class CancelAction extends AbstractAction { CancelAction() { putValue(Action.NAME, Localization.lang(STR)); } | /**
* Sets up the dialog
*/ | Sets up the dialog | init | {
"repo_name": "tobiasdiez/jabref",
"path": "src/main/java/org/jabref/gui/mergeentries/MergeFetchedEntryDialog.java",
"license": "mit",
"size": 6353
} | [
"com.jgoodies.forms.builder.ButtonBarBuilder",
"com.jgoodies.forms.layout.ColumnSpec",
"com.jgoodies.forms.layout.FormLayout",
"com.jgoodies.forms.layout.RowSpec",
"javax.swing.AbstractAction",
"javax.swing.Action",
"javax.swing.JButton",
"javax.swing.JSeparator",
"org.jabref.gui.undo.NamedCompound",
"org.jabref.gui.util.WindowLocation",
"org.jabref.logic.l10n.Localization",
"org.jabref.preferences.JabRefPreferences"
] | import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.layout.ColumnSpec; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.RowSpec; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JSeparator; import org.jabref.gui.undo.NamedCompound; import org.jabref.gui.util.WindowLocation; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; | import com.jgoodies.forms.builder.*; import com.jgoodies.forms.layout.*; import javax.swing.*; import org.jabref.gui.undo.*; import org.jabref.gui.util.*; import org.jabref.logic.l10n.*; import org.jabref.preferences.*; | [
"com.jgoodies.forms",
"javax.swing",
"org.jabref.gui",
"org.jabref.logic",
"org.jabref.preferences"
] | com.jgoodies.forms; javax.swing; org.jabref.gui; org.jabref.logic; org.jabref.preferences; | 927,657 |
@Override
public boolean isValidRow(Map<String, Object> row)
{
// no conditions
if (equalMap.size() == 0) {
return true;
}
// compare each condition value
for (Map.Entry<String, Object> entry : equalMap.entrySet()) {
if (!row.containsKey(entry.getKey())) {
return false;
}
Object value = row.get(entry.getKey());
if (entry.getValue() == null) {
if (value == null) {
return true;
}
return false;
}
if (value == null) {
return false;
}
if (!entry.getValue().equals(value)) {
return false;
}
}
return true;
} | boolean function(Map<String, Object> row) { if (equalMap.size() == 0) { return true; } for (Map.Entry<String, Object> entry : equalMap.entrySet()) { if (!row.containsKey(entry.getKey())) { return false; } Object value = row.get(entry.getKey()); if (entry.getValue() == null) { if (value == null) { return true; } return false; } if (value == null) { return false; } if (!entry.getValue().equals(value)) { return false; } } return true; } | /**
* Check valid row.
*/ | Check valid row | isValidRow | {
"repo_name": "ananthc/apex-malhar",
"path": "contrib/src/main/java/org/apache/apex/malhar/contrib/misc/streamquery/condition/EqualValueCondition.java",
"license": "apache-2.0",
"size": 2558
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 710,401 |
private void loadCachedSettings() {
Cursor localSettings = SiteSettingsTable.getSettings(mBlog.getRemoteBlogId());
if (localSettings != null) {
Map<Integer, CategoryModel> cachedModels = SiteSettingsTable.getAllCategories();
mSettings.deserializeOptionsDatabaseCursor(localSettings, cachedModels);
mSettings.language = languageIdToLanguageCode(Integer.toString(mSettings.languageId));
if (mSettings.language == null) {
setLanguageCode(LanguageUtils.getPatchedCurrentDeviceLanguage(null));
}
mRemoteSettings.language = mSettings.language;
mRemoteSettings.languageId = mSettings.languageId;
mRemoteSettings.location = mSettings.location;
localSettings.close();
notifyUpdatedOnUiThread(null);
} else {
mSettings.isInLocalTable = false;
setAddress(mBlog.getHomeURL());
setUsername(mBlog.getUsername());
setPassword(mBlog.getPassword());
setTitle(mBlog.getBlogName());
}
} | void function() { Cursor localSettings = SiteSettingsTable.getSettings(mBlog.getRemoteBlogId()); if (localSettings != null) { Map<Integer, CategoryModel> cachedModels = SiteSettingsTable.getAllCategories(); mSettings.deserializeOptionsDatabaseCursor(localSettings, cachedModels); mSettings.language = languageIdToLanguageCode(Integer.toString(mSettings.languageId)); if (mSettings.language == null) { setLanguageCode(LanguageUtils.getPatchedCurrentDeviceLanguage(null)); } mRemoteSettings.language = mSettings.language; mRemoteSettings.languageId = mSettings.languageId; mRemoteSettings.location = mSettings.location; localSettings.close(); notifyUpdatedOnUiThread(null); } else { mSettings.isInLocalTable = false; setAddress(mBlog.getHomeURL()); setUsername(mBlog.getUsername()); setPassword(mBlog.getPassword()); setTitle(mBlog.getBlogName()); } } | /**
* Need to defer loading the cached settings to a thread so it completes after initialization.
*/ | Need to defer loading the cached settings to a thread so it completes after initialization | loadCachedSettings | {
"repo_name": "karambir252/WordPress-Android",
"path": "WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsInterface.java",
"license": "gpl-2.0",
"size": 29425
} | [
"android.database.Cursor",
"java.util.Map",
"org.wordpress.android.datasets.SiteSettingsTable",
"org.wordpress.android.models.CategoryModel",
"org.wordpress.android.util.LanguageUtils"
] | import android.database.Cursor; import java.util.Map; import org.wordpress.android.datasets.SiteSettingsTable; import org.wordpress.android.models.CategoryModel; import org.wordpress.android.util.LanguageUtils; | import android.database.*; import java.util.*; import org.wordpress.android.datasets.*; import org.wordpress.android.models.*; import org.wordpress.android.util.*; | [
"android.database",
"java.util",
"org.wordpress.android"
] | android.database; java.util; org.wordpress.android; | 582,086 |
@ApiModelProperty(example = "null", value = "")
public String getOrganizationStatusCode() {
return organizationStatusCode;
} | @ApiModelProperty(example = "null", value = "") String function() { return organizationStatusCode; } | /**
* Get organizationStatusCode
* @return organizationStatusCode
**/ | Get organizationStatusCode | getOrganizationStatusCode | {
"repo_name": "PitneyBowes/LocationIntelligenceSDK-Java",
"path": "src/main/java/pb/locationintelligence/model/Poi.java",
"license": "apache-2.0",
"size": 11372
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 2,832,025 |
public Texture getNormalMap(final int layer) {
if (SceneApplication.getApplication().isOgl()) {
Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null)
return null;
MatParam matParam = null;
if (layer == 0)
matParam = terrain.getMaterial().getParam("NormalMap");
else
matParam = terrain.getMaterial().getParam("NormalMap_"+layer);
if (matParam == null || matParam.getValue() == null) {
return null;
} | Texture function(final int layer) { if (SceneApplication.getApplication().isOgl()) { Terrain terrain = (Terrain) getTerrain(null); if (terrain == null) return null; MatParam matParam = null; if (layer == 0) matParam = terrain.getMaterial().getParam(STR); else matParam = terrain.getMaterial().getParam(STR+layer); if (matParam == null matParam.getValue() == null) { return null; } | /**
* Get the normal map texture at the specified layer.
* Run this on the GL thread!
*/ | Get the normal map texture at the specified layer. Run this on the GL thread | getNormalMap | {
"repo_name": "OpenGrabeso/jmonkeyengine",
"path": "sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java",
"license": "bsd-3-clause",
"size": 45645
} | [
"com.jme3.gde.core.scene.SceneApplication",
"com.jme3.material.MatParam",
"com.jme3.terrain.Terrain",
"com.jme3.texture.Texture"
] | import com.jme3.gde.core.scene.SceneApplication; import com.jme3.material.MatParam; import com.jme3.terrain.Terrain; import com.jme3.texture.Texture; | import com.jme3.gde.core.scene.*; import com.jme3.material.*; import com.jme3.terrain.*; import com.jme3.texture.*; | [
"com.jme3.gde",
"com.jme3.material",
"com.jme3.terrain",
"com.jme3.texture"
] | com.jme3.gde; com.jme3.material; com.jme3.terrain; com.jme3.texture; | 875,988 |
public void setSystemPaths(PatternFilter systemPaths)
{
this.systemPaths = systemPaths;
}
| void function(PatternFilter systemPaths) { this.systemPaths = systemPaths; } | /**
* A list of regular expressions that represent patterns of system paths.
*
*/ | A list of regular expressions that represent patterns of system paths | setSystemPaths | {
"repo_name": "nguyentienlong/community-edition",
"path": "projects/repository/source/java/org/alfresco/repo/model/filefolder/FilenameFilteringInterceptor.java",
"license": "lgpl-3.0",
"size": 15272
} | [
"org.alfresco.util.PatternFilter"
] | import org.alfresco.util.PatternFilter; | import org.alfresco.util.*; | [
"org.alfresco.util"
] | org.alfresco.util; | 1,501,994 |
public Map<String, Object> getVisitTypeColorAndShortName(VisitType type) {
Map<String, Object> colorAndShortName = new HashMap<String, Object>();
if (type.getUuid().equals(LFHCFormsConstants.OUTPATIENT_VISIT_TYPE_UUID)) {
colorAndShortName.put("color", LFHCFormsConstants.OUTPATIENT_COLOR);
colorAndShortName.put("shortName", LFHCFormsConstants.OUTPATIENT_SHORTNAME);
}
if (type.getUuid().equals(LFHCFormsConstants.INPATIENT_VISIT_TYPE_UUID)) {
colorAndShortName.put("color", LFHCFormsConstants.INPATIENT_COLOR);
colorAndShortName.put("shortName", LFHCFormsConstants.INPATIENT_SHORTNAME);
}
if (type.getUuid().equals(LFHCFormsConstants.EMERGENCY_VISIT_TYPE_UUID)) {
colorAndShortName.put("color", LFHCFormsConstants.EMERGENCY_COLOR);
colorAndShortName.put("shortName", LFHCFormsConstants.EMERGENCY_SHORTNAME);
}
if (type.getUuid().equals(LFHCFormsConstants.OPERATING_THEATER_VISIT_TYPE_UUID)) {
colorAndShortName.put("color", LFHCFormsConstants.OPERATING_THEATER_COLOR);
colorAndShortName.put("shortName", LFHCFormsConstants.OPERATING_THEATER_SHORTNAME);
}
if (type.getUuid().equals(LFHCFormsConstants.OUTREACH_VISIT_TYPE_UUID)) {
colorAndShortName.put("color", LFHCFormsConstants.OUTREACH_COLOR);
colorAndShortName.put("shortName", LFHCFormsConstants.OUTREACH_SHORTNAME);
}
// set default values
if (colorAndShortName.get("color") == null ) {
colorAndShortName.put("color", "grey");
}
if (colorAndShortName.get("shortName") == null) {
colorAndShortName.put("shortName", "N/A");
}
return colorAndShortName;
} | Map<String, Object> function(VisitType type) { Map<String, Object> colorAndShortName = new HashMap<String, Object>(); if (type.getUuid().equals(LFHCFormsConstants.OUTPATIENT_VISIT_TYPE_UUID)) { colorAndShortName.put("color", LFHCFormsConstants.OUTPATIENT_COLOR); colorAndShortName.put(STR, LFHCFormsConstants.OUTPATIENT_SHORTNAME); } if (type.getUuid().equals(LFHCFormsConstants.INPATIENT_VISIT_TYPE_UUID)) { colorAndShortName.put("color", LFHCFormsConstants.INPATIENT_COLOR); colorAndShortName.put(STR, LFHCFormsConstants.INPATIENT_SHORTNAME); } if (type.getUuid().equals(LFHCFormsConstants.EMERGENCY_VISIT_TYPE_UUID)) { colorAndShortName.put("color", LFHCFormsConstants.EMERGENCY_COLOR); colorAndShortName.put(STR, LFHCFormsConstants.EMERGENCY_SHORTNAME); } if (type.getUuid().equals(LFHCFormsConstants.OPERATING_THEATER_VISIT_TYPE_UUID)) { colorAndShortName.put("color", LFHCFormsConstants.OPERATING_THEATER_COLOR); colorAndShortName.put(STR, LFHCFormsConstants.OPERATING_THEATER_SHORTNAME); } if (type.getUuid().equals(LFHCFormsConstants.OUTREACH_VISIT_TYPE_UUID)) { colorAndShortName.put("color", LFHCFormsConstants.OUTREACH_COLOR); colorAndShortName.put(STR, LFHCFormsConstants.OUTREACH_SHORTNAME); } if (colorAndShortName.get("color") == null ) { colorAndShortName.put("color", "grey"); } if (colorAndShortName.get(STR) == null) { colorAndShortName.put(STR, "N/A"); } return colorAndShortName; } | /**
* Returns the color and short name attributes for a given visit type
*
* @param type VisitType
* @return
*
*/ | Returns the color and short name attributes for a given visit type | getVisitTypeColorAndShortName | {
"repo_name": "mekomsolutions/openmrs-module-lfhcforms",
"path": "api/src/main/java/org/openmrs/module/lfhcforms/utils/VisitTypeHelper.java",
"license": "mit",
"size": 8172
} | [
"java.util.HashMap",
"java.util.Map",
"org.openmrs.VisitType",
"org.openmrs.module.lfhcforms.LFHCFormsConstants"
] | import java.util.HashMap; import java.util.Map; import org.openmrs.VisitType; import org.openmrs.module.lfhcforms.LFHCFormsConstants; | import java.util.*; import org.openmrs.*; import org.openmrs.module.lfhcforms.*; | [
"java.util",
"org.openmrs",
"org.openmrs.module"
] | java.util; org.openmrs; org.openmrs.module; | 2,360,805 |
public void onLivingUpdate()
{
if (!this.onGround && this.motionY < 0.0D)
{
this.motionY *= 0.6D;
}
if (this.world.isRemote)
{
if (this.rand.nextInt(24) == 0 && !this.isSilent())
{
this.world.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, SoundEvents.ENTITY_BLAZE_BURN, this.getSoundCategory(), 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F, false);
}
for (int i = 0; i < 2; ++i)
{
this.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0D, 0.0D, 0.0D);
}
}
super.onLivingUpdate();
} | void function() { if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.6D; } if (this.world.isRemote) { if (this.rand.nextInt(24) == 0 && !this.isSilent()) { this.world.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, SoundEvents.ENTITY_BLAZE_BURN, this.getSoundCategory(), 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F, false); } for (int i = 0; i < 2; ++i) { this.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0D, 0.0D, 0.0D); } } super.onLivingUpdate(); } | /**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/ | Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons use this to react to sunlight and start to burn | onLivingUpdate | {
"repo_name": "Severed-Infinity/technium",
"path": "build/tmp/recompileMc/sources/net/minecraft/entity/monster/EntityBlaze.java",
"license": "gpl-3.0",
"size": 11699
} | [
"net.minecraft.init.SoundEvents",
"net.minecraft.util.EnumParticleTypes"
] | import net.minecraft.init.SoundEvents; import net.minecraft.util.EnumParticleTypes; | import net.minecraft.init.*; import net.minecraft.util.*; | [
"net.minecraft.init",
"net.minecraft.util"
] | net.minecraft.init; net.minecraft.util; | 1,919,569 |
final Instant createTime = Instant.parse(
node.get(DruidConfigConstants.PROPERTIES)
.get(DruidConfigConstants.CREATED).asText());
final String name = node.get(DruidConfigConstants.NAME).asText();
final List<Segment> segmentList = new ArrayList<>();
for (JsonNode segNode : node.get(DruidConfigConstants.SEGMENTS)) {
final Segment segment = getSegmentFromJsonNode(segNode.deepCopy());
segmentList.add(segment);
}
Collections.sort(segmentList);
return new DataSource(name, createTime, segmentList);
} | final Instant createTime = Instant.parse( node.get(DruidConfigConstants.PROPERTIES) .get(DruidConfigConstants.CREATED).asText()); final String name = node.get(DruidConfigConstants.NAME).asText(); final List<Segment> segmentList = new ArrayList<>(); for (JsonNode segNode : node.get(DruidConfigConstants.SEGMENTS)) { final Segment segment = getSegmentFromJsonNode(segNode.deepCopy()); segmentList.add(segment); } Collections.sort(segmentList); return new DataSource(name, createTime, segmentList); } | /**
* get segment.
*
* @param node object node
* @return segment object
*/ | get segment | getDatasourceFromAllSegmentJsonObject | {
"repo_name": "tgianos/metacat",
"path": "metacat-connector-druid/src/main/java/com/netflix/metacat/connector/druid/converter/DruidConverterUtil.java",
"license": "apache-2.0",
"size": 3854
} | [
"com.fasterxml.jackson.databind.JsonNode",
"com.netflix.metacat.connector.druid.DruidConfigConstants",
"java.time.Instant",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] | import com.fasterxml.jackson.databind.JsonNode; import com.netflix.metacat.connector.druid.DruidConfigConstants; import java.time.Instant; import java.util.ArrayList; import java.util.Collections; import java.util.List; | import com.fasterxml.jackson.databind.*; import com.netflix.metacat.connector.druid.*; import java.time.*; import java.util.*; | [
"com.fasterxml.jackson",
"com.netflix.metacat",
"java.time",
"java.util"
] | com.fasterxml.jackson; com.netflix.metacat; java.time; java.util; | 834,138 |
private int initFileDirTables() {
try {
initFileDirTables(root);
} catch (IOException e) {
System.err.println(e.getLocalizedMessage());
e.printStackTrace();
return -1;
}
if (dirs.isEmpty()) {
System.err.println("The test space " + root + " is empty");
return -1;
}
if (files.isEmpty()) {
System.err.println("The test space " + root +
" does not have any file");
return -1;
}
return 0;
} | int function() { try { initFileDirTables(root); } catch (IOException e) { System.err.println(e.getLocalizedMessage()); e.printStackTrace(); return -1; } if (dirs.isEmpty()) { System.err.println(STR + root + STR); return -1; } if (files.isEmpty()) { System.err.println(STR + root + STR); return -1; } return 0; } | /** Create a table that contains all directories under root and
* another table that contains all files under root.
*/ | Create a table that contains all directories under root and another table that contains all files under root | initFileDirTables | {
"repo_name": "shakamunyi/hadoop-20",
"path": "src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/LoadGenerator.java",
"license": "apache-2.0",
"size": 17735
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,537,257 |
public void testGetMultiple_simple()
throws Exception
{
MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
server.setCacheEventLogger( cacheEventLogger );
// DO WORK
server.getMultiple( "region", new HashSet<String>() );
// VERIFY
assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
} | void function() throws Exception { MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); server.setCacheEventLogger( cacheEventLogger ); server.getMultiple( STR, new HashSet<String>() ); assertEquals( STR, 1, cacheEventLogger.startICacheEventCalls ); assertEquals( STR, 1, cacheEventLogger.endICacheEventCalls ); } | /**
* Verify event log calls.
* <p>
* @throws Exception
*/ | Verify event log calls. | testGetMultiple_simple | {
"repo_name": "mohanaraosv/commons-jcs",
"path": "commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java",
"license": "apache-2.0",
"size": 17365
} | [
"java.util.HashSet",
"org.apache.commons.jcs.auxiliary.MockCacheEventLogger"
] | import java.util.HashSet; import org.apache.commons.jcs.auxiliary.MockCacheEventLogger; | import java.util.*; import org.apache.commons.jcs.auxiliary.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 452,636 |
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void annotationsShouldNotBeShownInXWiki10Syntax()
{
AnnotatableViewPage annotatableViewPage = new AnnotatableViewPage(
getUtil().createPage(getTestClassName(), getTestMethodName(), "Some content",
"AnnotationsTest in XWiki 1.0 Syntax", "xwiki/1.0"));
annotatableViewPage.showAnnotationsPane();
// Annotations are disabled in 1.0 Pages. This element should no be here
assertTrue(annotatableViewPage.checkIfAnnotationsAreDisabled());
annotatableViewPage.simulateCTRL_M();
annotatableViewPage.waitforAnnotationWarningNotification();
} | @IgnoreBrowser(value = STR, version = "9\\.*", reason = STRSome contentSTRAnnotationsTest in XWiki 1.0 SyntaxSTRxwiki/1.0")); annotatableViewPage.showAnnotationsPane(); assertTrue(annotatableViewPage.checkIfAnnotationsAreDisabled()); annotatableViewPage.simulateCTRL_M(); annotatableViewPage.waitforAnnotationWarningNotification(); } | /**
* This test creates a XWiki 1.0 syntax page, and tries to add annotations to it, and checks if the warning messages
* are shown This test is against XAANNOTATIONS-17
*/ | This test creates a XWiki 1.0 syntax page, and tries to add annotations to it, and checks if the warning messages are shown This test is against XAANNOTATIONS-17 | annotationsShouldNotBeShownInXWiki10Syntax | {
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-test/xwiki-platform-annotation-test-tests/src/test/it/org/xwiki/annotation/test/ui/AnnotationsTest.java",
"license": "lgpl-2.1",
"size": 6509
} | [
"org.junit.Assert",
"org.xwiki.test.ui.browser.IgnoreBrowser"
] | import org.junit.Assert; import org.xwiki.test.ui.browser.IgnoreBrowser; | import org.junit.*; import org.xwiki.test.ui.browser.*; | [
"org.junit",
"org.xwiki.test"
] | org.junit; org.xwiki.test; | 578,567 |
public static DateTimeExpression<Date> currentTimestamp() {
return Constants.CURRENT_TIMESTAMP;
} | static DateTimeExpression<Date> function() { return Constants.CURRENT_TIMESTAMP; } | /**
* Create an expression representing the current time instant as a DateTimeExpression instance
*
* @return current timestamp
*/ | Create an expression representing the current time instant as a DateTimeExpression instance | currentTimestamp | {
"repo_name": "balazs-zsoldos/querydsl",
"path": "querydsl-core/src/main/java/com/querydsl/core/types/dsl/DateTimeExpression.java",
"license": "apache-2.0",
"size": 8080
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,258,721 |
public CountDownLatch updateOrderDiscountAsync(com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, Integer discountId, String updateMode, String version, String responseFields, AsyncCallback<com.mozu.api.contracts.commerceruntime.orders.Order> callback) throws Exception
{
MozuClient<com.mozu.api.contracts.commerceruntime.orders.Order> client = com.mozu.api.clients.commerce.OrderClient.updateOrderDiscountClient( discount, orderId, discountId, updateMode, version, responseFields);
client.setContext(_apiContext);
return client.executeRequest(callback);
} | CountDownLatch function(com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, Integer discountId, String updateMode, String version, String responseFields, AsyncCallback<com.mozu.api.contracts.commerceruntime.orders.Order> callback) throws Exception { MozuClient<com.mozu.api.contracts.commerceruntime.orders.Order> client = com.mozu.api.clients.commerce.OrderClient.updateOrderDiscountClient( discount, orderId, discountId, updateMode, version, responseFields); client.setContext(_apiContext); return client.executeRequest(callback); } | /**
* Update the properties of a discount applied to an order.
* <p><pre><code>
* Order order = new Order();
* CountDownLatch latch = order.updateOrderDiscount( discount, orderId, discountId, updateMode, version, responseFields, callback );
* latch.await() * </code></pre></p>
* @param discountId discountId parameter description DOCUMENT_HERE
* @param orderId Unique identifier of the order.
* @param responseFields Use this field to include those fields which are not included by default.
* @param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."
* @param version System-supplied integer that represents the current version of the order, which prevents users from unintentionally overriding changes to the order. When a user performs an operation for a defined order, the system validates that the version of the updated order matches the version of the order on the server. After the operation completes successfully, the system increments the version number by one.
* @param callback callback handler for asynchronous operations
* @param discount Properties of all applied discounts for an associated cart, order, or product.
* @return com.mozu.api.contracts.commerceruntime.orders.Order
* @see com.mozu.api.contracts.commerceruntime.orders.Order
* @see com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount
*/ | Update the properties of a discount applied to an order. <code><code> Order order = new Order(); CountDownLatch latch = order.updateOrderDiscount( discount, orderId, discountId, updateMode, version, responseFields, callback ); latch.await() * </code></code> | updateOrderDiscountAsync | {
"repo_name": "bhewett/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/OrderResource.java",
"license": "mit",
"size": 52060
} | [
"com.mozu.api.AsyncCallback",
"com.mozu.api.MozuClient",
"java.util.concurrent.CountDownLatch"
] | import com.mozu.api.AsyncCallback; import com.mozu.api.MozuClient; import java.util.concurrent.CountDownLatch; | import com.mozu.api.*; import java.util.concurrent.*; | [
"com.mozu.api",
"java.util"
] | com.mozu.api; java.util; | 2,068,511 |
public java.util.List<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI> getSubterm_finiteIntRanges_LessThanHLAPI(){
java.util.List<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI>();
for (Term elemnt : getSubterm()) {
if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.finiteIntRanges.impl.LessThanImpl.class)){
retour.add(new fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI(
(fr.lip6.move.pnml.hlpn.finiteIntRanges.LessThan)elemnt
));
}
}
return retour;
}
| java.util.List<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.finiteIntRanges.impl.LessThanImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.finiteIntRanges.hlapi.LessThanHLAPI( (fr.lip6.move.pnml.hlpn.finiteIntRanges.LessThan)elemnt )); } } return retour; } | /**
* This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/ | This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind. WARNING : this method can creates a lot of new object in memory | getSubterm_finiteIntRanges_LessThanHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/GreaterThanHLAPI.java",
"license": "epl-1.0",
"size": 108533
} | [
"fr.lip6.move.pnml.hlpn.terms.Term",
"java.util.ArrayList",
"java.util.List"
] | import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List; | import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
] | fr.lip6.move; java.util; | 1,394,576 |
@Override
public void resetTask() {
owner = null;
nav.clearPathEntity();
PathNavigate pathNavigate = dragon.getNavigator();
if (pathNavigate instanceof PathNavigateGround) {
PathNavigateGround pathNavigateGround = (PathNavigateGround)pathNavigate;
pathNavigateGround.func_179690_a(avoidWater); // best guess, based on vanilla EntityAIFollowOwner
}
} | void function() { owner = null; nav.clearPathEntity(); PathNavigate pathNavigate = dragon.getNavigator(); if (pathNavigate instanceof PathNavigateGround) { PathNavigateGround pathNavigateGround = (PathNavigateGround)pathNavigate; pathNavigateGround.func_179690_a(avoidWater); } } | /**
* Resets the task
*/ | Resets the task | resetTask | {
"repo_name": "StingStriker353/More-Everything-Mod",
"path": "src/main/java/com/riphtix/mem/server/entity/ai/ground/EntityAIDragonFollowOwner.java",
"license": "lgpl-2.1",
"size": 5796
} | [
"net.minecraft.pathfinding.PathNavigate",
"net.minecraft.pathfinding.PathNavigateGround"
] | import net.minecraft.pathfinding.PathNavigate; import net.minecraft.pathfinding.PathNavigateGround; | import net.minecraft.pathfinding.*; | [
"net.minecraft.pathfinding"
] | net.minecraft.pathfinding; | 1,983,387 |
private void actionPerformedNameSelect(GuiButton button)
{
if (button == backButton)
{
drawGenderSelectGui();
}
else if (button == nextButton)
{
drawOptionsGui();
}
} | void function(GuiButton button) { if (button == backButton) { drawGenderSelectGui(); } else if (button == nextButton) { drawOptionsGui(); } } | /**
* Handles an action performed on the Name Select GUI.
*
* @param button The button that was pressed.
*/ | Handles an action performed on the Name Select GUI | actionPerformedNameSelect | {
"repo_name": "MrPonyCaptain/minecraft-comes-alive",
"path": "Minecraft/1.7.10/src/main/java/mca/client/gui/GuiSetup.java",
"license": "gpl-3.0",
"size": 11990
} | [
"net.minecraft.client.gui.GuiButton"
] | import net.minecraft.client.gui.GuiButton; | import net.minecraft.client.gui.*; | [
"net.minecraft.client"
] | net.minecraft.client; | 428,288 |
public synchronized void logout() {
if (subject != null) {
LOG.debug("Logout. Kerberos enabled '{}', Principal '{}'", securityConfiguration.isKerberosEnabled(),
subject.getPrincipals());
if (loginContext != null) {
try {
loginContext.logout();
} catch (LoginException ex) {
LOG.warn("Error while doing logout from Kerberos: {}", ex.toString(), ex);
} finally {
loginContext = null;
}
}
subject = null;
}
} | synchronized void function() { if (subject != null) { LOG.debug(STR, securityConfiguration.isKerberosEnabled(), subject.getPrincipals()); if (loginContext != null) { try { loginContext.logout(); } catch (LoginException ex) { LOG.warn(STR, ex.toString(), ex); } finally { loginContext = null; } } subject = null; } } | /**
* Logs out. If Keberos is enabled it logs out from the KDC, otherwise is a NOP.
*/ | Logs out. If Keberos is enabled it logs out from the KDC, otherwise is a NOP | logout | {
"repo_name": "rockmkd/datacollector",
"path": "container-common/src/main/java/com/streamsets/datacollector/security/SecurityContext.java",
"license": "apache-2.0",
"size": 12107
} | [
"javax.security.auth.login.LoginException"
] | import javax.security.auth.login.LoginException; | import javax.security.auth.login.*; | [
"javax.security"
] | javax.security; | 2,567,213 |
public BigDecimal getCostStandardPOQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardPOQty);
if (bd == null)
return Env.ZERO;
return bd;
} | BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardPOQty); if (bd == null) return Env.ZERO; return bd; } | /** Get Std PO Cost Quantity Sum.
@return Standard Cost Purchase Order Quantity Sum (internal)
*/ | Get Std PO Cost Quantity Sum | getCostStandardPOQty | {
"repo_name": "pplatek/adempiere",
"path": "base/src/org/compiere/model/X_M_Product_Costing.java",
"license": "gpl-2.0",
"size": 11513
} | [
"java.math.BigDecimal",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import org.compiere.util.Env; | import java.math.*; import org.compiere.util.*; | [
"java.math",
"org.compiere.util"
] | java.math; org.compiere.util; | 1,405,822 |
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<ProductContractInner> listByServiceAsync(
String resourceGroupName,
String serviceName,
String filter,
Integer top,
Integer skip,
Boolean expandGroups,
String tags,
Context context) {
return new PagedFlux<>(
() ->
listByServiceSinglePageAsync(
resourceGroupName, serviceName, filter, top, skip, expandGroups, tags, context),
nextLink -> listByServiceNextSinglePageAsync(nextLink, context));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ProductContractInner> function( String resourceGroupName, String serviceName, String filter, Integer top, Integer skip, Boolean expandGroups, String tags, Context context) { return new PagedFlux<>( () -> listByServiceSinglePageAsync( resourceGroupName, serviceName, filter, top, skip, expandGroups, tags, context), nextLink -> listByServiceNextSinglePageAsync(nextLink, context)); } | /**
* Lists a collection of products in the specified service instance.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param filter | Field | Usage | Supported operators | Supported functions
* |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq,
* ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne,
* gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt,
* lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt |
* substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand
* | | |</br>.
* @param top Number of records to return.
* @param skip Number of records to skip.
* @param expandGroups When set to true, the response contains an array of groups that have visibility to the
* product. The default is false.
* @param tags Products which are part of a specific tag.
* @param context The context to associate with this operation.
* @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 paged Products list representation.
*/ | Lists a collection of products in the specified service instance | listByServiceAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/ProductsClientImpl.java",
"license": "mit",
"size": 97306
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.core.util.Context",
"com.azure.resourcemanager.apimanagement.fluent.models.ProductContractInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.core.util.Context; import com.azure.resourcemanager.apimanagement.fluent.models.ProductContractInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.apimanagement.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,319,739 |
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof AbstractRenderer)) {
return false;
}
AbstractRenderer that = (AbstractRenderer) obj;
if (!ObjectUtilities.equal(this.seriesVisible, that.seriesVisible)) {
return false;
}
if (!this.seriesVisibleList.equals(that.seriesVisibleList)) {
return false;
}
if (this.baseSeriesVisible != that.baseSeriesVisible) {
return false;
}
if (!ObjectUtilities.equal(this.seriesVisibleInLegend,
that.seriesVisibleInLegend)) {
return false;
}
if (!this.seriesVisibleInLegendList.equals(
that.seriesVisibleInLegendList)) {
return false;
}
if (this.baseSeriesVisibleInLegend != that.baseSeriesVisibleInLegend) {
return false;
}
if (!PaintUtilities.equal(this.paint, that.paint)) {
return false;
}
if (!ObjectUtilities.equal(this.paintList, that.paintList)) {
return false;
}
if (!PaintUtilities.equal(this.basePaint, that.basePaint)) {
return false;
}
if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
return false;
}
if (!ObjectUtilities.equal(this.fillPaintList, that.fillPaintList)) {
return false;
}
if (!PaintUtilities.equal(this.baseFillPaint, that.baseFillPaint)) {
return false;
}
if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.outlinePaintList,
that.outlinePaintList)) {
return false;
}
if (!PaintUtilities.equal(this.baseOutlinePaint,
that.baseOutlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
return false;
}
if (!ObjectUtilities.equal(this.strokeList, that.strokeList)) {
return false;
}
if (!ObjectUtilities.equal(this.baseStroke, that.baseStroke)) {
return false;
}
if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) {
return false;
}
if (!ObjectUtilities.equal(this.outlineStrokeList,
that.outlineStrokeList)) {
return false;
}
if (!ObjectUtilities.equal(
this.baseOutlineStroke, that.baseOutlineStroke)
) {
return false;
}
if (!ObjectUtilities.equal(this.shape, that.shape)) {
return false;
}
if (!ObjectUtilities.equal(this.shapeList, that.shapeList)) {
return false;
}
if (!ObjectUtilities.equal(this.baseShape, that.baseShape)) {
return false;
}
if (!ObjectUtilities.equal(this.itemLabelsVisible,
that.itemLabelsVisible)) {
return false;
}
if (!ObjectUtilities.equal(this.itemLabelsVisibleList,
that.itemLabelsVisibleList)) {
return false;
}
if (!ObjectUtilities.equal(this.baseItemLabelsVisible,
that.baseItemLabelsVisible)) {
return false;
}
if (!ObjectUtilities.equal(this.itemLabelFont, that.itemLabelFont)) {
return false;
}
if (!ObjectUtilities.equal(this.itemLabelFontList,
that.itemLabelFontList)) {
return false;
}
if (!ObjectUtilities.equal(this.baseItemLabelFont,
that.baseItemLabelFont)) {
return false;
}
if (!PaintUtilities.equal(this.itemLabelPaint, that.itemLabelPaint)) {
return false;
}
if (!ObjectUtilities.equal(this.itemLabelPaintList,
that.itemLabelPaintList)) {
return false;
}
if (!PaintUtilities.equal(this.baseItemLabelPaint,
that.baseItemLabelPaint)) {
return false;
}
if (!ObjectUtilities.equal(this.positiveItemLabelPosition,
that.positiveItemLabelPosition)) {
return false;
}
if (!ObjectUtilities.equal(this.positiveItemLabelPositionList,
that.positiveItemLabelPositionList)) {
return false;
}
if (!ObjectUtilities.equal(this.basePositiveItemLabelPosition,
that.basePositiveItemLabelPosition)) {
return false;
}
if (!ObjectUtilities.equal(this.negativeItemLabelPosition,
that.negativeItemLabelPosition)) {
return false;
}
if (!ObjectUtilities.equal(this.negativeItemLabelPositionList,
that.negativeItemLabelPositionList)) {
return false;
}
if (!ObjectUtilities.equal(this.baseNegativeItemLabelPosition,
that.baseNegativeItemLabelPosition)) {
return false;
}
if (this.itemLabelAnchorOffset != that.itemLabelAnchorOffset) {
return false;
}
if (!ObjectUtilities.equal(this.createEntities, that.createEntities)) {
return false;
}
if (!ObjectUtilities.equal(this.createEntitiesList,
that.createEntitiesList)) {
return false;
}
if (this.baseCreateEntities != that.baseCreateEntities) {
return false;
}
return true;
} | boolean function(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractRenderer)) { return false; } AbstractRenderer that = (AbstractRenderer) obj; if (!ObjectUtilities.equal(this.seriesVisible, that.seriesVisible)) { return false; } if (!this.seriesVisibleList.equals(that.seriesVisibleList)) { return false; } if (this.baseSeriesVisible != that.baseSeriesVisible) { return false; } if (!ObjectUtilities.equal(this.seriesVisibleInLegend, that.seriesVisibleInLegend)) { return false; } if (!this.seriesVisibleInLegendList.equals( that.seriesVisibleInLegendList)) { return false; } if (this.baseSeriesVisibleInLegend != that.baseSeriesVisibleInLegend) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.paintList, that.paintList)) { return false; } if (!PaintUtilities.equal(this.basePaint, that.basePaint)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!ObjectUtilities.equal(this.fillPaintList, that.fillPaintList)) { return false; } if (!PaintUtilities.equal(this.baseFillPaint, that.baseFillPaint)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlinePaintList, that.outlinePaintList)) { return false; } if (!PaintUtilities.equal(this.baseOutlinePaint, that.baseOutlinePaint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } if (!ObjectUtilities.equal(this.strokeList, that.strokeList)) { return false; } if (!ObjectUtilities.equal(this.baseStroke, that.baseStroke)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (!ObjectUtilities.equal(this.outlineStrokeList, that.outlineStrokeList)) { return false; } if (!ObjectUtilities.equal( this.baseOutlineStroke, that.baseOutlineStroke) ) { return false; } if (!ObjectUtilities.equal(this.shape, that.shape)) { return false; } if (!ObjectUtilities.equal(this.shapeList, that.shapeList)) { return false; } if (!ObjectUtilities.equal(this.baseShape, that.baseShape)) { return false; } if (!ObjectUtilities.equal(this.itemLabelsVisible, that.itemLabelsVisible)) { return false; } if (!ObjectUtilities.equal(this.itemLabelsVisibleList, that.itemLabelsVisibleList)) { return false; } if (!ObjectUtilities.equal(this.baseItemLabelsVisible, that.baseItemLabelsVisible)) { return false; } if (!ObjectUtilities.equal(this.itemLabelFont, that.itemLabelFont)) { return false; } if (!ObjectUtilities.equal(this.itemLabelFontList, that.itemLabelFontList)) { return false; } if (!ObjectUtilities.equal(this.baseItemLabelFont, that.baseItemLabelFont)) { return false; } if (!PaintUtilities.equal(this.itemLabelPaint, that.itemLabelPaint)) { return false; } if (!ObjectUtilities.equal(this.itemLabelPaintList, that.itemLabelPaintList)) { return false; } if (!PaintUtilities.equal(this.baseItemLabelPaint, that.baseItemLabelPaint)) { return false; } if (!ObjectUtilities.equal(this.positiveItemLabelPosition, that.positiveItemLabelPosition)) { return false; } if (!ObjectUtilities.equal(this.positiveItemLabelPositionList, that.positiveItemLabelPositionList)) { return false; } if (!ObjectUtilities.equal(this.basePositiveItemLabelPosition, that.basePositiveItemLabelPosition)) { return false; } if (!ObjectUtilities.equal(this.negativeItemLabelPosition, that.negativeItemLabelPosition)) { return false; } if (!ObjectUtilities.equal(this.negativeItemLabelPositionList, that.negativeItemLabelPositionList)) { return false; } if (!ObjectUtilities.equal(this.baseNegativeItemLabelPosition, that.baseNegativeItemLabelPosition)) { return false; } if (this.itemLabelAnchorOffset != that.itemLabelAnchorOffset) { return false; } if (!ObjectUtilities.equal(this.createEntities, that.createEntities)) { return false; } if (!ObjectUtilities.equal(this.createEntitiesList, that.createEntitiesList)) { return false; } if (this.baseCreateEntities != that.baseCreateEntities) { return false; } return true; } | /**
* Tests this renderer for equality with another object.
*
* @param obj the object (<code>null</code> permitted).
*
* @return <code>true</code> or <code>false</code>.
*/ | Tests this renderer for equality with another object | equals | {
"repo_name": "ibestvina/multithread-centiscape",
"path": "CentiScaPe2.1/src/main/java/org/jfree/chart/renderer/AbstractRenderer.java",
"license": "mit",
"size": 126056
} | [
"org.jfree.util.ObjectUtilities",
"org.jfree.util.PaintUtilities"
] | import org.jfree.util.ObjectUtilities; import org.jfree.util.PaintUtilities; | import org.jfree.util.*; | [
"org.jfree.util"
] | org.jfree.util; | 1,565,001 |
@Test
public void testAddTestScenarioToScenarioSuite() throws Exception {
TestProject testProject = createTestProjectsInWS();
FitnesseFileSystemTestStructureService service = new FitnesseFileSystemTestStructureService();
ScenarioSuite scs = new ScenarioSuite();
scs.setName("ScenarioSuite");
testProject.addChild(scs);
service.createTestStructure(scs);
TestScenario tsc = new TestScenario();
tsc.setName("Scenario");
scs.addChild(tsc);
service.createTestStructure(tsc);
assertTrue(
"Directory of Testcase exists.",
Files.exists(Paths.get(Platform.getLocation().toFile().toPath().toString()
+ "/tp/FitNesseRoot/tp/ScenarioSuite/Scenario")));
assertTrue(
"Properties of Testcase exists.",
Files.exists(Paths.get(Platform.getLocation().toFile().toPath().toString()
+ "/tp/FitNesseRoot/tp/ScenarioSuite/Scenario/properties.xml")));
assertTrue(new String(Files.readAllBytes(Paths.get(Platform.getLocation().toFile().toPath().toString()
+ "/tp/FitNesseRoot/tp/ScenarioSuite/Scenario/properties.xml")), StandardCharsets.UTF_8)
.contains("<TESTSCENARIO/>"));
} | void function() throws Exception { TestProject testProject = createTestProjectsInWS(); FitnesseFileSystemTestStructureService service = new FitnesseFileSystemTestStructureService(); ScenarioSuite scs = new ScenarioSuite(); scs.setName(STR); testProject.addChild(scs); service.createTestStructure(scs); TestScenario tsc = new TestScenario(); tsc.setName(STR); scs.addChild(tsc); service.createTestStructure(tsc); assertTrue( STR, Files.exists(Paths.get(Platform.getLocation().toFile().toPath().toString() + STR))); assertTrue( STR, Files.exists(Paths.get(Platform.getLocation().toFile().toPath().toString() + STR))); assertTrue(new String(Files.readAllBytes(Paths.get(Platform.getLocation().toFile().toPath().toString() + STR)), StandardCharsets.UTF_8) .contains(STR)); } | /**
* Tests the Adding of a TestScenario to an existing ScenarioSuite.
*
* @throws Exception
* on Test failure.
*/ | Tests the Adding of a TestScenario to an existing ScenarioSuite | testAddTestScenarioToScenarioSuite | {
"repo_name": "franzbecker/test-editor",
"path": "fitnesse/org.testeditor.fitnesse.test/src/org/testeditor/fitnesse/filesystem/FitnesseFileSystemTestStructureServiceTest.java",
"license": "epl-1.0",
"size": 20007
} | [
"java.nio.charset.StandardCharsets",
"java.nio.file.Files",
"java.nio.file.Paths",
"org.eclipse.core.runtime.Platform",
"org.junit.Assert",
"org.testeditor.core.model.teststructure.ScenarioSuite",
"org.testeditor.core.model.teststructure.TestProject",
"org.testeditor.core.model.teststructure.TestScenario"
] | import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import org.eclipse.core.runtime.Platform; import org.junit.Assert; import org.testeditor.core.model.teststructure.ScenarioSuite; import org.testeditor.core.model.teststructure.TestProject; import org.testeditor.core.model.teststructure.TestScenario; | import java.nio.charset.*; import java.nio.file.*; import org.eclipse.core.runtime.*; import org.junit.*; import org.testeditor.core.model.teststructure.*; | [
"java.nio",
"org.eclipse.core",
"org.junit",
"org.testeditor.core"
] | java.nio; org.eclipse.core; org.junit; org.testeditor.core; | 619,394 |
private ValueNode timestampAddBind()
throws StandardException
{
if( ! bindParameter( rightOperand, Types.INTEGER))
{
int jdbcType = rightOperand.getTypeId().getJDBCTypeId();
if( jdbcType != Types.TINYINT && jdbcType != Types.SMALLINT &&
jdbcType != Types.INTEGER && jdbcType != Types.BIGINT)
throw StandardException.newException(SQLState.LANG_INVALID_FUNCTION_ARG_TYPE,
rightOperand.getTypeId().getSQLTypeName(),
ReuseFactory.getInteger( 2),
operator);
}
bindDateTimeArg( receiver, 3);
setType(DataTypeDescriptor.getBuiltInDataTypeDescriptor( Types.TIMESTAMP));
return this;
} // end of timestampAddBind | ValueNode function() throws StandardException { if( ! bindParameter( rightOperand, Types.INTEGER)) { int jdbcType = rightOperand.getTypeId().getJDBCTypeId(); if( jdbcType != Types.TINYINT && jdbcType != Types.SMALLINT && jdbcType != Types.INTEGER && jdbcType != Types.BIGINT) throw StandardException.newException(SQLState.LANG_INVALID_FUNCTION_ARG_TYPE, rightOperand.getTypeId().getSQLTypeName(), ReuseFactory.getInteger( 2), operator); } bindDateTimeArg( receiver, 3); setType(DataTypeDescriptor.getBuiltInDataTypeDescriptor( Types.TIMESTAMP)); return this; } | /**
* Bind TIMESTAMPADD expression.
*
* @return The new top of the expression tree.
*
* @exception StandardException Thrown on error
*/ | Bind TIMESTAMPADD expression | timestampAddBind | {
"repo_name": "lpxz/grail-derby104",
"path": "java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java",
"license": "apache-2.0",
"size": 30919
} | [
"java.sql.Types",
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.reference.SQLState",
"org.apache.derby.iapi.types.DataTypeDescriptor",
"org.apache.derby.iapi.util.ReuseFactory"
] | import java.sql.Types; import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.reference.SQLState; import org.apache.derby.iapi.types.DataTypeDescriptor; import org.apache.derby.iapi.util.ReuseFactory; | import java.sql.*; import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.reference.*; import org.apache.derby.iapi.types.*; import org.apache.derby.iapi.util.*; | [
"java.sql",
"org.apache.derby"
] | java.sql; org.apache.derby; | 1,274,831 |
EAttribute getMedium_Name(); | EAttribute getMedium_Name(); | /**
* Returns the meta object for the attribute '{@link turnus.model.architecture.Medium#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Name</em>'.
* @see turnus.model.architecture.Medium#getName()
* @see #getMedium()
* @generated
*/ | Returns the meta object for the attribute '<code>turnus.model.architecture.Medium#getName Name</code>'. | getMedium_Name | {
"repo_name": "turnus/turnus",
"path": "turnus.model/src/turnus/model/architecture/ArchitecturePackage.java",
"license": "gpl-3.0",
"size": 44474
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,873,955 |
public static boolean canProduceEmptyMatches(final Pattern<?, ?> pattern) {
NFAFactoryCompiler<?> compiler = new NFAFactoryCompiler<>(checkNotNull(pattern));
compiler.compileFactory();
State<?> startState = compiler.getStates().stream().filter(State::isStart).findFirst().orElseThrow(
() -> new IllegalStateException("Compiler produced no start state. It is a bug. File a jira."));
Set<State<?>> visitedStates = new HashSet<>();
final Stack<State<?>> statesToCheck = new Stack<>();
statesToCheck.push(startState);
while (!statesToCheck.isEmpty()) {
final State<?> currentState = statesToCheck.pop();
if (visitedStates.contains(currentState)) {
continue;
} else {
visitedStates.add(currentState);
}
for (StateTransition<?> transition : currentState.getStateTransitions()) {
if (transition.getAction() == StateTransitionAction.PROCEED) {
if (transition.getTargetState().isFinal()) {
return true;
} else {
statesToCheck.push(transition.getTargetState());
}
}
}
}
return false;
}
static class NFAFactoryCompiler<T> {
private final NFAStateNameHandler stateNameHandler = new NFAStateNameHandler();
private final Map<String, State<T>> stopStates = new HashMap<>();
private final List<State<T>> states = new ArrayList<>();
private Optional<Long> windowTime;
private GroupPattern<T, ?> currentGroupPattern;
private Map<GroupPattern<T, ?>, Boolean> firstOfLoopMap = new HashMap<>();
private Pattern<T, ?> currentPattern;
private Pattern<T, ?> followingPattern;
private final AfterMatchSkipStrategy afterMatchSkipStrategy;
private Map<String, State<T>> originalStateMap = new HashMap<>();
NFAFactoryCompiler(final Pattern<T, ?> pattern) {
this.currentPattern = pattern;
afterMatchSkipStrategy = pattern.getAfterMatchSkipStrategy();
windowTime = Optional.empty();
} | static boolean function(final Pattern<?, ?> pattern) { NFAFactoryCompiler<?> compiler = new NFAFactoryCompiler<>(checkNotNull(pattern)); compiler.compileFactory(); State<?> startState = compiler.getStates().stream().filter(State::isStart).findFirst().orElseThrow( () -> new IllegalStateException(STR)); Set<State<?>> visitedStates = new HashSet<>(); final Stack<State<?>> statesToCheck = new Stack<>(); statesToCheck.push(startState); while (!statesToCheck.isEmpty()) { final State<?> currentState = statesToCheck.pop(); if (visitedStates.contains(currentState)) { continue; } else { visitedStates.add(currentState); } for (StateTransition<?> transition : currentState.getStateTransitions()) { if (transition.getAction() == StateTransitionAction.PROCEED) { if (transition.getTargetState().isFinal()) { return true; } else { statesToCheck.push(transition.getTargetState()); } } } } return false; } static class NFAFactoryCompiler<T> { private final NFAStateNameHandler stateNameHandler = new NFAStateNameHandler(); private final Map<String, State<T>> stopStates = new HashMap<>(); private final List<State<T>> states = new ArrayList<>(); private Optional<Long> windowTime; private GroupPattern<T, ?> currentGroupPattern; private Map<GroupPattern<T, ?>, Boolean> firstOfLoopMap = new HashMap<>(); private Pattern<T, ?> currentPattern; private Pattern<T, ?> followingPattern; private final AfterMatchSkipStrategy afterMatchSkipStrategy; private Map<String, State<T>> originalStateMap = new HashMap<>(); NFAFactoryCompiler(final Pattern<T, ?> pattern) { this.currentPattern = pattern; afterMatchSkipStrategy = pattern.getAfterMatchSkipStrategy(); windowTime = Optional.empty(); } | /**
* Verifies if the provided pattern can possibly generate empty match. Example of patterns that can possibly
* generate empty matches are: A*, A?, A* B? etc.
*
* @param pattern pattern to check
* @return true if empty match could potentially match the pattern, false otherwise
*/ | Verifies if the provided pattern can possibly generate empty match. Example of patterns that can possibly generate empty matches are: A*, A?, A* B? etc | canProduceEmptyMatches | {
"repo_name": "hequn8128/flink",
"path": "flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFACompiler.java",
"license": "apache-2.0",
"size": 36644
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.HashSet",
"java.util.List",
"java.util.Map",
"java.util.Optional",
"java.util.Set",
"java.util.Stack",
"org.apache.flink.cep.nfa.State",
"org.apache.flink.cep.nfa.StateTransition",
"org.apache.flink.cep.nfa.StateTransitionAction",
"org.apache.flink.cep.nfa.aftermatch.AfterMatchSkipStrategy",
"org.apache.flink.cep.pattern.GroupPattern",
"org.apache.flink.cep.pattern.Pattern"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.Stack; import org.apache.flink.cep.nfa.State; import org.apache.flink.cep.nfa.StateTransition; import org.apache.flink.cep.nfa.StateTransitionAction; import org.apache.flink.cep.nfa.aftermatch.AfterMatchSkipStrategy; import org.apache.flink.cep.pattern.GroupPattern; import org.apache.flink.cep.pattern.Pattern; | import java.util.*; import org.apache.flink.cep.nfa.*; import org.apache.flink.cep.nfa.aftermatch.*; import org.apache.flink.cep.pattern.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 1,821,773 |
public GeoDistanceSortBuilder points(GeoPoint... points) {
this.points.addAll(Arrays.asList(points));
return this;
} | GeoDistanceSortBuilder function(GeoPoint... points) { this.points.addAll(Arrays.asList(points)); return this; } | /**
* The point to create the range distance facets from.
*
* @param points reference points.
*/ | The point to create the range distance facets from | points | {
"repo_name": "fernandozhu/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java",
"license": "apache-2.0",
"size": 24980
} | [
"java.util.Arrays",
"org.elasticsearch.common.geo.GeoPoint"
] | import java.util.Arrays; import org.elasticsearch.common.geo.GeoPoint; | import java.util.*; import org.elasticsearch.common.geo.*; | [
"java.util",
"org.elasticsearch.common"
] | java.util; org.elasticsearch.common; | 2,151,330 |
public static String asString(IBinding binding) {
if (binding instanceof IMethodBinding)
return asString((IMethodBinding)binding);
else if (binding instanceof ITypeBinding)
return ((ITypeBinding)binding).getQualifiedName();
else if (binding instanceof IVariableBinding)
return asString((IVariableBinding)binding);
return binding.toString();
} | static String function(IBinding binding) { if (binding instanceof IMethodBinding) return asString((IMethodBinding)binding); else if (binding instanceof ITypeBinding) return ((ITypeBinding)binding).getQualifiedName(); else if (binding instanceof IVariableBinding) return asString((IVariableBinding)binding); return binding.toString(); } | /**
* Note: this method is for debugging and testing purposes only.
* There are tests whose pre-computed test results rely on the returned String's format.
* @param binding the binding
* @return a string representation of given binding
* @see org.eclipse.jdt.internal.ui.viewsupport.BindingLabelProvider
*/ | Note: this method is for debugging and testing purposes only. There are tests whose pre-computed test results rely on the returned String's format | asString | {
"repo_name": "kumattau/JDTPatch",
"path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/internal/corext/dom/Bindings.java",
"license": "epl-1.0",
"size": 61660
} | [
"org.eclipse.jdt.core.dom.IBinding",
"org.eclipse.jdt.core.dom.IMethodBinding",
"org.eclipse.jdt.core.dom.ITypeBinding",
"org.eclipse.jdt.core.dom.IVariableBinding"
] | import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.IVariableBinding; | import org.eclipse.jdt.core.dom.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 527,403 |
public CategoryLocalService getCategoryLocalService() {
return categoryLocalService;
} | CategoryLocalService function() { return categoryLocalService; } | /**
* Returns the category local service.
*
* @return the category local service
*/ | Returns the category local service | getCategoryLocalService | {
"repo_name": "fraunhoferfokus/govapps",
"path": "data-portlet/src/main/java/de/fraunhofer/fokus/movepla/service/base/CategoryLocalServiceBaseImpl.java",
"license": "bsd-3-clause",
"size": 42077
} | [
"de.fraunhofer.fokus.movepla.service.CategoryLocalService"
] | import de.fraunhofer.fokus.movepla.service.CategoryLocalService; | import de.fraunhofer.fokus.movepla.service.*; | [
"de.fraunhofer.fokus"
] | de.fraunhofer.fokus; | 2,022,481 |
void checkAttributesSyntax(PerunSession sess, Vo vo, List<Attribute> attributes) throws WrongAttributeValueException, WrongAttributeAssignmentException; | void checkAttributesSyntax(PerunSession sess, Vo vo, List<Attribute> attributes) throws WrongAttributeValueException, WrongAttributeAssignmentException; | /**
* Batch version of checkAttributeSyntax
* @throws WrongAttributeValueException if any of attributes values has wrong/illegal syntax
* @see cz.metacentrum.perun.core.api.AttributesManager#checkAttributeSyntax(PerunSession,Vo,Attribute)
*/ | Batch version of checkAttributeSyntax | checkAttributesSyntax | {
"repo_name": "zlamalp/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/AttributesManagerBl.java",
"license": "bsd-2-clause",
"size": 244560
} | [
"cz.metacentrum.perun.core.api.Attribute",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.Vo",
"cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException",
"cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException",
"java.util.List"
] | import cz.metacentrum.perun.core.api.Attribute; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.Vo; import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException; import cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException; import java.util.List; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 1,814,118 |
protected String toJSONFragment() {
StringBuffer json = new StringBuffer();
boolean first = true;
if (isSetOrder()) {
if (!first) json.append(", ");
json.append("\"Order\" : [");
java.util.List<Order> orderList = getOrder();
int orderListIndex = 0;
for (Order order : orderList) {
if (orderListIndex > 0) json.append(", ");
json.append("{");
json.append("");
json.append(order.toJSONFragment());
json.append("}");
first = false;
++orderListIndex;
}
json.append("]");
}
return json.toString();
} | String function() { StringBuffer json = new StringBuffer(); boolean first = true; if (isSetOrder()) { if (!first) json.append(STR); json.append("\"Order\STR); java.util.List<Order> orderList = getOrder(); int orderListIndex = 0; for (Order order : orderList) { if (orderListIndex > 0) json.append(STR); json.append("{"); json.append(STR}STR]"); } return json.toString(); } | /**
*
* JSON fragment representation of this object
*
* @return JSON fragment for this object. Name for outer
* object expected to be set by calling method. This fragment
* returns inner properties representation only
*
*/ | JSON fragment representation of this object | toJSONFragment | {
"repo_name": "VDuda/SyncRunner-Pub",
"path": "src/API/amazon/mws/orders/model/OrderList.java",
"license": "mit",
"size": 6522
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,677,035 |
public boolean handleActivityResult( int requestCode, int resultCode, Intent data );
| boolean function( int requestCode, int resultCode, Intent data ); | /**
* this method is called when the Commander can't find what to do with an activity result
*/ | this method is called when the Commander can't find what to do with an activity result | handleActivityResult | {
"repo_name": "svn2github/ghostcommander",
"path": "src/com/ghostsq/commander/adapters/CommanderAdapter.java",
"license": "gpl-3.0",
"size": 13932
} | [
"android.content.Intent"
] | import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 133,124 |
public void getBySiteId(String siteId, ITApiCallback<ITActivityKeys> callback) {
mService.getBySite(siteId, true).enqueue(new ProxyCallback<>(callback));
} | void function(String siteId, ITApiCallback<ITActivityKeys> callback) { mService.getBySite(siteId, true).enqueue(new ProxyCallback<>(callback)); } | /**
* Retrieves the activities of a given site by Intent Id. The callback returns the activity keys.
*
* @param siteId the ITSite's Intent id
*/ | Retrieves the activities of a given site by Intent Id. The callback returns the activity keys | getBySiteId | {
"repo_name": "INTENT-TECHNOLOGIES/SDK-Android",
"path": "sdk/android-sdk/src/main/java/eu/intent/sdk/api/ITActivityApi.java",
"license": "apache-2.0",
"size": 4489
} | [
"eu.intent.sdk.api.internal.ProxyCallback",
"eu.intent.sdk.model.ITActivityKeys"
] | import eu.intent.sdk.api.internal.ProxyCallback; import eu.intent.sdk.model.ITActivityKeys; | import eu.intent.sdk.api.internal.*; import eu.intent.sdk.model.*; | [
"eu.intent.sdk"
] | eu.intent.sdk; | 1,937,848 |
public void close() {
closeAndNotify();
player.send(new CloseInterfaceEvent());
} | void function() { closeAndNotify(); player.send(new CloseInterfaceEvent()); } | /**
* Closes the current open interface(s).
*/ | Closes the current open interface(s) | close | {
"repo_name": "DealerNextDoor/ApolloDev",
"path": "src/org/apollo/game/model/inter/InterfaceSet.java",
"license": "isc",
"size": 4694
} | [
"org.apollo.game.event.impl.CloseInterfaceEvent"
] | import org.apollo.game.event.impl.CloseInterfaceEvent; | import org.apollo.game.event.impl.*; | [
"org.apollo.game"
] | org.apollo.game; | 882,954 |
public String[] getQuorumPeers() {
List<String> l = new ArrayList<String>();
synchronized (this) {
if (leader != null) {
for (LearnerHandler fh : leader.getLearners()) {
if (fh.getSocket() != null) {
String s = fh.getSocket().getRemoteSocketAddress().toString();
if (leader.isLearnerSynced(fh))
s += "*";
l.add(s);
}
}
} else if (follower != null) {
l.add(follower.sock.getRemoteSocketAddress().toString());
}
}
return l.toArray(new String[0]);
} | String[] function() { List<String> l = new ArrayList<String>(); synchronized (this) { if (leader != null) { for (LearnerHandler fh : leader.getLearners()) { if (fh.getSocket() != null) { String s = fh.getSocket().getRemoteSocketAddress().toString(); if (leader.isLearnerSynced(fh)) s += "*"; l.add(s); } } } else if (follower != null) { l.add(follower.sock.getRemoteSocketAddress().toString()); } } return l.toArray(new String[0]); } | /**
* Only used by QuorumStats at the moment
*/ | Only used by QuorumStats at the moment | getQuorumPeers | {
"repo_name": "QuickClaim/Services",
"path": "src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java",
"license": "apache-2.0",
"size": 63258
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 999,237 |
public T create(T entity) {
EntityManager em = getEm();
EntityTransaction transaction = em.getTransaction();
transaction.begin();
em.persist(entity);
transaction.commit();
em.close();
return entity;
} | T function(T entity) { EntityManager em = getEm(); EntityTransaction transaction = em.getTransaction(); transaction.begin(); em.persist(entity); transaction.commit(); em.close(); return entity; } | /**
* Saves a given entity. Use the returned instance for further operations.
*
* @param entity The entity
* @return the saved entity
*/ | Saves a given entity. Use the returned instance for further operations | create | {
"repo_name": "TwilioDevEd/call-tracking-servlets",
"path": "src/main/java/com/twilio/calltracking/repositories/Repository.java",
"license": "mit",
"size": 3378
} | [
"javax.persistence.EntityManager",
"javax.persistence.EntityTransaction"
] | import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 1,397,162 |
public int getForce(JVector3d aForce) {
aForce = getPrevForce();
return (0);
} | int function(JVector3d aForce) { aForce = getPrevForce(); return (0); } | /**
* Read a sensed force [N] from the haptic device.
* @param aForce
* @return
*/ | Read a sensed force [N] from the haptic device | getForce | {
"repo_name": "jchai3d/jchai3d",
"path": "src/main/java/org/jchai3d/devices/JGenericHapticDevice.java",
"license": "gpl-2.0",
"size": 24927
} | [
"org.jchai3d.math.JVector3d"
] | import org.jchai3d.math.JVector3d; | import org.jchai3d.math.*; | [
"org.jchai3d.math"
] | org.jchai3d.math; | 927,930 |
public List<Tuple3<FieldsTaxonomicGrouping, FieldsIsRepresentedBy, FieldsObservationalUnit>> getRelationshipIsRepresentedBy(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException {
List<Object> args = new ArrayList<Object>();
args.add(ids);
args.add(fromFields);
args.add(relFields);
args.add(toFields);
TypeReference<List<List<Tuple3<FieldsTaxonomicGrouping, FieldsIsRepresentedBy, FieldsObservationalUnit>>>> retType = new TypeReference<List<List<Tuple3<FieldsTaxonomicGrouping, FieldsIsRepresentedBy, FieldsObservationalUnit>>>>() {};
List<List<Tuple3<FieldsTaxonomicGrouping, FieldsIsRepresentedBy, FieldsObservationalUnit>>> res = caller.jsonrpcCall("CDMI_EntityAPI.get_relationship_IsRepresentedBy", args, retType, true, false);
return res.get(0);
} | List<Tuple3<FieldsTaxonomicGrouping, FieldsIsRepresentedBy, FieldsObservationalUnit>> function(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(ids); args.add(fromFields); args.add(relFields); args.add(toFields); TypeReference<List<List<Tuple3<FieldsTaxonomicGrouping, FieldsIsRepresentedBy, FieldsObservationalUnit>>>> retType = new TypeReference<List<List<Tuple3<FieldsTaxonomicGrouping, FieldsIsRepresentedBy, FieldsObservationalUnit>>>>() {}; List<List<Tuple3<FieldsTaxonomicGrouping, FieldsIsRepresentedBy, FieldsObservationalUnit>>> res = caller.jsonrpcCall(STR, args, retType, true, false); return res.get(0); } | /**
* <p>Original spec-file function name: get_relationship_IsRepresentedBy</p>
* <pre>
* This relationship associates observational units with a genus,
* species, strain, and/or variety that was the source material.
* It has the following fields:
* =over 4
* =back
* </pre>
* @param ids instance of list of String
* @param fromFields instance of list of String
* @param relFields instance of list of String
* @param toFields instance of list of String
* @return instance of list of tuple of size 3: type {@link us.kbase.cdmientityapi.FieldsTaxonomicGrouping FieldsTaxonomicGrouping} (original type "fields_TaxonomicGrouping"), type {@link us.kbase.cdmientityapi.FieldsIsRepresentedBy FieldsIsRepresentedBy} (original type "fields_IsRepresentedBy"), type {@link us.kbase.cdmientityapi.FieldsObservationalUnit FieldsObservationalUnit} (original type "fields_ObservationalUnit")
* @throws IOException if an IO exception occurs
* @throws JsonClientException if a JSON RPC exception occurs
*/ | Original spec-file function name: get_relationship_IsRepresentedBy <code> This relationship associates observational units with a genus, species, strain, and/or variety that was the source material. It has the following fields: =over 4 =back </code> | getRelationshipIsRepresentedBy | {
"repo_name": "kbase/trees",
"path": "src/us/kbase/cdmientityapi/CDMIEntityAPIClient.java",
"license": "mit",
"size": 869221
} | [
"com.fasterxml.jackson.core.type.TypeReference",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"us.kbase.common.service.JsonClientException",
"us.kbase.common.service.Tuple3"
] | import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; import java.util.ArrayList; import java.util.List; import us.kbase.common.service.JsonClientException; import us.kbase.common.service.Tuple3; | import com.fasterxml.jackson.core.type.*; import java.io.*; import java.util.*; import us.kbase.common.service.*; | [
"com.fasterxml.jackson",
"java.io",
"java.util",
"us.kbase.common"
] | com.fasterxml.jackson; java.io; java.util; us.kbase.common; | 1,967,702 |
void flush() throws IOException; | void flush() throws IOException; | /**
* Flush the unwritten content to the current output.
*/ | Flush the unwritten content to the current output | flush | {
"repo_name": "praveev/druid",
"path": "processing/src/main/java/io/druid/segment/data/CompressionFactory.java",
"license": "apache-2.0",
"size": 13000
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,441,905 |
public PrintWriter getLogWriter() throws ResourceException
{
if (ActiveMQRAManagedConnectionFactory.trace)
{
ActiveMQRALogger.LOGGER.trace("getLogWriter()");
}
return null;
} | PrintWriter function() throws ResourceException { if (ActiveMQRAManagedConnectionFactory.trace) { ActiveMQRALogger.LOGGER.trace(STR); } return null; } | /**
* Get the log writer -- NOT SUPPORTED
*
* @return The writer
* @throws ResourceException Thrown if the writer can't be retrieved
*/ | Get the log writer -- NOT SUPPORTED | getLogWriter | {
"repo_name": "ryanemerson/activemq-artemis",
"path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java",
"license": "apache-2.0",
"size": 22050
} | [
"java.io.PrintWriter",
"javax.resource.ResourceException"
] | import java.io.PrintWriter; import javax.resource.ResourceException; | import java.io.*; import javax.resource.*; | [
"java.io",
"javax.resource"
] | java.io; javax.resource; | 650,588 |
Integer tKey = event.getTime();
//Get events scheduled for the same time
Set<Event<?>> evtSet = this.events.get(tKey);
//No event already scheduled for the given time
if(evtSet == null){
//Create a new event set and add the event
Set<Event<?>> eventSet = new HashSet<Event<?>>();
eventSet.add(event);
this.events.put(new Integer(tKey), eventSet);
//Event set for the same time already exist
} else {
//Add the new event
evtSet.add(event);
}
return tKey;
} | Integer tKey = event.getTime(); Set<Event<?>> evtSet = this.events.get(tKey); if(evtSet == null){ Set<Event<?>> eventSet = new HashSet<Event<?>>(); eventSet.add(event); this.events.put(new Integer(tKey), eventSet); } else { evtSet.add(event); } return tKey; } | /**
* Add (schedule) a new event
*
* @param event to be added
* @return event key (global time value)
*/ | Add (schedule) a new event | add | {
"repo_name": "pcjesus/NetworkSimulator",
"path": "src/msm/simulator/ScheduledEvents.java",
"license": "mit",
"size": 6167
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,864,262 |
public String process() {
//Update Event
Event event = eventHandler.updateEvent(userId, eventId, title, date, location, description);
//send notification
if (event != null) {
//TODO
}
//Return new event/error response
JsonObject jo = new JsonObject();
if (event == null) {
jo.addProperty(Command.SUCCES_VAR, false);
if (eventUserHandler.isAdmin(userId, eventId)) {
jo.addProperty(Command.ERROR_VAR, Command.INT_ERROR);
} else {
jo.addProperty(Command.ERROR_VAR, Command.ADMIN_ERROR);
}
} else {
jo = event.serialize();
jo.addProperty(Command.SUCCES_VAR, true);
}
return jo.toString();
}
| String function() { Event event = eventHandler.updateEvent(userId, eventId, title, date, location, description); if (event != null) { } JsonObject jo = new JsonObject(); if (event == null) { jo.addProperty(Command.SUCCES_VAR, false); if (eventUserHandler.isAdmin(userId, eventId)) { jo.addProperty(Command.ERROR_VAR, Command.INT_ERROR); } else { jo.addProperty(Command.ERROR_VAR, Command.ADMIN_ERROR); } } else { jo = event.serialize(); jo.addProperty(Command.SUCCES_VAR, true); } return jo.toString(); } | /**
* Updates the event. Checks if the user is an admin of the event. Afterwards, sends a notification to all
* members of the event. The returned String specifies if the operation was successful or not.
*/ | Updates the event. Checks if the user is an admin of the event. Afterwards, sends a notification to all members of the event. The returned String specifies if the operation was successful or not | process | {
"repo_name": "JohannesCox/GOApp_Server",
"path": "src/main/java/requestHandler/commands/UpdateEventCommand.java",
"license": "mit",
"size": 2812
} | [
"com.google.gson.JsonObject"
] | import com.google.gson.JsonObject; | import com.google.gson.*; | [
"com.google.gson"
] | com.google.gson; | 2,604,307 |
public void setStringConversionColumn(int stringConversionColumn) {
mStringConversionColumn = stringConversionColumn;
}
/**
* Returns the converter used to convert the filtering Cursor
* into a String.
*
* @return null if the converter does not exist or an instance of
* {@link android.widget.SimpleCursorAdapter.CursorToStringConverter} | void function(int stringConversionColumn) { mStringConversionColumn = stringConversionColumn; } /** * Returns the converter used to convert the filtering Cursor * into a String. * * @return null if the converter does not exist or an instance of * {@link android.widget.SimpleCursorAdapter.CursorToStringConverter} | /**
* Defines the index of the column in the Cursor used to get a String
* representation of that Cursor. The column is used to convert the
* Cursor to a String only when the current CursorToStringConverter
* is null.
*
* @param stringConversionColumn a valid index in the current Cursor or -1 to use the default
* conversion mechanism
*
* @see android.widget.CursorAdapter#convertToString(android.database.Cursor)
* @see #getStringConversionColumn()
* @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter)
* @see #getCursorToStringConverter()
*/ | Defines the index of the column in the Cursor used to get a String representation of that Cursor. The column is used to convert the Cursor to a String only when the current CursorToStringConverter is null | setStringConversionColumn | {
"repo_name": "brian512/Helper",
"path": "src/com/mobeta/android/dslv/SimpleDragSortCursorAdapter.java",
"license": "epl-1.0",
"size": 17060
} | [
"android.database.Cursor"
] | import android.database.Cursor; | import android.database.*; | [
"android.database"
] | android.database; | 2,007,738 |
public Set<? extends MvcEndpoint> getEndpoints() {
return new HashSet<MvcEndpoint>(this.endpoints);
} | Set<? extends MvcEndpoint> function() { return new HashSet<MvcEndpoint>(this.endpoints); } | /**
* Return the endpoints
* @return the endpoints
*/ | Return the endpoints | getEndpoints | {
"repo_name": "jorgepgjr/spring-boot",
"path": "spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java",
"license": "apache-2.0",
"size": 5751
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,013,729 |
@Test
void testStopAttack()
{
canAttack.set(true);
attacker.setAttackChecker(t -> canAttack.get());
attacker.setAttackDistance(new Range(0, 2));
final Transformable target = new TransformableModel(services, setup);
target.teleport(1, 1);
attacker.attack(target);
attacker.update(1.0);
attacker.update(1.0);
assertTrue(attacker.isAttacking());
attacker.stopAttack();
assertTrue(attacker.isAttacking());
attacker.update(1.0);
assertFalse(attacker.isAttacking());
}
| void testStopAttack() { canAttack.set(true); attacker.setAttackChecker(t -> canAttack.get()); attacker.setAttackDistance(new Range(0, 2)); final Transformable target = new TransformableModel(services, setup); target.teleport(1, 1); attacker.attack(target); attacker.update(1.0); attacker.update(1.0); assertTrue(attacker.isAttacking()); attacker.stopAttack(); assertTrue(attacker.isAttacking()); attacker.update(1.0); assertFalse(attacker.isAttacking()); } | /**
* Test the stop attack.
*/ | Test the stop attack | testStopAttack | {
"repo_name": "b3dgs/lionengine",
"path": "lionengine-game/src/test/java/com/b3dgs/lionengine/game/feature/attackable/AttackerModelTest.java",
"license": "gpl-3.0",
"size": 13911
} | [
"com.b3dgs.lionengine.Range",
"com.b3dgs.lionengine.UtilAssert",
"com.b3dgs.lionengine.game.feature.Transformable",
"com.b3dgs.lionengine.game.feature.TransformableModel"
] | import com.b3dgs.lionengine.Range; import com.b3dgs.lionengine.UtilAssert; import com.b3dgs.lionengine.game.feature.Transformable; import com.b3dgs.lionengine.game.feature.TransformableModel; | import com.b3dgs.lionengine.*; import com.b3dgs.lionengine.game.feature.*; | [
"com.b3dgs.lionengine"
] | com.b3dgs.lionengine; | 1,427,452 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.