method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public Object[] importCells(Object[] cells, double dx, double dy, Object target, Point location) { return graph.moveCells(cells, dx, dy, true, target, location); }
Object[] function(Object[] cells, double dx, double dy, Object target, Point location) { return graph.moveCells(cells, dx, dy, true, target, location); }
/** * Clones and inserts the given cells into the graph using the move method * and returns the inserted cells. This shortcut is used if cells are * inserted via datatransfer. */
Clones and inserts the given cells into the graph using the move method and returns the inserted cells. This shortcut is used if cells are inserted via datatransfer
importCells
{ "repo_name": "dpisarewski/gka_wise12", "path": "src/com/mxgraph/swing/mxGraphComponent.java", "license": "lgpl-2.1", "size": 102389 }
[ "java.awt.Point" ]
import java.awt.Point;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,816,597
this.envCheck = envCheck; checkPolicy(null); SharedActivationGroupDescriptor gd = envCheck.getGroupDescriptor(); if (gd != null) { checkPolicy(gd); } }
this.envCheck = envCheck; checkPolicy(null); SharedActivationGroupDescriptor gd = envCheck.getGroupDescriptor(); if (gd != null) { checkPolicy(gd); } }
/** * Perform the check both for the current VM, and for the group VM if a * <code>SharedActivationGroupDescriptor</code> is available from the plugin * container. */
Perform the check both for the current VM, and for the group VM if a <code>SharedActivationGroupDescriptor</code> is available from the plugin container
run
{ "repo_name": "cdegroot/river", "path": "src/com/sun/jini/tool/envcheck/plugins/CheckJSKPolicy.java", "license": "apache-2.0", "size": 3698 }
[ "com.sun.jini.start.SharedActivationGroupDescriptor" ]
import com.sun.jini.start.SharedActivationGroupDescriptor;
import com.sun.jini.start.*;
[ "com.sun.jini" ]
com.sun.jini;
2,721,316
public void moveAllChildrenTo(final FilePath target) throws IOException, InterruptedException { if(this.channel != target.channel) { throw new IOException("pullUpTo target must be on the same host"); }
void function(final FilePath target) throws IOException, InterruptedException { if(this.channel != target.channel) { throw new IOException(STR); }
/** * Moves all the contents of this directory into the specified directory, then delete this directory itself. * * @since 1.308. */
Moves all the contents of this directory into the specified directory, then delete this directory itself
moveAllChildrenTo
{ "repo_name": "sumitk1/jenkins", "path": "core/src/main/java/hudson/FilePath.java", "license": "mit", "size": 75848 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
104,113
static final Map<byte[], byte[]> putCp(Map<byte[], byte[]> map, String cp) { return putString(map, CP, cp); }
static final Map<byte[], byte[]> putCp(Map<byte[], byte[]> map, String cp) { return putString(map, CP, cp); }
/** * put the CP in the map * @param map * @param cp * @return */
put the CP in the map
putCp
{ "repo_name": "beeldengeluid/zieook", "path": "backend/zieook-api/zieook-api-data/src/main/java/nl/gridline/zieook/model/ModelConstants.java", "license": "apache-2.0", "size": 18942 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,965,930
protected String makeSQL(String sqlTemplate, String tableName, String... replacements) { String sql = sqlTemplate; sql = sql.replace(StatementMapper.TABLE_NAME, tableName); for (int i = 0; i < replacements.length; i++) { if (replacements.length < i + 1) { break; } sql = sql.replace(replacements[i], replacements[i+1]); i++; } // put in the select replacement last in case it was already replaced sql = sql.replace(StatementMapper.SELECT, "*"); return sql; }
String function(String sqlTemplate, String tableName, String... replacements) { String sql = sqlTemplate; sql = sql.replace(StatementMapper.TABLE_NAME, tableName); for (int i = 0; i < replacements.length; i++) { if (replacements.length < i + 1) { break; } sql = sql.replace(replacements[i], replacements[i+1]); i++; } sql = sql.replace(StatementMapper.SELECT, "*"); return sql; }
/** * Make SQL from a template * * @param sqlTemplate pass in an SQL template (one of the BASIC_* ones or make your own), * the replacement names will be replaced with the replacement values * @param tableName the name of the table for this SQL * @param replacements a sequence of replacement names (probably {@link #COLUMNS}, {@link #WHERE}, etc.) and values, * alternating like so: name,value,name,value * @return the SQL with all replacements made */
Make SQL from a template
makeSQL
{ "repo_name": "prince1a/genericdao", "path": "src/main/java/org/sakaiproject/genericdao/springjdbc/JdbcGenericDao.java", "license": "apache-2.0", "size": 75730 }
[ "org.sakaiproject.genericdao.api.mappers.StatementMapper" ]
import org.sakaiproject.genericdao.api.mappers.StatementMapper;
import org.sakaiproject.genericdao.api.mappers.*;
[ "org.sakaiproject.genericdao" ]
org.sakaiproject.genericdao;
1,034,219
public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); }
void function() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); }
/** * Queue contains all elements, in traversal order, of successful addAll */
Queue contains all elements, in traversal order, of successful addAll
testAddAll5
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "test/java/util/concurrent/tck/ConcurrentLinkedQueueTest.java", "license": "gpl-2.0", "size": 16383 }
[ "java.util.Arrays", "java.util.concurrent.ConcurrentLinkedQueue" ]
import java.util.Arrays; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,114,981
public OneResponse chown(int uid, int gid) { return chown(client, id, uid, gid); }
OneResponse function(int uid, int gid) { return chown(client, id, uid, gid); }
/** * Changes the owner/group * * @param uid The new owner user ID. Set it to -1 to leave the current one. * @param gid The new group ID. Set it to -1 to leave the current one. * @return If an error occurs the error message contains the reason. */
Changes the owner/group
chown
{ "repo_name": "hsanjuan/one", "path": "src/oca/java/src/org/opennebula/client/marketplace/MarketPlace.java", "license": "apache-2.0", "size": 11388 }
[ "org.opennebula.client.OneResponse" ]
import org.opennebula.client.OneResponse;
import org.opennebula.client.*;
[ "org.opennebula.client" ]
org.opennebula.client;
1,995,909
private void processDataLinks(List<Draft2DataLink> dataLinks, ApplicationPort port, Draft2Job job, boolean strip) { for (Draft2DataLink dataLink : dataLinks) { String source = dataLink.getSource(); String destination = dataLink.getDestination(); String scatter = null; if (job.getId().contains(Draft2SchemaHelper.PORT_ID_SEPARATOR)) { String remaining = job.getId().substring(job.getId().lastIndexOf(".") + 1); String mod = job.getId().substring(0, job.getId().lastIndexOf(".")); if (mod.contains(".")) { mod = mod.substring(mod.lastIndexOf(".") + 1); } if (strip) { mod = remaining; } else { mod = mod + remaining; } scatter = Draft2SchemaHelper.ID_START + mod + Draft2SchemaHelper.PORT_ID_SEPARATOR + Draft2SchemaHelper.normalizeId(port.getId()); } else { scatter = port.getId(); } // TODO fix if ((source.equals(scatter) || destination.equals(scatter)) && (dataLink.getScattered() == null || !dataLink.getScattered())) { dataLink.setScattered(port.getScatter()); } } }
void function(List<Draft2DataLink> dataLinks, ApplicationPort port, Draft2Job job, boolean strip) { for (Draft2DataLink dataLink : dataLinks) { String source = dataLink.getSource(); String destination = dataLink.getDestination(); String scatter = null; if (job.getId().contains(Draft2SchemaHelper.PORT_ID_SEPARATOR)) { String remaining = job.getId().substring(job.getId().lastIndexOf(".") + 1); String mod = job.getId().substring(0, job.getId().lastIndexOf(".")); if (mod.contains(".")) { mod = mod.substring(mod.lastIndexOf(".") + 1); } if (strip) { mod = remaining; } else { mod = mod + remaining; } scatter = Draft2SchemaHelper.ID_START + mod + Draft2SchemaHelper.PORT_ID_SEPARATOR + Draft2SchemaHelper.normalizeId(port.getId()); } else { scatter = port.getId(); } if ((source.equals(scatter) destination.equals(scatter)) && (dataLink.getScattered() == null !dataLink.getScattered())) { dataLink.setScattered(port.getScatter()); } } }
/** * Process data links */
Process data links
processDataLinks
{ "repo_name": "markosbg/debug", "path": "rabix-bindings-draft2/src/main/java/org/rabix/bindings/draft2/Draft2JobProcessor.java", "license": "apache-2.0", "size": 9348 }
[ "java.util.List", "org.rabix.bindings.draft2.bean.Draft2DataLink", "org.rabix.bindings.draft2.bean.Draft2Job", "org.rabix.bindings.draft2.helper.Draft2SchemaHelper", "org.rabix.bindings.model.ApplicationPort" ]
import java.util.List; import org.rabix.bindings.draft2.bean.Draft2DataLink; import org.rabix.bindings.draft2.bean.Draft2Job; import org.rabix.bindings.draft2.helper.Draft2SchemaHelper; import org.rabix.bindings.model.ApplicationPort;
import java.util.*; import org.rabix.bindings.draft2.bean.*; import org.rabix.bindings.draft2.helper.*; import org.rabix.bindings.model.*;
[ "java.util", "org.rabix.bindings" ]
java.util; org.rabix.bindings;
182,032
@Test public void testNewThreadNoExHandler() { ThreadFactory wrapped = EasyMock.createMock(ThreadFactory.class); Runnable r = EasyMock.createMock(Runnable.class); Thread.UncaughtExceptionHandler handler = EasyMock .createMock(Thread.UncaughtExceptionHandler.class); Thread t = new Thread(); t.setUncaughtExceptionHandler(handler); EasyMock.expect(wrapped.newThread(r)).andReturn(t); EasyMock.replay(wrapped, r, handler); BasicThreadFactory factory = builder.wrappedFactory(wrapped).build(); assertSame("Wrong thread", t, factory.newThread(r)); assertEquals("Wrong exception handler", handler, t .getUncaughtExceptionHandler()); EasyMock.verify(wrapped, r, handler); }
void function() { ThreadFactory wrapped = EasyMock.createMock(ThreadFactory.class); Runnable r = EasyMock.createMock(Runnable.class); Thread.UncaughtExceptionHandler handler = EasyMock .createMock(Thread.UncaughtExceptionHandler.class); Thread t = new Thread(); t.setUncaughtExceptionHandler(handler); EasyMock.expect(wrapped.newThread(r)).andReturn(t); EasyMock.replay(wrapped, r, handler); BasicThreadFactory factory = builder.wrappedFactory(wrapped).build(); assertSame(STR, t, factory.newThread(r)); assertEquals(STR, handler, t .getUncaughtExceptionHandler()); EasyMock.verify(wrapped, r, handler); }
/** * Tests whether the original exception hander is not touched if none is * specified. */
Tests whether the original exception hander is not touched if none is specified
testNewThreadNoExHandler
{ "repo_name": "SpoonLabs/astor", "path": "examples/Lang-issue-428/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java", "license": "gpl-2.0", "size": 11668 }
[ "java.util.concurrent.ThreadFactory", "org.easymock.EasyMock", "org.junit.Assert" ]
import java.util.concurrent.ThreadFactory; import org.easymock.EasyMock; import org.junit.Assert;
import java.util.concurrent.*; import org.easymock.*; import org.junit.*;
[ "java.util", "org.easymock", "org.junit" ]
java.util; org.easymock; org.junit;
1,598,528
@Override public void onComponentTagBody(final Component component, final MarkupStream markupStream, final ComponentTag openTag) { // Skip the components body. It will be replaced by the associated markup or fragment if (markupStream.getPreviousTag().isOpen()) { markupStream.skipRawMarkup(); if (markupStream.get().closes(openTag) == false) { throw new MarkupException( markupStream, "Close tag not found for tag: " + openTag.toString() + ". For " + Classes.simpleName(component.getClass()) + " Components only raw markup is allow in between the tags but not other Wicket Component." + ". Component: " + component.toString()); } } }
void function(final Component component, final MarkupStream markupStream, final ComponentTag openTag) { if (markupStream.getPreviousTag().isOpen()) { markupStream.skipRawMarkup(); if (markupStream.get().closes(openTag) == false) { throw new MarkupException( markupStream, STR + openTag.toString() + STR + Classes.simpleName(component.getClass()) + STR + STR + component.toString()); } } }
/** * Skip the components body which is expected to be raw markup only (no wicket components). It * will be replaced by the associated markup. */
Skip the components body which is expected to be raw markup only (no wicket components). It will be replaced by the associated markup
onComponentTagBody
{ "repo_name": "topicusonderwijs/wicket", "path": "wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AbstractMarkupSourcingStrategy.java", "license": "apache-2.0", "size": 5097 }
[ "org.apache.wicket.Component", "org.apache.wicket.markup.ComponentTag", "org.apache.wicket.markup.MarkupException", "org.apache.wicket.markup.MarkupStream", "org.apache.wicket.util.lang.Classes" ]
import org.apache.wicket.Component; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupException; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.util.lang.Classes;
import org.apache.wicket.*; import org.apache.wicket.markup.*; import org.apache.wicket.util.lang.*;
[ "org.apache.wicket" ]
org.apache.wicket;
1,943,438
public void Move_Function_00D(Pokemon d, Pokemon a, int damage){ // TODO -> időjárás.. d.setHp(d.getHp()-damage); d.setFreeze(1); }
void function(Pokemon d, Pokemon a, int damage){ d.setHp(d.getHp()-damage); d.setFreeze(1); }
/** * Function code: 00D. * Freezes the target. Always hits in hail. * */
Function code: 00D. Freezes the target. Always hits in hail
Move_Function_00D
{ "repo_name": "Adiss/ProgTechPokemon", "path": "src/main/java/hu/experiment_team/Move_Functions.java", "license": "apache-2.0", "size": 12961 }
[ "hu.experiment_team.models.Pokemon" ]
import hu.experiment_team.models.Pokemon;
import hu.experiment_team.models.*;
[ "hu.experiment_team.models" ]
hu.experiment_team.models;
1,406,791
@Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Exploitation.class)) { case ExploitationPackage.EXPLOITATION__NAME: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case ExploitationPackage.EXPLOITATION__RESSOURCE: case ExploitationPackage.EXPLOITATION__SURFACE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); }
void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Exploitation.class)) { case ExploitationPackage.EXPLOITATION__NAME: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case ExploitationPackage.EXPLOITATION__RESSOURCE: case ExploitationPackage.EXPLOITATION__SURFACE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); }
/** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>.
notifyChanged
{ "repo_name": "JeanHany/farmingdsl2", "path": "fr.esir.lsi.langage.edit/src/exploitation/provider/ExploitationItemProvider.java", "license": "mit", "size": 6553 }
[ "org.eclipse.emf.common.notify.Notification", "org.eclipse.emf.edit.provider.ViewerNotification" ]
import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,796,073
public static void subtractItemFromInvetory(Weapon wep) { int quantity = getItemQuantity(wep); if (quantity == 1) { SQLiteDatabase db = DatabaseManager.getInstance().openDatabase(); db.delete(TABLE_INV, KEY_NAME + " = ?", new String[] { String.valueOf(wep.getName()) }); DatabaseManager.getInstance().closeDatabase(); // Closing database connection } else if (quantity > 1){ SQLiteDatabase db = DatabaseManager.getInstance().openDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, wep.getName()); values.put(QUANTITY, quantity - 1); values.put(TYPE, "WEP"); // Inserting Row db.update(TABLE_INV, values, KEY_NAME + " = ?", new String[]{String.valueOf(wep.getName())}); DatabaseManager.getInstance().closeDatabase(); // Closing database connection } }
static void function(Weapon wep) { int quantity = getItemQuantity(wep); if (quantity == 1) { SQLiteDatabase db = DatabaseManager.getInstance().openDatabase(); db.delete(TABLE_INV, KEY_NAME + STR, new String[] { String.valueOf(wep.getName()) }); DatabaseManager.getInstance().closeDatabase(); } else if (quantity > 1){ SQLiteDatabase db = DatabaseManager.getInstance().openDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, wep.getName()); values.put(QUANTITY, quantity - 1); values.put(TYPE, "WEP"); db.update(TABLE_INV, values, KEY_NAME + STR, new String[]{String.valueOf(wep.getName())}); DatabaseManager.getInstance().closeDatabase(); } }
/** * Removes a singular weapon the inventory * This will subtract a single instance of the weapon * If there is a singular weapon in quantity the row will be removed from the table * @param wep Weapon to be removed */
Removes a singular weapon the inventory This will subtract a single instance of the weapon If there is a singular weapon in quantity the row will be removed from the table
subtractItemFromInvetory
{ "repo_name": "Timmy-T/BarQuest", "path": "app/src/main/java/attackontinytim/barquest/Database/InventoryRepo.java", "license": "lgpl-2.1", "size": 9702 }
[ "android.content.ContentValues", "android.database.sqlite.SQLiteDatabase" ]
import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase;
import android.content.*; import android.database.sqlite.*;
[ "android.content", "android.database" ]
android.content; android.database;
1,328,124
public void registerAPanel (APanel panel);
void function (APanel panel);
/** * Register APanel * @param panel panel */
Register APanel
registerAPanel
{ "repo_name": "erpcya/adempierePOS", "path": "client/src/org/compiere/grid/APanelTab.java", "license": "gpl-2.0", "size": 1990 }
[ "org.compiere.apps.APanel" ]
import org.compiere.apps.APanel;
import org.compiere.apps.*;
[ "org.compiere.apps" ]
org.compiere.apps;
1,350,453
try { OutputEventAdaptorFactory wso2EventAdaptorFactory = new WSO2EventAdaptorFactory(); context.getBundleContext().registerService(OutputEventAdaptorFactory.class.getName(), wso2EventAdaptorFactory, null); if (log.isDebugEnabled()) { log.debug("Successfully deployed the output WSO2Event adaptor service"); } } catch (RuntimeException e) { log.error("Can not create the output WSO2Event adaptor service ", e); } }
try { OutputEventAdaptorFactory wso2EventAdaptorFactory = new WSO2EventAdaptorFactory(); context.getBundleContext().registerService(OutputEventAdaptorFactory.class.getName(), wso2EventAdaptorFactory, null); if (log.isDebugEnabled()) { log.debug(STR); } } catch (RuntimeException e) { log.error(STR, e); } }
/** * initialize the agent service here service here. * * @param context */
initialize the agent service here service here
activate
{ "repo_name": "lankavitharana/carbon-event-processing", "path": "components/adaptors/event-output-adaptor/org.wso2.carbon.event.output.adaptor.wso2event/src/main/java/org/wso2/carbon/event/output/adaptor/wso2event/internal/ds/WSO2EventAdaptorServiceDS.java", "license": "apache-2.0", "size": 2291 }
[ "org.wso2.carbon.event.output.adaptor.core.OutputEventAdaptorFactory", "org.wso2.carbon.event.output.adaptor.wso2event.WSO2EventAdaptorFactory" ]
import org.wso2.carbon.event.output.adaptor.core.OutputEventAdaptorFactory; import org.wso2.carbon.event.output.adaptor.wso2event.WSO2EventAdaptorFactory;
import org.wso2.carbon.event.output.adaptor.core.*; import org.wso2.carbon.event.output.adaptor.wso2event.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
548,253
public static List<StoreFileScanner> getScannersForStoreFiles( Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, boolean isCompaction) throws IOException { return getScannersForStoreFiles(files, cacheBlocks, usePread, isCompaction, null); }
static List<StoreFileScanner> function( Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, boolean isCompaction) throws IOException { return getScannersForStoreFiles(files, cacheBlocks, usePread, isCompaction, null); }
/** * Return an array of scanners corresponding to the given set of store files. */
Return an array of scanners corresponding to the given set of store files
getScannersForStoreFiles
{ "repo_name": "indi60/hbase-pmc", "path": "target/hbase-0.94.1/hbase-0.94.1/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java", "license": "apache-2.0", "size": 12176 }
[ "java.io.IOException", "java.util.Collection", "java.util.List" ]
import java.io.IOException; import java.util.Collection; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,875,268
public GroupId findGroup(DbSession dbSession, GroupWsRef ref) { if (ref.hasId()) { GroupDto group = dbClient.groupDao().selectById(dbSession, ref.getId()); checkFound(group, "No group with id '%s'", ref.getId()); return GroupId.from(group); } OrganizationDto org = findOrganizationByKey(dbSession, ref.getOrganizationKey()); Optional<GroupDto> group = dbClient.groupDao().selectByName(dbSession, org.getUuid(), ref.getName()); checkFoundWithOptional(group, "No group with name '%s' in organization '%s'", ref.getName(), org.getKey()); return GroupId.from(group.get()); }
GroupId function(DbSession dbSession, GroupWsRef ref) { if (ref.hasId()) { GroupDto group = dbClient.groupDao().selectById(dbSession, ref.getId()); checkFound(group, STR, ref.getId()); return GroupId.from(group); } OrganizationDto org = findOrganizationByKey(dbSession, ref.getOrganizationKey()); Optional<GroupDto> group = dbClient.groupDao().selectByName(dbSession, org.getUuid(), ref.getName()); checkFoundWithOptional(group, STR, ref.getName(), org.getKey()); return GroupId.from(group.get()); }
/** * Finds a user group by its reference. If organization is not defined then group * is searched in default organization. * * @return non-null group * @throws NotFoundException if the requested group does not exist * @throws NotFoundException if the requested group is Anyone */
Finds a user group by its reference. If organization is not defined then group is searched in default organization
findGroup
{ "repo_name": "lbndev/sonarqube", "path": "server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java", "license": "lgpl-3.0", "size": 7896 }
[ "java.util.Optional", "org.sonar.db.DbSession", "org.sonar.db.organization.OrganizationDto", "org.sonar.db.user.GroupDto", "org.sonar.server.ws.WsUtils" ]
import java.util.Optional; import org.sonar.db.DbSession; import org.sonar.db.organization.OrganizationDto; import org.sonar.db.user.GroupDto; import org.sonar.server.ws.WsUtils;
import java.util.*; import org.sonar.db.*; import org.sonar.db.organization.*; import org.sonar.db.user.*; import org.sonar.server.ws.*;
[ "java.util", "org.sonar.db", "org.sonar.server" ]
java.util; org.sonar.db; org.sonar.server;
367,217
private void applyDeleteReceiver(NotificationCompat.Builder builder) { if (clearReceiver == null) return; Intent intent = new Intent(context, clearReceiver) .setAction(options.getIdStr()) .putExtra(Options.EXTRA, options.toString()); PendingIntent deleteIntent = PendingIntent.getBroadcast( context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(deleteIntent); }
void function(NotificationCompat.Builder builder) { if (clearReceiver == null) return; Intent intent = new Intent(context, clearReceiver) .setAction(options.getIdStr()) .putExtra(Options.EXTRA, options.toString()); PendingIntent deleteIntent = PendingIntent.getBroadcast( context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(deleteIntent); }
/** * Set intent to handle the delete event. Will clean up some persisted * preferences. * * @param builder * Local notification builder instance */
Set intent to handle the delete event. Will clean up some persisted preferences
applyDeleteReceiver
{ "repo_name": "PhantomOfTheOpera/cordova-plugin-local-notifications-EASTA", "path": "src/android/notification/Builder.java", "license": "apache-2.0", "size": 8475 }
[ "android.app.PendingIntent", "android.content.Intent", "android.support.v4.app.NotificationCompat" ]
import android.app.PendingIntent; import android.content.Intent; import android.support.v4.app.NotificationCompat;
import android.app.*; import android.content.*; import android.support.v4.app.*;
[ "android.app", "android.content", "android.support" ]
android.app; android.content; android.support;
2,527,802
assertThatClassIsImmutableBaseClass(Key.class); // Will be a long based key, class is private so cannot be // accessed directly Key longKey = Key.of(0xabcdefL, NetTestTools.APP_ID); assertThatClassIsImmutable(longKey.getClass()); // Will be a String based key, class is private so cannot be // accessed directly. Key stringKey = Key.of("some key", NetTestTools.APP_ID); assertThatClassIsImmutable(stringKey.getClass()); }
assertThatClassIsImmutableBaseClass(Key.class); Key longKey = Key.of(0xabcdefL, NetTestTools.APP_ID); assertThatClassIsImmutable(longKey.getClass()); Key stringKey = Key.of(STR, NetTestTools.APP_ID); assertThatClassIsImmutable(stringKey.getClass()); }
/** * Tests that keys are properly immutable. */
Tests that keys are properly immutable
keysAreImmutable
{ "repo_name": "opennetworkinglab/onos", "path": "core/api/src/test/java/org/onosproject/net/intent/KeyTest.java", "license": "apache-2.0", "size": 7012 }
[ "org.onlab.junit.ImmutableClassChecker", "org.onosproject.net.NetTestTools" ]
import org.onlab.junit.ImmutableClassChecker; import org.onosproject.net.NetTestTools;
import org.onlab.junit.*; import org.onosproject.net.*;
[ "org.onlab.junit", "org.onosproject.net" ]
org.onlab.junit; org.onosproject.net;
307,003
protected void addInput__iHMIOrderPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_CtrlUnit67_Input__iHMIOrder_feature"), getString("_UI_PropertyDescriptor_description", "_UI_CtrlUnit67_Input__iHMIOrder_feature", "_UI_CtrlUnit67_type"), WTSpecPackage.eINSTANCE.getCtrlUnit67_Input__iHMIOrder(), true, false, true, null, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), WTSpecPackage.eINSTANCE.getCtrlUnit67_Input__iHMIOrder(), true, false, true, null, null, null)); }
/** * This adds a property descriptor for the Input iHMI Order feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Input iHMI Order feature.
addInput__iHMIOrderPropertyDescriptor
{ "repo_name": "FTSRG/mondo-collab-framework", "path": "archive/workspaceTracker/VA/ikerlanEMF.edit/src/eu/mondo/collaboration/operationtracemodel/example/WTSpec/provider/CtrlUnit67ItemProvider.java", "license": "epl-1.0", "size": 8520 }
[ "eu.mondo.collaboration.operationtracemodel.example.WTSpec", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory" ]
import eu.mondo.collaboration.operationtracemodel.example.WTSpec; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import eu.mondo.collaboration.operationtracemodel.example.*; import org.eclipse.emf.edit.provider.*;
[ "eu.mondo.collaboration", "org.eclipse.emf" ]
eu.mondo.collaboration; org.eclipse.emf;
315,277
void addVariable(Node variable);
void addVariable(Node variable);
/** * Adds the given variable to the data set. * * @throws IllegalArgumentException if the variable is neither continuous * nor discrete. */
Adds the given variable to the data set
addVariable
{ "repo_name": "jmogarrio/tetrad", "path": "tetrad-lib/src/main/java/edu/cmu/tetrad/data/DataSet.java", "license": "gpl-2.0", "size": 10842 }
[ "edu.cmu.tetrad.graph.Node" ]
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetrad.graph.*;
[ "edu.cmu.tetrad" ]
edu.cmu.tetrad;
1,197,894
public void setMusicVolume(float volume) { SoundStore.get().setMusicVolume(volume); }
void function(float volume) { SoundStore.get().setMusicVolume(volume); }
/** * Set the default volume for music * @param volume the new default value for music volume */
Set the default volume for music
setMusicVolume
{ "repo_name": "CyboticCatfish/code404", "path": "CodingGame/lib/slick/src/org/newdawn/slick/GameContainer.java", "license": "gpl-2.0", "size": 22558 }
[ "org.newdawn.slick.openal.SoundStore" ]
import org.newdawn.slick.openal.SoundStore;
import org.newdawn.slick.openal.*;
[ "org.newdawn.slick" ]
org.newdawn.slick;
787,710
public List<Double> setsAggregated(WellSetDouble set, double[] weights) { Preconditions.checkNotNull(set, "The well set cannot be null."); Preconditions.checkNotNull(weights, "Weights array cannot be null."); List<Double> aggregated = new ArrayList<Double>(); for (WellDouble well : set) { List<Double> input = well.data(); for(int i = 0; i < input.size(); i++) { aggregated.add(input.get(i) * weights[i]); } } return calculate(aggregated); }
List<Double> function(WellSetDouble set, double[] weights) { Preconditions.checkNotNull(set, STR); Preconditions.checkNotNull(weights, STR); List<Double> aggregated = new ArrayList<Double>(); for (WellDouble well : set) { List<Double> input = well.data(); for(int i = 0; i < input.size(); i++) { aggregated.add(input.get(i) * weights[i]); } } return calculate(aggregated); }
/** * Returns the aggregated weighted statistic for the well set. * @param WellSetDouble the well set * @param double[] weights for the data set * @return the aggregated results */
Returns the aggregated weighted statistic for the well set
setsAggregated
{ "repo_name": "jessemull/MicroFlex", "path": "src/main/java/com/github/jessemull/microflex/doubleflex/stat/DescriptiveStatisticListDoubleWeights.java", "license": "apache-2.0", "size": 26697 }
[ "com.github.jessemull.microflex.doubleflex.plate.WellDouble", "com.github.jessemull.microflex.doubleflex.plate.WellSetDouble", "com.google.common.base.Preconditions", "java.util.ArrayList", "java.util.List" ]
import com.github.jessemull.microflex.doubleflex.plate.WellDouble; import com.github.jessemull.microflex.doubleflex.plate.WellSetDouble; import com.google.common.base.Preconditions; import java.util.ArrayList; import java.util.List;
import com.github.jessemull.microflex.doubleflex.plate.*; import com.google.common.base.*; import java.util.*;
[ "com.github.jessemull", "com.google.common", "java.util" ]
com.github.jessemull; com.google.common; java.util;
2,276,086
@Exported @QuickSilver public RunT getLastSuccessfulBuild() { return (RunT)Permalink.LAST_SUCCESSFUL_BUILD.resolve(this); }
RunT function() { return (RunT)Permalink.LAST_SUCCESSFUL_BUILD.resolve(this); }
/** * Returns the last successful build, if any. Otherwise null. A successful build * would include either {@link Result#SUCCESS} or {@link Result#UNSTABLE}. * * @see #getLastStableBuild() */
Returns the last successful build, if any. Otherwise null. A successful build would include either <code>Result#SUCCESS</code> or <code>Result#UNSTABLE</code>
getLastSuccessfulBuild
{ "repo_name": "olivergondza/jenkins", "path": "core/src/main/java/hudson/model/Job.java", "license": "mit", "size": 53642 }
[ "hudson.model.PermalinkProjectAction" ]
import hudson.model.PermalinkProjectAction;
import hudson.model.*;
[ "hudson.model" ]
hudson.model;
301,012
public final boolean isMatched(AnalyzedToken token) { boolean matched = patternToken.isMatched(token); if (patternToken.hasAndGroup()) { andGroupCheck[0] |= matched; } return matched; }
final boolean function(AnalyzedToken token) { boolean matched = patternToken.isMatched(token); if (patternToken.hasAndGroup()) { andGroupCheck[0] = matched; } return matched; }
/** * Checks whether the rule element matches the token given as a parameter. * * @param token AnalyzedToken to check matching against * @return True if token matches, false otherwise. */
Checks whether the rule element matches the token given as a parameter
isMatched
{ "repo_name": "jimregan/languagetool", "path": "languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternTokenMatcher.java", "license": "lgpl-2.1", "size": 4917 }
[ "org.languagetool.AnalyzedToken" ]
import org.languagetool.AnalyzedToken;
import org.languagetool.*;
[ "org.languagetool" ]
org.languagetool;
982,471
@Override public boolean onTouch(View v, MotionEvent event) { if( event.getAction() == MotionEvent.ACTION_UP ) { TimePickerFragment picker = new TimePickerFragment(); picker.show(act.getFragmentManager(), "timePickerOnTouchListener"); return true; } // The action is not consumed by the function because it was not a pressed-released touch. return false; }
boolean function(View v, MotionEvent event) { if( event.getAction() == MotionEvent.ACTION_UP ) { TimePickerFragment picker = new TimePickerFragment(); picker.show(act.getFragmentManager(), STR); return true; } return false; }
/** * Called when a touch event is dispatched to a view. This allows listeners to * get a chance to respond before the target view. * * @param v The view the touch event has been dispatched to. * @param event The MotionEvent object containing full information about * the event. * @return True if the listener has consumed the event, false otherwise. */
Called when a touch event is dispatched to a view. This allows listeners to get a chance to respond before the target view
onTouch
{ "repo_name": "Mithrandir21/RelationshipPoints", "path": "app/src/main/java/com/bahram/relationshippoints/activities/pointsActivities/GivingPoints/TimePickerOnTouchListener.java", "license": "gpl-3.0", "size": 2823 }
[ "android.view.MotionEvent", "android.view.View" ]
import android.view.MotionEvent; import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
104,810
public MultipartFile getIdCardPicFile() { return idCardPicFile; }
MultipartFile function() { return idCardPicFile; }
/** * Gets the id card pic file. * * @return the id card pic file */
Gets the id card pic file
getIdCardPicFile
{ "repo_name": "8090boy/gomall.la", "path": "legendshop_model/src/java/com/legendshop/model/entity/AbstractShopDetail.java", "license": "apache-2.0", "size": 19411 }
[ "org.springframework.web.multipart.MultipartFile" ]
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.*;
[ "org.springframework.web" ]
org.springframework.web;
2,912,649
public int execCONF(byte[] data) throws IOException { if (data != null) { return sendCommand(CMD_CONF, Base64.encodeBase64StringUnChunked(data)); } else { return sendCommand(CMD_CONF, ""); // perhaps "=" or just sendCommand(String)? } }
int function(byte[] data) throws IOException { if (data != null) { return sendCommand(CMD_CONF, Base64.encodeBase64StringUnChunked(data)); } else { return sendCommand(CMD_CONF, ""); } }
/** * Send the CONF command with the specified data. * @param data The data to send with the command. * @return server reply. * @throws IOException If an I/O error occurs while sending * the command. * @since 3.0 */
Send the CONF command with the specified data
execCONF
{ "repo_name": "grtlinux/KIEA_JAVA7", "path": "KIEA_JAVA7/src/tain/kr/com/commons/net/v01/ftp/FTPSClient.java", "license": "gpl-3.0", "size": 33164 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
633,406
public final ConversionService getConversionService() { return this.conversionService; }
final ConversionService function() { return this.conversionService; }
/** * Return the ConversionService which will apply to every DataBinder. */
Return the ConversionService which will apply to every DataBinder
getConversionService
{ "repo_name": "kingtang/spring-learn", "path": "spring-web/src/main/java/org/springframework/web/bind/support/ConfigurableWebBindingInitializer.java", "license": "gpl-3.0", "size": 7210 }
[ "org.springframework.core.convert.ConversionService" ]
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.*;
[ "org.springframework.core" ]
org.springframework.core;
160,565
public Map<String, StringMapAdaptorTable> getChildRelationshipMap() { return fChildRelations; }
Map<String, StringMapAdaptorTable> function() { return fChildRelations; }
/** * Gets the <code>Child Relationship Map</code> being used for SIF data list mapping operations * @return The <code>Map</code> being used for SIF data list mapping operations */
Gets the <code>Child Relationship Map</code> being used for SIF data list mapping operations
getChildRelationshipMap
{ "repo_name": "open-adk/OpenADK-java", "path": "adk-library/src/main/java/openadk/library/tools/mapping/ComplexStringMapAdaptor.java", "license": "apache-2.0", "size": 2273 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
611,105
int deleteByExample(RoleExample example);
int deleteByExample(RoleExample example);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_security_role * * @mbggenerated Fri Sep 06 15:12:05 CST 2013 */
This method was generated by MyBatis Generator. This method corresponds to the database table t_security_role
deleteByExample
{ "repo_name": "hequn/CTBRI_BeaconAccount", "path": "src/main/java/com/bupt/core/system/dao/RoleMapper.java", "license": "mit", "size": 2991 }
[ "com.bupt.core.system.model.RoleExample" ]
import com.bupt.core.system.model.RoleExample;
import com.bupt.core.system.model.*;
[ "com.bupt.core" ]
com.bupt.core;
580,246
private void setColumnResizable(Item column, boolean resizable) { if (column instanceof TableColumn) { ((TableColumn) column).setResizable(resizable); } else if (column instanceof TreeColumn) { ((TreeColumn) column).setResizable(resizable); } }
void function(Item column, boolean resizable) { if (column instanceof TableColumn) { ((TableColumn) column).setResizable(resizable); } else if (column instanceof TreeColumn) { ((TreeColumn) column).setResizable(resizable); } }
/** * Sets the {@link TreeColumn} or {@link TableColumn} resizable. * * @param column * Column * @param resizable * Resizable or not */
Sets the <code>TreeColumn</code> or <code>TableColumn</code> resizable
setColumnResizable
{ "repo_name": "pbouillet/inspectIT", "path": "inspectIT/src/info/novatec/inspectit/rcp/handlers/ShowHideColumnsHandler.java", "license": "agpl-3.0", "size": 9320 }
[ "org.eclipse.swt.widgets.Item", "org.eclipse.swt.widgets.TableColumn", "org.eclipse.swt.widgets.TreeColumn" ]
import org.eclipse.swt.widgets.Item; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,889,364
private void load() { Preferences prefs = getPrefsNode(); String pinCode = prefs.get(PIN_CODE, null); if (this.pinCode.equals(pinCode)) { this.accessToken = prefs.get(ACCESS_TOKEN, null); } }
void function() { Preferences prefs = getPrefsNode(); String pinCode = prefs.get(PIN_CODE, null); if (this.pinCode.equals(pinCode)) { this.accessToken = prefs.get(ACCESS_TOKEN, null); } }
/** * Only load the accessToken if the pinCode that was saved with it matches the current pinCode. Otherwise, we * could continue to try to use an accessToken that does not match the credentials in openhab.cfg. */
Only load the accessToken if the pinCode that was saved with it matches the current pinCode. Otherwise, we could continue to try to use an accessToken that does not match the credentials in openhab.cfg
load
{ "repo_name": "swatchy2dot0/openhab", "path": "bundles/binding/org.openhab.binding.nest/src/main/java/org/openhab/binding/nest/internal/NestBinding.java", "license": "epl-1.0", "size": 22611 }
[ "java.util.prefs.Preferences" ]
import java.util.prefs.Preferences;
import java.util.prefs.*;
[ "java.util" ]
java.util;
598,396
public ICi getRootPolicy() { Path<String> path = new Path<String>(this.rootPolicyAlias); ICi ci = modelService.findCi(path); return (ci); }
ICi function() { Path<String> path = new Path<String>(this.rootPolicyAlias); ICi ci = modelService.findCi(path); return (ci); }
/** * Root getters. */
Root getters
getRootPolicy
{ "repo_name": "afnet/OneCMDBwithMaven", "path": "src/org.onecmdb.core/src/main/java/org/onecmdb/core/internal/policy/PolicyService.java", "license": "gpl-2.0", "size": 6898 }
[ "org.onecmdb.core.ICi", "org.onecmdb.core.internal.model.Path" ]
import org.onecmdb.core.ICi; import org.onecmdb.core.internal.model.Path;
import org.onecmdb.core.*; import org.onecmdb.core.internal.model.*;
[ "org.onecmdb.core" ]
org.onecmdb.core;
1,678,860
public void showMessage(final MessageTyp typ, final String message) { // type // 0 // == // info, // type 1 == // warning, type // 2 == error switch(typ) { case INFO: JOptionPane.showMessageDialog(null, message, "Information", JOptionPane.INFORMATION_MESSAGE); break; case WARNING: JOptionPane.showMessageDialog(null, message, "Warning", JOptionPane.WARNING_MESSAGE); break; case ERROR: JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE); break; } }
void function(final MessageTyp typ, final String message) { switch(typ) { case INFO: JOptionPane.showMessageDialog(null, message, STR, JOptionPane.INFORMATION_MESSAGE); break; case WARNING: JOptionPane.showMessageDialog(null, message, STR, JOptionPane.WARNING_MESSAGE); break; case ERROR: JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE); break; } }
/** * Funktion welche ermueglich Nachrichten in der GUI anzuzeigen. Gibt * anderen Programmteilen ueber den MulticastController die Mueglichkeit * Informations, Warnungs und Errormeldungen auf dem GUI auszugeben. * * @param typ * Art der Nachricht (INFO / WARNING / ERROR) * @param message * Die eigentliche Nachricht welche angezeigt werden soll */
Funktion welche ermueglich Nachrichten in der GUI anzuzeigen. Gibt anderen Programmteilen ueber den MulticastController die Mueglichkeit Informations, Warnungs und Errormeldungen auf dem GUI auszugeben
showMessage
{ "repo_name": "autarchprinceps/MultiCastor", "path": "ourmulitcastor/multicastor/src/multicastor/controller/ViewController.java", "license": "gpl-3.0", "size": 102064 }
[ "javax.swing.JOptionPane" ]
import javax.swing.JOptionPane;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
234,224
@Test public void whenHelloIsNotPalindrome() throws Exception { String wordForCheck = "Hello"; InputStream input = new ByteArrayInputStream(wordForCheck.getBytes()); FiveLetters word = new FiveLetters(); boolean result = word.checkWord(input); assertThat(result, is(false)); }
void function() throws Exception { String wordForCheck = "Hello"; InputStream input = new ByteArrayInputStream(wordForCheck.getBytes()); FiveLetters word = new FiveLetters(); boolean result = word.checkWord(input); assertThat(result, is(false)); }
/** * Test for check, this word is palindrome? * Hello is not palindrome. * @throws Exception - Exception. */
Test for check, this word is palindrome? Hello is not palindrome
whenHelloIsNotPalindrome
{ "repo_name": "anton415/Job4j", "path": "Pre-middle/Part_1_Input_Output/src/test/java/ru/aserdyuchenko/FiveLettersTest.java", "license": "apache-2.0", "size": 1627 }
[ "java.io.ByteArrayInputStream", "java.io.InputStream", "org.hamcrest.core.Is", "org.junit.Assert" ]
import java.io.ByteArrayInputStream; import java.io.InputStream; import org.hamcrest.core.Is; import org.junit.Assert;
import java.io.*; import org.hamcrest.core.*; import org.junit.*;
[ "java.io", "org.hamcrest.core", "org.junit" ]
java.io; org.hamcrest.core; org.junit;
249,041
private void drawTrace() { for (int i = 0; i < this.nbBodies; i++) { for (int j = 0; j < (this.MAX_HISTO_SIZE - 1); j++) { double x = this.bodies[i].getX(j + 1) - this.baseX; double y = this.bodies[i].getY(j + 1) - this.baseY; double z = this.bodies[i].getZ(j + 1) - this.baseZ; //this.tracesTransformation[i][j].setTranslation(new Vector3d(x,y,z)); //this.tracesGroup[i][j].setTransform(tracesTransformation[i][j]); Transform3D t = new Transform3D(); t.setTranslation(new Vector3d(x, y, z)); this.tracesGroup[i][j].setTransform(t); //System.out.println("["+i+"]["+j+"]: ("+x+","+y+","+z+")"); } } }
void function() { for (int i = 0; i < this.nbBodies; i++) { for (int j = 0; j < (this.MAX_HISTO_SIZE - 1); j++) { double x = this.bodies[i].getX(j + 1) - this.baseX; double y = this.bodies[i].getY(j + 1) - this.baseY; double z = this.bodies[i].getZ(j + 1) - this.baseZ; Transform3D t = new Transform3D(); t.setTranslation(new Vector3d(x, y, z)); this.tracesGroup[i][j].setTransform(t); } } }
/** * Called to place ghost bodies * (uses a lot of ressources) */
Called to place ghost bodies (uses a lot of ressources)
drawTrace
{ "repo_name": "moliva/proactive", "path": "src/Examples/org/objectweb/proactive/examples/nbody/common/NBody3DFrame.java", "license": "agpl-3.0", "size": 37196 }
[ "javax.media.j3d.Transform3D", "javax.vecmath.Vector3d" ]
import javax.media.j3d.Transform3D; import javax.vecmath.Vector3d;
import javax.media.j3d.*; import javax.vecmath.*;
[ "javax.media", "javax.vecmath" ]
javax.media; javax.vecmath;
283,354
Optional<BlockStatistic> getBlockStatistic(StatisticGroup statisticGroup, BlockType blockType);
Optional<BlockStatistic> getBlockStatistic(StatisticGroup statisticGroup, BlockType blockType);
/** * Gets the {@link Statistic} for the given {@link StatisticGroup} and * {@link BlockType}. If the statistic group is not a valid * {@link BlockStatistic} group then {@link Optional#absent()} will be * returned. * * @param statisticGroup The type of statistic to return * @param blockType The block type for the statistic to return * @return The block statistic or Optional.absent() if not found */
Gets the <code>Statistic</code> for the given <code>StatisticGroup</code> and <code>BlockType</code>. If the statistic group is not a valid <code>BlockStatistic</code> group then <code>Optional#absent()</code> will be returned
getBlockStatistic
{ "repo_name": "SpongeHistory/SpongeAPI-History", "path": "src/main/java/org/spongepowered/api/GameRegistry.java", "license": "mit", "size": 37085 }
[ "com.google.common.base.Optional", "org.spongepowered.api.block.BlockType", "org.spongepowered.api.stats.BlockStatistic", "org.spongepowered.api.stats.StatisticGroup" ]
import com.google.common.base.Optional; import org.spongepowered.api.block.BlockType; import org.spongepowered.api.stats.BlockStatistic; import org.spongepowered.api.stats.StatisticGroup;
import com.google.common.base.*; import org.spongepowered.api.block.*; import org.spongepowered.api.stats.*;
[ "com.google.common", "org.spongepowered.api" ]
com.google.common; org.spongepowered.api;
1,218,092
public static void validateWriterWanSiteEntriesTask() { Log.getLogWriter().info("Sleeping for some time .."); hydra.MasterController.sleepForMs(100000); Region region = RegionHelper.getRegion(regionNames.get(0)); if (region.isEmpty()) { throw new TestException(" Region has no entries to validate "); } checkKeys(region.getName(), "writer_"); long requiredSize = WANBlackboard.getInstance().getSharedCounters().read( WANBlackboard.currentEntry_writer); checkKeyRegionEntries(region.getName(), "writer_", requiredSize); }
static void function() { Log.getLogWriter().info(STR); hydra.MasterController.sleepForMs(100000); Region region = RegionHelper.getRegion(regionNames.get(0)); if (region.isEmpty()) { throw new TestException(STR); } checkKeys(region.getName(), STR); long requiredSize = WANBlackboard.getInstance().getSharedCounters().read( WANBlackboard.currentEntry_writer); checkKeyRegionEntries(region.getName(), STR, requiredSize); }
/** * Validating Writer Wan Sites */
Validating Writer Wan Sites
validateWriterWanSiteEntriesTask
{ "repo_name": "papicella/snappy-store", "path": "tests/core/src/main/java/newWan/security/WanSecurity.java", "license": "apache-2.0", "size": 26405 }
[ "com.gemstone.gemfire.cache.Region" ]
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
839,809
GetIndexTemplatesRequestBuilder prepareGetTemplates(String... name);
GetIndexTemplatesRequestBuilder prepareGetTemplates(String... name);
/** * Gets an index template (optional). */
Gets an index template (optional)
prepareGetTemplates
{ "repo_name": "qwerty4030/elasticsearch", "path": "server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java", "license": "apache-2.0", "size": 31749 }
[ "org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequestBuilder" ]
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequestBuilder;
import org.elasticsearch.action.admin.indices.template.get.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
2,787,250
protected void createContextMenuFor(StructuredViewer viewer) { MenuManager contextMenu = new MenuManager("#PopUp"); contextMenu.add(new Separator("additions")); contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(this); Menu menu= contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); }
void function(StructuredViewer viewer) { MenuManager contextMenu = new MenuManager(STR); contextMenu.add(new Separator(STR)); contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(this); Menu menu= contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY DND.DROP_MOVE DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); }
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
createContextMenuFor
{ "repo_name": "cbrun/sirius-query-rewriter", "path": "org.eclipse.sirius.queryrewriter.editor/src-gen/org/eclipse/sirius/queryrewriter/presentation/QueryrewriterEditor.java", "license": "epl-1.0", "size": 55457 }
[ "org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter", "org.eclipse.emf.edit.ui.dnd.LocalTransfer", "org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter", "org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider", "org.eclipse.jface.action.MenuManager", "org.eclipse.jface.action.Separator", "org.eclipse.jface.util.LocalSelectionTransfer", "org.eclipse.jface.viewers.StructuredViewer", "org.eclipse.swt.dnd.FileTransfer", "org.eclipse.swt.dnd.Transfer", "org.eclipse.swt.widgets.Menu" ]
import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.widgets.Menu;
import org.eclipse.emf.edit.ui.dnd.*; import org.eclipse.emf.edit.ui.provider.*; import org.eclipse.jface.action.*; import org.eclipse.jface.util.*; import org.eclipse.jface.viewers.*; import org.eclipse.swt.dnd.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.emf", "org.eclipse.jface", "org.eclipse.swt" ]
org.eclipse.emf; org.eclipse.jface; org.eclipse.swt;
1,037,013
protected JPanel createCustomParameterPanel () { return null; }
JPanel function () { return null; }
/** * Create a panel for custom output parameter editing. * * @return The custom parameter panel. */
Create a panel for custom output parameter editing
createCustomParameterPanel
{ "repo_name": "grappendorf/openmetix", "path": "plugin/metix-interfacing/src/java/de/iritgo/openmetix/interfacing/gagingsystem/GagingOutputEditor.java", "license": "gpl-2.0", "size": 4620 }
[ "javax.swing.JPanel" ]
import javax.swing.JPanel;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
128,454
public static MainFragment newInstance(int sectionNumber) { //fragment=PlaceholderFragment.instantiate(getBaseContext(), MyClass1.class.getName()); MainFragment fragment = new MainFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } public MainFragment() { }
static MainFragment function(int sectionNumber) { MainFragment fragment = new MainFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } public MainFragment() { }
/** * Returns a new instance of this fragment for the given section * number. */
Returns a new instance of this fragment for the given section number
newInstance
{ "repo_name": "WiverNz/CreditCalcPlus", "path": "CreditCalcPlus/src/ru/wivern/creditcalcplus/MainFragment.java", "license": "bsd-3-clause", "size": 21545 }
[ "android.os.Bundle" ]
import android.os.Bundle;
import android.os.*;
[ "android.os" ]
android.os;
2,176,756
@Test public void testUpdateClosed() { spyDoor = Mockito.spy(door); doReturn(false).when(spyDoor).isOpen(); spyDoor.update(0l); verify(spyDoor).isOpen(); verify(spyDoor, never()).destroy(); }
void function() { spyDoor = Mockito.spy(door); doReturn(false).when(spyDoor).isOpen(); spyDoor.update(0l); verify(spyDoor).isOpen(); verify(spyDoor, never()).destroy(); }
/** * Tests if updating the door works correct */
Tests if updating the door works correct
testUpdateClosed
{ "repo_name": "JoshCode/SEM", "path": "src/test/java/nl/joshuaslik/tudelft/SEM/control/gameObjects/BubbleDoorTest.java", "license": "apache-2.0", "size": 3526 }
[ "org.mockito.Mockito" ]
import org.mockito.Mockito;
import org.mockito.*;
[ "org.mockito" ]
org.mockito;
960,460
@Override public long connectionDelay(Node node, long now) { return connectionStates.connectionDelay(node.idString(), now); }
long function(Node node, long now) { return connectionStates.connectionDelay(node.idString(), now); }
/** * Returns the number of milliseconds to wait, based on the connection state, before attempting to send data. When * disconnected, this respects the reconnect backoff time. When connecting or connected, this handles slow/stalled * connections. * * @param node The node to check * @param now The current timestamp * @return The number of milliseconds to wait. */
Returns the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting or connected, this handles slow/stalled connections
connectionDelay
{ "repo_name": "TiVo/kafka", "path": "clients/src/main/java/org/apache/kafka/clients/NetworkClient.java", "license": "apache-2.0", "size": 57423 }
[ "org.apache.kafka.common.Node" ]
import org.apache.kafka.common.Node;
import org.apache.kafka.common.*;
[ "org.apache.kafka" ]
org.apache.kafka;
1,671,603
private void internalSetProperty(DavProperty<?> property) throws DavException { if (!exists()) { throw new DavException(DavServletResponse.SC_NOT_FOUND); } DavPropertyName propName = property.getName(); if (JCR_MIXINNODETYPES.equals(propName)) { Node n = (Node) item; try { NodeTypeProperty mix = new NodeTypeProperty(property); Set<String> mixins = mix.getNodeTypeNames(); for (NodeType existingMixin : n.getMixinNodeTypes()) { String name = existingMixin.getName(); if (mixins.contains(name)){ // do not add existing mixins mixins.remove(name); } else { // remove mixin that are not contained in the new list n.removeMixin(name); } } // add the remaining mixing types that are not yet set for (String mixin : mixins) { n.addMixin(mixin); } } catch (RepositoryException e) { throw new JcrDavException(e); } } else if (JCR_PRIMARYNODETYPE.equals(propName)) { Node n = (Node) item; try { NodeTypeProperty ntProp = new NodeTypeProperty(property); Set<String> names = ntProp.getNodeTypeNames(); if (names.size() == 1) { String ntName = names.iterator().next(); n.setPrimaryType(ntName); } else { // only a single node type can be primary node type. throw new DavException(DavServletResponse.SC_BAD_REQUEST); } } catch (RepositoryException e) { throw new JcrDavException(e); } } else { // all props except for mixin node types and primaryType are read-only throw new DavException(DavServletResponse.SC_CONFLICT); } }
void function(DavProperty<?> property) throws DavException { if (!exists()) { throw new DavException(DavServletResponse.SC_NOT_FOUND); } DavPropertyName propName = property.getName(); if (JCR_MIXINNODETYPES.equals(propName)) { Node n = (Node) item; try { NodeTypeProperty mix = new NodeTypeProperty(property); Set<String> mixins = mix.getNodeTypeNames(); for (NodeType existingMixin : n.getMixinNodeTypes()) { String name = existingMixin.getName(); if (mixins.contains(name)){ mixins.remove(name); } else { n.removeMixin(name); } } for (String mixin : mixins) { n.addMixin(mixin); } } catch (RepositoryException e) { throw new JcrDavException(e); } } else if (JCR_PRIMARYNODETYPE.equals(propName)) { Node n = (Node) item; try { NodeTypeProperty ntProp = new NodeTypeProperty(property); Set<String> names = ntProp.getNodeTypeNames(); if (names.size() == 1) { String ntName = names.iterator().next(); n.setPrimaryType(ntName); } else { throw new DavException(DavServletResponse.SC_BAD_REQUEST); } } catch (RepositoryException e) { throw new JcrDavException(e); } } else { throw new DavException(DavServletResponse.SC_CONFLICT); } }
/** * Internal method used to set or add the given property * * @param property * @throws DavException * @see #setProperty(DavProperty) */
Internal method used to set or add the given property
internalSetProperty
{ "repo_name": "sdmcraft/jackrabbit", "path": "jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java", "license": "apache-2.0", "size": 49161 }
[ "java.util.Set", "javax.jcr.Node", "javax.jcr.RepositoryException", "javax.jcr.nodetype.NodeType", "org.apache.jackrabbit.webdav.DavException", "org.apache.jackrabbit.webdav.DavServletResponse", "org.apache.jackrabbit.webdav.jcr.nodetype.NodeTypeProperty", "org.apache.jackrabbit.webdav.property.DavProperty", "org.apache.jackrabbit.webdav.property.DavPropertyName" ]
import java.util.Set; import javax.jcr.Node; import javax.jcr.RepositoryException; import javax.jcr.nodetype.NodeType; import org.apache.jackrabbit.webdav.DavException; import org.apache.jackrabbit.webdav.DavServletResponse; import org.apache.jackrabbit.webdav.jcr.nodetype.NodeTypeProperty; import org.apache.jackrabbit.webdav.property.DavProperty; import org.apache.jackrabbit.webdav.property.DavPropertyName;
import java.util.*; import javax.jcr.*; import javax.jcr.nodetype.*; import org.apache.jackrabbit.webdav.*; import org.apache.jackrabbit.webdav.jcr.nodetype.*; import org.apache.jackrabbit.webdav.property.*;
[ "java.util", "javax.jcr", "org.apache.jackrabbit" ]
java.util; javax.jcr; org.apache.jackrabbit;
2,505,535
@NonNull protected static String getAREA_MIN_LAT(@NonNull Context context) { GTFSCurrentNextProvider.checkForNextData(context); if (areaMinLat == null) { if (GTFSCurrentNextProvider.hasCurrentData(context)) { if (GTFSCurrentNextProvider.isNextData(context)) { areaMinLat = context.getResources().getString(R.string.next_gtfs_rts_area_min_lat); } else { // CURRENT = default areaMinLat = context.getResources().getString(R.string.current_gtfs_rts_area_min_lat); } } else { areaMinLat = context.getResources().getString(R.string.gtfs_rts_area_min_lat); } } return areaMinLat; } @Nullable private static String areaMaxLat = null;
static String function(@NonNull Context context) { GTFSCurrentNextProvider.checkForNextData(context); if (areaMinLat == null) { if (GTFSCurrentNextProvider.hasCurrentData(context)) { if (GTFSCurrentNextProvider.isNextData(context)) { areaMinLat = context.getResources().getString(R.string.next_gtfs_rts_area_min_lat); } else { areaMinLat = context.getResources().getString(R.string.current_gtfs_rts_area_min_lat); } } else { areaMinLat = context.getResources().getString(R.string.gtfs_rts_area_min_lat); } } return areaMinLat; } private static String areaMaxLat = null;
/** * Override if multiple {@link GTFSProvider} implementations in same app. */
Override if multiple <code>GTFSProvider</code> implementations in same app
getAREA_MIN_LAT
{ "repo_name": "mtransitapps/commons-android", "path": "src/main/java/org/mtransit/android/commons/provider/GTFSProvider.java", "license": "apache-2.0", "size": 17986 }
[ "android.content.Context", "androidx.annotation.NonNull" ]
import android.content.Context; import androidx.annotation.NonNull;
import android.content.*; import androidx.annotation.*;
[ "android.content", "androidx.annotation" ]
android.content; androidx.annotation;
2,031,008
void deleteRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsDataAccessException;
void deleteRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsDataAccessException;
/** * Deletes rewrite aliases matching a given filter.<p> * * @param dbc the current database context * @param filter the filter describing which rewrite aliases to delete * * @throws CmsDataAccessException if something goes wrong */
Deletes rewrite aliases matching a given filter
deleteRewriteAliases
{ "repo_name": "victos/opencms-core", "path": "src/org/opencms/db/I_CmsVfsDriver.java", "license": "lgpl-2.1", "size": 41952 }
[ "org.opencms.file.CmsDataAccessException" ]
import org.opencms.file.CmsDataAccessException;
import org.opencms.file.*;
[ "org.opencms.file" ]
org.opencms.file;
1,173,367
public ImmutableSet<String> supportedFileAttributeViews() { return providersByName.keySet(); }
ImmutableSet<String> function() { return providersByName.keySet(); }
/** * Implements {@link FileSystem#supportedFileAttributeViews()}. */
Implements <code>FileSystem#supportedFileAttributeViews()</code>
supportedFileAttributeViews
{ "repo_name": "thejavamonk/jimfs", "path": "jimfs/src/main/java/com/google/common/jimfs/AttributeService.java", "license": "apache-2.0", "size": 14727 }
[ "com.google.common.collect.ImmutableSet" ]
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
2,592,444
return data; } /** * Define el valor de la propiedad data. * * @param value * allowed object is * {@link Carer }
return data; } /** * Define el valor de la propiedad data. * * @param value * allowed object is * {@link Carer }
/** * Obtiene el valor de la propiedad data. * * @return * possible object is * {@link Carer } * */
Obtiene el valor de la propiedad data
getData
{ "repo_name": "seaclouds-atos/softcare-final-implementation", "path": "softcare-gui/src/eu/ehealth/ws_client/storagecomponent/UpdateCarer.java", "license": "apache-2.0", "size": 2104 }
[ "eu.ehealth.ws_client.xsd.Carer" ]
import eu.ehealth.ws_client.xsd.Carer;
import eu.ehealth.ws_client.xsd.*;
[ "eu.ehealth.ws_client" ]
eu.ehealth.ws_client;
2,888,744
public void setName(final String value) { name = Objects.requireNonNull(value, "Received a null pointer as name"); }
void function(final String value) { name = Objects.requireNonNull(value, STR); }
/** * Sets the name of the entity. * * @param value * the name to set in the entity */
Sets the name of the entity
setName
{ "repo_name": "Bernardo-MG/jpa-example", "path": "src/main/java/com/bernardomg/example/jpa/model/relation/onetoone/OneToOneSourceEntity.java", "license": "mit", "size": 3922 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
135,201
@Test public void testReloadLeak() throws Exception { final ExecutorService executor = ExecutorUtil.newMDCAwareFixedThreadPool(1, new SolrNamedThreadFactory("testReloadLeak")); // Continuously open new searcher while core is not closed, and reload core to try to reproduce // searcher leak. While in practice we never continuously open new searchers, this is trying to // make up for the fact that opening a searcher in this empty core is very fast by opening new // searchers continuously to increase the likelihood for race. SolrCore core = h.getCore(); assertTrue("Refcount != 1", core.getOpenCount() == 1); executor.execute(new NewSearcherRunnable(core)); // Since we called getCore() vs getCoreInc() and don't own a refCount, the container should // decRef the core and close it when we call reload. h.reload(); executor.shutdown(); executor.awaitTermination(1, TimeUnit.MINUTES); // Check that all cores are closed and no searcher references are leaked. assertTrue("SolrCore " + core + " is not closed", core.isClosed()); assertTrue(core.areAllSearcherReferencesEmpty()); } private static class NewSearcherRunnable implements Runnable { private final SolrCore core; NewSearcherRunnable(SolrCore core) { this.core = core; }
void function() throws Exception { final ExecutorService executor = ExecutorUtil.newMDCAwareFixedThreadPool(1, new SolrNamedThreadFactory(STR)); SolrCore core = h.getCore(); assertTrue(STR, core.getOpenCount() == 1); executor.execute(new NewSearcherRunnable(core)); h.reload(); executor.shutdown(); executor.awaitTermination(1, TimeUnit.MINUTES); assertTrue(STR + core + STR, core.isClosed()); assertTrue(core.areAllSearcherReferencesEmpty()); } private static class NewSearcherRunnable implements Runnable { private final SolrCore core; NewSearcherRunnable(SolrCore core) { this.core = core; }
/** * Test that's meant to be run with many iterations to expose a leak of SolrIndexSearcher when a * core is closed due to a reload. Without the fix, this test fails with most iters=1000 runs. */
Test that's meant to be run with many iterations to expose a leak of SolrIndexSearcher when a core is closed due to a reload. Without the fix, this test fails with most iters=1000 runs
testReloadLeak
{ "repo_name": "apache/solr", "path": "solr/core/src/test/org/apache/solr/core/SolrCoreTest.java", "license": "apache-2.0", "size": 14892 }
[ "java.util.concurrent.ExecutorService", "java.util.concurrent.TimeUnit", "org.apache.solr.common.util.ExecutorUtil", "org.apache.solr.common.util.SolrNamedThreadFactory" ]
import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import org.apache.solr.common.util.ExecutorUtil; import org.apache.solr.common.util.SolrNamedThreadFactory;
import java.util.concurrent.*; import org.apache.solr.common.util.*;
[ "java.util", "org.apache.solr" ]
java.util; org.apache.solr;
1,455,309
public boolean real_connect(Env env, @Optional("localhost") StringValue host, @Optional StringValue userName, @Optional StringValue password, @Optional StringValue dbname, @Optional("3306") int port, @Optional StringValue socket, @Optional int flags) { return connectInternal(env, host.toString(), userName.toString(), password.toString(), dbname.toString(), port, socket.toString(), flags, null, null, false); }
boolean function(Env env, @Optional(STR) StringValue host, @Optional StringValue userName, @Optional StringValue password, @Optional StringValue dbname, @Optional("3306") int port, @Optional StringValue socket, @Optional int flags) { return connectInternal(env, host.toString(), userName.toString(), password.toString(), dbname.toString(), port, socket.toString(), flags, null, null, false); }
/** * Connects to the underlying database. */
Connects to the underlying database
real_connect
{ "repo_name": "dwango/quercus", "path": "src/main/java/com/caucho/quercus/lib/db/Mysqli.java", "license": "gpl-2.0", "size": 42280 }
[ "com.caucho.quercus.annotation.Optional", "com.caucho.quercus.env.Env", "com.caucho.quercus.env.StringValue" ]
import com.caucho.quercus.annotation.Optional; import com.caucho.quercus.env.Env; import com.caucho.quercus.env.StringValue;
import com.caucho.quercus.annotation.*; import com.caucho.quercus.env.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
1,040,781
return Selector.SAC_CHILD_SELECTOR; } public ChildSelectorImpl(Selector parent, SimpleSelector child) { this.parent = parent; this.child = child; }
return Selector.SAC_CHILD_SELECTOR; } public ChildSelectorImpl(Selector parent, SimpleSelector child) { this.parent = parent; this.child = child; }
/** * An integer indicating the type of <code>Selector</code> */
An integer indicating the type of <code>Selector</code>
getSelectorType
{ "repo_name": "dmazinanian/css-analyser", "path": "src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java", "license": "mit", "size": 1583 }
[ "org.w3c.css.sac.Selector", "org.w3c.css.sac.SimpleSelector" ]
import org.w3c.css.sac.Selector; import org.w3c.css.sac.SimpleSelector;
import org.w3c.css.sac.*;
[ "org.w3c.css" ]
org.w3c.css;
793,441
public boolean isItemSelected(int seriesIdx, int valueIdx) { double selectedValue = getItemValue(seriesIdx, PlotDimension.SELECTED, valueIdx); boolean selected = (selectedValue == 1) ? true : false; return selected; }
boolean function(int seriesIdx, int valueIdx) { double selectedValue = getItemValue(seriesIdx, PlotDimension.SELECTED, valueIdx); boolean selected = (selectedValue == 1) ? true : false; return selected; }
/** * Returns if the given item is selected (aka value of 1 in the {@link PlotDimension#SELECTED} column) * @param seriesIdx * @param valueIdx * @return */
Returns if the given item is selected (aka value of 1 in the <code>PlotDimension#SELECTED</code> column)
isItemSelected
{ "repo_name": "aborg0/RapidMiner-Unuk", "path": "src/com/rapidminer/gui/new_plotter/engine/jfreechart/RenderFormatDelegate.java", "license": "agpl-3.0", "size": 14972 }
[ "com.rapidminer.gui.new_plotter.configuration.DimensionConfig" ]
import com.rapidminer.gui.new_plotter.configuration.DimensionConfig;
import com.rapidminer.gui.new_plotter.configuration.*;
[ "com.rapidminer.gui" ]
com.rapidminer.gui;
911,414
public Genomics fromApplicationDefaultCredential() { return fromCredential(CredentialFactory.getApplicationDefaultCredential()); }
Genomics function() { return fromCredential(CredentialFactory.getApplicationDefaultCredential()); }
/** * Create a {@link Genomics} stub using the Application Default Credential. * * @return The new {@code Genomics} stub */
Create a <code>Genomics</code> stub using the Application Default Credential
fromApplicationDefaultCredential
{ "repo_name": "deflaux/utils-java", "path": "src/main/java/com/google/cloud/genomics/utils/GenomicsFactory.java", "license": "apache-2.0", "size": 17536 }
[ "com.google.api.services.genomics.Genomics" ]
import com.google.api.services.genomics.Genomics;
import com.google.api.services.genomics.*;
[ "com.google.api" ]
com.google.api;
1,170,901
private CellProcessor[] getProcessor(List<Field> fields) { CellProcessor[] processor = new CellProcessor[fields.size()]; int fieldCount = 0; for (Field field : fields) { processor[fieldCount++] = CellProcessorBuilder.getCellProcessor(field.getType(), field.getConstraints()); } return processor; }
CellProcessor[] function(List<Field> fields) { CellProcessor[] processor = new CellProcessor[fields.size()]; int fieldCount = 0; for (Field field : fields) { processor[fieldCount++] = CellProcessorBuilder.getCellProcessor(field.getType(), field.getConstraints()); } return processor; }
/** * Returns array of cellprocessors, one for each field */
Returns array of cellprocessors, one for each field
getProcessor
{ "repo_name": "yogidevendra/incubator-apex-malhar", "path": "contrib/src/main/java/com/datatorrent/contrib/enrich/DelimitedFSLoader.java", "license": "apache-2.0", "size": 4958 }
[ "com.datatorrent.contrib.parser.CellProcessorBuilder", "com.datatorrent.contrib.parser.DelimitedSchema", "java.util.List", "org.supercsv.cellprocessor.ift.CellProcessor" ]
import com.datatorrent.contrib.parser.CellProcessorBuilder; import com.datatorrent.contrib.parser.DelimitedSchema; import java.util.List; import org.supercsv.cellprocessor.ift.CellProcessor;
import com.datatorrent.contrib.parser.*; import java.util.*; import org.supercsv.cellprocessor.ift.*;
[ "com.datatorrent.contrib", "java.util", "org.supercsv.cellprocessor" ]
com.datatorrent.contrib; java.util; org.supercsv.cellprocessor;
2,372,925
@Override public Consent isAssociationValid(final ObjectAdapter ownerAdapter, final ObjectAdapter proposedToReferenceAdapter) { return isAssociationValidResult(ownerAdapter, proposedToReferenceAdapter).createConsent(); }
Consent function(final ObjectAdapter ownerAdapter, final ObjectAdapter proposedToReferenceAdapter) { return isAssociationValidResult(ownerAdapter, proposedToReferenceAdapter).createConsent(); }
/** * TODO: currently this method is hard-coded to assume all interactions are * initiated {@link InteractionInvocationMethod#BY_USER by user}. */
initiated <code>InteractionInvocationMethod#BY_USER by user</code>
isAssociationValid
{ "repo_name": "kidaa/isis", "path": "core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneAssociationImpl.java", "license": "apache-2.0", "size": 15738 }
[ "org.apache.isis.core.metamodel.adapter.ObjectAdapter", "org.apache.isis.core.metamodel.consent.Consent" ]
import org.apache.isis.core.metamodel.adapter.ObjectAdapter; import org.apache.isis.core.metamodel.consent.Consent;
import org.apache.isis.core.metamodel.adapter.*; import org.apache.isis.core.metamodel.consent.*;
[ "org.apache.isis" ]
org.apache.isis;
2,765,013
public static NodeList getNodesFromXP(Node n, String xpath) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xp = factory.newXPath(); XPathExpression expr = xp.compile(xpath); return (NodeList) expr.evaluate(n, XPathConstants.NODESET); }
static NodeList function(Node n, String xpath) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xp = factory.newXPath(); XPathExpression expr = xp.compile(xpath); return (NodeList) expr.evaluate(n, XPathConstants.NODESET); }
/** * Gets all nodes matching an XPath */
Gets all nodes matching an XPath
getNodesFromXP
{ "repo_name": "netboynb/search-core", "path": "src/main/java/org/apache/solr/util/SimplePostTool.java", "license": "apache-2.0", "size": 42365 }
[ "javax.xml.xpath.XPath", "javax.xml.xpath.XPathConstants", "javax.xml.xpath.XPathExpression", "javax.xml.xpath.XPathExpressionException", "javax.xml.xpath.XPathFactory", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import javax.xml.xpath.*; import org.w3c.dom.*;
[ "javax.xml", "org.w3c.dom" ]
javax.xml; org.w3c.dom;
823,611
void registerValidGatheringSpawn(Block block);
void registerValidGatheringSpawn(Block block);
/** Register a block state as being a valid spawn location for gathering blocks * @param block the block that is valid */
Register a block state as being a valid spawn location for gathering blocks
registerValidGatheringSpawn
{ "repo_name": "PenguinSquad/Harvest-Festival", "path": "src/main/java/joshie/harvest/api/gathering/IGatheringRegistry.java", "license": "mit", "size": 1153 }
[ "net.minecraft.block.Block" ]
import net.minecraft.block.Block;
import net.minecraft.block.*;
[ "net.minecraft.block" ]
net.minecraft.block;
1,011,035
public AvailableNumber fetchAvailableNumbers(String country) throws HoiioException { return fetchAvailableNumbers(country, null, null); }
AvailableNumber function(String country) throws HoiioException { return fetchAvailableNumbers(country, null, null); }
/** * Returns a list of available Hoiio Numbers for subscription in a given country * @param country Select the country that you wish to browse the list of available Hoiio Numbers. Use country code in ISO 3166-1 alpha-2 format. * @return Object containing all the responses from the server * @throws HoiioException */
Returns a list of available Hoiio Numbers for subscription in a given country
fetchAvailableNumbers
{ "repo_name": "Hoiio/hoiio-java", "path": "src/com/hoiio/sdk/services/NumberService.java", "license": "mit", "size": 8974 }
[ "com.hoiio.sdk.exception.HoiioException", "com.hoiio.sdk.objects.number.AvailableNumber" ]
import com.hoiio.sdk.exception.HoiioException; import com.hoiio.sdk.objects.number.AvailableNumber;
import com.hoiio.sdk.exception.*; import com.hoiio.sdk.objects.number.*;
[ "com.hoiio.sdk" ]
com.hoiio.sdk;
2,794,663
public void addUnqualifiedSequenceValue(String simpleSeqName, String seqValue) { ArrayProperty seq = (ArrayProperty) getAbstractProperty(simpleSeqName); TextType li = createTextType(XmpConstants.LIST_NAME, seqValue); if (seq != null) { seq.getContainer().addProperty(li); } else { ArrayProperty newSeq = createArrayProperty(simpleSeqName, Cardinality.Seq); newSeq.getContainer().addProperty(li); addProperty(newSeq); } }
void function(String simpleSeqName, String seqValue) { ArrayProperty seq = (ArrayProperty) getAbstractProperty(simpleSeqName); TextType li = createTextType(XmpConstants.LIST_NAME, seqValue); if (seq != null) { seq.getContainer().addProperty(li); } else { ArrayProperty newSeq = createArrayProperty(simpleSeqName, Cardinality.Seq); newSeq.getContainer().addProperty(li); addProperty(newSeq); } }
/** * Add a new value to a sequence property. * * @param simpleSeqName * The name of the sequence property without the namespace prefix * @param seqValue * The value to add to the sequence. */
Add a new value to a sequence property
addUnqualifiedSequenceValue
{ "repo_name": "gavanx/pdflearn", "path": "xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java", "license": "apache-2.0", "size": 41334 }
[ "org.apache.xmpbox.XmpConstants", "org.apache.xmpbox.type.ArrayProperty", "org.apache.xmpbox.type.Cardinality", "org.apache.xmpbox.type.TextType" ]
import org.apache.xmpbox.XmpConstants; import org.apache.xmpbox.type.ArrayProperty; import org.apache.xmpbox.type.Cardinality; import org.apache.xmpbox.type.TextType;
import org.apache.xmpbox.*; import org.apache.xmpbox.type.*;
[ "org.apache.xmpbox" ]
org.apache.xmpbox;
339,472
public static String replace( String string, String repl, String with ) { if ( string != null && repl != null && with != null ) { return string.replaceAll( Pattern.quote( repl ), Matcher.quoteReplacement( with ) ); } else { return null; } }
static String function( String string, String repl, String with ) { if ( string != null && repl != null && with != null ) { return string.replaceAll( Pattern.quote( repl ), Matcher.quoteReplacement( with ) ); } else { return null; } }
/** * Replace values in a String with another. * * 33% Faster using replaceAll this way than original method * * @param string * The original String. * @param repl * The text to replace * @param with * The new text bit * @return The resulting string with the text pieces replaced. */
Replace values in a String with another. 33% Faster using replaceAll this way than original method
replace
{ "repo_name": "e-cuellar/pentaho-kettle", "path": "core/src/main/java/org/pentaho/di/core/Const.java", "license": "apache-2.0", "size": 121114 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,793,565
@RequestMapping(method = RequestMethod.POST, value = "/member") public MembershipStatus saveMember(@RequestBody Member member, HttpServletRequest request) throws LdapUserNotFoundException, LdapWriteException, HttpException, InsufficientQuotaException { if(checkClient(request)) { logger.debug("Save data of a member"); if (StringUtils.isEmpty(member.getPhoneNumber())) { if (member.getValidCG()) throw new InvalidParameterException("ADHESION.ERROR.PHONEREQUIRED"); } else { memberManager.validatePhoneNumber(member.getPhoneNumber()); } // save datas into LDAP boolean pending = memberManager.saveOrUpdateMember(member); return pending ? MembershipStatus.PENDING : MembershipStatus.OK; } else { throw new SmsuForbiddenException("You can't call this WS from this remote address"); } }
@RequestMapping(method = RequestMethod.POST, value = STR) MembershipStatus function(@RequestBody Member member, HttpServletRequest request) throws LdapUserNotFoundException, LdapWriteException, HttpException, InsufficientQuotaException { if(checkClient(request)) { logger.debug(STR); if (StringUtils.isEmpty(member.getPhoneNumber())) { if (member.getValidCG()) throw new InvalidParameterException(STR); } else { memberManager.validatePhoneNumber(member.getPhoneNumber()); } boolean pending = memberManager.saveOrUpdateMember(member); return pending ? MembershipStatus.PENDING : MembershipStatus.OK; } else { throw new SmsuForbiddenException(STR); } }
/** * curl \ * -i \ * -X POST \ * -H "Content-Type: application/json" \ * -d '{"login": "loginTestSmsu", "phoneNumber": "0612345678", "validCG": true, "validCP": ["cas"]}}' \ * http://localhost:8080/ws/member */
curl \ -i \ -X POST \ -H "Content-Type: application/json" \ -d '{"login": "loginTestSmsu", "phoneNumber": "0612345678", "validCG": true, "validCP": ["cas"]}}' \ HREF
saveMember
{ "repo_name": "EsupPortail/esup-smsu", "path": "src/main/java/org/esupportail/smsu/web/ws/WsController.java", "license": "apache-2.0", "size": 8852 }
[ "javax.servlet.http.HttpServletRequest", "org.apache.commons.lang.StringUtils", "org.esupportail.smsu.business.beans.Member", "org.esupportail.smsu.exceptions.SmsuForbiddenException", "org.esupportail.smsu.exceptions.ldap.LdapUserNotFoundException", "org.esupportail.smsu.exceptions.ldap.LdapWriteException", "org.esupportail.smsu.web.controllers.InvalidParameterException", "org.esupportail.smsuapi.exceptions.InsufficientQuotaException", "org.esupportail.smsuapi.utils.HttpException", "org.springframework.web.bind.annotation.RequestBody", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod" ]
import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.esupportail.smsu.business.beans.Member; import org.esupportail.smsu.exceptions.SmsuForbiddenException; import org.esupportail.smsu.exceptions.ldap.LdapUserNotFoundException; import org.esupportail.smsu.exceptions.ldap.LdapWriteException; import org.esupportail.smsu.web.controllers.InvalidParameterException; import org.esupportail.smsuapi.exceptions.InsufficientQuotaException; import org.esupportail.smsuapi.utils.HttpException; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.*; import org.apache.commons.lang.*; import org.esupportail.smsu.business.beans.*; import org.esupportail.smsu.exceptions.*; import org.esupportail.smsu.exceptions.ldap.*; import org.esupportail.smsu.web.controllers.*; import org.esupportail.smsuapi.exceptions.*; import org.esupportail.smsuapi.utils.*; import org.springframework.web.bind.annotation.*;
[ "javax.servlet", "org.apache.commons", "org.esupportail.smsu", "org.esupportail.smsuapi", "org.springframework.web" ]
javax.servlet; org.apache.commons; org.esupportail.smsu; org.esupportail.smsuapi; org.springframework.web;
1,113,939
public List<RefCounterLock> getAllLockedTokens() { List<RefCounterLock> tokens = new ArrayList<>(); Iterator<Cache.Entry<String, RefCounterLock>> iterator = this.locks.iterator(); while (iterator.hasNext()) { Cache.Entry<String, RefCounterLock> entry = iterator.next(); RefCounterLock rLock = entry.getValue(); FencedLock lock = getLock(rLock); if (lock.isLocked()) { tokens.add(entry.getValue()); } } return tokens; }
List<RefCounterLock> function() { List<RefCounterLock> tokens = new ArrayList<>(); Iterator<Cache.Entry<String, RefCounterLock>> iterator = this.locks.iterator(); while (iterator.hasNext()) { Cache.Entry<String, RefCounterLock> entry = iterator.next(); RefCounterLock rLock = entry.getValue(); FencedLock lock = getLock(rLock); if (lock.isLocked()) { tokens.add(entry.getValue()); } } return tokens; }
/** * Get all locked tokens * * @return */
Get all locked tokens
getAllLockedTokens
{ "repo_name": "Heigvd/Wegas", "path": "wegas-core/src/main/java/com/wegas/core/ejb/ConcurrentHelper.java", "license": "mit", "size": 11736 }
[ "com.hazelcast.cp.lock.FencedLock", "java.util.ArrayList", "java.util.Iterator", "java.util.List", "javax.cache.Cache" ]
import com.hazelcast.cp.lock.FencedLock; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.cache.Cache;
import com.hazelcast.cp.lock.*; import java.util.*; import javax.cache.*;
[ "com.hazelcast.cp", "java.util", "javax.cache" ]
com.hazelcast.cp; java.util; javax.cache;
1,831,658
protected boolean validateCommit() { if (!readonly) for (Map.Entry<VBox<?>, VBoxBody<?>> entry : bodiesRead.entrySet()) { // Compare versions instead of 'body' objects because we may have multiple // re-loads of the same version of some disk data - we allow that in // transactional caches if (entry.getKey().body.version != entry.getValue().version) { return false; } } return true; }
boolean function() { if (!readonly) for (Map.Entry<VBox<?>, VBoxBody<?>> entry : bodiesRead.entrySet()) { if (entry.getKey().body.version != entry.getValue().version) { return false; } } return true; }
/** * A commit can proceed only if none of the values we've read during * the transaction has changed (i.e. has been committed) since we read * them. In order words, the latest/current body of each VBox is the same * as the one tagged with this transaction's number. */
A commit can proceed only if none of the values we've read during the transaction has changed (i.e. has been committed) since we read them. In order words, the latest/current body of each VBox is the same as the one tagged with this transaction's number
validateCommit
{ "repo_name": "armatys/hypergraphdb-android", "path": "hgdb-android/java/src/org/hypergraphdb/transaction/HGTransaction.java", "license": "lgpl-3.0", "size": 12103 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,146,077
public static String getIResourceOSString(IResource f) { URI locationURI = f.getLocationURI(); if (locationURI != null) { try{ //RTC source control not return a valid uri return FileUtils.getFileAbsolutePath(new File(locationURI)); }catch (IllegalArgumentException e) { } } IPath rawLocation = f.getRawLocation(); if (rawLocation == null) { return null; //yes, we could have a resource that was deleted but we still have it's representation... } String fullPath = rawLocation.toOSString(); //now, we have to make sure it is canonical... File file = new File(fullPath); if (file.exists()) { return FileUtils.getFileAbsolutePath(file); } else { //it does not exist, so, we have to check its project to validate the part that we can IProject project = f.getProject(); IPath location = project.getLocation(); File projectFile = location.toFile(); if (projectFile.exists()) { String projectFilePath = FileUtils.getFileAbsolutePath(projectFile); if (fullPath.startsWith(projectFilePath)) { //the case is all ok return fullPath; } else { //the case appears to be different, so, let's check if this is it... if (fullPath.toLowerCase().startsWith(projectFilePath.toLowerCase())) { String relativePart = fullPath.substring(projectFilePath.length()); //at least the first part was correct return projectFilePath + relativePart; } } } } //it may not be correct, but it was the best we could do... return fullPath; } //Default for using in tests (could be private) static File location;
static String function(IResource f) { URI locationURI = f.getLocationURI(); if (locationURI != null) { try{ return FileUtils.getFileAbsolutePath(new File(locationURI)); }catch (IllegalArgumentException e) { } } IPath rawLocation = f.getRawLocation(); if (rawLocation == null) { return null; } String fullPath = rawLocation.toOSString(); File file = new File(fullPath); if (file.exists()) { return FileUtils.getFileAbsolutePath(file); } else { IProject project = f.getProject(); IPath location = project.getLocation(); File projectFile = location.toFile(); if (projectFile.exists()) { String projectFilePath = FileUtils.getFileAbsolutePath(projectFile); if (fullPath.startsWith(projectFilePath)) { return fullPath; } else { if (fullPath.toLowerCase().startsWith(projectFilePath.toLowerCase())) { String relativePart = fullPath.substring(projectFilePath.length()); return projectFilePath + relativePart; } } } } return fullPath; } static File location;
/** * Given a resource get the string in the filesystem for it. */
Given a resource get the string in the filesystem for it
getIResourceOSString
{ "repo_name": "RandallDW/Aruba_plugin", "path": "plugins/org.python.pydev/src/org/python/pydev/plugin/PydevPlugin.java", "license": "epl-1.0", "size": 28302 }
[ "java.io.File", "org.eclipse.core.resources.IProject", "org.eclipse.core.resources.IResource", "org.eclipse.core.runtime.IPath", "org.python.pydev.shared_core.io.FileUtils" ]
import java.io.File; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; import org.python.pydev.shared_core.io.FileUtils;
import java.io.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.python.pydev.shared_core.io.*;
[ "java.io", "org.eclipse.core", "org.python.pydev" ]
java.io; org.eclipse.core; org.python.pydev;
2,647,778
public void setDescription(@Nullable String ruleDescription) { description = ruleDescription; }
void function(@Nullable String ruleDescription) { description = ruleDescription; }
/** * This method is used to specify human-readable description of the purpose and consequences of the * {@link Rule}'s execution. * * @param ruleDescription the {@link Rule}'s human-readable description, or {@code null}. */
This method is used to specify human-readable description of the purpose and consequences of the <code>Rule</code>'s execution
setDescription
{ "repo_name": "Snickermicker/smarthome", "path": "bundles/automation/org.eclipse.smarthome.automation.module.script.rulesupport/src/main/java/org/eclipse/smarthome/automation/module/script/rulesupport/shared/simple/SimpleRule.java", "license": "epl-1.0", "size": 8554 }
[ "org.eclipse.jdt.annotation.Nullable" ]
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jdt.annotation.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
1,136,231
private boolean validateOutput(GeoJsonCollection geoJsonCollection) { return !geoJsonCollection.getFeatures().isEmpty(); } //**************************************** // INNER CLASSES //****************************************
boolean function(GeoJsonCollection geoJsonCollection) { return !geoJsonCollection.getFeatures().isEmpty(); }
/** * validates the output from the API * * @param geoJsonCollection the API outputJSON to be validated * @return returns true if the outputJSON is not empty */
validates the output from the API
validateOutput
{ "repo_name": "ArnoHeid/PubApp", "path": "geocoder/src/main/java/de/hsmainz/pubapp/geocoder/controller/HttpAPIRequest.java", "license": "apache-2.0", "size": 5824 }
[ "de.hsmainz.pubapp.geocoder.model.geojson.GeoJsonCollection" ]
import de.hsmainz.pubapp.geocoder.model.geojson.GeoJsonCollection;
import de.hsmainz.pubapp.geocoder.model.geojson.*;
[ "de.hsmainz.pubapp" ]
de.hsmainz.pubapp;
1,284,916
public static String trim(@Nullable final String input) { if (input == null) { return ""; } return input.trim(); }
static String function(@Nullable final String input) { if (input == null) { return ""; } return input.trim(); }
/** * Removes white spaces from both ends of a string. * @return empty string if input is null, trimmed else */
Removes white spaces from both ends of a string
trim
{ "repo_name": "indeedeng/proctor", "path": "proctor-common/src/main/java/com/indeed/proctor/common/LegacyTaglibFunctions.java", "license": "apache-2.0", "size": 10833 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,468,045
private Put createPut(HBaseRow hRow) throws Exception { ObjectHelper.notNull(hRow, "HBase row"); ObjectHelper.notNull(hRow.getId(), "HBase row id"); ObjectHelper.notNull(hRow.getCells(), "HBase cells"); Put put = new Put(endpoint.getCamelContext().getTypeConverter().convertTo(byte[].class, hRow.getId())); Set<HBaseCell> cells = hRow.getCells(); for (HBaseCell cell : cells) { String family = cell.getFamily(); String column = cell.getQualifier(); Object value = cell.getValue(); ObjectHelper.notNull(family, "HBase column family", cell); ObjectHelper.notNull(column, "HBase column", cell); put.addColumn( HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column), endpoint.getCamelContext().getTypeConverter().convertTo(byte[].class, value) ); } return put; }
Put function(HBaseRow hRow) throws Exception { ObjectHelper.notNull(hRow, STR); ObjectHelper.notNull(hRow.getId(), STR); ObjectHelper.notNull(hRow.getCells(), STR); Put put = new Put(endpoint.getCamelContext().getTypeConverter().convertTo(byte[].class, hRow.getId())); Set<HBaseCell> cells = hRow.getCells(); for (HBaseCell cell : cells) { String family = cell.getFamily(); String column = cell.getQualifier(); Object value = cell.getValue(); ObjectHelper.notNull(family, STR, cell); ObjectHelper.notNull(column, STR, cell); put.addColumn( HBaseHelper.getHBaseFieldAsBytes(family), HBaseHelper.getHBaseFieldAsBytes(column), endpoint.getCamelContext().getTypeConverter().convertTo(byte[].class, value) ); } return put; }
/** * Creates an HBase {@link Put} on a specific row, using a collection of values (family/column/value pairs). * * @param hRow * @throws Exception */
Creates an HBase <code>Put</code> on a specific row, using a collection of values (family/column/value pairs)
createPut
{ "repo_name": "Fabryprog/camel", "path": "components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseProducer.java", "license": "apache-2.0", "size": 13342 }
[ "java.util.Set", "org.apache.camel.component.hbase.model.HBaseCell", "org.apache.camel.component.hbase.model.HBaseRow", "org.apache.camel.util.ObjectHelper", "org.apache.hadoop.hbase.client.Put" ]
import java.util.Set; import org.apache.camel.component.hbase.model.HBaseCell; import org.apache.camel.component.hbase.model.HBaseRow; import org.apache.camel.util.ObjectHelper; import org.apache.hadoop.hbase.client.Put;
import java.util.*; import org.apache.camel.component.hbase.model.*; import org.apache.camel.util.*; import org.apache.hadoop.hbase.client.*;
[ "java.util", "org.apache.camel", "org.apache.hadoop" ]
java.util; org.apache.camel; org.apache.hadoop;
2,855,507
public void contextChanged(Context context) { mContext = context; LayoutTab.resetDimensionConstants(context); }
void function(Context context) { mContext = context; LayoutTab.resetDimensionConstants(context); }
/** * Called when the context and size of the view has changed. * * @param context The current Android's context. */
Called when the context and size of the view has changed
contextChanged
{ "repo_name": "danakj/chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/Layout.java", "license": "bsd-3-clause", "size": 47924 }
[ "android.content.Context", "org.chromium.chrome.browser.compositor.layouts.components.LayoutTab" ]
import android.content.Context; import org.chromium.chrome.browser.compositor.layouts.components.LayoutTab;
import android.content.*; import org.chromium.chrome.browser.compositor.layouts.components.*;
[ "android.content", "org.chromium.chrome" ]
android.content; org.chromium.chrome;
1,890,826
@Factory public static <T> Matcher<Annotation> hasParamValue(String param, T paramValue) { return new AnnotationParamMatcher<T>(param, equalTo(paramValue)); }
static <T> Matcher<Annotation> function(String param, T paramValue) { return new AnnotationParamMatcher<T>(param, equalTo(paramValue)); }
/** * Creates a matcher of {@link Annotation} that matches any object containing * the named <code>param</code> with a value equal to to <code>paramValue</code>. * <p> * For example: * <pre>assertThat(myAnnotation, hasParamValue("value", "b")(</pre> * </p> * * @param param name of parameter to match * @param paramValue value to match against * @param <T> type of value to match */
Creates a matcher of <code>Annotation</code> that matches any object containing the named <code>param</code> with a value equal to to <code>paramValue</code>. For example: <code>assertThat(myAnnotation, hasParamValue("value", "b")(</code>
hasParamValue
{ "repo_name": "zaradai/matchers", "path": "src/main/java/com/zaradai/matchers/AnnotationParamMatcher.java", "license": "apache-2.0", "size": 4683 }
[ "java.lang.annotation.Annotation", "org.hamcrest.CoreMatchers", "org.hamcrest.Matcher" ]
import java.lang.annotation.Annotation; import org.hamcrest.CoreMatchers; import org.hamcrest.Matcher;
import java.lang.annotation.*; import org.hamcrest.*;
[ "java.lang", "org.hamcrest" ]
java.lang; org.hamcrest;
1,056,933
public void setCollapsed(boolean collapse) { if (collapse) { // collapse the panel, remove content and set border to empty border remove(panel); arrow.setIcon(iconArrow[COLLAPSED]); border = new CollapsibleTitledBorder(collapsedBorderLine, titleComponent); } else { // expand the panel, add content and set border to titled border add(panel, BorderLayout.NORTH); arrow.setIcon(iconArrow[EXPANDED]); border = new CollapsibleTitledBorder(expandedBorderLine, titleComponent); } setBorder(border); collapsed = collapse; updateUI(); }
void function(boolean collapse) { if (collapse) { remove(panel); arrow.setIcon(iconArrow[COLLAPSED]); border = new CollapsibleTitledBorder(collapsedBorderLine, titleComponent); } else { add(panel, BorderLayout.NORTH); arrow.setIcon(iconArrow[EXPANDED]); border = new CollapsibleTitledBorder(expandedBorderLine, titleComponent); } setBorder(border); collapsed = collapse; updateUI(); }
/** * Collapses or expands the panel. add or remove the content pane, alternate between a frame and empty border, and * change the title arrow. The current state is stored in the collapsed boolean. * * @param collapse When set to true, the panel is collapsed, else it is expanded */
Collapses or expands the panel. add or remove the content pane, alternate between a frame and empty border, and change the title arrow. The current state is stored in the collapsed boolean
setCollapsed
{ "repo_name": "iarspider/JULauncher", "path": "src/main/java/com/julauncher/gui/components/CollapsiblePanel.java", "license": "gpl-3.0", "size": 17118 }
[ "java.awt.BorderLayout" ]
import java.awt.BorderLayout;
import java.awt.*;
[ "java.awt" ]
java.awt;
476,139
private static MultiWorkUnit findAndPopBestFitGroup(WorkUnit workUnit, PriorityQueue<MultiWorkUnit> pQueue, double avgGroupSize) { List<MultiWorkUnit> fullWorkUnits = Lists.newArrayList(); MultiWorkUnit bestFit = null; while (!pQueue.isEmpty()) { MultiWorkUnit candidate = pQueue.poll(); if (getWorkUnitEstSize(candidate) + getWorkUnitEstSize(workUnit) <= avgGroupSize) { bestFit = candidate; break; } fullWorkUnits.add(candidate); } for (MultiWorkUnit fullWorkUnit : fullWorkUnits) { pQueue.add(fullWorkUnit); } return bestFit; }
static MultiWorkUnit function(WorkUnit workUnit, PriorityQueue<MultiWorkUnit> pQueue, double avgGroupSize) { List<MultiWorkUnit> fullWorkUnits = Lists.newArrayList(); MultiWorkUnit bestFit = null; while (!pQueue.isEmpty()) { MultiWorkUnit candidate = pQueue.poll(); if (getWorkUnitEstSize(candidate) + getWorkUnitEstSize(workUnit) <= avgGroupSize) { bestFit = candidate; break; } fullWorkUnits.add(candidate); } for (MultiWorkUnit fullWorkUnit : fullWorkUnits) { pQueue.add(fullWorkUnit); } return bestFit; }
/** * Find the best group using the best-fit-decreasing algorithm. * The best group is the fullest group that has enough capacity for the new {@link WorkUnit}. * If no existing group has enough capacity for the new {@link WorkUnit}, return null. */
Find the best group using the best-fit-decreasing algorithm. The best group is the fullest group that has enough capacity for the new <code>WorkUnit</code>. If no existing group has enough capacity for the new <code>WorkUnit</code>, return null
findAndPopBestFitGroup
{ "repo_name": "shirshanka/gobblin", "path": "gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/workunit/packer/KafkaBiLevelWorkUnitPacker.java", "license": "apache-2.0", "size": 6469 }
[ "com.google.common.collect.Lists", "java.util.List", "java.util.PriorityQueue", "org.apache.gobblin.source.workunit.MultiWorkUnit", "org.apache.gobblin.source.workunit.WorkUnit" ]
import com.google.common.collect.Lists; import java.util.List; import java.util.PriorityQueue; import org.apache.gobblin.source.workunit.MultiWorkUnit; import org.apache.gobblin.source.workunit.WorkUnit;
import com.google.common.collect.*; import java.util.*; import org.apache.gobblin.source.workunit.*;
[ "com.google.common", "java.util", "org.apache.gobblin" ]
com.google.common; java.util; org.apache.gobblin;
1,272,987
private static NetworkEnvironment createNetworkEnvironment( TaskManagerServicesConfiguration taskManagerServicesConfiguration, long maxJvmHeapMemory) { NetworkEnvironmentConfiguration networkEnvironmentConfiguration = taskManagerServicesConfiguration.getNetworkConfig(); final long networkBuf = calculateNetworkBufferMemory(taskManagerServicesConfiguration, maxJvmHeapMemory); int segmentSize = networkEnvironmentConfiguration.networkBufferSize(); // tolerate offcuts between intended and allocated memory due to segmentation (will be available to the user-space memory) final long numNetBuffersLong = networkBuf / segmentSize; if (numNetBuffersLong > Integer.MAX_VALUE) { throw new IllegalArgumentException("The given number of memory bytes (" + networkBuf + ") corresponds to more than MAX_INT pages."); } NetworkBufferPool networkBufferPool = new NetworkBufferPool( (int) numNetBuffersLong, segmentSize); ConnectionManager connectionManager; boolean enableCreditBased = false; NettyConfig nettyConfig = networkEnvironmentConfiguration.nettyConfig(); if (nettyConfig != null) { connectionManager = new NettyConnectionManager(nettyConfig); enableCreditBased = nettyConfig.isCreditBasedEnabled(); } else { connectionManager = new LocalConnectionManager(); } ResultPartitionManager resultPartitionManager = new ResultPartitionManager(); TaskEventDispatcher taskEventDispatcher = new TaskEventDispatcher(); KvStateRegistry kvStateRegistry = new KvStateRegistry(); QueryableStateConfiguration qsConfig = taskManagerServicesConfiguration.getQueryableStateConfig(); KvStateClientProxy kvClientProxy = null; KvStateServer kvStateServer = null; if (qsConfig != null) { int numProxyServerNetworkThreads = qsConfig.numProxyServerThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyServerThreads(); int numProxyServerQueryThreads = qsConfig.numProxyQueryThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyQueryThreads(); kvClientProxy = QueryableStateUtils.createKvStateClientProxy( taskManagerServicesConfiguration.getTaskManagerAddress(), qsConfig.getProxyPortRange(), numProxyServerNetworkThreads, numProxyServerQueryThreads, new DisabledKvStateRequestStats()); int numStateServerNetworkThreads = qsConfig.numStateServerThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateServerThreads(); int numStateServerQueryThreads = qsConfig.numStateQueryThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateQueryThreads(); kvStateServer = QueryableStateUtils.createKvStateServer( taskManagerServicesConfiguration.getTaskManagerAddress(), qsConfig.getStateServerPortRange(), numStateServerNetworkThreads, numStateServerQueryThreads, kvStateRegistry, new DisabledKvStateRequestStats()); } // we start the network first, to make sure it can allocate its buffers first return new NetworkEnvironment( networkBufferPool, connectionManager, resultPartitionManager, taskEventDispatcher, kvStateRegistry, kvStateServer, kvClientProxy, networkEnvironmentConfiguration.ioMode(), networkEnvironmentConfiguration.partitionRequestInitialBackoff(), networkEnvironmentConfiguration.partitionRequestMaxBackoff(), networkEnvironmentConfiguration.networkBuffersPerChannel(), networkEnvironmentConfiguration.floatingNetworkBuffersPerGate(), enableCreditBased); }
static NetworkEnvironment function( TaskManagerServicesConfiguration taskManagerServicesConfiguration, long maxJvmHeapMemory) { NetworkEnvironmentConfiguration networkEnvironmentConfiguration = taskManagerServicesConfiguration.getNetworkConfig(); final long networkBuf = calculateNetworkBufferMemory(taskManagerServicesConfiguration, maxJvmHeapMemory); int segmentSize = networkEnvironmentConfiguration.networkBufferSize(); final long numNetBuffersLong = networkBuf / segmentSize; if (numNetBuffersLong > Integer.MAX_VALUE) { throw new IllegalArgumentException(STR + networkBuf + STR); } NetworkBufferPool networkBufferPool = new NetworkBufferPool( (int) numNetBuffersLong, segmentSize); ConnectionManager connectionManager; boolean enableCreditBased = false; NettyConfig nettyConfig = networkEnvironmentConfiguration.nettyConfig(); if (nettyConfig != null) { connectionManager = new NettyConnectionManager(nettyConfig); enableCreditBased = nettyConfig.isCreditBasedEnabled(); } else { connectionManager = new LocalConnectionManager(); } ResultPartitionManager resultPartitionManager = new ResultPartitionManager(); TaskEventDispatcher taskEventDispatcher = new TaskEventDispatcher(); KvStateRegistry kvStateRegistry = new KvStateRegistry(); QueryableStateConfiguration qsConfig = taskManagerServicesConfiguration.getQueryableStateConfig(); KvStateClientProxy kvClientProxy = null; KvStateServer kvStateServer = null; if (qsConfig != null) { int numProxyServerNetworkThreads = qsConfig.numProxyServerThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyServerThreads(); int numProxyServerQueryThreads = qsConfig.numProxyQueryThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyQueryThreads(); kvClientProxy = QueryableStateUtils.createKvStateClientProxy( taskManagerServicesConfiguration.getTaskManagerAddress(), qsConfig.getProxyPortRange(), numProxyServerNetworkThreads, numProxyServerQueryThreads, new DisabledKvStateRequestStats()); int numStateServerNetworkThreads = qsConfig.numStateServerThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateServerThreads(); int numStateServerQueryThreads = qsConfig.numStateQueryThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateQueryThreads(); kvStateServer = QueryableStateUtils.createKvStateServer( taskManagerServicesConfiguration.getTaskManagerAddress(), qsConfig.getStateServerPortRange(), numStateServerNetworkThreads, numStateServerQueryThreads, kvStateRegistry, new DisabledKvStateRequestStats()); } return new NetworkEnvironment( networkBufferPool, connectionManager, resultPartitionManager, taskEventDispatcher, kvStateRegistry, kvStateServer, kvClientProxy, networkEnvironmentConfiguration.ioMode(), networkEnvironmentConfiguration.partitionRequestInitialBackoff(), networkEnvironmentConfiguration.partitionRequestMaxBackoff(), networkEnvironmentConfiguration.networkBuffersPerChannel(), networkEnvironmentConfiguration.floatingNetworkBuffersPerGate(), enableCreditBased); }
/** * Creates the {@link NetworkEnvironment} from the given {@link TaskManagerServicesConfiguration}. * * @param taskManagerServicesConfiguration to construct the network environment from * @param maxJvmHeapMemory the maximum JVM heap size * @return Network environment * @throws IOException */
Creates the <code>NetworkEnvironment</code> from the given <code>TaskManagerServicesConfiguration</code>
createNetworkEnvironment
{ "repo_name": "ueshin/apache-flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServices.java", "license": "apache-2.0", "size": 30443 }
[ "org.apache.flink.queryablestate.network.stats.DisabledKvStateRequestStats", "org.apache.flink.runtime.io.network.ConnectionManager", "org.apache.flink.runtime.io.network.LocalConnectionManager", "org.apache.flink.runtime.io.network.NetworkEnvironment", "org.apache.flink.runtime.io.network.TaskEventDispatcher", "org.apache.flink.runtime.io.network.buffer.NetworkBufferPool", "org.apache.flink.runtime.io.network.netty.NettyConfig", "org.apache.flink.runtime.io.network.netty.NettyConnectionManager", "org.apache.flink.runtime.io.network.partition.ResultPartitionManager", "org.apache.flink.runtime.query.KvStateClientProxy", "org.apache.flink.runtime.query.KvStateRegistry", "org.apache.flink.runtime.query.KvStateServer", "org.apache.flink.runtime.query.QueryableStateUtils", "org.apache.flink.runtime.taskmanager.NetworkEnvironmentConfiguration" ]
import org.apache.flink.queryablestate.network.stats.DisabledKvStateRequestStats; import org.apache.flink.runtime.io.network.ConnectionManager; import org.apache.flink.runtime.io.network.LocalConnectionManager; import org.apache.flink.runtime.io.network.NetworkEnvironment; import org.apache.flink.runtime.io.network.TaskEventDispatcher; import org.apache.flink.runtime.io.network.buffer.NetworkBufferPool; import org.apache.flink.runtime.io.network.netty.NettyConfig; import org.apache.flink.runtime.io.network.netty.NettyConnectionManager; import org.apache.flink.runtime.io.network.partition.ResultPartitionManager; import org.apache.flink.runtime.query.KvStateClientProxy; import org.apache.flink.runtime.query.KvStateRegistry; import org.apache.flink.runtime.query.KvStateServer; import org.apache.flink.runtime.query.QueryableStateUtils; import org.apache.flink.runtime.taskmanager.NetworkEnvironmentConfiguration;
import org.apache.flink.queryablestate.network.stats.*; import org.apache.flink.runtime.io.network.*; import org.apache.flink.runtime.io.network.buffer.*; import org.apache.flink.runtime.io.network.netty.*; import org.apache.flink.runtime.io.network.partition.*; import org.apache.flink.runtime.query.*; import org.apache.flink.runtime.taskmanager.*;
[ "org.apache.flink" ]
org.apache.flink;
1,191,644
CertStoreException tE = new CertStoreException(); assertNull("getMessage() must return null.", tE.getMessage()); assertNull("getCause() must return null", tE.getCause()); }
CertStoreException tE = new CertStoreException(); assertNull(STR, tE.getMessage()); assertNull(STR, tE.getCause()); }
/** * Test for <code>CertStoreException()</code> constructor Assertion: * constructs CertStoreException with no detail message */
Test for <code>CertStoreException()</code> constructor Assertion: constructs CertStoreException with no detail message
testCertStoreException01
{ "repo_name": "AdmireTheDistance/android_libcore", "path": "luni/src/test/java/tests/security/cert/CertStoreExceptionTest.java", "license": "gpl-2.0", "size": 6921 }
[ "java.security.cert.CertStoreException" ]
import java.security.cert.CertStoreException;
import java.security.cert.*;
[ "java.security" ]
java.security;
113,845
@Test public void testExtractSubscriptionLocal() { Subscription sub; Collection<LightProcessedRequestDTO> requests; ProcessedRequest pr; LightProcessedRequestDTO lightPr; RequestResultStatus status; Long subId; Long prId; // Create subscription sub = buildRecurrentSubscription(USER_TEST, ParameterCode.DATE_TIME_INTERVAL); sub.setExtractMode(ExtractMode.NOT_IN_LOCAL_CACHE); subId = subscriptionSrv.createSubscription(sub, URN_TEST); Assert.assertNotNull(subId); // Check Empty subscription sub = subscriptionSrv.getFullSubscription(subId); Assert.assertNotNull(sub); requests = processedRequestSrv .getAllProcessedRequestsByRequest(subId, 0, 500, null, null); Assert.assertNotNull(requests); Assert.assertTrue(requests.isEmpty()); // add subscription request pr = buildProcessedRequest(now.getTime()); prId = processedRequestSrv.addProcessedRequestToSubscription(sub, pr); Assert.assertNotNull(prId); sub = subscriptionSrv.getFullSubscription(subId); Assert.assertNotNull(sub); requests = processedRequestSrv .getAllProcessedRequestsByRequest(subId, 0, 500, null, null); Assert.assertNotNull(requests); Assert.assertEquals(1, requests.size()); lightPr = requests.iterator().next(); Assert.assertEquals(prId, lightPr.getId()); Assert.assertEquals(RequestResultStatus.CREATED, lightPr.getRequestResultStatus()); // Extract processedRequestSrv.extract(pr, DateTimeUtils.formatUTC(now.getTime()), null); // Check new status sub = subscriptionSrv.getFullSubscription(subId); Assert.assertNotNull(sub); requests = processedRequestSrv .getAllProcessedRequestsByRequest(subId, 0, 500, null, null); Assert.assertNotNull(requests); Assert.assertEquals(1, requests.size()); lightPr = requests.iterator().next(); Assert.assertEquals(prId, lightPr.getId()); status = lightPr.getRequestResultStatus(); Assert.assertFalse(RequestResultStatus.CREATED.equals(status)); Assert.assertFalse(RequestResultStatus.INITIAL.equals(status)); // FIXME use a determinism Harness LocalDataSource for better testing // Assert.assertFalse(RequestResultStatus.FAILED.equals(status)); }
void function() { Subscription sub; Collection<LightProcessedRequestDTO> requests; ProcessedRequest pr; LightProcessedRequestDTO lightPr; RequestResultStatus status; Long subId; Long prId; sub = buildRecurrentSubscription(USER_TEST, ParameterCode.DATE_TIME_INTERVAL); sub.setExtractMode(ExtractMode.NOT_IN_LOCAL_CACHE); subId = subscriptionSrv.createSubscription(sub, URN_TEST); Assert.assertNotNull(subId); sub = subscriptionSrv.getFullSubscription(subId); Assert.assertNotNull(sub); requests = processedRequestSrv .getAllProcessedRequestsByRequest(subId, 0, 500, null, null); Assert.assertNotNull(requests); Assert.assertTrue(requests.isEmpty()); pr = buildProcessedRequest(now.getTime()); prId = processedRequestSrv.addProcessedRequestToSubscription(sub, pr); Assert.assertNotNull(prId); sub = subscriptionSrv.getFullSubscription(subId); Assert.assertNotNull(sub); requests = processedRequestSrv .getAllProcessedRequestsByRequest(subId, 0, 500, null, null); Assert.assertNotNull(requests); Assert.assertEquals(1, requests.size()); lightPr = requests.iterator().next(); Assert.assertEquals(prId, lightPr.getId()); Assert.assertEquals(RequestResultStatus.CREATED, lightPr.getRequestResultStatus()); processedRequestSrv.extract(pr, DateTimeUtils.formatUTC(now.getTime()), null); sub = subscriptionSrv.getFullSubscription(subId); Assert.assertNotNull(sub); requests = processedRequestSrv .getAllProcessedRequestsByRequest(subId, 0, 500, null, null); Assert.assertNotNull(requests); Assert.assertEquals(1, requests.size()); lightPr = requests.iterator().next(); Assert.assertEquals(prId, lightPr.getId()); status = lightPr.getRequestResultStatus(); Assert.assertFalse(RequestResultStatus.CREATED.equals(status)); Assert.assertFalse(RequestResultStatus.INITIAL.equals(status)); }
/** * Test extract subscription local. */
Test extract subscription local
testExtractSubscriptionLocal
{ "repo_name": "OpenWIS/openwis", "path": "openwis-dataservice/openwis-dataservice-server/openwis-dataservice-server-ejb/src/test/java/org/openwis/datasource/server/service/impl/ProcessedRequestServiceImplIntegrationTestCase.java", "license": "gpl-3.0", "size": 35429 }
[ "java.util.Collection", "junit.framework.Assert", "org.openwis.dataservice.common.domain.dto.LightProcessedRequestDTO", "org.openwis.dataservice.common.domain.entity.enumeration.ExtractMode", "org.openwis.dataservice.common.domain.entity.enumeration.RequestResultStatus", "org.openwis.dataservice.common.domain.entity.request.ParameterCode", "org.openwis.dataservice.common.domain.entity.request.ProcessedRequest", "org.openwis.dataservice.common.domain.entity.subscription.Subscription", "org.openwis.dataservice.common.util.DateTimeUtils" ]
import java.util.Collection; import junit.framework.Assert; import org.openwis.dataservice.common.domain.dto.LightProcessedRequestDTO; import org.openwis.dataservice.common.domain.entity.enumeration.ExtractMode; import org.openwis.dataservice.common.domain.entity.enumeration.RequestResultStatus; import org.openwis.dataservice.common.domain.entity.request.ParameterCode; import org.openwis.dataservice.common.domain.entity.request.ProcessedRequest; import org.openwis.dataservice.common.domain.entity.subscription.Subscription; import org.openwis.dataservice.common.util.DateTimeUtils;
import java.util.*; import junit.framework.*; import org.openwis.dataservice.common.domain.dto.*; import org.openwis.dataservice.common.domain.entity.enumeration.*; import org.openwis.dataservice.common.domain.entity.request.*; import org.openwis.dataservice.common.domain.entity.subscription.*; import org.openwis.dataservice.common.util.*;
[ "java.util", "junit.framework", "org.openwis.dataservice" ]
java.util; junit.framework; org.openwis.dataservice;
2,283,584
@Override @RunsInEDT public void requireText(@Nonnull JTextComponent textBox, @Nonnull Pattern pattern) { verifyThat(textOf(textBox)).as(textProperty(textBox)).matches(pattern); }
void function(@Nonnull JTextComponent textBox, @Nonnull Pattern pattern) { verifyThat(textOf(textBox)).as(textProperty(textBox)).matches(pattern); }
/** * Asserts that the text in the given {@code JTextComponent} matches the given regular expression pattern. * * @param textBox the given {@code JTextComponent}. * @param pattern the regular expression pattern to match. * @throws NullPointerException if the given regular expression pattern is {@code null}. * @throws AssertionError if the text of the {@code JTextComponent} is not equal to the given one. * @since 1.2 */
Asserts that the text in the given JTextComponent matches the given regular expression pattern
requireText
{ "repo_name": "google/fest", "path": "third_party/fest-swing/src/main/java/org/fest/swing/driver/JTextComponentDriver.java", "license": "apache-2.0", "size": 16361 }
[ "java.util.regex.Pattern", "javax.annotation.Nonnull", "javax.swing.text.JTextComponent", "org.fest.swing.driver.TextAssert" ]
import java.util.regex.Pattern; import javax.annotation.Nonnull; import javax.swing.text.JTextComponent; import org.fest.swing.driver.TextAssert;
import java.util.regex.*; import javax.annotation.*; import javax.swing.text.*; import org.fest.swing.driver.*;
[ "java.util", "javax.annotation", "javax.swing", "org.fest.swing" ]
java.util; javax.annotation; javax.swing; org.fest.swing;
727,413
public com.squareup.okhttp.Call createNoteAsync(String parent, ApiNote body, final ApiCallback<ApiNote> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
com.squareup.okhttp.Call function(String parent, ApiNote body, final ApiCallback<ApiNote> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
/** * Creates a new &#x60;Note&#x60;. (asynchronously) * * @param parent (required) * @param body (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */
Creates a new &#x60;Note&#x60;. (asynchronously)
createNoteAsync
{ "repo_name": "grafeas/client-java", "path": "src/main/java/io/grafeas/api/GrafeasApi.java", "license": "apache-2.0", "size": 55376 }
[ "io.grafeas.ApiCallback", "io.grafeas.ApiException", "io.grafeas.ProgressRequestBody", "io.grafeas.ProgressResponseBody", "io.grafeas.model.ApiNote" ]
import io.grafeas.ApiCallback; import io.grafeas.ApiException; import io.grafeas.ProgressRequestBody; import io.grafeas.ProgressResponseBody; import io.grafeas.model.ApiNote;
import io.grafeas.*; import io.grafeas.model.*;
[ "io.grafeas", "io.grafeas.model" ]
io.grafeas; io.grafeas.model;
373,128
public Builder extrapolatorRight(CurveExtrapolator extrapolatorRight) { JodaBeanUtils.notNull(extrapolatorRight, "extrapolatorRight"); this.extrapolatorRight = extrapolatorRight; return this; }
Builder function(CurveExtrapolator extrapolatorRight) { JodaBeanUtils.notNull(extrapolatorRight, STR); this.extrapolatorRight = extrapolatorRight; return this; }
/** * Sets the right extrapolator for the SABR parameter curves. * <p> * The x value of the interpolated curves is the expiry. * @param extrapolatorRight the new value, not null * @return this, for chaining, not null */
Sets the right extrapolator for the SABR parameter curves. The x value of the interpolated curves is the expiry
extrapolatorRight
{ "repo_name": "ChinaQuants/Strata", "path": "modules/pricer/src/main/java/com/opengamma/strata/pricer/capfloor/SabrIborCapletFloorletVolatilityBootstrapDefinition.java", "license": "apache-2.0", "size": 41369 }
[ "com.opengamma.strata.market.curve.interpolator.CurveExtrapolator", "org.joda.beans.JodaBeanUtils" ]
import com.opengamma.strata.market.curve.interpolator.CurveExtrapolator; import org.joda.beans.JodaBeanUtils;
import com.opengamma.strata.market.curve.interpolator.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
2,417,791
public void testIt5() throws Exception { final String dir = "src/test/it5"; runTest( dir ); Document doc1 = parse( new File( dir, "xml/doc1.xml" ) ); doc1.normalize(); Document doc2 = parse( new File( dir, "target/generated-resources/xml/xslt/doc1.xml" ) ); doc2.normalize(); Element doc1Element = doc1.getDocumentElement(); assertEquals( "doc1", doc1Element.getLocalName() ); assertNull( doc1Element.getNamespaceURI() ); Element doc2Element = doc2.getDocumentElement(); assertEquals( "doc2", doc2Element.getLocalName() ); assertNull( doc2Element.getNamespaceURI() ); Node text1 = doc1Element.getFirstChild(); assertNotNull( text1 ); assertNull( text1.getNextSibling() ); assertEquals( Node.TEXT_NODE, text1.getNodeType() ); Node text2 = doc2Element.getFirstChild(); assertNotNull( text2 ); assertNull( text2.getNextSibling() ); assertEquals( Node.TEXT_NODE, text2.getNodeType() ); assertEquals(text2.getNodeValue(), "parameter passed in"); }
void function() throws Exception { final String dir = STR; runTest( dir ); Document doc1 = parse( new File( dir, STR ) ); doc1.normalize(); Document doc2 = parse( new File( dir, STR ) ); doc2.normalize(); Element doc1Element = doc1.getDocumentElement(); assertEquals( "doc1", doc1Element.getLocalName() ); assertNull( doc1Element.getNamespaceURI() ); Element doc2Element = doc2.getDocumentElement(); assertEquals( "doc2", doc2Element.getLocalName() ); assertNull( doc2Element.getNamespaceURI() ); Node text1 = doc1Element.getFirstChild(); assertNotNull( text1 ); assertNull( text1.getNextSibling() ); assertEquals( Node.TEXT_NODE, text1.getNodeType() ); Node text2 = doc2Element.getFirstChild(); assertNotNull( text2 ); assertNull( text2.getNextSibling() ); assertEquals( Node.TEXT_NODE, text2.getNodeType() ); assertEquals(text2.getNodeValue(), STR); }
/** * Builds the it5 test project. */
Builds the it5 test project
testIt5
{ "repo_name": "mohanaraosv/xml-maven-plugin", "path": "src/test/java/org/codehaus/mojo/xml/test/TransformMojoTest.java", "license": "apache-2.0", "size": 9627 }
[ "java.io.File", "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.Node" ]
import java.io.File; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node;
import java.io.*; import org.w3c.dom.*;
[ "java.io", "org.w3c.dom" ]
java.io; org.w3c.dom;
653,016
if(StringService.isEmpty(name) || StringService.isEmpty(signature)) return ; // encode signature under base 64. String base64Content = Base64Service.encodeString(signature) ; // add data. this.setField(name, base64Content) ; }
if(StringService.isEmpty(name) StringService.isEmpty(signature)) return ; String base64Content = Base64Service.encodeString(signature) ; this.setField(name, base64Content) ; }
/** * Set signature. * * @param name String - the given signature name. * @param signature String - the given signature content. */
Set signature
setSignature
{ "repo_name": "inetcloud/iMail", "path": "source/com.inet.mail/src/com/inet/mail/data/MailSignature.java", "license": "gpl-2.0", "size": 4080 }
[ "com.inet.base.service.Base64Service", "com.inet.base.service.StringService" ]
import com.inet.base.service.Base64Service; import com.inet.base.service.StringService;
import com.inet.base.service.*;
[ "com.inet.base" ]
com.inet.base;
1,937,280
public static MRequestType getDefault (Properties ctx) { int AD_Client_ID = Env.getAD_Client_ID(ctx); //FR: [ 2214883 ] Remove SQL code and Replace for Query - red1 final String whereClause = "AD_Client_ID IN (0," + AD_Client_ID + ")"; MRequestType retValue = new Query(ctx, I_R_RequestType.Table_Name, whereClause, null) .setOrderBy("IsDefault DESC, AD_Client_ID DESC") .first(); if (retValue != null && !retValue.isDefault()) retValue = null; return retValue; } // get public MRequestType (Properties ctx, int R_RequestType_ID, String trxName) { super(ctx, R_RequestType_ID, trxName); if (R_RequestType_ID == 0) { // setR_RequestType_ID (0); // setName (null); setDueDateTolerance (7); setIsDefault (false); setIsEMailWhenDue (false); setIsEMailWhenOverdue (false); setIsSelfService (true); // Y setAutoDueDateDays(0); setConfidentialType(CONFIDENTIALTYPE_PublicInformation); setIsAutoChangeRequest(false); setIsConfidentialInfo(false); setIsIndexed(true); setIsInvoiced(false); } } // MRequestType public MRequestType(Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); } // MRequestType private long m_nextStats = 0; private int m_openNo = 0; private int m_totalNo = 0; private int m_new30No = 0; private int m_closed30No = 0;
static MRequestType function (Properties ctx) { int AD_Client_ID = Env.getAD_Client_ID(ctx); final String whereClause = STR + AD_Client_ID + ")"; MRequestType retValue = new Query(ctx, I_R_RequestType.Table_Name, whereClause, null) .setOrderBy(STR) .first(); if (retValue != null && !retValue.isDefault()) retValue = null; return retValue; } public MRequestType (Properties ctx, int R_RequestType_ID, String trxName) { super(ctx, R_RequestType_ID, trxName); if (R_RequestType_ID == 0) { setDueDateTolerance (7); setIsDefault (false); setIsEMailWhenDue (false); setIsEMailWhenOverdue (false); setIsSelfService (true); setAutoDueDateDays(0); setConfidentialType(CONFIDENTIALTYPE_PublicInformation); setIsAutoChangeRequest(false); setIsConfidentialInfo(false); setIsIndexed(true); setIsInvoiced(false); } } public MRequestType(Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); } private long m_nextStats = 0; private int m_openNo = 0; private int m_totalNo = 0; private int m_new30No = 0; private int m_closed30No = 0;
/** * Get Default Request Type * @param ctx context * @return Request Type */
Get Default Request Type
getDefault
{ "repo_name": "erpcya/adempierePOS", "path": "base/src/org/compiere/model/MRequestType.java", "license": "gpl-2.0", "size": 15344 }
[ "java.sql.ResultSet", "java.util.Properties", "org.compiere.util.Env" ]
import java.sql.ResultSet; import java.util.Properties; import org.compiere.util.Env;
import java.sql.*; import java.util.*; import org.compiere.util.*;
[ "java.sql", "java.util", "org.compiere.util" ]
java.sql; java.util; org.compiere.util;
867,779
@RequestMapping(value = "/view/{id:[\\d]+}/get", method = { RequestMethod.GET }) @ResponseBody public IRestResponse getView(@PathVariable final long id, HttpServletRequest request) throws UnsupportedEncodingException { logger.info("Request received. URL: '/lider/report/view/{}/get'", id); IRestResponse restResponse = reportProcessor.getView(id); logger.debug("Completed processing request, returning result: {}", restResponse.toJson()); return restResponse; }
@RequestMapping(value = STR, method = { RequestMethod.GET }) IRestResponse function(@PathVariable final long id, HttpServletRequest request) throws UnsupportedEncodingException { logger.info(STR, id); IRestResponse restResponse = reportProcessor.getView(id); logger.debug(STR, restResponse.toJson()); return restResponse; }
/** * Retrieve view specified by id * * @param id * @param request * @return * @throws UnsupportedEncodingException */
Retrieve view specified by id
getView
{ "repo_name": "Pardus-LiderAhenk/lider", "path": "lider-web/src/main/java/tr/org/liderahenk/web/controller/ReportController.java", "license": "lgpl-3.0", "size": 12551 }
[ "java.io.UnsupportedEncodingException", "javax.servlet.http.HttpServletRequest", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "tr.org.liderahenk.lider.core.api.rest.responses.IRestResponse" ]
import java.io.UnsupportedEncodingException; import javax.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import tr.org.liderahenk.lider.core.api.rest.responses.IRestResponse;
import java.io.*; import javax.servlet.http.*; import org.springframework.web.bind.annotation.*; import tr.org.liderahenk.lider.core.api.rest.responses.*;
[ "java.io", "javax.servlet", "org.springframework.web", "tr.org.liderahenk" ]
java.io; javax.servlet; org.springframework.web; tr.org.liderahenk;
678,044
public static final LanguageServiceClient create(LanguageServiceSettings settings) throws IOException { return new LanguageServiceClient(settings); } protected LanguageServiceClient(LanguageServiceSettings settings) throws IOException { this.settings = settings; ChannelAndExecutor channelAndExecutor = settings.getChannelAndExecutor(); this.executor = channelAndExecutor.getExecutor(); this.channel = channelAndExecutor.getChannel(); this.analyzeSentimentCallable = UnaryCallable.create(settings.analyzeSentimentSettings(), this.channel, this.executor); this.analyzeEntitiesCallable = UnaryCallable.create(settings.analyzeEntitiesSettings(), this.channel, this.executor); this.analyzeSyntaxCallable = UnaryCallable.create(settings.analyzeSyntaxSettings(), this.channel, this.executor); this.annotateTextCallable = UnaryCallable.create(settings.annotateTextSettings(), this.channel, this.executor);
static final LanguageServiceClient function(LanguageServiceSettings settings) throws IOException { return new LanguageServiceClient(settings); } protected LanguageServiceClient(LanguageServiceSettings settings) throws IOException { this.settings = settings; ChannelAndExecutor channelAndExecutor = settings.getChannelAndExecutor(); this.executor = channelAndExecutor.getExecutor(); this.channel = channelAndExecutor.getChannel(); this.analyzeSentimentCallable = UnaryCallable.create(settings.analyzeSentimentSettings(), this.channel, this.executor); this.analyzeEntitiesCallable = UnaryCallable.create(settings.analyzeEntitiesSettings(), this.channel, this.executor); this.analyzeSyntaxCallable = UnaryCallable.create(settings.analyzeSyntaxSettings(), this.channel, this.executor); this.annotateTextCallable = UnaryCallable.create(settings.annotateTextSettings(), this.channel, this.executor);
/** * Constructs an instance of LanguageServiceClient, using the given settings. The channels are * created based on the settings passed in, or defaults for any settings that are not set. */
Constructs an instance of LanguageServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set
create
{ "repo_name": "jabubake/google-cloud-java", "path": "google-cloud-language/src/main/java/com/google/cloud/language/spi/v1/LanguageServiceClient.java", "license": "apache-2.0", "size": 20013 }
[ "com.google.api.gax.grpc.ChannelAndExecutor", "com.google.api.gax.grpc.UnaryCallable", "java.io.IOException" ]
import com.google.api.gax.grpc.ChannelAndExecutor; import com.google.api.gax.grpc.UnaryCallable; import java.io.IOException;
import com.google.api.gax.grpc.*; import java.io.*;
[ "com.google.api", "java.io" ]
com.google.api; java.io;
827,434
private List<DBlock> loadBlock(Input kryo_in, Output kryo_out, int bsize, Collection<Boolean> newBlocks) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, NotEnoughSpaceOnDisc{ Kryo kryo = new Kryo(null); kryo.setAutoReset(true); String message = kryo_in.readString(); while (message.equals("check") || message.equals("get_vals")){ switch (message) { case "check": String hash2 = kryo_in.readString(); boolean exists = db.blockExists(hash2); kryo_out.writeBoolean(exists); kryo_out.flush(); break; case "get_vals": Set<Long> vals = db.getBlockHashes(); kryo_out.writeInt(vals.size()); for (long L : vals){ kryo_out.writeLong(L); } kryo_out.flush(); break; } message = kryo_in.readString(); } switch(message){ case "end": return null; case "raw_data": byte[] data = kryo.readObject(kryo_in, byte[].class); newBlocks.add(Boolean.TRUE); List<DBlock> res = create_save_blocks(data,bsize); kryo_out.writeInt(res.size()); for (DBlock b : res){ kryo_out.writeLong(b.getHash()); } kryo_out.flush(); return res; case "hash": long hash = kryo_in.readLong(); String hash2 = kryo_in.readString(); DBlock block = db.findBlock(hash, hash2); if (block == null){ throw new ProtocolException(); } else { return Arrays.asList(block); } default: throw new ProtocolException(); } }
List<DBlock> function(Input kryo_in, Output kryo_out, int bsize, Collection<Boolean> newBlocks) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, NotEnoughSpaceOnDisc{ Kryo kryo = new Kryo(null); kryo.setAutoReset(true); String message = kryo_in.readString(); while (message.equals("check") message.equals(STR)){ switch (message) { case "check": String hash2 = kryo_in.readString(); boolean exists = db.blockExists(hash2); kryo_out.writeBoolean(exists); kryo_out.flush(); break; case STR: Set<Long> vals = db.getBlockHashes(); kryo_out.writeInt(vals.size()); for (long L : vals){ kryo_out.writeLong(L); } kryo_out.flush(); break; } message = kryo_in.readString(); } switch(message){ case "end": return null; case STR: byte[] data = kryo.readObject(kryo_in, byte[].class); newBlocks.add(Boolean.TRUE); List<DBlock> res = create_save_blocks(data,bsize); kryo_out.writeInt(res.size()); for (DBlock b : res){ kryo_out.writeLong(b.getHash()); } kryo_out.flush(); return res; case "hash": long hash = kryo_in.readLong(); String hash2 = kryo_in.readString(); DBlock block = db.findBlock(hash, hash2); if (block == null){ throw new ProtocolException(); } else { return Arrays.asList(block); } default: throw new ProtocolException(); } }
/** * Loads a single block id, or some raw data as a byte array, from the "kryo_in" input. * In the case of raw data, it is then parsed into blocks and these new blocks are returned. * @param kryo_in * @param kryo_out * @param newBlocks Indicates whether a new block has been parsed from raw data in the new file version. * @param bsize Block size used when parsing raw data into new blocks. * @return * @throws IOException * @throws ClassNotFoundException * @throws NoSuchAlgorithmException * @throws NotEnoughSpaceOnDisc */
Loads a single block id, or some raw data as a byte array, from the "kryo_in" input. In the case of raw data, it is then parsed into blocks and these new blocks are returned
loadBlock
{ "repo_name": "filipekt/save-the-world", "path": "src/main/java/cz/filipekt/Server.java", "license": "mit", "size": 53612 }
[ "com.esotericsoftware.kryo.Kryo", "com.esotericsoftware.kryo.io.Input", "com.esotericsoftware.kryo.io.Output", "java.io.IOException", "java.net.ProtocolException", "java.security.NoSuchAlgorithmException", "java.util.Arrays", "java.util.Collection", "java.util.List", "java.util.Set" ]
import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; import java.io.IOException; import java.net.ProtocolException; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Set;
import com.esotericsoftware.kryo.*; import com.esotericsoftware.kryo.io.*; import java.io.*; import java.net.*; import java.security.*; import java.util.*;
[ "com.esotericsoftware.kryo", "java.io", "java.net", "java.security", "java.util" ]
com.esotericsoftware.kryo; java.io; java.net; java.security; java.util;
1,123,570
public static void performHttpPostRequest(String uri, String jsonPayload, String authToken) throws JsonProcessingException { StringEntity entity = new StringEntity(jsonPayload, "UTF-8"); entity.setContentType(MediaType.APPLICATION_JSON); performHttpPostRequest(uri, entity, Optional.ofNullable(authToken)); }
static void function(String uri, String jsonPayload, String authToken) throws JsonProcessingException { StringEntity entity = new StringEntity(jsonPayload, "UTF-8"); entity.setContentType(MediaType.APPLICATION_JSON); performHttpPostRequest(uri, entity, Optional.ofNullable(authToken)); }
/** * Performs HTTP post request to a uri with a json payload * * @param uri URI of a remote endpoint * @param jsonPayload Request content, already formatted as json string * @param authToken The authorization token */
Performs HTTP post request to a uri with a json payload
performHttpPostRequest
{ "repo_name": "pkocandr/pnc", "path": "common/src/main/java/org/jboss/pnc/common/util/HttpUtils.java", "license": "apache-2.0", "size": 8370 }
[ "com.fasterxml.jackson.core.JsonProcessingException", "java.util.Optional", "javax.ws.rs.core.MediaType", "org.apache.http.entity.StringEntity" ]
import com.fasterxml.jackson.core.JsonProcessingException; import java.util.Optional; import javax.ws.rs.core.MediaType; import org.apache.http.entity.StringEntity;
import com.fasterxml.jackson.core.*; import java.util.*; import javax.ws.rs.core.*; import org.apache.http.entity.*;
[ "com.fasterxml.jackson", "java.util", "javax.ws", "org.apache.http" ]
com.fasterxml.jackson; java.util; javax.ws; org.apache.http;
305,803
@Override public void onGuiClosed() { Keyboard.enableRepeatEvents(false); }
void function() { Keyboard.enableRepeatEvents(false); }
/** * "Called when the screen is unloaded. Used to disable keyboard repeat events." */
"Called when the screen is unloaded. Used to disable keyboard repeat events."
onGuiClosed
{ "repo_name": "Elviond/Wurst-Client", "path": "Wurst Client/src/tk/wurst_client/gui/mods/GuiBookHack.java", "license": "mpl-2.0", "size": 3282 }
[ "org.lwjgl.input.Keyboard" ]
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.*;
[ "org.lwjgl.input" ]
org.lwjgl.input;
1,736,459
isLoggedIn = false; // reset login flag if (httpClient == null) { httpClient = new HttpClient(); } final String url = "http://" + hostname + ":" + port + "/fsapi/CREATE_SESSION?pin=" + pin; logger.trace("opening URL:" + url); final HttpMethod method = new GetMethod(url); method.getParams().setSoTimeout(SOCKET_TIMEOUT); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); try { final int statusCode = httpClient.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { logger.warn("Method failed: " + method.getStatusLine()); } final String responseBody = IOUtils.toString(method.getResponseBodyAsStream()); if (!responseBody.isEmpty()) { logger.trace("login response: " + responseBody); } try { final FrontierSiliconRadioApiResult result = new FrontierSiliconRadioApiResult(responseBody); if (result.isStatusOk()) { logger.trace("login successful"); sessionId = result.getSessionId(); isLoggedIn = true; return true; // login successful :-) } } catch (Exception e) { logger.error("Parsing response failed"); } } catch (HttpException he) { logger.error("Fatal protocol violation: {}", he.toString()); } catch (IOException ioe) { logger.error("Fatal transport error: {}", ioe.toString()); } finally { method.releaseConnection(); } return false; // login not successful }
isLoggedIn = false; if (httpClient == null) { httpClient = new HttpClient(); } final String url = STRopening URL:STRMethod failed: STRlogin response: STRlogin successfulSTRParsing response failedSTRFatal protocol violation: {}STRFatal transport error: {}", ioe.toString()); } finally { method.releaseConnection(); } return false; }
/** * Perform login/establish a new session. Uses the PIN number and when successful saves the assigned sessionID for * future requests. * * @return <code>true</code> if login was successful; <code>false</code> otherwise. */
Perform login/establish a new session. Uses the PIN number and when successful saves the assigned sessionID for future requests
doLogin
{ "repo_name": "TheNetStriker/openhab", "path": "bundles/binding/org.openhab.binding.frontiersiliconradio/src/main/java/org/openhab/binding/frontiersiliconradio/internal/FrontierSiliconRadioConnection.java", "license": "epl-1.0", "size": 7259 }
[ "org.apache.commons.httpclient.HttpClient" ]
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.*;
[ "org.apache.commons" ]
org.apache.commons;
2,126,597
private void maybeProposePropertyWrite(IJavaProject project, IMethod method, String propertyName, int invocationOffset, int indentationUnits, boolean isStatic, List<ICompletionProposal> proposals, int numCharsFilled, int numCharsToOverwrite) throws JavaModelException { String[] parameterNames = method.getParameterNames(); if (parameterNames.length == 1 && propertyName.length() > 0) { String expression = createJsPropertyWriteExpression(propertyName, parameterNames[0], isStatic); String code = createJsniBlock(project, expression, indentationUnits); proposals.add(createProposal(method.getFlags(), code, invocationOffset, numCharsFilled, numCharsToOverwrite, expression)); } }
void function(IJavaProject project, IMethod method, String propertyName, int invocationOffset, int indentationUnits, boolean isStatic, List<ICompletionProposal> proposals, int numCharsFilled, int numCharsToOverwrite) throws JavaModelException { String[] parameterNames = method.getParameterNames(); if (parameterNames.length == 1 && propertyName.length() > 0) { String expression = createJsPropertyWriteExpression(propertyName, parameterNames[0], isStatic); String code = createJsniBlock(project, expression, indentationUnits); proposals.add(createProposal(method.getFlags(), code, invocationOffset, numCharsFilled, numCharsToOverwrite, expression)); } }
/** * Proposes a JSNI method of the form * <code>this.property = newPropertyValue</code> if the java method has a * single parameter. */
Proposes a JSNI method of the form <code>this.property = newPropertyValue</code> if the java method has a single parameter
maybeProposePropertyWrite
{ "repo_name": "boa0332/google-plugin-for-eclipse", "path": "plugins/com.google.gwt.eclipse.core/src/com/google/gwt/eclipse/core/editors/java/JsniMethodBodyCompletionProposalComputer.java", "license": "epl-1.0", "size": 26143 }
[ "java.util.List", "org.eclipse.jdt.core.IJavaProject", "org.eclipse.jdt.core.IMethod", "org.eclipse.jdt.core.JavaModelException", "org.eclipse.jface.text.contentassist.ICompletionProposal" ]
import java.util.List; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.text.contentassist.ICompletionProposal;
import java.util.*; import org.eclipse.jdt.core.*; import org.eclipse.jface.text.contentassist.*;
[ "java.util", "org.eclipse.jdt", "org.eclipse.jface" ]
java.util; org.eclipse.jdt; org.eclipse.jface;
1,192,666
private long getTimeout() { String timeout = processConfiguration.getEndpointProperties(serviceReference) .get(Properties.PROP_MEX_TIMEOUT); if (timeout != null) { try { return Long.parseLong(timeout); } catch (NumberFormatException e) { log.warn("Mal-formatted Property: [" + Properties.PROP_MEX_TIMEOUT + "=" + timeout + "] Default value (" + Properties.DEFAULT_MEX_TIMEOUT + ") will be used"); } } // Default value is 120000 milliseconds and if specified in bps.xml configuration file, that value will be // returned. return BPELServerImpl.getInstance().getBpelServerConfiguration().getMexTimeOut(); }
long function() { String timeout = processConfiguration.getEndpointProperties(serviceReference) .get(Properties.PROP_MEX_TIMEOUT); if (timeout != null) { try { return Long.parseLong(timeout); } catch (NumberFormatException e) { log.warn(STR + Properties.PROP_MEX_TIMEOUT + "=" + timeout + STR + Properties.DEFAULT_MEX_TIMEOUT + STR); } } return BPELServerImpl.getInstance().getBpelServerConfiguration().getMexTimeOut(); }
/** * do not store the value so it can be dynamically updated. * * @return Message Exchange Timeout */
do not store the value so it can be dynamically updated
getTimeout
{ "repo_name": "himasha/carbon-business-process", "path": "components/bpel/org.wso2.carbon.bpel/src/main/java/org/wso2/carbon/bpel/core/ode/integration/BPELProcessProxy.java", "license": "apache-2.0", "size": 21469 }
[ "org.apache.ode.utils.Properties" ]
import org.apache.ode.utils.Properties;
import org.apache.ode.utils.*;
[ "org.apache.ode" ]
org.apache.ode;
240,547
public boolean handleRequest(MessageContext messageContext) { if (ServiceReferenceHolder.getInstance().getThrottleDataPublisher() == null) { log.error("Cannot publish events to traffic manager because ThrottleDataPublisher " + "has not been initialised"); return true; } Timer timer3 = getTimer(MetricManager.name( APIConstants.METRICS_PREFIX, this.getClass().getSimpleName(), THROTTLE_MAIN)); Timer.Context context3 = timer3.start(); TracingSpan throttleLatencySpan = null; if (Util.tracingEnabled()) { TracingSpan responseLatencySpan = (TracingSpan) messageContext.getProperty(APIMgtGatewayConstants.RESPONSE_LATENCY); TracingTracer tracer = Util.getGlobalTracer(); throttleLatencySpan = Util.startSpan(APIMgtGatewayConstants.THROTTLE_LATENCY, responseLatencySpan, tracer); } long executionStartTime = System.currentTimeMillis(); if (!ExtensionListenerUtil.preProcessRequest(messageContext, type)) { return false; } try { boolean throttleResponse = doThrottle(messageContext); if (!ExtensionListenerUtil.postProcessRequest(messageContext, type)) { return false; } return throttleResponse; } catch (Exception e) { if (Util.tracingEnabled() && throttleLatencySpan != null) { Util.setTag(throttleLatencySpan, APIMgtGatewayConstants.ERROR, APIMgtGatewayConstants.THROTTLE_HANDLER_ERROR); } throw e; } finally { messageContext.setProperty(APIMgtGatewayConstants.THROTTLING_LATENCY, System.currentTimeMillis() - executionStartTime); context3.stop(); if (Util.tracingEnabled()) { Util.finishSpan(throttleLatencySpan); } } }
boolean function(MessageContext messageContext) { if (ServiceReferenceHolder.getInstance().getThrottleDataPublisher() == null) { log.error(STR + STR); return true; } Timer timer3 = getTimer(MetricManager.name( APIConstants.METRICS_PREFIX, this.getClass().getSimpleName(), THROTTLE_MAIN)); Timer.Context context3 = timer3.start(); TracingSpan throttleLatencySpan = null; if (Util.tracingEnabled()) { TracingSpan responseLatencySpan = (TracingSpan) messageContext.getProperty(APIMgtGatewayConstants.RESPONSE_LATENCY); TracingTracer tracer = Util.getGlobalTracer(); throttleLatencySpan = Util.startSpan(APIMgtGatewayConstants.THROTTLE_LATENCY, responseLatencySpan, tracer); } long executionStartTime = System.currentTimeMillis(); if (!ExtensionListenerUtil.preProcessRequest(messageContext, type)) { return false; } try { boolean throttleResponse = doThrottle(messageContext); if (!ExtensionListenerUtil.postProcessRequest(messageContext, type)) { return false; } return throttleResponse; } catch (Exception e) { if (Util.tracingEnabled() && throttleLatencySpan != null) { Util.setTag(throttleLatencySpan, APIMgtGatewayConstants.ERROR, APIMgtGatewayConstants.THROTTLE_HANDLER_ERROR); } throw e; } finally { messageContext.setProperty(APIMgtGatewayConstants.THROTTLING_LATENCY, System.currentTimeMillis() - executionStartTime); context3.stop(); if (Util.tracingEnabled()) { Util.finishSpan(throttleLatencySpan); } } }
/** * Handle incoming requests and call throttling method to perform throttling. * * @param messageContext message context object which contains message details. * @return return true if message flow need to continue and pass requests to next handler in chain. Else return * false to notify error with handler */
Handle incoming requests and call throttling method to perform throttling
handleRequest
{ "repo_name": "chamindias/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/throttling/ThrottleHandler.java", "license": "apache-2.0", "size": 64032 }
[ "org.apache.synapse.MessageContext", "org.wso2.carbon.apimgt.gateway.APIMgtGatewayConstants", "org.wso2.carbon.apimgt.gateway.handlers.ext.listener.ExtensionListenerUtil", "org.wso2.carbon.apimgt.gateway.internal.ServiceReferenceHolder", "org.wso2.carbon.apimgt.impl.APIConstants", "org.wso2.carbon.apimgt.tracing.TracingSpan", "org.wso2.carbon.apimgt.tracing.TracingTracer", "org.wso2.carbon.apimgt.tracing.Util", "org.wso2.carbon.metrics.manager.MetricManager", "org.wso2.carbon.metrics.manager.Timer" ]
import org.apache.synapse.MessageContext; import org.wso2.carbon.apimgt.gateway.APIMgtGatewayConstants; import org.wso2.carbon.apimgt.gateway.handlers.ext.listener.ExtensionListenerUtil; import org.wso2.carbon.apimgt.gateway.internal.ServiceReferenceHolder; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.tracing.TracingSpan; import org.wso2.carbon.apimgt.tracing.TracingTracer; import org.wso2.carbon.apimgt.tracing.Util; import org.wso2.carbon.metrics.manager.MetricManager; import org.wso2.carbon.metrics.manager.Timer;
import org.apache.synapse.*; import org.wso2.carbon.apimgt.gateway.*; import org.wso2.carbon.apimgt.gateway.handlers.ext.listener.*; import org.wso2.carbon.apimgt.gateway.internal.*; import org.wso2.carbon.apimgt.impl.*; import org.wso2.carbon.apimgt.tracing.*; import org.wso2.carbon.metrics.manager.*;
[ "org.apache.synapse", "org.wso2.carbon" ]
org.apache.synapse; org.wso2.carbon;
1,947,852
public static byte[] getAuthnChallenge(HttpSession session) { return getAuthnChallenge(session, null); }
static byte[] function(HttpSession session) { return getAuthnChallenge(session, null); }
/** * Gives back the authentication challenge. This challenge is checked for * freshness and can be consumed only once. * * @param session * @return */
Gives back the authentication challenge. This challenge is checked for freshness and can be consumed only once
getAuthnChallenge
{ "repo_name": "marwensaid/eid-applet", "path": "eid-applet-service/src/main/java/be/fedict/eid/applet/service/impl/AuthenticationChallenge.java", "license": "gpl-3.0", "size": 4237 }
[ "javax.servlet.http.HttpSession" ]
import javax.servlet.http.HttpSession;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
2,794,418
static DownloadOrder buildDownloadOrderUnderSizeLimit(UserInfo user, List<FileHandleAssociation> fullList, Map<String, Long> downloadableFileSizes, String zipFileName) { // build up a list of files to download up to the size limit. long totalSizeBytes = 0L; List<FileHandleAssociation> toDownload = new LinkedList<>(); for (FileHandleAssociation association : fullList) { Long fileSizeBytes = downloadableFileSizes.get(association.getFileHandleId()); if (fileSizeBytes != null) { if (totalSizeBytes + fileSizeBytes <= FileConstants.BULK_FILE_DOWNLOAD_MAX_SIZE_BYTES) { totalSizeBytes += fileSizeBytes; toDownload.add(association); } } } // create the new download order DownloadOrder order = new DownloadOrder(); order.setCreatedBy(user.getId().toString()); order.setCreatedOn(new Date()); order.setFiles(toDownload); order.setTotalNumberOfFiles((long) toDownload.size()); order.setTotalSizeBytes(totalSizeBytes); order.setZipFileName(zipFileName); return order; }
static DownloadOrder buildDownloadOrderUnderSizeLimit(UserInfo user, List<FileHandleAssociation> fullList, Map<String, Long> downloadableFileSizes, String zipFileName) { long totalSizeBytes = 0L; List<FileHandleAssociation> toDownload = new LinkedList<>(); for (FileHandleAssociation association : fullList) { Long fileSizeBytes = downloadableFileSizes.get(association.getFileHandleId()); if (fileSizeBytes != null) { if (totalSizeBytes + fileSizeBytes <= FileConstants.BULK_FILE_DOWNLOAD_MAX_SIZE_BYTES) { totalSizeBytes += fileSizeBytes; toDownload.add(association); } } } DownloadOrder order = new DownloadOrder(); order.setCreatedBy(user.getId().toString()); order.setCreatedOn(new Date()); order.setFiles(toDownload); order.setTotalNumberOfFiles((long) toDownload.size()); order.setTotalSizeBytes(totalSizeBytes); order.setZipFileName(zipFileName); return order; }
/** * Helper to build a Download from the full list of files on the user's and the * file sizes of the files the user has permission to download. * * @param user * @param fullList All of the files on the user's download list. * @param downloadableFileSizes The sizes of the files the user has permission * to download. * @param zipFileName The name of the resulting ZIP file. * @return */
Helper to build a Download from the full list of files on the user's and the file sizes of the files the user has permission to download
buildDownloadOrderUnderSizeLimit
{ "repo_name": "Sage-Bionetworks/Synapse-Repository-Services", "path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/file/download/BulkDownloadManagerImpl.java", "license": "apache-2.0", "size": 14898 }
[ "java.util.Date", "java.util.LinkedList", "java.util.List", "java.util.Map", "org.sagebionetworks.repo.model.UserInfo", "org.sagebionetworks.repo.model.file.DownloadOrder", "org.sagebionetworks.repo.model.file.FileConstants", "org.sagebionetworks.repo.model.file.FileHandleAssociation" ]
import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.model.file.DownloadOrder; import org.sagebionetworks.repo.model.file.FileConstants; import org.sagebionetworks.repo.model.file.FileHandleAssociation;
import java.util.*; import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.file.*;
[ "java.util", "org.sagebionetworks.repo" ]
java.util; org.sagebionetworks.repo;
633,981
EList<FSObject> getContents();
EList<FSObject> getContents();
/** * Returns the value of the '<em><b>Contents</b></em>' containment reference list. * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject}. * It is bidirectional and its opposite is '{@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject#getParent <em>Parent</em>}'. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Contents</em>' containment reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Contents</em>' containment reference list. * @see hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage#getDir_Contents() * @see hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject#getParent * @model opposite="parent" containment="true" * @generated */
Returns the value of the 'Contents' containment reference list. The list contents are of type <code>hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject</code>. It is bidirectional and its opposite is '<code>hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject#getParent Parent</code>'. If the meaning of the 'Contents' containment reference list isn't clear, there really should be more of a description here...
getContents
{ "repo_name": "viatra/VIATRA-Generator", "path": "Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/Dir.java", "license": "epl-1.0", "size": 1585 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
670,441
private HashMap<Object, Double> toMap() { if(!value.containsKey(DEFAULT_VALUE)) value.put(DEFAULT_VALUE, null); return value; } }
HashMap<Object, Double> function() { if(!value.containsKey(DEFAULT_VALUE)) value.put(DEFAULT_VALUE, null); return value; } }
/** * Converts mapping to HashMap. */
Converts mapping to HashMap
toMap
{ "repo_name": "shroman/ignite", "path": "modules/ml/src/main/java/org/apache/ignite/ml/dataset/feature/extractor/impl/BinaryObjectVectorizer.java", "license": "apache-2.0", "size": 4613 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,430,849
public void tryFileNodeInfos() { //LOG.info("enter tryFileNodeInfos"); Map<String, PoolDirectory> mapd = StorageClover.dirMap.get(getNodeDirName()); Map<String, PoolFile> poolFiles = null; PoolFile tmppf = null; if ( mapd != null) { PoolDirectory pd = mapd.get(getDirName()); if (pd != null && !isDir) { poolFiles = pd.getPoolFiles(); tmppf = poolFiles.get(name); if (tmppf != null) { this.nodeInfos = tmppf.getNodeInfos(); //LOG.info("no need add nodeinfo to " + tmppf.name + ", nodeInfos: "+ this.nodeInfos.size()); } } }else { PoolFile pf = new PoolFile(); //LOG.info("add mapd: " + getNodeDirName()); mapd = new HashMap<String, PoolDirectory>(); StorageClover.dirMap.put(getNodeDirName(), mapd); //LOG.info("add pool directory: " + getDirName()); PoolDirectory p = pf.new PoolDirectory(getDirName()); mapd.put(getDirName(), p); poolFiles = p.getPoolFiles(); tmppf = poolFiles.get(name); } //if no namenode associated with file, add namenode //first add local node, then random select from nodes ring if (this.nodeInfos.size() == 0) { Random r = new Random(); boolean isAdd = true; int index = 0; int num = StorageClover.getPoolNodes().size(); //LOG.info("need select nodeinfos in " + num + " nodes"); this.nodeInfos.add(NameNode.client.storage.localnode); //LOG.info("nodeinfos size : " + this.nodeInfos.size() ); index = r.nextInt(); if (index < 0) index = 0; for (int i=0; i< POOLFILE_REPLICA_NUM; i++) { index = index % num; NameNodeInfo child = StorageClover.getPoolNodes().get(index); isAdd = true; for (int j=0; j< this.nodeInfos.size(); j++) { if (this.nodeInfos.get(j).getHostName().equalsIgnoreCase(child.getHostName())){ isAdd = false; } } if (isAdd) { //LOG.info("add child" + index + ", hostname: " + child.getHostName() + ", rpcport: " + child.getRpcPort() + ", socketport: " // + child.getSocketPort()); addChild(child); } index++; } } if (tmppf == null) { //LOG.info("add poolfile to mapd, name:" + name); poolFiles.put(name, this); } }
void function() { Map<String, PoolDirectory> mapd = StorageClover.dirMap.get(getNodeDirName()); Map<String, PoolFile> poolFiles = null; PoolFile tmppf = null; if ( mapd != null) { PoolDirectory pd = mapd.get(getDirName()); if (pd != null && !isDir) { poolFiles = pd.getPoolFiles(); tmppf = poolFiles.get(name); if (tmppf != null) { this.nodeInfos = tmppf.getNodeInfos(); } } }else { PoolFile pf = new PoolFile(); mapd = new HashMap<String, PoolDirectory>(); StorageClover.dirMap.put(getNodeDirName(), mapd); PoolDirectory p = pf.new PoolDirectory(getDirName()); mapd.put(getDirName(), p); poolFiles = p.getPoolFiles(); tmppf = poolFiles.get(name); } if (this.nodeInfos.size() == 0) { Random r = new Random(); boolean isAdd = true; int index = 0; int num = StorageClover.getPoolNodes().size(); this.nodeInfos.add(NameNode.client.storage.localnode); index = r.nextInt(); if (index < 0) index = 0; for (int i=0; i< POOLFILE_REPLICA_NUM; i++) { index = index % num; NameNodeInfo child = StorageClover.getPoolNodes().get(index); isAdd = true; for (int j=0; j< this.nodeInfos.size(); j++) { if (this.nodeInfos.get(j).getHostName().equalsIgnoreCase(child.getHostName())){ isAdd = false; } } if (isAdd) { addChild(child); } index++; } } if (tmppf == null) { poolFiles.put(name, this); } }
/** * try to get namenode list with the file name from dirMap * if first crate file, create namenode info with it */
try to get namenode list with the file name from dirMap if first crate file, create namenode info with it
tryFileNodeInfos
{ "repo_name": "sdecoder/CMDS-HDFS", "path": "hdfs/src/java/org/apache/hadoop/hdfs/server/common/PoolFile.java", "license": "apache-2.0", "size": 12514 }
[ "java.util.HashMap", "java.util.Map", "java.util.Random", "org.apache.hadoop.hdfs.server.namenode.NameNode" ]
import java.util.HashMap; import java.util.Map; import java.util.Random; import org.apache.hadoop.hdfs.server.namenode.NameNode;
import java.util.*; import org.apache.hadoop.hdfs.server.namenode.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,169,834
public static Predicate<Permissible> hasPermission(Permission node){ return new HasPermissionPredicate(node); } } public static final class Entities { private Entities(){ //No instance should be created }
static Predicate<Permissible> function(Permission node){ return new HasPermissionPredicate(node); } } public static final class Entities { private Entities(){ }
/** * Gets a predicate that returns {@code true} if {@code node} is {@code null} <b>or</b> the {@link CommandSender} in question has the permission node {@code node}. * @param node The permission node to check. * @return A predicate that will return {@code true} when the conditions specified above are satisfied. */
Gets a predicate that returns true if node is null or the <code>CommandSender</code> in question has the permission node node
hasPermission
{ "repo_name": "glen3b/BukkitLib", "path": "src/main/java/me/pagekite/glen3b/library/bukkit/Utilities.java", "license": "gpl-3.0", "size": 73311 }
[ "com.google.common.base.Predicate", "org.bukkit.permissions.Permissible", "org.bukkit.permissions.Permission" ]
import com.google.common.base.Predicate; import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permission;
import com.google.common.base.*; import org.bukkit.permissions.*;
[ "com.google.common", "org.bukkit.permissions" ]
com.google.common; org.bukkit.permissions;
126,413
@Test() public void testAwaitWithBoundaryValues() throws Exception { final FixedRateBarrier barrier = new FixedRateBarrier(1000L, 100); assertFalse(barrier.await(0)); assertFalse(barrier.await(-1)); try { barrier.await(1001); fail("Expected an exception with an await argument that exceeds " + "perInterval"); } catch (final LDAPSDKUsageException e) { // This was expected. } }
@Test() void function() throws Exception { final FixedRateBarrier barrier = new FixedRateBarrier(1000L, 100); assertFalse(barrier.await(0)); assertFalse(barrier.await(-1)); try { barrier.await(1001); fail(STR + STR); } catch (final LDAPSDKUsageException e) { } }
/** * Tests the {@link FixedRateBarrier#await(int)} method with values that are * at, near, or in excess of the boundary conditions. * * @throws Exception If an unexpected problem occurs. */
Tests the <code>FixedRateBarrier#await(int)</code> method with values that are at, near, or in excess of the boundary conditions
testAwaitWithBoundaryValues
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/util/FixedRateBarrierTestCase.java", "license": "gpl-2.0", "size": 11410 }
[ "org.testng.annotations.Test" ]
import org.testng.annotations.Test;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
1,887,389