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
MsisdnTypeService msisdnTypeService = MsisdnTypeService.getInstance(); if (Settings.isTestMode(context)) { return getTestCalls(msisdnTypeService); } ArrayList<Chargeable> calls = new ArrayList<Chargeable>(); String[] projection = { CallLog.Calls.TYPE, CallLog.Calls.NUMBER, CallLog.Calls.CACHED_NAME, CallLog.Calls.DURATION, CallLog.Calls.DATE}; String selection = null; if (startBillingDate != null) { selection = CallLog.Calls.DATE + " > " + startBillingDate.getTime(); if (endBillingDate != null) { selection = selection + " AND " + CallLog.Calls.DATE + " < " + endBillingDate.getTime(); } } Cursor cursor = context.getContentResolver().query( CallLog.Calls.CONTENT_URI, projection, selection, null, CallLog.Calls.DATE + " DESC"); int typeColumn = cursor.getColumnIndex(CallLog.Calls.TYPE); int numberColumn = cursor.getColumnIndex(CallLog.Calls.NUMBER); int contactColumn = cursor.getColumnIndex(CallLog.Calls.CACHED_NAME); int durationColumn = cursor.getColumnIndex(CallLog.Calls.DURATION); int dateColumn = cursor.getColumnIndex(CallLog.Calls.DATE); try { if (cursor.moveToFirst()) { do { int callType; switch (cursor.getInt(typeColumn)) { case CallLog.Calls.OUTGOING_TYPE: callType = Call.CALL_TYPE_SENT; break; case CallLog.Calls.INCOMING_TYPE: callType = Call.CALL_TYPE_RECEIVED; break; case CallLog.Calls.MISSED_TYPE: callType = Call.CALL_TYPE_RECEIVED_MISSED; break; default: continue; } String contactName = cursor.getString(contactColumn); String callNumber = cursor.getString(numberColumn); Long callDuration = cursor.getLong(durationColumn); if (callDuration == 0 && callType == Call.CALL_TYPE_SENT) { callType = Call.CALL_TYPE_SENT_MISSED; } Calendar callCal = Calendar.getInstance(); callCal.setTimeInMillis(cursor.getLong(dateColumn)); Contact contact = new Contact(callNumber, contactName, msisdnTypeService.getMsisdnType(callNumber, "ES")); Call call = new Call(callType, callDuration, contact, callCal); calls.add(call); } while (cursor.moveToNext()); } } finally { cursor.close(); } return calls; }
MsisdnTypeService msisdnTypeService = MsisdnTypeService.getInstance(); if (Settings.isTestMode(context)) { return getTestCalls(msisdnTypeService); } ArrayList<Chargeable> calls = new ArrayList<Chargeable>(); String[] projection = { CallLog.Calls.TYPE, CallLog.Calls.NUMBER, CallLog.Calls.CACHED_NAME, CallLog.Calls.DURATION, CallLog.Calls.DATE}; String selection = null; if (startBillingDate != null) { selection = CallLog.Calls.DATE + STR + startBillingDate.getTime(); if (endBillingDate != null) { selection = selection + STR + CallLog.Calls.DATE + STR + endBillingDate.getTime(); } } Cursor cursor = context.getContentResolver().query( CallLog.Calls.CONTENT_URI, projection, selection, null, CallLog.Calls.DATE + STR); int typeColumn = cursor.getColumnIndex(CallLog.Calls.TYPE); int numberColumn = cursor.getColumnIndex(CallLog.Calls.NUMBER); int contactColumn = cursor.getColumnIndex(CallLog.Calls.CACHED_NAME); int durationColumn = cursor.getColumnIndex(CallLog.Calls.DURATION); int dateColumn = cursor.getColumnIndex(CallLog.Calls.DATE); try { if (cursor.moveToFirst()) { do { int callType; switch (cursor.getInt(typeColumn)) { case CallLog.Calls.OUTGOING_TYPE: callType = Call.CALL_TYPE_SENT; break; case CallLog.Calls.INCOMING_TYPE: callType = Call.CALL_TYPE_RECEIVED; break; case CallLog.Calls.MISSED_TYPE: callType = Call.CALL_TYPE_RECEIVED_MISSED; break; default: continue; } String contactName = cursor.getString(contactColumn); String callNumber = cursor.getString(numberColumn); Long callDuration = cursor.getLong(durationColumn); if (callDuration == 0 && callType == Call.CALL_TYPE_SENT) { callType = Call.CALL_TYPE_SENT_MISSED; } Calendar callCal = Calendar.getInstance(); callCal.setTimeInMillis(cursor.getLong(dateColumn)); Contact contact = new Contact(callNumber, contactName, msisdnTypeService.getMsisdnType(callNumber, "ES")); Call call = new Call(callType, callDuration, contact, callCal); calls.add(call); } while (cursor.moveToNext()); } } finally { cursor.close(); } return calls; }
/** * Obtain all calls since last invoice * * @param activity * caller activity * @param startBillingDay * starting billing day * @return ArrayList with all calls made */
Obtain all calls since last invoice
getCalls
{ "repo_name": "jmsanzg/myPlan", "path": "src/com/conzebit/myplan/android/store/CallLogStore.java", "license": "gpl-3.0", "size": 9228 }
[ "android.database.Cursor", "android.provider.CallLog", "com.conzebit.myplan.android.util.Settings", "com.conzebit.myplan.core.Chargeable", "com.conzebit.myplan.core.call.Call", "com.conzebit.myplan.core.contact.Contact", "com.conzebit.myplan.core.msisdn.MsisdnTypeService", "java.util.ArrayList", "java.util.Calendar" ]
import android.database.Cursor; import android.provider.CallLog; import com.conzebit.myplan.android.util.Settings; import com.conzebit.myplan.core.Chargeable; import com.conzebit.myplan.core.call.Call; import com.conzebit.myplan.core.contact.Contact; import com.conzebit.myplan.core.msisdn.MsisdnTypeService; import java.util.ArrayList; import java.util.Calendar;
import android.database.*; import android.provider.*; import com.conzebit.myplan.android.util.*; import com.conzebit.myplan.core.*; import com.conzebit.myplan.core.call.*; import com.conzebit.myplan.core.contact.*; import com.conzebit.myplan.core.msisdn.*; import java.util.*;
[ "android.database", "android.provider", "com.conzebit.myplan", "java.util" ]
android.database; android.provider; com.conzebit.myplan; java.util;
1,458,206
synchronized void put(ResourceRecord record) { String name = record.getName().toLowerCase(); Vector<CacheEntry> vect = names.get(name); long curTime = System.currentTimeMillis(); CacheEntry entry = null; if (vect == null) { vect = new Vector<CacheEntry>(); names.put(name, vect); } // TTL should be between 0 and 2^31; if greater - should be set to 0 // See RFC 2181 point 8 if (record.getTtl() >> 31 != 0) { record.setTtl(0); } // skip records with wildcards in names or with zero TTL if (record.getTtl() > 0 && (record.getName().indexOf('*') == -1)) { entry = new CacheEntry(record, curTime + record.getTtl()); // remove old occurrence if any for (int i = 0; i < vect.size(); i++) { CacheEntry exEntry = vect.elementAt(i); ResourceRecord exRec = exEntry.rr; if (ProviderMgr.namesAreEqual(record.getName(), exRec.getName()) && record.getRRClass() == exRec.getRRClass() && record.getRRType() == exRec.getRRType()) { if (record.getRData() != null && exRec.getRData() != null && record.getRData().equals(exRec.getRData())) { vect.remove(i); break; } } } vect.addElement(entry); } }
synchronized void put(ResourceRecord record) { String name = record.getName().toLowerCase(); Vector<CacheEntry> vect = names.get(name); long curTime = System.currentTimeMillis(); CacheEntry entry = null; if (vect == null) { vect = new Vector<CacheEntry>(); names.put(name, vect); } if (record.getTtl() >> 31 != 0) { record.setTtl(0); } if (record.getTtl() > 0 && (record.getName().indexOf('*') == -1)) { entry = new CacheEntry(record, curTime + record.getTtl()); for (int i = 0; i < vect.size(); i++) { CacheEntry exEntry = vect.elementAt(i); ResourceRecord exRec = exEntry.rr; if (ProviderMgr.namesAreEqual(record.getName(), exRec.getName()) && record.getRRClass() == exRec.getRRClass() && record.getRRType() == exRec.getRRType()) { if (record.getRData() != null && exRec.getRData() != null && record.getRData().equals(exRec.getRData())) { vect.remove(i); break; } } } vect.addElement(entry); } }
/** * Puts element into the cache. Doesn't put records with zero TTLs. * Doesn't put records with bad TTLs. * @param record a resource record to insert */
Puts element into the cache. Doesn't put records with zero TTLs. Doesn't put records with bad TTLs
put
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java", "license": "apache-2.0", "size": 6116 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
691,769
public AppWidgetsGetImagesByIdQuery getImagesById(GroupActor actor, List<String> images) { return new AppWidgetsGetImagesByIdQuery(getClient(), actor, images); }
AppWidgetsGetImagesByIdQuery function(GroupActor actor, List<String> images) { return new AppWidgetsGetImagesByIdQuery(getClient(), actor, images); }
/** * Returns an image for community app widgets by its ID * * @param actor vk actor * @param images List of images IDs * @return query */
Returns an image for community app widgets by its ID
getImagesById
{ "repo_name": "VKCOM/vk-java-sdk", "path": "sdk/src/main/java/com/vk/api/sdk/actions/AppWidgets.java", "license": "mit", "size": 6856 }
[ "com.vk.api.sdk.client.actors.GroupActor", "com.vk.api.sdk.queries.appwidgets.AppWidgetsGetImagesByIdQuery", "java.util.List" ]
import com.vk.api.sdk.client.actors.GroupActor; import com.vk.api.sdk.queries.appwidgets.AppWidgetsGetImagesByIdQuery; import java.util.List;
import com.vk.api.sdk.client.actors.*; import com.vk.api.sdk.queries.appwidgets.*; import java.util.*;
[ "com.vk.api", "java.util" ]
com.vk.api; java.util;
178,673
public void fieldToData(Field field) throws DBException { super.fieldToData(field); }
void function(Field field) throws DBException { super.fieldToData(field); }
/** * Move this Field's data to the record area (Override this for non-standard buffers). * Warning: Check to make sure the field.isSelected() before moving data! * @exception DBException File exception. */
Move this Field's data to the record area (Override this for non-standard buffers). Warning: Check to make sure the field.isSelected() before moving data
fieldToData
{ "repo_name": "jbundle/jbundle", "path": "base/base/src/main/java/org/jbundle/base/db/util/HierarchicalTable.java", "license": "gpl-3.0", "size": 14605 }
[ "org.jbundle.model.DBException", "org.jbundle.model.db.Field" ]
import org.jbundle.model.DBException; import org.jbundle.model.db.Field;
import org.jbundle.model.*; import org.jbundle.model.db.*;
[ "org.jbundle.model" ]
org.jbundle.model;
849,633
public static void i(@NonNull final String message, @NonNull final Object... args) { GENERAL_LC_GROUP.i(message, args); }
static void function(@NonNull final String message, @NonNull final Object... args) { GENERAL_LC_GROUP.i(message, args); }
/** * Logs info message via {@link #GENERAL_LC_GROUP}. * * @param message Message or format of message to log; * @param args Arguments of formatted message. */
Logs info message via <code>#GENERAL_LC_GROUP</code>
i
{ "repo_name": "TouchInstinct/RoboSwag-core", "path": "src/main/java/ru/touchin/roboswag/core/log/Lc.java", "license": "apache-2.0", "size": 10938 }
[ "android.support.annotation.NonNull" ]
import android.support.annotation.NonNull;
import android.support.annotation.*;
[ "android.support" ]
android.support;
2,274,541
public final void setFetchDirection(int direction) throws SQLException { getStatement().setFetchDirection( direction); }
final void function(int direction) throws SQLException { getStatement().setFetchDirection( direction); }
/** * JDBC 2.0 * * Give a hint as to the direction in which the rows in a result set * will be processed. The hint applies only to result sets created * using this Statement object. The default value is * ResultSet.FETCH_FORWARD. * * @param direction the initial direction for processing rows * @exception SQLException if a database-access error occurs or direction * is not one of ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or * ResultSet.FETCH_UNKNOWN */
JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using this Statement object. The default value is ResultSet.FETCH_FORWARD
setFetchDirection
{ "repo_name": "scnakandala/derby", "path": "java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java", "license": "apache-2.0", "size": 21761 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,267,276
public T addBillingDetails(String firstName, String lastName, String email, String phone, String address, String city, String country, String state, String zip, String cell, String county) { UserAddress userAddress = AddressUtils.createUserAddressFromParams(firstName, lastName, email, phone, address, city, country, state, zip, cell, county); return addBillingDetails(userAddress); }
T function(String firstName, String lastName, String email, String phone, String address, String city, String country, String state, String zip, String cell, String county) { UserAddress userAddress = AddressUtils.createUserAddressFromParams(firstName, lastName, email, phone, address, city, country, state, zip, cell, county); return addBillingDetails(userAddress); }
/** * Adds billing info to the request. * * @param firstName The first name of the recipient * @param lastName The last name of the recipient * @param email The email of the recipient * @param phone The phone number of the recipient * @param address The address of the recipient * @param city The city of the recipient * @param country The country of the recipient(two-letter ISO country code) * @param state The state of the recipient(two-letter ISO state code) * @param zip The postal code of the recipient * @param cell The cell number of the recipient * @return this object */
Adds billing info to the request
addBillingDetails
{ "repo_name": "DopplerEffect666/safecharge-java", "path": "src/main/java/com/safecharge/request/builder/SafechargeOrderBuilder.java", "license": "mit", "size": 16509 }
[ "com.safecharge.model.UserAddress", "com.safecharge.util.AddressUtils" ]
import com.safecharge.model.UserAddress; import com.safecharge.util.AddressUtils;
import com.safecharge.model.*; import com.safecharge.util.*;
[ "com.safecharge.model", "com.safecharge.util" ]
com.safecharge.model; com.safecharge.util;
1,080,558
boolean preCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> c, final byte [] row, final byte [] family, final byte [] qualifier, final CompareOp compareOp, final WritableByteArrayComparable comparator, final Put put, final boolean result) throws IOException;
boolean preCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> c, final byte [] row, final byte [] family, final byte [] qualifier, final CompareOp compareOp, final WritableByteArrayComparable comparator, final Put put, final boolean result) throws IOException;
/** * Called before checkAndPut * <p> * Call CoprocessorEnvironment#bypass to skip default actions * <p> * Call CoprocessorEnvironment#complete to skip any subsequent chained * coprocessors * @param c the environment provided by the region server * @param row row to check * @param family column family * @param qualifier column qualifier * @param compareOp the comparison operation * @param comparator the comparator * @param put data to put if check succeeds * @param result * @return the return value to return to client if bypassing default * processing * @throws IOException if an error occurred on the coprocessor */
Called before checkAndPut Call CoprocessorEnvironment#bypass to skip default actions Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preCheckAndPut
{ "repo_name": "indi60/hbase-pmc", "path": "target/hbase-0.94.1/hbase-0.94.1/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java", "license": "apache-2.0", "size": 27227 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.Put", "org.apache.hadoop.hbase.filter.CompareFilter", "org.apache.hadoop.hbase.filter.WritableByteArrayComparable" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.filter.CompareFilter; import org.apache.hadoop.hbase.filter.WritableByteArrayComparable;
import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.filter.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,000,117
public List<FixtureScript> choices0RunFixtureScript() { return fixtureScripts.getFixtureScriptList(); } // //////////////////////////////////////
List<FixtureScript> function() { return fixtureScripts.getFixtureScriptList(); }
/** * Raising visibility to <tt>public</tt> so that choices are available for * first param of {@link #runFixtureScript(FixtureScript, String)}. */
Raising visibility to public so that choices are available for first param of <code>#runFixtureScript(FixtureScript, String)</code>
choices0RunFixtureScript
{ "repo_name": "kigsmtua/estatio", "path": "estatioapp/fixture/src/main/java/org/estatio/fixture/security/EstatioSecurityModuleFixturesService.java", "license": "apache-2.0", "size": 3886 }
[ "java.util.List", "org.apache.isis.applib.fixturescripts.FixtureScript" ]
import java.util.List; import org.apache.isis.applib.fixturescripts.FixtureScript;
import java.util.*; import org.apache.isis.applib.fixturescripts.*;
[ "java.util", "org.apache.isis" ]
java.util; org.apache.isis;
1,443,476
private boolean optionCheckTestsUpToDate() { return options.getOptions(ExecutionOptions.class).testCheckUpToDate; }
boolean function() { return options.getOptions(ExecutionOptions.class).testCheckUpToDate; }
/** * Returns true iff the --check_tests_up_to_date option is enabled. */
Returns true iff the --check_tests_up_to_date option is enabled
optionCheckTestsUpToDate
{ "repo_name": "juhalindfors/bazel-patches", "path": "src/main/java/com/google/devtools/build/lib/runtime/TerminalTestResultNotifier.java", "license": "apache-2.0", "size": 8188 }
[ "com.google.devtools.build.lib.exec.ExecutionOptions" ]
import com.google.devtools.build.lib.exec.ExecutionOptions;
import com.google.devtools.build.lib.exec.*;
[ "com.google.devtools" ]
com.google.devtools;
788,525
public void forceReindex(String indexerName) throws ObjectNotFoundException;
void function(String indexerName) throws ObjectNotFoundException;
/** * Force reindex for indexer of given name. * * @param indexerName to force reindex for * @throws ObjectNotFoundException if indexer of given name doesn't exist. */
Force reindex for indexer of given name
forceReindex
{ "repo_name": "ollyjshaw/searchisko", "path": "api/src/main/java/org/searchisko/api/indexer/IndexerHandler.java", "license": "apache-2.0", "size": 1716 }
[ "javax.ejb.ObjectNotFoundException" ]
import javax.ejb.ObjectNotFoundException;
import javax.ejb.*;
[ "javax.ejb" ]
javax.ejb;
54,478
public JPopupMenu getPopupMenu() { if (!popupMenuCreated) { popupMenu = createPopupMenu(); if (popupMenu!=null) { ComponentOrientation orientation = ComponentOrientation. getOrientation(Locale.getDefault()); popupMenu.applyComponentOrientation(orientation); } popupMenuCreated = true; } return popupMenu; }
JPopupMenu function() { if (!popupMenuCreated) { popupMenu = createPopupMenu(); if (popupMenu!=null) { ComponentOrientation orientation = ComponentOrientation. getOrientation(Locale.getDefault()); popupMenu.applyComponentOrientation(orientation); } popupMenuCreated = true; } return popupMenu; }
/** * Returns the popup menu for this component, lazily creating it if * necessary. * * @return The popup menu. * @see #createPopupMenu() * @see #setPopupMenu(JPopupMenu) */
Returns the popup menu for this component, lazily creating it if necessary
getPopupMenu
{ "repo_name": "fanruan/finereport-design", "path": "designer_base/src/com/fr/design/gui/syntax/ui/rtextarea/RTextArea.java", "license": "gpl-3.0", "size": 50571 }
[ "java.awt.ComponentOrientation", "java.util.Locale", "javax.swing.JPopupMenu" ]
import java.awt.ComponentOrientation; import java.util.Locale; import javax.swing.JPopupMenu;
import java.awt.*; import java.util.*; import javax.swing.*;
[ "java.awt", "java.util", "javax.swing" ]
java.awt; java.util; javax.swing;
1,271,433
@Test public void testGetEnd() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.MARCH, 31, 23, 59, 59); cal.set(Calendar.MILLISECOND, 999); Quarter q = new Quarter(1, 2006); assertEquals(cal.getTime(), q.getEnd()); Locale.setDefault(saved); }
void function() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.MARCH, 31, 23, 59, 59); cal.set(Calendar.MILLISECOND, 999); Quarter q = new Quarter(1, 2006); assertEquals(cal.getTime(), q.getEnd()); Locale.setDefault(saved); }
/** * Some checks for the getEnd() method. */
Some checks for the getEnd() method
testGetEnd
{ "repo_name": "simon04/jfreechart", "path": "src/test/java/org/jfree/data/time/QuarterTest.java", "license": "lgpl-2.1", "size": 13050 }
[ "java.util.Calendar", "java.util.Locale", "org.junit.Assert" ]
import java.util.Calendar; import java.util.Locale; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
373,581
public void testContainsValue() { ConcurrentNavigableMap map = map5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); }
void function() { ConcurrentNavigableMap map = map5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); }
/** * containsValue returns true for held values */
containsValue returns true for held values
testContainsValue
{ "repo_name": "life-beam/j2objc", "path": "jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListSubMapTest.java", "license": "apache-2.0", "size": 42529 }
[ "java.util.concurrent.ConcurrentNavigableMap" ]
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
150,660
public static Map<String, String> strToMap(String str, String delim) { return strToMap(str, delim, false); }
static Map<String, String> function(String str, String delim) { return strToMap(str, delim, false); }
/** * Creates a Map from an encoded name/value pair string * @param str The string to decode and format * @param delim the delimiter character(s) to join on (null will split on whitespace) * @return a Map of name/value pairs */
Creates a Map from an encoded name/value pair string
strToMap
{ "repo_name": "ilscipio/scipio-erp", "path": "framework/base/src/org/ofbiz/base/util/StringUtil.java", "license": "apache-2.0", "size": 40110 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,361,688
public void writePacketData(PacketBuffer data) throws IOException { data.writeVarIntToBuffer(this.field_149458_a); data.writeInt(this.field_149456_b); data.writeInt(this.field_149457_c); data.writeInt(this.field_149454_d); data.writeByte(this.field_149455_e); data.writeByte(this.field_149453_f); data.writeBoolean(this.field_179698_g); }
void function(PacketBuffer data) throws IOException { data.writeVarIntToBuffer(this.field_149458_a); data.writeInt(this.field_149456_b); data.writeInt(this.field_149457_c); data.writeInt(this.field_149454_d); data.writeByte(this.field_149455_e); data.writeByte(this.field_149453_f); data.writeBoolean(this.field_179698_g); }
/** * Writes the raw packet data to the data stream. */
Writes the raw packet data to the data stream
writePacketData
{ "repo_name": "KubaKaszycki/FreeCraft", "path": "src/main/java/kk/freecraft/network/play/server/S18PacketEntityTeleport.java", "license": "gpl-3.0", "size": 3313 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
668,372
@Override public void registerReadinessChecks(final HealthCheckHandler readinessHandler) { if (dnsClient != null) { log.info("registering readiness check using DNS Client"); readinessHandler.register("authentication-service-availability", status -> { log.trace("checking availability of Authentication service"); dnsClient.lookup(getConfig().getHost(), lookupAttempt -> { if (lookupAttempt.succeeded()) { status.tryComplete(Status.OK()); } else { log.debug("readiness check failed to resolve Authentication service address [{}]: ", getConfig().getHost(), lookupAttempt.cause().getMessage()); status.tryComplete(Status.KO()); } }); }); } else if (VertxInternal.class.isInstance(vertx)) { log.info("registering readiness check using vert.x Address Resolver"); readinessHandler.register("authentication-service-availability", status -> { log.trace("checking availability of Authentication service"); ((VertxInternal) vertx).resolveAddress(getConfig().getHost(), lookupAttempt -> { if (lookupAttempt.succeeded()) { status.tryComplete(Status.OK()); } else { log.debug("readiness check failed to resolve Authentication service address [{}]: ", getConfig().getHost(), lookupAttempt.cause().getMessage()); status.tryComplete(Status.KO()); } }); }); } else { log.warn("cannot register readiness check, no DNS resolver available"); } }
void function(final HealthCheckHandler readinessHandler) { if (dnsClient != null) { log.info(STR); readinessHandler.register(STR, status -> { log.trace(STR); dnsClient.lookup(getConfig().getHost(), lookupAttempt -> { if (lookupAttempt.succeeded()) { status.tryComplete(Status.OK()); } else { log.debug(STR, getConfig().getHost(), lookupAttempt.cause().getMessage()); status.tryComplete(Status.KO()); } }); }); } else if (VertxInternal.class.isInstance(vertx)) { log.info(STR); readinessHandler.register(STR, status -> { log.trace(STR); ((VertxInternal) vertx).resolveAddress(getConfig().getHost(), lookupAttempt -> { if (lookupAttempt.succeeded()) { status.tryComplete(Status.OK()); } else { log.debug(STR, getConfig().getHost(), lookupAttempt.cause().getMessage()); status.tryComplete(Status.KO()); } }); }); } else { log.warn(STR); } }
/** * Registers a check which succeeds if a connection with the configured <em>Authentication</em> service can be established. * * @param readinessHandler The health check handler to register the checks with. */
Registers a check which succeeds if a connection with the configured Authentication service can be established
registerReadinessChecks
{ "repo_name": "dejanb/hono", "path": "service-base/src/main/java/org/eclipse/hono/service/auth/delegating/DelegatingAuthenticationService.java", "license": "epl-1.0", "size": 6583 }
[ "io.vertx.core.impl.VertxInternal", "io.vertx.ext.healthchecks.HealthCheckHandler", "io.vertx.ext.healthchecks.Status" ]
import io.vertx.core.impl.VertxInternal; import io.vertx.ext.healthchecks.HealthCheckHandler; import io.vertx.ext.healthchecks.Status;
import io.vertx.core.impl.*; import io.vertx.ext.healthchecks.*;
[ "io.vertx.core", "io.vertx.ext" ]
io.vertx.core; io.vertx.ext;
635,547
private void doRetrieval() throws Exception { boolean passed = false; this.rs = this.stmt .executeQuery("SELECT blobdata from BLOBTEST LIMIT 1"); this.rs.next(); byte[] retrBytes = this.rs.getBytes(1); passed = checkBlob(retrBytes); assertTrue( "Inserted BLOB data did not match retrieved BLOB data for getBytes().", passed); retrBytes = this.rs.getBlob(1).getBytes(1L, (int) this.rs.getBlob(1).length()); passed = checkBlob(retrBytes); assertTrue( "Inserted BLOB data did not match retrieved BLOB data for getBlob().", passed); InputStream inStr = this.rs.getBinaryStream(1); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); int b; while ((b = inStr.read()) != -1) { bOut.write((byte) b); } retrBytes = bOut.toByteArray(); passed = checkBlob(retrBytes); assertTrue( "Inserted BLOB data did not match retrieved BLOB data for getBinaryStream().", passed); inStr = this.rs.getAsciiStream(1); bOut = new ByteArrayOutputStream(); while ((b = inStr.read()) != -1) { bOut.write((byte) b); } retrBytes = bOut.toByteArray(); passed = checkBlob(retrBytes); assertTrue( "Inserted BLOB data did not match retrieved BLOB data for getAsciiStream().", passed); inStr = this.rs.getUnicodeStream(1); bOut = new ByteArrayOutputStream(); while ((b = inStr.read()) != -1) { bOut.write((byte) b); } retrBytes = bOut.toByteArray(); passed = checkBlob(retrBytes); assertTrue( "Inserted BLOB data did not match retrieved BLOB data for getUnicodeStream().", passed); } private final static String TEST_BLOB_FILE_PREFIX = "cmj-testblob";
void function() throws Exception { boolean passed = false; this.rs = this.stmt .executeQuery(STR); this.rs.next(); byte[] retrBytes = this.rs.getBytes(1); passed = checkBlob(retrBytes); assertTrue( STR, passed); retrBytes = this.rs.getBlob(1).getBytes(1L, (int) this.rs.getBlob(1).length()); passed = checkBlob(retrBytes); assertTrue( STR, passed); InputStream inStr = this.rs.getBinaryStream(1); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); int b; while ((b = inStr.read()) != -1) { bOut.write((byte) b); } retrBytes = bOut.toByteArray(); passed = checkBlob(retrBytes); assertTrue( STR, passed); inStr = this.rs.getAsciiStream(1); bOut = new ByteArrayOutputStream(); while ((b = inStr.read()) != -1) { bOut.write((byte) b); } retrBytes = bOut.toByteArray(); passed = checkBlob(retrBytes); assertTrue( STR, passed); inStr = this.rs.getUnicodeStream(1); bOut = new ByteArrayOutputStream(); while ((b = inStr.read()) != -1) { bOut.write((byte) b); } retrBytes = bOut.toByteArray(); passed = checkBlob(retrBytes); assertTrue( STR, passed); } private final static String TEST_BLOB_FILE_PREFIX = STR;
/** * Mark this as deprecated to avoid warnings from compiler... * * @deprecated * * @throws Exception * if an error occurs retrieving the value */
Mark this as deprecated to avoid warnings from compiler..
doRetrieval
{ "repo_name": "seadsystem/SchemaSpy", "path": "src/testsuite/simple/BlobTest.java", "license": "gpl-2.0", "size": 6881 }
[ "java.io.ByteArrayOutputStream", "java.io.InputStream" ]
import java.io.ByteArrayOutputStream; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
123,063
public double readDouble( ) throws IOException { return Double.longBitsToDouble( readLong( ) ); }
double function( ) throws IOException { return Double.longBitsToDouble( readLong( ) ); }
/** * Description of the Method * * @return Description of the Returned Value * @exception IOException * Description of Exception */
Description of the Method
readDouble
{ "repo_name": "sguan-actuate/birt", "path": "data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/document/AbstractBufferedRandomAccessObject.java", "license": "epl-1.0", "size": 23429 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,153,127
@Element(name = "PROFITSHARING", order = 50) public BigDecimal getProfitSharingValue() { return profitSharingValue; }
@Element(name = STR, order = 50) BigDecimal function() { return profitSharingValue; }
/** * Current value of all securities purchased with Employer Profit Sharing contributions. This is not a required * field according to the OFX spec. * * @return the value of all the securities in the account purchased with employer profit sharing contributions */
Current value of all securities purchased with Employer Profit Sharing contributions. This is not a required field according to the OFX spec
getProfitSharingValue
{ "repo_name": "stoicflame/ofx4j", "path": "src/main/java/com/webcohesion/ofx4j/domain/data/investment/statements/FourOhOneKBalance.java", "license": "apache-2.0", "size": 8353 }
[ "com.webcohesion.ofx4j.meta.Element", "java.math.BigDecimal" ]
import com.webcohesion.ofx4j.meta.Element; import java.math.BigDecimal;
import com.webcohesion.ofx4j.meta.*; import java.math.*;
[ "com.webcohesion.ofx4j", "java.math" ]
com.webcohesion.ofx4j; java.math;
1,447,567
public void hide() { if (mAnchor == null) { return; } try { mAnchor.removeView(this); mHandler.removeMessages(SHOW_PROGRESS); } catch (IllegalArgumentException ex) { Log.w("MediaController", "already removed"); } mShowing = false; }
void function() { if (mAnchor == null) { return; } try { mAnchor.removeView(this); mHandler.removeMessages(SHOW_PROGRESS); } catch (IllegalArgumentException ex) { Log.w(STR, STR); } mShowing = false; }
/** * Remove the controller from the screen. */
Remove the controller from the screen
hide
{ "repo_name": "DigitalCampus/instrat-oppia-mobile", "path": "src/org/digitalcampus/oppia/utils/mediaplayer/VideoControllerView.java", "license": "gpl-3.0", "size": 23014 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,028,504
public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(Application.class); app.setShowBanner(false); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); addLiquibaseScanPackages(); Environment env = app.run(args).getEnvironment(); log.info("Access URLs:\n----------------------------------------------------------\n\t" + "Local: \t\thttp://127.0.0.1:{}\n\t" + "External: \thttp://{}:{}\n----------------------------------------------------------", env.getProperty("server.port"), InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port")); }
static void function(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(Application.class); app.setShowBanner(false); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); addDefaultProfile(app, source); addLiquibaseScanPackages(); Environment env = app.run(args).getEnvironment(); log.info(STR + STRExternal: \thttp: env.getProperty(STR), InetAddress.getLocalHost().getHostAddress(), env.getProperty(STR)); }
/** * Main method, used to run the application. */
Main method, used to run the application
main
{ "repo_name": "pgrazaitis/BCDS", "path": "Code/bcds-web/src/main/java/gov/va/vba/Application.java", "license": "apache-2.0", "size": 3814 }
[ "java.net.InetAddress", "java.net.UnknownHostException", "org.springframework.boot.SpringApplication", "org.springframework.core.env.Environment", "org.springframework.core.env.SimpleCommandLinePropertySource" ]
import java.net.InetAddress; import java.net.UnknownHostException; import org.springframework.boot.SpringApplication; import org.springframework.core.env.Environment; import org.springframework.core.env.SimpleCommandLinePropertySource;
import java.net.*; import org.springframework.boot.*; import org.springframework.core.env.*;
[ "java.net", "org.springframework.boot", "org.springframework.core" ]
java.net; org.springframework.boot; org.springframework.core;
2,064,576
public long restore(DataTree dt, Map<Long, Integer> sessions, PlayBackListener listener) throws IOException { snapLog.deserialize(dt, sessions); FileTxnLog txnLog = new FileTxnLog(dataDir); TxnIterator itr = txnLog.read(dt.lastProcessedZxid + 1); long highestZxid = dt.lastProcessedZxid; TxnHeader hdr; try { while (true) { // iterator points to // the first valid txn when initialized hdr = itr.getHeader(); if (hdr == null) { //empty logs return dt.lastProcessedZxid; } if (hdr.getZxid() < highestZxid && highestZxid != 0) { LOG.error("{}(higestZxid) > {}(next log) for type {}", new Object[] { highestZxid, hdr.getZxid(), hdr.getType() }); } else { highestZxid = hdr.getZxid(); } try { processTransaction(hdr,dt,sessions, itr.getTxn()); } catch(KeeperException.NoNodeException e) { throw new IOException("Failed to process transaction type: " + hdr.getType() + " error: " + e.getMessage(), e); } listener.onTxnLoaded(hdr, itr.getTxn()); if (!itr.next()) break; } } finally { if (itr != null) { itr.close(); } } return highestZxid; }
long function(DataTree dt, Map<Long, Integer> sessions, PlayBackListener listener) throws IOException { snapLog.deserialize(dt, sessions); FileTxnLog txnLog = new FileTxnLog(dataDir); TxnIterator itr = txnLog.read(dt.lastProcessedZxid + 1); long highestZxid = dt.lastProcessedZxid; TxnHeader hdr; try { while (true) { hdr = itr.getHeader(); if (hdr == null) { return dt.lastProcessedZxid; } if (hdr.getZxid() < highestZxid && highestZxid != 0) { LOG.error(STR, new Object[] { highestZxid, hdr.getZxid(), hdr.getType() }); } else { highestZxid = hdr.getZxid(); } try { processTransaction(hdr,dt,sessions, itr.getTxn()); } catch(KeeperException.NoNodeException e) { throw new IOException(STR + hdr.getType() + STR + e.getMessage(), e); } listener.onTxnLoaded(hdr, itr.getTxn()); if (!itr.next()) break; } } finally { if (itr != null) { itr.close(); } } return highestZxid; }
/** * this function restores the server database after reading from the * snapshots and transaction logs * @param dt the datatree to be restored * @param sessions the sessions to be restored * @param listener the playback listener to run on the database restoration * @return the highest zxid restored * @throws IOException */
this function restores the server database after reading from the snapshots and transaction logs
restore
{ "repo_name": "dinglevin/levin-zookeeper", "path": "levin-zookeeper-maven/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java", "license": "apache-2.0", "size": 11456 }
[ "java.io.IOException", "java.util.Map", "org.apache.zookeeper.KeeperException", "org.apache.zookeeper.server.DataTree", "org.apache.zookeeper.server.persistence.TxnLog", "org.apache.zookeeper.txn.TxnHeader" ]
import java.io.IOException; import java.util.Map; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.server.DataTree; import org.apache.zookeeper.server.persistence.TxnLog; import org.apache.zookeeper.txn.TxnHeader;
import java.io.*; import java.util.*; import org.apache.zookeeper.*; import org.apache.zookeeper.server.*; import org.apache.zookeeper.server.persistence.*; import org.apache.zookeeper.txn.*;
[ "java.io", "java.util", "org.apache.zookeeper" ]
java.io; java.util; org.apache.zookeeper;
850,241
@Nonnull public ServiceHealthCollectionRequest filter(@Nonnull final String value) { addFilterOption(value); return this; }
ServiceHealthCollectionRequest function(@Nonnull final String value) { addFilterOption(value); return this; }
/** * Sets the filter clause for the request * * @param value the filter clause * @return the updated request */
Sets the filter clause for the request
filter
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/ServiceHealthCollectionRequest.java", "license": "mit", "size": 5801 }
[ "com.microsoft.graph.requests.ServiceHealthCollectionRequest", "javax.annotation.Nonnull" ]
import com.microsoft.graph.requests.ServiceHealthCollectionRequest; import javax.annotation.Nonnull;
import com.microsoft.graph.requests.*; import javax.annotation.*;
[ "com.microsoft.graph", "javax.annotation" ]
com.microsoft.graph; javax.annotation;
1,034,567
protected static void _buildExceptions(PyObject dict) { Error = buildClass("Error", Py.StandardError); Warning = buildClass("Warning", Py.StandardError); InterfaceError = buildClass("InterfaceError", Error); DatabaseError = buildClass("DatabaseError", Error); InternalError = buildClass("InternalError", DatabaseError); OperationalError = buildClass("OperationalError", DatabaseError); ProgrammingError = buildClass("ProgrammingError", DatabaseError); IntegrityError = buildClass("IntegrityError", DatabaseError); DataError = buildClass("DataError", DatabaseError); NotSupportedError = buildClass("NotSupportedError", DatabaseError); }
static void function(PyObject dict) { Error = buildClass("Error", Py.StandardError); Warning = buildClass(STR, Py.StandardError); InterfaceError = buildClass(STR, Error); DatabaseError = buildClass(STR, Error); InternalError = buildClass(STR, DatabaseError); OperationalError = buildClass(STR, DatabaseError); ProgrammingError = buildClass(STR, DatabaseError); IntegrityError = buildClass(STR, DatabaseError); DataError = buildClass(STR, DatabaseError); NotSupportedError = buildClass(STR, DatabaseError); }
/** * Create the exception classes and get their descriptions from the resource bundle. * * @param dict */
Create the exception classes and get their descriptions from the resource bundle
_buildExceptions
{ "repo_name": "tunneln/CarnotKE", "path": "jyhton/src/com/ziclix/python/sql/zxJDBC.java", "license": "apache-2.0", "size": 17570 }
[ "org.python.core.Py", "org.python.core.PyObject" ]
import org.python.core.Py; import org.python.core.PyObject;
import org.python.core.*;
[ "org.python.core" ]
org.python.core;
68,808
ImmutableList<ArgumentType> getArgumentTypes();
ImmutableList<ArgumentType> getArgumentTypes();
/** * The types of the arguments of the function. */
The types of the arguments of the function
getArgumentTypes
{ "repo_name": "raviagarwal7/buck", "path": "src/com/facebook/buck/query/QueryEnvironment.java", "license": "apache-2.0", "size": 8562 }
[ "com.google.common.collect.ImmutableList" ]
import com.google.common.collect.ImmutableList;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
80,309
@Test public void testGetCompliantPdfaTota1() { ValidationBatchSummary summary = ValidationBatchSummaryImpl.fromValues(12, 0, 0); assertTrue(summary.getCompliantPdfaCount() == 12); summary = ValidationBatchSummaryImpl.fromValues(10, 12, 0); assertTrue(summary.getCompliantPdfaCount() == 10); summary = ValidationBatchSummaryImpl.fromValues(15, 0, 20); assertTrue(summary.getCompliantPdfaCount() == 15); summary = ValidationBatchSummaryImpl.fromValues(25, 13, 20); assertTrue(summary.getCompliantPdfaCount() == 25); summary = ValidationBatchSummaryImpl.fromValues(0, 13, 20); assertTrue(summary.getCompliantPdfaCount() == 0); }
void function() { ValidationBatchSummary summary = ValidationBatchSummaryImpl.fromValues(12, 0, 0); assertTrue(summary.getCompliantPdfaCount() == 12); summary = ValidationBatchSummaryImpl.fromValues(10, 12, 0); assertTrue(summary.getCompliantPdfaCount() == 10); summary = ValidationBatchSummaryImpl.fromValues(15, 0, 20); assertTrue(summary.getCompliantPdfaCount() == 15); summary = ValidationBatchSummaryImpl.fromValues(25, 13, 20); assertTrue(summary.getCompliantPdfaCount() == 25); summary = ValidationBatchSummaryImpl.fromValues(0, 13, 20); assertTrue(summary.getCompliantPdfaCount() == 0); }
/** * Test method for {@link org.verapdf.processor.reports.ValidationBatchSummaryImpl#getCompliantPdfaTota1()}. */
Test method for <code>org.verapdf.processor.reports.ValidationBatchSummaryImpl#getCompliantPdfaTota1()</code>
testGetCompliantPdfaTota1
{ "repo_name": "carlwilson/veraPDF-library", "path": "core/src/test/java/org/verapdf/processor/reports/ValidationBatchSummaryTest.java", "license": "mpl-2.0", "size": 4764 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
562,468
public void setDictCollectionFinder( DictCollectionFinder dictCollectionFinder) { this.dictCollectionFinder = dictCollectionFinder; }
void function( DictCollectionFinder dictCollectionFinder) { this.dictCollectionFinder = dictCollectionFinder; }
/** * Sets the dictionary collection finder. * * @param dictCollectionFinder the dictionary collection finder */
Sets the dictionary collection finder
setDictCollectionFinder
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-core-datamgt-portlet/docroot/WEB-INF/src/org/oep/core/datamgt/service/base/DictAttributeServiceBaseImpl.java", "license": "apache-2.0", "size": 16321 }
[ "org.oep.core.datamgt.service.persistence.DictCollectionFinder" ]
import org.oep.core.datamgt.service.persistence.DictCollectionFinder;
import org.oep.core.datamgt.service.persistence.*;
[ "org.oep.core" ]
org.oep.core;
377,827
public boolean onItemClick(IDrawerItem selectedDrawerItem) { //We only need to clear if the new item is selectable if (selectedDrawerItem.isSelectable()) { //crossfade if we are cross faded if (mCrossFader != null) { if (mCrossFader.isCrossfaded()) { mCrossFader.crossfade(); } } //update everything setSelection(selectedDrawerItem.getIdentifier()); return false; } else { return true; } }
boolean function(IDrawerItem selectedDrawerItem) { if (selectedDrawerItem.isSelectable()) { if (mCrossFader != null) { if (mCrossFader.isCrossfaded()) { mCrossFader.crossfade(); } } setSelection(selectedDrawerItem.getIdentifier()); return false; } else { return true; } }
/** * call this method to trigger the onItemClick on the MiniDrawer * * @param selectedDrawerItem * @return */
call this method to trigger the onItemClick on the MiniDrawer
onItemClick
{ "repo_name": "natodemon/Lunary-Ethereum-Wallet", "path": "materialdrawer/src/main/java/com/mikepenz/materialdrawer/MiniDrawer.java", "license": "gpl-3.0", "size": 19246 }
[ "com.mikepenz.materialdrawer.model.interfaces.IDrawerItem" ]
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.*;
[ "com.mikepenz.materialdrawer" ]
com.mikepenz.materialdrawer;
2,279,251
public Object convert(Class type, Object value) { if (value == null) { if (useDefault) { return (defaultValue); } else { throw new ConversionException("No value specified"); } } if (value instanceof Timestamp) { return (value); } try { return (Timestamp.valueOf(value.toString())); } catch (Exception e) { if (useDefault) { return (defaultValue); } else { throw new ConversionException(e); } } } }
Object function(Class type, Object value) { if (value == null) { if (useDefault) { return (defaultValue); } else { throw new ConversionException(STR); } } if (value instanceof Timestamp) { return (value); } try { return (Timestamp.valueOf(value.toString())); } catch (Exception e) { if (useDefault) { return (defaultValue); } else { throw new ConversionException(e); } } } }
/** * Convert the specified input object into an output object of the * specified type. * * @param type Data type to which this value should be converted * @param value The input value to be converted * * @exception org.apache.commons.beanutils.ConversionException if conversion cannot be performed * successfully */
Convert the specified input object into an output object of the specified type
convert
{ "repo_name": "bhutchinson/rice", "path": "rice-middleware/ksb/web/src/main/java/org/kuali/rice/ksb/messaging/web/MessageQueueForm.java", "license": "apache-2.0", "size": 11533 }
[ "java.sql.Timestamp", "org.apache.commons.beanutils.ConversionException" ]
import java.sql.Timestamp; import org.apache.commons.beanutils.ConversionException;
import java.sql.*; import org.apache.commons.beanutils.*;
[ "java.sql", "org.apache.commons" ]
java.sql; org.apache.commons;
242,857
public Optional<Component> getComponent() { return Optional.ofNullable(component); }
Optional<Component> function() { return Optional.ofNullable(component); }
/** * Returns an {@code Optional} for the {@code Component} related to value * conversion. * * @return the optional of component */
Returns an Optional for the Component related to value conversion
getComponent
{ "repo_name": "Darsstar/framework", "path": "server/src/main/java/com/vaadin/data/ValueContext.java", "license": "apache-2.0", "size": 4760 }
[ "com.vaadin.ui.Component", "java.util.Optional" ]
import com.vaadin.ui.Component; import java.util.Optional;
import com.vaadin.ui.*; import java.util.*;
[ "com.vaadin.ui", "java.util" ]
com.vaadin.ui; java.util;
389,830
Map<Integer, Long> getAgentIdsInRestartState();
Map<Integer, Long> getAgentIdsInRestartState();
/** * Gets the agentIds being restarted by the SAPS mechanism * @return {@link Map} of {@link Integer} = agentId to {@link Long} = timestamp ms which * represents the time the agent restart command was issued */
Gets the agentIds being restarted by the SAPS mechanism
getAgentIdsInRestartState
{ "repo_name": "cc14514/hq6", "path": "hq-server/src/main/java/org/hyperic/hq/product/shared/PluginManager.java", "license": "unlicense", "size": 8758 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
876,930
public boolean createSelectionActionModeMenuItem(MenuItem convert);
boolean function(MenuItem convert);
/** * Returns a converted MenuItem for use in the selection Contextual Action Bar. * Return false for a tool that does not appear in the selection CAB * * @param convert the MenuItem to convert * @return whether or not the MenuItem should appear in the selection CAB */
Returns a converted MenuItem for use in the selection Contextual Action Bar. Return false for a tool that does not appear in the selection CAB
createSelectionActionModeMenuItem
{ "repo_name": "Calsign/APDE", "path": "APDE/src/main/java/com/calsignlabs/apde/tool/Tool.java", "license": "gpl-2.0", "size": 1098 }
[ "android.view.MenuItem" ]
import android.view.MenuItem;
import android.view.*;
[ "android.view" ]
android.view;
2,702,532
private Map<File, File[]> getRawPeptideShakerLinks() { Map<File, File[]> links = new HashMap<>(); //iterate over the nodes Enumeration children = fileLinkerRootNode.children(); while (children.hasMoreElements()) { DefaultMutableTreeNode rawFileNode = (DefaultMutableTreeNode) children.nextElement(); File rawFile = ((File) ((DefaultMutableTreeNode) rawFileNode).getUserObject()); DefaultMutableTreeNode peptideShakerNode = (DefaultMutableTreeNode) rawFileNode.getChildAt(0); File peptideShakerFile = ((File) (peptideShakerNode).getUserObject()); File[] peptideShakerFiles = new File[3]; peptideShakerFiles[0] = peptideShakerFile; //add FASTA and MGF files Enumeration peptideShakerChildren = peptideShakerNode.children(); while (peptideShakerChildren.hasMoreElements()) { DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) peptideShakerChildren.nextElement(); File fastaOrMgfFile = ((File) (childNode).getUserObject()); if (FilenameUtils.getExtension(fastaOrMgfFile.getName()).equals("fasta")) { peptideShakerFiles[1] = fastaOrMgfFile; } else { peptideShakerFiles[2] = fastaOrMgfFile; } } links.put(rawFile, peptideShakerFiles); } return links; }
Map<File, File[]> function() { Map<File, File[]> links = new HashMap<>(); Enumeration children = fileLinkerRootNode.children(); while (children.hasMoreElements()) { DefaultMutableTreeNode rawFileNode = (DefaultMutableTreeNode) children.nextElement(); File rawFile = ((File) ((DefaultMutableTreeNode) rawFileNode).getUserObject()); DefaultMutableTreeNode peptideShakerNode = (DefaultMutableTreeNode) rawFileNode.getChildAt(0); File peptideShakerFile = ((File) (peptideShakerNode).getUserObject()); File[] peptideShakerFiles = new File[3]; peptideShakerFiles[0] = peptideShakerFile; Enumeration peptideShakerChildren = peptideShakerNode.children(); while (peptideShakerChildren.hasMoreElements()) { DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) peptideShakerChildren.nextElement(); File fastaOrMgfFile = ((File) (childNode).getUserObject()); if (FilenameUtils.getExtension(fastaOrMgfFile.getName()).equals("fasta")) { peptideShakerFiles[1] = fastaOrMgfFile; } else { peptideShakerFiles[2] = fastaOrMgfFile; } } links.put(rawFile, peptideShakerFiles); } return links; }
/** * Get the file link map in case of PeptideShaker identification files (key: * RAW file absolute path; value: an array with 3 PeptideShaker related * files (first element: the PeptideShaker .cpsx file; second element: the * FASTA file; third element: the MGF file)). * * @return the link map */
Get the file link map in case of PeptideShaker identification files (key: RAW file absolute path; value: an array with 3 PeptideShaker related files (first element: the PeptideShaker .cpsx file; second element: the FASTA file; third element: the MGF file))
getRawPeptideShakerLinks
{ "repo_name": "compomics/moff-gui", "path": "src/main/java/com/compomics/moff/gui/view/MainController.java", "license": "apache-2.0", "size": 53839 }
[ "java.io.File", "java.util.Enumeration", "java.util.HashMap", "java.util.Map", "javax.swing.tree.DefaultMutableTreeNode", "org.apache.commons.io.FilenameUtils" ]
import java.io.File; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import javax.swing.tree.DefaultMutableTreeNode; import org.apache.commons.io.FilenameUtils;
import java.io.*; import java.util.*; import javax.swing.tree.*; import org.apache.commons.io.*;
[ "java.io", "java.util", "javax.swing", "org.apache.commons" ]
java.io; java.util; javax.swing; org.apache.commons;
197,933
public static GloVeSpace load(String gloVeModel, boolean norm, boolean header) { GloVeSpace model = new GloVeSpace(); try { Reader decoder; if (gloVeModel.endsWith("gz")) { decoder = new InputStreamReader(new GZIPInputStream(new FileInputStream(gloVeModel)), "UTF-8"); } else { decoder = new InputStreamReader(new FileInputStream(gloVeModel), "UTF-8"); } BufferedReader r = new BufferedReader(decoder); long numWords = 0; String line; if (header) { String h = r.readLine(); System.out.println(h); } while ((line = r.readLine()) != null) { // Split into words: String[] wordvec = StringUtils.split(line, ' '); if (wordvec.length < 2) { break; } float[] vec = readFloatVector(wordvec); if (norm) { model.store.put(wordvec[0], VectorMath.normalize(new FloatMatrix(vec))); } else { model.store.put(wordvec[0], new FloatMatrix(vec)); } numWords++; } decoder.close(); r.close(); int vecSize = model.store.entrySet().iterator().next().getValue().length; vectorLength =vecSize; System.out.println(String.format("Loaded %s words, vector size %s", numWords, vecSize)); } catch (IOException e) { System.err.println("ERROR: Failed to load model: " + gloVeModel); e.printStackTrace(); System.exit(1); } return model; }
static GloVeSpace function(String gloVeModel, boolean norm, boolean header) { GloVeSpace model = new GloVeSpace(); try { Reader decoder; if (gloVeModel.endsWith("gz")) { decoder = new InputStreamReader(new GZIPInputStream(new FileInputStream(gloVeModel)), "UTF-8"); } else { decoder = new InputStreamReader(new FileInputStream(gloVeModel), "UTF-8"); } BufferedReader r = new BufferedReader(decoder); long numWords = 0; String line; if (header) { String h = r.readLine(); System.out.println(h); } while ((line = r.readLine()) != null) { String[] wordvec = StringUtils.split(line, ' '); if (wordvec.length < 2) { break; } float[] vec = readFloatVector(wordvec); if (norm) { model.store.put(wordvec[0], VectorMath.normalize(new FloatMatrix(vec))); } else { model.store.put(wordvec[0], new FloatMatrix(vec)); } numWords++; } decoder.close(); r.close(); int vecSize = model.store.entrySet().iterator().next().getValue().length; vectorLength =vecSize; System.out.println(String.format(STR, numWords, vecSize)); } catch (IOException e) { System.err.println(STR + gloVeModel); e.printStackTrace(); System.exit(1); } return model; }
/** * Reads a .txt or .txt.gz model * @param gloVeModel path containing the model * @param norm specifies if the word representation is to be normalised * @param header specifies if the first word and it's representation is to be printed * @return a model containing the word representation of all the words */
Reads a .txt or .txt.gz model
load
{ "repo_name": "tudarmstadt-lt/AB-Sentiment", "path": "src/main/java/tudarmstadt/lt/ABSentiment/featureExtractor/util/GloVeSpace.java", "license": "apache-2.0", "size": 7001 }
[ "java.io.BufferedReader", "java.io.FileInputStream", "java.io.IOException", "java.io.InputStreamReader", "java.io.Reader", "java.util.zip.GZIPInputStream", "org.apache.commons.lang.StringUtils", "org.jblas.FloatMatrix" ]
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.zip.GZIPInputStream; import org.apache.commons.lang.StringUtils; import org.jblas.FloatMatrix;
import java.io.*; import java.util.zip.*; import org.apache.commons.lang.*; import org.jblas.*;
[ "java.io", "java.util", "org.apache.commons", "org.jblas" ]
java.io; java.util; org.apache.commons; org.jblas;
2,325,609
char ch = c.charValue(); // check for immune characters if (StringUtilityMethods.containsCharacter( ch, immune ) ) { return ""+ch; } // check for alphanumeric characters String hex = HexadecimalConverter.getHexForNonAlphanumeric(ch); if ( hex == null ) { return ""+ch; } return "\\" + c; }
char ch = c.charValue(); if (StringUtilityMethods.containsCharacter( ch, immune ) ) { return STRSTR\\" + c; }
/** * {@inheritDoc} * * Returns backslash-encoded character * * @param immune */
Returns backslash-encoded character
encodeCharacter
{ "repo_name": "ihr/esapi-c14n", "path": "src/main/java/org/owasp/esapi/c14n/encoder/UnixEncoder.java", "license": "bsd-3-clause", "size": 1630 }
[ "org.owasp.esapi.c14n.util.StringUtilityMethods" ]
import org.owasp.esapi.c14n.util.StringUtilityMethods;
import org.owasp.esapi.c14n.util.*;
[ "org.owasp.esapi" ]
org.owasp.esapi;
2,877,146
public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final double range) throws ParticleVersionException, ParticleDataException { if (!this.isSupported()) { throw new ParticleVersionException( "This particle effect is not supported by your server version"); } if (!this.requiresData) { throw new ParticleDataException( "This particle effect does not require additional data"); } if (!isDataCorrect(this, data)) { throw new ParticleDataException( "The particle data type is incorrect"); } new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256, data).sendTo(center, range); }
void function(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final double range) throws ParticleVersionException, ParticleDataException { if (!this.isSupported()) { throw new ParticleVersionException( STR); } if (!this.requiresData) { throw new ParticleDataException( STR); } if (!isDataCorrect(this, data)) { throw new ParticleDataException( STR); } new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256, data).sendTo(center, range); }
/** * Displays a particle effect which requires additional data and is only visible for all players within a certain * range in the world of @param center * * @param data * Data of the effect * @param offsetX * Maximum distance particles can fly away from the center on the x-axis * @param offsetY * Maximum distance particles can fly away from the center on the y-axis * @param offsetZ * Maximum distance particles can fly away from the center on the z-axis * @param speed * Display speed of the particles * @param amount * Amount of particles * @param center * Center location of the effect * @param range * Range of the visibility * @throws ParticleVersionException * If the particle effect is not supported by the server version * @throws ParticleDataException * If the particle effect does not require additional data or if the data type is incorrect * @see ParticlePacket * @see ParticlePacket#sendTo(Location, double) */
Displays a particle effect which requires additional data and is only visible for all players within a certain range in the world of @param center
display
{ "repo_name": "dobrakmato/PexelCore", "path": "src/eu/matejkormuth/pexel/PexelCore/util/ParticleEffect2.java", "license": "gpl-3.0", "size": 60113 }
[ "org.bukkit.Location" ]
import org.bukkit.Location;
import org.bukkit.*;
[ "org.bukkit" ]
org.bukkit;
46,408
protected void clearJars() { synchronized (this) { ArrayList<JarEntry> jars = new ArrayList<JarEntry>(_jarList); _jarList.clear(); if (_pathMap != null) _pathMap.clear(); for (int i = 0; i < jars.size(); i++) { JarEntry jarEntry = jars.get(i); JarPath jarPath = jarEntry.getJarPath(); jarPath.closeJar(); } } }
void function() { synchronized (this) { ArrayList<JarEntry> jars = new ArrayList<JarEntry>(_jarList); _jarList.clear(); if (_pathMap != null) _pathMap.clear(); for (int i = 0; i < jars.size(); i++) { JarEntry jarEntry = jars.get(i); JarPath jarPath = jarEntry.getJarPath(); jarPath.closeJar(); } } }
/** * Closes the jars. */
Closes the jars
clearJars
{ "repo_name": "mdaniel/svn-caucho-com-resin", "path": "modules/kernel/src/com/caucho/loader/JarListLoader.java", "license": "gpl-2.0", "size": 9509 }
[ "com.caucho.vfs.JarPath", "java.util.ArrayList" ]
import com.caucho.vfs.JarPath; import java.util.ArrayList;
import com.caucho.vfs.*; import java.util.*;
[ "com.caucho.vfs", "java.util" ]
com.caucho.vfs; java.util;
1,321,819
public static void dispatchEvent(Group group, EventType eventType, Map params) { for (GroupEventListener listener : listeners) { try { switch (eventType) { case group_created: { listener.groupCreated(group, params); break; } case group_deleting: { listener.groupDeleting(group, params); break; } case member_added: { listener.memberAdded(group, params); break; } case member_removed: { listener.memberRemoved(group, params); break; } case admin_added: { listener.adminAdded(group, params); break; } case admin_removed: { listener.adminRemoved(group, params); break; } case group_modified: { listener.groupModified(group, params); break; } default: break; } } catch (Exception e) { Log.error(e.getMessage(), e); } } } public enum EventType { group_created, group_deleting, group_modified, member_added, member_removed, admin_added, admin_removed; }
static void function(Group group, EventType eventType, Map params) { for (GroupEventListener listener : listeners) { try { switch (eventType) { case group_created: { listener.groupCreated(group, params); break; } case group_deleting: { listener.groupDeleting(group, params); break; } case member_added: { listener.memberAdded(group, params); break; } case member_removed: { listener.memberRemoved(group, params); break; } case admin_added: { listener.adminAdded(group, params); break; } case admin_removed: { listener.adminRemoved(group, params); break; } case group_modified: { listener.groupModified(group, params); break; } default: break; } } catch (Exception e) { Log.error(e.getMessage(), e); } } } public enum EventType { group_created, group_deleting, group_modified, member_added, member_removed, admin_added, admin_removed; }
/** * Dispatches an event to all listeners. * * @param group the group. * @param eventType the event type. * @param params event parameters. */
Dispatches an event to all listeners
dispatchEvent
{ "repo_name": "derek-wang/ca.rides.openfire", "path": "src/java/org/jivesoftware/openfire/event/GroupEventDispatcher.java", "license": "apache-2.0", "size": 7003 }
[ "java.util.Map", "org.jivesoftware.openfire.group.Group" ]
import java.util.Map; import org.jivesoftware.openfire.group.Group;
import java.util.*; import org.jivesoftware.openfire.group.*;
[ "java.util", "org.jivesoftware.openfire" ]
java.util; org.jivesoftware.openfire;
1,833,820
public T getObject(); } public PerunLinkCell() { this(new SafeHtmlRenderer<T>() {
T function(); } public PerunLinkCell() { this(new SafeHtmlRenderer<T>() {
/** * Get object, which is used to render this row and should be used in all * other methods to get data and perform decisions. * * @return object/key behind current row */
Get object, which is used to render this row and should be used in all other methods to get data and perform decisions
getObject
{ "repo_name": "zlamalp/perun-wui", "path": "perun-wui-core/src/main/java/cz/metacentrum/perun/wui/widgets/cells/PerunLinkCell.java", "license": "bsd-2-clause", "size": 5831 }
[ "com.google.gwt.text.shared.SafeHtmlRenderer" ]
import com.google.gwt.text.shared.SafeHtmlRenderer;
import com.google.gwt.text.shared.*;
[ "com.google.gwt" ]
com.google.gwt;
2,866,136
public T addSummary(ComponentBuilder<?, ?> ...components) { Validate.notNull(components, "components must not be null"); Validate.noNullElements(components, "components must not contains null component"); for (ComponentBuilder<?, ?> component : components) { getObject().getSummaryBand().addComponent(component.build()); } return (T) this; }
T function(ComponentBuilder<?, ?> ...components) { Validate.notNull(components, STR); Validate.noNullElements(components, STR); for (ComponentBuilder<?, ?> component : components) { getObject().getSummaryBand().addComponent(component.build()); } return (T) this; }
/** * Adds components to the summary band. * The band is printed on the last page and only once. * * @param components the summary components * @return a report builder */
Adds components to the summary band. The band is printed on the last page and only once
addSummary
{ "repo_name": "robcowell/dynamicreports", "path": "dynamicreports-core/src/main/java/net/sf/dynamicreports/report/builder/ReportBuilder.java", "license": "lgpl-3.0", "size": 61004 }
[ "net.sf.dynamicreports.report.builder.component.ComponentBuilder", "org.apache.commons.lang3.Validate" ]
import net.sf.dynamicreports.report.builder.component.ComponentBuilder; import org.apache.commons.lang3.Validate;
import net.sf.dynamicreports.report.builder.component.*; import org.apache.commons.lang3.*;
[ "net.sf.dynamicreports", "org.apache.commons" ]
net.sf.dynamicreports; org.apache.commons;
2,876,437
public void publishToSubscriber(String subscribedDestination, String messageDestination, AbstractMessage.QOSType qos, ByteBuffer message, boolean retain, Integer messageID, String mqttClientID) throws MQTTException { Subscription subscription = subscriptions.getSubscriptions(subscribedDestination, mqttClientID); if (subscription != null) { if (qos.ordinal() > subscription.getRequestedQos().ordinal()) { qos = subscription.getRequestedQos(); } //TODO we do not need to duplicate this here // ByteBuffer message = origMessage.duplicate(); //TODO we could add the qos class //TODO check whether the QOS 0 messages should be retained if (qos == AbstractMessage.QOSType.MOST_ONE && subscription.isActive()) { //QoS 0 sendPublish(subscription.getClientId(), messageDestination, qos, message, retain); } else { //QoS 1 or 2 //if the target subscription is not clean session and is not connected => store it if (!subscription.isCleanSession() && !subscription.isActive()) { //clone the event with matching clientID //TODO if its clean session we don't need to store it, it will be stored at the andes layer itself PublishEvent newPublishEvt = new PublishEvent(subscribedDestination, qos, message, retain, subscription.getClientId(), messageID, null); m_storageService.storePublishForFuture(newPublishEvt); } else { //Then we need to store this //publish if (subscription.isActive()) { //Change done by WSO2 will be overloading the method sendPublish(subscription.getClientId(), messageDestination, qos, message, retain, messageID); } } } } else { //This means by the time the message was given out for delivery the subscription has closed its connection throw new MQTTException("Subscriber disconnected unexpectedly, will not deliver the message"); } }
void function(String subscribedDestination, String messageDestination, AbstractMessage.QOSType qos, ByteBuffer message, boolean retain, Integer messageID, String mqttClientID) throws MQTTException { Subscription subscription = subscriptions.getSubscriptions(subscribedDestination, mqttClientID); if (subscription != null) { if (qos.ordinal() > subscription.getRequestedQos().ordinal()) { qos = subscription.getRequestedQos(); } if (qos == AbstractMessage.QOSType.MOST_ONE && subscription.isActive()) { sendPublish(subscription.getClientId(), messageDestination, qos, message, retain); } else { if (!subscription.isCleanSession() && !subscription.isActive()) { PublishEvent newPublishEvt = new PublishEvent(subscribedDestination, qos, message, retain, subscription.getClientId(), messageID, null); m_storageService.storePublishForFuture(newPublishEvt); } else { if (subscription.isActive()) { sendPublish(subscription.getClientId(), messageDestination, qos, message, retain, messageID); } } } } else { throw new MQTTException(STR); } }
/** * Method written by WSO2. Since we would be sequentially writing the message to the subscribers * @param subscribedDestination The subscribed destination, this may include wildcards * @param messageDestination The destination the message was published to * @param qos the level of qos the message was published this could be either 0,1 or 2 * @param message the content of the message * @param retain should this message retain * @param messageID the unique identifier of the message */
Method written by WSO2. Since we would be sequentially writing the message to the subscribers
publishToSubscriber
{ "repo_name": "Asitha/andes", "path": "modules/andes-core/broker/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java", "license": "apache-2.0", "size": 44025 }
[ "java.nio.ByteBuffer", "org.dna.mqtt.moquette.messaging.spi.impl.events.PublishEvent", "org.dna.mqtt.moquette.messaging.spi.impl.subscriptions.Subscription", "org.dna.mqtt.moquette.proto.messages.AbstractMessage", "org.wso2.andes.mqtt.MQTTException" ]
import java.nio.ByteBuffer; import org.dna.mqtt.moquette.messaging.spi.impl.events.PublishEvent; import org.dna.mqtt.moquette.messaging.spi.impl.subscriptions.Subscription; import org.dna.mqtt.moquette.proto.messages.AbstractMessage; import org.wso2.andes.mqtt.MQTTException;
import java.nio.*; import org.dna.mqtt.moquette.messaging.spi.impl.events.*; import org.dna.mqtt.moquette.messaging.spi.impl.subscriptions.*; import org.dna.mqtt.moquette.proto.messages.*; import org.wso2.andes.mqtt.*;
[ "java.nio", "org.dna.mqtt", "org.wso2.andes" ]
java.nio; org.dna.mqtt; org.wso2.andes;
435,261
public boolean deleteDirectory () { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot delete a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot delete an internal file: " + file); return deleteDirectory(file()); }
boolean function () { if (type == FileType.Classpath) throw new GdxRuntimeException(STR + file); if (type == FileType.Internal) throw new GdxRuntimeException(STR + file); return deleteDirectory(file()); }
/** Deletes this file or directory and all children, recursively. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */
Deletes this file or directory and all children, recursively
deleteDirectory
{ "repo_name": "ryoenji/libgdx", "path": "gdx/src/com/badlogic/gdx/files/FileHandle.java", "license": "apache-2.0", "size": 28489 }
[ "com.badlogic.gdx.Files", "com.badlogic.gdx.utils.GdxRuntimeException" ]
import com.badlogic.gdx.Files; import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.*; import com.badlogic.gdx.utils.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
2,639,405
private DocSet getSubset(DocSet base, SchemaField field, String pivotValue) throws IOException { FieldType ft = field.getType(); if (null == pivotValue) { Query query = ft.getRangeQuery(null, field, null, null, false, false); DocSet hasVal = searcher.getDocSet(query); return base.andNot(hasVal); } else { Query query = ft.getFieldTermQuery(null, field, pivotValue); return searcher.getDocSet(query, base); } }
DocSet function(DocSet base, SchemaField field, String pivotValue) throws IOException { FieldType ft = field.getType(); if (null == pivotValue) { Query query = ft.getRangeQuery(null, field, null, null, false, false); DocSet hasVal = searcher.getDocSet(query); return base.andNot(hasVal); } else { Query query = ft.getFieldTermQuery(null, field, pivotValue); return searcher.getDocSet(query, base); } }
/** * Given a base docset, computes the subset of documents corresponding to the specified pivotValue * * @param base the set of documents to evaluate relative to * @param field the field type used by the pivotValue * @param pivotValue String representation of the value, may be null (ie: "missing") */
Given a base docset, computes the subset of documents corresponding to the specified pivotValue
getSubset
{ "repo_name": "apache/solr", "path": "solr/core/src/java/org/apache/solr/handler/component/PivotFacetProcessor.java", "license": "apache-2.0", "size": 19747 }
[ "java.io.IOException", "org.apache.lucene.search.Query", "org.apache.solr.schema.FieldType", "org.apache.solr.schema.SchemaField", "org.apache.solr.search.DocSet" ]
import java.io.IOException; import org.apache.lucene.search.Query; import org.apache.solr.schema.FieldType; import org.apache.solr.schema.SchemaField; import org.apache.solr.search.DocSet;
import java.io.*; import org.apache.lucene.search.*; import org.apache.solr.schema.*; import org.apache.solr.search.*;
[ "java.io", "org.apache.lucene", "org.apache.solr" ]
java.io; org.apache.lucene; org.apache.solr;
2,551,295
public void setupRunner() { if (options.isStreaming()) { if (options.getRunner() == DirectPipelineRunner.class) { throw new IllegalArgumentException( "Processing of unbounded input sources is not supported with the DirectPipelineRunner."); } // In order to cancel the pipelines automatically, // {@literal DataflowPipelineRunner} is forced to be used. options.setRunner(DataflowPipelineRunner.class); } }
void function() { if (options.isStreaming()) { if (options.getRunner() == DirectPipelineRunner.class) { throw new IllegalArgumentException( STR); } options.setRunner(DataflowPipelineRunner.class); } }
/** * Do some runner setup: check that the DirectPipelineRunner is not used in conjunction with * streaming, and if streaming is specified, use the DataflowPipelineRunner. Return the streaming * flag value. */
Do some runner setup: check that the DirectPipelineRunner is not used in conjunction with streaming, and if streaming is specified, use the DataflowPipelineRunner. Return the streaming flag value
setupRunner
{ "repo_name": "VikramTiwari/do-codelabs", "path": "cloud-dataflow-starter/first-dataflow/src/main/java/com/example/common/DataflowExampleUtils.java", "license": "mit", "size": 16416 }
[ "com.google.cloud.dataflow.sdk.runners.DataflowPipelineRunner", "com.google.cloud.dataflow.sdk.runners.DirectPipelineRunner" ]
import com.google.cloud.dataflow.sdk.runners.DataflowPipelineRunner; import com.google.cloud.dataflow.sdk.runners.DirectPipelineRunner;
import com.google.cloud.dataflow.sdk.runners.*;
[ "com.google.cloud" ]
com.google.cloud;
159,227
public VirtualNetworkGatewayConnectionInner updateTags(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).toBlocking().last().body(); }
VirtualNetworkGatewayConnectionInner function(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).toBlocking().last().body(); }
/** * Updates a virtual network gateway connection tags. * * @param resourceGroupName The name of the resource group. * @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. * @param tags Resource tags. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the VirtualNetworkGatewayConnectionInner object if successful. */
Updates a virtual network gateway connection tags
updateTags
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/VirtualNetworkGatewayConnectionsInner.java", "license": "mit", "size": 146321 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
30,427
public void onMessage(Message msg) { try { LOG.debug("Queuing msg [" + msg.getJMSMessageID() + "]"); } catch (JMSException e) { } this.queue.offer(msg); }
void function(Message msg) { try { LOG.debug(STR + msg.getJMSMessageID() + "]"); } catch (JMSException e) { } this.queue.offer(msg); }
/** * <code>javax.jms.MessageListener</code> implementation. * <p/> * Stored the JMS message in an internal queue for processing by the <code>nextTuple()</code> method. */
<code>javax.jms.MessageListener</code> implementation. Stored the JMS message in an internal queue for processing by the <code>nextTuple()</code> method
onMessage
{ "repo_name": "Bikeemotion/storm-jms", "path": "src/main/java/org/apache/storm/jms/spout/JmsSpout.java", "license": "apache-2.0", "size": 13559 }
[ "javax.jms.JMSException", "javax.jms.Message" ]
import javax.jms.JMSException; import javax.jms.Message;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
2,367,244
default void preDeleteTableAction( final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName) throws IOException {}
default void preDeleteTableAction( final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName) throws IOException {}
/** * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a * table. Called as part of delete table procedure and * it is async to the delete RPC call. * * @param ctx the environment to interact with the framework and master * @param tableName the name of the table */
Called before <code>org.apache.hadoop.hbase.master.HMaster</code> deletes a table. Called as part of delete table procedure and it is async to the delete RPC call
preDeleteTableAction
{ "repo_name": "apurtell/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java", "license": "apache-2.0", "size": 74501 }
[ "java.io.IOException", "org.apache.hadoop.hbase.TableName" ]
import java.io.IOException; import org.apache.hadoop.hbase.TableName;
import java.io.*; import org.apache.hadoop.hbase.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
923,018
private int getDepth(BinaryNode root) { if (root == null) { return 0; } else { return 1 + Math.max(getDepth(root.getLeft()), getDepth(root.getRight())); } }
int function(BinaryNode root) { if (root == null) { return 0; } else { return 1 + Math.max(getDepth(root.getLeft()), getDepth(root.getRight())); } }
/** * Calculate the Binary Tree depth based on recursion. The complexity order in space terms of * this algorithm is O(N) and in time terms is O(N) where N is the number of nodes in the tree. */
Calculate the Binary Tree depth based on recursion. The complexity order in space terms of this algorithm is O(N) and in time terms is O(N) where N is the number of nodes in the tree
getDepth
{ "repo_name": "pedrovgs/Algorithms", "path": "src/main/java/com/github/pedrovgs/problem13/BinaryTreeByLevel.java", "license": "apache-2.0", "size": 4130 }
[ "com.github.pedrovgs.binarytree.BinaryNode" ]
import com.github.pedrovgs.binarytree.BinaryNode;
import com.github.pedrovgs.binarytree.*;
[ "com.github.pedrovgs" ]
com.github.pedrovgs;
2,338,457
OperationMetadataInner innerModel();
OperationMetadataInner innerModel();
/** * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner object. * * @return the inner object. */
Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner object
innerModel
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadata.java", "license": "mit", "size": 936 }
[ "com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner" ]
import com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner;
import com.azure.resourcemanager.devtestlabs.fluent.models.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
2,616,559
public void testBug71672Statement(int testStep, Connection testConn, String query, int expectedUpdateCount, int[] expectedKeys) throws SQLException { Statement testStmt = testConn.createStatement(); if (expectedUpdateCount < 0) { assertFalse(testStep + ". Stmt.execute() result", testStmt.execute(query, Statement.RETURN_GENERATED_KEYS)); } else { assertEquals(testStep + ". Stmt.executeUpdate() result", expectedUpdateCount, testStmt.executeUpdate(query, Statement.RETURN_GENERATED_KEYS)); } ResultSet testRS = testStmt.getGeneratedKeys(); for (int k : expectedKeys) { assertTrue(testStep + ". Row expected in generated keys ResultSet", testRS.next()); assertEquals(testStep + ". Wrong generated key", k, testRS.getInt(1)); } assertFalse(testStep + ". No more rows expected in generated keys ResultSet", testRS.next()); testRS.close(); testStmt.close(); }
void function(int testStep, Connection testConn, String query, int expectedUpdateCount, int[] expectedKeys) throws SQLException { Statement testStmt = testConn.createStatement(); if (expectedUpdateCount < 0) { assertFalse(testStep + STR, testStmt.execute(query, Statement.RETURN_GENERATED_KEYS)); } else { assertEquals(testStep + STR, expectedUpdateCount, testStmt.executeUpdate(query, Statement.RETURN_GENERATED_KEYS)); } ResultSet testRS = testStmt.getGeneratedKeys(); for (int k : expectedKeys) { assertTrue(testStep + STR, testRS.next()); assertEquals(testStep + STR, k, testRS.getInt(1)); } assertFalse(testStep + STR, testRS.next()); testRS.close(); testStmt.close(); }
/** * Check the update count and returned keys for an INSERT query using a Statement object. If expectedUpdateCount < 0 then runs Statement.execute() otherwise * Statement.executeUpdate(). */
Check the update count and returned keys for an INSERT query using a Statement object. If expectedUpdateCount < 0 then runs Statement.execute() otherwise Statement.executeUpdate()
testBug71672Statement
{ "repo_name": "seanbright/mysql-connector-j", "path": "src/testsuite/regression/StatementRegressionTest.java", "license": "gpl-2.0", "size": 331459 }
[ "java.sql.Connection", "java.sql.ResultSet", "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,725,868
@Override public MeasureRawColumnChunk getMeasureChunk(FileHolder fileReader, int blockIndex) { // operation of getting the measure chunk is not supported as its a non // leaf node // and in case of B+Tree data will be stored only in leaf node and // intermediate // node will be used only for searching the leaf node throw new UnsupportedOperationException("Unsupported operation"); }
@Override MeasureRawColumnChunk function(FileHolder fileReader, int blockIndex) { throw new UnsupportedOperationException(STR); }
/** * Below method will be used to read the measure chunk * * @param fileReader file read to read the file chunk * @param blockIndex block index to be read from file * @return measure data chunk */
Below method will be used to read the measure chunk
getMeasureChunk
{ "repo_name": "mohammadshahidkhan/incubator-carbondata", "path": "core/src/main/java/org/apache/carbondata/core/datastore/impl/btree/BTreeNonLeafNode.java", "license": "apache-2.0", "size": 7851 }
[ "org.apache.carbondata.core.datastore.FileHolder", "org.apache.carbondata.core.datastore.chunk.impl.MeasureRawColumnChunk" ]
import org.apache.carbondata.core.datastore.FileHolder; import org.apache.carbondata.core.datastore.chunk.impl.MeasureRawColumnChunk;
import org.apache.carbondata.core.datastore.*; import org.apache.carbondata.core.datastore.chunk.impl.*;
[ "org.apache.carbondata" ]
org.apache.carbondata;
1,477,398
void handleEof() throws IOException;
void handleEof() throws IOException;
/** * Invoked when <code>SSH_MSG_CHANNEL_EOF</code> received * * @throws IOException If failed to handle the message */
Invoked when <code>SSH_MSG_CHANNEL_EOF</code> received
handleEof
{ "repo_name": "Niky4000/UsefulUtils", "path": "projects/ssh/apache_mina/apache-sshd-1.2.0/sshd-core/src/main/java/org/apache/sshd/common/channel/Channel.java", "license": "gpl-3.0", "size": 6899 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
190,420
public static int getServiceIdentifierFromParcelUuid(ParcelUuid parcelUuid) { UUID uuid = parcelUuid.getUuid(); long value = (uuid.getMostSignificantBits() & 0x0000FFFF00000000L) >>> 32; return (int)value; }
static int function(ParcelUuid parcelUuid) { UUID uuid = parcelUuid.getUuid(); long value = (uuid.getMostSignificantBits() & 0x0000FFFF00000000L) >>> 32; return (int)value; }
/** * Extract the Service Identifier or the actual uuid from the Parcel Uuid. * For example, if 0000110B-0000-1000-8000-00805F9B34FB is the parcel Uuid, * this function will return 110B * @param parcelUuid * @return the service identifier. */
Extract the Service Identifier or the actual uuid from the Parcel Uuid. For example, if 0000110B-0000-1000-8000-00805F9B34FB is the parcel Uuid, this function will return 110B
getServiceIdentifierFromParcelUuid
{ "repo_name": "shelmesky/nexfi_android_ble", "path": "underdark/src/main/java/impl/underdark/transport/bluetooth/discovery/ble/detector/BluetoothUuid.java", "license": "gpl-3.0", "size": 9873 }
[ "android.os.ParcelUuid" ]
import android.os.ParcelUuid;
import android.os.*;
[ "android.os" ]
android.os;
319,591
public AdminEmailAttributes getAdminEmail(String subject, Date createDate) { Assumption.assertNotNull(subject); Assumption.assertNotNull(createDate); return adminEmailsDb.getAdminEmail(subject, createDate); }
AdminEmailAttributes function(String subject, Date createDate) { Assumption.assertNotNull(subject); Assumption.assertNotNull(createDate); return adminEmailsDb.getAdminEmail(subject, createDate); }
/** * Gets an admin email by subject and createDate. * @return null if no matched email found */
Gets an admin email by subject and createDate
getAdminEmail
{ "repo_name": "shivanshsoni/teammates", "path": "src/main/java/teammates/logic/core/AdminEmailsLogic.java", "license": "gpl-2.0", "size": 4731 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
946,580
public FileSystemsListPathsHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { this.lastModified = new DateTimeRfc1123(lastModified); } return this; }
FileSystemsListPathsHeaders function(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { this.lastModified = new DateTimeRfc1123(lastModified); } return this; }
/** * Set the lastModified property: The Last-Modified property. * * @param lastModified the lastModified value to set. * @return the FileSystemsListPathsHeaders object itself. */
Set the lastModified property: The Last-Modified property
setLastModified
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/models/FileSystemsListPathsHeaders.java", "license": "mit", "size": 5111 }
[ "com.azure.core.util.DateTimeRfc1123", "java.time.OffsetDateTime" ]
import com.azure.core.util.DateTimeRfc1123; import java.time.OffsetDateTime;
import com.azure.core.util.*; import java.time.*;
[ "com.azure.core", "java.time" ]
com.azure.core; java.time;
1,594,653
public static org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network .rev20151208.ietfnetwork.networksstate.Network teSubsystem2YangNetworkState( org.onosproject.tetopology.management.api.Network teSubsystem, OperationType operation) { checkNotNull(teSubsystem, E_NULL_TE_NETWORK); checkNotNull(teSubsystem.networkId(), E_NULL_TE_NETWORKID); org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208 .ietfnetwork.networksstate.Network.NetworkBuilder stateBuilder = org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208 .ietfnetwork.networksstate.DefaultNetwork.builder(); if (teSubsystem.networkId() != null) { stateBuilder.networkRef(NetworkId.fromString(teSubsystem.networkId().toString())); } stateBuilder.serverProvided(teSubsystem.isServerProvided()); // Operation type may be required. return stateBuilder.build(); }
static org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network .rev20151208.ietfnetwork.networksstate.Network function( org.onosproject.tetopology.management.api.Network teSubsystem, OperationType operation) { checkNotNull(teSubsystem, E_NULL_TE_NETWORK); checkNotNull(teSubsystem.networkId(), E_NULL_TE_NETWORKID); org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208 .ietfnetwork.networksstate.Network.NetworkBuilder stateBuilder = org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208 .ietfnetwork.networksstate.DefaultNetwork.builder(); if (teSubsystem.networkId() != null) { stateBuilder.networkRef(NetworkId.fromString(teSubsystem.networkId().toString())); } stateBuilder.serverProvided(teSubsystem.isServerProvided()); return stateBuilder.build(); }
/** * Network State object conversion from TE Topology subsystem to YANG. * * @param teSubsystem TE Topology subsystem network object * @param operation operation type * @return Network YANG object */
Network State object conversion from TE Topology subsystem to YANG
teSubsystem2YangNetworkState
{ "repo_name": "donNewtonAlpha/onos", "path": "apps/tenbi/utils/src/main/java/org/onosproject/teyang/utils/topology/NetworkConverter.java", "license": "apache-2.0", "size": 32588 }
[ "com.google.common.base.Preconditions", "org.onosproject.teyang.api.OperationType", "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.NetworkId", "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.networks.Network" ]
import com.google.common.base.Preconditions; import org.onosproject.teyang.api.OperationType; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.NetworkId; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.networks.Network;
import com.google.common.base.*; import org.onosproject.teyang.api.*; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.*; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.networks.*;
[ "com.google.common", "org.onosproject.teyang", "org.onosproject.yang" ]
com.google.common; org.onosproject.teyang; org.onosproject.yang;
2,404,868
private SAbstractAnnotation getSAnnotation() { return sAbstractAnnotation; }
SAbstractAnnotation function() { return sAbstractAnnotation; }
/** * Returns the {@link SAnnotation} object to which the methods of this object will be delegated to. */
Returns the <code>SAnnotation</code> object to which the methods of this object will be delegated to
getSAnnotation
{ "repo_name": "korpling/pepperModules-RelANNISModules", "path": "src/main/java/de/hu_berlin/german/korpling/saltnpepper/misc/relANNIS/impl/RANodeAnnotationImpl.java", "license": "apache-2.0", "size": 11124 }
[ "de.hu_berlin.german.korpling.saltnpepper.salt.saltCore.SAbstractAnnotation" ]
import de.hu_berlin.german.korpling.saltnpepper.salt.saltCore.SAbstractAnnotation;
import de.hu_berlin.german.korpling.saltnpepper.salt.*;
[ "de.hu_berlin.german" ]
de.hu_berlin.german;
2,206,149
@Theory public final void hashCodeIsConsistentWithEquals(Object x, Object y) { Assume.assumeNotNull(x); Assume.assumeTrue(x.equals(y)); Assert.assertThat(x.hashCode(), CoreMatchers.is(CoreMatchers.equalTo(y.hashCode()))); }
final void function(Object x, Object y) { Assume.assumeNotNull(x); Assume.assumeTrue(x.equals(y)); Assert.assertThat(x.hashCode(), CoreMatchers.is(CoreMatchers.equalTo(y.hashCode()))); }
/** * Check {@link Object#hashCode()} is always consistent with equals condition: if two objects * are equal according to {@link Object#equals(Object)} method, then calling * {@link Object#hashCode()} method on each of the two objects must produce the same integer * result. User must provide data points that are similar but not the same. * * @param x primary object instance. * @param y secondary object instance. */
Check <code>Object#hashCode()</code> is always consistent with equals condition: if two objects are equal according to <code>Object#equals(Object)</code> method, then calling <code>Object#hashCode()</code> method on each of the two objects must produce the same integer result. User must provide data points that are similar but not the same
hashCodeIsConsistentWithEquals
{ "repo_name": "gwynlavin/jactors-junit", "path": "src/main/java/org/jactors/junit/theory/ObjectTheory.java", "license": "mit", "size": 11071 }
[ "org.hamcrest.CoreMatchers", "org.junit.Assert", "org.junit.Assume" ]
import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Assume;
import org.hamcrest.*; import org.junit.*;
[ "org.hamcrest", "org.junit" ]
org.hamcrest; org.junit;
1,399,615
public JobSubmissionResult runDetached(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException { waitForClusterToBeReady(); final ActorGateway jobManagerGateway; try { jobManagerGateway = getJobManagerGateway(); } catch (Exception e) { throw new ProgramInvocationException("Failed to retrieve the JobManager gateway.", jobGraph.getJobID(), e); } try { logAndSysout("Submitting Job with JobID: " + jobGraph.getJobID() + ". Returning after job submission."); JobClient.submitJobDetached( new AkkaJobManagerGateway(jobManagerGateway), flinkConfig, jobGraph, Time.milliseconds(timeout.toMillis()), classLoader); return new JobSubmissionResult(jobGraph.getJobID()); } catch (JobExecutionException e) { throw new ProgramInvocationException("The program execution failed: " + e.getMessage(), jobGraph.getJobID(), e); } }
JobSubmissionResult function(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException { waitForClusterToBeReady(); final ActorGateway jobManagerGateway; try { jobManagerGateway = getJobManagerGateway(); } catch (Exception e) { throw new ProgramInvocationException(STR, jobGraph.getJobID(), e); } try { logAndSysout(STR + jobGraph.getJobID() + STR); JobClient.submitJobDetached( new AkkaJobManagerGateway(jobManagerGateway), flinkConfig, jobGraph, Time.milliseconds(timeout.toMillis()), classLoader); return new JobSubmissionResult(jobGraph.getJobID()); } catch (JobExecutionException e) { throw new ProgramInvocationException(STR + e.getMessage(), jobGraph.getJobID(), e); } }
/** * Submits a JobGraph detached. * @param jobGraph The JobGraph * @param classLoader User code class loader to deserialize the results and errors (may contain custom classes). * @return JobSubmissionResult * @throws ProgramInvocationException */
Submits a JobGraph detached
runDetached
{ "repo_name": "zhangminglei/flink", "path": "flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java", "license": "apache-2.0", "size": 41128 }
[ "org.apache.flink.api.common.JobSubmissionResult", "org.apache.flink.api.common.time.Time", "org.apache.flink.runtime.akka.AkkaJobManagerGateway", "org.apache.flink.runtime.client.JobClient", "org.apache.flink.runtime.client.JobExecutionException", "org.apache.flink.runtime.instance.ActorGateway", "org.apache.flink.runtime.jobgraph.JobGraph" ]
import org.apache.flink.api.common.JobSubmissionResult; import org.apache.flink.api.common.time.Time; import org.apache.flink.runtime.akka.AkkaJobManagerGateway; import org.apache.flink.runtime.client.JobClient; import org.apache.flink.runtime.client.JobExecutionException; import org.apache.flink.runtime.instance.ActorGateway; import org.apache.flink.runtime.jobgraph.JobGraph;
import org.apache.flink.api.common.*; import org.apache.flink.api.common.time.*; import org.apache.flink.runtime.akka.*; import org.apache.flink.runtime.client.*; import org.apache.flink.runtime.instance.*; import org.apache.flink.runtime.jobgraph.*;
[ "org.apache.flink" ]
org.apache.flink;
626,964
public static void dispatchCallToHost(@NonNull String callName, @NonNull RemoteCall<?> remoteCall) { try { dispatchCallToHostForResult(callName, remoteCall); } catch (RemoteException e) { // The host is dead, don't crash the app, just log. Log.e(LogTags.TAG_DISPATCH, "Host unresponsive when dispatching call " + callName, e); } } /** * Returns an {@link ISurfaceCallback} stub that invokes the input {@link SurfaceCallback} * if it is not {@code null}, or {@code null} if the input {@link SurfaceCallback} is {@code * null} * * @param lifecycle the lifecycle of the session to be used to not dispatch calls out of * lifecycle. * @param surfaceCallback the callback to wrap in an {@link ISurfaceCallback}
static void function(@NonNull String callName, @NonNull RemoteCall<?> remoteCall) { try { dispatchCallToHostForResult(callName, remoteCall); } catch (RemoteException e) { Log.e(LogTags.TAG_DISPATCH, STR + callName, e); } } /** * Returns an {@link ISurfaceCallback} stub that invokes the input {@link SurfaceCallback} * if it is not {@code null}, or {@code null} if the input {@link SurfaceCallback} is { * null} * * @param lifecycle the lifecycle of the session to be used to not dispatch calls out of * lifecycle. * @param surfaceCallback the callback to wrap in an {@link ISurfaceCallback}
/** * Performs the remote call to the host and handles exceptions thrown by the host. * * @throws SecurityException as a pass through from the host * @throws HostException if the remote call fails with any other exception */
Performs the remote call to the host and handles exceptions thrown by the host
dispatchCallToHost
{ "repo_name": "AndroidX/androidx", "path": "car/app/app/src/main/java/androidx/car/app/utils/RemoteUtils.java", "license": "apache-2.0", "size": 14298 }
[ "android.os.RemoteException", "android.util.Log", "androidx.annotation.NonNull", "androidx.car.app.ISurfaceCallback", "androidx.car.app.SurfaceCallback" ]
import android.os.RemoteException; import android.util.Log; import androidx.annotation.NonNull; import androidx.car.app.ISurfaceCallback; import androidx.car.app.SurfaceCallback;
import android.os.*; import android.util.*; import androidx.annotation.*; import androidx.car.app.*;
[ "android.os", "android.util", "androidx.annotation", "androidx.car" ]
android.os; android.util; androidx.annotation; androidx.car;
743,934
public synchronized Credentials remove(Object o) { Credentials credentials = cache.asMap().remove(o); try { if (credentials == null) { credentials = get(o); } String normalizedKey = normalizeKey(o); deleteSafe(curator, ZkPath.CLOUD_NODE_IDENTITY.getPath(normalizedKey)); deleteSafe(curator, ZkPath.CLOUD_NODE_CREDENTIAL.getPath(normalizedKey)); } catch (Exception e) { LOGGER.warn("Failed to remove jclouds credentials to zookeeper.", e); } return credentials; }
synchronized Credentials function(Object o) { Credentials credentials = cache.asMap().remove(o); try { if (credentials == null) { credentials = get(o); } String normalizedKey = normalizeKey(o); deleteSafe(curator, ZkPath.CLOUD_NODE_IDENTITY.getPath(normalizedKey)); deleteSafe(curator, ZkPath.CLOUD_NODE_CREDENTIAL.getPath(normalizedKey)); } catch (Exception e) { LOGGER.warn(STR, e); } return credentials; }
/** * Removes {@link Credentials} for {@link Cache} and Zookeeper. */
Removes <code>Credentials</code> for <code>Cache</code> and Zookeeper
remove
{ "repo_name": "janstey/fuse", "path": "fabric/fabric-core-agent-jclouds/src/main/java/org/fusesource/fabric/service/jclouds/modules/ZookeeperCredentialStore.java", "license": "apache-2.0", "size": 13930 }
[ "org.fusesource.fabric.zookeeper.ZkPath", "org.fusesource.fabric.zookeeper.utils.ZooKeeperUtils", "org.jclouds.domain.Credentials" ]
import org.fusesource.fabric.zookeeper.ZkPath; import org.fusesource.fabric.zookeeper.utils.ZooKeeperUtils; import org.jclouds.domain.Credentials;
import org.fusesource.fabric.zookeeper.*; import org.fusesource.fabric.zookeeper.utils.*; import org.jclouds.domain.*;
[ "org.fusesource.fabric", "org.jclouds.domain" ]
org.fusesource.fabric; org.jclouds.domain;
510,373
return LanguageUtility.transelate("color." + name); }
return LanguageUtility.transelate(STR + name); }
/** * Gets the localized name of this color by translating the unlocalized name. * @return localized name */
Gets the localized name of this color by translating the unlocalized name
getLocalizedName
{ "repo_name": "halvors/Nuclear-Physics", "path": "src/main/java/org/halvors/nuclearphysics/common/type/EnumColor.java", "license": "gpl-3.0", "size": 3029 }
[ "org.halvors.nuclearphysics.common.utility.LanguageUtility" ]
import org.halvors.nuclearphysics.common.utility.LanguageUtility;
import org.halvors.nuclearphysics.common.utility.*;
[ "org.halvors.nuclearphysics" ]
org.halvors.nuclearphysics;
2,778,289
public boolean canRoute(Document document, Person user);
boolean function(Document document, Person user);
/** * Determines if the user has permission to route the document * * @param document document to check * @param user current user * @return boolean, true if the user has permissions to route a document else false */
Determines if the user has permission to route the document
canRoute
{ "repo_name": "ewestfal/rice", "path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/document/DocumentAuthorizer.java", "license": "apache-2.0", "size": 6468 }
[ "org.kuali.rice.kim.api.identity.Person" ]
import org.kuali.rice.kim.api.identity.Person;
import org.kuali.rice.kim.api.identity.*;
[ "org.kuali.rice" ]
org.kuali.rice;
543,608
public static void showErrorDialog(Context context, int title, int message) { new AlertDialog.Builder(context) .setTitle(title) .setIcon(android.R.drawable.ic_dialog_alert) .setMessage(message) .setPositiveButton(R.string.Commons_Ok, null) .show(); }
static void function(Context context, int title, int message) { new AlertDialog.Builder(context) .setTitle(title) .setIcon(android.R.drawable.ic_dialog_alert) .setMessage(message) .setPositiveButton(R.string.Commons_Ok, null) .show(); }
/** * Show an error dialog. * @param context The current context. * @param title The title string id. * @param message The message string id. */
Show an error dialog
showErrorDialog
{ "repo_name": "vanan08/android-browser-cmcsoft", "path": "src/org/cmc/utils/ApplicationUtils.java", "license": "gpl-3.0", "size": 18427 }
[ "android.app.AlertDialog", "android.content.Context" ]
import android.app.AlertDialog; import android.content.Context;
import android.app.*; import android.content.*;
[ "android.app", "android.content" ]
android.app; android.content;
1,609,884
public List<BatchHeader> getHeaders() { return unmodifiableList(headers); }
List<BatchHeader> function() { return unmodifiableList(headers); }
/** * The HTTP response headers. * * @return The HTTP response headers. */
The HTTP response headers
getHeaders
{ "repo_name": "jried31/SSWS", "path": "classes/com/restfb/batch/BatchResponse.java", "license": "gpl-2.0", "size": 3330 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
833,367
public static boolean isFloatingPointClass(Class nClazz) { if (!isNumericClass(nClazz)) throw new IllegalArgumentException("NaN Class: " + nClazz); if (nClazz.isPrimitive()) nClazz = ClassUtils.primitiveToWrapper(nClazz); return ArrayUtils.contains(floatingPointClasses, nClazz); }
static boolean function(Class nClazz) { if (!isNumericClass(nClazz)) throw new IllegalArgumentException(STR + nClazz); if (nClazz.isPrimitive()) nClazz = ClassUtils.primitiveToWrapper(nClazz); return ArrayUtils.contains(floatingPointClasses, nClazz); }
/** * convenience method is Object from FloatingPoint-Class */
convenience method is Object from FloatingPoint-Class
isFloatingPointClass
{ "repo_name": "kgidev/maserJ", "path": "src/tools/MyMath.java", "license": "apache-2.0", "size": 16920 }
[ "org.apache.commons.lang.ArrayUtils", "org.apache.commons.lang.ClassUtils" ]
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ClassUtils;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
1,948,009
public void execute() throws MojoExecutionException, MojoFailureException { if(preverifyPath == null) { getLog().debug("skip native preverification"); return; } getLog().debug("start native preverification"); final File preverifyCmd= getAbsolutePreverifyCommand(); StreamConsumer stdoutLogger= new LogWriter(false); StreamConsumer stderrLogger= new LogWriter(true); String classPath = getClassPath(getProject()); AbstractConfiguration[] configurations= (AbstractConfiguration[]) getPluginContext().get(ConfiguratorMojo.GENERATED_CONFIGURATIONS_KEY); for(AbstractConfiguration configuration : configurations) { if(!(configuration instanceof NodeConfiguration)) { continue; } String classifier= configuration.className.substring(configuration.className.lastIndexOf('.') + 1); File oldJar= checkJarFile(classifier); if(keepJars) { try { FileUtils.copyFile(oldJar, getJarFile(classifier + "-before_preverify")); } catch (IOException ioe) { getLog().warn("could not keep old jar '" + oldJar.getAbsolutePath() + "'", ioe); } } getLog().info("Preverifying jar: " + FileNameUtil.getAbsolutPath(oldJar)); Commandline commandLine= new Commandline(preverifyCmd.getPath() + " -classpath " + classPath + " -d " + FileNameUtil.getAbsolutPath(oldJar.getParentFile()) + " " + FileNameUtil.getAbsolutPath(oldJar)); getLog().debug(commandLine.toString()); try { if(CommandLineUtils.executeCommandLine(commandLine, stdoutLogger, stderrLogger) != 0) { throw new MojoExecutionException("Preverification failed. Please read the log for details."); } } catch (CommandLineException cle) { throw new MojoExecutionException("could not execute preverify command", cle); } } getLog().debug("finished preverification"); }
void function() throws MojoExecutionException, MojoFailureException { if(preverifyPath == null) { getLog().debug(STR); return; } getLog().debug(STR); final File preverifyCmd= getAbsolutePreverifyCommand(); StreamConsumer stdoutLogger= new LogWriter(false); StreamConsumer stderrLogger= new LogWriter(true); String classPath = getClassPath(getProject()); AbstractConfiguration[] configurations= (AbstractConfiguration[]) getPluginContext().get(ConfiguratorMojo.GENERATED_CONFIGURATIONS_KEY); for(AbstractConfiguration configuration : configurations) { if(!(configuration instanceof NodeConfiguration)) { continue; } String classifier= configuration.className.substring(configuration.className.lastIndexOf('.') + 1); File oldJar= checkJarFile(classifier); if(keepJars) { try { FileUtils.copyFile(oldJar, getJarFile(classifier + STR)); } catch (IOException ioe) { getLog().warn(STR + oldJar.getAbsolutePath() + "'", ioe); } } getLog().info(STR + FileNameUtil.getAbsolutPath(oldJar)); Commandline commandLine= new Commandline(preverifyCmd.getPath() + STR + classPath + STR + FileNameUtil.getAbsolutPath(oldJar.getParentFile()) + " " + FileNameUtil.getAbsolutPath(oldJar)); getLog().debug(commandLine.toString()); try { if(CommandLineUtils.executeCommandLine(commandLine, stdoutLogger, stderrLogger) != 0) { throw new MojoExecutionException(STR); } } catch (CommandLineException cle) { throw new MojoExecutionException(STR, cle); } } getLog().debug(STR); }
/** * The main method of this MoJo */
The main method of this MoJo
execute
{ "repo_name": "mcpat/microjiac-public", "path": "tools/microjiac-midlet-maven-plugin/src/main/java/de/jiac/micro/mojo/PreverifyMojo.java", "license": "gpl-3.0", "size": 6076 }
[ "de.jiac.micro.config.generator.AbstractConfiguration", "de.jiac.micro.config.generator.NodeConfiguration", "de.jiac.micro.util.FileNameUtil", "java.io.File", "java.io.IOException", "org.apache.maven.plugin.MojoExecutionException", "org.apache.maven.plugin.MojoFailureException", "org.codehaus.plexus.util.FileUtils", "org.codehaus.plexus.util.cli.CommandLineException", "org.codehaus.plexus.util.cli.CommandLineUtils", "org.codehaus.plexus.util.cli.Commandline", "org.codehaus.plexus.util.cli.StreamConsumer" ]
import de.jiac.micro.config.generator.AbstractConfiguration; import de.jiac.micro.config.generator.NodeConfiguration; import de.jiac.micro.util.FileNameUtil; import java.io.File; import java.io.IOException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.cli.CommandLineException; import org.codehaus.plexus.util.cli.CommandLineUtils; import org.codehaus.plexus.util.cli.Commandline; import org.codehaus.plexus.util.cli.StreamConsumer;
import de.jiac.micro.config.generator.*; import de.jiac.micro.util.*; import java.io.*; import org.apache.maven.plugin.*; import org.codehaus.plexus.util.*; import org.codehaus.plexus.util.cli.*;
[ "de.jiac.micro", "java.io", "org.apache.maven", "org.codehaus.plexus" ]
de.jiac.micro; java.io; org.apache.maven; org.codehaus.plexus;
357,667
public ImageRecord getImageRecord(Referent rft) throws ResolverException { String id = ((URI) rft.getDescriptors()[0]).toASCIIString(); return getImageRecord(id); }
ImageRecord function(Referent rft) throws ResolverException { String id = ((URI) rft.getDescriptors()[0]).toASCIIString(); return getImageRecord(id); }
/** * Referent Identifier to be resolved from Identifier Resolver. The returned * ImageRecord need only contain the imageId and image file path. * @param rft identifier of the image to be resolved * @return ImageRecord instance containing resolvable metadata * @throws ResolverException */
Referent Identifier to be resolved from Identifier Resolver. The returned ImageRecord need only contain the imageId and image file path
getImageRecord
{ "repo_name": "cbeer/adore-djatoka-mirror", "path": "src/gov/lanl/adore/djatoka/openurl/SimpleListResolver.java", "license": "lgpl-2.1", "size": 7475 }
[ "gov.lanl.adore.djatoka.util.ImageRecord", "info.openurl.oom.entities.Referent" ]
import gov.lanl.adore.djatoka.util.ImageRecord; import info.openurl.oom.entities.Referent;
import gov.lanl.adore.djatoka.util.*; import info.openurl.oom.entities.*;
[ "gov.lanl.adore", "info.openurl.oom" ]
gov.lanl.adore; info.openurl.oom;
1,458,304
ServiceFuture<Void> putOptionalQueryAsync(String queryParameter, final ServiceCallback<Void> serviceCallback);
ServiceFuture<Void> putOptionalQueryAsync(String queryParameter, final ServiceCallback<Void> serviceCallback);
/** * Test implicitly optional query parameter. * * @param queryParameter the String value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceFuture} object */
Test implicitly optional query parameter
putOptionalQueryAsync
{ "repo_name": "anudeepsharma/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/requiredoptional/Implicits.java", "license": "mit", "size": 10069 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,413,746
public String[] getImplicitImportsForMXML(MXMLDialect dialect) { String[] additionalImports = getMXMLVersionDependentImports(dialect).toArray(new String[0]); String[] imports = new String[implicitImportsForMXML.length + additionalImports.length]; // append MXML version dependent imports to the standard imports. System.arraycopy(implicitImportsForMXML, 0, imports, 0, implicitImportsForMXML.length); System.arraycopy(additionalImports, 0, imports, implicitImportsForMXML.length, additionalImports.length); return imports; }
String[] function(MXMLDialect dialect) { String[] additionalImports = getMXMLVersionDependentImports(dialect).toArray(new String[0]); String[] imports = new String[implicitImportsForMXML.length + additionalImports.length]; System.arraycopy(implicitImportsForMXML, 0, imports, 0, implicitImportsForMXML.length); System.arraycopy(additionalImports, 0, imports, implicitImportsForMXML.length, additionalImports.length); return imports; }
/** * Gets the imports that are automatically imported into every MXML file. * * @param dialect - the dialect of the MXML language being compiled. * @return An array of Strings such as <code>flash.display.*"</code>. */
Gets the imports that are automatically imported into every MXML file
getImplicitImportsForMXML
{ "repo_name": "greg-dove/flex-falcon", "path": "compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java", "license": "apache-2.0", "size": 73716 }
[ "org.apache.flex.compiler.internal.mxml.MXMLDialect" ]
import org.apache.flex.compiler.internal.mxml.MXMLDialect;
import org.apache.flex.compiler.internal.mxml.*;
[ "org.apache.flex" ]
org.apache.flex;
994,366
private static final byte[] asPNG(final BufferedImage bufferedImage) throws ConversionException { try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { if (!ImageIO.write(requireNonNull(bufferedImage), "png", outputStream)) throw new ConversionException(); return outputStream.toByteArray(); } catch (final IOException e) { throw new ConversionException(e); } } @SuppressWarnings("serial") static final class ConversionException extends Exception { public ConversionException() { // Intentionally left blank. } public ConversionException(final Throwable cause) { super(cause); } }
static final byte[] function(final BufferedImage bufferedImage) throws ConversionException { try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { if (!ImageIO.write(requireNonNull(bufferedImage), "png", outputStream)) throw new ConversionException(); return outputStream.toByteArray(); } catch (final IOException e) { throw new ConversionException(e); } } @SuppressWarnings(STR) static final class ConversionException extends Exception { public ConversionException() { } public ConversionException(final Throwable cause) { super(cause); } }
/** * Converts {@code image} into {@code byte[]}. * * @param bufferedImage The image to convert. Must not be {@code null}. * @return PNG bitmap created from {@code image}. Never {@code null}. * @throws ConversionException if conversion failed */
Converts image into byte[]
asPNG
{ "repo_name": "jeozey/XmppServerTester", "path": "xmpp-extensions-client/src/main/java/rocks/xmpp/extensions/avatar/AvatarManager.java", "license": "mit", "size": 30575 }
[ "java.awt.image.BufferedImage", "java.io.ByteArrayOutputStream", "java.io.IOException", "javax.imageio.ImageIO" ]
import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.imageio.ImageIO;
import java.awt.image.*; import java.io.*; import javax.imageio.*;
[ "java.awt", "java.io", "javax.imageio" ]
java.awt; java.io; javax.imageio;
2,244,598
public static void convertToSchemaAndMerge(RawRowSet in, List<ColumnModel> columns, RowSet out) { Map<String, Integer> columnIndexMap = createColumnIdToIndexMap(in); // Now convert each row into the requested format. // Process each row for (Row row : in.getRows()) { // First convert the values to if (row.getValues() == null) { continue; } Row newRow = convertToSchemaAndMerge(row, columnIndexMap, columns); // add the new row to the out set out.getRows().add(newRow); } }
static void function(RawRowSet in, List<ColumnModel> columns, RowSet out) { Map<String, Integer> columnIndexMap = createColumnIdToIndexMap(in); for (Row row : in.getRows()) { if (row.getValues() == null) { continue; } Row newRow = convertToSchemaAndMerge(row, columnIndexMap, columns); out.getRows().add(newRow); } }
/** * Convert the passed RowSet into the passed schema and append the rows to the passed output set. * * @param sets * @param restultForm * @param sets */
Convert the passed RowSet into the passed schema and append the rows to the passed output set
convertToSchemaAndMerge
{ "repo_name": "hhu94/Synapse-Repository-Services", "path": "lib/lib-table-cluster/src/main/java/org/sagebionetworks/table/cluster/utils/TableModelUtils.java", "license": "apache-2.0", "size": 50396 }
[ "java.util.List", "java.util.Map", "org.sagebionetworks.repo.model.table.ColumnModel", "org.sagebionetworks.repo.model.table.RawRowSet", "org.sagebionetworks.repo.model.table.Row", "org.sagebionetworks.repo.model.table.RowSet" ]
import java.util.List; import java.util.Map; import org.sagebionetworks.repo.model.table.ColumnModel; import org.sagebionetworks.repo.model.table.RawRowSet; import org.sagebionetworks.repo.model.table.Row; import org.sagebionetworks.repo.model.table.RowSet;
import java.util.*; import org.sagebionetworks.repo.model.table.*;
[ "java.util", "org.sagebionetworks.repo" ]
java.util; org.sagebionetworks.repo;
674,049
@SuppressWarnings("unchecked") private void resolveClasses() { for (String s : filesToResolve) { SchemaTupleFactory.LOG.info("Attempting to resolve class: " + s); // Step one is to simply attempt to get the class object from the classloader // that includes the generated code. Class<?> clazz; try { clazz = classLoader.loadClass(s); } catch (ClassNotFoundException e) { throw new RuntimeException("Unable to find class: " + s, e); } // Step three is to check if the class is a SchemaTuple. If it isn't, // we do not attempt to resolve it, because it is support code, such // as anonymous classes. if (!SchemaTuple.class.isAssignableFrom(clazz)) { return; } Class<SchemaTuple<?>> stClass = (Class<SchemaTuple<?>>)clazz; // Step four is to actually try to create the SchemaTuple instance. SchemaTuple<?> st; try { st = stClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException("Error instantiating file: " + s, e); } catch (IllegalAccessException e) { throw new RuntimeException("Error accessing file: " + s, e); } // Step five is to get information about the class. boolean isAppendable = st instanceof AppendableSchemaTuple<?>; int id = st.getSchemaTupleIdentifier(); Schema schema = st.getSchema(); SchemaTupleFactory stf = new SchemaTupleFactory(stClass, st.getQuickGenerator()); for (GenContext context : GenContext.values()) { if (context != GenContext.FORCE_LOAD && !context.shouldGenerate(stClass)) { SchemaTupleFactory.LOG.debug("Context ["+context+"] not present for class, skipping."); continue; } // the SchemaKey (Schema sans alias) and appendability are how we will // uniquely identify a SchemaTupleFactory Triple<SchemaKey, Boolean, GenContext> trip = Triple.make(new SchemaKey(schema), isAppendable, context); schemaTupleFactoriesByTriple.put(trip, stf); SchemaTupleFactory.LOG.info("Successfully resolved class for schema ["+schema+"] and appendability ["+isAppendable+"]" + " in context: " + context); } schemaTupleFactoriesById.put(id, stf); } }
@SuppressWarnings(STR) void function() { for (String s : filesToResolve) { SchemaTupleFactory.LOG.info(STR + s); Class<?> clazz; try { clazz = classLoader.loadClass(s); } catch (ClassNotFoundException e) { throw new RuntimeException(STR + s, e); } if (!SchemaTuple.class.isAssignableFrom(clazz)) { return; } Class<SchemaTuple<?>> stClass = (Class<SchemaTuple<?>>)clazz; SchemaTuple<?> st; try { st = stClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(STR + s, e); } catch (IllegalAccessException e) { throw new RuntimeException(STR + s, e); } boolean isAppendable = st instanceof AppendableSchemaTuple<?>; int id = st.getSchemaTupleIdentifier(); Schema schema = st.getSchema(); SchemaTupleFactory stf = new SchemaTupleFactory(stClass, st.getQuickGenerator()); for (GenContext context : GenContext.values()) { if (context != GenContext.FORCE_LOAD && !context.shouldGenerate(stClass)) { SchemaTupleFactory.LOG.debug(STR+context+STR); continue; } Triple<SchemaKey, Boolean, GenContext> trip = Triple.make(new SchemaKey(schema), isAppendable, context); schemaTupleFactoriesByTriple.put(trip, stf); SchemaTupleFactory.LOG.info(STR+schema+STR+isAppendable+"]" + STR + context); } schemaTupleFactoriesById.put(id, stf); } }
/** * Once all of the files are copied from the distributed cache to the local * temp directory, this will attempt to resolve those files and add their information. */
Once all of the files are copied from the distributed cache to the local temp directory, this will attempt to resolve those files and add their information
resolveClasses
{ "repo_name": "siddaartha/spork", "path": "src/org/apache/pig/data/SchemaTupleBackend.java", "license": "apache-2.0", "size": 13449 }
[ "org.apache.pig.data.SchemaTupleClassGenerator", "org.apache.pig.data.utils.StructuresHelper", "org.apache.pig.impl.logicalLayer.schema.Schema" ]
import org.apache.pig.data.SchemaTupleClassGenerator; import org.apache.pig.data.utils.StructuresHelper; import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.data.*; import org.apache.pig.data.utils.*; import org.apache.pig.impl.*;
[ "org.apache.pig" ]
org.apache.pig;
2,055,425
public InputStream findResourceStream(String name) { //Search This Classloader _LOG_.log(Level.INFO, "Searching Local For Resource: " + name); InputStream IStream = fireGetResourceAsStream(name); if(IStream == null) { _LOG_.log(Level.INFO, "Resource: " + name + " Not Found In Local"); return null; } else { _LOG_.log(Level.INFO, "Local Found Resource: " + name); return IStream; } }
InputStream function(String name) { _LOG_.log(Level.INFO, STR + name); InputStream IStream = fireGetResourceAsStream(name); if(IStream == null) { _LOG_.log(Level.INFO, STR + name + STR); return null; } else { _LOG_.log(Level.INFO, STR + name); return IStream; } }
/** * Does Not Search Parent/System ClassLoader or System ClassLoader Use * Method getResourceAsStream(String) * * @param name * @return */
Does Not Search Parent/System ClassLoader or System ClassLoader Use Method getResourceAsStream(String)
findResourceStream
{ "repo_name": "J-P-77/utilities", "path": "src/jp77/beta/utillib/classloader/v2/MyClassloader.java", "license": "mit", "size": 21471 }
[ "java.io.InputStream", "java.util.logging.Level" ]
import java.io.InputStream; import java.util.logging.Level;
import java.io.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,120,852
@Test public void getClientRotatedSecret() throws Exception { configureDefaultProfileAndPolicy(); String cidConfidential = createClientByAdmin(DEFAULT_CLIENT_ID); ClientResource clientResource = adminClient.realm(REALM_NAME).clients() .get(cidConfidential); String firstSecret = clientResource.getSecret().getValue(); try { clientResource.getClientRotatedSecret(); } catch (Exception e) { assertThat(e, is(instanceOf(NotFoundException.class))); } String newSecret = clientResource.generateNewSecret().getValue(); String rotatedSecret = clientResource.getClientRotatedSecret().getValue(); assertThat(firstSecret, not(equalTo(newSecret))); assertThat(firstSecret, equalTo(rotatedSecret)); }
void function() throws Exception { configureDefaultProfileAndPolicy(); String cidConfidential = createClientByAdmin(DEFAULT_CLIENT_ID); ClientResource clientResource = adminClient.realm(REALM_NAME).clients() .get(cidConfidential); String firstSecret = clientResource.getSecret().getValue(); try { clientResource.getClientRotatedSecret(); } catch (Exception e) { assertThat(e, is(instanceOf(NotFoundException.class))); } String newSecret = clientResource.generateNewSecret().getValue(); String rotatedSecret = clientResource.getClientRotatedSecret().getValue(); assertThat(firstSecret, not(equalTo(newSecret))); assertThat(firstSecret, equalTo(rotatedSecret)); }
/** * After rotate the secret the endpoint must return the rotated secret * * @throws Exception */
After rotate the secret the endpoint must return the rotated secret
getClientRotatedSecret
{ "repo_name": "keycloak/keycloak", "path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientSecretRotationTest.java", "license": "apache-2.0", "size": 36956 }
[ "javax.ws.rs.NotFoundException", "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.keycloak.admin.client.resource.ClientResource" ]
import javax.ws.rs.NotFoundException; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.keycloak.admin.client.resource.ClientResource;
import javax.ws.rs.*; import org.hamcrest.*; import org.keycloak.admin.client.resource.*;
[ "javax.ws", "org.hamcrest", "org.keycloak.admin" ]
javax.ws; org.hamcrest; org.keycloak.admin;
1,135,057
PatientProfileDto savePatient(PatientProfileDto patientProfileDto);
PatientProfileDto savePatient(PatientProfileDto patientProfileDto);
/** * Save patient. * * @param patientProfileDto the patient profile dto * @return the patient profile dto */
Save patient
savePatient
{ "repo_name": "tlin-fei/ds4p", "path": "DS4P/consent2share/core/src/main/java/gov/samhsa/consent2share/service/patient/PatientService.java", "license": "bsd-3-clause", "size": 5141 }
[ "gov.samhsa.consent2share.service.dto.PatientProfileDto" ]
import gov.samhsa.consent2share.service.dto.PatientProfileDto;
import gov.samhsa.consent2share.service.dto.*;
[ "gov.samhsa.consent2share" ]
gov.samhsa.consent2share;
352,000
public static Observable<SshKey> byId(Project _project, String _id) { return new RequestBuilder("/cloud/project/" + _project.getId() + "/sshkey/" + _id, Method.GET, _project.getCredentials()) .build() .flatMap((SafeResponse arg0) -> arg0.validateResponse(JSONObject.class)) .map((JSONObject key) -> { return new SshKey(_project, key.getString("id"), Region.byName(_project, key.getJSONArray("regions").getString(0)), key.getString("name"), key.getString("publicKey"), key.getString("fingerPrint")); }); }
static Observable<SshKey> function(Project _project, String _id) { return new RequestBuilder(STR + _project.getId() + STR + _id, Method.GET, _project.getCredentials()) .build() .flatMap((SafeResponse arg0) -> arg0.validateResponse(JSONObject.class)) .map((JSONObject key) -> { return new SshKey(_project, key.getString("id"), Region.byName(_project, key.getJSONArray(STR).getString(0)), key.getString("name"), key.getString(STR), key.getString(STR)); }); }
/** * Loads a SSH key by its id * * @param _project the project to load the key from * @param _id the key id * * @return an observable SshKey object */
Loads a SSH key by its id
byId
{ "repo_name": "cambierr/OvhApi", "path": "src/main/java/com/github/cambierr/ovhapi/cloud/SshKey.java", "license": "mit", "size": 8234 }
[ "com.github.cambierr.ovhapi.common.Method", "com.github.cambierr.ovhapi.common.RequestBuilder", "com.github.cambierr.ovhapi.common.SafeResponse", "org.json.JSONObject" ]
import com.github.cambierr.ovhapi.common.Method; import com.github.cambierr.ovhapi.common.RequestBuilder; import com.github.cambierr.ovhapi.common.SafeResponse; import org.json.JSONObject;
import com.github.cambierr.ovhapi.common.*; import org.json.*;
[ "com.github.cambierr", "org.json" ]
com.github.cambierr; org.json;
59,596
public List<RuleConditionElement> getNestedElements() { return Collections.emptyList(); }
List<RuleConditionElement> function() { return Collections.emptyList(); }
/** * It is not possible to nest elements inside an entry point, so * always return an empty list. * * @see org.drools.rule.RuleConditionElement#getNestedElements() */
It is not possible to nest elements inside an entry point, so always return an empty list
getNestedElements
{ "repo_name": "pperboires/PocDrools", "path": "drools-core/src/main/java/org/drools/rule/NamedConsequence.java", "license": "apache-2.0", "size": 3516 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,352,311
@NonNull static String getImageUrl(@NonNull DocumentFile documentFolder) { // look for special file names for (String iconLocation : PREFERRED_FEED_IMAGE_FILENAMES) { DocumentFile image = documentFolder.findFile(iconLocation); if (image != null) { return image.getUri().toString(); } } // use the first image in the folder if existing for (DocumentFile file : documentFolder.listFiles()) { String mime = file.getType(); if (mime != null && (mime.startsWith("image/jpeg") || mime.startsWith("image/png"))) { return file.getUri().toString(); } } // use default icon as fallback return Feed.PREFIX_GENERATIVE_COVER + documentFolder.getUri(); }
static String getImageUrl(@NonNull DocumentFile documentFolder) { for (String iconLocation : PREFERRED_FEED_IMAGE_FILENAMES) { DocumentFile image = documentFolder.findFile(iconLocation); if (image != null) { return image.getUri().toString(); } } for (DocumentFile file : documentFolder.listFiles()) { String mime = file.getType(); if (mime != null && (mime.startsWith(STR) mime.startsWith(STR))) { return file.getUri().toString(); } } return Feed.PREFIX_GENERATIVE_COVER + documentFolder.getUri(); }
/** * Returns the image URL for the local feed. */
Returns the image URL for the local feed
getImageUrl
{ "repo_name": "AntennaPod/AntennaPod", "path": "core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java", "license": "gpl-3.0", "size": 9538 }
[ "androidx.annotation.NonNull", "androidx.documentfile.provider.DocumentFile", "de.danoeh.antennapod.model.feed.Feed" ]
import androidx.annotation.NonNull; import androidx.documentfile.provider.DocumentFile; import de.danoeh.antennapod.model.feed.Feed;
import androidx.annotation.*; import androidx.documentfile.provider.*; import de.danoeh.antennapod.model.feed.*;
[ "androidx.annotation", "androidx.documentfile", "de.danoeh.antennapod" ]
androidx.annotation; androidx.documentfile; de.danoeh.antennapod;
2,129,642
public LabelNode rangeLabel(final LabelNode l) { return rangeTable.get(l); } // AbstractMap implementation
LabelNode function(final LabelNode l) { return rangeTable.get(l); }
/** * Looks up the label <code>l</code> in the <code>rangeTable</code>, * thus translating it from a Label in the original code, to a Label in * the inlined code that is appropriate for use by an try/catch or * variable use annotation. * * @param l The label we will be translating * @return a label for use by a try/catch or variable annotation in the * original code * @see #rangeTable */
Looks up the label <code>l</code> in the <code>rangeTable</code>, thus translating it from a Label in the original code, to a Label in the inlined code that is appropriate for use by an try/catch or variable use annotation
rangeLabel
{ "repo_name": "nxmatic/objectweb-asm-4.0", "path": "src/org/objectweb/asm/commons/JSRInlinerAdapter.java", "license": "bsd-3-clause", "size": 30334 }
[ "org.objectweb.asm.tree.LabelNode" ]
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.*;
[ "org.objectweb.asm" ]
org.objectweb.asm;
455,156
private PortalSearchResults getPortalSearchResults(PortletRequest request, String queryId) { final PortletSession session = request.getPortletSession(); @SuppressWarnings("unchecked") final Cache<String, PortalSearchResults> searchResultsCache = (Cache<String, PortalSearchResults>)session.getAttribute(SEARCH_RESULTS_CACHE_NAME); if (searchResultsCache == null) { return null; } return searchResultsCache.getIfPresent(queryId); }
PortalSearchResults function(PortletRequest request, String queryId) { final PortletSession session = request.getPortletSession(); @SuppressWarnings(STR) final Cache<String, PortalSearchResults> searchResultsCache = (Cache<String, PortalSearchResults>)session.getAttribute(SEARCH_RESULTS_CACHE_NAME); if (searchResultsCache == null) { return null; } return searchResultsCache.getIfPresent(queryId); }
/** * Get the {@link PortalSearchResults} for the specified query id from the session. If there are no results null * is returned. */
Get the <code>PortalSearchResults</code> for the specified query id from the session. If there are no results null is returned
getPortalSearchResults
{ "repo_name": "apetro/uPortal", "path": "uportal-war/src/main/java/org/apereo/portal/portlets/search/SearchPortletController.java", "license": "apache-2.0", "size": 40458 }
[ "com.google.common.cache.Cache", "javax.portlet.PortletRequest", "javax.portlet.PortletSession" ]
import com.google.common.cache.Cache; import javax.portlet.PortletRequest; import javax.portlet.PortletSession;
import com.google.common.cache.*; import javax.portlet.*;
[ "com.google.common", "javax.portlet" ]
com.google.common; javax.portlet;
1,627,922
private static Map<String, String> getFragmentParametersMap(Uri uri) { String fragment = uri.getFragment(); String[] keyValuePairs = TextUtils.split(fragment, AMPERSAND); Map<String, String> fragementParameters = new HashMap<String, String>(); for (String keyValuePair : keyValuePairs) { int index = keyValuePair.indexOf(EQUALS); String key = keyValuePair.substring(0, index); String value = keyValuePair.substring(index + 1); fragementParameters.put(key, value); } return fragementParameters; } private final Activity activity; private final HttpClient client; private final String clientId; private final DefaultObservableOAuthRequest observable; private final String scope; private final String loginHint; private final OAuthConfig mOAuthConfig; public AuthorizationRequest(Activity activity, HttpClient client, String clientId, String scope, String loginHint, final OAuthConfig oAuthConfig) { if (activity == null) throw new AssertionError(); if (client == null) throw new AssertionError(); if (TextUtils.isEmpty(clientId)) throw new AssertionError(); if (TextUtils.isEmpty(scope)) throw new AssertionError(); this.activity = activity; this.client = client; this.clientId = clientId; this.mOAuthConfig = oAuthConfig; this.observable = new DefaultObservableOAuthRequest(); this.scope = scope; this.loginHint = loginHint; }
static Map<String, String> function(Uri uri) { String fragment = uri.getFragment(); String[] keyValuePairs = TextUtils.split(fragment, AMPERSAND); Map<String, String> fragementParameters = new HashMap<String, String>(); for (String keyValuePair : keyValuePairs) { int index = keyValuePair.indexOf(EQUALS); String key = keyValuePair.substring(0, index); String value = keyValuePair.substring(index + 1); fragementParameters.put(key, value); } return fragementParameters; } private final Activity activity; private final HttpClient client; private final String clientId; private final DefaultObservableOAuthRequest observable; private final String scope; private final String loginHint; private final OAuthConfig mOAuthConfig; public AuthorizationRequest(Activity activity, HttpClient client, String clientId, String scope, String loginHint, final OAuthConfig oAuthConfig) { if (activity == null) throw new AssertionError(); if (client == null) throw new AssertionError(); if (TextUtils.isEmpty(clientId)) throw new AssertionError(); if (TextUtils.isEmpty(scope)) throw new AssertionError(); this.activity = activity; this.client = client; this.clientId = clientId; this.mOAuthConfig = oAuthConfig; this.observable = new DefaultObservableOAuthRequest(); this.scope = scope; this.loginHint = loginHint; }
/** * Turns the fragment parameters of the uri into a map. * * @param uri to get fragment parameters from * @return a map containing the fragment parameters */
Turns the fragment parameters of the uri into a map
getFragmentParametersMap
{ "repo_name": "MSOpenTech/msa-auth-for-android", "path": "src/main/java/com/microsoft/services/msa/AuthorizationRequest.java", "license": "mit", "size": 22226 }
[ "android.app.Activity", "android.net.Uri", "android.text.TextUtils", "java.util.HashMap", "java.util.Map", "org.apache.http.client.HttpClient" ]
import android.app.Activity; import android.net.Uri; import android.text.TextUtils; import java.util.HashMap; import java.util.Map; import org.apache.http.client.HttpClient;
import android.app.*; import android.net.*; import android.text.*; import java.util.*; import org.apache.http.client.*;
[ "android.app", "android.net", "android.text", "java.util", "org.apache.http" ]
android.app; android.net; android.text; java.util; org.apache.http;
1,569,024
@ServiceMethod(returns = ReturnType.SINGLE) void restartRevision(String resourceGroupName, String containerAppName, String name);
@ServiceMethod(returns = ReturnType.SINGLE) void restartRevision(String resourceGroupName, String containerAppName, String name);
/** * Restarts a revision for a Container App. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param containerAppName Name of the Container App. * @param name Name of the Container App Revision to restart. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.appservice.models.DefaultErrorResponseErrorException thrown if the request is * rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */
Restarts a revision for a Container App
restartRevision
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/fluent/ContainerAppsRevisionsClient.java", "license": "mit", "size": 17086 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.*;
[ "com.azure.core" ]
com.azure.core;
2,363,287
File getFile(String url);
File getFile(String url);
/** * Returns the file handle of the cached content for the given url. * * @param url original of the content * @return file handle of the cached content */
Returns the file handle of the cached content for the given url
getFile
{ "repo_name": "wmhameed/Yahala-Messenger", "path": "app/src/main/java/com/yahala/ImageLoader/file/FileManager.java", "license": "mit", "size": 2586 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,482,407
@Deprecated void fireJob(Object job, Map<String, Serializable> config) throws Exception;
void fireJob(Object job, Map<String, Serializable> config) throws Exception;
/** * Fire a job immediately and only once. * * @param job The job to execute (either {@link Job} or {@link Runnable}). * @param config An optional configuration object - this configuration is only passed to the job the job implements {@link Job}. * @throws IllegalArgumentException If the job has not the correct type. * @throws Exception If the job can't be scheduled. * @deprecated Use {@link #schedule(Object, ScheduleOptions)} instead. */
Fire a job immediately and only once
fireJob
{ "repo_name": "Nimco/sling", "path": "bundles/commons/scheduler/src/main/java/org/apache/sling/commons/scheduler/Scheduler.java", "license": "apache-2.0", "size": 17404 }
[ "java.io.Serializable", "java.util.Map" ]
import java.io.Serializable; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,100,556
public static CmsCoreData prefetch(HttpServletRequest request) { CmsCoreService srv = new CmsCoreService(); srv.setCms(CmsFlexController.getCmsObject(request)); srv.setRequest(request); CmsCoreData result = null; try { result = srv.prefetch(); } finally { srv.clearThreadStorage(); } return result; }
static CmsCoreData function(HttpServletRequest request) { CmsCoreService srv = new CmsCoreService(); srv.setCms(CmsFlexController.getCmsObject(request)); srv.setRequest(request); CmsCoreData result = null; try { result = srv.prefetch(); } finally { srv.clearThreadStorage(); } return result; }
/** * Fetches the core data.<p> * * @param request the current request * * @return the core data */
Fetches the core data
prefetch
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/gwt/CmsCoreService.java", "license": "lgpl-2.1", "size": 56046 }
[ "javax.servlet.http.HttpServletRequest", "org.opencms.flex.CmsFlexController", "org.opencms.gwt.shared.CmsCoreData" ]
import javax.servlet.http.HttpServletRequest; import org.opencms.flex.CmsFlexController; import org.opencms.gwt.shared.CmsCoreData;
import javax.servlet.http.*; import org.opencms.flex.*; import org.opencms.gwt.shared.*;
[ "javax.servlet", "org.opencms.flex", "org.opencms.gwt" ]
javax.servlet; org.opencms.flex; org.opencms.gwt;
699,146
public static Pair makeClassificationsFromAlignments( SegmentAlignment alignment, //the segment alignment information NOMElementToValueDelegate nomElementToValue ) { Classification c1 = new Classification("Annotator 1"); Classification c2 = new Classification("Annotator 2"); //process all aligned pairs for (int i = 0; i < alignment.alignedSegments.size(); i++) { WeightedPair nextPair = (WeightedPair)alignment.alignedSegments.get(i); Item newItem = new PairItem(nextPair); c1.add(newItem, nomElementToValue.getValueForNOMElement((NOMElement)nextPair.o1)); c2.add(newItem, nomElementToValue.getValueForNOMElement((NOMElement)nextPair.o2)); } //return result return new Pair(c1,c2); }
static Pair function( SegmentAlignment alignment, NOMElementToValueDelegate nomElementToValue ) { Classification c1 = new Classification(STR); Classification c2 = new Classification(STR); for (int i = 0; i < alignment.alignedSegments.size(); i++) { WeightedPair nextPair = (WeightedPair)alignment.alignedSegments.get(i); Item newItem = new PairItem(nextPair); c1.add(newItem, nomElementToValue.getValueForNOMElement((NOMElement)nextPair.o1)); c2.add(newItem, nomElementToValue.getValueForNOMElement((NOMElement)nextPair.o2)); } return new Pair(c1,c2); }
/** Given two aligned segment lists, make two calc.Classification where all Pairs of aligned segments are Items; and the Values are determined by the NOMElementToValueDelegate. Returns a Pair of Classifications. */
Given two aligned segment lists, make two calc.Classification where all Pairs of aligned
makeClassificationsFromAlignments
{ "repo_name": "boompieman/iim_project", "path": "nxt_1.4.4/src/net/sourceforge/nite/datainspection/timespan/SegmentAlignmentToClassificationFactory.java", "license": "gpl-3.0", "size": 1952 }
[ "net.sourceforge.nite.datainspection.data.Classification", "net.sourceforge.nite.datainspection.data.Item", "net.sourceforge.nite.datainspection.data.NOMElementToValueDelegate", "net.sourceforge.nite.datainspection.impl.PairItem", "net.sourceforge.nite.nom.nomwrite.NOMElement", "net.sourceforge.nite.util.Pair", "net.sourceforge.nite.util.WeightedPair" ]
import net.sourceforge.nite.datainspection.data.Classification; import net.sourceforge.nite.datainspection.data.Item; import net.sourceforge.nite.datainspection.data.NOMElementToValueDelegate; import net.sourceforge.nite.datainspection.impl.PairItem; import net.sourceforge.nite.nom.nomwrite.NOMElement; import net.sourceforge.nite.util.Pair; import net.sourceforge.nite.util.WeightedPair;
import net.sourceforge.nite.datainspection.data.*; import net.sourceforge.nite.datainspection.impl.*; import net.sourceforge.nite.nom.nomwrite.*; import net.sourceforge.nite.util.*;
[ "net.sourceforge.nite" ]
net.sourceforge.nite;
1,613,654
public static List<ColumnChange> createAllDeleteColumnChange(){ ColumnChange one = new ColumnChange(); one.setOldColumnId("111"); one.setNewColumnId(null); ColumnChange two = new ColumnChange(); two.setOldColumnId("222"); two.setNewColumnId(null); ColumnChange three = new ColumnChange(); three.setOldColumnId("333"); three.setNewColumnId(null); return Lists.newArrayList(one, two, three); }
static List<ColumnChange> function(){ ColumnChange one = new ColumnChange(); one.setOldColumnId("111"); one.setNewColumnId(null); ColumnChange two = new ColumnChange(); two.setOldColumnId("222"); two.setNewColumnId(null); ColumnChange three = new ColumnChange(); three.setOldColumnId("333"); three.setNewColumnId(null); return Lists.newArrayList(one, two, three); }
/** * Create a column change request to delete all columns. * @return */
Create a column change request to delete all columns
createAllDeleteColumnChange
{ "repo_name": "hhu94/Synapse-Repository-Services", "path": "lib/lib-test/src/main/java/org/sagebionetworks/repo/model/dbo/dao/table/TableModelTestUtils.java", "license": "apache-2.0", "size": 20325 }
[ "com.google.common.collect.Lists", "java.util.List", "org.sagebionetworks.repo.model.table.ColumnChange" ]
import com.google.common.collect.Lists; import java.util.List; import org.sagebionetworks.repo.model.table.ColumnChange;
import com.google.common.collect.*; import java.util.*; import org.sagebionetworks.repo.model.table.*;
[ "com.google.common", "java.util", "org.sagebionetworks.repo" ]
com.google.common; java.util; org.sagebionetworks.repo;
1,971,328
public void arrancarRecurso(Integer indice) { logger.debug("GestorRecursos: Arrancando recurso."); trazas.aceptaNuevaTraza(new InfoTraza("GestorRecursos", "Arrancando recurso.", InfoTraza.NivelTraza.debug)); boolean errorEnArranque = false; // seleccionamos el recurso que corresponde String nombreRec = (String) this.nombresRecursosGestionados .elementAt(indice.intValue()); try { // recuperamos la interfaz de gestion del recurso logger.debug("GestorRecursos: Es necesario arrancar el recurso " + nombreRec + ", recuperando interfaz de gestion."); trazas.aceptaNuevaTraza(new InfoTraza("GestorRecursos", "Es necesario arrancar el recurso " + nombreRec + ", recuperando interfaz de gestion.", InfoTraza.NivelTraza.debug)); InterfazGestion itfGesAg = (InterfazGestion) this.itfUsoRepositorio .obtenerInterfaz(NombresPredefinidos.ITF_GESTION + nombreRec); // arrancamos el recurso logger.debug("GestorRecursos: Arrancando el recurso " + nombreRec + "."); trazas.aceptaNuevaTraza(new InfoTraza("GestorRecursos", "Arrancando el recurso " + nombreRec + ".", InfoTraza.NivelTraza.debug)); if (itfGesAg == null) {// No esta registrada en el repositirio de // interfaces del nodo local // String identHostRecurso= // config.getDescInstanciaRecursoAplicacion(nombreRec).getNodo().getNombreUso(); // itfGesAg = // AdaptadorRegRMI.getItfGestionEntidadRemota(identHostRecurso, // nombreRec); itfGesAg = (InterfazGestion) AdaptadorRegRMI .getItfRecursoRemoto(nombreRec, NombresPredefinidos.ITF_GESTION); if (itfGesAg == null)// la intf de gestion es null El recruso no // ha sido registrado { logger.debug("GestorRecursos: No se puede dar la orden de arranque al recurso " + nombreRec + ". Porque su interfaz es null"); trazas.aceptaNuevaTraza(new InfoTraza(nombreAgente, " No se puede dar la orden de arranque al recurso " + nombreRec + ". Porque su interfaz es null", InfoTraza.NivelTraza.debug)); errorEnArranque = true; } else { // Registro la interfaz en el repositorio local y doy la // orden de arrancar this.itfUsoRepositorio.registrarInterfaz( NombresPredefinidos.ITF_GESTION + nombreRec, itfGesAg); Remote itfUsoRec = AdaptadorRegRMI.getItfRecursoRemoto( nombreRec, NombresPredefinidos.ITF_USO); this.itfUsoRepositorio.registrarInterfaz( NombresPredefinidos.ITF_USO + nombreRec, itfUsoRec); logger.debug("GestorRecursos: Registro la interfaz remota del recurso: " + nombreRec + ". En el repositorio de interfaces"); trazas.aceptaNuevaTraza(new InfoTraza(nombreAgente, " Registro la interfaz remota del recurso: " + nombreRec + ". En el repositorio de interfaces", InfoTraza.NivelTraza.debug)); errorEnArranque = false; } } if (itfGesAg != null) { itfGesAg.arranca(); logger.debug("GestorRecursos: Orden de arranque ha sido dada al recurso " + nombreRec + "."); trazas.aceptaNuevaTraza(new InfoTraza("GestorRecursos", "Orden de arranque ha sido dada al recurso " + nombreRec + ".", InfoTraza.NivelTraza.debug)); } // else { // // La interfaz del recurso no esta en el repositorio local. Una // posibilidad es buscar su itenrfaz remota // // registrarla en el repositorio de interfaces local al GR y // darle la orden de arrancar // // String nodoRecurso = // this.config.getDescInstanciaRecursoAplicacion(nombre).getNodo().getNombreUso(); // itfGesAg = // AdaptadorRegRMI.getItfGestionAgteReactRemoto(nombreAgente); // if (itfGesAg != null ){ // // Registro la interfaz en el repositorio local y doy la orden de // arrancar // this.itfUsoRepositorio.registrarInterfaz(NombresPredefinidos.ITF_GESTION // + nombre, itfGesAg); // this.itfUsoRepositorio.registrarInterfaz(NombresPredefinidos.ITF_USO // + nombre, // AdaptadorRegRMI.getItfUsoAgteReactRemoto(nombreAgente)); // // // } // // logger.debug("GestorRecursos: No se puede dar la orden de arranque al recurso "+ // nombre + ". Porque su interfaz es null"); // trazas.aceptaNuevaTraza(new InfoTraza(nombreAgente, // " No se puede dar la orden de arranque al recurso "+ nombre + // ". Porque su interfaz es null", // InfoTraza.NivelTraza.debug)); // errorEnArranque = true; // } } catch (Exception ex) { logger.error("GestorRecursos: Hubo un problema al acceder al interfaz remoto mientras se arrancaba el recurso " + nombreRec + " en el gestor de recursos."); trazas.aceptaNuevaTraza(new InfoTraza( "GestorRecursos", "Hubo un problema al acceder al interfaz remoto mientras se arrancaba el recurso " + nombreRec + " en el gestor de recursos.", InfoTraza.NivelTraza.error)); ex.printStackTrace(); errorEnArranque = true; } if (errorEnArranque) { // ha ocurrido alg�n problema en el arranque // del // recurso try { this.informaraMiAutomata("error_en_arranque_recurso"); // this.itfUsoPropiadeEsteAgente.aceptaEvento(new EventoRecAgte( // "error_en_arranque_recurso", // NombresPredefinidos.NOMBRE_GESTOR_RECURSOS, // NombresPredefinidos.NOMBRE_GESTOR_RECURSOS)); } catch (Exception e) { e.printStackTrace(); } logger.error("GestorRecursos: Se produjo un error en el arranque del recurso " + nombreRec + "."); trazas.aceptaNuevaTraza(new InfoTraza("GestorRecursos", "Se produjo un error en el arranque del recurso " + nombreRec + ".", InfoTraza.NivelTraza.error)); } else {// el recurso ha sido arrancado if (indice.intValue() == (this.nombresRecursosGestionados.size() - 1)) { // ya // no // hay // m�s // recursos // que // arrancar logger.debug("GestorRecursos: Terminado proceso de arranque automatico de recursos."); trazas.aceptaNuevaTraza(new InfoTraza( "GestorRecursos", "Terminado proceso de arranque autom�tico de recursos.", InfoTraza.NivelTraza.debug)); try { this.informaraMiAutomata("recursos_arrancados_ok"); // this.itfUsoPropiadeEsteAgente.aceptaEvento(new // EventoRecAgte( // "recursos_arrancados_ok", // NombresPredefinidos.NOMBRE_GESTOR_RECURSOS, // NombresPredefinidos.NOMBRE_GESTOR_RECURSOS)); // this.itfUsoGestorAReportar.aceptaEvento(new // EventoRecAgte( // "gestor_recursos_arrancado_ok", // NombresPredefinidos.NOMBRE_GESTOR_RECURSOS, // NombresPredefinidos.NOMBRE_GESTOR_ORGANIZACION)); this.comunicator.enviarInfoAotroAgente( "gestor_recursos_arrancado_ok", NombresPredefinidos.NOMBRE_GESTOR_ORGANIZACION); } catch (Exception e) { e.printStackTrace(); } logger.debug("GestorRecursos: Gestor de recursos esperando peticiones."); trazas.aceptaNuevaTraza(new InfoTraza("GestorRecursos", "Gestor de recursos esperando peticiones.", InfoTraza.NivelTraza.debug)); // creo hebra de monitorizaci�n hebra = new HebraMonitorizacion(tiempoParaNuevaMonitorizacion, this.itfUsoPropiadeEsteAgente, "monitorizar"); this.hebra.start(); } else { // hay mas recursos que arrancar logger.debug("GestorRecursos: Terminado arranque recurso " + nombreRec + ". Arrancando el siguiente recurso."); trazas.aceptaNuevaTraza(new InfoTraza("GestorRecursos", "Terminado arranque recurso " + nombreRec + ". Arrancando el siguiente recurso.", InfoTraza.NivelTraza.debug)); try { this.informaraMiAutomata("recurso_arrancado", indice + 1); // this.itfUsoPropiadeEsteAgente.aceptaEvento(new // EventoRecAgte( // "recurso_arrancado", new Integer( // indice.intValue() + 1), // NombresPredefinidos.NOMBRE_GESTOR_RECURSOS, // NombresPredefinidos.NOMBRE_GESTOR_RECURSOS)); } catch (Exception e) { e.printStackTrace(); } } } } /* * private boolean esNecesarioArrancar(String nombreRecurso) { Enumeration * enume = configEspecifica.getListaRecursos().enumerateRecurso(); while * (enume.hasMoreElements()) { Recurso item = (Recurso)enume.nextElement(); * if (nombreRecurso.equals(item.getNombre())) return * item.getHayQueArrancarlo(); } logger.error("GestorRecursos: No se * encontr� ning�n recurso con nombre "+nombreRecurso+" dentro de la * lista de objetos gestionados."); throw new NullPointerException(); }
void function(Integer indice) { logger.debug(STR); trazas.aceptaNuevaTraza(new InfoTraza(STR, STR, InfoTraza.NivelTraza.debug)); boolean errorEnArranque = false; String nombreRec = (String) this.nombresRecursosGestionados .elementAt(indice.intValue()); try { logger.debug(STR + nombreRec + STR); trazas.aceptaNuevaTraza(new InfoTraza(STR, STR + nombreRec + STR, InfoTraza.NivelTraza.debug)); InterfazGestion itfGesAg = (InterfazGestion) this.itfUsoRepositorio .obtenerInterfaz(NombresPredefinidos.ITF_GESTION + nombreRec); logger.debug(STR + nombreRec + "."); trazas.aceptaNuevaTraza(new InfoTraza(STR, STR + nombreRec + ".", InfoTraza.NivelTraza.debug)); if (itfGesAg == null) { itfGesAg = (InterfazGestion) AdaptadorRegRMI .getItfRecursoRemoto(nombreRec, NombresPredefinidos.ITF_GESTION); if (itfGesAg == null) { logger.debug(STR + nombreRec + STR); trazas.aceptaNuevaTraza(new InfoTraza(nombreAgente, STR + nombreRec + STR, InfoTraza.NivelTraza.debug)); errorEnArranque = true; } else { this.itfUsoRepositorio.registrarInterfaz( NombresPredefinidos.ITF_GESTION + nombreRec, itfGesAg); Remote itfUsoRec = AdaptadorRegRMI.getItfRecursoRemoto( nombreRec, NombresPredefinidos.ITF_USO); this.itfUsoRepositorio.registrarInterfaz( NombresPredefinidos.ITF_USO + nombreRec, itfUsoRec); logger.debug(STR + nombreRec + STR); trazas.aceptaNuevaTraza(new InfoTraza(nombreAgente, STR + nombreRec + STR, InfoTraza.NivelTraza.debug)); errorEnArranque = false; } } if (itfGesAg != null) { itfGesAg.arranca(); logger.debug(STR + nombreRec + "."); trazas.aceptaNuevaTraza(new InfoTraza(STR, STR + nombreRec + ".", InfoTraza.NivelTraza.debug)); } } catch (Exception ex) { logger.error(STR + nombreRec + STR); trazas.aceptaNuevaTraza(new InfoTraza( STR, STR + nombreRec + STR, InfoTraza.NivelTraza.error)); ex.printStackTrace(); errorEnArranque = true; } if (errorEnArranque) { try { this.informaraMiAutomata(STR); } catch (Exception e) { e.printStackTrace(); } logger.error(STR + nombreRec + "."); trazas.aceptaNuevaTraza(new InfoTraza(STR, STR + nombreRec + ".", InfoTraza.NivelTraza.error)); } else { if (indice.intValue() == (this.nombresRecursosGestionados.size() - 1)) { logger.debug(STR); trazas.aceptaNuevaTraza(new InfoTraza( STR, STR, InfoTraza.NivelTraza.debug)); try { this.informaraMiAutomata(STR); this.comunicator.enviarInfoAotroAgente( STR, NombresPredefinidos.NOMBRE_GESTOR_ORGANIZACION); } catch (Exception e) { e.printStackTrace(); } logger.debug(STR); trazas.aceptaNuevaTraza(new InfoTraza(STR, STR, InfoTraza.NivelTraza.debug)); hebra = new HebraMonitorizacion(tiempoParaNuevaMonitorizacion, this.itfUsoPropiadeEsteAgente, STR); this.hebra.start(); } else { logger.debug(STR + nombreRec + STR); trazas.aceptaNuevaTraza(new InfoTraza(STR, STR + nombreRec + STR, InfoTraza.NivelTraza.debug)); try { this.informaraMiAutomata(STR, indice + 1); } catch (Exception e) { e.printStackTrace(); } } } } /* * private boolean esNecesarioArrancar(String nombreRecurso) { Enumeration * enume = configEspecifica.getListaRecursos().enumerateRecurso(); while * (enume.hasMoreElements()) { Recurso item = (Recurso)enume.nextElement(); * if (nombreRecurso.equals(item.getNombre())) return * item.getHayQueArrancarlo(); } logger.error(STR+nombreRecurso+STR); throw new NullPointerException(); }
/** * arranca el siguiente recurso que especifique la configuracion. */
arranca el siguiente recurso que especifique la configuracion
arrancarRecurso
{ "repo_name": "SONIAGroup/S.O.N.I.A.", "path": "src/icaro/gestores/gestorRecursos/comportamiento/AccionesSemanticasGestorRecursos.java", "license": "gpl-2.0", "size": 45550 }
[ "java.rmi.Remote", "java.util.Enumeration" ]
import java.rmi.Remote; import java.util.Enumeration;
import java.rmi.*; import java.util.*;
[ "java.rmi", "java.util" ]
java.rmi; java.util;
801,753
public synchronized void compile( String collectionRole, Map replacements, boolean scalar) throws QueryException, MappingException { if ( !isCompiled() ) { addFromAssociation( "this", collectionRole ); compile( replacements, scalar ); } }
synchronized void function( String collectionRole, Map replacements, boolean scalar) throws QueryException, MappingException { if ( !isCompiled() ) { addFromAssociation( "this", collectionRole ); compile( replacements, scalar ); } }
/** * Compile a filter. This method may be called multiple * times. Subsequent invocations are no-ops. */
Compile a filter. This method may be called multiple times. Subsequent invocations are no-ops
compile
{ "repo_name": "codeApeFromChina/resource", "path": "frame_packages/java_libs/hibernate-distribution-3.6.10.Final/project/hibernate-core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java", "license": "unlicense", "size": 35781 }
[ "java.util.Map", "org.hibernate.MappingException", "org.hibernate.QueryException" ]
import java.util.Map; import org.hibernate.MappingException; import org.hibernate.QueryException;
import java.util.*; import org.hibernate.*;
[ "java.util", "org.hibernate" ]
java.util; org.hibernate;
2,557,423
void regionOverflow(Object source, String elementName, String page, int amount, boolean clip, boolean canRecover, Locator loc) throws LayoutException;
void regionOverflow(Object source, String elementName, String page, int amount, boolean clip, boolean canRecover, Locator loc) throws LayoutException;
/** * Contents overflow a region viewport. * @param source the event source * @param elementName the formatting object * @param page the page number/name where the overflow happened * @param amount the amount by which the contents overflow (in mpt) * @param clip true if the content will be clipped * @param canRecover indicates whether FOP can recover from this problem and continue working * @param loc the location of the error or null * @throws LayoutException the layout error provoked by the method call * @event.severity FATAL */
Contents overflow a region viewport
regionOverflow
{ "repo_name": "chunlinyao/fop", "path": "fop-core/src/main/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java", "license": "apache-2.0", "size": 9073 }
[ "org.xml.sax.Locator" ]
import org.xml.sax.Locator;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
788,367
public void testVerifyUpdatedEmployee() { EntityManager em = createEntityManager(); beginTransaction(em); try { Employee emp = em.find(Employee.class, empId); assertNotNull("The updated employee was not found.", emp); boolean found = false; for (String responsibility : (Collection<String>) emp.getResponsibilities()) { if (responsibility.equals(newResponsibility)) { found = true; break; } } commitTransaction(em); assertTrue("The new responsibility was not added.", found); assertTrue("The basic collection using enums was not persisted correctly.", emp.worksMondayToFriday()); } catch (RuntimeException e) { if (isTransactionActive(em)){ rollbackTransaction(em); } closeEntityManager(em); // Re-throw exception to ensure stacktrace appears in test result. throw e; } closeEntityManager(em); }
void function() { EntityManager em = createEntityManager(); beginTransaction(em); try { Employee emp = em.find(Employee.class, empId); assertNotNull(STR, emp); boolean found = false; for (String responsibility : (Collection<String>) emp.getResponsibilities()) { if (responsibility.equals(newResponsibility)) { found = true; break; } } commitTransaction(em); assertTrue(STR, found); assertTrue(STR, emp.worksMondayToFriday()); } catch (RuntimeException e) { if (isTransactionActive(em)){ rollbackTransaction(em); } closeEntityManager(em); throw e; } closeEntityManager(em); }
/** * Verifies: * - a BasicCollection mapping. * - a BasicCollection that uses an Enum converter (by detection). */
Verifies: - a BasicCollection mapping. - a BasicCollection that uses an Enum converter (by detection)
testVerifyUpdatedEmployee
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/advanced/AdvancedJPAJunitTest.java", "license": "epl-1.0", "size": 166492 }
[ "java.util.Collection", "javax.persistence.EntityManager", "org.eclipse.persistence.testing.models.jpa.advanced.Employee" ]
import java.util.Collection; import javax.persistence.EntityManager; import org.eclipse.persistence.testing.models.jpa.advanced.Employee;
import java.util.*; import javax.persistence.*; import org.eclipse.persistence.testing.models.jpa.advanced.*;
[ "java.util", "javax.persistence", "org.eclipse.persistence" ]
java.util; javax.persistence; org.eclipse.persistence;
1,232,469
public static String generateActivationKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); }
static String function() { return RandomStringUtils.randomNumeric(DEF_COUNT); }
/** * Generates an activation key. * * @return the generated activation key */
Generates an activation key
generateActivationKey
{ "repo_name": "smalldatalab/omh-dsu", "path": "ohmageomh-manage-server/src/main/java/io/smalldata/ohmageomh/service/util/RandomUtil.java", "license": "apache-2.0", "size": 894 }
[ "org.apache.commons.lang.RandomStringUtils" ]
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
994,479
private void setupCtlr(Ctlr ctlr, int controllerId, String title) { LayoutInflater li = LayoutInflater.from(getActivity()); ctlr.mRootView = (ViewGroup) li.inflate(R.layout.controllers_content_tabbed, null); ctlr.scrollView = (ObservableScrollView) ctlr.mRootView.findViewById(R.id.controllers_scroll); ctlr.scrollView.setOnScrollListener(this); ctlr.mTabHost = (TabHost) ctlr.mRootView.findViewById(android.R.id.tabhost); ctlr.mTabHost.setup(); ctlr.index = mCtlrs.size(); ctlr.mTitleView = (TextView) ctlr.mRootView.findViewById(R.id.session_title); ctlr.mSubtitleView = (TextView) ctlr.mRootView.findViewById(R.id.session_subtitle); ctlr.mStarredView = (CompoundButton) ctlr.mRootView.findViewById(R.id.star_button); ctlr.mStarredView.setFocusable(true); ctlr.mStarredView.setClickable(true); ctlr.mControllerId=controllerId; ctlr.mTitleString=title; setupProbesTab(ctlr); setupOutletsTab(ctlr); setupNotesTab(ctlr); mWorkspace.addView(ctlr.mRootView); mCtlrs.add(ctlr); updateWorkspaceHeader(ctlr.index); }
void function(Ctlr ctlr, int controllerId, String title) { LayoutInflater li = LayoutInflater.from(getActivity()); ctlr.mRootView = (ViewGroup) li.inflate(R.layout.controllers_content_tabbed, null); ctlr.scrollView = (ObservableScrollView) ctlr.mRootView.findViewById(R.id.controllers_scroll); ctlr.scrollView.setOnScrollListener(this); ctlr.mTabHost = (TabHost) ctlr.mRootView.findViewById(android.R.id.tabhost); ctlr.mTabHost.setup(); ctlr.index = mCtlrs.size(); ctlr.mTitleView = (TextView) ctlr.mRootView.findViewById(R.id.session_title); ctlr.mSubtitleView = (TextView) ctlr.mRootView.findViewById(R.id.session_subtitle); ctlr.mStarredView = (CompoundButton) ctlr.mRootView.findViewById(R.id.star_button); ctlr.mStarredView.setFocusable(true); ctlr.mStarredView.setClickable(true); ctlr.mControllerId=controllerId; ctlr.mTitleString=title; setupProbesTab(ctlr); setupOutletsTab(ctlr); setupNotesTab(ctlr); mWorkspace.addView(ctlr.mRootView); mCtlrs.add(ctlr); updateWorkspaceHeader(ctlr.index); }
/** * Prepare the TabHost for this controller and inflate it within a workspace pane * * @param controllerId * @param title */
Prepare the TabHost for this controller and inflate it within a workspace pane
setupCtlr
{ "repo_name": "HeneryH/AquaNotesBU", "path": "src/com/heneryh/aquanotes/ui/CtlrStatusFragment.java", "license": "apache-2.0", "size": 30562 }
[ "android.view.LayoutInflater", "android.view.ViewGroup", "android.widget.CompoundButton", "android.widget.TabHost", "android.widget.TextView", "com.heneryh.aquanotes.ui.widget.ObservableScrollView" ]
import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.TabHost; import android.widget.TextView; import com.heneryh.aquanotes.ui.widget.ObservableScrollView;
import android.view.*; import android.widget.*; import com.heneryh.aquanotes.ui.widget.*;
[ "android.view", "android.widget", "com.heneryh.aquanotes" ]
android.view; android.widget; com.heneryh.aquanotes;
2,313,719
@Bean public IntegrationFlow sendFlow() { return IntegrationFlows .from(packetChannel()) .transform(OutgoingMessageWrapper.class, msg -> { msg.write(); return msg; }) .transform(OutgoingMessageWrapper.class, msg -> { encoder.appendBlowFishPadding(msg.getPayload()); return msg; }) .route(OutgoingMessageWrapper.class, msg -> msg instanceof Init, invoker -> invoker .subFlowMapping("true", sf -> sf.transform(Init.class, i -> encoder.encWithXor(i.getPayload())) .enrichHeaders(singletonMap(STATIC_KEY_HEADER, true))) .subFlowMapping("false", sf -> sf.transform(OutgoingMessageWrapper.class, msg -> encoder.appendChecksum(msg.getPayload())))) .transform(ByteBuf.class, buf -> { byte[] data = new byte[buf.readableBytes()]; buf.readBytes(data); buf.release(); return data; }) .transform(encoder, "encrypt") .headerFilter(STATIC_KEY_HEADER) .channel(tcpOutChannel()) .get(); }
IntegrationFlow function() { return IntegrationFlows .from(packetChannel()) .transform(OutgoingMessageWrapper.class, msg -> { msg.write(); return msg; }) .transform(OutgoingMessageWrapper.class, msg -> { encoder.appendBlowFishPadding(msg.getPayload()); return msg; }) .route(OutgoingMessageWrapper.class, msg -> msg instanceof Init, invoker -> invoker .subFlowMapping("true", sf -> sf.transform(Init.class, i -> encoder.encWithXor(i.getPayload())) .enrichHeaders(singletonMap(STATIC_KEY_HEADER, true))) .subFlowMapping("false", sf -> sf.transform(OutgoingMessageWrapper.class, msg -> encoder.appendChecksum(msg.getPayload())))) .transform(ByteBuf.class, buf -> { byte[] data = new byte[buf.readableBytes()]; buf.readBytes(data); buf.release(); return data; }) .transform(encoder, STR) .headerFilter(STATIC_KEY_HEADER) .channel(tcpOutChannel()) .get(); }
/** * Outgoing message flow * * @return - complete message transformations flow */
Outgoing message flow
sendFlow
{ "repo_name": "Camelion/JTS-V3", "path": "authserver/src/main/java/ru/jts_dev/authserver/config/AuthIntegrationConfig.java", "license": "gpl-3.0", "size": 10064 }
[ "io.netty.buffer.ByteBuf", "org.springframework.integration.dsl.IntegrationFlow", "org.springframework.integration.dsl.IntegrationFlows", "ru.jts_dev.authserver.packets.out.Init", "ru.jts_dev.common.packets.OutgoingMessageWrapper" ]
import io.netty.buffer.ByteBuf; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; import ru.jts_dev.authserver.packets.out.Init; import ru.jts_dev.common.packets.OutgoingMessageWrapper;
import io.netty.buffer.*; import org.springframework.integration.dsl.*; import ru.jts_dev.authserver.packets.out.*; import ru.jts_dev.common.packets.*;
[ "io.netty.buffer", "org.springframework.integration", "ru.jts_dev.authserver", "ru.jts_dev.common" ]
io.netty.buffer; org.springframework.integration; ru.jts_dev.authserver; ru.jts_dev.common;
1,479,216
public final List<String> getRelativeDirContent() { assert (isDirectory()); return Arrays.asList(file.list()); }
final List<String> function() { assert (isDirectory()); return Arrays.asList(file.list()); }
/** * Returns the list of (relative) filenames contained in this directory. * * @return list of relative filenames */
Returns the list of (relative) filenames contained in this directory
getRelativeDirContent
{ "repo_name": "chupanw/jdime", "path": "src/de/fosd/jdime/common/FileArtifact.java", "license": "lgpl-2.1", "size": 17118 }
[ "java.util.Arrays", "java.util.List" ]
import java.util.Arrays; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,792,228
private static void addVars(List stats, Bits inits, Bits uninits) { for (; stats.nonEmpty(); stats = stats.tail) { Tree stat = (Tree) stats.head; if (stat.tag == Tree.VARDEF) { int adr = ((VarDef) stat).sym.adr; inits.excl(adr); uninits.incl(adr); } } }
static void function(List stats, Bits inits, Bits uninits) { for (; stats.nonEmpty(); stats = stats.tail) { Tree stat = (Tree) stats.head; if (stat.tag == Tree.VARDEF) { int adr = ((VarDef) stat).sym.adr; inits.excl(adr); uninits.incl(adr); } } }
/** * Add any variables defined in stats to inits and uninits. */
Add any variables defined in stats to inits and uninits
addVars
{ "repo_name": "nileshpatelksy/hello-pod-cast", "path": "archive/FILE/Compiler/java_GJC1.42_src/src/com/sun/tools/javac/v8/comp/Flow.java", "license": "apache-2.0", "size": 36551 }
[ "com.sun.tools.javac.v8.tree.Tree", "com.sun.tools.javac.v8.util.Bits", "com.sun.tools.javac.v8.util.List" ]
import com.sun.tools.javac.v8.tree.Tree; import com.sun.tools.javac.v8.util.Bits; import com.sun.tools.javac.v8.util.List;
import com.sun.tools.javac.v8.tree.*; import com.sun.tools.javac.v8.util.*;
[ "com.sun.tools" ]
com.sun.tools;
422,239
public ResourceViewBean createResourceViewBean(Resource resource) { ResourceViewBean viewBean = null; if (resource != null) { if (resource instanceof Software) { viewBean = new SoftwareViewBean((Software) resource); } else if (resource instanceof PedagogicalAndDocumentaryResource) { viewBean = new PedagogicalAndDocumentaryResourceViewBean((PedagogicalAndDocumentaryResource) resource); } else if (resource instanceof Equipment) { viewBean = new EquipmentViewBean((Equipment) resource); } else if (resource instanceof Documentation) { viewBean = new DocumentationViewBean((Documentation) resource); } else if (resource instanceof ProfessionalTraining) { viewBean = new ProfessionalTrainingViewBean((ProfessionalTraining) resource); } } return viewBean; }
ResourceViewBean function(Resource resource) { ResourceViewBean viewBean = null; if (resource != null) { if (resource instanceof Software) { viewBean = new SoftwareViewBean((Software) resource); } else if (resource instanceof PedagogicalAndDocumentaryResource) { viewBean = new PedagogicalAndDocumentaryResourceViewBean((PedagogicalAndDocumentaryResource) resource); } else if (resource instanceof Equipment) { viewBean = new EquipmentViewBean((Equipment) resource); } else if (resource instanceof Documentation) { viewBean = new DocumentationViewBean((Documentation) resource); } else if (resource instanceof ProfessionalTraining) { viewBean = new ProfessionalTrainingViewBean((ProfessionalTraining) resource); } } return viewBean; }
/** * Helper method that will create a correctly typed ResourceViewBean given a Resource * @param resource The Resource to use to construct the ResourceViewBean * @return the corresponding ResourceViewBean, or null if given resource is null */
Helper method that will create a correctly typed ResourceViewBean given a Resource
createResourceViewBean
{ "repo_name": "gcolbert/ACEM", "path": "ACEM-web-jsf-servlet/src/main/java/eu/ueb/acem/web/controllers/MyToolsController.java", "license": "gpl-3.0", "size": 45291 }
[ "eu.ueb.acem.domain.beans.jaune.Documentation", "eu.ueb.acem.domain.beans.jaune.Equipment", "eu.ueb.acem.domain.beans.jaune.PedagogicalAndDocumentaryResource", "eu.ueb.acem.domain.beans.jaune.ProfessionalTraining", "eu.ueb.acem.domain.beans.jaune.Resource", "eu.ueb.acem.domain.beans.jaune.Software", "eu.ueb.acem.web.viewbeans.jaune.DocumentationViewBean", "eu.ueb.acem.web.viewbeans.jaune.EquipmentViewBean", "eu.ueb.acem.web.viewbeans.jaune.PedagogicalAndDocumentaryResourceViewBean", "eu.ueb.acem.web.viewbeans.jaune.ProfessionalTrainingViewBean", "eu.ueb.acem.web.viewbeans.jaune.ResourceViewBean", "eu.ueb.acem.web.viewbeans.jaune.SoftwareViewBean" ]
import eu.ueb.acem.domain.beans.jaune.Documentation; import eu.ueb.acem.domain.beans.jaune.Equipment; import eu.ueb.acem.domain.beans.jaune.PedagogicalAndDocumentaryResource; import eu.ueb.acem.domain.beans.jaune.ProfessionalTraining; import eu.ueb.acem.domain.beans.jaune.Resource; import eu.ueb.acem.domain.beans.jaune.Software; import eu.ueb.acem.web.viewbeans.jaune.DocumentationViewBean; import eu.ueb.acem.web.viewbeans.jaune.EquipmentViewBean; import eu.ueb.acem.web.viewbeans.jaune.PedagogicalAndDocumentaryResourceViewBean; import eu.ueb.acem.web.viewbeans.jaune.ProfessionalTrainingViewBean; import eu.ueb.acem.web.viewbeans.jaune.ResourceViewBean; import eu.ueb.acem.web.viewbeans.jaune.SoftwareViewBean;
import eu.ueb.acem.domain.beans.jaune.*; import eu.ueb.acem.web.viewbeans.jaune.*;
[ "eu.ueb.acem" ]
eu.ueb.acem;
988,117
public static void initializeContentModel(final Session session, final URL cndFile) throws RepositoryException { LOG.info("Initializing JCR Model from File {}", cndFile.getPath()); Reader cndReader; try { cndReader = new InputStreamReader(cndFile.openStream(), StandardCharsets.UTF_8); } catch (final IOException e) { throw new InkstandRuntimeException("Could not read cndFile " + cndFile, e); } final Repository repository = session.getRepository(); final String user = session.getUserID(); final String name = repository.getDescriptor(Repository.REP_NAME_DESC); LOG.info("Logged in as {} to a {} repository", user, name); NodeType[] nodeTypes; try { nodeTypes = CndImporter.registerNodeTypes(cndReader, session, true); if (LOG.isDebugEnabled()) { logRegisteredNodeTypes(nodeTypes); } } catch (final ParseException | IOException e) { throw new InkstandRuntimeException("Could not register node types", e); } }
static void function(final Session session, final URL cndFile) throws RepositoryException { LOG.info(STR, cndFile.getPath()); Reader cndReader; try { cndReader = new InputStreamReader(cndFile.openStream(), StandardCharsets.UTF_8); } catch (final IOException e) { throw new InkstandRuntimeException(STR + cndFile, e); } final Repository repository = session.getRepository(); final String user = session.getUserID(); final String name = repository.getDescriptor(Repository.REP_NAME_DESC); LOG.info(STR, user, name); NodeType[] nodeTypes; try { nodeTypes = CndImporter.registerNodeTypes(cndReader, session, true); if (LOG.isDebugEnabled()) { logRegisteredNodeTypes(nodeTypes); } } catch (final ParseException IOException e) { throw new InkstandRuntimeException(STR, e); } }
/** * Loads the inque nodetype model to the session's repository * * @param session * a session with a user with sufficient privileges * @param cndFile * the url to the file containing the node type definitions in CND syntax * @throws RepositoryException */
Loads the inque nodetype model to the session's repository
initializeContentModel
{ "repo_name": "inkstand-io/inkstand", "path": "inkstand-jcr-jackrabbit/src/main/java/io/inkstand/jcr/provider/JackrabbitUtil.java", "license": "apache-2.0", "size": 6177 }
[ "io.inkstand.InkstandRuntimeException", "java.io.IOException", "java.io.InputStreamReader", "java.io.Reader", "java.nio.charset.StandardCharsets", "javax.jcr.Repository", "javax.jcr.RepositoryException", "javax.jcr.Session", "javax.jcr.nodetype.NodeType", "org.apache.jackrabbit.commons.cnd.CndImporter", "org.apache.jackrabbit.commons.cnd.ParseException" ]
import io.inkstand.InkstandRuntimeException; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.nio.charset.StandardCharsets; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.jcr.nodetype.NodeType; import org.apache.jackrabbit.commons.cnd.CndImporter; import org.apache.jackrabbit.commons.cnd.ParseException;
import io.inkstand.*; import java.io.*; import java.nio.charset.*; import javax.jcr.*; import javax.jcr.nodetype.*; import org.apache.jackrabbit.commons.cnd.*;
[ "io.inkstand", "java.io", "java.nio", "javax.jcr", "org.apache.jackrabbit" ]
io.inkstand; java.io; java.nio; javax.jcr; org.apache.jackrabbit;
2,850,059