method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public static AlluxioBlockStore create(FileSystemContext context) { return new AlluxioBlockStore(context, NetworkAddressUtils.getClientHostName()); } public AlluxioBlockStore(FileSystemContext context, String localHostName) { mContext = context; mLocalHostName = localHostName; mRandom = new Random(); }
static AlluxioBlockStore function(FileSystemContext context) { return new AlluxioBlockStore(context, NetworkAddressUtils.getClientHostName()); } public AlluxioBlockStore(FileSystemContext context, String localHostName) { mContext = context; mLocalHostName = localHostName; mRandom = new Random(); }
/** * Creates an Alluxio block store with default local hostname. * * @param context the file system context * @return the {@link AlluxioBlockStore} created */
Creates an Alluxio block store with default local hostname
create
{ "repo_name": "jsimsa/alluxio", "path": "core/client/fs/src/main/java/alluxio/client/block/AlluxioBlockStore.java", "license": "apache-2.0", "size": 10565 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
2,517,491
// Pass the call callcontext used to create the subscription event public void checkSubscriptionEventCreated(final UUID bundleId, final UUID subscriptionEventId, final CallContext context) { final List<AuditLog> auditLogsForSubscriptionEvent = getAuditLogsForSubscriptionEvent(bundleId, subscriptionEventId, context); Assert.assertEquals(auditLogsForSubscriptionEvent.size(), 1); checkAuditLog(ChangeType.INSERT, context, auditLogsForSubscriptionEvent.get(0), subscriptionEventId, SubscriptionEventSqlDao.class, false, true); }
void function(final UUID bundleId, final UUID subscriptionEventId, final CallContext context) { final List<AuditLog> auditLogsForSubscriptionEvent = getAuditLogsForSubscriptionEvent(bundleId, subscriptionEventId, context); Assert.assertEquals(auditLogsForSubscriptionEvent.size(), 1); checkAuditLog(ChangeType.INSERT, context, auditLogsForSubscriptionEvent.get(0), subscriptionEventId, SubscriptionEventSqlDao.class, false, true); }
/** * ******************************************** SUBSCRIPTION EVENTS ******************************************************* */
SUBSCRIPTION EVENTS
checkSubscriptionEventCreated
{ "repo_name": "liqianggao/killbill", "path": "beatrix/src/test/java/org/killbill/billing/beatrix/util/AuditChecker.java", "license": "apache-2.0", "size": 14941 }
[ "java.util.List", "org.killbill.billing.subscription.engine.dao.SubscriptionEventSqlDao", "org.killbill.billing.util.audit.AuditLog", "org.killbill.billing.util.audit.ChangeType", "org.killbill.billing.util.callcontext.CallContext", "org.testng.Assert" ]
import java.util.List; import org.killbill.billing.subscription.engine.dao.SubscriptionEventSqlDao; import org.killbill.billing.util.audit.AuditLog; import org.killbill.billing.util.audit.ChangeType; import org.killbill.billing.util.callcontext.CallContext; import org.testng.Assert;
import java.util.*; import org.killbill.billing.subscription.engine.dao.*; import org.killbill.billing.util.audit.*; import org.killbill.billing.util.callcontext.*; import org.testng.*;
[ "java.util", "org.killbill.billing", "org.testng" ]
java.util; org.killbill.billing; org.testng;
1,560,880
public ThreadStatusMsg getThreadStatus() { return this.threadStatus; }
ThreadStatusMsg function() { return this.threadStatus; }
/** * Return the internal status object, this allows methods that perform updates to be passed the status object * and not the entire thread. * * @return thread status object */
Return the internal status object, this allows methods that perform updates to be passed the status object and not the entire thread
getThreadStatus
{ "repo_name": "chetrebman/fedoraApp", "path": "src/edu/du/penrose/systems/fedoraApp/batchIngest/bus/BatchThreadHolder.java", "license": "gpl-3.0", "size": 4666 }
[ "edu.du.penrose.systems.fedoraApp.batchIngest.data.ThreadStatusMsg" ]
import edu.du.penrose.systems.fedoraApp.batchIngest.data.ThreadStatusMsg;
import edu.du.penrose.systems.*;
[ "edu.du.penrose" ]
edu.du.penrose;
1,649,736
public Object getParameter(String name) throws DOMException { if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)) { return ((fFeatures & COMMENTS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)) { return ((fFeatures & CDATA) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)) { return ((fFeatures & ENTITIES) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)) { return ((fFeatures & NAMESPACES) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)) { return ((fFeatures & NAMESPACEDECLS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)) { return ((fFeatures & SPLITCDATA) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)) { return ((fFeatures & WELLFORMED) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)) { return ((fFeatures & DISCARDDEFAULT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) { return ((fFeatures & XMLDECL) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) { return ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { return Boolean.TRUE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) { return Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)){ if ((fFeatures & ENTITIES) == 0 && (fFeatures & CDATA) == 0 && (fFeatures & ELEM_CONTENT_WHITESPACE) != 0 && (fFeatures & NAMESPACES) != 0 && (fFeatures & NAMESPACEDECLS) != 0 && (fFeatures & WELLFORMED) != 0 && (fFeatures & COMMENTS) != 0) { return Boolean.TRUE; } return Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER)) { return fDOMErrorHandler; } else if ( name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) { return null; } else { // Here we have to add the Xalan specific DOM Message Formatter String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_FOUND, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } }
Object function(String name) throws DOMException { if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)) { return ((fFeatures & COMMENTS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)) { return ((fFeatures & CDATA) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)) { return ((fFeatures & ENTITIES) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)) { return ((fFeatures & NAMESPACES) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)) { return ((fFeatures & NAMESPACEDECLS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)) { return ((fFeatures & SPLITCDATA) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)) { return ((fFeatures & WELLFORMED) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)) { return ((fFeatures & DISCARDDEFAULT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) { return ((fFeatures & XMLDECL) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) { return ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { return Boolean.TRUE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) { return Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)){ if ((fFeatures & ENTITIES) == 0 && (fFeatures & CDATA) == 0 && (fFeatures & ELEM_CONTENT_WHITESPACE) != 0 && (fFeatures & NAMESPACES) != 0 && (fFeatures & NAMESPACEDECLS) != 0 && (fFeatures & WELLFORMED) != 0 && (fFeatures & COMMENTS) != 0) { return Boolean.TRUE; } return Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER)) { return fDOMErrorHandler; } else if ( name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION) name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) { return null; } else { String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_FOUND, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } }
/** * This method returns the value of a parameter if known. * * @see org.w3c.dom.DOMConfiguration#getParameter(java.lang.String) * * @param name A String containing the DOMConfiguration parameter name * whose value is to be returned. * @return Object The value of the parameter if known. */
This method returns the value of a parameter if known
getParameter
{ "repo_name": "mirego/j2objc", "path": "xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java", "license": "apache-2.0", "size": 74517 }
[ "org.apache.xml.serializer.utils.MsgKey", "org.apache.xml.serializer.utils.Utils", "org.w3c.dom.DOMException" ]
import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.w3c.dom.DOMException;
import org.apache.xml.serializer.utils.*; import org.w3c.dom.*;
[ "org.apache.xml", "org.w3c.dom" ]
org.apache.xml; org.w3c.dom;
966,470
public String getCdeBrowserUrl(Connection conn_);
String function(Connection conn_);
/** * Get the CDE Browser Url * * @param conn_ an existing database connection * @return the URL */
Get the CDE Browser Url
getCdeBrowserUrl
{ "repo_name": "NCIP/cadsr-sentinel", "path": "software/src/java/gov/nih/nci/cadsr/sentinel/database/DBAlert.java", "license": "bsd-3-clause", "size": 73851 }
[ "java.sql.Connection" ]
import java.sql.Connection;
import java.sql.*;
[ "java.sql" ]
java.sql;
572,852
public OutputStream getOutputStream(OutputStream out) throws IOException { if (!saslClient.isComplete()) { throw new IOException("Sasl authentication exchange hasn't completed yet"); } return new SaslOutputStream(out, saslClient); }
OutputStream function(OutputStream out) throws IOException { if (!saslClient.isComplete()) { throw new IOException(STR); } return new SaslOutputStream(out, saslClient); }
/** * Get a SASL wrapped OutputStream. Can be called only after saslConnect() has * been called. * * @param out * the OutputStream to wrap * @return a SASL wrapped OutputStream * @throws IOException */
Get a SASL wrapped OutputStream. Can be called only after saslConnect() has been called
getOutputStream
{ "repo_name": "throughsky/lywebank", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/security/HBaseSaslRpcClient.java", "license": "apache-2.0", "size": 12082 }
[ "java.io.IOException", "java.io.OutputStream", "org.apache.hadoop.security.SaslOutputStream" ]
import java.io.IOException; import java.io.OutputStream; import org.apache.hadoop.security.SaslOutputStream;
import java.io.*; import org.apache.hadoop.security.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,916,484
public static long copyAndClose(InputStream is, OutputStream os) throws IOException { try { final long retval = ByteStreams.copy(is, os); // Workarround for http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/759aa847dcaf os.flush(); return retval; } finally { is.close(); os.close(); } }
static long function(InputStream is, OutputStream os) throws IOException { try { final long retval = ByteStreams.copy(is, os); os.flush(); return retval; } finally { is.close(); os.close(); } }
/** * Copy from `is` to `os` and close the streams regardless of the result. * * @param is The `InputStream` to copy results from. It is closed * @param os The `OutputStream` to copy results to. It is closed * * @return The count of bytes written to `os` * * @throws IOException */
Copy from `is` to `os` and close the streams regardless of the result
copyAndClose
{ "repo_name": "jon-wei/java-util", "path": "src/main/java/com/metamx/common/StreamUtils.java", "license": "apache-2.0", "size": 6383 }
[ "com.google.common.io.ByteStreams", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream" ]
import com.google.common.io.ByteStreams; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
import com.google.common.io.*; import java.io.*;
[ "com.google.common", "java.io" ]
com.google.common; java.io;
1,946,088
public synchronized int countHolidayInRang(Calendar start, Calendar end) { int count = 0; fillHolidays(); for (Calendar data : this.holidays) { if (data.after(start) && data.before(end)) { count++; } } System.out.println("Количество праздинчных дней в отпуске: " + count); return count; }
synchronized int function(Calendar start, Calendar end) { int count = 0; fillHolidays(); for (Calendar data : this.holidays) { if (data.after(start) && data.before(end)) { count++; } } System.out.println(STR + count); return count; }
/** * counts holidays. * @param start - holiday start date * @param end - holiday end date * @return count */
counts holidays
countHolidayInRang
{ "repo_name": "dsaetgareev/junior", "path": "chapter_005/wait/src/main/java/ru/job4j/pool/Work.java", "license": "apache-2.0", "size": 4921 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
446,734
public void testAddAllIntName004() throws Exception { try { LdapName ln = new LdapName("t=test"); LdapName add = null; ln.addAll(1, add); fail("NPE expected"); } catch (NullPointerException e) {} }
void function() throws Exception { try { LdapName ln = new LdapName(STR); LdapName add = null; ln.addAll(1, add); fail(STR); } catch (NullPointerException e) {} }
/** * <p> * Test method for 'javax.naming.ldap.LdapName.addAll(int, Name)' * </p> * <p> * Here we are testing if this method correctly adds the components of the * given Name to an LdapName at the given index. * <p> * The expected result is an NullPointer Exception. * </p> */
Test method for 'javax.naming.ldap.LdapName.addAll(int, Name)' Here we are testing if this method correctly adds the components of the given Name to an LdapName at the given index. The expected result is an NullPointer Exception.
testAddAllIntName004
{ "repo_name": "freeVM/freeVM", "path": "enhanced/java/classlib/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java", "license": "apache-2.0", "size": 119091 }
[ "javax.naming.ldap.LdapName" ]
import javax.naming.ldap.LdapName;
import javax.naming.ldap.*;
[ "javax.naming" ]
javax.naming;
176,934
public static boolean containsEqualEntries(final Set<Pair> set1, final Set<Pair> set2) { if (set1 == null || set2 == null) { return false; } return Sets.difference(set1, set2).isEmpty(); }
static boolean function(final Set<Pair> set1, final Set<Pair> set2) { if (set1 == null set2 == null) { return false; } return Sets.difference(set1, set2).isEmpty(); }
/** * Checks if two maps contain the same entities * * @param set1 * @param set2 * @return */
Checks if two maps contain the same entities
containsEqualEntries
{ "repo_name": "dryazanov/mockenger", "path": "core/src/main/java/org/mockenger/core/util/CommonUtils.java", "license": "gpl-2.0", "size": 7042 }
[ "com.google.common.collect.Sets", "java.util.Set", "org.mockenger.data.model.persistent.mock.request.part.Pair", "org.springframework.util.StringUtils" ]
import com.google.common.collect.Sets; import java.util.Set; import org.mockenger.data.model.persistent.mock.request.part.Pair; import org.springframework.util.StringUtils;
import com.google.common.collect.*; import java.util.*; import org.mockenger.data.model.persistent.mock.request.part.*; import org.springframework.util.*;
[ "com.google.common", "java.util", "org.mockenger.data", "org.springframework.util" ]
com.google.common; java.util; org.mockenger.data; org.springframework.util;
1,556,860
public synchronized void sync() { if (needsSync && dataFile != null) { if (busyWriting) { forceSync = true; return; } try { //fileStreamOut.flush(); dataFile.sync(); syncCount++; } catch (IOException e) { Trace.printSystemOut("flush() or sync() error: " + e.toString()); } needsSync = false; forceSync = false; } }
synchronized void function() { if (needsSync && dataFile != null) { if (busyWriting) { forceSync = true; return; } try { dataFile.sync(); syncCount++; } catch (IOException e) { Trace.printSystemOut(STR + e.toString()); } needsSync = false; forceSync = false; } }
/** * Called internally or externally in write delay intervals. */
Called internally or externally in write delay intervals
sync
{ "repo_name": "jdrider/rhodes", "path": "platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptWriterBase.java", "license": "mit", "size": 14352 }
[ "java.io.IOException", "org.hsqldb.Trace" ]
import java.io.IOException; import org.hsqldb.Trace;
import java.io.*; import org.hsqldb.*;
[ "java.io", "org.hsqldb" ]
java.io; org.hsqldb;
650,676
public String serviceName_userLogs_login_changePassword_POST(String serviceName, String login, String password) throws IOException { String qPath = "/hosting/web/{serviceName}/userLogs/{login}/changePassword"; StringBuilder sb = path(qPath, serviceName, login); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "password", password); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, String.class); } /** * Get this object properties * * REST: GET /hosting/web/{serviceName}/userLogs/{login}
String function(String serviceName, String login, String password) throws IOException { String qPath = STR; StringBuilder sb = path(qPath, serviceName, login); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, STR, password); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, String.class); } /** * Get this object properties * * REST: GET /hosting/web/{serviceName}/userLogs/{login}
/** * Request a password change * * REST: POST /hosting/web/{serviceName}/userLogs/{login}/changePassword * @param password [required] The new userLogs password * @param serviceName [required] The internal name of your hosting * @param login [required] The userLogs login used to connect to logs.ovh.net */
Request a password change
serviceName_userLogs_login_changePassword_POST
{ "repo_name": "UrielCh/ovh-java-sdk", "path": "ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java", "license": "bsd-3-clause", "size": 99470 }
[ "java.io.IOException", "java.util.HashMap" ]
import java.io.IOException; import java.util.HashMap;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
318,198
void recomputeProgress() { if (isComplete()) { this.progress = 1; // update the counters and the state TaskStatus completedStatus = taskStatuses.get(getSuccessfulTaskid()); this.counters = completedStatus.getCounters(); this.state = completedStatus.getStateString(); } else if (failed) { this.progress = 0; // reset the counters and the state this.state = ""; this.counters = new Counters(); } else { double bestProgress = 0; String bestState = ""; Counters bestCounters = new Counters(); for (Iterator<TaskAttemptID> it = taskStatuses.keySet().iterator(); it.hasNext();) { TaskAttemptID taskid = it.next(); TaskStatus status = taskStatuses.get(taskid); if (status.getRunState() == TaskStatus.State.SUCCEEDED) { bestProgress = 1; bestState = status.getStateString(); bestCounters = status.getCounters(); break; } else if (status.getRunState() == TaskStatus.State.COMMIT_PENDING) { //for COMMIT_PENDING, we take the last state that we recorded //when the task was RUNNING bestProgress = this.progress; bestState = this.state; bestCounters = this.counters; } else if (status.getRunState() == TaskStatus.State.RUNNING) { if (status.getProgress() >= bestProgress) { bestProgress = status.getProgress(); bestState = status.getStateString(); if (status.getIncludeCounters()) { bestCounters = status.getCounters(); } else { bestCounters = this.counters; } } } } this.progress = bestProgress; this.state = bestState; this.counters = bestCounters; } } ///////////////////////////////////////////////// // "Action" methods that actually require the TIP // to do something. /////////////////////////////////////////////////
void recomputeProgress() { if (isComplete()) { this.progress = 1; TaskStatus completedStatus = taskStatuses.get(getSuccessfulTaskid()); this.counters = completedStatus.getCounters(); this.state = completedStatus.getStateString(); } else if (failed) { this.progress = 0; this.state = STR"; Counters bestCounters = new Counters(); for (Iterator<TaskAttemptID> it = taskStatuses.keySet().iterator(); it.hasNext();) { TaskAttemptID taskid = it.next(); TaskStatus status = taskStatuses.get(taskid); if (status.getRunState() == TaskStatus.State.SUCCEEDED) { bestProgress = 1; bestState = status.getStateString(); bestCounters = status.getCounters(); break; } else if (status.getRunState() == TaskStatus.State.COMMIT_PENDING) { bestProgress = this.progress; bestState = this.state; bestCounters = this.counters; } else if (status.getRunState() == TaskStatus.State.RUNNING) { if (status.getProgress() >= bestProgress) { bestProgress = status.getProgress(); bestState = status.getStateString(); if (status.getIncludeCounters()) { bestCounters = status.getCounters(); } else { bestCounters = this.counters; } } } } this.progress = bestProgress; this.state = bestState; this.counters = bestCounters; } }
/** * This method is called whenever there's a status change * for one of the TIP's sub-tasks. It recomputes the overall * progress for the TIP. We examine all sub-tasks and find * the one that's most advanced (and non-failed). */
This method is called whenever there's a status change for one of the TIP's sub-tasks. It recomputes the overall progress for the TIP. We examine all sub-tasks and find the one that's most advanced (and non-failed)
recomputeProgress
{ "repo_name": "IMCG/priter", "path": "src/mapred/org/apache/hadoop/mapred/TaskInProgress.java", "license": "apache-2.0", "size": 35902 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,012,972
public void registerProviderFreedListener(OnFreedListener onProviderFreedListener) { graph.registerProviderFreedListener(onProviderFreedListener); }
void function(OnFreedListener onProviderFreedListener) { graph.registerProviderFreedListener(onProviderFreedListener); }
/** * Register {@link OnFreedListener} which will be called when the last cached * instance of an injected contract is freed. * * @param onProviderFreedListener The listener */
Register <code>OnFreedListener</code> which will be called when the last cached instance of an injected contract is freed
registerProviderFreedListener
{ "repo_name": "tananrules/AndroidMvc", "path": "library/android-mvc-controller/src/main/java/com/shipdream/lib/android/mvc/MvcGraph.java", "license": "apache-2.0", "size": 15931 }
[ "com.shipdream.lib.poke.Provider" ]
import com.shipdream.lib.poke.Provider;
import com.shipdream.lib.poke.*;
[ "com.shipdream.lib" ]
com.shipdream.lib;
671,680
public BlockInstance getBlockInstanceAt(int index) { if (this.blockInstances == null) { return (null); } return (this.blockInstances.get(index)); }
BlockInstance function(int index) { if (this.blockInstances == null) { return (null); } return (this.blockInstances.get(index)); }
/** * get the block instance at the given location (relative to the terrain) */
get the block instance at the given location (relative to the terrain)
getBlockInstanceAt
{ "repo_name": "toss-dev/VoxelEngine", "path": "VoxelEngine/src/com/grillecube/common/world/terrain/WorldObjectTerrain.java", "license": "gpl-2.0", "size": 52402 }
[ "com.grillecube.common.world.block.instances.BlockInstance" ]
import com.grillecube.common.world.block.instances.BlockInstance;
import com.grillecube.common.world.block.instances.*;
[ "com.grillecube.common" ]
com.grillecube.common;
320,776
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Bundle reply = new Bundle(); Account kolabAccount = getKolabDroidAccount(context); if (kolabAccount != null) handler.sendEmptyMessage(0); else createKolabDroidAccount(context); return reply; }
Bundle function(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Bundle reply = new Bundle(); Account kolabAccount = getKolabDroidAccount(context); if (kolabAccount != null) handler.sendEmptyMessage(0); else createKolabDroidAccount(context); return reply; }
/** * {@inheritDoc} Check if a KolabAccount already exists. If this is the * case, we display an error since only one KolabAccount is supported * yet. If no KolabAccount exists, we create one. */
Check if a KolabAccount already exists. If this is the case, we display an error since only one KolabAccount is supported yet. If no KolabAccount exists, we create one
addAccount
{ "repo_name": "arthurzaczek/kolab-android", "path": "src/at/dasz/KolabDroid/Account/KolabAccountAuthenticatorService.java", "license": "gpl-3.0", "size": 5514 }
[ "android.accounts.Account", "android.accounts.AccountAuthenticatorResponse", "android.accounts.NetworkErrorException", "android.os.Bundle" ]
import android.accounts.Account; import android.accounts.AccountAuthenticatorResponse; import android.accounts.NetworkErrorException; import android.os.Bundle;
import android.accounts.*; import android.os.*;
[ "android.accounts", "android.os" ]
android.accounts; android.os;
2,112,818
public void testQueryWithoutEntityType() throws Exception { String configXml = "<multi-id-query />"; Element config = parse(configXml).getDocumentElement(); MultiIdQuery instance = MultiIdQuery.init(config); String xml = "<x><a id='1'/><a id='2'/><a id='3'/><b id='4'/><b id='5'/></x>"; Document doc = parse(xml); String[] array = { "1", "3", "5", "7" }; Map<String, String[]> params = Collections.singletonMap("id", array); List<Node> result = instance.query(doc, params); assertEquals(3, result.size()); NodeList nodeList = doc.getDocumentElement().getChildNodes(); List<Node> expResult = new LinkedList<Node>(); expResult.add(nodeList.item(0)); expResult.add(nodeList.item(2)); expResult.add(nodeList.item(4)); assertEquals(expResult, result); }
void function() throws Exception { String configXml = STR; Element config = parse(configXml).getDocumentElement(); MultiIdQuery instance = MultiIdQuery.init(config); String xml = STR; Document doc = parse(xml); String[] array = { "1", "3", "5", "7" }; Map<String, String[]> params = Collections.singletonMap("id", array); List<Node> result = instance.query(doc, params); assertEquals(3, result.size()); NodeList nodeList = doc.getDocumentElement().getChildNodes(); List<Node> expResult = new LinkedList<Node>(); expResult.add(nodeList.item(0)); expResult.add(nodeList.item(2)); expResult.add(nodeList.item(4)); assertEquals(expResult, result); }
/** * Test of query method, of class MultiIdQuery. */
Test of query method, of class MultiIdQuery
testQueryWithoutEntityType
{ "repo_name": "pfstrack/eldamo", "path": "src/test/java/xdb/query/MultiIdQueryTest.java", "license": "mit", "size": 2873 }
[ "java.util.Collections", "java.util.LinkedList", "java.util.List", "java.util.Map", "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import java.util.*; import org.w3c.dom.*;
[ "java.util", "org.w3c.dom" ]
java.util; org.w3c.dom;
2,907,093
public static void disableLocalizationServiceLogging() { Logger log = Logger.getLogger(LocalizationService.class); log.setLevel(Level.OFF); }
static void function() { Logger log = Logger.getLogger(LocalizationService.class); log.setLevel(Level.OFF); }
/** * Util for turning of the spew from the l10n service for * test cases that make calls with dummy string IDs. */
Util for turning of the spew from the l10n service for test cases that make calls with dummy string IDs
disableLocalizationServiceLogging
{ "repo_name": "ogajduse/spacewalk", "path": "java/code/src/com/redhat/rhn/testing/RhnBaseTestCase.java", "license": "gpl-2.0", "size": 9288 }
[ "com.redhat.rhn.common.localization.LocalizationService", "org.apache.log4j.Level", "org.apache.log4j.Logger" ]
import com.redhat.rhn.common.localization.LocalizationService; import org.apache.log4j.Level; import org.apache.log4j.Logger;
import com.redhat.rhn.common.localization.*; import org.apache.log4j.*;
[ "com.redhat.rhn", "org.apache.log4j" ]
com.redhat.rhn; org.apache.log4j;
453,409
private void test(Message msg) { assertMessage(msg); if (forbidden.contains(msg)) { Assert.fail("received forbidden message " + msg); } required.remove(msg); }
void function(Message msg) { assertMessage(msg); if (forbidden.contains(msg)) { Assert.fail(STR + msg); } required.remove(msg); }
/** * Tests the message for legal/illegal reception. * * @param msg the message */
Tests the message for legal/illegal reception
test
{ "repo_name": "QualiMaster/Infrastructure", "path": "AdaptationLayer/src/tests/eu/qualimaster/adaptation/ExternalTests.java", "license": "apache-2.0", "size": 33340 }
[ "eu.qualimaster.adaptation.external.Message", "org.junit.Assert" ]
import eu.qualimaster.adaptation.external.Message; import org.junit.Assert;
import eu.qualimaster.adaptation.external.*; import org.junit.*;
[ "eu.qualimaster.adaptation", "org.junit" ]
eu.qualimaster.adaptation; org.junit;
2,617,796
public GeoDistanceSortBuilder validation(GeoValidationMethod method) { this.validation = method; return this; }
GeoDistanceSortBuilder function(GeoValidationMethod method) { this.validation = method; return this; }
/** * Sets validation method for this sort builder. */
Sets validation method for this sort builder
validation
{ "repo_name": "strahanjen/strahanjen.github.io", "path": "elasticsearch-master/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java", "license": "bsd-3-clause", "size": 25937 }
[ "org.elasticsearch.index.query.GeoValidationMethod" ]
import org.elasticsearch.index.query.GeoValidationMethod;
import org.elasticsearch.index.query.*;
[ "org.elasticsearch.index" ]
org.elasticsearch.index;
2,805,065
public List<Integer> getEffTimes() { return effTimes; }
List<Integer> function() { return effTimes; }
/** * Gets the eff times. * * @return the eff times */
Gets the eff times
getEffTimes
{ "repo_name": "termMed/sct-descriptive-statistics-generator", "path": "src/main/java/com/termmed/inheritance/model/LongWithDates.java", "license": "apache-2.0", "size": 5511 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,042,802
private String[] getWeatherDataFromJson(String forecastJsonStr, int numDays) throws JSONException { // These are the names of the JSON objects that need to be extracted. final String OWM_LIST = "list"; final String OWM_WEATHER = "weather"; final String OWM_TEMPERATURE = "temp"; final String OWM_MAX = "max"; final String OWM_MIN = "min"; final String OWM_DESCRIPTION = "main"; JSONObject forecastJson = new JSONObject(forecastJsonStr); JSONArray weatherArray = forecastJson.getJSONArray(OWM_LIST); // OWM returns daily forecasts based upon the local time of the city that is being // asked for, which means that we need to know the GMT offset to translate this data // properly. // Since this data is also sent in-order and the first day is always the // current day, we're going to take advantage of that to get a nice // normalized UTC date for all of our weather. Time dayTime = new Time(); dayTime.setToNow(); // we start at the day returned by local time. Otherwise this is a mess. int julianStartDay = Time.getJulianDay(System.currentTimeMillis(), dayTime.gmtoff); // now we work exclusively in UTC dayTime = new Time(); String[] resultStrs = new String[numDays]; // Data is fetched in Celsius by default. // If user prefers to see in Fahrenheit, convert the values here. // We do this rather than fetching in Fahrenheit so that the user can // change this option without us having to re-fetch the data once // we start storing the values in a database. SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); String unitType = sharedPrefs.getString( getString(R.string.pref_units_key), getString(R.string.pref_units_metric)); for (int i = 0; i < weatherArray.length(); i++) { // For now, using the format "Day, description, hi/low" String day; String description; String highAndLow; // Get the JSON object representing the day JSONObject dayForecast = weatherArray.getJSONObject(i); // The date/time is returned as a long. We need to convert that // into something human-readable, since most people won't read "1400356800" as // "this saturday". long dateTime; // Cheating to convert this to UTC time, which is what we want anyhow dateTime = dayTime.setJulianDay(julianStartDay + i); day = getReadableDateString(dateTime); // description is in a child array called "weather", which is 1 element long. JSONObject weatherObject = dayForecast.getJSONArray(OWM_WEATHER).getJSONObject(0); description = weatherObject.getString(OWM_DESCRIPTION); // Temperatures are in a child object called "temp". Try not to name variables // "temp" when working with temperature. It confuses everybody. JSONObject temperatureObject = dayForecast.getJSONObject(OWM_TEMPERATURE); double high = temperatureObject.getDouble(OWM_MAX); double low = temperatureObject.getDouble(OWM_MIN); highAndLow = formatHighLows(high, low, unitType); resultStrs[i] = day + " - " + description + " - " + highAndLow; } return resultStrs; }
String[] function(String forecastJsonStr, int numDays) throws JSONException { final String OWM_LIST = "list"; final String OWM_WEATHER = STR; final String OWM_TEMPERATURE = "temp"; final String OWM_MAX = "max"; final String OWM_MIN = "min"; final String OWM_DESCRIPTION = "main"; JSONObject forecastJson = new JSONObject(forecastJsonStr); JSONArray weatherArray = forecastJson.getJSONArray(OWM_LIST); Time dayTime = new Time(); dayTime.setToNow(); int julianStartDay = Time.getJulianDay(System.currentTimeMillis(), dayTime.gmtoff); dayTime = new Time(); String[] resultStrs = new String[numDays]; SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); String unitType = sharedPrefs.getString( getString(R.string.pref_units_key), getString(R.string.pref_units_metric)); for (int i = 0; i < weatherArray.length(); i++) { String day; String description; String highAndLow; JSONObject dayForecast = weatherArray.getJSONObject(i); long dateTime; dateTime = dayTime.setJulianDay(julianStartDay + i); day = getReadableDateString(dateTime); JSONObject weatherObject = dayForecast.getJSONArray(OWM_WEATHER).getJSONObject(0); description = weatherObject.getString(OWM_DESCRIPTION); JSONObject temperatureObject = dayForecast.getJSONObject(OWM_TEMPERATURE); double high = temperatureObject.getDouble(OWM_MAX); double low = temperatureObject.getDouble(OWM_MIN); highAndLow = formatHighLows(high, low, unitType); resultStrs[i] = day + STR + description + STR + highAndLow; } return resultStrs; }
/** * Take the String representing the complete forecast in JSON Format and * pull out the data we need to construct the Strings needed for the wireframes. * <p> * Fortunately parsing is easy: constructor takes the JSON string and converts it * into an Object hierarchy for us. */
Take the String representing the complete forecast in JSON Format and pull out the data we need to construct the Strings needed for the wireframes. Fortunately parsing is easy: constructor takes the JSON string and converts it into an Object hierarchy for us
getWeatherDataFromJson
{ "repo_name": "xeoneux/Sunshine", "path": "app/src/main/java/com/example/android/sunshine/app/ForecastFragment.java", "license": "apache-2.0", "size": 14129 }
[ "android.content.SharedPreferences", "android.preference.PreferenceManager", "android.text.format.Time", "org.json.JSONArray", "org.json.JSONException", "org.json.JSONObject" ]
import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.text.format.Time; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject;
import android.content.*; import android.preference.*; import android.text.format.*; import org.json.*;
[ "android.content", "android.preference", "android.text", "org.json" ]
android.content; android.preference; android.text; org.json;
1,818,521
public ValidationResult validate() { ValidationModel validationModel = new ValidationModel(component); validationModel.setConsumeFieldsOnly(true); ValidationResult validationResult = ValidationUtil.validate(validationModel); validationResult.merge(validateSubComponent(attributes)); validationResult.merge(validateSubComponent(contacts)); validationResult.merge(validateSubComponent(evaluationSections)); validationResult.merge(validateSubComponent(externalDependencies)); validationResult.merge(validateSubComponent(media)); validationResult.merge(validateSubComponent(metadata)); validationResult.merge(validateSubComponent(resources)); validationResult.merge(validateSubComponent(tags)); validationResult.merge(validateSubComponent(relationships)); for (QuestionAll questionAll : questions) { List<ComponentQuestion> componentQuestions = new ArrayList<>(); componentQuestions.add(questionAll.getQuestion()); validationResult.merge(validateSubComponent(componentQuestions)); validationResult.merge(validateSubComponent(questionAll.getResponds())); } for (ReviewAll reviewAll : reviews) { List<ComponentReview> componentReviews = new ArrayList<>(); componentReviews.add(reviewAll.getComponentReview()); validationResult.merge(validateSubComponent(componentReviews)); for (ComponentReviewPro reviewPro : reviewAll.getPros()) { validationModel = new ValidationModel(reviewPro); validationModel.setConsumeFieldsOnly(true); validationResult.merge(ValidationUtil.validate(validationModel)); } for (ComponentReviewCon reviewCon : reviewAll.getCons()) { validationModel = new ValidationModel(reviewCon); validationModel.setConsumeFieldsOnly(true); validationResult.merge(ValidationUtil.validate(validationModel)); } } return validationResult; }
ValidationResult function() { ValidationModel validationModel = new ValidationModel(component); validationModel.setConsumeFieldsOnly(true); ValidationResult validationResult = ValidationUtil.validate(validationModel); validationResult.merge(validateSubComponent(attributes)); validationResult.merge(validateSubComponent(contacts)); validationResult.merge(validateSubComponent(evaluationSections)); validationResult.merge(validateSubComponent(externalDependencies)); validationResult.merge(validateSubComponent(media)); validationResult.merge(validateSubComponent(metadata)); validationResult.merge(validateSubComponent(resources)); validationResult.merge(validateSubComponent(tags)); validationResult.merge(validateSubComponent(relationships)); for (QuestionAll questionAll : questions) { List<ComponentQuestion> componentQuestions = new ArrayList<>(); componentQuestions.add(questionAll.getQuestion()); validationResult.merge(validateSubComponent(componentQuestions)); validationResult.merge(validateSubComponent(questionAll.getResponds())); } for (ReviewAll reviewAll : reviews) { List<ComponentReview> componentReviews = new ArrayList<>(); componentReviews.add(reviewAll.getComponentReview()); validationResult.merge(validateSubComponent(componentReviews)); for (ComponentReviewPro reviewPro : reviewAll.getPros()) { validationModel = new ValidationModel(reviewPro); validationModel.setConsumeFieldsOnly(true); validationResult.merge(ValidationUtil.validate(validationModel)); } for (ComponentReviewCon reviewCon : reviewAll.getCons()) { validationModel = new ValidationModel(reviewCon); validationModel.setConsumeFieldsOnly(true); validationResult.merge(ValidationUtil.validate(validationModel)); } } return validationResult; }
/** * Validates all entities * * @return */
Validates all entities
validate
{ "repo_name": "skycow/openstorefront", "path": "server/openstorefront/openstorefront-core/model/src/main/java/edu/usu/sdl/openstorefront/core/model/ComponentAll.java", "license": "apache-2.0", "size": 11765 }
[ "edu.usu.sdl.openstorefront.core.entity.ComponentQuestion", "edu.usu.sdl.openstorefront.core.entity.ComponentReview", "edu.usu.sdl.openstorefront.core.entity.ComponentReviewCon", "edu.usu.sdl.openstorefront.core.entity.ComponentReviewPro", "edu.usu.sdl.openstorefront.validation.ValidationModel", "edu.usu.sdl.openstorefront.validation.ValidationResult", "edu.usu.sdl.openstorefront.validation.ValidationUtil", "java.util.ArrayList", "java.util.List" ]
import edu.usu.sdl.openstorefront.core.entity.ComponentQuestion; import edu.usu.sdl.openstorefront.core.entity.ComponentReview; import edu.usu.sdl.openstorefront.core.entity.ComponentReviewCon; import edu.usu.sdl.openstorefront.core.entity.ComponentReviewPro; import edu.usu.sdl.openstorefront.validation.ValidationModel; import edu.usu.sdl.openstorefront.validation.ValidationResult; import edu.usu.sdl.openstorefront.validation.ValidationUtil; import java.util.ArrayList; import java.util.List;
import edu.usu.sdl.openstorefront.core.entity.*; import edu.usu.sdl.openstorefront.validation.*; import java.util.*;
[ "edu.usu.sdl", "java.util" ]
edu.usu.sdl; java.util;
2,293,617
public X509CertificateHolder build( ContentSigner signer) { tbsGen.setSignature(signer.getAlgorithmIdentifier()); if (!extGenerator.isEmpty()) { tbsGen.setExtensions(extGenerator.generate()); } return CertUtils.generateFullCert(signer, tbsGen.generateTBSCertificate()); }
X509CertificateHolder function( ContentSigner signer) { tbsGen.setSignature(signer.getAlgorithmIdentifier()); if (!extGenerator.isEmpty()) { tbsGen.setExtensions(extGenerator.generate()); } return CertUtils.generateFullCert(signer, tbsGen.generateTBSCertificate()); }
/** * Generate an X.509 certificate, based on the current issuer and subject * using the passed in signer. * * @param signer the content signer to be used to generate the signature validating the certificate. * @return a holder containing the resulting signed certificate. */
Generate an X.509 certificate, based on the current issuer and subject using the passed in signer
build
{ "repo_name": "iseki-masaya/spongycastle", "path": "pkix/src/main/java/org/spongycastle/cert/X509v3CertificateBuilder.java", "license": "mit", "size": 7408 }
[ "org.spongycastle.operator.ContentSigner" ]
import org.spongycastle.operator.ContentSigner;
import org.spongycastle.operator.*;
[ "org.spongycastle.operator" ]
org.spongycastle.operator;
2,184,123
public Builder applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; }
Builder function( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; }
/** * Applies the given settings updater function to all of the unary API methods in this service. * * <p>Note: This method does not support applying settings to streaming methods. */
Applies the given settings updater function to all of the unary API methods in this service. Note: This method does not support applying settings to streaming methods
applyToAllUnaryMethods
{ "repo_name": "googleapis/java-gkehub", "path": "google-cloud-gkehub/src/main/java/com/google/cloud/gkehub/v1/stub/GkeHubStubSettings.java", "license": "apache-2.0", "size": 44176 }
[ "com.google.api.core.ApiFunction", "com.google.api.gax.rpc.UnaryCallSettings" ]
import com.google.api.core.ApiFunction; import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.core.*; import com.google.api.gax.rpc.*;
[ "com.google.api" ]
com.google.api;
244,029
public int markAll(String toMark, boolean matchCase, boolean wholeWord, boolean regex) { Highlighter h = getHighlighter(); int numMarked = 0; if (toMark != null && !toMark.equals(markedWord) && h != null) { if (markAllHighlights != null) clearMarkAllHighlights(); else markAllHighlights = new ArrayList(10); int caretPos = getCaretPosition(); markedWord = toMark; setCaretPosition(0); boolean found = SearchEngine.find(this, toMark, true, matchCase, wholeWord, regex); while (found) { int start = getSelectionStart(); int end = getSelectionEnd(); try { markAllHighlights.add(h.addHighlight(start, end, markAllHighlightPainter)); } catch (BadLocationException ble) { ble.printStackTrace(); } numMarked++; found = SearchEngine.find(this, toMark, true, matchCase, wholeWord, regex); } setCaretPosition(caretPos); repaint(); } return numMarked; } /** * {@inheritDoc}
int function(String toMark, boolean matchCase, boolean wholeWord, boolean regex) { Highlighter h = getHighlighter(); int numMarked = 0; if (toMark != null && !toMark.equals(markedWord) && h != null) { if (markAllHighlights != null) clearMarkAllHighlights(); else markAllHighlights = new ArrayList(10); int caretPos = getCaretPosition(); markedWord = toMark; setCaretPosition(0); boolean found = SearchEngine.find(this, toMark, true, matchCase, wholeWord, regex); while (found) { int start = getSelectionStart(); int end = getSelectionEnd(); try { markAllHighlights.add(h.addHighlight(start, end, markAllHighlightPainter)); } catch (BadLocationException ble) { ble.printStackTrace(); } numMarked++; found = SearchEngine.find(this, toMark, true, matchCase, wholeWord, regex); } setCaretPosition(caretPos); repaint(); } return numMarked; } /** * {@inheritDoc}
/** * Marks all instances of the specified text in this text area. * * @param toMark * The text to mark. * @param matchCase * Whether the match should be case-sensitive. * @param wholeWord * Whether the matches should be surrounded by spaces or tabs. * @param regex * Whether <code>toMark</code> is a Java regular expression. * @return The number of matches marked. * @see #clearMarkAllHighlights * @see #getMarkAllHighlightColor * @see #setMarkAllHighlightColor */
Marks all instances of the specified text in this text area
markAll
{ "repo_name": "kevinmcgoldrick/Tank", "path": "tools/agent_debugger/src/main/java/org/fife/ui/rtextarea/RTextArea.java", "license": "epl-1.0", "size": 54300 }
[ "java.util.ArrayList", "javax.swing.text.BadLocationException", "javax.swing.text.Highlighter" ]
import java.util.ArrayList; import javax.swing.text.BadLocationException; import javax.swing.text.Highlighter;
import java.util.*; import javax.swing.text.*;
[ "java.util", "javax.swing" ]
java.util; javax.swing;
2,121,246
private void loadSessionData() throws SQLException { String query = "SELECT * FROM session WHERE sessionid=\'" + sessionId + "\';"; ResultSet rs = dbConn.executeQuery(query); if (rs == null) { System.err.println("Session id " + sessionId + " not found in session table!"); System.exit(-1); } while (rs.next()) { Long timeStarted = rs.getLong("timeStarted"); session.setStartTime(timeStarted); } }
void function() throws SQLException { String query = STR + sessionId + "\';"; ResultSet rs = dbConn.executeQuery(query); if (rs == null) { System.err.println(STR + sessionId + STR); System.exit(-1); } while (rs.next()) { Long timeStarted = rs.getLong(STR); session.setStartTime(timeStarted); } }
/** * Load Session data * * @throws SQLException */
Load Session data
loadSessionData
{ "repo_name": "dbhage/qasp", "path": "src/session/SessionLoader.java", "license": "bsd-2-clause", "size": 14396 }
[ "java.sql.ResultSet", "java.sql.SQLException" ]
import java.sql.ResultSet; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
749,700
// URL escapers should throw null pointer exceptions for null input try { e.escape((String) null); fail("Escaping null string should throw exception"); } catch (NullPointerException x) { // pass } // All URL escapers should leave 0-9, A-Z, a-z unescaped assertUnescaped(e, 'a'); assertUnescaped(e, 'z'); assertUnescaped(e, 'A'); assertUnescaped(e, 'Z'); assertUnescaped(e, '0'); assertUnescaped(e, '9'); // Unreserved characters used in java.net.URLEncoder assertUnescaped(e, '-'); assertUnescaped(e, '_'); assertUnescaped(e, '.'); assertUnescaped(e, '*'); assertEscaping(e, "%00", '\u0000'); // nul assertEscaping(e, "%7F", '\u007f'); // del assertEscaping(e, "%C2%80", '\u0080'); // xx-00010,x-000000 assertEscaping(e, "%DF%BF", '\u07ff'); // xx-11111,x-111111 assertEscaping(e, "%E0%A0%80", '\u0800'); // xxx-0000,x-100000,x-00,0000 assertEscaping(e, "%EF%BF%BF", '\uffff'); // xxx-1111,x-111111,x-11,1111 assertUnicodeEscaping(e, "%F0%90%80%80", '\uD800', '\uDC00'); assertUnicodeEscaping(e, "%F4%8F%BF%BF", '\uDBFF', '\uDFFF'); assertEquals("", e.escape("")); assertEquals("safestring", e.escape("safestring")); assertEquals("embedded%00null", e.escape("embedded\0null")); assertEquals("max%EF%BF%BFchar", e.escape("max\uffffchar")); }
try { e.escape((String) null); fail(STR); } catch (NullPointerException x) { } assertUnescaped(e, 'a'); assertUnescaped(e, 'z'); assertUnescaped(e, 'A'); assertUnescaped(e, 'Z'); assertUnescaped(e, '0'); assertUnescaped(e, '9'); assertUnescaped(e, '-'); assertUnescaped(e, '_'); assertUnescaped(e, '.'); assertUnescaped(e, '*'); assertEscaping(e, "%00", '\u0000'); assertEscaping(e, "%7F", '\u007f'); assertEscaping(e, STR, '\u0080'); assertEscaping(e, STR, '\u07ff'); assertEscaping(e, STR, '\u0800'); assertEscaping(e, STR, '\uffff'); assertUnicodeEscaping(e, STR, '\uD800', '\uDC00'); assertUnicodeEscaping(e, STR, '\uDBFF', '\uDFFF'); assertEquals(STRSTRsafestringSTRsafestringSTRembedded%00nullSTRembedded\0nullSTRmax%EF%BF%BFcharSTRmax\uffffchar")); }
/** * Helper to assert common expected behaviour of uri escapers. You should call * assertBasicUrlEscaper() unless the escaper explicitly does not escape '%'. */
Helper to assert common expected behaviour of uri escapers. You should call assertBasicUrlEscaper() unless the escaper explicitly does not escape '%'
assertBasicUrlEscaperExceptPercent
{ "repo_name": "sensui/guava-libraries", "path": "guava-tests/test/com/google/common/net/UrlEscapersTest.java", "license": "apache-2.0", "size": 4751 }
[ "com.google.common.escape.testing.EscaperAsserts" ]
import com.google.common.escape.testing.EscaperAsserts;
import com.google.common.escape.testing.*;
[ "com.google.common" ]
com.google.common;
1,319,052
EAttribute getElementRule_CreateYN();
EAttribute getElementRule_CreateYN();
/** * Returns the meta object for the attribute '{@link nexcore.tool.mda.model.developer.reverseTransformation.ElementRule#isCreateYN <em>Create YN</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Create YN</em>'. * @see nexcore.tool.mda.model.developer.reverseTransformation.ElementRule#isCreateYN() * @see #getElementRule() * @generated */
Returns the meta object for the attribute '<code>nexcore.tool.mda.model.developer.reverseTransformation.ElementRule#isCreateYN Create YN</code>'.
getElementRule_CreateYN
{ "repo_name": "SK-HOLDINGS-CC/NEXCORE-UML-Modeler", "path": "nexcore.tool.mda.model/src/java/nexcore/tool/mda/model/developer/reverseTransformation/ReverseTransformationPackage.java", "license": "epl-1.0", "size": 46728 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,726,372
protected Job constructDAGJob(String name, String directory, String dagBasename) { // for time being use the old functions. Job job = new Job(); // set the logical transformation job.setTransformation(CONDOR_DAGMAN_NAMESPACE, CONDOR_DAGMAN_LOGICAL_NAME, null); // set the logical derivation attributes of the job. job.setDerivation(CONDOR_DAGMAN_NAMESPACE, CONDOR_DAGMAN_LOGICAL_NAME, null); // always runs on the submit host job.setSiteHandle("local"); // set the partition id only as the unique id // for the time being. // job.setName(partition.getID()); // set the logical id for the job same as the partition id. job.setName(name); List entries; TransformationCatalogEntry entry = null; // get the path to condor dagman try { // try to construct the path from the environment entry = constructTCEntryFromEnvironment(); // try to construct from the TC if (entry == null) { entries = mTCHandle.lookup( job.namespace, job.logicalName, job.version, job.getSiteHandle(), TCType.INSTALLED); entry = (entries == null) ? defaultTCEntry("local") : // construct from site catalog // Gaurang assures that if no record is found then // TC Mechanism returns null (TransformationCatalogEntry) entries.get(0); } } catch (Exception e) { throw new RuntimeException("ERROR: While accessing the Transformation Catalog", e); } if (entry == null) { // throw appropriate error throw new RuntimeException( "ERROR: Entry not found in tc for job " + job.getCompleteTCName() + " on site " + job.getSiteHandle()); } // set the path to the executable and environment string job.setRemoteExecutable(entry.getPhysicalTransformation()); // the job itself is the main job of the super node // construct the classad specific information job.jobID = job.getName(); job.jobClass = Job.COMPUTE_JOB; // directory where all the dagman related files for the nested dagman // reside. Same as the directory passed as an input parameter String dir = directory; // make the initial dir point to the submit file dir for the partition // we can do this as we are running this job both on local host, and scheduler // universe. Hence, no issues of shared filesystem or anything. job.condorVariables.construct("initialdir", dir); // construct the argument string, with all the dagman files // being generated in the partition directory. Using basenames as // initialdir has been specified for the job. StringBuffer sb = new StringBuffer(); sb.append(" -f -l . -Debug 3") .append(" -Lockfile ") .append(getBasename(dagBasename, ".lock")) .append(" -Dag ") .append(dagBasename); // append(" -Rescue ").append( getBasename( dagBasename, ".rescue")). // specify condor log for condor version less than 7.1.2 if (mCondorVersion < CondorVersion.v_7_1_2) { sb.append(" -Condorlog ").append(getBasename(dagBasename, ".log")); } // allow for version mismatch as after 7.1.3 condor does tight // checking on dag.condor.sub file and the condor version used if (mCondorVersion >= CondorVersion.v_7_1_3) { sb.append(" -AllowVersionMismatch "); } // for condor 7.1.0 sb.append(" -AutoRescue 1 -DoRescueFrom 0 "); // pass any dagman knobs that were specified in properties file // sb.append( this.mDAGManKnobs ); // put in the environment variables that are required job.envVariables.construct( "_CONDOR_DAGMAN_LOG", directory + File.separator + dagBasename + ".dagman.out"); job.envVariables.construct("_CONDOR_MAX_DAGMAN_LOG", "0"); // set the arguments for the job job.setArguments(sb.toString()); // the environment need to be propogated for exitcode to be picked up job.condorVariables.construct("getenv", "TRUE"); job.condorVariables.construct("remove_kill_sig", "SIGUSR1"); // the job needs to be explicitly launched in // scheduler universe instead of local universe job.condorVariables.construct(Condor.UNIVERSE_KEY, Condor.SCHEDULER_UNIVERSE); // add any notifications specified in the transformation // catalog for the job. JIRA PM-391 job.addNotifications(entry); // incorporate profiles from the transformation catalog // and properties for the time being. Not from the site catalog. // the profile information from the transformation // catalog needs to be assimilated into the job // overriding the one from pool catalog. job.updateProfiles(entry); // the profile information from the properties file // is assimilated overidding the one from transformation // catalog. job.updateProfiles(mProps); // we do not want the job to be launched via kickstart // Fix for Pegasus bug number 143 // http://bugzilla.globus.org/vds/show_bug.cgi?id=143 job.vdsNS.construct( Pegasus.GRIDSTART_KEY, GridStartFactory.GRIDSTART_SHORT_NAMES[GridStartFactory.NO_GRIDSTART_INDEX]); return job; }
Job function(String name, String directory, String dagBasename) { Job job = new Job(); job.setTransformation(CONDOR_DAGMAN_NAMESPACE, CONDOR_DAGMAN_LOGICAL_NAME, null); job.setDerivation(CONDOR_DAGMAN_NAMESPACE, CONDOR_DAGMAN_LOGICAL_NAME, null); job.setSiteHandle("local"); job.setName(name); List entries; TransformationCatalogEntry entry = null; try { entry = constructTCEntryFromEnvironment(); if (entry == null) { entries = mTCHandle.lookup( job.namespace, job.logicalName, job.version, job.getSiteHandle(), TCType.INSTALLED); entry = (entries == null) ? defaultTCEntry("local") : (TransformationCatalogEntry) entries.get(0); } } catch (Exception e) { throw new RuntimeException(STR, e); } if (entry == null) { throw new RuntimeException( STR + job.getCompleteTCName() + STR + job.getSiteHandle()); } job.setRemoteExecutable(entry.getPhysicalTransformation()); job.jobID = job.getName(); job.jobClass = Job.COMPUTE_JOB; String dir = directory; job.condorVariables.construct(STR, dir); StringBuffer sb = new StringBuffer(); sb.append(STR) .append(STR) .append(getBasename(dagBasename, ".lock")) .append(STR) .append(dagBasename); if (mCondorVersion < CondorVersion.v_7_1_2) { sb.append(STR).append(getBasename(dagBasename, ".log")); } if (mCondorVersion >= CondorVersion.v_7_1_3) { sb.append(STR); } sb.append(STR); job.envVariables.construct( STR, directory + File.separator + dagBasename + STR); job.envVariables.construct(STR, "0"); job.setArguments(sb.toString()); job.condorVariables.construct(STR, "TRUE"); job.condorVariables.construct(STR, STR); job.condorVariables.construct(Condor.UNIVERSE_KEY, Condor.SCHEDULER_UNIVERSE); job.addNotifications(entry); job.updateProfiles(entry); job.updateProfiles(mProps); job.vdsNS.construct( Pegasus.GRIDSTART_KEY, GridStartFactory.GRIDSTART_SHORT_NAMES[GridStartFactory.NO_GRIDSTART_INDEX]); return job; }
/** * Constructs a job that plans and submits the partitioned workflow, referred to by a Partition. * The main job itself is a condor dagman job that submits the concrete workflow. The concrete * workflow is generated by running the planner in the prescript for the job. * * @param name the key to be assigned to the job. * @param directory the submit directory where the submit files for the partition should reside. * this is where the dag file is created * @param dagBasename the basename of the dag file created. * @return the constructed DAG job. */
Constructs a job that plans and submits the partitioned workflow, referred to by a Partition. The main job itself is a condor dagman job that submits the concrete workflow. The concrete workflow is generated by running the planner in the prescript for the job
constructDAGJob
{ "repo_name": "pegasus-isi/pegasus", "path": "src/edu/isi/pegasus/planner/code/generator/condor/CondorGenerator.java", "license": "apache-2.0", "size": 75136 }
[ "edu.isi.pegasus.common.util.CondorVersion", "edu.isi.pegasus.planner.catalog.transformation.TransformationCatalogEntry", "edu.isi.pegasus.planner.catalog.transformation.classes.TCType", "edu.isi.pegasus.planner.classes.Job", "edu.isi.pegasus.planner.code.GridStartFactory", "edu.isi.pegasus.planner.namespace.Condor", "edu.isi.pegasus.planner.namespace.Pegasus", "java.io.File", "java.util.List" ]
import edu.isi.pegasus.common.util.CondorVersion; import edu.isi.pegasus.planner.catalog.transformation.TransformationCatalogEntry; import edu.isi.pegasus.planner.catalog.transformation.classes.TCType; import edu.isi.pegasus.planner.classes.Job; import edu.isi.pegasus.planner.code.GridStartFactory; import edu.isi.pegasus.planner.namespace.Condor; import edu.isi.pegasus.planner.namespace.Pegasus; import java.io.File; import java.util.List;
import edu.isi.pegasus.common.util.*; import edu.isi.pegasus.planner.catalog.transformation.*; import edu.isi.pegasus.planner.catalog.transformation.classes.*; import edu.isi.pegasus.planner.classes.*; import edu.isi.pegasus.planner.code.*; import edu.isi.pegasus.planner.namespace.*; import java.io.*; import java.util.*;
[ "edu.isi.pegasus", "java.io", "java.util" ]
edu.isi.pegasus; java.io; java.util;
2,019,973
public static final Date utc2date(Long time) { // don't accept negative values if (time == null || time < 0) return null; // add the timezone offset time += timezoneOffsetMillis(new Date(time)); return new Date(time); }
static final Date function(Long time) { if (time == null time < 0) return null; time += timezoneOffsetMillis(new Date(time)); return new Date(time); }
/** * Converts a time in UTC to a gwt Date object which is in the timezone of * the current browser. * * @return The Date corresponding to the time, adjusted for the timezone of * the current browser. null if the specified time is null or * represents a negative number. */
Converts a time in UTC to a gwt Date object which is in the timezone of the current browser
utc2date
{ "repo_name": "tractionsoftware/gwt-traction", "path": "src/main/java/com/tractionsoftware/gwt/user/client/ui/UTCDateBox.java", "license": "apache-2.0", "size": 7947 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
414,494
EAttribute getMeasure_Name();
EAttribute getMeasure_Name();
/** * Returns the meta object for the attribute '{@link subkdm.SimplifiedDecisionMetrics.Measure#getName <em>Name</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Name</em>'. * @see subkdm.SimplifiedDecisionMetrics.Measure#getName() * @see #getMeasure() * @generated */
Returns the meta object for the attribute '<code>subkdm.SimplifiedDecisionMetrics.Measure#getName Name</code>'.
getMeasure_Name
{ "repo_name": "lfmendivelso10/AppModernization", "path": "source/i2/miso4301_201520/src/subkdm/SimplifiedDecisionMetrics/SimplifiedDecisionMetricsPackage.java", "license": "mit", "size": 24308 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
204,987
@Override public final BytesStreamOutput bytesOutput() { if (bytesOut == null) { bytesOut = newBytesOutput(); } else { bytesOut.reset(); } return bytesOut; }
final BytesStreamOutput function() { if (bytesOut == null) { bytesOut = newBytesOutput(); } else { bytesOut.reset(); } return bytesOut; }
/** * A channel level bytes output that can be reused. The bytes output is lazily instantiated * by a call to {@link #newBytesOutput()}. Once the stream is created, it gets reset on each * call to this method. */
A channel level bytes output that can be reused. The bytes output is lazily instantiated by a call to <code>#newBytesOutput()</code>. Once the stream is created, it gets reset on each call to this method
bytesOutput
{ "repo_name": "gfyoung/elasticsearch", "path": "server/src/main/java/org/elasticsearch/rest/AbstractRestChannel.java", "license": "apache-2.0", "size": 6346 }
[ "org.elasticsearch.common.io.stream.BytesStreamOutput" ]
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
2,701,037
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<Void> deleteInstancesAsync( String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { final Boolean forceDeletion = null; return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion) .last() .flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> function( String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { final Boolean forceDeletion = null; return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion) .last() .flatMap(this.client::getLroFinalResultOrError); }
/** * Deletes virtual machines in a VM scale set. * * @param resourceGroupName The name of the resource group. * @param vmScaleSetName The name of the VM scale set. * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ApiErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */
Deletes virtual machines in a VM scale set
deleteInstancesAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/VirtualMachineScaleSetsClientImpl.java", "license": "mit", "size": 352067 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs;
import com.azure.core.annotation.*; import com.azure.resourcemanager.compute.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,864,402
@Nullable String getParameterValueWithName (@Nullable String sParamName);
String getParameterValueWithName (@Nullable String sParamName);
/** * Get the value of the parameter with the specified name. The names are * matched case sensitive! * * @param sParamName * The parameter name to search. May be <code>null</code>. * @return <code>null</code> if no such parameter exists. */
Get the value of the parameter with the specified name. The names are matched case sensitive
getParameterValueWithName
{ "repo_name": "phax/ph-commons", "path": "ph-commons/src/main/java/com/helger/commons/mime/IMimeType.java", "license": "apache-2.0", "size": 5841 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,722,710
interface WithAuthenticationCertificates { WithCreate withAuthenticationCertificates(List<ApplicationGatewayAuthenticationCertificate> authenticationCertificates); }
interface WithAuthenticationCertificates { WithCreate withAuthenticationCertificates(List<ApplicationGatewayAuthenticationCertificate> authenticationCertificates); }
/** * Specifies authenticationCertificates. * @param authenticationCertificates Authentication certificates of the application gateway resource * @return the next definition stage */
Specifies authenticationCertificates
withAuthenticationCertificates
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/ApplicationGateway.java", "license": "mit", "size": 24925 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
422,449
@Beta public static Writer nullWriter() { return NullWriter.INSTANCE; } private static final class NullWriter extends Writer { private static final NullWriter INSTANCE = new NullWriter(); @Override public void write(int c) {}
static Writer function() { return NullWriter.INSTANCE; } private static final class NullWriter extends Writer { private static final NullWriter INSTANCE = new NullWriter(); public void write(int c) {}
/** * Returns a {@link Writer} that simply discards written chars. * * @since 15.0 */
Returns a <code>Writer</code> that simply discards written chars
nullWriter
{ "repo_name": "EdwardLee03/guava", "path": "guava/src/com/google/common/io/CharStreams.java", "license": "apache-2.0", "size": 11050 }
[ "java.io.Writer" ]
import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
1,426,498
void enterNonWildcardTypeArguments(@NotNull JavaParser.NonWildcardTypeArgumentsContext ctx); void exitNonWildcardTypeArguments(@NotNull JavaParser.NonWildcardTypeArgumentsContext ctx);
void enterNonWildcardTypeArguments(@NotNull JavaParser.NonWildcardTypeArgumentsContext ctx); void exitNonWildcardTypeArguments(@NotNull JavaParser.NonWildcardTypeArgumentsContext ctx);
/** * Exit a parse tree produced by {@link JavaParser#nonWildcardTypeArguments}. * @param ctx the parse tree */
Exit a parse tree produced by <code>JavaParser#nonWildcardTypeArguments</code>
exitNonWildcardTypeArguments
{ "repo_name": "zmughal/oop-analysis", "path": "src/generated-sources/JavaListener.java", "license": "apache-2.0", "size": 38949 }
[ "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;
798,822
@ServiceMethod(returns = ReturnType.SINGLE) Response<CredentialResultsInner> listClusterUserCredentialsWithResponse( String resourceGroupName, String resourceName, Context context);
@ServiceMethod(returns = ReturnType.SINGLE) Response<CredentialResultsInner> listClusterUserCredentialsWithResponse( String resourceGroupName, String resourceName, Context context);
/** * Gets cluster user credential of the managed cluster with a specified resource group and name. * * @param resourceGroupName The name of the resource group. * @param resourceName The name of the managed cluster resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return cluster user credential of the managed cluster with a specified resource group and name. */
Gets cluster user credential of the managed cluster with a specified resource group and name
listClusterUserCredentialsWithResponse
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/fluent/ManagedClustersClient.java", "license": "mit", "size": 63960 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.containerservice.fluent.models.CredentialResultsInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.containerservice.fluent.models.CredentialResultsInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.containerservice.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,789,529
public void testCanExport( ) throws Exception { openDesign( "ElementExporterTest.xml" ); //$NON-NLS-1$ openLibrary( "ElementExporterTestLibrary.xml" ); //$NON-NLS-1$ DataSetHandle ds = designHandle.findDataSet( "dataSet1" ); //$NON-NLS-1$ assertTrue( ElementExportUtil.canExport( ds, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( ds ) ); // if add a dataset1 to the library, cannot export DataSetHandle tmpDs = libraryHandle.getElementFactory( ) .newScriptDataSet( "dataSet1" ); //$NON-NLS-1$ libraryHandle.getDataSets( ).add( tmpDs ); assertFalse( ElementExportUtil.canExport( ds, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( ds, libraryHandle, true ) ); assertTrue( ElementExportUtil.canExport( ds ) ); StyleHandle style1 = designHandle.findStyle( "style1" ); //$NON-NLS-1$ assertFalse( ElementExportUtil.canExport( style1, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( style1 ) ); // group cannot be exported. TableHandle table = (TableHandle) designHandle.findElement( "table1" ); //$NON-NLS-1$ GroupHandle group = (GroupHandle) table.getGroups( ).get( 0 ); assertFalse( ElementExportUtil.canExport( group, libraryHandle, false ) ); assertFalse( ElementExportUtil.canExport( group ) ); CustomColorHandle color1 = (CustomColorHandle) designHandle .customColorsIterator( ).next( ); assertTrue( ElementExportUtil.canExport( color1, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( color1 ) ); // if add a custom color with "customColor1" into library, cannot export CustomColor tmpColor1 = StructureFactory.createCustomColor( ); tmpColor1.setName( "customColor1" ); //$NON-NLS-1$ libraryHandle.getPropertyHandle( IModuleModel.COLOR_PALETTE_PROP ) .addItem( tmpColor1 ); assertFalse( ElementExportUtil.canExport( color1, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( color1, libraryHandle, true ) ); assertTrue( ElementExportUtil.canExport( color1 ) ); }
void function( ) throws Exception { openDesign( STR ); openLibrary( STR ); DataSetHandle ds = designHandle.findDataSet( STR ); assertTrue( ElementExportUtil.canExport( ds, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( ds ) ); DataSetHandle tmpDs = libraryHandle.getElementFactory( ) .newScriptDataSet( STR ); libraryHandle.getDataSets( ).add( tmpDs ); assertFalse( ElementExportUtil.canExport( ds, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( ds, libraryHandle, true ) ); assertTrue( ElementExportUtil.canExport( ds ) ); StyleHandle style1 = designHandle.findStyle( STR ); assertFalse( ElementExportUtil.canExport( style1, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( style1 ) ); TableHandle table = (TableHandle) designHandle.findElement( STR ); GroupHandle group = (GroupHandle) table.getGroups( ).get( 0 ); assertFalse( ElementExportUtil.canExport( group, libraryHandle, false ) ); assertFalse( ElementExportUtil.canExport( group ) ); CustomColorHandle color1 = (CustomColorHandle) designHandle .customColorsIterator( ).next( ); assertTrue( ElementExportUtil.canExport( color1, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( color1 ) ); CustomColor tmpColor1 = StructureFactory.createCustomColor( ); tmpColor1.setName( STR ); libraryHandle.getPropertyHandle( IModuleModel.COLOR_PALETTE_PROP ) .addItem( tmpColor1 ); assertFalse( ElementExportUtil.canExport( color1, libraryHandle, false ) ); assertTrue( ElementExportUtil.canExport( color1, libraryHandle, true ) ); assertTrue( ElementExportUtil.canExport( color1 ) ); }
/** * Test the function that whether an element/structure can be exported. * * @throws Exception */
Test the function that whether an element/structure can be exported
testCanExport
{ "repo_name": "Charling-Huang/birt", "path": "model/org.eclipse.birt.report.model.tests/test/org/eclipse/birt/report/model/api/ElementExporterTest.java", "license": "epl-1.0", "size": 35512 }
[ "org.eclipse.birt.report.model.api.core.IModuleModel", "org.eclipse.birt.report.model.api.elements.structures.CustomColor", "org.eclipse.birt.report.model.api.util.ElementExportUtil" ]
import org.eclipse.birt.report.model.api.core.IModuleModel; import org.eclipse.birt.report.model.api.elements.structures.CustomColor; import org.eclipse.birt.report.model.api.util.ElementExportUtil;
import org.eclipse.birt.report.model.api.core.*; import org.eclipse.birt.report.model.api.elements.structures.*; import org.eclipse.birt.report.model.api.util.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
431,779
public void dupX1(){ mv.visitInsn(Opcodes.DUP_X1); }
void function(){ mv.visitInsn(Opcodes.DUP_X1); }
/** * Generates a DUP_X1 instruction. */
Generates a DUP_X1 instruction
dupX1
{ "repo_name": "hexosse/ProtocolLib", "path": "ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/BoxingHelper.java", "license": "gpl-2.0", "size": 8142 }
[ "net.sf.cglib.asm.Opcodes" ]
import net.sf.cglib.asm.Opcodes;
import net.sf.cglib.asm.*;
[ "net.sf.cglib" ]
net.sf.cglib;
1,210,537
public AppResponse getCapabilities() throws Exception { AppResponse response = new AppResponse(); String mime = null; boolean hasTextXml = false; boolean hasAppXml = false; boolean hasOther = false; String[] acceptFormats = getParameterValues("acceptFormats"); if (acceptFormats != null && acceptFormats.length == 1) { acceptFormats = Val.tokenize(acceptFormats[0],",",false); } if (acceptFormats != null) { for (String s: acceptFormats) { if (s.equalsIgnoreCase("application/xml")) { hasAppXml = true; } else if (s.equalsIgnoreCase("text/xml")) { hasTextXml = true; } else if (s.length() > 0) { hasOther = true; } } } String accept = getAcceptHeader(); if (accept != null) { if (accept.equals("text/xml")) { hasTextXml = true; } } if (!hasAppXml && hasTextXml) { mime = "text/xml"; } else if (!hasAppXml && !hasTextXml && hasOther) { String msg = "CSW: The acceptFormats parameter is invalid."; throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,"acceptFormats",msg); } String[] acceptVersions = getParameterValues("acceptVersions"); if (acceptVersions != null && acceptVersions.length == 1) { acceptVersions = Val.tokenize(acceptVersions[0],",",false); } if (acceptVersions != null && acceptVersions.length > 0) { boolean has30 = false; for (String s: acceptVersions) { if (s.equalsIgnoreCase("3.0.0")) { has30 = true; break; } } if (!has30) { String msg = "CSW: The acceptVersions parameter is invalid, 3.0.0 is required"; throw new OwsException(OwsException.OWSCODE_VersionNegotiationFailed,"acceptVersions",msg); } } String baseUrl = this.getBaseUrl(); String cswUrl = baseUrl+"/csw"; String opensearchDscUrl = baseUrl+"/opensearch/description"; ResourcePath rp = new ResourcePath(); URI uri = rp.makeUrl(capabilitiesFile).toURI(); String xml = new String(Files.readAllBytes(Paths.get(uri)),"UTF-8"); xml = xml.replaceAll("\\{csw.url\\}",XmlUtil.escape(cswUrl)); xml = xml.replaceAll("\\{opensearch.description.url\\}",XmlUtil.escape(opensearchDscUrl)); String sections = Val.trim(getParameter("sections")); if ((sections != null) && (sections.length() > 0)) { if (sections.equalsIgnoreCase("all")) { } else if (sections.equalsIgnoreCase("Filter_Capabilities")) { xml = removeAllButFilter(xml); } else { String msg = "CSW: The sections parameter must be All or Filter_Capabilities."; throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,"sections",msg); } } response.setEntity(xml); response.setMediaType(MediaType.APPLICATION_XML_TYPE.withCharset("UTF-8")); if (mime != null && mime.equals("text/xml")) { response.setMediaType(MediaType.TEXT_XML_TYPE.withCharset("UTF-8")); } response.setStatus(Response.Status.OK); return response; }
AppResponse function() throws Exception { AppResponse response = new AppResponse(); String mime = null; boolean hasTextXml = false; boolean hasAppXml = false; boolean hasOther = false; String[] acceptFormats = getParameterValues(STR); if (acceptFormats != null && acceptFormats.length == 1) { acceptFormats = Val.tokenize(acceptFormats[0],",",false); } if (acceptFormats != null) { for (String s: acceptFormats) { if (s.equalsIgnoreCase(STR)) { hasAppXml = true; } else if (s.equalsIgnoreCase(STR)) { hasTextXml = true; } else if (s.length() > 0) { hasOther = true; } } } String accept = getAcceptHeader(); if (accept != null) { if (accept.equals(STR)) { hasTextXml = true; } } if (!hasAppXml && hasTextXml) { mime = STR; } else if (!hasAppXml && !hasTextXml && hasOther) { String msg = STR; throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,STR,msg); } String[] acceptVersions = getParameterValues(STR); if (acceptVersions != null && acceptVersions.length == 1) { acceptVersions = Val.tokenize(acceptVersions[0],",",false); } if (acceptVersions != null && acceptVersions.length > 0) { boolean has30 = false; for (String s: acceptVersions) { if (s.equalsIgnoreCase("3.0.0")) { has30 = true; break; } } if (!has30) { String msg = STR; throw new OwsException(OwsException.OWSCODE_VersionNegotiationFailed,STR,msg); } } String baseUrl = this.getBaseUrl(); String cswUrl = baseUrl+"/csw"; String opensearchDscUrl = baseUrl+STR; ResourcePath rp = new ResourcePath(); URI uri = rp.makeUrl(capabilitiesFile).toURI(); String xml = new String(Files.readAllBytes(Paths.get(uri)),"UTF-8"); xml = xml.replaceAll(STR,XmlUtil.escape(cswUrl)); xml = xml.replaceAll(STR,XmlUtil.escape(opensearchDscUrl)); String sections = Val.trim(getParameter(STR)); if ((sections != null) && (sections.length() > 0)) { if (sections.equalsIgnoreCase("all")) { } else if (sections.equalsIgnoreCase(STR)) { xml = removeAllButFilter(xml); } else { String msg = STR; throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,STR,msg); } } response.setEntity(xml); response.setMediaType(MediaType.APPLICATION_XML_TYPE.withCharset("UTF-8")); if (mime != null && mime.equals(STR)) { response.setMediaType(MediaType.TEXT_XML_TYPE.withCharset("UTF-8")); } response.setStatus(Response.Status.OK); return response; }
/** * Generate an GetCapabilities response. * @return the response * @throws Exception if an exception occurs */
Generate an GetCapabilities response
getCapabilities
{ "repo_name": "usgin/geoportal-server-catalog", "path": "geoportal/src/main/java/com/esri/geoportal/lib/elastic/request/CswRequest.java", "license": "apache-2.0", "size": 20978 }
[ "com.esri.geoportal.base.util.ResourcePath", "com.esri.geoportal.base.util.Val", "com.esri.geoportal.base.xml.XmlUtil", "com.esri.geoportal.context.AppResponse", "com.esri.geoportal.lib.elastic.response.OwsException", "java.nio.file.Files", "java.nio.file.Paths", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response" ]
import com.esri.geoportal.base.util.ResourcePath; import com.esri.geoportal.base.util.Val; import com.esri.geoportal.base.xml.XmlUtil; import com.esri.geoportal.context.AppResponse; import com.esri.geoportal.lib.elastic.response.OwsException; import java.nio.file.Files; import java.nio.file.Paths; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import com.esri.geoportal.base.util.*; import com.esri.geoportal.base.xml.*; import com.esri.geoportal.context.*; import com.esri.geoportal.lib.elastic.response.*; import java.nio.file.*; import javax.ws.rs.core.*;
[ "com.esri.geoportal", "java.nio", "javax.ws" ]
com.esri.geoportal; java.nio; javax.ws;
1,363,684
public EffectiveNetworkSecurityRule withDestinationAddressPrefixes(List<String> destinationAddressPrefixes) { this.destinationAddressPrefixes = destinationAddressPrefixes; return this; }
EffectiveNetworkSecurityRule function(List<String> destinationAddressPrefixes) { this.destinationAddressPrefixes = destinationAddressPrefixes; return this; }
/** * Set the destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AureLoadBalancer, Internet), System Tags, and the asterix (*). * * @param destinationAddressPrefixes the destinationAddressPrefixes value to set * @return the EffectiveNetworkSecurityRule object itself. */
Set the destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AureLoadBalancer, Internet), System Tags, and the asterix (*)
withDestinationAddressPrefixes
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/EffectiveNetworkSecurityRule.java", "license": "mit", "size": 13853 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
472,578
public void verify(){ JadeAgentIntrospector introspector = (JadeAgentIntrospector) PlatformSelector.getAgentIntrospector("jade"); while (((TesterAgent)introspector.getAgent("TestAgent")).isMessageReceived()==false) { // Wait... } checkAgentsBeliefEquealsTo("TestAgent", "ReceivedMessage", true); }
void function(){ JadeAgentIntrospector introspector = (JadeAgentIntrospector) PlatformSelector.getAgentIntrospector("jade"); while (((TesterAgent)introspector.getAgent(STR)).isMessageReceived()==false) { } checkAgentsBeliefEquealsTo(STR, STR, true); }
/** * This is the method that must create the Evaluation. * It is related with the THEN part. * * In verify method the following method must be used * checkAgentsBeliefEquealsTo(agent_name,belief_name,expected_belief_value) */
This is the method that must create the Evaluation. It is related with the THEN part. In verify method the following method must be used checkAgentsBeliefEquealsTo(agent_name,belief_name,expected_belief_value)
verify
{ "repo_name": "gsi-upm/BeastTool", "path": "beast-tool/src/test/java/es/upm/dit/gsi/beast/platform/jade/jadePlatformTest/SendAMessage.java", "license": "gpl-2.0", "size": 5163 }
[ "es.upm.dit.gsi.beast.platform.PlatformSelector", "es.upm.dit.gsi.beast.platform.jade.JadeAgentIntrospector", "es.upm.dit.gsi.beast.test.agent.jade.TesterAgent" ]
import es.upm.dit.gsi.beast.platform.PlatformSelector; import es.upm.dit.gsi.beast.platform.jade.JadeAgentIntrospector; import es.upm.dit.gsi.beast.test.agent.jade.TesterAgent;
import es.upm.dit.gsi.beast.platform.*; import es.upm.dit.gsi.beast.platform.jade.*; import es.upm.dit.gsi.beast.test.agent.jade.*;
[ "es.upm.dit" ]
es.upm.dit;
381,541
Block readBlock(SliceInput input);
Block readBlock(SliceInput input);
/** * Read a block from the specified input. The returned * block should begin at the specified position. */
Read a block from the specified input. The returned block should begin at the specified position
readBlock
{ "repo_name": "sunchao/presto", "path": "presto-spi/src/main/java/com/facebook/presto/spi/block/BlockEncoding.java", "license": "apache-2.0", "size": 1439 }
[ "io.airlift.slice.SliceInput" ]
import io.airlift.slice.SliceInput;
import io.airlift.slice.*;
[ "io.airlift.slice" ]
io.airlift.slice;
885,111
protected void fireElementContentAboutToBeReplaced(Object element) { Iterator e= new ArrayList(fElementStateListeners).iterator(); while (e.hasNext()) { IElementStateListener l= (IElementStateListener) e.next(); l.elementContentAboutToBeReplaced(element); } }
void function(Object element) { Iterator e= new ArrayList(fElementStateListeners).iterator(); while (e.hasNext()) { IElementStateListener l= (IElementStateListener) e.next(); l.elementContentAboutToBeReplaced(element); } }
/** * Informs all registered element state listeners about an impending * replace of the given element's content. * * @param element the element * @see IElementStateListener#elementContentAboutToBeReplaced(Object) */
Informs all registered element state listeners about an impending replace of the given element's content
fireElementContentAboutToBeReplaced
{ "repo_name": "xiaguangme/simon_ide_tools", "path": "02.eclipse_enhance/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java", "license": "apache-2.0", "size": 31197 }
[ "java.util.ArrayList", "java.util.Iterator" ]
import java.util.ArrayList; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,892,656
public static boolean deleteColorItem(Context context, ColorItem colorItemToDelete) { if (colorItemToDelete == null) { throw new IllegalArgumentException("Can't delete a null color item"); } final SharedPreferences sharedPreferences = getPreferences(context); final List<ColorItem> savedColorsItems = getSavedColorItems(sharedPreferences); for (Iterator<ColorItem> it = savedColorsItems.iterator(); it.hasNext(); ) { final ColorItem candidate = it.next(); if (candidate.getId() == colorItemToDelete.getId()) { it.remove(); final SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(KEY_SAVED_COLOR_ITEMS, GSON.toJson(savedColorsItems)); return editor.commit(); } } return false; }
static boolean function(Context context, ColorItem colorItemToDelete) { if (colorItemToDelete == null) { throw new IllegalArgumentException(STR); } final SharedPreferences sharedPreferences = getPreferences(context); final List<ColorItem> savedColorsItems = getSavedColorItems(sharedPreferences); for (Iterator<ColorItem> it = savedColorsItems.iterator(); it.hasNext(); ) { final ColorItem candidate = it.next(); if (candidate.getId() == colorItemToDelete.getId()) { it.remove(); final SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(KEY_SAVED_COLOR_ITEMS, GSON.toJson(savedColorsItems)); return editor.commit(); } } return false; }
/** * Delete a {@link fr.tvbarthel.apps.cameracolorpicker.data.ColorItem}. * * @param context a {@link android.content.Context}. * @param colorItemToDelete the {@link fr.tvbarthel.apps.cameracolorpicker.data.ColorItem} to be deleted. * @return Returns true if the new color was successfully deleted from persistent storage. */
Delete a <code>fr.tvbarthel.apps.cameracolorpicker.data.ColorItem</code>
deleteColorItem
{ "repo_name": "0359xiaodong/CameraColorPicker", "path": "CameraColorPicker/app/src/main/java/fr/tvbarthel/apps/cameracolorpicker/data/ColorItems.java", "license": "apache-2.0", "size": 9244 }
[ "android.content.Context", "android.content.SharedPreferences", "java.util.Iterator", "java.util.List" ]
import android.content.Context; import android.content.SharedPreferences; import java.util.Iterator; import java.util.List;
import android.content.*; import java.util.*;
[ "android.content", "java.util" ]
android.content; java.util;
1,236,896
public static FileUtils.FileCopyResult gzip(final File inFile, final File outFile, Predicate<Throwable> shouldRetry) throws IOException { gzip(Files.asByteSource(inFile), Files.asByteSink(outFile), shouldRetry); return new FileUtils.FileCopyResult(outFile); }
static FileUtils.FileCopyResult function(final File inFile, final File outFile, Predicate<Throwable> shouldRetry) throws IOException { gzip(Files.asByteSource(inFile), Files.asByteSink(outFile), shouldRetry); return new FileUtils.FileCopyResult(outFile); }
/** * Gzips the input file to the output * * @param inFile The file to gzip * @param outFile A target file to copy the uncompressed contents of inFile to * @param shouldRetry Predicate on a potential throwable to determine if the copy should be attempted again. * * @return The result of the file copy * * @throws IOException */
Gzips the input file to the output
gzip
{ "repo_name": "praveev/druid", "path": "java-util/src/main/java/io/druid/java/util/common/CompressionUtils.java", "license": "apache-2.0", "size": 16791 }
[ "com.google.common.base.Predicate", "com.google.common.io.Files", "java.io.File", "java.io.IOException" ]
import com.google.common.base.Predicate; import com.google.common.io.Files; import java.io.File; import java.io.IOException;
import com.google.common.base.*; import com.google.common.io.*; import java.io.*;
[ "com.google.common", "java.io" ]
com.google.common; java.io;
2,500,637
public void addITraitsGetter(Name getterName, Name returnType, InstructionList body) { ITraitVisitor traitVisitor = addMethodToTraits(itraits, getterName, Collections.<Name>emptyList(), returnType, Collections.<Object>emptyList(), false, ABCConstants.TRAIT_Getter, body); traitVisitor.visitStart(); traitVisitor.visitEnd(); }
void function(Name getterName, Name returnType, InstructionList body) { ITraitVisitor traitVisitor = addMethodToTraits(itraits, getterName, Collections.<Name>emptyList(), returnType, Collections.<Object>emptyList(), false, ABCConstants.TRAIT_Getter, body); traitVisitor.visitStart(); traitVisitor.visitEnd(); }
/** * Utility method to add an instance getter to the generated class. * * @param getterName {@link Name} of the method to add. * @param returnType {@link Name} of the return type of the method. * @param body An {@link InstructionList} for the body of the method. */
Utility method to add an instance getter to the generated class
addITraitsGetter
{ "repo_name": "adufilie/flex-falcon", "path": "compiler/src/org/apache/flex/compiler/internal/abc/ClassGeneratorHelper.java", "license": "apache-2.0", "size": 21906 }
[ "java.util.Collections", "org.apache.flex.abc.ABCConstants", "org.apache.flex.abc.instructionlist.InstructionList", "org.apache.flex.abc.semantics.Name", "org.apache.flex.abc.visitors.ITraitVisitor" ]
import java.util.Collections; import org.apache.flex.abc.ABCConstants; import org.apache.flex.abc.instructionlist.InstructionList; import org.apache.flex.abc.semantics.Name; import org.apache.flex.abc.visitors.ITraitVisitor;
import java.util.*; import org.apache.flex.abc.*; import org.apache.flex.abc.instructionlist.*; import org.apache.flex.abc.semantics.*; import org.apache.flex.abc.visitors.*;
[ "java.util", "org.apache.flex" ]
java.util; org.apache.flex;
2,553,881
public static String toISO8601(Date date) { if (date == null) { return null; } synchronized (ISO_8601_DATE_FORMAT) { return ISO_8601_DATE_FORMAT.format(date); } }
static String function(Date date) { if (date == null) { return null; } synchronized (ISO_8601_DATE_FORMAT) { return ISO_8601_DATE_FORMAT.format(date); } }
/** * Formats the given date to a ISO-8601 date/time format, and UTC timezone. * <p/> * The returned date uses the following format: 2007-12-17T14:57:17 * * @param date The date to format * @return The corresponding ISO-8601 formatted string. */
Formats the given date to a ISO-8601 date/time format, and UTC timezone. The returned date uses the following format: 2007-12-17T14:57:17
toISO8601
{ "repo_name": "langera/libresonic", "path": "libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java", "license": "gpl-3.0", "size": 18105 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,533,843
@Deprecated public void setNonStrokingColor(float[] components) throws IOException { if (nonStrokingColorSpaceStack.isEmpty()) { throw new IllegalStateException("The color space must be set before setting a color"); } for (int i = 0; i < components.length; i++) { writeOperand(components[i]); } PDColorSpace currentNonStrokingColorSpace = nonStrokingColorSpaceStack.peek(); if (currentNonStrokingColorSpace instanceof PDSeparation || currentNonStrokingColorSpace instanceof PDPattern || currentNonStrokingColorSpace instanceof PDICCBased) { writeOperator("scn"); } else { writeOperator("sc"); } }
void function(float[] components) throws IOException { if (nonStrokingColorSpaceStack.isEmpty()) { throw new IllegalStateException(STR); } for (int i = 0; i < components.length; i++) { writeOperand(components[i]); } PDColorSpace currentNonStrokingColorSpace = nonStrokingColorSpaceStack.peek(); if (currentNonStrokingColorSpace instanceof PDSeparation currentNonStrokingColorSpace instanceof PDPattern currentNonStrokingColorSpace instanceof PDICCBased) { writeOperator("scn"); } else { writeOperator("sc"); } }
/** * Set the color components of current non-stroking color space. * * @param components The components to set for the current color. * @throws IOException If there is an error while writing to the stream. * @deprecated Use {@link #setNonStrokingColor(PDColor)} instead. */
Set the color components of current non-stroking color space
setNonStrokingColor
{ "repo_name": "benmccann/pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java", "license": "apache-2.0", "size": 73640 }
[ "java.io.IOException", "org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace", "org.apache.pdfbox.pdmodel.graphics.color.PDICCBased", "org.apache.pdfbox.pdmodel.graphics.color.PDPattern", "org.apache.pdfbox.pdmodel.graphics.color.PDSeparation" ]
import java.io.IOException; import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace; import org.apache.pdfbox.pdmodel.graphics.color.PDICCBased; import org.apache.pdfbox.pdmodel.graphics.color.PDPattern; import org.apache.pdfbox.pdmodel.graphics.color.PDSeparation;
import java.io.*; import org.apache.pdfbox.pdmodel.graphics.color.*;
[ "java.io", "org.apache.pdfbox" ]
java.io; org.apache.pdfbox;
1,370,679
public Long getTagUsage(ContentItem contentItem);
Long function(ContentItem contentItem);
/** * Counts the current usages of a tag, meaning, how many ContentItems are tagged with the tag. * @param contentItem * @return * @author szabyg */
Counts the current usages of a tag, meaning, how many ContentItems are tagged with the tag
getTagUsage
{ "repo_name": "fregaham/KiWi", "path": "src/action/kiwi/api/tagging/TaggingService.java", "license": "bsd-3-clause", "size": 8103 }
[ "kiwi.model.content.ContentItem" ]
import kiwi.model.content.ContentItem;
import kiwi.model.content.*;
[ "kiwi.model.content" ]
kiwi.model.content;
853,245
public List<ReportNote> getNotes();
List<ReportNote> function();
/** * Gets the notes. * * @return the notes */
Gets the notes
getNotes
{ "repo_name": "IHTSDO/OTF-Mapping-Service", "path": "model/src/main/java/org/ihtsdo/otf/mapping/reports/Report.java", "license": "apache-2.0", "size": 4298 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,464,119
List<KeywordHit> getResults(Keyword keyword) { return results.get(keyword); }
List<KeywordHit> getResults(Keyword keyword) { return results.get(keyword); }
/** * Gets the keyword hits stored in this object for a given keyword. * * @param keyword The keyword. * * @return The keyword hits. */
Gets the keyword hits stored in this object for a given keyword
getResults
{ "repo_name": "rcordovano/autopsy", "path": "KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java", "license": "apache-2.0", "size": 15198 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,101,741
private String[] validateUI() { ArrayList<String> errorList = new ArrayList<String>(); if (EDIT_MODE_CORRECT.equals(form.getLocalContext().getSelectedEditMode())) { if (form.ctnDetails().ccCorrectingHCP().getValue() == null) { errorList.add("Correcting HCP is mandatory."); } if (form.ctnDetails().dtimCorrectedDateTime().getValue() == null) { errorList.add("Correcting Date Time is mandatory."); } if (form.ctnDetails().txtCorrectionReason().getValue() == null) { errorList.add("Correction Reason is mandatory."); } } return errorList.toArray(new String[errorList.size()]); }
String[] function() { ArrayList<String> errorList = new ArrayList<String>(); if (EDIT_MODE_CORRECT.equals(form.getLocalContext().getSelectedEditMode())) { if (form.ctnDetails().ccCorrectingHCP().getValue() == null) { errorList.add(STR); } if (form.ctnDetails().dtimCorrectedDateTime().getValue() == null) { errorList.add(STR); } if (form.ctnDetails().txtCorrectionReason().getValue() == null) { errorList.add(STR); } } return errorList.toArray(new String[errorList.size()]); }
/** * WDEV-13872 * Custom validation (for correcting comment notes) */
WDEV-13872 Custom validation (for correcting comment notes)
validateUI
{ "repo_name": "FreudianNM/openMAXIMS", "path": "Source Library/openmaxims_workspace/OCRR/src/ims/ocrr/forms/resultcommentsdialog/Logic.java", "license": "agpl-3.0", "size": 18889 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,621,354
public List<TerrainModification> getNewVersion(final String proprietaire, final long lastVersion, final String me) throws GeneralException { final List<TerrainModification> modifications = new ArrayList<>(); final Map<Integer, Map<Integer, Layers>> terrain = getTerrain(proprietaire, false).getLayers(); for (final Entry<Integer, Map<Integer, Layers>> lineEntry : terrain.entrySet()) { final Map<Integer, Layers> line = lineEntry.getValue(); for (final Entry<Integer, Layers> tileEntry : line.entrySet()) { final Layers layers = tileEntry.getValue(); final int x = tileEntry.getKey(); final int y = lineEntry.getKey(); addModification(modifications, x, y, lastVersion, layers.getSousSol(), me); addModification(modifications, x, y, lastVersion, layers.getSol(), me); addModification(modifications, x, y, lastVersion, layers.getLayer1(), me); } } return modifications; }
List<TerrainModification> function(final String proprietaire, final long lastVersion, final String me) throws GeneralException { final List<TerrainModification> modifications = new ArrayList<>(); final Map<Integer, Map<Integer, Layers>> terrain = getTerrain(proprietaire, false).getLayers(); for (final Entry<Integer, Map<Integer, Layers>> lineEntry : terrain.entrySet()) { final Map<Integer, Layers> line = lineEntry.getValue(); for (final Entry<Integer, Layers> tileEntry : line.entrySet()) { final Layers layers = tileEntry.getValue(); final int x = tileEntry.getKey(); final int y = lineEntry.getKey(); addModification(modifications, x, y, lastVersion, layers.getSousSol(), me); addModification(modifications, x, y, lastVersion, layers.getSol(), me); addModification(modifications, x, y, lastVersion, layers.getLayer1(), me); } } return modifications; }
/** * Renvoi la nouvelle version du terrain * * @param proprietaire * @param lastVersion * @param login * @return * @throws GeneralException */
Renvoi la nouvelle version du terrain
getNewVersion
{ "repo_name": "Mastersnes/BUL", "path": "src/main/java/bdd/TerrainDAO.java", "license": "apache-2.0", "size": 6946 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map" ]
import java.util.ArrayList; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,111,141
public CreateBucketResult grabBucket(final int bucketId, final InternalDistributedMember moveSource, final boolean forceCreation, final boolean replaceOffineData, final boolean isRebalance, final InternalDistributedMember creationRequestor, final boolean isDiskRecovery) { CreateBucketResult grab = grabFreeBucket(bucketId, partitionedRegion.getMyId(), moveSource, forceCreation, isRebalance, true, replaceOffineData, creationRequestor); if (!grab.nowExists()) { if (logger.isDebugEnabled()) { logger.debug("Failed grab for bucketId = {}{}{}", partitionedRegion.getPRId(), PartitionedRegion.BUCKET_ID_SEPARATOR, bucketId); } // Assert.assertTrue(nList.contains(partitionedRegion.getNode().getMemberId()) , // " grab returned false and b2n does not contains this member."); } else { // try grabbing buckets for all the PR which are colocated with it List colocatedWithList = ColocationHelper.getColocatedChildRegions(partitionedRegion); for (final Object o : colocatedWithList) { PartitionedRegion pr = (PartitionedRegion) o; if (logger.isDebugEnabled()) { logger.debug("For bucketId = {} isInitialized {} iscolocation complete {} pr name {}", bucketId, pr.isInitialized(), pr.getDataStore().isColocationComplete(bucketId), pr.getFullPath()); } if ((isDiskRecovery || pr.isInitialized()) && (pr.getDataStore().isColocationComplete(bucketId))) { try { grab = pr.getDataStore().grabFreeBucketRecursively(bucketId, pr, moveSource, forceCreation, replaceOffineData, isRebalance, creationRequestor, isDiskRecovery); } catch (RegionDestroyedException rde) { if (logger.isDebugEnabled()) { logger.debug("Failed to grab, colocated region for bucketId = {}{}{} is destroyed.", partitionedRegion.getPRId(), PartitionedRegion.BUCKET_ID_SEPARATOR, bucketId); } } if (!grab.nowExists()) { if (logger.isDebugEnabled()) { logger.debug("Failed grab for bucketId = {}{}{}", partitionedRegion.getPRId(), PartitionedRegion.BUCKET_ID_SEPARATOR, bucketId); } // Should Throw Exception-- As discussed in weekly call // " grab returned false and b2n does not contains this member."); } } } } if (logger.isDebugEnabled()) { logger.debug("Grab attempt on bucketId={}{}{}; grab:{}", partitionedRegion.getPRId(), PartitionedRegion.BUCKET_ID_SEPARATOR, bucketId, grab); } return grab; }
CreateBucketResult function(final int bucketId, final InternalDistributedMember moveSource, final boolean forceCreation, final boolean replaceOffineData, final boolean isRebalance, final InternalDistributedMember creationRequestor, final boolean isDiskRecovery) { CreateBucketResult grab = grabFreeBucket(bucketId, partitionedRegion.getMyId(), moveSource, forceCreation, isRebalance, true, replaceOffineData, creationRequestor); if (!grab.nowExists()) { if (logger.isDebugEnabled()) { logger.debug(STR, partitionedRegion.getPRId(), PartitionedRegion.BUCKET_ID_SEPARATOR, bucketId); } } else { List colocatedWithList = ColocationHelper.getColocatedChildRegions(partitionedRegion); for (final Object o : colocatedWithList) { PartitionedRegion pr = (PartitionedRegion) o; if (logger.isDebugEnabled()) { logger.debug(STR, bucketId, pr.isInitialized(), pr.getDataStore().isColocationComplete(bucketId), pr.getFullPath()); } if ((isDiskRecovery pr.isInitialized()) && (pr.getDataStore().isColocationComplete(bucketId))) { try { grab = pr.getDataStore().grabFreeBucketRecursively(bucketId, pr, moveSource, forceCreation, replaceOffineData, isRebalance, creationRequestor, isDiskRecovery); } catch (RegionDestroyedException rde) { if (logger.isDebugEnabled()) { logger.debug(STR, partitionedRegion.getPRId(), PartitionedRegion.BUCKET_ID_SEPARATOR, bucketId); } } if (!grab.nowExists()) { if (logger.isDebugEnabled()) { logger.debug(STR, partitionedRegion.getPRId(), PartitionedRegion.BUCKET_ID_SEPARATOR, bucketId); } } } } } if (logger.isDebugEnabled()) { logger.debug(STR, partitionedRegion.getPRId(), PartitionedRegion.BUCKET_ID_SEPARATOR, bucketId, grab); } return grab; }
/** * Create a redundancy bucket on this member * * @param bucketId the id of the bucket to create * @param moveSource the member id of where the bucket is being copied from, if this is a bucket * move. Setting this field means that we are allowed to go over redundancy. * @param forceCreation force the bucket creation, even if it would provide better balance if the * bucket was placed on another node. * @param replaceOffineData create the bucket, even if redundancy is satisfied when considering * offline members. * @param isRebalance true if this is a rebalance * @param creationRequestor the id of the member that is atomically creating this bucket on all * members, if this is an atomic bucket creation. * @return the status of the bucket creation. */
Create a redundancy bucket on this member
grabBucket
{ "repo_name": "jdeppe-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java", "license": "apache-2.0", "size": 123871 }
[ "java.util.List", "org.apache.geode.cache.RegionDestroyedException", "org.apache.geode.distributed.internal.membership.InternalDistributedMember" ]
import java.util.List; import org.apache.geode.cache.RegionDestroyedException; import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import java.util.*; import org.apache.geode.cache.*; import org.apache.geode.distributed.internal.membership.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
548,294
@Override public String interceptSQL(String sql, int sqlType) { LOGGER.debug("sql interceptSQL:"); final int sqltype = sqlType; final String sqls = DefaultSqlInterceptor.processEscape(sql); NetSystem.getInstance().getExecutor() .execute(new StatisticsSqlRunner(sqltype, sqls)); return sql; }
String function(String sql, int sqlType) { LOGGER.debug(STR); final int sqltype = sqlType; final String sqls = DefaultSqlInterceptor.processEscape(sql); NetSystem.getInstance().getExecutor() .execute(new StatisticsSqlRunner(sqltype, sqls)); return sql; }
/** * interceptSQL , type :insert,delete,update,select exectime:xxx ms log * content : select:select 1 from table,exectime:100ms,shared:1 etc */
interceptSQL , type :insert,delete,update,select exectime:xxx ms log content : select:select 1 from table,exectime:100ms,shared:1 etc
interceptSQL
{ "repo_name": "huangsizhou/Mycat-Server", "path": "src/main/java/io/mycat/server/interceptor/impl/StatisticsSqlInterceptor.java", "license": "apache-2.0", "size": 3758 }
[ "io.mycat.net.NetSystem" ]
import io.mycat.net.NetSystem;
import io.mycat.net.*;
[ "io.mycat.net" ]
io.mycat.net;
1,197,150
private static DelegatedCredentialReference getDelegatedCredentialReference(String serializedDCR) throws AuthenticationException { StringReader serialDCR = new StringReader(serializedDCR); ClassLoader classLoader = CaGridWebSSODelegationLookupFilter.class.getClassLoader(); DelegatedCredentialReference dcr = null; try { InputStream wsddFile = classLoader.getResourceAsStream("cdsclient-config.wsdd"); dcr = (DelegatedCredentialReference) Utils.deserializeObject(serialDCR, DelegatedCredentialReference.class, wsddFile); } catch (Exception e) { logger.error(e.getMessage(), e); throw new AuthenticationException("Unable to deserialize the Delegation Reference. " + e.getMessage(), e); } return dcr; }
static DelegatedCredentialReference function(String serializedDCR) throws AuthenticationException { StringReader serialDCR = new StringReader(serializedDCR); ClassLoader classLoader = CaGridWebSSODelegationLookupFilter.class.getClassLoader(); DelegatedCredentialReference dcr = null; try { InputStream wsddFile = classLoader.getResourceAsStream(STR); dcr = (DelegatedCredentialReference) Utils.deserializeObject(serialDCR, DelegatedCredentialReference.class, wsddFile); } catch (Exception e) { logger.error(e.getMessage(), e); throw new AuthenticationException(STR + e.getMessage(), e); } return dcr; }
/** * This method de-serializes the client serialized DelegatedCredentialReference * * @param serializedDCR * @return DelegatedCredentialReference */
This method de-serializes the client serialized DelegatedCredentialReference
getDelegatedCredentialReference
{ "repo_name": "NCIP/cagrid-iphone-app", "path": "software/gss/src/gov/nih/nci/gss/grid/authentication/AuthenticationUtility.java", "license": "bsd-3-clause", "size": 7842 }
[ "gov.nih.nci.cagrid.common.Utils", "java.io.InputStream", "java.io.StringReader", "org.cagrid.gaards.cds.delegated.stubs.types.DelegatedCredentialReference", "org.cagrid.websso.client.filter.CaGridWebSSODelegationLookupFilter" ]
import gov.nih.nci.cagrid.common.Utils; import java.io.InputStream; import java.io.StringReader; import org.cagrid.gaards.cds.delegated.stubs.types.DelegatedCredentialReference; import org.cagrid.websso.client.filter.CaGridWebSSODelegationLookupFilter;
import gov.nih.nci.cagrid.common.*; import java.io.*; import org.cagrid.gaards.cds.delegated.stubs.types.*; import org.cagrid.websso.client.filter.*;
[ "gov.nih.nci", "java.io", "org.cagrid.gaards", "org.cagrid.websso" ]
gov.nih.nci; java.io; org.cagrid.gaards; org.cagrid.websso;
1,040,622
protected void logOutputToFile() { PrintWriter writer = null; try { String logHeader = null; String path = logFileDirectory(); int transferType = parent.getTransferType(); if (transferType == ImportExportDataProcess.EXPORT) { logHeader = "[ Data Export Process - "; path += SystemProperties.getProperty("system", "eq.export.log"); } else { logHeader = "[ Data Import Process - "; path += SystemProperties.getProperty("system", "eq.import.log"); } // add a header for this process DateFormat df = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); StringBuffer sb = new StringBuffer(); sb.append(logHeader); sb.append(df.format(new Date(startTime))); sb.append(" ]\n\n"); sb.append(progress.getText()); sb.append("\n\n"); writer = new PrintWriter(new FileWriter(path, true), true); writer.println(sb.toString()); sb = null; } catch (IOException io) {} finally { if (writer != null) { writer.close(); } writer = null; } }
void function() { PrintWriter writer = null; try { String logHeader = null; String path = logFileDirectory(); int transferType = parent.getTransferType(); if (transferType == ImportExportDataProcess.EXPORT) { logHeader = STR; path += SystemProperties.getProperty(STR, STR); } else { logHeader = STR; path += SystemProperties.getProperty(STR, STR); } DateFormat df = new SimpleDateFormat(STR); StringBuffer sb = new StringBuffer(); sb.append(logHeader); sb.append(df.format(new Date(startTime))); sb.append(STR); sb.append(progress.getText()); sb.append("\n\n"); writer = new PrintWriter(new FileWriter(path, true), true); writer.println(sb.toString()); sb = null; } catch (IOException io) {} finally { if (writer != null) { writer.close(); } writer = null; } }
/** * Logs the contents of the output pane to file. */
Logs the contents of the output pane to file
logOutputToFile
{ "repo_name": "takisd123/executequery", "path": "src/org/executequery/gui/importexport/AbstractImportExportWorker.java", "license": "gpl-3.0", "size": 29777 }
[ "java.io.FileWriter", "java.io.IOException", "java.io.PrintWriter", "java.text.DateFormat", "java.text.SimpleDateFormat", "java.util.Date", "org.underworldlabs.util.SystemProperties" ]
import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import org.underworldlabs.util.SystemProperties;
import java.io.*; import java.text.*; import java.util.*; import org.underworldlabs.util.*;
[ "java.io", "java.text", "java.util", "org.underworldlabs.util" ]
java.io; java.text; java.util; org.underworldlabs.util;
2,080,817
public DiscoCache discoCache(AffinityTopologyVersion topVer) { return discoCacheHist.get(topVer); }
DiscoCache function(AffinityTopologyVersion topVer) { return discoCacheHist.get(topVer); }
/** * Gets discovery collection cache from SPI safely guarding against "floating" collections. * * @return Discovery collection cache. */
Gets discovery collection cache from SPI safely guarding against "floating" collections
discoCache
{ "repo_name": "irudyak/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java", "license": "apache-2.0", "size": 123630 }
[ "org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion" ]
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.affinity.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,632,571
EClass getParameterExpressionType();
EClass getParameterExpressionType();
/** * Returns the meta object for class '{@link net.opengis.wfs20.ParameterExpressionType <em>Parameter Expression Type</em>}'. * <!-- begin-user-doc * --> <!-- end-user-doc --> * @return the meta object for class '<em>Parameter Expression Type</em>'. * @see net.opengis.wfs20.ParameterExpressionType * @generated */
Returns the meta object for class '<code>net.opengis.wfs20.ParameterExpressionType Parameter Expression Type</code>'.
getParameterExpressionType
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.wfs/src/net/opengis/wfs20/Wfs20Package.java", "license": "lgpl-2.1", "size": 404067 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,181,568
private int getPrimaryColor() { TypedArray typedArray = getContext().obtainStyledAttributes(new TypedValue().data, new int[]{R.attr.colorPrimary}); int color = typedArray.getColor(0, 0); typedArray.recycle(); return color; }
int function() { TypedArray typedArray = getContext().obtainStyledAttributes(new TypedValue().data, new int[]{R.attr.colorPrimary}); int color = typedArray.getColor(0, 0); typedArray.recycle(); return color; }
/** * Gets the primary color of this project. * * @return primary color of this project. */
Gets the primary color of this project
getPrimaryColor
{ "repo_name": "PSD-Company/duo-navigation-drawer", "path": "duo-navigation-drawer/src/main/java/nl/psdcompany/duonavigationdrawer/views/DuoMenuView.java", "license": "apache-2.0", "size": 11793 }
[ "android.content.res.TypedArray", "android.util.TypedValue" ]
import android.content.res.TypedArray; import android.util.TypedValue;
import android.content.res.*; import android.util.*;
[ "android.content", "android.util" ]
android.content; android.util;
800,768
@Test public void testGetNestedNamespace2() { String msg = "The adaptation of Namespace.getNestedNamespace() seems to be wrong. The return type should be an EList."; assertTrue(msg, package1.getNestedNamespace() instanceof EList); } /** * <p> * A test case testing the operation {@link Namespace#getNestingNamespace()}
void function() { String msg = STR; assertTrue(msg, package1.getNestedNamespace() instanceof EList); } /** * <p> * A test case testing the operation {@link Namespace#getNestingNamespace()}
/** * <p> * A test case testing the operation {@link Namespace#getNestedNamespace()}. * </p> */
A test case testing the operation <code>Namespace#getNestedNamespace()</code>.
testGetNestedNamespace2
{ "repo_name": "dresden-ocl/dresdenocl", "path": "tests/org.dresdenocl.metamodels.test/src/org/dresdenocl/metamodels/test/tests/TestNamespace.java", "license": "lgpl-3.0", "size": 8809 }
[ "org.dresdenocl.pivotmodel.Namespace", "org.eclipse.emf.common.util.EList", "org.junit.Assert" ]
import org.dresdenocl.pivotmodel.Namespace; import org.eclipse.emf.common.util.EList; import org.junit.Assert;
import org.dresdenocl.pivotmodel.*; import org.eclipse.emf.common.util.*; import org.junit.*;
[ "org.dresdenocl.pivotmodel", "org.eclipse.emf", "org.junit" ]
org.dresdenocl.pivotmodel; org.eclipse.emf; org.junit;
2,515,119
protected JBuffer getMemoryBuffer(int minSize) { if (!memory.isInitialized() || memory.size() < minSize) { allocate(minSize); } return memory; }
JBuffer function(int minSize) { if (!memory.isInitialized() memory.size() < minSize) { allocate(minSize); } return memory; }
/** * Retrieves a memory buffer, allocated if neccessary, at least minSize in * bytes. If existing buffer is already big enough, it is returned, otherwise * a new buffer is allocated and the existing one released. * * @param minSize * minimum number of bytes required for the buffer * @return the buffer */
Retrieves a memory buffer, allocated if neccessary, at least minSize in bytes. If existing buffer is already big enough, it is returned, otherwise a new buffer is allocated and the existing one released
getMemoryBuffer
{ "repo_name": "universsky/diddler", "path": "src/org/jnetpcap/packet/JPacket.java", "license": "lgpl-3.0", "size": 30500 }
[ "org.jnetpcap.nio.JBuffer" ]
import org.jnetpcap.nio.JBuffer;
import org.jnetpcap.nio.*;
[ "org.jnetpcap.nio" ]
org.jnetpcap.nio;
1,558,619
public void setWorkingDirectory( File workingDir ) { if ( workingDir != null ) { this.workingDir = workingDir.getAbsolutePath(); } }
void function( File workingDir ) { if ( workingDir != null ) { this.workingDir = workingDir.getAbsolutePath(); } }
/** * Sets execution directory. */
Sets execution directory
setWorkingDirectory
{ "repo_name": "CCM-Modding/Nucleum-Omnium", "path": "src/main/java/ccm/libs/org/codehaus/plexus/util/cli/shell/Shell.java", "license": "mit", "size": 10880 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,582,696
private void writeByte(int x) { assert x >= 0 && x < 256; // optimized if byte-aligned if (N == 0) { try { out.write(x); } catch (IOException e) { e.printStackTrace(); } return; } // otherwise write one bit at a time for (int i = 0; i < 8; i++) { boolean bit = ((x >>> (8 - i - 1)) & 1) == 1; writeBit(bit); } }
void function(int x) { assert x >= 0 && x < 256; if (N == 0) { try { out.write(x); } catch (IOException e) { e.printStackTrace(); } return; } for (int i = 0; i < 8; i++) { boolean bit = ((x >>> (8 - i - 1)) & 1) == 1; writeBit(bit); } }
/** * Write the 8-bit byte to the binary output stream. */
Write the 8-bit byte to the binary output stream
writeByte
{ "repo_name": "wz12406/accumulate", "path": "algorithm/src/webapp/doc/算法 第四版/AlgorithmsSedgewick-master/StdLib/BinaryOut.java", "license": "apache-2.0", "size": 9175 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
655,461
@Override public void doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) { super.doRouteStatusChange(statusChangeEvent); if (getDocumentHeader().getWorkflowDocument().isProcessed()) { changeLedgerPendingEntriesApprovedStatusCode(); } else if (getDocumentHeader().getWorkflowDocument().isCanceled() || getDocumentHeader().getWorkflowDocument().isDisapproved()) { removeLedgerPendingEntries(); } }
void function(DocumentRouteStatusChange statusChangeEvent) { super.doRouteStatusChange(statusChangeEvent); if (getDocumentHeader().getWorkflowDocument().isProcessed()) { changeLedgerPendingEntriesApprovedStatusCode(); } else if (getDocumentHeader().getWorkflowDocument().isCanceled() getDocumentHeader().getWorkflowDocument().isDisapproved()) { removeLedgerPendingEntries(); } }
/** * Override to call super and then iterate over all GLPEs and update the approved code appropriately. * * @see Document#doRouteStatusChange() */
Override to call super and then iterate over all GLPEs and update the approved code appropriately
doRouteStatusChange
{ "repo_name": "ua-eas/kfs-devops-automation-fork", "path": "kfs-ld/src/main/java/org/kuali/kfs/module/ld/document/LaborJournalVoucherDocument.java", "license": "agpl-3.0", "size": 12355 }
[ "org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange" ]
import org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange;
import org.kuali.rice.kew.framework.postprocessor.*;
[ "org.kuali.rice" ]
org.kuali.rice;
1,649,163
public synchronized boolean sendAck(PowerMaxBaseMessage msg, byte ackType) { int code = msg.getCode(); byte[] rawData = msg.getRawData(); byte[] ackData; if ((code >= 0x80) || ((code < 0x10) && (rawData[rawData.length - 3] == 0x43))) { ackData = new byte[] { 0x0D, ackType, 0x43, 0x00, 0x0A }; } else { ackData = new byte[] { 0x0D, ackType, 0x00, 0x0A }; } if (logger.isDebugEnabled()) { logger.debug("sendAck(): sending message {}", DatatypeConverter.printHexBinary(ackData)); } boolean done = sendMessage(ackData); if (!done) { logger.debug("sendAck(): failed"); } return done; }
synchronized boolean function(PowerMaxBaseMessage msg, byte ackType) { int code = msg.getCode(); byte[] rawData = msg.getRawData(); byte[] ackData; if ((code >= 0x80) ((code < 0x10) && (rawData[rawData.length - 3] == 0x43))) { ackData = new byte[] { 0x0D, ackType, 0x43, 0x00, 0x0A }; } else { ackData = new byte[] { 0x0D, ackType, 0x00, 0x0A }; } if (logger.isDebugEnabled()) { logger.debug(STR, DatatypeConverter.printHexBinary(ackData)); } boolean done = sendMessage(ackData); if (!done) { logger.debug(STR); } return done; }
/** * Send an ACK for a received message * * @param msg * the received message object * @param ackType * the type of ACK to be sent * * @return true if the ACK was sent or false if not */
Send an ACK for a received message
sendAck
{ "repo_name": "dominicdesu/openhab", "path": "bundles/binding/org.openhab.binding.powermax/src/main/java/org/openhab/binding/powermax/internal/message/PowerMaxCommDriver.java", "license": "epl-1.0", "size": 21994 }
[ "javax.xml.bind.DatatypeConverter" ]
import javax.xml.bind.DatatypeConverter;
import javax.xml.bind.*;
[ "javax.xml" ]
javax.xml;
1,775,653
public String toString() { StringBuffer text = new StringBuffer(); for (Iterator iter = turns.iterator(); iter.hasNext();) { text.append(iter.next()); if (iter.hasNext()) text.append(" -> "); } text.append(" ["); text.append(getScore()); text.append("]"); return text.toString(); }
String function() { StringBuffer text = new StringBuffer(); for (Iterator iter = turns.iterator(); iter.hasNext();) { text.append(iter.next()); if (iter.hasNext()) text.append(STR); } text.append(STR); text.append(getScore()); text.append("]"); return text.toString(); }
/** * For debugging * * @see java.lang.Object#toString() */
For debugging
toString
{ "repo_name": "andrewswan/tally-ho", "path": "src/main/java/tallyho/model/player/ai/Path.java", "license": "mit", "size": 2293 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,667,910
public static Map<String, ResourceInformation> getNodeResourceInformation( Configuration conf) { if (!initializedNodeResources) { synchronized (ResourceUtils.class) { if (!initializedNodeResources) { Map<String, ResourceInformation> nodeResources = initializeNodeResourceInformation( conf); checkMandatoryResources(nodeResources); addMandatoryResources(nodeResources); setAllocationForMandatoryResources(nodeResources, conf); readOnlyNodeResources = Collections.unmodifiableMap(nodeResources); initializedNodeResources = true; } } } return readOnlyNodeResources; }
static Map<String, ResourceInformation> function( Configuration conf) { if (!initializedNodeResources) { synchronized (ResourceUtils.class) { if (!initializedNodeResources) { Map<String, ResourceInformation> nodeResources = initializeNodeResourceInformation( conf); checkMandatoryResources(nodeResources); addMandatoryResources(nodeResources); setAllocationForMandatoryResources(nodeResources, conf); readOnlyNodeResources = Collections.unmodifiableMap(nodeResources); initializedNodeResources = true; } } } return readOnlyNodeResources; }
/** * Function to get the resources for a node. This function will look at the * file {@link YarnConfiguration#NODE_RESOURCES_CONFIGURATION_FILE} to * determine the node resources. * * @param conf configuration file * @return a map to resource name to the ResourceInformation object. The map * is guaranteed to have entries for memory and vcores */
Function to get the resources for a node. This function will look at the file <code>YarnConfiguration#NODE_RESOURCES_CONFIGURATION_FILE</code> to determine the node resources
getNodeResourceInformation
{ "repo_name": "ChetnaChaudhari/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java", "license": "apache-2.0", "size": 28572 }
[ "java.util.Collections", "java.util.Map", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.yarn.api.records.ResourceInformation" ]
import java.util.Collections; import java.util.Map; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.api.records.ResourceInformation;
import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.yarn.api.records.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
745,823
public final static VersionTypeImpl parseFactory( String versionAsString) throws NullPointerException, ParseException { if (versionAsString == null) throw new NullPointerException("Cannot convert a null string into a value of the version type."); int dotIndex = versionAsString.indexOf('.'); if (dotIndex == -1) throw new ParseException("The given version value does not contain a major/minor separator dot.", 0); String majorString = versionAsString.substring(0, dotIndex); String minorString = versionAsString.substring(dotIndex + 1); try { int major = Integer.parseInt(majorString); if ((major < Byte.MIN_VALUE) || (major > Byte.MAX_VALUE)) throw new NumberFormatException("The major part of the version number must be between " + Byte.MIN_VALUE + " and " + Byte.MAX_VALUE + "."); int minor = Integer.parseInt(minorString); if ((minor < Byte.MIN_VALUE) || (minor > Byte.MAX_VALUE)) throw new NumberFormatException("The minor part of the version number must be between " + Byte.MIN_VALUE + " and " + Byte.MAX_VALUE + "."); return new VersionTypeImpl((byte) major, (byte) minor); } catch (NumberFormatException nfe) { throw new ParseException("Unable to parse the major or minor parts of a version type value: " + nfe.getMessage(), 0); } } // private final static String uInt8ToString(@UInt8 byte number) { // // return Integer.toString((number >= 0) ? number : 256 + number); // }
final static VersionTypeImpl function( String versionAsString) throws NullPointerException, ParseException { if (versionAsString == null) throw new NullPointerException(STR); int dotIndex = versionAsString.indexOf('.'); if (dotIndex == -1) throw new ParseException(STR, 0); String majorString = versionAsString.substring(0, dotIndex); String minorString = versionAsString.substring(dotIndex + 1); try { int major = Integer.parseInt(majorString); if ((major < Byte.MIN_VALUE) (major > Byte.MAX_VALUE)) throw new NumberFormatException(STR + Byte.MIN_VALUE + STR + Byte.MAX_VALUE + "."); int minor = Integer.parseInt(minorString); if ((minor < Byte.MIN_VALUE) (minor > Byte.MAX_VALUE)) throw new NumberFormatException(STR + Byte.MIN_VALUE + STR + Byte.MAX_VALUE + "."); return new VersionTypeImpl((byte) major, (byte) minor); } catch (NumberFormatException nfe) { throw new ParseException(STR + nfe.getMessage(), 0); } }
/** * <p>Parse a string representation of a version number and create a value of this * class. The value must contain a&nbsp;'<code>.</code>' to be valid. The major and minor * parts of the version numbers, before and after the dot respectively, must range between * 0&nbsp;and&nbsp;255.</p> * * @param versionAsString String representation of a version number. * @return Version number value. * * @throws NullPointerException The given version number string is <code>null</code>. * @throws ParseException The given version number string causes parse or number range errors * that prevent it from being converted into a version number value. */
Parse a string representation of a version number and create a value of this class. The value must contain a&nbsp;'<code>.</code>' to be valid. The major and minor parts of the version numbers, before and after the dot respectively, must range between 0&nbsp;and&nbsp;255
parseFactory
{ "repo_name": "AMWA-TV/maj", "path": "src/main/java/tv/amwa/maj/record/impl/VersionTypeImpl.java", "license": "apache-2.0", "size": 9813 }
[ "java.text.ParseException" ]
import java.text.ParseException;
import java.text.*;
[ "java.text" ]
java.text;
443,974
@Bean(name = NAME) @ConditionalOnMissingBean(name = NAME) public String flywayCoreUnavailable() { return "N/A"; }
@Bean(name = NAME) @ConditionalOnMissingBean(name = NAME) String function() { return "N/A"; }
/** * Fallback, when flyway is disabled => some configuration depends on it (e.g. Rest Template) * @return */
Fallback, when flyway is disabled => some configuration depends on it (e.g. Rest Template)
flywayCoreUnavailable
{ "repo_name": "bcvsolutions/CzechIdMng", "path": "Realization/backend/core/core-impl/src/main/java/eu/bcvsolutions/idm/core/config/flyway/CoreFlywayConfig.java", "license": "mit", "size": 2261 }
[ "org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean", "org.springframework.context.annotation.Bean" ]
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean;
import org.springframework.boot.autoconfigure.condition.*; import org.springframework.context.annotation.*;
[ "org.springframework.boot", "org.springframework.context" ]
org.springframework.boot; org.springframework.context;
2,459,402
private void onGetBlobDataError(Exception e, GetBlobOptionsInternal options, boolean encrypted) { onError(e); Counter blobErrorCount = encrypted ? getEncryptedBlobErrorCount : getBlobErrorCount; Counter blobWithRangeErrorCount = encrypted ? getEncryptedBlobWithRangeErrorCount : getBlobWithRangeErrorCount; Meter operationErrorRateMeter = encrypted ? encryptedOperationErrorRate : operationErrorRate; if (RouterUtils.isSystemHealthError(e)) { blobErrorCount.inc(); if (options != null && options.getBlobOptions.getRange() != null) { blobWithRangeErrorCount.inc(); } operationErrorRateMeter.mark(); } }
void function(Exception e, GetBlobOptionsInternal options, boolean encrypted) { onError(e); Counter blobErrorCount = encrypted ? getEncryptedBlobErrorCount : getBlobErrorCount; Counter blobWithRangeErrorCount = encrypted ? getEncryptedBlobWithRangeErrorCount : getBlobWithRangeErrorCount; Meter operationErrorRateMeter = encrypted ? encryptedOperationErrorRate : operationErrorRate; if (RouterUtils.isSystemHealthError(e)) { blobErrorCount.inc(); if (options != null && options.getBlobOptions.getRange() != null) { blobWithRangeErrorCount.inc(); } operationErrorRateMeter.mark(); } }
/** * Update appropriate metrics on a getBlob (Data or All) operation related error. * @param e the {@link Exception} associated with the error. * @param options the {@link GetBlobOptionsInternal} associated with the request. * @param encrypted {@code true} if blob is encrypted, {@code false} otherwise */
Update appropriate metrics on a getBlob (Data or All) operation related error
onGetBlobDataError
{ "repo_name": "vgkholla/ambry", "path": "ambry-router/src/main/java/com.github.ambry.router/NonBlockingRouterMetrics.java", "license": "apache-2.0", "size": 46374 }
[ "com.codahale.metrics.Counter", "com.codahale.metrics.Meter" ]
import com.codahale.metrics.Counter; import com.codahale.metrics.Meter;
import com.codahale.metrics.*;
[ "com.codahale.metrics" ]
com.codahale.metrics;
1,066,180
protected void checkResultByFile(@Nullable String message, @TestDataFile @NotNull String expectedFilePath, final boolean ignoreTrailingSpaces) { bringRealEditorBack(); PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting(); if (ignoreTrailingSpaces) { final Editor editor = myEditor; TrailingSpacesStripper.strip(editor.getDocument(), false, true); EditorUtil.fillVirtualSpaceUntilCaret(editor); } PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); String fullPath = getTestDataPath() + expectedFilePath; File ioFile = new File(fullPath); assertTrue(getMessage("Cannot find file " + fullPath, message), ioFile.exists()); String fileText; try { checkCaseSensitiveFS(fullPath, ioFile); fileText = FileUtil.loadFile(ioFile, CharsetToolkit.UTF8_CHARSET); } catch (IOException e) { throw new RuntimeException(e); } checkResultByText(message, StringUtil.convertLineSeparators(fileText), ignoreTrailingSpaces, getTestDataPath() + "/" + expectedFilePath); }
void function(@Nullable String message, @TestDataFile @NotNull String expectedFilePath, final boolean ignoreTrailingSpaces) { bringRealEditorBack(); PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting(); if (ignoreTrailingSpaces) { final Editor editor = myEditor; TrailingSpacesStripper.strip(editor.getDocument(), false, true); EditorUtil.fillVirtualSpaceUntilCaret(editor); } PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); String fullPath = getTestDataPath() + expectedFilePath; File ioFile = new File(fullPath); assertTrue(getMessage(STR + fullPath, message), ioFile.exists()); String fileText; try { checkCaseSensitiveFS(fullPath, ioFile); fileText = FileUtil.loadFile(ioFile, CharsetToolkit.UTF8_CHARSET); } catch (IOException e) { throw new RuntimeException(e); } checkResultByText(message, StringUtil.convertLineSeparators(fileText), ignoreTrailingSpaces, getTestDataPath() + "/" + expectedFilePath); }
/** * Validates that content of the editor as well as caret and selection matches one specified in data file that * should be formed with the same format as one used in configureByFile * @param message - this check specific message. Added to text, caret position, selection checking. May be null * @param expectedFilePath - relative path from %IDEA_INSTALLATION_HOME%/testData/ * @param ignoreTrailingSpaces - whether trailing spaces in editor in data file should be stripped prior to comparing. */
Validates that content of the editor as well as caret and selection matches one specified in data file that should be formed with the same format as one used in configureByFile
checkResultByFile
{ "repo_name": "paplorinc/intellij-community", "path": "platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java", "license": "apache-2.0", "size": 28177 }
[ "com.intellij.openapi.editor.Editor", "com.intellij.openapi.editor.ex.util.EditorUtil", "com.intellij.openapi.editor.impl.TrailingSpacesStripper", "com.intellij.openapi.util.io.FileUtil", "com.intellij.openapi.util.text.StringUtil", "com.intellij.openapi.vfs.CharsetToolkit", "com.intellij.psi.PsiDocumentManager", "com.intellij.psi.impl.source.PostprocessReformattingAspect", "java.io.File", "java.io.IOException", "org.jetbrains.annotations.NotNull", "org.jetbrains.annotations.Nullable" ]
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.editor.impl.TrailingSpacesStripper; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.impl.source.PostprocessReformattingAspect; import java.io.File; import java.io.IOException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.ex.util.*; import com.intellij.openapi.editor.impl.*; import com.intellij.openapi.util.io.*; import com.intellij.openapi.util.text.*; import com.intellij.openapi.vfs.*; import com.intellij.psi.*; import com.intellij.psi.impl.source.*; import java.io.*; import org.jetbrains.annotations.*;
[ "com.intellij.openapi", "com.intellij.psi", "java.io", "org.jetbrains.annotations" ]
com.intellij.openapi; com.intellij.psi; java.io; org.jetbrains.annotations;
1,337,668
StringBuilder sbStr = new StringBuilder(); sbStr.append(method.getName()); sbStr.append('('); for (AbstractMap.SimpleEntry<Type, SArray.Size> parameter : parameters) { Class clazz; Type parameterType = parameter.getKey(); SArray.Size parameterSize = parameter.getValue(); if (parameterSize != null) { // It's an array clazz = SArray.getNestedType(parameterType); } else { // It's a simple type clazz = (Class) parameterType; } String arrayStr = SArray.sizeToString(parameterSize); sbStr.append(clazz.getSimpleName().substring(1).toLowerCase()); sbStr.append(arrayStr); sbStr.append(","); } if (parameters.size() > 0) { sbStr.setLength(sbStr.length() - 1); } sbStr.append(')'); return sbStr.toString(); }
StringBuilder sbStr = new StringBuilder(); sbStr.append(method.getName()); sbStr.append('('); for (AbstractMap.SimpleEntry<Type, SArray.Size> parameter : parameters) { Class clazz; Type parameterType = parameter.getKey(); SArray.Size parameterSize = parameter.getValue(); if (parameterSize != null) { clazz = SArray.getNestedType(parameterType); } else { clazz = (Class) parameterType; } String arrayStr = SArray.sizeToString(parameterSize); sbStr.append(clazz.getSimpleName().substring(1).toLowerCase()); sbStr.append(arrayStr); sbStr.append(","); } if (parameters.size() > 0) { sbStr.setLength(sbStr.length() - 1); } sbStr.append(')'); return sbStr.toString(); }
/** * Get the signature of the given element. * Ex: bar(type1,type2,...) * * @return signature of the given element. */
Get the signature of the given element. Ex: bar(type1,type2,...)
transformToFullName
{ "repo_name": "ethmobile/ethdroid", "path": "ethdroid/src/main/java/io/ethmobile/ethdroid/solidity/element/SolidityElement.java", "license": "mit", "size": 4209 }
[ "io.ethmobile.ethdroid.solidity.types.SArray", "java.lang.reflect.Type", "java.util.AbstractMap" ]
import io.ethmobile.ethdroid.solidity.types.SArray; import java.lang.reflect.Type; import java.util.AbstractMap;
import io.ethmobile.ethdroid.solidity.types.*; import java.lang.reflect.*; import java.util.*;
[ "io.ethmobile.ethdroid", "java.lang", "java.util" ]
io.ethmobile.ethdroid; java.lang; java.util;
361,690
Value<Boolean> charged();
Value<Boolean> charged();
/** * Gets the {@link Value} for the current "charged" state. * * @return The value for the "charged" state */
Gets the <code>Value</code> for the current "charged" state
charged
{ "repo_name": "joshgarde/SpongeAPI", "path": "src/main/java/org/spongepowered/api/data/manipulator/mutable/entity/ChargedData.java", "license": "mit", "size": 1921 }
[ "org.spongepowered.api.data.value.mutable.Value" ]
import org.spongepowered.api.data.value.mutable.Value;
import org.spongepowered.api.data.value.mutable.*;
[ "org.spongepowered.api" ]
org.spongepowered.api;
2,789,824
StoredBlock get(Sha256Hash hash) throws BlockStoreException; /** * Returns the {@link StoredBlock} that represents the top of the chain of greatest total work. Note that this * can be arbitrarily expensive, you probably should use {@link com.google.bitcoin.core.BlockChain#getChainHead()}
StoredBlock get(Sha256Hash hash) throws BlockStoreException; /** * Returns the {@link StoredBlock} that represents the top of the chain of greatest total work. Note that this * can be arbitrarily expensive, you probably should use {@link com.google.bitcoin.core.BlockChain#getChainHead()}
/** * Returns the StoredBlock given a hash. The returned values block.getHash() method will be equal to the * parameter. If no such block is found, returns null. */
Returns the StoredBlock given a hash. The returned values block.getHash() method will be equal to the parameter. If no such block is found, returns null
get
{ "repo_name": "HashEngineering/myriadcoinj", "path": "core/src/main/java/com/google/bitcoin/store/BlockStore.java", "license": "apache-2.0", "size": 2568 }
[ "com.google.bitcoin.core.Sha256Hash", "com.google.bitcoin.core.StoredBlock" ]
import com.google.bitcoin.core.Sha256Hash; import com.google.bitcoin.core.StoredBlock;
import com.google.bitcoin.core.*;
[ "com.google.bitcoin" ]
com.google.bitcoin;
2,564,004
@Test public void testGetSetPrefix() { final StrSubstitutor sub = new StrSubstitutor(); assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); sub.setVariablePrefix('<'); assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.CharMatcher); sub.setVariablePrefix("<<"); assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); try { sub.setVariablePrefix((String) null); fail(); } catch (final IllegalArgumentException ex) { // expected } assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); final StrMatcher matcher = StrMatcher.commaMatcher(); sub.setVariablePrefixMatcher(matcher); assertSame(matcher, sub.getVariablePrefixMatcher()); try { sub.setVariablePrefixMatcher((StrMatcher) null); fail(); } catch (final IllegalArgumentException ex) { // expected } assertSame(matcher, sub.getVariablePrefixMatcher()); }
void function() { final StrSubstitutor sub = new StrSubstitutor(); assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); sub.setVariablePrefix('<'); assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.CharMatcher); sub.setVariablePrefix("<<"); assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); try { sub.setVariablePrefix((String) null); fail(); } catch (final IllegalArgumentException ex) { } assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); final StrMatcher matcher = StrMatcher.commaMatcher(); sub.setVariablePrefixMatcher(matcher); assertSame(matcher, sub.getVariablePrefixMatcher()); try { sub.setVariablePrefixMatcher((StrMatcher) null); fail(); } catch (final IllegalArgumentException ex) { } assertSame(matcher, sub.getVariablePrefixMatcher()); }
/** * Tests get set. */
Tests get set
testGetSetPrefix
{ "repo_name": "kinow/commons-lang", "path": "src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java", "license": "apache-2.0", "size": 26361 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,280,827
@POST @Produces("text/plain") public Response createGroup(String body, @Context HttpHeaders headers, @Context UriInfo ui) { return handleRequest(headers, body, ui, Request.Type.POST, createGroupResource(null)); }
@Produces(STR) Response function(String body, @Context HttpHeaders headers, @Context UriInfo ui) { return handleRequest(headers, body, ui, Request.Type.POST, createGroupResource(null)); }
/** * Creates a group. * Handles: POST /groups requests. * * @param headers http headers * @param ui uri info * @return information regarding the created group */
Creates a group. Handles: POST /groups requests
createGroup
{ "repo_name": "zouzhberk/ambaridemo", "path": "demo-server/src/main/java/org/apache/ambari/server/api/services/GroupService.java", "license": "apache-2.0", "size": 4590 }
[ "javax.ws.rs.Produces", "javax.ws.rs.core.Context", "javax.ws.rs.core.HttpHeaders", "javax.ws.rs.core.Response", "javax.ws.rs.core.UriInfo" ]
import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo;
import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "javax.ws" ]
javax.ws;
159,872
String getLocks() throws IOException;
String getLocks() throws IOException;
/** * Get locks. * @return lock list in JSON * @throws IOException if a remote or network exception occurs */
Get locks
getLocks
{ "repo_name": "vincentpoon/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java", "license": "apache-2.0", "size": 104154 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,668,801
public void setColor(@Nonnull Color color) { this.color = color; }
void function(@Nonnull Color color) { this.color = color; }
/** * Set the colour of the rectangle. * @param color the new colour */
Set the colour of the rectangle
setColor
{ "repo_name": "bensmith87/ui", "path": "src/main/java/ben/ui/renderer/FlatRenderer.java", "license": "lgpl-3.0", "size": 3128 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,292,988
public boolean isExternalStorageWritable() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { File publicDir = Environment.getExternalStorageDirectory(); return publicDir.canWrite(); } return false; }
boolean function() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { File publicDir = Environment.getExternalStorageDirectory(); return publicDir.canWrite(); } return false; }
/** * Checks if an external storage is present, and if there are write permissions for the documents folder. * * @return the boolean */
Checks if an external storage is present, and if there are write permissions for the documents folder
isExternalStorageWritable
{ "repo_name": "schocco/mds-droid", "path": "app/src/main/java/info/muni_scale/mdsdroid/gpx/GpxFileWriter.java", "license": "mit", "size": 7520 }
[ "android.os.Environment", "java.io.File" ]
import android.os.Environment; import java.io.File;
import android.os.*; import java.io.*;
[ "android.os", "java.io" ]
android.os; java.io;
2,452,704
public interface Listener { void onRequirementsStateChanged( RequirementsWatcher requirementsWatcher, @Requirements.RequirementFlags int notMetRequirements); } private final Context context; private final Listener listener; private final Requirements requirements; private final Handler handler; @Nullable private DeviceStatusChangeReceiver receiver; @Requirements.RequirementFlags private int notMetRequirements; @Nullable private NetworkCallback networkCallback; public RequirementsWatcher(Context context, Listener listener, Requirements requirements) { this.context = context.getApplicationContext(); this.listener = listener; this.requirements = requirements; handler = Util.createHandlerForCurrentOrMainLooper(); }
interface Listener { void function( RequirementsWatcher requirementsWatcher, @Requirements.RequirementFlags int notMetRequirements); } private final Context context; private final Listener listener; private final Requirements requirements; private final Handler handler; @Nullable private DeviceStatusChangeReceiver receiver; @Requirements.RequirementFlags private int notMetRequirements; @Nullable private NetworkCallback networkCallback; public RequirementsWatcher(Context context, Listener listener, Requirements requirements) { this.context = context.getApplicationContext(); this.listener = listener; this.requirements = requirements; handler = Util.createHandlerForCurrentOrMainLooper(); }
/** * Called when there is a change on the met requirements. * * @param requirementsWatcher Calling instance. * @param notMetRequirements {@link Requirements.RequirementFlags RequirementFlags} that are not * met, or 0. */
Called when there is a change on the met requirements
onRequirementsStateChanged
{ "repo_name": "ened/ExoPlayer", "path": "library/core/src/main/java/com/google/android/exoplayer2/scheduler/RequirementsWatcher.java", "license": "apache-2.0", "size": 8075 }
[ "android.content.Context", "android.os.Handler", "androidx.annotation.Nullable", "com.google.android.exoplayer2.util.Util" ]
import android.content.Context; import android.os.Handler; import androidx.annotation.Nullable; import com.google.android.exoplayer2.util.Util;
import android.content.*; import android.os.*; import androidx.annotation.*; import com.google.android.exoplayer2.util.*;
[ "android.content", "android.os", "androidx.annotation", "com.google.android" ]
android.content; android.os; androidx.annotation; com.google.android;
276,582
private LiteralOp evalScalarOperation( Hop bop ) throws LopsException, DMLRuntimeException, IOException, HopsException { //Timing time = new Timing( true ); DataOp tmpWrite = new DataOp(TMP_VARNAME, bop.getDataType(), bop.getValueType(), bop, DataOpTypes.TRANSIENTWRITE, TMP_VARNAME); //generate runtime instruction Dag<Lop> dag = new Dag<>(); Recompiler.rClearLops(tmpWrite); //prevent lops reuse Lop lops = tmpWrite.constructLops(); //reconstruct lops lops.addToDag( dag ); ArrayList<Instruction> inst = dag.getJobs(null, ConfigurationManager.getDMLConfig()); //execute instructions ExecutionContext ec = getExecutionContext(); ProgramBlock pb = getProgramBlock(); pb.setInstructions( inst ); pb.execute( ec ); //get scalar result (check before invocation) and create literal according //to observed scalar output type (not hop type) for runtime consistency ScalarObject so = (ScalarObject) ec.getVariable(TMP_VARNAME); LiteralOp literal = null; switch( so.getValueType() ){ case DOUBLE: literal = new LiteralOp(so.getDoubleValue()); break; case INT: literal = new LiteralOp(so.getLongValue()); break; case BOOLEAN: literal = new LiteralOp(so.getBooleanValue()); break; case STRING: literal = new LiteralOp(so.getStringValue()); break; default: throw new HopsException("Unsupported literal value type: "+bop.getValueType()); } //cleanup tmpWrite.getInput().clear(); bop.getParent().remove(tmpWrite); pb.setInstructions(null); ec.getVariables().removeAll(); //set literal properties (scalar) HopRewriteUtils.setOutputParametersForScalar(literal); //System.out.println("Constant folded in "+time.stop()+"ms."); return literal; }
LiteralOp function( Hop bop ) throws LopsException, DMLRuntimeException, IOException, HopsException { DataOp tmpWrite = new DataOp(TMP_VARNAME, bop.getDataType(), bop.getValueType(), bop, DataOpTypes.TRANSIENTWRITE, TMP_VARNAME); Dag<Lop> dag = new Dag<>(); Recompiler.rClearLops(tmpWrite); Lop lops = tmpWrite.constructLops(); lops.addToDag( dag ); ArrayList<Instruction> inst = dag.getJobs(null, ConfigurationManager.getDMLConfig()); ExecutionContext ec = getExecutionContext(); ProgramBlock pb = getProgramBlock(); pb.setInstructions( inst ); pb.execute( ec ); ScalarObject so = (ScalarObject) ec.getVariable(TMP_VARNAME); LiteralOp literal = null; switch( so.getValueType() ){ case DOUBLE: literal = new LiteralOp(so.getDoubleValue()); break; case INT: literal = new LiteralOp(so.getLongValue()); break; case BOOLEAN: literal = new LiteralOp(so.getBooleanValue()); break; case STRING: literal = new LiteralOp(so.getStringValue()); break; default: throw new HopsException(STR+bop.getValueType()); } tmpWrite.getInput().clear(); bop.getParent().remove(tmpWrite); pb.setInstructions(null); ec.getVariables().removeAll(); HopRewriteUtils.setOutputParametersForScalar(literal); return literal; }
/** * In order to (1) prevent unexpected side effects from constant folding and * (2) for simplicity with regard to arbitrary value type combinations, * we use the same compilation and runtime for constant folding as we would * use for actual instruction execution. * * @param bop high-level operator * @return literal op * @throws LopsException if LopsException occurs * @throws DMLRuntimeException if DMLRuntimeException occurs * @throws IOException if IOException occurs * @throws HopsException if HopsException occurs */
In order to (1) prevent unexpected side effects from constant folding and (2) for simplicity with regard to arbitrary value type combinations, we use the same compilation and runtime for constant folding as we would use for actual instruction execution
evalScalarOperation
{ "repo_name": "dusenberrymw/systemml", "path": "src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java", "license": "apache-2.0", "size": 9460 }
[ "java.io.IOException", "java.util.ArrayList", "org.apache.sysml.conf.ConfigurationManager", "org.apache.sysml.hops.DataOp", "org.apache.sysml.hops.Hop", "org.apache.sysml.hops.HopsException", "org.apache.sysml.hops.LiteralOp", "org.apache.sysml.hops.recompile.Recompiler", "org.apache.sysml.lops.Lop", "org.apache.sysml.lops.LopsException", "org.apache.sysml.lops.compile.Dag", "org.apache.sysml.runtime.DMLRuntimeException", "org.apache.sysml.runtime.controlprogram.ProgramBlock", "org.apache.sysml.runtime.controlprogram.context.ExecutionContext", "org.apache.sysml.runtime.instructions.Instruction", "org.apache.sysml.runtime.instructions.cp.ScalarObject" ]
import java.io.IOException; import java.util.ArrayList; import org.apache.sysml.conf.ConfigurationManager; import org.apache.sysml.hops.DataOp; import org.apache.sysml.hops.Hop; import org.apache.sysml.hops.HopsException; import org.apache.sysml.hops.LiteralOp; import org.apache.sysml.hops.recompile.Recompiler; import org.apache.sysml.lops.Lop; import org.apache.sysml.lops.LopsException; import org.apache.sysml.lops.compile.Dag; import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.ProgramBlock; import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.Instruction; import org.apache.sysml.runtime.instructions.cp.ScalarObject;
import java.io.*; import java.util.*; import org.apache.sysml.conf.*; import org.apache.sysml.hops.*; import org.apache.sysml.hops.recompile.*; import org.apache.sysml.lops.*; import org.apache.sysml.lops.compile.*; import org.apache.sysml.runtime.*; import org.apache.sysml.runtime.controlprogram.*; import org.apache.sysml.runtime.controlprogram.context.*; import org.apache.sysml.runtime.instructions.*; import org.apache.sysml.runtime.instructions.cp.*;
[ "java.io", "java.util", "org.apache.sysml" ]
java.io; java.util; org.apache.sysml;
614,351
public HTMSensor<?> getSensor() { return sensor; } /** * Returns the {@link Connections} object being used by this {@link Layer}
HTMSensor<?> function() { return sensor; } /** * Returns the {@link Connections} object being used by this {@link Layer}
/** * Returns the configured {@link Sensor} if any exists in this * {@code Layer}, or null if one does not. * @return */
Returns the configured <code>Sensor</code> if any exists in this Layer, or null if one does not
getSensor
{ "repo_name": "user405/test", "path": "src/main/java/org/numenta/nupic/network/Layer.java", "license": "agpl-3.0", "size": 72476 }
[ "org.numenta.nupic.Connections", "org.numenta.nupic.network.sensor.HTMSensor" ]
import org.numenta.nupic.Connections; import org.numenta.nupic.network.sensor.HTMSensor;
import org.numenta.nupic.*; import org.numenta.nupic.network.sensor.*;
[ "org.numenta.nupic" ]
org.numenta.nupic;
2,132,066
protected void listen() throws Exception { if (doListen()) { log.warn(sm.getString("nioReceiver.alreadyStarted")); return; } setListen(true); // Avoid NPEs if selector is set to null on stop. Selector selector = this.selector.get(); if (selector!=null && datagramChannel!=null) { ObjectReader oreader = new ObjectReader(MAX_UDP_SIZE); //max size for a datagram packet registerChannel(selector,datagramChannel,SelectionKey.OP_READ,oreader); } while (doListen() && selector != null) { // this may block for a long time, upon return the // selected set contains keys of the ready channels try { events(); socketTimeouts(); int n = selector.select(getSelectorTimeout()); if (n == 0) { //there is a good chance that we got here //because the TcpReplicationThread called //selector wakeup(). //if that happens, we must ensure that that //thread has enough time to call interestOps // synchronized (interestOpsMutex) { //if we got the lock, means there are no //keys trying to register for the //interestOps method // } continue; // nothing to do } // get an iterator over the set of selected keys Iterator<SelectionKey> it = selector.selectedKeys().iterator(); // look at each key in the selected set while (it!=null && it.hasNext()) { SelectionKey key = it.next(); // Is a new connection coming in? if (key.isAcceptable()) { ServerSocketChannel server = (ServerSocketChannel) key.channel(); SocketChannel channel = server.accept(); channel.socket().setReceiveBufferSize(getTxBufSize()); channel.socket().setSendBufferSize(getTxBufSize()); channel.socket().setTcpNoDelay(getTcpNoDelay()); channel.socket().setKeepAlive(getSoKeepAlive()); channel.socket().setOOBInline(getOoBInline()); channel.socket().setReuseAddress(getSoReuseAddress()); channel.socket().setSoLinger(getSoLingerOn(),getSoLingerTime()); channel.socket().setSoTimeout(getTimeout()); Object attach = new ObjectReader(channel); registerChannel(selector, channel, SelectionKey.OP_READ, attach); } // is there data to read on this channel? if (key.isReadable()) { readDataFromSocket(key); } else { key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE)); } // remove key from selected set, it's been handled it.remove(); } } catch (java.nio.channels.ClosedSelectorException cse) { // ignore is normal at shutdown or stop listen socket } catch (java.nio.channels.CancelledKeyException nx) { log.warn(sm.getString("nioReceiver.clientDisconnect")); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.error(sm.getString("nioReceiver.requestError"), t); } } serverChannel.close(); if (datagramChannel!=null) { try { datagramChannel.close(); }catch (Exception iox) { if (log.isDebugEnabled()) log.debug("Unable to close datagram channel.",iox); } datagramChannel=null; } closeSelector(); }
void function() throws Exception { if (doListen()) { log.warn(sm.getString(STR)); return; } setListen(true); Selector selector = this.selector.get(); if (selector!=null && datagramChannel!=null) { ObjectReader oreader = new ObjectReader(MAX_UDP_SIZE); registerChannel(selector,datagramChannel,SelectionKey.OP_READ,oreader); } while (doListen() && selector != null) { try { events(); socketTimeouts(); int n = selector.select(getSelectorTimeout()); if (n == 0) { continue; } Iterator<SelectionKey> it = selector.selectedKeys().iterator(); while (it!=null && it.hasNext()) { SelectionKey key = it.next(); if (key.isAcceptable()) { ServerSocketChannel server = (ServerSocketChannel) key.channel(); SocketChannel channel = server.accept(); channel.socket().setReceiveBufferSize(getTxBufSize()); channel.socket().setSendBufferSize(getTxBufSize()); channel.socket().setTcpNoDelay(getTcpNoDelay()); channel.socket().setKeepAlive(getSoKeepAlive()); channel.socket().setOOBInline(getOoBInline()); channel.socket().setReuseAddress(getSoReuseAddress()); channel.socket().setSoLinger(getSoLingerOn(),getSoLingerTime()); channel.socket().setSoTimeout(getTimeout()); Object attach = new ObjectReader(channel); registerChannel(selector, channel, SelectionKey.OP_READ, attach); } if (key.isReadable()) { readDataFromSocket(key); } else { key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE)); } it.remove(); } } catch (java.nio.channels.ClosedSelectorException cse) { } catch (java.nio.channels.CancelledKeyException nx) { log.warn(sm.getString(STR)); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.error(sm.getString(STR), t); } } serverChannel.close(); if (datagramChannel!=null) { try { datagramChannel.close(); }catch (Exception iox) { if (log.isDebugEnabled()) log.debug(STR,iox); } datagramChannel=null; } closeSelector(); }
/** * Get data from channel and store in byte array * send it to cluster * @throws IOException IO error */
Get data from channel and store in byte array send it to cluster
listen
{ "repo_name": "Nickname0806/Test_Q4", "path": "java/org/apache/catalina/tribes/transport/nio/NioReceiver.java", "license": "apache-2.0", "size": 18152 }
[ "java.nio.channels.CancelledKeyException", "java.nio.channels.ClosedSelectorException", "java.nio.channels.SelectionKey", "java.nio.channels.Selector", "java.nio.channels.ServerSocketChannel", "java.nio.channels.SocketChannel", "java.util.Iterator", "org.apache.catalina.tribes.io.ObjectReader", "org.apache.catalina.tribes.util.ExceptionUtils" ]
import java.nio.channels.CancelledKeyException; import java.nio.channels.ClosedSelectorException; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.Iterator; import org.apache.catalina.tribes.io.ObjectReader; import org.apache.catalina.tribes.util.ExceptionUtils;
import java.nio.channels.*; import java.util.*; import org.apache.catalina.tribes.io.*; import org.apache.catalina.tribes.util.*;
[ "java.nio", "java.util", "org.apache.catalina" ]
java.nio; java.util; org.apache.catalina;
1,488,512
public static ResourceBundle push(final String name, final ResourceBundle rb) { instance.pushInternal(instance.resourceName, instance.resourceBundle); instance.resourceBundle = rb; instance.resourceName = name; return rb; }
static ResourceBundle function(final String name, final ResourceBundle rb) { instance.pushInternal(instance.resourceName, instance.resourceBundle); instance.resourceBundle = rb; instance.resourceName = name; return rb; }
/** * Pushes the Resource Info onto the stack. * @param name the name of the resource * @param rb the resource bundle * @return the same res bundle */
Pushes the Resource Info onto the stack
push
{ "repo_name": "specify/specify6", "path": "src/edu/ku/brc/ui/UIRegistry.java", "license": "gpl-2.0", "size": 98859 }
[ "java.util.ResourceBundle" ]
import java.util.ResourceBundle;
import java.util.*;
[ "java.util" ]
java.util;
1,424,933
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProfileInner>> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } context = this.client.mergeContext(context); return service .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<ProfileInner>> function(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } context = this.client.mergeContext(context); return service .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * Lists all of the CDN profiles within an Azure subscription. * * @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 result of the request to list profiles. */
Lists all of the CDN profiles within an Azure subscription
listSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cdn/src/main/java/com/azure/resourcemanager/cdn/implementation/ProfilesClientImpl.java", "license": "mit", "size": 111257 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.cdn.fluent.models.ProfileInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.cdn.fluent.models.ProfileInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.cdn.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
809,339
public void endResponse(final OChannelBinaryClient iNetwork) { iNetwork.endResponse(); if (debug) System.out.println("<- res: " + getSessionId()); }
void function(final OChannelBinaryClient iNetwork) { iNetwork.endResponse(); if (debug) System.out.println(STR + getSessionId()); }
/** * End response reached: release the channel in the pool to being reused */
End response reached: release the channel in the pool to being reused
endResponse
{ "repo_name": "wuman/orientdb-android", "path": "client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java", "license": "apache-2.0", "size": 56795 }
[ "com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient" ]
import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient;
import com.orientechnologies.orient.enterprise.channel.binary.*;
[ "com.orientechnologies.orient" ]
com.orientechnologies.orient;
463,949
public static int decode(String data, OutputStream out) throws IOException { return encoder.decode(data, out); }
static int function(String data, OutputStream out) throws IOException { return encoder.decode(data, out); }
/** * decode the base 64 encoded String data writing it to the given output * stream, whitespace characters will be ignored. * * @return the number of bytes produced. */
decode the base 64 encoded String data writing it to the given output stream, whitespace characters will be ignored
decode
{ "repo_name": "tjulk/gaeproxy", "path": "src/org/emergent/android/weave/client/Base64.java", "license": "gpl-3.0", "size": 2518 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,592,108
public final void writeEnum(final int fieldNumber, final int value) throws IOException { writeInt32(fieldNumber, value); }
final void function(final int fieldNumber, final int value) throws IOException { writeInt32(fieldNumber, value); }
/** * Write an enum field, including tag, to the stream. The provided value is the numeric * value used to represent the enum value on the wire (not the enum ordinal value). */
Write an enum field, including tag, to the stream. The provided value is the numeric value used to represent the enum value on the wire (not the enum ordinal value)
writeEnum
{ "repo_name": "gustavoanatoly/hbase", "path": "hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/CodedOutputStream.java", "license": "apache-2.0", "size": 105107 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,567,159
@Adjacency(label = TECH_TAG_TO_FILE_MODEL, direction = Direction.OUT) Iterable<FileModel> getFileModels();
@Adjacency(label = TECH_TAG_TO_FILE_MODEL, direction = Direction.OUT) Iterable<FileModel> getFileModels();
/** * References the {@link FileModel}s that use this technology. */
References the <code>FileModel</code>s that use this technology
getFileModels
{ "repo_name": "mareknovotny/windup", "path": "reporting/api/src/main/java/org/jboss/windup/reporting/model/TechnologyTagModel.java", "license": "epl-1.0", "size": 2416 }
[ "com.tinkerpop.blueprints.Direction", "com.tinkerpop.frames.Adjacency", "org.jboss.windup.graph.model.resource.FileModel" ]
import com.tinkerpop.blueprints.Direction; import com.tinkerpop.frames.Adjacency; import org.jboss.windup.graph.model.resource.FileModel;
import com.tinkerpop.blueprints.*; import com.tinkerpop.frames.*; import org.jboss.windup.graph.model.resource.*;
[ "com.tinkerpop.blueprints", "com.tinkerpop.frames", "org.jboss.windup" ]
com.tinkerpop.blueprints; com.tinkerpop.frames; org.jboss.windup;
2,438,127
GradoopIdSet readGraphIds(final Result res);
GradoopIdSet readGraphIds(final Result res);
/** * Reads the graph identifiers from the given {@link Result}. * * @param res HBase row * @return graphs identifiers */
Reads the graph identifiers from the given <code>Result</code>
readGraphIds
{ "repo_name": "galpha/gradoop", "path": "gradoop-store/gradoop-hbase/src/main/java/org/gradoop/storage/hbase/impl/api/GraphElementHandler.java", "license": "apache-2.0", "size": 1685 }
[ "org.apache.hadoop.hbase.client.Result", "org.gradoop.common.model.impl.id.GradoopIdSet" ]
import org.apache.hadoop.hbase.client.Result; import org.gradoop.common.model.impl.id.GradoopIdSet;
import org.apache.hadoop.hbase.client.*; import org.gradoop.common.model.impl.id.*;
[ "org.apache.hadoop", "org.gradoop.common" ]
org.apache.hadoop; org.gradoop.common;
931,310
protected KeyStore getKeyStore(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception { return CertificateUtils.getKeyStore(storeStream, storePath, storeType, storeProvider, storePassword); }
KeyStore function(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception { return CertificateUtils.getKeyStore(storeStream, storePath, storeType, storeProvider, storePassword); }
/** * Loads keystore using an input stream or a file path in the same * order of precedence. * * Required for integrations to be able to override the mechanism * used to load a keystore in order to provide their own implementation. * * @param storeStream keystore input stream * @param storePath path of keystore file * @param storeType keystore type * @param storeProvider keystore provider * @param storePassword keystore password * @return created keystore * @throws Exception */
Loads keystore using an input stream or a file path in the same order of precedence. Required for integrations to be able to override the mechanism used to load a keystore in order to provide their own implementation
getKeyStore
{ "repo_name": "leoleegit/jetty-8.0.4.v20111024", "path": "jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java", "license": "apache-2.0", "size": 12221 }
[ "java.io.InputStream", "java.security.KeyStore", "org.eclipse.jetty.util.security.CertificateUtils" ]
import java.io.InputStream; import java.security.KeyStore; import org.eclipse.jetty.util.security.CertificateUtils;
import java.io.*; import java.security.*; import org.eclipse.jetty.util.security.*;
[ "java.io", "java.security", "org.eclipse.jetty" ]
java.io; java.security; org.eclipse.jetty;
940,552
CompletableFuture<Void> unremoveProject(String projectName);
CompletableFuture<Void> unremoveProject(String projectName);
/** * Unremoves a project. */
Unremoves a project
unremoveProject
{ "repo_name": "line/centraldogma", "path": "client/java/src/main/java/com/linecorp/centraldogma/client/CentralDogma.java", "license": "apache-2.0", "size": 40089 }
[ "java.util.concurrent.CompletableFuture" ]
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
771,837
@Test public void testOwnerAddExistingExperimenterToGroup() throws Exception { // First create a new user. String uuid = UUID.randomUUID().toString(); Experimenter e = createExperimenterI(uuid, "user", "user"); IAdminPrx svc = root.getSession().getAdminService(); // already tested ExperimenterGroup g = new ExperimenterGroupI(); g.setName(omero.rtypes.rstring(uuid)); g.getDetails().setPermissions(new PermissionsI("rw----")); // create group. long groupId = svc.createGroup(g); g = svc.lookupGroup(uuid); // create the user. long expId = svc.createUser(e, uuid); Experimenter owner = svc.lookupExperimenter(uuid); // set the user as the group owner. svc.setGroupOwner(g, owner); // create another group and user String uuidGroup = UUID.randomUUID().toString(); ExperimenterGroup g2 = new ExperimenterGroupI(); g2.setName(omero.rtypes.rstring(uuidGroup)); g2.getDetails().setPermissions(new PermissionsI("rw----")); svc.createGroup(g2); String uuid2 = UUID.randomUUID().toString(); e = createExperimenterI(uuid2, "user", "user"); expId = svc.createUser(e, uuidGroup); e = svc.lookupExperimenter(uuid2); // owner logs in. omero.client client = newOmeroClient(); client.createSession(uuid, uuid); init(client); // iAdmin. List<ExperimenterGroup> groups = new ArrayList<ExperimenterGroup>(); groups.add(g); iAdmin.addGroups(e, groups); }
void function() throws Exception { String uuid = UUID.randomUUID().toString(); Experimenter e = createExperimenterI(uuid, "user", "user"); IAdminPrx svc = root.getSession().getAdminService(); ExperimenterGroup g = new ExperimenterGroupI(); g.setName(omero.rtypes.rstring(uuid)); g.getDetails().setPermissions(new PermissionsI(STR)); long groupId = svc.createGroup(g); g = svc.lookupGroup(uuid); long expId = svc.createUser(e, uuid); Experimenter owner = svc.lookupExperimenter(uuid); svc.setGroupOwner(g, owner); String uuidGroup = UUID.randomUUID().toString(); ExperimenterGroup g2 = new ExperimenterGroupI(); g2.setName(omero.rtypes.rstring(uuidGroup)); g2.getDetails().setPermissions(new PermissionsI(STR)); svc.createGroup(g2); String uuid2 = UUID.randomUUID().toString(); e = createExperimenterI(uuid2, "user", "user"); expId = svc.createUser(e, uuidGroup); e = svc.lookupExperimenter(uuid2); omero.client client = newOmeroClient(); client.createSession(uuid, uuid); init(client); List<ExperimenterGroup> groups = new ArrayList<ExperimenterGroup>(); groups.add(g); iAdmin.addGroups(e, groups); }
/** * Tests the addition of existing user by the owner of the group. The owner * is NOT an administrator. * * @throws Exception * Thrown if an error occurred. */
Tests the addition of existing user by the owner of the group. The owner is NOT an administrator
testOwnerAddExistingExperimenterToGroup
{ "repo_name": "jballanc/openmicroscopy", "path": "components/tools/OmeroJava/test/integration/AdminServiceTest.java", "license": "gpl-2.0", "size": 70144 }
[ "java.util.ArrayList", "java.util.List", "java.util.UUID" ]
import java.util.ArrayList; import java.util.List; import java.util.UUID;
import java.util.*;
[ "java.util" ]
java.util;
579,952
@Test public void matchMetadataTest() { Criterion criterion = Criteria.matchMetadata(0xabcdL); ObjectNode result = criterionCodec.encode(criterion, context); assertThat(result, matchesCriterion(criterion)); }
void function() { Criterion criterion = Criteria.matchMetadata(0xabcdL); ObjectNode result = criterionCodec.encode(criterion, context); assertThat(result, matchesCriterion(criterion)); }
/** * Tests metadata criterion. */
Tests metadata criterion
matchMetadataTest
{ "repo_name": "sdnwiselab/onos", "path": "core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java", "license": "apache-2.0", "size": 14744 }
[ "com.fasterxml.jackson.databind.node.ObjectNode", "org.hamcrest.MatcherAssert", "org.onosproject.codec.impl.CriterionJsonMatcher", "org.onosproject.net.flow.criteria.Criteria", "org.onosproject.net.flow.criteria.Criterion" ]
import com.fasterxml.jackson.databind.node.ObjectNode; import org.hamcrest.MatcherAssert; import org.onosproject.codec.impl.CriterionJsonMatcher; import org.onosproject.net.flow.criteria.Criteria; import org.onosproject.net.flow.criteria.Criterion;
import com.fasterxml.jackson.databind.node.*; import org.hamcrest.*; import org.onosproject.codec.impl.*; import org.onosproject.net.flow.criteria.*;
[ "com.fasterxml.jackson", "org.hamcrest", "org.onosproject.codec", "org.onosproject.net" ]
com.fasterxml.jackson; org.hamcrest; org.onosproject.codec; org.onosproject.net;
2,576,387
public String getPercentage(Assignment<V, T> assignment) { double val = getValue(assignment); double[] bounds = getBounds(assignment); if (bounds[0] <= val && val <= bounds[1] && bounds[0] < bounds[1]) return getPerc(val, bounds[0], bounds[1]) + "%"; else if (bounds[1] <= val && val <= bounds[0] && bounds[1] < bounds[0]) return getPercRev(val, bounds[1], bounds[0]) + "%"; else return sDoubleFormat.format(val); }
String function(Assignment<V, T> assignment) { double val = getValue(assignment); double[] bounds = getBounds(assignment); if (bounds[0] <= val && val <= bounds[1] && bounds[0] < bounds[1]) return getPerc(val, bounds[0], bounds[1]) + "%"; else if (bounds[1] <= val && val <= bounds[0] && bounds[1] < bounds[0]) return getPercRev(val, bounds[1], bounds[0]) + "%"; else return sDoubleFormat.format(val); }
/** * Return formatted value of this criterion, as percentage when possible * @param assignment current assignment * @return formatted value */
Return formatted value of this criterion, as percentage when possible
getPercentage
{ "repo_name": "UniTime/cpsolver", "path": "src/org/cpsolver/ifs/criteria/AbstractCriterion.java", "license": "lgpl-3.0", "size": 20667 }
[ "org.cpsolver.ifs.assignment.Assignment" ]
import org.cpsolver.ifs.assignment.Assignment;
import org.cpsolver.ifs.assignment.*;
[ "org.cpsolver.ifs" ]
org.cpsolver.ifs;
2,366,869
void productSelected(Product product, int clickCount);
void productSelected(Product product, int clickCount);
/** * Called when a product has been selected in the tree. * * @param product The selected product. * @param clickCount The number of mouse clicks. */
Called when a product has been selected in the tree
productSelected
{ "repo_name": "lveci/nest", "path": "beam/beam-ui/src/main/java/org/esa/beam/framework/ui/product/ProductTreeListener.java", "license": "gpl-3.0", "size": 2792 }
[ "org.esa.beam.framework.datamodel.Product" ]
import org.esa.beam.framework.datamodel.Product;
import org.esa.beam.framework.datamodel.*;
[ "org.esa.beam" ]
org.esa.beam;
2,100,205