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 void setListCellRenderer(DefaultListCellRenderer rnd)
{
if (rnd != null) history.setCellRenderer(rnd);
} | void function(DefaultListCellRenderer rnd) { if (rnd != null) history.setCellRenderer(rnd); } | /**
* Sets the renderer for the various list.
*
* @param rnd The value to set.
*/ | Sets the renderer for the various list | setListCellRenderer | {
"repo_name": "simleo/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/HistoryDialog.java",
"license": "gpl-2.0",
"size": 15974
} | [
"javax.swing.DefaultListCellRenderer"
]
| import javax.swing.DefaultListCellRenderer; | import javax.swing.*; | [
"javax.swing"
]
| javax.swing; | 290,029 |
public void setSoTimeout(final FileSystemOptions opts, final Integer soTimeout) {
setParam(opts, SO_TIMEOUT, soTimeout);
} | void function(final FileSystemOptions opts, final Integer soTimeout) { setParam(opts, SO_TIMEOUT, soTimeout); } | /**
* Sets the socket timeout for the FTP client.
* <p>
* If you set the {@code soTimeout} to {@code null}, no socket timeout will be set on the ftp client.
* </p>
*
* @param opts The FileSystem options.
* @param soTimeout The timeout value in milliseconds.
* @since 2.0
*/ | Sets the socket timeout for the FTP client. If you set the soTimeout to null, no socket timeout will be set on the ftp client. | setSoTimeout | {
"repo_name": "seeburger-ag/commons-vfs",
"path": "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java",
"license": "apache-2.0",
"size": 17410
} | [
"org.apache.commons.vfs2.FileSystemOptions"
]
| import org.apache.commons.vfs2.FileSystemOptions; | import org.apache.commons.vfs2.*; | [
"org.apache.commons"
]
| org.apache.commons; | 664,154 |
public Message[] getMessages(
final IProgressMonitor monitor,
final Calendar start, final Calendar end,
final MessagePropertyFilter filters[],
final int max_properties,
final DateTimeFormatter date_format) throws Exception
{
monitor.beginTask("Reading Messages", IProgressMonitor.UNKNOWN);
final ArrayList<Message> messages = new ArrayList<Message>();
// Create new select statement
final String sql_txt = sql.createSelect(rdb_util, filters);
final Connection connection = rdb_util.getConnection();
connection.setReadOnly(true);
final PreparedStatement statement =
connection.prepareStatement(sql_txt);
try
{
int parm = 1;
// Set start/end
statement.setTimestamp(parm++, new Timestamp(start.getTimeInMillis()));
statement.setTimestamp(parm++, new Timestamp(end.getTimeInMillis()));
// Set filter parameters
for (MessagePropertyFilter filter : filters)
statement.setString(parm++, filter.getPattern());
// Set query limit a bit higher than max_properties.
// This still limits the number of properties on the RDB side,
// but allows the following code to detect exhausting the limit.
statement.setInt(parm++, max_properties+10);
// One benchmark example:
// Query took <<1 second, but reading all the messages took ~30.
// Same result when only calling 'next',
// i.e. commenting the 'next' loop body.
// So the local lookup of properties and packing
// into a HashMap adds almost nothing to the overall time.
final ResultSet result = statement.executeQuery();
int sequence = 0;
// Initialize id and datum as "no current message"
int id = -1;
Date datum = null;
Date last_datum = null;
Message last_message = null;
Map<String, String> props = null;
int prop_count = 0;
while (!monitor.isCanceled() && result.next())
{
// Fixed ID and DATUM
final int next_id = result.getInt(1);
final Date next_datum = result.getTimestamp(2);
// New message?
if (next_id != id)
{ // Does this conclude a previous message?
if (props != null)
{
final Message message = createMessage(++sequence, id, props);
messages.add(message);
// Maybe set the 'delta' of previous message
if (last_message != null && last_datum != null)
last_message.setDelta(last_datum, datum);
last_datum = datum;
last_message = message;
// Update monitor every 50 messages
final int count = messages.size();
if (count % 50 == 0)
monitor.subTask(count + " messages...");
}
// Construct new message and values
props = new HashMap<String, String>();
id = next_id;
datum = next_datum;
props.put(Message.DATUM, date_format.format(datum.toInstant()));
}
// Get Prop/Value from MESSAGE table
int res_idx = 3;
for (int i=0; i<sql.messagePropertyCount(); ++i)
props.put(sql.getMessageProperty(i), result.getString(res_idx++));
// Prop/Value from MESSAGE_CONTENT table
final String prop = sql.getPropertyNameById(result.getInt(res_idx++));
final String value = result.getString(res_idx);
props.put(prop, value);
++prop_count;
}
// No more results.
// Was another (partial) message assembled?
// This message may miss some properties because the RDB retrieval
// is limited by property max_properties...
if (props != null && props.isEmpty() == false)
{
messages.add(createMessage(++sequence, id, props));
if (last_message != null && last_datum != null)
last_message.setDelta(last_datum, datum);
}
// Was readout stopped because we reached max. number of properties?
if (prop_count >= max_properties)
{
props = new HashMap<String, String>();
props.put(Message.TYPE, "internal");
props.put(Message.SEVERITY, "FATAL");
props.put("TEXT",
NLS.bind(Messages.ReachedMaxPropertiesFmt, max_properties));
// Add this message both as the first and last messages,
// so user is more likely to see it.
// A dialog box is even harder to miss,
// but auto-refresh mode would result in either
// blocked updates or a profusion of message boxes.
messages.add(0, createMessage(0, -1, props));
messages.add(createMessage(++sequence, -1, props));
}
}
finally
{
statement.close();
monitor.done();
}
// Convert to plain array
final Message[] ret_val = new Message[messages.size()];
return messages.toArray(ret_val);
} | Message[] function( final IProgressMonitor monitor, final Calendar start, final Calendar end, final MessagePropertyFilter filters[], final int max_properties, final DateTimeFormatter date_format) throws Exception { monitor.beginTask(STR, IProgressMonitor.UNKNOWN); final ArrayList<Message> messages = new ArrayList<Message>(); final String sql_txt = sql.createSelect(rdb_util, filters); final Connection connection = rdb_util.getConnection(); connection.setReadOnly(true); final PreparedStatement statement = connection.prepareStatement(sql_txt); try { int parm = 1; statement.setTimestamp(parm++, new Timestamp(start.getTimeInMillis())); statement.setTimestamp(parm++, new Timestamp(end.getTimeInMillis())); for (MessagePropertyFilter filter : filters) statement.setString(parm++, filter.getPattern()); statement.setInt(parm++, max_properties+10); final ResultSet result = statement.executeQuery(); int sequence = 0; int id = -1; Date datum = null; Date last_datum = null; Message last_message = null; Map<String, String> props = null; int prop_count = 0; while (!monitor.isCanceled() && result.next()) { final int next_id = result.getInt(1); final Date next_datum = result.getTimestamp(2); if (next_id != id) { if (props != null) { final Message message = createMessage(++sequence, id, props); messages.add(message); if (last_message != null && last_datum != null) last_message.setDelta(last_datum, datum); last_datum = datum; last_message = message; final int count = messages.size(); if (count % 50 == 0) monitor.subTask(count + STR); } props = new HashMap<String, String>(); id = next_id; datum = next_datum; props.put(Message.DATUM, date_format.format(datum.toInstant())); } int res_idx = 3; for (int i=0; i<sql.messagePropertyCount(); ++i) props.put(sql.getMessageProperty(i), result.getString(res_idx++)); final String prop = sql.getPropertyNameById(result.getInt(res_idx++)); final String value = result.getString(res_idx); props.put(prop, value); ++prop_count; } if (props != null && props.isEmpty() == false) { messages.add(createMessage(++sequence, id, props)); if (last_message != null && last_datum != null) last_message.setDelta(last_datum, datum); } if (prop_count >= max_properties) { props = new HashMap<String, String>(); props.put(Message.TYPE, STR); props.put(Message.SEVERITY, "FATAL"); props.put("TEXT", NLS.bind(Messages.ReachedMaxPropertiesFmt, max_properties)); messages.add(0, createMessage(0, -1, props)); messages.add(createMessage(++sequence, -1, props)); } } finally { statement.close(); monitor.done(); } final Message[] ret_val = new Message[messages.size()]; return messages.toArray(ret_val); } | /** Read messages from start to end time, maybe including filters.
* <p>
* @param monitor Used to display progress, also checked for cancellation
* @param start Start time
* @param end End time
* @param filters Filters to use (not <code>null</code>).
* @param max_properties Limit on the number of properties(!) retrieved.
* Unclear how many properties to expect per message,
* so this is a vague overload throttle.
* @return Array of Messages or <code>null</code>
*/ | Read messages from start to end time, maybe including filters. | getMessages | {
"repo_name": "ControlSystemStudio/cs-studio",
"path": "applications/alarm/alarm-plugins/org.csstudio.alarm.beast.msghist/src/org/csstudio/alarm/beast/msghist/rdb/MessageRDB.java",
"license": "epl-1.0",
"size": 8938
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.Timestamp",
"java.time.format.DateTimeFormatter",
"java.util.ArrayList",
"java.util.Calendar",
"java.util.Date",
"java.util.HashMap",
"java.util.Map",
"org.csstudio.alarm.beast.msghist.Messages",
"org.csstudio.alarm.beast.msghist.model.Message",
"org.csstudio.alarm.beast.msghist.model.MessagePropertyFilter",
"org.eclipse.core.runtime.IProgressMonitor",
"org.eclipse.osgi.util.NLS"
]
| import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Timestamp; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.csstudio.alarm.beast.msghist.Messages; import org.csstudio.alarm.beast.msghist.model.Message; import org.csstudio.alarm.beast.msghist.model.MessagePropertyFilter; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osgi.util.NLS; | import java.sql.*; import java.time.format.*; import java.util.*; import org.csstudio.alarm.beast.msghist.*; import org.csstudio.alarm.beast.msghist.model.*; import org.eclipse.core.runtime.*; import org.eclipse.osgi.util.*; | [
"java.sql",
"java.time",
"java.util",
"org.csstudio.alarm",
"org.eclipse.core",
"org.eclipse.osgi"
]
| java.sql; java.time; java.util; org.csstudio.alarm; org.eclipse.core; org.eclipse.osgi; | 995,266 |
public GroupedFindItemsResults<Item> findItems(FolderId parentFolderId,
ItemView view, Grouping groupBy) throws Exception {
EwsUtilities.validateParam(groupBy, "groupBy");
List<FolderId> folderIdArray = new ArrayList<FolderId>();
folderIdArray.add(parentFolderId);
ServiceResponseCollection<FindItemResponse<Item>> responses = this
.findItems(folderIdArray, null,
null,
view, groupBy, ServiceErrorHandling.ThrowOnError);
return responses.getResponseAtIndex(0).getGroupedFindResults();
} | GroupedFindItemsResults<Item> function(FolderId parentFolderId, ItemView view, Grouping groupBy) throws Exception { EwsUtilities.validateParam(groupBy, STR); List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); ServiceResponseCollection<FindItemResponse<Item>> responses = this .findItems(folderIdArray, null, null, view, groupBy, ServiceErrorHandling.ThrowOnError); return responses.getResponseAtIndex(0).getGroupedFindResults(); } | /**
* Obtains a grouped list of item by searching the contents of a specific
* folder. Calling this method results in a call to EWS.
*
* @param parentFolderId the parent folder id
* @param view the view
* @param groupBy the group by
* @return A list of item containing the contents of the specified folder.
* @throws Exception the exception
*/ | Obtains a grouped list of item by searching the contents of a specific folder. Calling this method results in a call to EWS | findItems | {
"repo_name": "xvronny/ews-java-api",
"path": "src/main/java/microsoft/exchange/webservices/data/core/ExchangeService.java",
"license": "mit",
"size": 161280
} | [
"java.util.ArrayList",
"java.util.List"
]
| import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 1,478,672 |
public void startMedia(SACMediaList media) {
throwUnsupportedEx();
} | void function(SACMediaList media) { throwUnsupportedEx(); } | /**
* <b>SAC</b>: Implements {@link
* DocumentHandler#startMedia(SACMediaList)}.
*/ | SAC: Implements <code>DocumentHandler#startMedia(SACMediaList)</code> | startMedia | {
"repo_name": "Groostav/CMPT880-term-project",
"path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/css/engine/CSSEngine.java",
"license": "apache-2.0",
"size": 91557
} | [
"org.w3c.css.sac.SACMediaList"
]
| import org.w3c.css.sac.SACMediaList; | import org.w3c.css.sac.*; | [
"org.w3c.css"
]
| org.w3c.css; | 2,180,678 |
public static boolean isExcludedFromDependencyCheck(PropertyDescriptor pd) {
Method wm = pd.getWriteMethod();
if (wm == null) {
return false;
}
if (!wm.getDeclaringClass().getName().contains("$$")) {
// Not a CGLIB method so it's OK.
return false;
}
// It was declared by CGLIB, but we might still want to autowire it
// if it was actually declared by the superclass.
Class<?> superclass = wm.getDeclaringClass().getSuperclass();
return !ClassUtils.hasMethod(superclass, wm.getName(), wm.getParameterTypes());
} | static boolean function(PropertyDescriptor pd) { Method wm = pd.getWriteMethod(); if (wm == null) { return false; } if (!wm.getDeclaringClass().getName().contains("$$")) { return false; } Class<?> superclass = wm.getDeclaringClass().getSuperclass(); return !ClassUtils.hasMethod(superclass, wm.getName(), wm.getParameterTypes()); } | /**
* Determine whether the given bean property is excluded from dependency checks.
* <p>This implementation excludes properties defined by CGLIB.
* @param pd the PropertyDescriptor of the bean property
* @return whether the bean property is excluded
*/ | Determine whether the given bean property is excluded from dependency checks. This implementation excludes properties defined by CGLIB | isExcludedFromDependencyCheck | {
"repo_name": "deathspeeder/class-guard",
"path": "spring-framework-3.2.x/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java",
"license": "gpl-2.0",
"size": 12000
} | [
"java.beans.PropertyDescriptor",
"java.lang.reflect.Method",
"org.springframework.util.ClassUtils"
]
| import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import org.springframework.util.ClassUtils; | import java.beans.*; import java.lang.reflect.*; import org.springframework.util.*; | [
"java.beans",
"java.lang",
"org.springframework.util"
]
| java.beans; java.lang; org.springframework.util; | 63,212 |
public void setPlugin(Plugin plugin); | void function(Plugin plugin); | /**
* Set Plugin data.
*
* @param plugin Plugin
*/ | Set Plugin data | setPlugin | {
"repo_name": "maximvarentsov/Essentials",
"path": "src/com/earth2me/essentials/register/payment/Method.java",
"license": "gpl-3.0",
"size": 4790
} | [
"org.bukkit.plugin.Plugin"
]
| import org.bukkit.plugin.Plugin; | import org.bukkit.plugin.*; | [
"org.bukkit.plugin"
]
| org.bukkit.plugin; | 1,608,258 |
public static void showTimed(Player player, IDynamicText text,
int duration, TimeScale timeScale, ActionBarPriority priority) {
manager().showTimed(player, text, duration, timeScale, priority);
} | static void function(Player player, IDynamicText text, int duration, TimeScale timeScale, ActionBarPriority priority) { manager().showTimed(player, text, duration, timeScale, priority); } | /**
* Show an {@link ITimedActionBar} to a player.
*
* @param player The player to show the action bar to.
* @param text The text the action bar displays.
* @param duration The duration to display the action bar for.
* @param timeScale The time scale of the specified duration.
* @param priority The action bar priority.
*/ | Show an <code>ITimedActionBar</code> to a player | showTimed | {
"repo_name": "JCThePants/NucleusFramework",
"path": "src/com/jcwhatever/nucleus/managed/actionbar/ActionBars.java",
"license": "mit",
"size": 13600
} | [
"com.jcwhatever.nucleus.utils.TimeScale",
"com.jcwhatever.nucleus.utils.text.dynamic.IDynamicText",
"org.bukkit.entity.Player"
]
| import com.jcwhatever.nucleus.utils.TimeScale; import com.jcwhatever.nucleus.utils.text.dynamic.IDynamicText; import org.bukkit.entity.Player; | import com.jcwhatever.nucleus.utils.*; import com.jcwhatever.nucleus.utils.text.dynamic.*; import org.bukkit.entity.*; | [
"com.jcwhatever.nucleus",
"org.bukkit.entity"
]
| com.jcwhatever.nucleus; org.bukkit.entity; | 1,894,038 |
public void testRecursiveSubSets() throws Exception {
int setSize = expensiveTests ? 1000 : 100;
Class cl = TreeSet.class;
NavigableSet<Integer> set = newSet(cl);
bs = new BitSet(setSize);
populate(set, setSize);
check(set, 0, setSize - 1, true);
check(set.descendingSet(), 0, setSize - 1, false);
mutateSet(set, 0, setSize - 1);
check(set, 0, setSize - 1, true);
check(set.descendingSet(), 0, setSize - 1, false);
bashSubSet(set.subSet(0, true, setSize, false),
0, setSize - 1, true);
} | void function() throws Exception { int setSize = expensiveTests ? 1000 : 100; Class cl = TreeSet.class; NavigableSet<Integer> set = newSet(cl); bs = new BitSet(setSize); populate(set, setSize); check(set, 0, setSize - 1, true); check(set.descendingSet(), 0, setSize - 1, false); mutateSet(set, 0, setSize - 1); check(set, 0, setSize - 1, true); check(set.descendingSet(), 0, setSize - 1, false); bashSubSet(set.subSet(0, true, setSize, false), 0, setSize - 1, true); } | /**
* Subsets of subsets subdivide correctly
*/ | Subsets of subsets subdivide correctly | testRecursiveSubSets | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jdk/test/java/util/concurrent/tck/TreeSetTest.java",
"license": "gpl-2.0",
"size": 30547
} | [
"java.util.BitSet",
"java.util.NavigableSet",
"java.util.TreeSet"
]
| import java.util.BitSet; import java.util.NavigableSet; import java.util.TreeSet; | import java.util.*; | [
"java.util"
]
| java.util; | 2,848,764 |
@Override
public RSocketServer getSource() {
return (RSocketServer) super.getSource();
} | RSocketServer function() { return (RSocketServer) super.getSource(); } | /**
* Access the source of the event (an {@link RSocketServer}).
* @return the embedded web server
*/ | Access the source of the event (an <code>RSocketServer</code>) | getSource | {
"repo_name": "aahlenst/spring-boot",
"path": "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/context/RSocketServerInitializedEvent.java",
"license": "apache-2.0",
"size": 1522
} | [
"org.springframework.boot.rsocket.server.RSocketServer"
]
| import org.springframework.boot.rsocket.server.RSocketServer; | import org.springframework.boot.rsocket.server.*; | [
"org.springframework.boot"
]
| org.springframework.boot; | 1,989,394 |
public static SslContextBuilder forServer(
InputStream keyCertChainInputStream, InputStream keyInputStream, String keyPassword) {
return new SslContextBuilder(true).keyManager(keyCertChainInputStream, keyInputStream, keyPassword);
} | static SslContextBuilder function( InputStream keyCertChainInputStream, InputStream keyInputStream, String keyPassword) { return new SslContextBuilder(true).keyManager(keyCertChainInputStream, keyInputStream, keyPassword); } | /**
* Creates a builder for new server-side {@link SslContext}.
*
* @param keyCertChainInputStream an input stream for an X.509 certificate chain in PEM format
* @param keyInputStream an input stream for a PKCS#8 private key in PEM format
* @param keyPassword the password of the {@code keyFile}, or {@code null} if it's not
* password-protected
* @see #keyManager(InputStream, InputStream, String)
*/ | Creates a builder for new server-side <code>SslContext</code> | forServer | {
"repo_name": "SinaTadayon/netty",
"path": "handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java",
"license": "apache-2.0",
"size": 16430
} | [
"java.io.InputStream"
]
| import java.io.InputStream; | import java.io.*; | [
"java.io"
]
| java.io; | 2,427,164 |
public NTarget addDecodedTermination(String name, float[][] matrix, float[] tfNumerator, float[] tfDenominator,
float passthrough, boolean isModulatory) throws StructuralException; | NTarget function(String name, float[][] matrix, float[] tfNumerator, float[] tfDenominator, float passthrough, boolean isModulatory) throws StructuralException; | /**
* As above but with arbitrary single-input-single-output PSC dynamics.
*
* @param name Unique name for this Termination (in the scope of this Ensemble)
* @param matrix Transformation matrix which defines a linear map on incoming information
* @param tfNumerator Coefficients of transfer function numerator (see CanonicalModel.getRealization(...)
* for details)
* @param tfDenominator Coefficients of transfer function denominator
* @param passthrough How much should passthrough...?
* @param isModulatory If true, inputs to this Termination do not drive Nodes in the Ensemble directly
* but may have modulatory influences (eg related to plasticity). If false, the transformation matrix
* output dimension must match the dimension of this Ensemble.
* @return The resulting Termination
* @throws StructuralException if given transformation matrix is not a matrix or there is a problem
* with the transfer function
*/ | As above but with arbitrary single-input-single-output PSC dynamics | addDecodedTermination | {
"repo_name": "printedheart/opennars",
"path": "nars_gui/src/main/java/ca/nengo/neural/nef/NEFGroup.java",
"license": "agpl-3.0",
"size": 9033
} | [
"ca.nengo.model.NTarget",
"ca.nengo.model.StructuralException"
]
| import ca.nengo.model.NTarget; import ca.nengo.model.StructuralException; | import ca.nengo.model.*; | [
"ca.nengo.model"
]
| ca.nengo.model; | 1,647,686 |
recreateIndices();
final int nodeCount = 1;
getNodesBySchema(SCHEMA_NAME)
.flatMapCompletable(this::deleteNode)
.andThen(deleteSchemaByName(SCHEMA_NAME))
.andThen(createTestSchema())
.flatMapObservable(newSchema -> getRootNodeReference()
.flatMapObservable(rootNodeReference -> Observable.range(1, nodeCount)
.flatMapSingle(unused -> createEmptyNode(newSchema, rootNodeReference))))
.ignoreElements().blockingAwait();
waitForSearchIdleEvent();
NodeListResponse searchResult = call(() -> client().searchNodes(getSimpleTermQuery("schema.name.raw", SCHEMA_NAME)));
assertEquals("Check search result after actions", nodeCount, searchResult.getMetainfo().getTotalCount());
} | recreateIndices(); final int nodeCount = 1; getNodesBySchema(SCHEMA_NAME) .flatMapCompletable(this::deleteNode) .andThen(deleteSchemaByName(SCHEMA_NAME)) .andThen(createTestSchema()) .flatMapObservable(newSchema -> getRootNodeReference() .flatMapObservable(rootNodeReference -> Observable.range(1, nodeCount) .flatMapSingle(unused -> createEmptyNode(newSchema, rootNodeReference)))) .ignoreElements().blockingAwait(); waitForSearchIdleEvent(); NodeListResponse searchResult = call(() -> client().searchNodes(getSimpleTermQuery(STR, SCHEMA_NAME))); assertEquals(STR, nodeCount, searchResult.getMetainfo().getTotalCount()); } | /**
* This test does the following:
* <ol>
* <li>Delete all nodes of a schema</li>
* <li>Delete that schema</li>
* <li>Create a new schema with the same name as the old schema</li>
* <li>Create nodes of that schema</li>
* <li>Search for all nodes of that schema</li>
* </ol>
*
* @throws Exception
*/ | This test does the following: Delete all nodes of a schema Delete that schema Create a new schema with the same name as the old schema Create nodes of that schema Search for all nodes of that schema | testActions | {
"repo_name": "gentics/mesh",
"path": "tests/tests-core/src/main/java/com/gentics/mesh/search/MultipleActionsTest.java",
"license": "apache-2.0",
"size": 4577
} | [
"com.gentics.mesh.core.rest.node.NodeListResponse",
"com.gentics.mesh.test.ClientHelper",
"io.reactivex.Observable",
"org.junit.Assert"
]
| import com.gentics.mesh.core.rest.node.NodeListResponse; import com.gentics.mesh.test.ClientHelper; import io.reactivex.Observable; import org.junit.Assert; | import com.gentics.mesh.core.rest.node.*; import com.gentics.mesh.test.*; import io.reactivex.*; import org.junit.*; | [
"com.gentics.mesh",
"io.reactivex",
"org.junit"
]
| com.gentics.mesh; io.reactivex; org.junit; | 2,090,929 |
protected void batchedEventHandler() {
projects = new HashMap<IProject, IResourceDelta>();
for (final IResourceChangeEvent event : BATCHED_EVENTS) {
final IResourceDelta resourceDelta = event.getDelta();
if (resourceDelta == null) {
switch (event.getType()) {
case IResourceChangeEvent.PRE_CLOSE:
case IResourceChangeEvent.PRE_DELETE:
GlobalParser.clearAllInformation(event.getResource().getProject());
break;
default:
break;
}
} else {
try {
resourceDelta.accept(projectAdder);
} catch (CoreException e) {
ErrorReporter.logExceptionStackTrace(e);
}
MarkerHandler.handleResourceChanges(event);
}
}
BATCHED_EVENTS.clear();
final IPreferencesService prefs = Platform.getPreferencesService();
// for every project check if the TITANProperties file was changed or need to be changed
for (final IProject project : projects.keySet()) {
// which can be handled
if (project != null && project.isAccessible() && projects.get(project) != null) {
final IResourceDelta projectDelta = projects.get(project);
if (projectDelta.getKind() == IResourceDelta.ADDED) {
// new project appeared load the settings
final ProjectFileHandler pfHandler = new ProjectFileHandler(project);
pfHandler.loadProjectSettings();
PropertyNotificationManager.firePropertyChange(project);
continue;
}
try {
final IResourceDelta propertiesDelta = projectDelta.findMember(new Path(ProjectFileHandler.XML_TITAN_PROPERTIES_FILE));
final DeltaVisitor visitor = new DeltaVisitor();
projectDelta.accept(visitor);
if (visitor.hasNewOrRemovedResources()) {
final ProjectFileHandler pfHandler = new ProjectFileHandler(project);
if (propertiesDelta == null || propertiesDelta.getKind() == IResourceDelta.REMOVED) {
// project setting file does not exist
pfHandler.saveProjectSettings();
} else {
// the project settings have changed and we have new resources, the project was updated by the user
pfHandler.loadProjectSettings();
PropertyNotificationManager.firePropertyChange(project);
}
} else {
if (propertiesDelta != null) {
final ProjectFileHandler pfHandler = new ProjectFileHandler(project);
if (propertiesDelta.getKind() == IResourceDelta.REMOVED) {
// save the settings if the only change was that it was removed externally
pfHandler.saveProjectSettings();
} else {
// load the settings if it changed
pfHandler.loadProjectSettings();
PropertyNotificationManager.firePropertyChange(project);
}
}
}
} catch (CoreException e) {
ErrorReporter.logExceptionStackTrace(e);
}
// check if it needs to be built, if full analysis is needed, and that the working directory is always set as derived
final IProject[] referencingProjects = ProjectBasedBuilder.getProjectBasedBuilder(project).getReferencingProjects();
for (int i = 0; i < referencingProjects.length; i++) {
ProjectBasedBuilder.setForcedBuild(referencingProjects[i]);
}
if ((projectDelta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
TITANBuilder.markProjectForRebuild(project);
} | void function() { projects = new HashMap<IProject, IResourceDelta>(); for (final IResourceChangeEvent event : BATCHED_EVENTS) { final IResourceDelta resourceDelta = event.getDelta(); if (resourceDelta == null) { switch (event.getType()) { case IResourceChangeEvent.PRE_CLOSE: case IResourceChangeEvent.PRE_DELETE: GlobalParser.clearAllInformation(event.getResource().getProject()); break; default: break; } } else { try { resourceDelta.accept(projectAdder); } catch (CoreException e) { ErrorReporter.logExceptionStackTrace(e); } MarkerHandler.handleResourceChanges(event); } } BATCHED_EVENTS.clear(); final IPreferencesService prefs = Platform.getPreferencesService(); for (final IProject project : projects.keySet()) { if (project != null && project.isAccessible() && projects.get(project) != null) { final IResourceDelta projectDelta = projects.get(project); if (projectDelta.getKind() == IResourceDelta.ADDED) { final ProjectFileHandler pfHandler = new ProjectFileHandler(project); pfHandler.loadProjectSettings(); PropertyNotificationManager.firePropertyChange(project); continue; } try { final IResourceDelta propertiesDelta = projectDelta.findMember(new Path(ProjectFileHandler.XML_TITAN_PROPERTIES_FILE)); final DeltaVisitor visitor = new DeltaVisitor(); projectDelta.accept(visitor); if (visitor.hasNewOrRemovedResources()) { final ProjectFileHandler pfHandler = new ProjectFileHandler(project); if (propertiesDelta == null propertiesDelta.getKind() == IResourceDelta.REMOVED) { pfHandler.saveProjectSettings(); } else { pfHandler.loadProjectSettings(); PropertyNotificationManager.firePropertyChange(project); } } else { if (propertiesDelta != null) { final ProjectFileHandler pfHandler = new ProjectFileHandler(project); if (propertiesDelta.getKind() == IResourceDelta.REMOVED) { pfHandler.saveProjectSettings(); } else { pfHandler.loadProjectSettings(); PropertyNotificationManager.firePropertyChange(project); } } } } catch (CoreException e) { ErrorReporter.logExceptionStackTrace(e); } final IProject[] referencingProjects = ProjectBasedBuilder.getProjectBasedBuilder(project).getReferencingProjects(); for (int i = 0; i < referencingProjects.length; i++) { ProjectBasedBuilder.setForcedBuild(referencingProjects[i]); } if ((projectDelta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { TITANBuilder.markProjectForRebuild(project); } | /**
* Handle the resource changes that has been batched.
*/ | Handle the resource changes that has been batched | batchedEventHandler | {
"repo_name": "alovassy/titan.EclipsePlug-ins",
"path": "org.eclipse.titan.designer/src/org/eclipse/titan/designer/Activator.java",
"license": "epl-1.0",
"size": 19587
} | [
"java.util.HashMap",
"org.eclipse.core.resources.IProject",
"org.eclipse.core.resources.IResourceChangeEvent",
"org.eclipse.core.resources.IResourceDelta",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.core.runtime.Path",
"org.eclipse.core.runtime.Platform",
"org.eclipse.core.runtime.preferences.IPreferencesService",
"org.eclipse.titan.common.logging.ErrorReporter",
"org.eclipse.titan.designer.AST",
"org.eclipse.titan.designer.core.ProjectBasedBuilder",
"org.eclipse.titan.designer.core.TITANBuilder",
"org.eclipse.titan.designer.parsers.GlobalParser",
"org.eclipse.titan.designer.properties.PropertyNotificationManager",
"org.eclipse.titan.designer.properties.data.ProjectFileHandler"
]
| import java.util.HashMap; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.IPreferencesService; import org.eclipse.titan.common.logging.ErrorReporter; import org.eclipse.titan.designer.AST; import org.eclipse.titan.designer.core.ProjectBasedBuilder; import org.eclipse.titan.designer.core.TITANBuilder; import org.eclipse.titan.designer.parsers.GlobalParser; import org.eclipse.titan.designer.properties.PropertyNotificationManager; import org.eclipse.titan.designer.properties.data.ProjectFileHandler; | import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.preferences.*; import org.eclipse.titan.common.logging.*; import org.eclipse.titan.designer.*; import org.eclipse.titan.designer.core.*; import org.eclipse.titan.designer.parsers.*; import org.eclipse.titan.designer.properties.*; import org.eclipse.titan.designer.properties.data.*; | [
"java.util",
"org.eclipse.core",
"org.eclipse.titan"
]
| java.util; org.eclipse.core; org.eclipse.titan; | 1,319,964 |
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<SshPublicKeyGenerateKeyPairResultInner> generateKeyPairAsync(
String resourceGroupName, String sshPublicKeyName); | @ServiceMethod(returns = ReturnType.SINGLE) Mono<SshPublicKeyGenerateKeyPairResultInner> generateKeyPairAsync( String resourceGroupName, String sshPublicKeyName); | /**
* Generates and returns a public/private key pair and populates the SSH public key resource with the public key.
* The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource.
*
* @param resourceGroupName The name of the resource group.
* @param sshPublicKeyName The name of the SSH public key.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.compute.models.ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response from generation of an SSH key pair on successful completion of {@link Mono}.
*/ | Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource | generateKeyPairAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/SshPublicKeysClient.java",
"license": "mit",
"size": 22909
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.compute.fluent.models.SshPublicKeyGenerateKeyPairResultInner"
]
| import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.compute.fluent.models.SshPublicKeyGenerateKeyPairResultInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.compute.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
]
| com.azure.core; com.azure.resourcemanager; | 1,705,698 |
@Test
public void testGetItemInfoBucketApiException() throws IOException {
MockHttpTransport transport =
mockTransport(
jsonErrorResponse(ErrorResponses.NOT_FOUND), jsonErrorResponse(ErrorResponses.GONE));
GoogleCloudStorage gcs = mockedGcs(transport);
// Not found.
GoogleCloudStorageItemInfo info = gcs.getItemInfo(new StorageResourceId(BUCKET_NAME));
GoogleCloudStorageItemInfo expected =
GoogleCloudStorageItemInfo.createNotFound(new StorageResourceId(BUCKET_NAME));
assertThat(info).isEqualTo(expected);
// Throw.
assertThrows(IOException.class, () -> gcs.getItemInfo(new StorageResourceId(BUCKET_NAME)));
assertThat(trackingRequestInitializerWithRetries.getAllRequestStrings())
.containsExactly(getBucketRequestString(BUCKET_NAME), getBucketRequestString(BUCKET_NAME))
.inOrder();
} | void function() throws IOException { MockHttpTransport transport = mockTransport( jsonErrorResponse(ErrorResponses.NOT_FOUND), jsonErrorResponse(ErrorResponses.GONE)); GoogleCloudStorage gcs = mockedGcs(transport); GoogleCloudStorageItemInfo info = gcs.getItemInfo(new StorageResourceId(BUCKET_NAME)); GoogleCloudStorageItemInfo expected = GoogleCloudStorageItemInfo.createNotFound(new StorageResourceId(BUCKET_NAME)); assertThat(info).isEqualTo(expected); assertThrows(IOException.class, () -> gcs.getItemInfo(new StorageResourceId(BUCKET_NAME))); assertThat(trackingRequestInitializerWithRetries.getAllRequestStrings()) .containsExactly(getBucketRequestString(BUCKET_NAME), getBucketRequestString(BUCKET_NAME)) .inOrder(); } | /**
* Test handling of various types of exceptions thrown during JSON API call for
* GoogleCloudStorage.getItemInfo(2) when arguments represent only a bucket.
*/ | Test handling of various types of exceptions thrown during JSON API call for GoogleCloudStorage.getItemInfo(2) when arguments represent only a bucket | testGetItemInfoBucketApiException | {
"repo_name": "GoogleCloudDataproc/hadoop-connectors",
"path": "gcsio/src/test/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageTest.java",
"license": "apache-2.0",
"size": 147644
} | [
"com.google.api.client.testing.http.MockHttpTransport",
"com.google.cloud.hadoop.gcsio.TrackingHttpRequestInitializer",
"com.google.cloud.hadoop.util.testing.MockHttpTransportHelper",
"com.google.common.truth.Truth",
"java.io.IOException",
"org.junit.Assert"
]
| import com.google.api.client.testing.http.MockHttpTransport; import com.google.cloud.hadoop.gcsio.TrackingHttpRequestInitializer; import com.google.cloud.hadoop.util.testing.MockHttpTransportHelper; import com.google.common.truth.Truth; import java.io.IOException; import org.junit.Assert; | import com.google.api.client.testing.http.*; import com.google.cloud.hadoop.gcsio.*; import com.google.cloud.hadoop.util.testing.*; import com.google.common.truth.*; import java.io.*; import org.junit.*; | [
"com.google.api",
"com.google.cloud",
"com.google.common",
"java.io",
"org.junit"
]
| com.google.api; com.google.cloud; com.google.common; java.io; org.junit; | 751,613 |
public static void unsetRole(PerunSession sess, User user, PerunBean complementaryObject, Role role) throws InternalErrorException, PrivilegeException, UserNotExistsException, UserNotAdminException {
Utils.notNull(role, "role");
((PerunBl) sess.getPerun()).getUsersManagerBl().checkUserExists(sess, user);
if(!isAuthorized(sess, Role.PERUNADMIN)) throw new PrivilegeException("You are not privileged to use this method unsetRole.");
cz.metacentrum.perun.core.blImpl.AuthzResolverBlImpl.unsetRole(sess, user, complementaryObject, role);
} | static void function(PerunSession sess, User user, PerunBean complementaryObject, Role role) throws InternalErrorException, PrivilegeException, UserNotExistsException, UserNotAdminException { Utils.notNull(role, "role"); ((PerunBl) sess.getPerun()).getUsersManagerBl().checkUserExists(sess, user); if(!isAuthorized(sess, Role.PERUNADMIN)) throw new PrivilegeException(STR); cz.metacentrum.perun.core.blImpl.AuthzResolverBlImpl.unsetRole(sess, user, complementaryObject, role); } | /**
* Unset role for user and <b>one</b> complementary object.
*
* If complementary object is wrong for the role, throw an exception.
* For role "perunadmin" ignore complementary object.
*
* @param sess perun session
* @param user the user for unsetting role
* @param role role of user in a session
* @param complementaryObject object for which role will be unset
*
* @throws InternalErrorException
* @throws PrivilegeException
* @throws UserNotExistsException
* @throws UserNotAdminException
*/ | Unset role for user and one complementary object. If complementary object is wrong for the role, throw an exception. For role "perunadmin" ignore complementary object | unsetRole | {
"repo_name": "licehammer/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/AuthzResolver.java",
"license": "bsd-2-clause",
"size": 25476
} | [
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"cz.metacentrum.perun.core.api.exceptions.PrivilegeException",
"cz.metacentrum.perun.core.api.exceptions.UserNotAdminException",
"cz.metacentrum.perun.core.api.exceptions.UserNotExistsException",
"cz.metacentrum.perun.core.bl.PerunBl",
"cz.metacentrum.perun.core.impl.Utils"
]
| import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.UserNotAdminException; import cz.metacentrum.perun.core.api.exceptions.UserNotExistsException; import cz.metacentrum.perun.core.bl.PerunBl; import cz.metacentrum.perun.core.impl.Utils; | import cz.metacentrum.perun.core.api.exceptions.*; import cz.metacentrum.perun.core.bl.*; import cz.metacentrum.perun.core.impl.*; | [
"cz.metacentrum.perun"
]
| cz.metacentrum.perun; | 2,398,358 |
public NodeSet getAncestors(int contextId, boolean includeSelf) {
ExtArrayNodeSet ancestors = new ExtArrayNodeSet();
for (Iterator i = iterator(); i.hasNext();) {
NodeProxy current = (NodeProxy) i.next();
if (includeSelf) {
if (Expression.NO_CONTEXT_ID != contextId)
current.addContextNode(contextId, current);
ancestors.add(current);
}
NodeId parentID = current.getNodeId().getParentId();
while (parentID != null) {
//Filter out the temporary nodes wrapper element
if (parentID != NodeId.DOCUMENT_NODE &&
!(parentID.getTreeLevel() == 1 && current.getDocument().getCollection().isTempCollection())) {
NodeProxy parent = new NodeProxy(current.getDocument(), parentID, Node.ELEMENT_NODE);
if (Expression.NO_CONTEXT_ID != contextId)
parent.addContextNode(contextId, current);
else
parent.copyContext(current);
ancestors.add(parent);
}
parentID = parentID.getParentId();
}
}
ancestors.mergeDuplicates();
return ancestors;
} | NodeSet function(int contextId, boolean includeSelf) { ExtArrayNodeSet ancestors = new ExtArrayNodeSet(); for (Iterator i = iterator(); i.hasNext();) { NodeProxy current = (NodeProxy) i.next(); if (includeSelf) { if (Expression.NO_CONTEXT_ID != contextId) current.addContextNode(contextId, current); ancestors.add(current); } NodeId parentID = current.getNodeId().getParentId(); while (parentID != null) { if (parentID != NodeId.DOCUMENT_NODE && !(parentID.getTreeLevel() == 1 && current.getDocument().getCollection().isTempCollection())) { NodeProxy parent = new NodeProxy(current.getDocument(), parentID, Node.ELEMENT_NODE); if (Expression.NO_CONTEXT_ID != contextId) parent.addContextNode(contextId, current); else parent.copyContext(current); ancestors.add(parent); } parentID = parentID.getParentId(); } } ancestors.mergeDuplicates(); return ancestors; } | /**
* The method <code>getAncestors</code>
*
* @param contextId an <code>int</code> value
* @param includeSelf a <code>boolean</code> value
* @return a <code>NodeSet</code> value
*/ | The method <code>getAncestors</code> | getAncestors | {
"repo_name": "kingargyle/exist-1.4.x",
"path": "src/org/exist/dom/AbstractNodeSet.java",
"license": "lgpl-2.1",
"size": 26406
} | [
"java.util.Iterator",
"org.exist.numbering.NodeId",
"org.exist.xquery.Expression",
"org.w3c.dom.Node"
]
| import java.util.Iterator; import org.exist.numbering.NodeId; import org.exist.xquery.Expression; import org.w3c.dom.Node; | import java.util.*; import org.exist.numbering.*; import org.exist.xquery.*; import org.w3c.dom.*; | [
"java.util",
"org.exist.numbering",
"org.exist.xquery",
"org.w3c.dom"
]
| java.util; org.exist.numbering; org.exist.xquery; org.w3c.dom; | 2,312,136 |
public synchronized Folder getFolder(String name)
throws MessagingException {
checkConnected();
return new IMAPFolder(name, IMAPFolder.UNKNOWN_SEPARATOR, this);
} | synchronized Folder function(String name) throws MessagingException { checkConnected(); return new IMAPFolder(name, IMAPFolder.UNKNOWN_SEPARATOR, this); } | /**
* Get named folder. Returns a new, closed IMAPFolder.
*/ | Get named folder. Returns a new, closed IMAPFolder | getFolder | {
"repo_name": "arthurzaczek/kolab-android",
"path": "javamail/com/sun/mail/imap/IMAPStore.java",
"license": "gpl-3.0",
"size": 60428
} | [
"javax.mail.Folder",
"javax.mail.MessagingException"
]
| import javax.mail.Folder; import javax.mail.MessagingException; | import javax.mail.*; | [
"javax.mail"
]
| javax.mail; | 2,676,641 |
@Override
public String lookup(final LogEvent event, final String key) {
switch (key) {
case "version":
return "Java version " + getSystemProperty("java.version");
case "runtime":
return getRuntime();
case "vm":
return getVirtualMachine();
case "os":
return getOperatingSystem();
case "hw":
return getHardware();
case "locale":
return getLocale();
default:
throw new IllegalArgumentException(key);
}
} | String function(final LogEvent event, final String key) { switch (key) { case STR: return STR + getSystemProperty(STR); case STR: return getRuntime(); case "vm": return getVirtualMachine(); case "os": return getOperatingSystem(); case "hw": return getHardware(); case STR: return getLocale(); default: throw new IllegalArgumentException(key); } } | /**
* Looks up the value of the environment variable.
*
* @param event
* The current LogEvent (is ignored by this StrLookup).
* @param key
* the key to be looked up, may be null
* @return The value of the environment variable.
*/ | Looks up the value of the environment variable | lookup | {
"repo_name": "SourceStudyNotes/log4j2",
"path": "src/main/java/org/apache/logging/log4j/core/lookup/JavaLookup.java",
"license": "apache-2.0",
"size": 4353
} | [
"org.apache.logging.log4j.core.LogEvent"
]
| import org.apache.logging.log4j.core.LogEvent; | import org.apache.logging.log4j.core.*; | [
"org.apache.logging"
]
| org.apache.logging; | 863,494 |
public void startMainActivityFromExternalApp(String url, String appId) {
Intent intent = new Intent(Intent.ACTION_VIEW);
if (appId != null) {
intent.putExtra(Browser.EXTRA_APPLICATION_ID, appId);
}
startMainActivityFromIntent(intent, url);
} | void function(String url, String appId) { Intent intent = new Intent(Intent.ACTION_VIEW); if (appId != null) { intent.putExtra(Browser.EXTRA_APPLICATION_ID, appId); } startMainActivityFromIntent(intent, url); } | /**
* Starts the Main activity as if it was started from an external application, on the
* specified URL.
*/ | Starts the Main activity as if it was started from an external application, on the specified URL | startMainActivityFromExternalApp | {
"repo_name": "endlessm/chromium-browser",
"path": "chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java",
"license": "bsd-3-clause",
"size": 28525
} | [
"android.content.Intent",
"android.provider.Browser"
]
| import android.content.Intent; import android.provider.Browser; | import android.content.*; import android.provider.*; | [
"android.content",
"android.provider"
]
| android.content; android.provider; | 2,471,560 |
public MetaProperty<DayCount> dayCount() {
return dayCount;
} | MetaProperty<DayCount> function() { return dayCount; } | /**
* The meta-property for the {@code dayCount} property.
* @return the meta-property, not null
*/ | The meta-property for the dayCount property | dayCount | {
"repo_name": "jmptrader/Strata",
"path": "modules/product/src/main/java/com/opengamma/strata/product/swap/type/OvernightRateSwapLegConvention.java",
"license": "apache-2.0",
"size": 60593
} | [
"com.opengamma.strata.basics.date.DayCount",
"org.joda.beans.MetaProperty"
]
| import com.opengamma.strata.basics.date.DayCount; import org.joda.beans.MetaProperty; | import com.opengamma.strata.basics.date.*; import org.joda.beans.*; | [
"com.opengamma.strata",
"org.joda.beans"
]
| com.opengamma.strata; org.joda.beans; | 2,212,574 |
public Adapter createTopLevelDictionaryEntryAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class '{@link iso20022.TopLevelDictionaryEntry <em>Top Level Dictionary Entry</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see iso20022.TopLevelDictionaryEntry
* @generated
*/ | Creates a new adapter for an object of class '<code>iso20022.TopLevelDictionaryEntry Top Level Dictionary Entry</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createTopLevelDictionaryEntryAdapter | {
"repo_name": "ISO20022ArchitectForum/sample-code-public",
"path": "DLT/Corda/ISO20022Generated/src/iso20022/util/Iso20022AdapterFactory.java",
"license": "apache-2.0",
"size": 55827
} | [
"org.eclipse.emf.common.notify.Adapter"
]
| import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
]
| org.eclipse.emf; | 781,686 |
public IFile getModelFile() {
return newFileCreationPage.getModelFile();
} | IFile function() { return newFileCreationPage.getModelFile(); } | /**
* Get the file from the page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Get the file from the page. | getModelFile | {
"repo_name": "unicesi/QD-SPL",
"path": "Generation/co.shift.modeling.editor/src/domainmetamodel/presentation/DomainmetamodelModelWizard.java",
"license": "lgpl-3.0",
"size": 18087
} | [
"org.eclipse.core.resources.IFile"
]
| import org.eclipse.core.resources.IFile; | import org.eclipse.core.resources.*; | [
"org.eclipse.core"
]
| org.eclipse.core; | 282,851 |
default AdvancedFileEndpointConsumerBuilder onCompletionExceptionHandler(
ExceptionHandler onCompletionExceptionHandler) {
doSetProperty("onCompletionExceptionHandler", onCompletionExceptionHandler);
return this;
} | default AdvancedFileEndpointConsumerBuilder onCompletionExceptionHandler( ExceptionHandler onCompletionExceptionHandler) { doSetProperty(STR, onCompletionExceptionHandler); return this; } | /**
* To use a custom org.apache.camel.spi.ExceptionHandler to handle any
* thrown exceptions that happens during the file on completion process
* where the consumer does either a commit or rollback. The default
* implementation will log any exception at WARN level and ignore.
*
* The option is a: <code>org.apache.camel.spi.ExceptionHandler</code>
* type.
*
* Group: consumer (advanced)
*/ | To use a custom org.apache.camel.spi.ExceptionHandler to handle any thrown exceptions that happens during the file on completion process where the consumer does either a commit or rollback. The default implementation will log any exception at WARN level and ignore. The option is a: <code>org.apache.camel.spi.ExceptionHandler</code> type. Group: consumer (advanced) | onCompletionExceptionHandler | {
"repo_name": "DariusX/camel",
"path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 149488
} | [
"org.apache.camel.spi.ExceptionHandler"
]
| import org.apache.camel.spi.ExceptionHandler; | import org.apache.camel.spi.*; | [
"org.apache.camel"
]
| org.apache.camel; | 320,202 |
private JsonObject getDefaultWatermark() {
Schema schema = new Schema();
String dataType;
String columnName = "derivedwatermarkcolumn";
schema.setColumnName(columnName);
WatermarkType wmType = WatermarkType.valueOf(
this.workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_WATERMARK_TYPE, "TIMESTAMP").toUpperCase());
switch (wmType) {
case TIMESTAMP:
dataType = "timestamp";
break;
case DATE:
dataType = "date";
break;
default:
dataType = "int";
break;
}
String elementDataType = "string";
List<String> mapSymbols = null;
JsonObject newDataType = this.convertDataType(columnName, dataType, elementDataType, mapSymbols);
schema.setDataType(newDataType);
schema.setWaterMark(true);
schema.setPrimaryKey(0);
schema.setLength(0);
schema.setPrecision(0);
schema.setScale(0);
schema.setNullable(false);
schema.setFormat(null);
schema.setComment("Default watermark column");
schema.setDefaultValue(null);
schema.setUnique(false);
String jsonStr = gson.toJson(schema);
JsonObject obj = gson.fromJson(jsonStr, JsonObject.class).getAsJsonObject();
return obj;
} | JsonObject function() { Schema schema = new Schema(); String dataType; String columnName = STR; schema.setColumnName(columnName); WatermarkType wmType = WatermarkType.valueOf( this.workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_WATERMARK_TYPE, STR).toUpperCase()); switch (wmType) { case TIMESTAMP: dataType = STR; break; case DATE: dataType = "date"; break; default: dataType = "int"; break; } String elementDataType = STR; List<String> mapSymbols = null; JsonObject newDataType = this.convertDataType(columnName, dataType, elementDataType, mapSymbols); schema.setDataType(newDataType); schema.setWaterMark(true); schema.setPrimaryKey(0); schema.setLength(0); schema.setPrecision(0); schema.setScale(0); schema.setNullable(false); schema.setFormat(null); schema.setComment(STR); schema.setDefaultValue(null); schema.setUnique(false); String jsonStr = gson.toJson(schema); JsonObject obj = gson.fromJson(jsonStr, JsonObject.class).getAsJsonObject(); return obj; } | /**
* Schema of default watermark column-required if there are multiple watermarks
*
* @return column schema
*/ | Schema of default watermark column-required if there are multiple watermarks | getDefaultWatermark | {
"repo_name": "jenniferzheng/gobblin",
"path": "gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/source/jdbc/JdbcExtractor.java",
"license": "apache-2.0",
"size": 43184
} | [
"com.google.gson.JsonObject",
"java.util.List",
"org.apache.gobblin.configuration.ConfigurationKeys",
"org.apache.gobblin.source.extractor.schema.Schema",
"org.apache.gobblin.source.extractor.watermark.WatermarkType"
]
| import com.google.gson.JsonObject; import java.util.List; import org.apache.gobblin.configuration.ConfigurationKeys; import org.apache.gobblin.source.extractor.schema.Schema; import org.apache.gobblin.source.extractor.watermark.WatermarkType; | import com.google.gson.*; import java.util.*; import org.apache.gobblin.configuration.*; import org.apache.gobblin.source.extractor.schema.*; import org.apache.gobblin.source.extractor.watermark.*; | [
"com.google.gson",
"java.util",
"org.apache.gobblin"
]
| com.google.gson; java.util; org.apache.gobblin; | 1,280,785 |
SSHKeyPair createSSHKeyPair(CreateSSHKeyPairCmd cmd); | SSHKeyPair createSSHKeyPair(CreateSSHKeyPairCmd cmd); | /**
* Creates a new
*
* @param cmd The api command class.
* @return A VO containing the key pair name, finger print for the public key and the private key material of the
* key pair.
*/ | Creates a new | createSSHKeyPair | {
"repo_name": "MissionCriticalCloud/cosmic",
"path": "cosmic-core/api/src/main/java/com/cloud/server/ManagementService.java",
"license": "apache-2.0",
"size": 14634
} | [
"com.cloud.api.command.user.ssh.CreateSSHKeyPairCmd",
"com.cloud.legacymodel.user.SSHKeyPair"
]
| import com.cloud.api.command.user.ssh.CreateSSHKeyPairCmd; import com.cloud.legacymodel.user.SSHKeyPair; | import com.cloud.api.command.user.ssh.*; import com.cloud.legacymodel.user.*; | [
"com.cloud.api",
"com.cloud.legacymodel"
]
| com.cloud.api; com.cloud.legacymodel; | 1,025,339 |
public Object unpack(Object viewObject) {
if (!Proxy.isProxyClass(viewObject.getClass()) || !(Proxy.getInvocationHandler(viewObject) instanceof InvocationHandlerImpl)) {
throw new IllegalArgumentException("The given object is not a view object");
}
InvocationHandlerImpl handler = (InvocationHandlerImpl) Proxy.getInvocationHandler(viewObject);
return handler.sourceObject;
}
private static class ViewGraphDetails implements Serializable {
// Transient, don't serialize all the views that happen to have been visited, recreate them when visited via the deserialized view
private transient Map<ViewKey, Object> views = new HashMap<ViewKey, Object>();
private final TargetTypeProvider typeProvider;
ViewGraphDetails(TargetTypeProvider typeProvider) {
this.typeProvider = typeProvider;
} | Object function(Object viewObject) { if (!Proxy.isProxyClass(viewObject.getClass()) !(Proxy.getInvocationHandler(viewObject) instanceof InvocationHandlerImpl)) { throw new IllegalArgumentException(STR); } InvocationHandlerImpl handler = (InvocationHandlerImpl) Proxy.getInvocationHandler(viewObject); return handler.sourceObject; } private static class ViewGraphDetails implements Serializable { private transient Map<ViewKey, Object> views = new HashMap<ViewKey, Object>(); private final TargetTypeProvider typeProvider; ViewGraphDetails(TargetTypeProvider typeProvider) { this.typeProvider = typeProvider; } | /**
* Unpacks the source object from a given view object.
*/ | Unpacks the source object from a given view object | unpack | {
"repo_name": "gradle/gradle",
"path": "subprojects/tooling-api/src/main/java/org/gradle/tooling/internal/adapter/ProtocolToModelAdapter.java",
"license": "apache-2.0",
"size": 41888
} | [
"java.io.Serializable",
"java.lang.reflect.Proxy",
"java.util.HashMap",
"java.util.Map"
]
| import java.io.Serializable; import java.lang.reflect.Proxy; import java.util.HashMap; import java.util.Map; | import java.io.*; import java.lang.reflect.*; import java.util.*; | [
"java.io",
"java.lang",
"java.util"
]
| java.io; java.lang; java.util; | 1,728,394 |
public void setDebugSolverName(LinearSystem system, String name) {
mDebugName = name;
SolverVariable left = system.createObjectVariable(mLeft);
SolverVariable top = system.createObjectVariable(mTop);
SolverVariable right = system.createObjectVariable(mRight);
SolverVariable bottom = system.createObjectVariable(mBottom);
left.setName(name + ".left");
top.setName(name + ".top");
right.setName(name + ".right");
bottom.setName(name + ".bottom");
SolverVariable baseline = system.createObjectVariable(mBaseline);
baseline.setName(name + ".baseline");
} | void function(LinearSystem system, String name) { mDebugName = name; SolverVariable left = system.createObjectVariable(mLeft); SolverVariable top = system.createObjectVariable(mTop); SolverVariable right = system.createObjectVariable(mRight); SolverVariable bottom = system.createObjectVariable(mBottom); left.setName(name + ".left"); top.setName(name + ".top"); right.setName(name + STR); bottom.setName(name + STR); SolverVariable baseline = system.createObjectVariable(mBaseline); baseline.setName(name + STR); } | /**
* Utility debug function. Sets the names of the anchors in the solver given
* a widget's name. The given name is used as a prefix, resulting in anchors' names
* of the form:
* <p/>
* <ul>
* <li>{name}.left</li>
* <li>{name}.top</li>
* <li>{name}.right</li>
* <li>{name}.bottom</li>
* <li>{name}.baseline</li>
* </ul>
*
* @param system solver used
* @param name name of the widget
*/ | Utility debug function. Sets the names of the anchors in the solver given a widget's name. The given name is used as a prefix, resulting in anchors' names of the form: {name}.left {name}.top {name}.right {name}.bottom {name}.baseline | setDebugSolverName | {
"repo_name": "AndroidX/constraintlayout",
"path": "constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/ConstraintWidget.java",
"license": "apache-2.0",
"size": 147462
} | [
"androidx.constraintlayout.core.LinearSystem",
"androidx.constraintlayout.core.SolverVariable"
]
| import androidx.constraintlayout.core.LinearSystem; import androidx.constraintlayout.core.SolverVariable; | import androidx.constraintlayout.core.*; | [
"androidx.constraintlayout"
]
| androidx.constraintlayout; | 2,126,344 |
@Override
protected void internalWriteSearchSettingsToXml(EwsServiceXmlWriter writer,
Grouping groupBy) throws XMLStreamException,
ServiceXmlSerializationException {
if (groupBy != null) {
groupBy.writeToXml(writer);
}
} | void function(EwsServiceXmlWriter writer, Grouping groupBy) throws XMLStreamException, ServiceXmlSerializationException { if (groupBy != null) { groupBy.writeToXml(writer); } } | /**
* Internals the write search settings to XML.
*
* @param writer
* The writer
* @param groupBy
* The group by clause.
* @throws javax.xml.stream.XMLStreamException
* the xML stream exception
* @throws ServiceXmlSerializationException
* the service xml serialization exception
*/ | Internals the write search settings to XML | internalWriteSearchSettingsToXml | {
"repo_name": "kaaaaang/ews-java-api",
"path": "src/main/java/microsoft/exchange/webservices/data/PagedView.java",
"license": "mit",
"size": 5422
} | [
"javax.xml.stream.XMLStreamException"
]
| import javax.xml.stream.XMLStreamException; | import javax.xml.stream.*; | [
"javax.xml"
]
| javax.xml; | 258,051 |
public void setEclipseEModelService(EModelService eclipseEModelService) {
this.eclipseEModelService = eclipseEModelService;
} | void function(EModelService eclipseEModelService) { this.eclipseEModelService = eclipseEModelService; } | /**
* Sets the eclipse EModelService.
* @param eclipseEModelService the current eclipse EModelService
*/ | Sets the eclipse EModelService | setEclipseEModelService | {
"repo_name": "EnFlexIT/AgentWorkbench",
"path": "eclipseProjects/org.agentgui/bundles/org.agentgui.core/src/agentgui/core/project/Project.java",
"license": "lgpl-2.1",
"size": 78478
} | [
"org.eclipse.e4.ui.workbench.modeling.EModelService"
]
| import org.eclipse.e4.ui.workbench.modeling.EModelService; | import org.eclipse.e4.ui.workbench.modeling.*; | [
"org.eclipse.e4"
]
| org.eclipse.e4; | 2,138,947 |
@ApiModelProperty(example = "null", value = "")
public String getTimespan() {
return timespan;
} | @ApiModelProperty(example = "null", value = "") String function() { return timespan; } | /**
* Get timespan
* @return timespan
**/ | Get timespan | getTimespan | {
"repo_name": "leanix/leanix-sdk-java",
"path": "src/main/java/net/leanix/api/models/ChartConfig.java",
"license": "mit",
"size": 5671
} | [
"io.swagger.annotations.ApiModelProperty"
]
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
]
| io.swagger.annotations; | 2,833,426 |
@ModelNodeBinding(detypedName = "use-ccm")
public Boolean useCcm() {
return this.useCcm;
} | @ModelNodeBinding(detypedName = STR) Boolean function() { return this.useCcm; } | /**
* Enable the use of a cached connection manager
*/ | Enable the use of a cached connection manager | useCcm | {
"repo_name": "wildfly-swarm/wildfly-config-api",
"path": "generator/src/test/java/org/wildfly/apigen/test/invocation/datasources/subsystem/xaDataSource/XaDataSource.java",
"license": "apache-2.0",
"size": 39848
} | [
"org.wildfly.swarm.config.runtime.ModelNodeBinding"
]
| import org.wildfly.swarm.config.runtime.ModelNodeBinding; | import org.wildfly.swarm.config.runtime.*; | [
"org.wildfly.swarm"
]
| org.wildfly.swarm; | 2,174,539 |
public void listDirectory(OCFile directory) {
if (mContainerActivity == null) {
Timber.e("No container activity attached");
return;
}
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
if (storageManager != null) {
// Check input parameters for null
if (directory == null) {
if (mFile != null) {
directory = mFile;
} else {
directory = storageManager.getFileByPath(OCFile.ROOT_PATH);
if (directory == null) {
return; // no files, wait for sync
}
}
}
// If that's not a directory -> List its parent
if (!directory.isFolder()) {
Timber.w("You see, that is not a directory -> %s", directory.toString());
directory = storageManager.getFileById(directory.getParentId());
}
mFileListAdapter.swapDirectory(directory, storageManager);
if (mFile == null || !mFile.equals(directory)) {
mCurrentListView.setSelection(0);
}
mFile = directory;
updateLayout();
}
} | void function(OCFile directory) { if (mContainerActivity == null) { Timber.e(STR); return; } FileDataStorageManager storageManager = mContainerActivity.getStorageManager(); if (storageManager != null) { if (directory == null) { if (mFile != null) { directory = mFile; } else { directory = storageManager.getFileByPath(OCFile.ROOT_PATH); if (directory == null) { return; } } } if (!directory.isFolder()) { Timber.w(STR, directory.toString()); directory = storageManager.getFileById(directory.getParentId()); } mFileListAdapter.swapDirectory(directory, storageManager); if (mFile == null !mFile.equals(directory)) { mCurrentListView.setSelection(0); } mFile = directory; updateLayout(); } } | /**
* Lists the given directory on the view. When the input parameter is null,
* it will either refresh the last known directory. list the root
* if there never was a directory.
*
* @param directory File to be listed
*/ | Lists the given directory on the view. When the input parameter is null, it will either refresh the last known directory. list the root if there never was a directory | listDirectory | {
"repo_name": "owncloud/android",
"path": "owncloudApp/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java",
"license": "gpl-2.0",
"size": 51319
} | [
"com.owncloud.android.datamodel.FileDataStorageManager",
"com.owncloud.android.datamodel.OCFile"
]
| import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; | import com.owncloud.android.datamodel.*; | [
"com.owncloud.android"
]
| com.owncloud.android; | 2,414,112 |
public boolean hasAi()
{ List<Profile> profiles = getProfiles();
Iterator<Profile> it = profiles.iterator();
boolean result = false;
while(it.hasNext() && !result)
{ Profile profile = it.next();
result = profile.hasAi();
}
return result;
}
| boolean function() { List<Profile> profiles = getProfiles(); Iterator<Profile> it = profiles.iterator(); boolean result = false; while(it.hasNext() && !result) { Profile profile = it.next(); result = profile.hasAi(); } return result; } | /**
* Checks if the current confrontation contains artificial agents.
*
* @return
* {@code true} iff the confrontation has at least one artificial agent.
*/ | Checks if the current confrontation contains artificial agents | hasAi | {
"repo_name": "vlabatut/totalboumboum",
"path": "src/org/totalboumboum/game/tournament/AbstractTournament.java",
"license": "gpl-2.0",
"size": 13061
} | [
"java.util.Iterator",
"java.util.List",
"org.totalboumboum.game.profile.Profile"
]
| import java.util.Iterator; import java.util.List; import org.totalboumboum.game.profile.Profile; | import java.util.*; import org.totalboumboum.game.profile.*; | [
"java.util",
"org.totalboumboum.game"
]
| java.util; org.totalboumboum.game; | 484,795 |
@ApiModelProperty(value = "")
public Amount getExpenseAmountInvoiced() {
return expenseAmountInvoiced;
} | @ApiModelProperty(value = "") Amount function() { return expenseAmountInvoiced; } | /**
* Get expenseAmountInvoiced
*
* @return expenseAmountInvoiced
*/ | Get expenseAmountInvoiced | getExpenseAmountInvoiced | {
"repo_name": "XeroAPI/Xero-Java",
"path": "src/main/java/com/xero/models/project/Project.java",
"license": "mit",
"size": 22642
} | [
"io.swagger.annotations.ApiModelProperty"
]
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
]
| io.swagger.annotations; | 1,197,516 |
EReference getDocumentRoot_TextAnnotation(); | EReference getDocumentRoot_TextAnnotation(); | /**
* Returns the meta object for the containment reference '{@link org.eclipse.bpmn2.DocumentRoot#getTextAnnotation <em>Text Annotation</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Text Annotation</em>'.
* @see org.eclipse.bpmn2.DocumentRoot#getTextAnnotation()
* @see #getDocumentRoot()
* @generated
*/ | Returns the meta object for the containment reference '<code>org.eclipse.bpmn2.DocumentRoot#getTextAnnotation Text Annotation</code>'. | getDocumentRoot_TextAnnotation | {
"repo_name": "Rikkola/kie-wb-common",
"path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java",
"license": "apache-2.0",
"size": 929298
} | [
"org.eclipse.emf.ecore.EReference"
]
| import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
]
| org.eclipse.emf; | 2,124,058 |
public static List<Double> getRandomMemberships(double maxNum,int countNum) {
Random random = new Random(System.currentTimeMillis());
double firstNum = random.nextDouble()*maxNum;
List<Double> numbers = new ArrayList<Double>();
numbers.add(firstNum);
double remainder = maxNum - firstNum;
double randomNumber;
while(numbers.size() < countNum) {
if (remainder == 0.0) {
break;
}
if (numbers.size() == countNum-1) {
break;
}
while(true) {
randomNumber = random.nextDouble()*maxNum;
if (randomNumber <= remainder) {
break;
}
}
numbers.add(randomNumber);
remainder = remainder - randomNumber;
}
for (int i = numbers.size(); i < countNum; i++) {
numbers.add(remainder);
}
return numbers;
} | static List<Double> function(double maxNum,int countNum) { Random random = new Random(System.currentTimeMillis()); double firstNum = random.nextDouble()*maxNum; List<Double> numbers = new ArrayList<Double>(); numbers.add(firstNum); double remainder = maxNum - firstNum; double randomNumber; while(numbers.size() < countNum) { if (remainder == 0.0) { break; } if (numbers.size() == countNum-1) { break; } while(true) { randomNumber = random.nextDouble()*maxNum; if (randomNumber <= remainder) { break; } } numbers.add(randomNumber); remainder = remainder - randomNumber; } for (int i = numbers.size(); i < countNum; i++) { numbers.add(remainder); } return numbers; } | /**
* Given a limit maxNum returns sum of random numbers equal to that number
* @param maxNum Double containing the value of the maxNum
* @param countNum Integer containing the number of integers to add
* @return List<Double> containing the random numbers
*/ | Given a limit maxNum returns sum of random numbers equal to that number | getRandomMemberships | {
"repo_name": "rupakc/jCluster",
"path": "src/main/java/org/jcluster/fuzzykmeans/FuzzyCMeansUtil.java",
"license": "mit",
"size": 5215
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Random"
]
| import java.util.ArrayList; import java.util.List; import java.util.Random; | import java.util.*; | [
"java.util"
]
| java.util; | 765,815 |
public void testAutoApplyConverter() {
ServerSession session = getPersistenceUnitServerSession();
ClassDescriptor employeeDescriptor = session.getDescriptor(Employee.class);
DirectToFieldMapping salaryMapping = (DirectToFieldMapping) employeeDescriptor.getMappingForAttributeName("salary");
assertNotNull("Salary mapping did not have the auto apply converter", salaryMapping.getConverter());
DirectToFieldMapping previousSalaryMapping = (DirectToFieldMapping) employeeDescriptor.getMappingForAttributeName("previousSalary");
assertNull("Salary mapping did not have the auto apply converter", previousSalaryMapping.getConverter());
} | void function() { ServerSession session = getPersistenceUnitServerSession(); ClassDescriptor employeeDescriptor = session.getDescriptor(Employee.class); DirectToFieldMapping salaryMapping = (DirectToFieldMapping) employeeDescriptor.getMappingForAttributeName(STR); assertNotNull(STR, salaryMapping.getConverter()); DirectToFieldMapping previousSalaryMapping = (DirectToFieldMapping) employeeDescriptor.getMappingForAttributeName(STR); assertNull(STR, previousSalaryMapping.getConverter()); } | /**
* Test that an attribute picks up an auto apply converter.
*/ | Test that an attribute picks up an auto apply converter | testAutoApplyConverter | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa21/advanced/ConverterTestSuite.java",
"license": "epl-1.0",
"size": 12710
} | [
"org.eclipse.persistence.descriptors.ClassDescriptor",
"org.eclipse.persistence.mappings.DirectToFieldMapping",
"org.eclipse.persistence.sessions.server.ServerSession",
"org.eclipse.persistence.testing.models.jpa21.advanced.Employee"
]
| import org.eclipse.persistence.descriptors.ClassDescriptor; import org.eclipse.persistence.mappings.DirectToFieldMapping; import org.eclipse.persistence.sessions.server.ServerSession; import org.eclipse.persistence.testing.models.jpa21.advanced.Employee; | import org.eclipse.persistence.descriptors.*; import org.eclipse.persistence.mappings.*; import org.eclipse.persistence.sessions.server.*; import org.eclipse.persistence.testing.models.jpa21.advanced.*; | [
"org.eclipse.persistence"
]
| org.eclipse.persistence; | 480,235 |
public static MozuClient<com.mozu.api.contracts.reference.CurrencyCollection> getCurrenciesClient(String responseFields) throws Exception
{
MozuUrl url = com.mozu.api.urls.platform.ReferenceDataUrl.getCurrenciesUrl(responseFields);
String verb = "GET";
Class<?> clz = com.mozu.api.contracts.reference.CurrencyCollection.class;
MozuClient<com.mozu.api.contracts.reference.CurrencyCollection> mozuClient = (MozuClient<com.mozu.api.contracts.reference.CurrencyCollection>) MozuClientFactory.getInstance(clz);
mozuClient.setVerb(verb);
mozuClient.setResourceUrl(url);
return mozuClient;
} | static MozuClient<com.mozu.api.contracts.reference.CurrencyCollection> function(String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.platform.ReferenceDataUrl.getCurrenciesUrl(responseFields); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.reference.CurrencyCollection.class; MozuClient<com.mozu.api.contracts.reference.CurrencyCollection> mozuClient = (MozuClient<com.mozu.api.contracts.reference.CurrencyCollection>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; } | /**
* Retrieves the entire list of currencies that the system supports.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.reference.CurrencyCollection> mozuClient=GetCurrenciesClient( responseFields);
* client.setBaseAddress(url);
* client.executeRequest();
* CurrencyCollection currencyCollection = client.Result();
* </code></pre></p>
* @param responseFields Use this field to include those fields which are not included by default.
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.reference.CurrencyCollection>
* @see com.mozu.api.contracts.reference.CurrencyCollection
*/ | Retrieves the entire list of currencies that the system supports. <code><code> MozuClient mozuClient=GetCurrenciesClient( responseFields); client.setBaseAddress(url); client.executeRequest(); CurrencyCollection currencyCollection = client.Result(); </code></code> | getCurrenciesClient | {
"repo_name": "sanjaymandadi/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/platform/ReferenceDataClient.java",
"license": "mit",
"size": 27111
} | [
"com.mozu.api.MozuClient",
"com.mozu.api.MozuClientFactory",
"com.mozu.api.MozuUrl"
]
| import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; | import com.mozu.api.*; | [
"com.mozu.api"
]
| com.mozu.api; | 1,805,655 |
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (mSearchable == null) {
return false;
}
// if it's an action specified by the searchable activity, launch the
// entered query with the action key
SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode);
if ((actionKey != null) && (actionKey.getQueryActionMsg() != null)) {
launchQuerySearch(keyCode, actionKey.getQueryActionMsg(), mSearchSrcTextView.getText()
.toString());
return true;
}
return super.onKeyDown(keyCode, event);
} | boolean function(int keyCode, KeyEvent event) { if (mSearchable == null) { return false; } SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode); if ((actionKey != null) && (actionKey.getQueryActionMsg() != null)) { launchQuerySearch(keyCode, actionKey.getQueryActionMsg(), mSearchSrcTextView.getText() .toString()); return true; } return super.onKeyDown(keyCode, event); } | /**
* Handles the key down event for dealing with action keys.
*
* @param keyCode This is the keycode of the typed key, and is the same value as
* found in the KeyEvent parameter.
* @param event The complete event record for the typed key
*
* @return true if the event was handled here, or false if not.
*/ | Handles the key down event for dealing with action keys | onKeyDown | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/widget/SearchView.java",
"license": "gpl-3.0",
"size": 71165
} | [
"android.app.SearchableInfo",
"android.view.KeyEvent"
]
| import android.app.SearchableInfo; import android.view.KeyEvent; | import android.app.*; import android.view.*; | [
"android.app",
"android.view"
]
| android.app; android.view; | 597,987 |
@Override
public void delete(DataRecord record) throws FormException {
if (record != null) {
ForeignPK foreignPK = new ForeignPK(record.getId(), recordTemplate.getInstanceId());
// remove files managed by WYSIWYG fields
WysiwygFCKFieldDisplayer.removeContents(foreignPK);
// remove form documents registred into JCR
List<SimpleDocument> documents = AttachmentServiceProvider.getAttachmentService().
listDocumentsByForeignKeyAndType(foreignPK, DocumentType.form, null);
for (SimpleDocument doc : documents) {
AttachmentServiceProvider.getAttachmentService().deleteAttachment(doc);
}
List<String> languages =
getGenericRecordSetManager().getLanguagesOfRecord(recordTemplate, record.getId());
for (String lang : languages) {
DataRecord aRecord = getRecord(record.getId(), lang);
// remove data in database
getGenericRecordSetManager().deleteRecord(recordTemplate, aRecord);
}
}
} | void function(DataRecord record) throws FormException { if (record != null) { ForeignPK foreignPK = new ForeignPK(record.getId(), recordTemplate.getInstanceId()); WysiwygFCKFieldDisplayer.removeContents(foreignPK); List<SimpleDocument> documents = AttachmentServiceProvider.getAttachmentService(). listDocumentsByForeignKeyAndType(foreignPK, DocumentType.form, null); for (SimpleDocument doc : documents) { AttachmentServiceProvider.getAttachmentService().deleteAttachment(doc); } List<String> languages = getGenericRecordSetManager().getLanguagesOfRecord(recordTemplate, record.getId()); for (String lang : languages) { DataRecord aRecord = getRecord(record.getId(), lang); getGenericRecordSetManager().deleteRecord(recordTemplate, aRecord); } } } | /**
* Deletes the given DataRecord and set to null its id.
* @throws FormException when the record doesn't have the required template., when the record has
* an unknown id, when the delete fail.
*/ | Deletes the given DataRecord and set to null its id | delete | {
"repo_name": "ebonnet/Silverpeas-Core",
"path": "core-library/src/main/java/org/silverpeas/core/contribution/content/form/record/GenericRecordSet.java",
"license": "agpl-3.0",
"size": 16487
} | [
"java.util.List",
"org.silverpeas.core.ForeignPK",
"org.silverpeas.core.contribution.attachment.AttachmentServiceProvider",
"org.silverpeas.core.contribution.attachment.model.DocumentType",
"org.silverpeas.core.contribution.attachment.model.SimpleDocument",
"org.silverpeas.core.contribution.content.form.DataRecord",
"org.silverpeas.core.contribution.content.form.FormException",
"org.silverpeas.core.contribution.content.form.displayers.WysiwygFCKFieldDisplayer"
]
| import java.util.List; import org.silverpeas.core.ForeignPK; import org.silverpeas.core.contribution.attachment.AttachmentServiceProvider; import org.silverpeas.core.contribution.attachment.model.DocumentType; import org.silverpeas.core.contribution.attachment.model.SimpleDocument; import org.silverpeas.core.contribution.content.form.DataRecord; import org.silverpeas.core.contribution.content.form.FormException; import org.silverpeas.core.contribution.content.form.displayers.WysiwygFCKFieldDisplayer; | import java.util.*; import org.silverpeas.core.*; import org.silverpeas.core.contribution.attachment.*; import org.silverpeas.core.contribution.attachment.model.*; import org.silverpeas.core.contribution.content.form.*; import org.silverpeas.core.contribution.content.form.displayers.*; | [
"java.util",
"org.silverpeas.core"
]
| java.util; org.silverpeas.core; | 2,813,553 |
public void checkDamage(final Player player, final MovingData data, final double y) {
final MovingConfig cc = MovingConfig.getConfig(player);
// Deal damage.
handleOnGround(player, y, false, data, cc);
}
| void function(final Player player, final MovingData data, final double y) { final MovingConfig cc = MovingConfig.getConfig(player); handleOnGround(player, y, false, data, cc); } | /**
* This is called if a player fails a check and gets set back, to avoid using that to avoid fall damage the player might be dealt damage here.
* @param player
* @param data
*/ | This is called if a player fails a check and gets set back, to avoid using that to avoid fall damage the player might be dealt damage here | checkDamage | {
"repo_name": "MyPictures/NoCheatPlus",
"path": "NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/NoFall.java",
"license": "gpl-3.0",
"size": 10239
} | [
"org.bukkit.entity.Player"
]
| import org.bukkit.entity.Player; | import org.bukkit.entity.*; | [
"org.bukkit.entity"
]
| org.bukkit.entity; | 761,845 |
public List<String> getExtensions() {
return ImmutableList.of();
} | List<String> function() { return ImmutableList.of(); } | /**
* Get a list of filename extensions this matcher handles. The first entry in the list (if
* available) is the primary extension that code can use to construct output file names.
* The list can be empty for some matchers.
*
* @return a list of filename extensions
*/ | Get a list of filename extensions this matcher handles. The first entry in the list (if available) is the primary extension that code can use to construct output file names. The list can be empty for some matchers | getExtensions | {
"repo_name": "kamalmarhubi/bazel",
"path": "src/main/java/com/google/devtools/build/lib/util/FileType.java",
"license": "apache-2.0",
"size": 8498
} | [
"com.google.common.collect.ImmutableList",
"java.util.List"
]
| import com.google.common.collect.ImmutableList; import java.util.List; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
]
| com.google.common; java.util; | 917,752 |
private static NestedSet<LibraryToLink> computeLtoIndexingUniqueLibraries(
NestedSet<LibraryToLink> originalUniqueLibraries, boolean includeLinkStaticInLtoIndexing) {
NestedSetBuilder<LibraryToLink> uniqueLibrariesBuilder = NestedSetBuilder.linkOrder();
for (LibraryToLink lib : originalUniqueLibraries) {
if (!lib.containsObjectFiles()) {
uniqueLibrariesBuilder.add(lib);
continue;
}
ImmutableSet.Builder<Artifact> newObjectFilesBuilder = ImmutableSet.builder();
for (Artifact a : lib.getObjectFiles()) {
// If this link includes object files from another library, that library must be
// statically linked.
if (!includeLinkStaticInLtoIndexing) {
Preconditions.checkNotNull(lib.getSharedNonLtoBackends());
LtoBackendArtifacts ltoArtifacts = lib.getSharedNonLtoBackends().getOrDefault(a, null);
// Either we have a shared LTO artifact, or this wasn't bitcode to start with.
Preconditions.checkState(
ltoArtifacts != null || !lib.getLtoBitcodeFiles().containsKey(a));
if (ltoArtifacts != null) {
// Include the native object produced by the shared LTO backend in the LTO indexing
// step instead of the bitcode file. The LTO indexing step invokes the linker which
// must see all objects used to produce the final link output.
newObjectFilesBuilder.add(ltoArtifacts.getObjectFile());
continue;
}
}
newObjectFilesBuilder.add(lib.getLtoBitcodeFiles().getOrDefault(a, a));
}
uniqueLibrariesBuilder.add(
LinkerInputs.newInputLibrary(
lib.getArtifact(),
lib.getArtifactCategory(),
lib.getLibraryIdentifier(),
newObjectFilesBuilder.build(),
lib.getLtoBitcodeFiles(),
null));
}
return uniqueLibrariesBuilder.build();
} | static NestedSet<LibraryToLink> function( NestedSet<LibraryToLink> originalUniqueLibraries, boolean includeLinkStaticInLtoIndexing) { NestedSetBuilder<LibraryToLink> uniqueLibrariesBuilder = NestedSetBuilder.linkOrder(); for (LibraryToLink lib : originalUniqueLibraries) { if (!lib.containsObjectFiles()) { uniqueLibrariesBuilder.add(lib); continue; } ImmutableSet.Builder<Artifact> newObjectFilesBuilder = ImmutableSet.builder(); for (Artifact a : lib.getObjectFiles()) { if (!includeLinkStaticInLtoIndexing) { Preconditions.checkNotNull(lib.getSharedNonLtoBackends()); LtoBackendArtifacts ltoArtifacts = lib.getSharedNonLtoBackends().getOrDefault(a, null); Preconditions.checkState( ltoArtifacts != null !lib.getLtoBitcodeFiles().containsKey(a)); if (ltoArtifacts != null) { newObjectFilesBuilder.add(ltoArtifacts.getObjectFile()); continue; } } newObjectFilesBuilder.add(lib.getLtoBitcodeFiles().getOrDefault(a, a)); } uniqueLibrariesBuilder.add( LinkerInputs.newInputLibrary( lib.getArtifact(), lib.getArtifactCategory(), lib.getLibraryIdentifier(), newObjectFilesBuilder.build(), lib.getLtoBitcodeFiles(), null)); } return uniqueLibrariesBuilder.build(); } | /**
* Maps bitcode library files used by the LTO backends to the corresponding minimized bitcode file
* used as input to the LTO indexing step.
*/ | Maps bitcode library files used by the LTO backends to the corresponding minimized bitcode file used as input to the LTO indexing step | computeLtoIndexingUniqueLibraries | {
"repo_name": "dropbox/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java",
"license": "apache-2.0",
"size": 62785
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.ImmutableSet",
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.collect.nestedset.NestedSet",
"com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder",
"com.google.devtools.build.lib.rules.cpp.LinkerInputs"
]
| import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.rules.cpp.LinkerInputs; | import com.google.common.base.*; import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.collect.nestedset.*; import com.google.devtools.build.lib.rules.cpp.*; | [
"com.google.common",
"com.google.devtools"
]
| com.google.common; com.google.devtools; | 1,576,352 |
public void addSeparatorToNavbar(Page page, NavbarPositionType position, boolean ifNotEmpty) {
Navbar navbar = getNavbar(page, position);
if (navbar != null) {
if (!ifNotEmpty || navbar.getPageOrGroupOrLine().size() > 0) {
Line line = new Line();
line.setLayout(createLayout(0));
navbar.getPageOrGroupOrLine().add(factory.createNavbarLine(line));
}
}
} | void function(Page page, NavbarPositionType position, boolean ifNotEmpty) { Navbar navbar = getNavbar(page, position); if (navbar != null) { if (!ifNotEmpty navbar.getPageOrGroupOrLine().size() > 0) { Line line = new Line(); line.setLayout(createLayout(0)); navbar.getPageOrGroupOrLine().add(factory.createNavbarLine(line)); } } } | /**
* add the separating line in the navbar
*
* @param page
* - the page the navbar should be searched in
* @param position
* - the position of the navbar
* @param ifNotEmpty
* - true: only add the separator ot the navbar has already
* content (e.g. prevent a seperator at the beginning of the
* navbar)
*/ | add the separating line in the navbar | addSeparatorToNavbar | {
"repo_name": "actong/openhab2",
"path": "addons/ui/org.openhab.ui.cometvisu/src/main/java/org/openhab/ui/cometvisu/internal/config/ConfigHelper.java",
"license": "epl-1.0",
"size": 42030
} | [
"org.openhab.ui.cometvisu.internal.config.beans.Line",
"org.openhab.ui.cometvisu.internal.config.beans.Navbar",
"org.openhab.ui.cometvisu.internal.config.beans.NavbarPositionType",
"org.openhab.ui.cometvisu.internal.config.beans.Page"
]
| import org.openhab.ui.cometvisu.internal.config.beans.Line; import org.openhab.ui.cometvisu.internal.config.beans.Navbar; import org.openhab.ui.cometvisu.internal.config.beans.NavbarPositionType; import org.openhab.ui.cometvisu.internal.config.beans.Page; | import org.openhab.ui.cometvisu.internal.config.beans.*; | [
"org.openhab.ui"
]
| org.openhab.ui; | 1,222,885 |
@SuppressWarnings("unchecked")
public IStructuredSelection findSelection(IEditorInput anInput) {
if (!(anInput instanceof IURIEditorInput)) {
return null;
}
URI uri = ((IURIEditorInput) anInput).getURI();
if (!uri.getScheme().equals("file")) //$NON-NLS-1$
return null;
File file = new File(uri.getPath());
if (!file.exists())
return null;
RepositoryUtil config = Activator.getDefault().getRepositoryUtil();
List<String> repos = config.getConfiguredRepositories();
for (String repo : repos) {
Repository repository;
try {
repository = FileRepositoryBuilder.create(new File(repo));
} catch (IOException e) {
continue;
}
if (repository.isBare())
continue;
if (file.getPath().startsWith(repository.getWorkTree().getPath())) {
RepositoriesViewContentProvider cp = new RepositoriesViewContentProvider();
RepositoryNode repoNode = new RepositoryNode(null, repository);
RepositoryTreeNode result = null;
for (Object child : cp.getChildren(repoNode)) {
if (child instanceof WorkingDirNode) {
result = (WorkingDirNode) child;
break;
}
}
if (result == null)
return null;
IPath remainingPath = new Path(file.getPath().substring(
repository.getWorkTree().getPath().length()));
for (String segment : remainingPath.segments()) {
for (Object child : cp.getChildren(result)) {
RepositoryTreeNode<File> fileNode;
try {
fileNode = (RepositoryTreeNode<File>) child;
} catch (ClassCastException e) {
return null;
}
if (fileNode.getObject().getName().equals(segment)) {
result = fileNode;
break;
}
}
}
return new StructuredSelection(result);
}
}
return null;
} | @SuppressWarnings(STR) IStructuredSelection function(IEditorInput anInput) { if (!(anInput instanceof IURIEditorInput)) { return null; } URI uri = ((IURIEditorInput) anInput).getURI(); if (!uri.getScheme().equals("file")) return null; File file = new File(uri.getPath()); if (!file.exists()) return null; RepositoryUtil config = Activator.getDefault().getRepositoryUtil(); List<String> repos = config.getConfiguredRepositories(); for (String repo : repos) { Repository repository; try { repository = FileRepositoryBuilder.create(new File(repo)); } catch (IOException e) { continue; } if (repository.isBare()) continue; if (file.getPath().startsWith(repository.getWorkTree().getPath())) { RepositoriesViewContentProvider cp = new RepositoriesViewContentProvider(); RepositoryNode repoNode = new RepositoryNode(null, repository); RepositoryTreeNode result = null; for (Object child : cp.getChildren(repoNode)) { if (child instanceof WorkingDirNode) { result = (WorkingDirNode) child; break; } } if (result == null) return null; IPath remainingPath = new Path(file.getPath().substring( repository.getWorkTree().getPath().length())); for (String segment : remainingPath.segments()) { for (Object child : cp.getChildren(result)) { RepositoryTreeNode<File> fileNode; try { fileNode = (RepositoryTreeNode<File>) child; } catch (ClassCastException e) { return null; } if (fileNode.getObject().getName().equals(segment)) { result = fileNode; break; } } } return new StructuredSelection(result); } } return null; } | /**
* TODO javadoc missing
*/ | TODO javadoc missing | findSelection | {
"repo_name": "blizzy78/egit",
"path": "org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/LinkHelper.java",
"license": "epl-1.0",
"size": 4161
} | [
"java.io.File",
"java.io.IOException",
"java.util.List",
"org.eclipse.core.runtime.IPath",
"org.eclipse.core.runtime.Path",
"org.eclipse.egit.core.RepositoryUtil",
"org.eclipse.egit.ui.Activator",
"org.eclipse.egit.ui.internal.repository.RepositoriesViewContentProvider",
"org.eclipse.jface.viewers.IStructuredSelection",
"org.eclipse.jface.viewers.StructuredSelection",
"org.eclipse.jgit.lib.Repository",
"org.eclipse.jgit.storage.file.FileRepositoryBuilder",
"org.eclipse.ui.IEditorInput",
"org.eclipse.ui.IURIEditorInput"
]
| import java.io.File; import java.io.IOException; import java.util.List; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.egit.core.RepositoryUtil; import org.eclipse.egit.ui.Activator; import org.eclipse.egit.ui.internal.repository.RepositoriesViewContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IURIEditorInput; | import java.io.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.egit.core.*; import org.eclipse.egit.ui.*; import org.eclipse.egit.ui.internal.repository.*; import org.eclipse.jface.viewers.*; import org.eclipse.jgit.lib.*; import org.eclipse.jgit.storage.file.*; import org.eclipse.ui.*; | [
"java.io",
"java.util",
"org.eclipse.core",
"org.eclipse.egit",
"org.eclipse.jface",
"org.eclipse.jgit",
"org.eclipse.ui"
]
| java.io; java.util; org.eclipse.core; org.eclipse.egit; org.eclipse.jface; org.eclipse.jgit; org.eclipse.ui; | 2,075,808 |
protected void createHandleAuthenticationFailureAction(final Flow flow) {
val handler = createActionState(flow, CasWebflowConstants.STATE_ID_HANDLE_AUTHN_FAILURE,
CasWebflowConstants.ACTION_ID_AUTHENTICATION_EXCEPTION_HANDLER);
createTransitionForState(handler, AccountDisabledException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_ACCOUNT_DISABLED);
createTransitionForState(handler, AccountLockedException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_ACCOUNT_LOCKED);
createTransitionForState(handler, AccountPasswordMustChangeException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_MUST_CHANGE_PASSWORD);
createTransitionForState(handler, CredentialExpiredException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_EXPIRED_PASSWORD);
createTransitionForState(handler, InvalidLoginLocationException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_INVALID_WORKSTATION);
createTransitionForState(handler, InvalidLoginTimeException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_INVALID_AUTHENTICATION_HOURS);
createTransitionForState(handler, FailedLoginException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM);
createTransitionForState(handler, AccountNotFoundException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM);
createTransitionForState(handler, UnauthorizedServiceForPrincipalException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM);
createTransitionForState(handler, PrincipalException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM);
createTransitionForState(handler, UnsatisfiedAuthenticationPolicyException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM);
createTransitionForState(handler, UnauthorizedAuthenticationException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_AUTHENTICATION_BLOCKED);
createTransitionForState(handler, CasWebflowConstants.STATE_ID_SERVICE_UNAUTHZ_CHECK, CasWebflowConstants.STATE_ID_SERVICE_UNAUTHZ_CHECK);
createStateDefaultTransition(handler, CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM);
} | void function(final Flow flow) { val handler = createActionState(flow, CasWebflowConstants.STATE_ID_HANDLE_AUTHN_FAILURE, CasWebflowConstants.ACTION_ID_AUTHENTICATION_EXCEPTION_HANDLER); createTransitionForState(handler, AccountDisabledException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_ACCOUNT_DISABLED); createTransitionForState(handler, AccountLockedException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_ACCOUNT_LOCKED); createTransitionForState(handler, AccountPasswordMustChangeException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_MUST_CHANGE_PASSWORD); createTransitionForState(handler, CredentialExpiredException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_EXPIRED_PASSWORD); createTransitionForState(handler, InvalidLoginLocationException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_INVALID_WORKSTATION); createTransitionForState(handler, InvalidLoginTimeException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_INVALID_AUTHENTICATION_HOURS); createTransitionForState(handler, FailedLoginException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM); createTransitionForState(handler, AccountNotFoundException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM); createTransitionForState(handler, UnauthorizedServiceForPrincipalException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM); createTransitionForState(handler, PrincipalException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM); createTransitionForState(handler, UnsatisfiedAuthenticationPolicyException.class.getSimpleName(), CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM); createTransitionForState(handler, UnauthorizedAuthenticationException.class.getSimpleName(), CasWebflowConstants.VIEW_ID_AUTHENTICATION_BLOCKED); createTransitionForState(handler, CasWebflowConstants.STATE_ID_SERVICE_UNAUTHZ_CHECK, CasWebflowConstants.STATE_ID_SERVICE_UNAUTHZ_CHECK); createStateDefaultTransition(handler, CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM); } | /**
* Create handle authentication failure action.
*
* @param flow the flow
*/ | Create handle authentication failure action | createHandleAuthenticationFailureAction | {
"repo_name": "frett/cas",
"path": "core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/DefaultLoginWebflowConfigurer.java",
"license": "apache-2.0",
"size": 22551
} | [
"javax.security.auth.login.AccountLockedException",
"javax.security.auth.login.AccountNotFoundException",
"javax.security.auth.login.CredentialExpiredException",
"javax.security.auth.login.FailedLoginException",
"org.apereo.cas.authentication.PrincipalException",
"org.apereo.cas.authentication.adaptive.UnauthorizedAuthenticationException",
"org.apereo.cas.authentication.exceptions.AccountDisabledException",
"org.apereo.cas.authentication.exceptions.AccountPasswordMustChangeException",
"org.apereo.cas.authentication.exceptions.InvalidLoginLocationException",
"org.apereo.cas.authentication.exceptions.InvalidLoginTimeException",
"org.apereo.cas.services.UnauthorizedServiceForPrincipalException",
"org.apereo.cas.ticket.UnsatisfiedAuthenticationPolicyException",
"org.apereo.cas.web.flow.CasWebflowConstants",
"org.springframework.webflow.engine.Flow"
]
| import javax.security.auth.login.AccountLockedException; import javax.security.auth.login.AccountNotFoundException; import javax.security.auth.login.CredentialExpiredException; import javax.security.auth.login.FailedLoginException; import org.apereo.cas.authentication.PrincipalException; import org.apereo.cas.authentication.adaptive.UnauthorizedAuthenticationException; import org.apereo.cas.authentication.exceptions.AccountDisabledException; import org.apereo.cas.authentication.exceptions.AccountPasswordMustChangeException; import org.apereo.cas.authentication.exceptions.InvalidLoginLocationException; import org.apereo.cas.authentication.exceptions.InvalidLoginTimeException; import org.apereo.cas.services.UnauthorizedServiceForPrincipalException; import org.apereo.cas.ticket.UnsatisfiedAuthenticationPolicyException; import org.apereo.cas.web.flow.CasWebflowConstants; import org.springframework.webflow.engine.Flow; | import javax.security.auth.login.*; import org.apereo.cas.authentication.*; import org.apereo.cas.authentication.adaptive.*; import org.apereo.cas.authentication.exceptions.*; import org.apereo.cas.services.*; import org.apereo.cas.ticket.*; import org.apereo.cas.web.flow.*; import org.springframework.webflow.engine.*; | [
"javax.security",
"org.apereo.cas",
"org.springframework.webflow"
]
| javax.security; org.apereo.cas; org.springframework.webflow; | 2,905,547 |
public static BgpPrefixAttrMetric read(ChannelBuffer cb)
throws BgpParseException {
int linkPfxMetric;
short lsAttrLength = cb.readShort(); // 4 Bytes
if ((lsAttrLength != ATTR_PREFIX_LEN)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
linkPfxMetric = cb.readInt();
return BgpPrefixAttrMetric.of(linkPfxMetric);
} | static BgpPrefixAttrMetric function(ChannelBuffer cb) throws BgpParseException { int linkPfxMetric; short lsAttrLength = cb.readShort(); if ((lsAttrLength != ATTR_PREFIX_LEN) (cb.readableBytes() < lsAttrLength)) { Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } linkPfxMetric = cb.readInt(); return BgpPrefixAttrMetric.of(linkPfxMetric); } | /**
* Reads the Prefix Metric.
*
* @param cb ChannelBuffer
* @return object of BgpPrefixAttrMetric
* @throws BgpParseException while parsing BgpPrefixAttrMetric
*/ | Reads the Prefix Metric | read | {
"repo_name": "Shashikanth-Huawei/bmp",
"path": "apps/bgp-api/src/main/java/org/onosproject/bgp/bgpio/types/attr/BgpPrefixAttrMetric.java",
"license": "apache-2.0",
"size": 3853
} | [
"org.jboss.netty.buffer.ChannelBuffer",
"org.onosproject.bgp.bgpio.exceptions.BgpParseException",
"org.onosproject.bgp.bgpio.types.BgpErrorType",
"org.onosproject.bgp.bgpio.util.Validation"
]
| import org.jboss.netty.buffer.ChannelBuffer; import org.onosproject.bgp.bgpio.exceptions.BgpParseException; import org.onosproject.bgp.bgpio.types.BgpErrorType; import org.onosproject.bgp.bgpio.util.Validation; | import org.jboss.netty.buffer.*; import org.onosproject.bgp.bgpio.exceptions.*; import org.onosproject.bgp.bgpio.types.*; import org.onosproject.bgp.bgpio.util.*; | [
"org.jboss.netty",
"org.onosproject.bgp"
]
| org.jboss.netty; org.onosproject.bgp; | 1,023,228 |
BitMatrix buildFunctionPattern() {
int dimension = getDimensionForVersion();
BitMatrix bitMatrix = new BitMatrix(dimension);
// Top left finder pattern + separator + format
bitMatrix.setRegion(0, 0, 9, 9);
// Top right finder pattern + separator + format
bitMatrix.setRegion(dimension - 8, 0, 8, 9);
// Bottom left finder pattern + separator + format
bitMatrix.setRegion(0, dimension - 8, 9, 8);
// Alignment patterns
int max = alignmentPatternCenters.length;
for (int x = 0; x < max; x++) {
int i = alignmentPatternCenters[x] - 2;
for (int y = 0; y < max; y++) {
if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) {
// No alignment patterns near the three finder paterns
continue;
}
bitMatrix.setRegion(alignmentPatternCenters[y] - 2, i, 5, 5);
}
}
// Vertical timing pattern
bitMatrix.setRegion(6, 9, 1, dimension - 17);
// Horizontal timing pattern
bitMatrix.setRegion(9, 6, dimension - 17, 1);
if (versionNumber > 6) {
// Version info, top right
bitMatrix.setRegion(dimension - 11, 0, 3, 6);
// Version info, bottom left
bitMatrix.setRegion(0, dimension - 11, 6, 3);
}
return bitMatrix;
}
public static final class ECBlocks {
private final int ecCodewordsPerBlock;
private final ECB[] ecBlocks;
ECBlocks(int ecCodewordsPerBlock, ECB... ecBlocks) {
this.ecCodewordsPerBlock = ecCodewordsPerBlock;
this.ecBlocks = ecBlocks;
} | BitMatrix buildFunctionPattern() { int dimension = getDimensionForVersion(); BitMatrix bitMatrix = new BitMatrix(dimension); bitMatrix.setRegion(0, 0, 9, 9); bitMatrix.setRegion(dimension - 8, 0, 8, 9); bitMatrix.setRegion(0, dimension - 8, 9, 8); int max = alignmentPatternCenters.length; for (int x = 0; x < max; x++) { int i = alignmentPatternCenters[x] - 2; for (int y = 0; y < max; y++) { if ((x == 0 && (y == 0 y == max - 1)) (x == max - 1 && y == 0)) { continue; } bitMatrix.setRegion(alignmentPatternCenters[y] - 2, i, 5, 5); } } bitMatrix.setRegion(6, 9, 1, dimension - 17); bitMatrix.setRegion(9, 6, dimension - 17, 1); if (versionNumber > 6) { bitMatrix.setRegion(dimension - 11, 0, 3, 6); bitMatrix.setRegion(0, dimension - 11, 6, 3); } return bitMatrix; } public static final class ECBlocks { private final int ecCodewordsPerBlock; private final ECB[] ecBlocks; ECBlocks(int ecCodewordsPerBlock, ECB... ecBlocks) { this.ecCodewordsPerBlock = ecCodewordsPerBlock; this.ecBlocks = ecBlocks; } | /**
* See ISO 18004:2006 Annex E
*/ | See ISO 18004:2006 Annex E | buildFunctionPattern | {
"repo_name": "cping/RipplePower",
"path": "eclipse/RipplePower/src/com/google/zxing/qrcode/decoder/Version.java",
"license": "apache-2.0",
"size": 17657
} | [
"com.google.zxing.common.BitMatrix"
]
| import com.google.zxing.common.BitMatrix; | import com.google.zxing.common.*; | [
"com.google.zxing"
]
| com.google.zxing; | 478,719 |
public void consumeError(InputStream pInputStream) throws IOException {
InputStreamReader isr = new InputStreamReader(pInputStream);
BufferedReader reader = new BufferedReader(isr);
String line;
while ((line = reader.readLine()) != null) {
iOutputLines.add(line);
}
if (reader != null) {
reader.close();
}
if (isr != null) {
isr.close();
}
} | void function(InputStream pInputStream) throws IOException { InputStreamReader isr = new InputStreamReader(pInputStream); BufferedReader reader = new BufferedReader(isr); String line; while ((line = reader.readLine()) != null) { iOutputLines.add(line); } if (reader != null) { reader.close(); } if (isr != null) { isr.close(); } } | /**
* Read command Error and save in an internal field.
*/ | Read command Error and save in an internal field | consumeError | {
"repo_name": "ungerik/ephesoft",
"path": "Ephesoft_Community_Release_4.0.2.0/source/dcma-imagemagick/src/main/java/com/ephesoft/dcma/imagemagick/imageClassifier/ArrayListErrorConsumer.java",
"license": "agpl-3.0",
"size": 3615
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader"
]
| import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; | import java.io.*; | [
"java.io"
]
| java.io; | 1,477,306 |
static Node newExpr(Node child) {
return IR.exprResult(child).srcref(child);
} | static Node newExpr(Node child) { return IR.exprResult(child).srcref(child); } | /**
* Creates an EXPR_RESULT.
*
* @param child The expression itself.
* @return Newly created EXPR node with the child as subexpression.
*/ | Creates an EXPR_RESULT | newExpr | {
"repo_name": "robbert/closure-compiler",
"path": "src/com/google/javascript/jscomp/NodeUtil.java",
"license": "apache-2.0",
"size": 114790
} | [
"com.google.javascript.rhino.IR",
"com.google.javascript.rhino.Node"
]
| import com.google.javascript.rhino.IR; import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
]
| com.google.javascript; | 1,808,576 |
@Override
public void debug(Object message, Throwable t) {
logger.log(Level.FINE, String.valueOf(message), t);
} | void function(Object message, Throwable t) { logger.log(Level.FINE, String.valueOf(message), t); } | /**
* Write messages debug level logs and your throwable
*
* @param message Message
* @param t Throwable
*/ | Write messages debug level logs and your throwable | debug | {
"repo_name": "girinoboy/lojacasamento",
"path": "pagseguro-api/src/main/java/br/com/uol/pagseguro/api/utils/logging/SimpleLog.java",
"license": "mit",
"size": 4973
} | [
"java.util.logging.Level"
]
| import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
]
| java.util; | 2,047,635 |
@Test
public final void test() throws Exception {
final TestCaseSetup setup = new TestCaseSetup();
setup.setTimeout(2);
final List<DownloadWorker> downloads = new LinkedList<>();
downloads.add(downloads1 -> {
try {
java.nio.file.Files.copy(this.getClass().getResourceAsStream("run.sh"),
downloads1.resolve("run.sh"));
java.nio.file.Files.copy(this.getClass().getResourceAsStream("program.jar"),
downloads1.resolve("program.jar"));
} catch (final Exception e) {
log.catching(e);
}
});
setup.setStartArgs(new String[0]);
setup.setFrameName("Frame1");
setup.setStartClass("com.phoenix.MyFrame");
setup.setStartupScript("./run.sh");
setup.setDownloads(downloads);
this.exec.setUp(setup);
Assert.assertNotNull(this.exec.env.getFrame());
Assert.assertNotNull(this.exec.env.getRobot());
} | final void function() throws Exception { final TestCaseSetup setup = new TestCaseSetup(); setup.setTimeout(2); final List<DownloadWorker> downloads = new LinkedList<>(); downloads.add(downloads1 -> { try { java.nio.file.Files.copy(this.getClass().getResourceAsStream(STR), downloads1.resolve(STR)); java.nio.file.Files.copy(this.getClass().getResourceAsStream(STR), downloads1.resolve(STR)); } catch (final Exception e) { log.catching(e); } }); setup.setStartArgs(new String[0]); setup.setFrameName(STR); setup.setStartClass(STR); setup.setStartupScript(STR); setup.setDownloads(downloads); this.exec.setUp(setup); Assert.assertNotNull(this.exec.env.getFrame()); Assert.assertNotNull(this.exec.env.getRobot()); } | /**
* Copies to files over and ensures frame is started.
*
* @author nschuste
* @version 1.0.0
* @throws Exception
* @since Feb 23, 2016
*/ | Copies to files over and ensures frame is started | test | {
"repo_name": "Neitsch/Phoenix",
"path": "phoenix-engine/src/test/java/com/phoenix/execution/DefaultTcExecutor_setup_Test.java",
"license": "gpl-2.0",
"size": 3398
} | [
"com.phoenix.to.DownloadWorker",
"com.phoenix.to.TestCaseSetup",
"java.nio.file.Files",
"java.util.LinkedList",
"java.util.List",
"org.junit.Assert"
]
| import com.phoenix.to.DownloadWorker; import com.phoenix.to.TestCaseSetup; import java.nio.file.Files; import java.util.LinkedList; import java.util.List; import org.junit.Assert; | import com.phoenix.to.*; import java.nio.file.*; import java.util.*; import org.junit.*; | [
"com.phoenix.to",
"java.nio",
"java.util",
"org.junit"
]
| com.phoenix.to; java.nio; java.util; org.junit; | 900,259 |
@SuppressWarnings("OptionalGetWithoutIsPresent")
static RetryRule of(Iterable<? extends RetryRule> retryRules) {
requireNonNull(retryRules, "retryRules");
checkArgument(!Iterables.isEmpty(retryRules), "retryRules can't be empty.");
if (Iterables.size(retryRules) == 1) {
return Iterables.get(retryRules, 0);
}
@SuppressWarnings("unchecked")
final Iterable<RetryRule> cast = (Iterable<RetryRule>) retryRules;
return Streams.stream(cast).reduce(RetryRule::orElse).get();
}
/**
* Returns a composed {@link RetryRule} that represents a logical OR of this {@link RetryRule} and another.
* If this {@link RetryRule} completes with {@link RetryDecision#next()}, then other {@link RetryRule} | @SuppressWarnings(STR) static RetryRule of(Iterable<? extends RetryRule> retryRules) { requireNonNull(retryRules, STR); checkArgument(!Iterables.isEmpty(retryRules), STR); if (Iterables.size(retryRules) == 1) { return Iterables.get(retryRules, 0); } @SuppressWarnings(STR) final Iterable<RetryRule> cast = (Iterable<RetryRule>) retryRules; return Streams.stream(cast).reduce(RetryRule::orElse).get(); } /** * Returns a composed {@link RetryRule} that represents a logical OR of this {@link RetryRule} and another. * If this {@link RetryRule} completes with {@link RetryDecision#next()}, then other {@link RetryRule} | /**
* Returns a {@link RetryRule} that combines all the {@link RetryRule} of
* the {@code retryRules}.
*/ | Returns a <code>RetryRule</code> that combines all the <code>RetryRule</code> of the retryRules | of | {
"repo_name": "anuraaga/armeria",
"path": "core/src/main/java/com/linecorp/armeria/client/retry/RetryRule.java",
"license": "apache-2.0",
"size": 11448
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.Iterables",
"com.google.common.collect.Streams",
"java.util.Objects"
]
| import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; import com.google.common.collect.Streams; import java.util.Objects; | import com.google.common.base.*; import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
]
| com.google.common; java.util; | 2,199,544 |
Map<String, List<CandidateGenerator>> getCandidateGenerators() {
return this.generators;
} | Map<String, List<CandidateGenerator>> getCandidateGenerators() { return this.generators; } | /**
* get the candidate generators.
*/ | get the candidate generators | getCandidateGenerators | {
"repo_name": "strapdata/elassandra",
"path": "server/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java",
"license": "apache-2.0",
"size": 33267
} | [
"java.util.List",
"java.util.Map"
]
| import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
]
| java.util; | 1,660,743 |
public void unsetSqueezeServer(SqueezeServer squeezeServer) {
this.squeezeServer.removePlayerEventListener(this);
this.squeezeServer = null;
} | void function(SqueezeServer squeezeServer) { this.squeezeServer.removePlayerEventListener(this); this.squeezeServer = null; } | /**
* Unsetter for Declarative Services.
*
* @param squeezeServer
* Service to remove.
*/ | Unsetter for Declarative Services | unsetSqueezeServer | {
"repo_name": "paulianttila/openhab",
"path": "bundles/binding/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/SqueezeboxBinding.java",
"license": "epl-1.0",
"size": 10436
} | [
"org.openhab.io.squeezeserver.SqueezeServer"
]
| import org.openhab.io.squeezeserver.SqueezeServer; | import org.openhab.io.squeezeserver.*; | [
"org.openhab.io"
]
| org.openhab.io; | 2,749,015 |
protected void addPrimaryKeyNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_ConstraintsType_primaryKeyName_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_ConstraintsType_primaryKeyName_feature", "_UI_ConstraintsType_type"),
DbchangelogPackage.eINSTANCE.getConstraintsType_PrimaryKeyName(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
| void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), DbchangelogPackage.eINSTANCE.getConstraintsType_PrimaryKeyName(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Primary Key Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Primary Key Name feature. | addPrimaryKeyNamePropertyDescriptor | {
"repo_name": "Treehopper/EclipseAugments",
"path": "liquibase-editor/eu.hohenegger.xsd.liquibase.ui/src-gen/org/liquibase/xml/ns/dbchangelog/provider/ConstraintsTypeItemProvider.java",
"license": "epl-1.0",
"size": 19375
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.liquibase.xml.ns.dbchangelog.DbchangelogPackage"
]
| import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.liquibase.xml.ns.dbchangelog.DbchangelogPackage; | import org.eclipse.emf.edit.provider.*; import org.liquibase.xml.ns.dbchangelog.*; | [
"org.eclipse.emf",
"org.liquibase.xml"
]
| org.eclipse.emf; org.liquibase.xml; | 1,165,048 |
public SortType getLibrarySortType(SortType defValue) {
SortType sortType = SortType.fromNumber(prefs.getInt(LIBRARY_SORT_TYPE, -1));
return sortType != null ? sortType : defValue;
} | SortType function(SortType defValue) { SortType sortType = SortType.fromNumber(prefs.getInt(LIBRARY_SORT_TYPE, -1)); return sortType != null ? sortType : defValue; } | /**
* Get library sort type.
* @param defValue The default value to return if nothing is set.
* @return Sort type.
*/ | Get library sort type | getLibrarySortType | {
"repo_name": "bkromhout/Minerva",
"path": "app/src/main/java/com/bkromhout/minerva/Prefs.java",
"license": "apache-2.0",
"size": 14745
} | [
"com.bkromhout.minerva.enums.SortType"
]
| import com.bkromhout.minerva.enums.SortType; | import com.bkromhout.minerva.enums.*; | [
"com.bkromhout.minerva"
]
| com.bkromhout.minerva; | 1,595,411 |
public void logAtDebug(Logger log) {
Collection<String> prefixes = getCommonPrefixes();
Collection<OSSObjectSummary> summaries = getObjectSummaries();
log.debug("Prefix count = {}; object count={}",
prefixes.size(), summaries.size());
for (OSSObjectSummary summary : summaries) {
log.debug("Summary: {} {}", summary.getKey(), summary.getSize());
}
for (String prefix : prefixes) {
log.debug("Prefix: {}", prefix);
}
} | void function(Logger log) { Collection<String> prefixes = getCommonPrefixes(); Collection<OSSObjectSummary> summaries = getObjectSummaries(); log.debug(STR, prefixes.size(), summaries.size()); for (OSSObjectSummary summary : summaries) { log.debug(STR, summary.getKey(), summary.getSize()); } for (String prefix : prefixes) { log.debug(STR, prefix); } } | /**
* Dump the result at debug level.
* @param log log to use
*/ | Dump the result at debug level | logAtDebug | {
"repo_name": "JingchengDu/hadoop",
"path": "hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/OSSListResult.java",
"license": "apache-2.0",
"size": 3183
} | [
"com.aliyun.oss.model.OSSObjectSummary",
"java.util.Collection",
"org.slf4j.Logger"
]
| import com.aliyun.oss.model.OSSObjectSummary; import java.util.Collection; import org.slf4j.Logger; | import com.aliyun.oss.model.*; import java.util.*; import org.slf4j.*; | [
"com.aliyun.oss",
"java.util",
"org.slf4j"
]
| com.aliyun.oss; java.util; org.slf4j; | 1,669,912 |
public RestoreSnapshotRequest settings(String source) {
this.settings = Settings.settingsBuilder().loadFromSource(source).build();
return this;
} | RestoreSnapshotRequest function(String source) { this.settings = Settings.settingsBuilder().loadFromSource(source).build(); return this; } | /**
* Sets repository-specific restore settings in JSON, YAML or properties format
* <p/>
* See repository documentation for more information.
*
* @param source repository-specific snapshot settings
* @return this request
*/ | Sets repository-specific restore settings in JSON, YAML or properties format See repository documentation for more information | settings | {
"repo_name": "mkis-/elasticsearch",
"path": "src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java",
"license": "apache-2.0",
"size": 22635
} | [
"org.elasticsearch.common.settings.Settings"
]
| import org.elasticsearch.common.settings.Settings; | import org.elasticsearch.common.settings.*; | [
"org.elasticsearch.common"
]
| org.elasticsearch.common; | 68,742 |
private FrameNeededResult isFrameNeededForRendering(int index) {
AnimatedDrawableFrameInfo frameInfo = mAnimatedDrawableBackend.getFrameInfo(index);
DisposalMethod disposalMethod = frameInfo.disposalMethod;
if (disposalMethod == DisposalMethod.DISPOSE_DO_NOT) {
// Need this frame so keep going.
return FrameNeededResult.REQUIRED;
} else if (disposalMethod == DisposalMethod.DISPOSE_TO_BACKGROUND) {
if (frameInfo.xOffset == 0 &&
frameInfo.yOffset == 0 &&
frameInfo.width == mAnimatedDrawableBackend.getRenderedWidth() &&
frameInfo.height == mAnimatedDrawableBackend.getRenderedHeight()) {
// The frame covered the whole image and we're disposing to background,
// so we don't even need to draw this frame.
return FrameNeededResult.NOT_REQUIRED;
} else {
// We need to draw the image. Then erase the part the previous frame covered.
// So keep going.
return FrameNeededResult.REQUIRED;
}
} else if (disposalMethod == DisposalMethod.DISPOSE_TO_PREVIOUS) {
return FrameNeededResult.SKIP;
} else {
return FrameNeededResult.ABORT;
}
} | FrameNeededResult function(int index) { AnimatedDrawableFrameInfo frameInfo = mAnimatedDrawableBackend.getFrameInfo(index); DisposalMethod disposalMethod = frameInfo.disposalMethod; if (disposalMethod == DisposalMethod.DISPOSE_DO_NOT) { return FrameNeededResult.REQUIRED; } else if (disposalMethod == DisposalMethod.DISPOSE_TO_BACKGROUND) { if (frameInfo.xOffset == 0 && frameInfo.yOffset == 0 && frameInfo.width == mAnimatedDrawableBackend.getRenderedWidth() && frameInfo.height == mAnimatedDrawableBackend.getRenderedHeight()) { return FrameNeededResult.NOT_REQUIRED; } else { return FrameNeededResult.REQUIRED; } } else if (disposalMethod == DisposalMethod.DISPOSE_TO_PREVIOUS) { return FrameNeededResult.SKIP; } else { return FrameNeededResult.ABORT; } } | /**
* Returns whether the specified frame is needed for rendering the next frame. This is part of
* the compositing logic. See {@link FrameNeededResult} for more info about the results.
*
* @param index the frame to check
* @return whether the frame is required taking into account special conditions
*/ | Returns whether the specified frame is needed for rendering the next frame. This is part of the compositing logic. See <code>FrameNeededResult</code> for more info about the results | isFrameNeededForRendering | {
"repo_name": "MichaelEvans/fresco",
"path": "imagepipeline/src/main/java/com/facebook/imagepipeline/animated/impl/AnimatedImageCompositor.java",
"license": "bsd-3-clause",
"size": 8956
} | [
"com.facebook.imagepipeline.animated.base.AnimatedDrawableFrameInfo"
]
| import com.facebook.imagepipeline.animated.base.AnimatedDrawableFrameInfo; | import com.facebook.imagepipeline.animated.base.*; | [
"com.facebook.imagepipeline"
]
| com.facebook.imagepipeline; | 909,797 |
@Override
public void close() throws IOException {
try {
this.unlock();
} catch (JobLockException e) {
throw new IOException(e);
} finally {
lockEventListeners.remove(this.lockPath);
}
} | void function() throws IOException { try { this.unlock(); } catch (JobLockException e) { throw new IOException(e); } finally { lockEventListeners.remove(this.lockPath); } } | /**
* Closes this stream and releases any system resources associated
* with it. If the stream is already closed then invoking this
* method has no effect.
*
* @throws IOException if an I/O error occurs
*/ | Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect | close | {
"repo_name": "ydai1124/gobblin-1",
"path": "gobblin-runtime/src/main/java/gobblin/runtime/locks/ZookeeperBasedJobLock.java",
"license": "apache-2.0",
"size": 9874
} | [
"java.io.IOException"
]
| import java.io.IOException; | import java.io.*; | [
"java.io"
]
| java.io; | 2,370,510 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
sceneChooser = new javax.swing.JFileChooser();
gizmoButtonGroup = new javax.swing.ButtonGroup();
jToggleButton1 = new javax.swing.JToggleButton();
pnlMainSplitPane = new javax.swing.JSplitPane();
pnlProjectSplit = new javax.swing.JSplitPane();
projectPanel1 = new dae.gui.ProjectPanel();
assetPanel2 = new dae.gui.AssetPanel();
pnlOutputSplit = new javax.swing.JSplitPane();
pnlTabOutputs = new javax.swing.JTabbedPane();
outputPanel1 = new dae.gui.OutputPanel();
pnlToolbarViewport = new javax.swing.JPanel();
pnlViewPort = new javax.swing.JSplitPane();
scrProperties = new javax.swing.JScrollPane();
propertiesPanel1 = new dae.prefabs.ui.PropertiesPanel();
pnlToolbar = new javax.swing.JPanel();
gizmoToolbar = new javax.swing.JToolBar();
btnLink = new javax.swing.JToggleButton();
btnMove = new javax.swing.JToggleButton();
pnlTranslateSpaceChoice = new javax.swing.JPanel();
cboTranslateSpace = new javax.swing.JComboBox();
btnRotate = new javax.swing.JToggleButton();
cboRotateSpace = new javax.swing.JComboBox();
zoomToolbar = new javax.swing.JToolBar();
btnZoomExtents = new javax.swing.JButton();
snapToolbar = new javax.swing.JToolBar();
toggleSnap = new javax.swing.JToggleButton();
toggleAutogrid = new javax.swing.JToggleButton();
brushToolbar = new javax.swing.JToolBar();
btnToggleBrush = new javax.swing.JToggleButton();
cboBrushes = new javax.swing.JComboBox();
playToolbar = new javax.swing.JToolBar();
btnPlay = new javax.swing.JToggleButton();
mnuSandboxMenu = new javax.swing.JMenuBar();
mnuFile = new javax.swing.JMenu();
mnuNewProject = new javax.swing.JMenuItem();
mnuOpenScene = new javax.swing.JMenuItem();
mnuImportScene = new javax.swing.JMenuItem();
openSeparator = new javax.swing.JPopupMenu.Separator();
mnuSaveProject = new javax.swing.JMenuItem();
mnuExit = new javax.swing.JMenuItem();
mnuEdit = new javax.swing.JMenu();
mnuUndo = new javax.swing.JMenuItem();
mnuRedo = new javax.swing.JMenuItem();
jSeparator9 = new javax.swing.JPopupMenu.Separator();
mnuCutAction = new javax.swing.JMenuItem();
mnuPaste = new javax.swing.JMenuItem();
jSeparator10 = new javax.swing.JPopupMenu.Separator();
mnuPreferences = new javax.swing.JMenuItem();
mnuComponents = new javax.swing.JMenu();
mnuAddPhysicsBox = new javax.swing.JMenuItem();
mnuConvexShape = new javax.swing.JMenuItem();
mnuAddCollider = new javax.swing.JMenuItem();
mnuPhysicsTerrain = new javax.swing.JMenuItem();
mnuCharacterController = new javax.swing.JMenuItem();
jSeparator5 = new javax.swing.JPopupMenu.Separator();
mnuAddBoxComponent = new javax.swing.JMenuItem();
mnuAddCylinderComponent = new javax.swing.JMenuItem();
mnuAddSphereComponent = new javax.swing.JMenuItem();
jSeparator8 = new javax.swing.JPopupMenu.Separator();
mnuAddAnimationComponent = new javax.swing.JMenuItem();
mnuAddPath = new javax.swing.JMenuItem();
jSeparator6 = new javax.swing.JPopupMenu.Separator();
mnuAddPersonalityComponent = new javax.swing.JMenuItem();
jSeparator7 = new javax.swing.JPopupMenu.Separator();
mnuRemoveComponent = new javax.swing.JMenuItem();
mnuStandardObjects = new javax.swing.JMenu();
mnuTerrain = new javax.swing.JMenuItem();
mnuCreateTerrainBrush = new javax.swing.JMenuItem();
mnuEntities = new javax.swing.JMenu();
mnuAddCamera = new javax.swing.JMenuItem();
mnuAddSound = new javax.swing.JMenuItem();
mnuAddNPC = new javax.swing.JMenuItem();
mnuAdd = new javax.swing.JMenu();
mnuCreateRig = new javax.swing.JMenuItem();
mnuAddRevoluteJoint = new javax.swing.JMenuItem();
mnuAddFreeJoint = new javax.swing.JMenuItem();
mnuAddTarget = new javax.swing.JMenuItem();
jSeparator4 = new javax.swing.JPopupMenu.Separator();
mnuAddEye = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JPopupMenu.Separator();
mnuAddHandle = new javax.swing.JMenuItem();
mnuAdd2HandleAxis = new javax.swing.JMenuItem();
jMenuItem1 = new javax.swing.JMenuItem();
munAddFootcurve = new javax.swing.JMenuItem();
mnuHandCurve = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JPopupMenu.Separator();
mnuAddCharacterPath = new javax.swing.JMenuItem();
mnuAddWaypoint = new javax.swing.JMenuItem();
mnuLights = new javax.swing.JMenu();
mnuAddAmbientLight = new javax.swing.JMenuItem();
mnuAddSpotLight = new javax.swing.JMenuItem();
mnuAddDirectionalLight = new javax.swing.JMenuItem();
mnuSpotLight = new javax.swing.JMenuItem();
mnuPhysics = new javax.swing.JMenu();
mnuAddCrate = new javax.swing.JMenuItem();
mnuAddSphere = new javax.swing.JMenuItem();
mnuAddCylinder = new javax.swing.JMenuItem();
mnuAddTriggerBox = new javax.swing.JMenuItem();
jSeparator3 = new javax.swing.JPopupMenu.Separator();
mnuAddHingeJoint = new javax.swing.JMenuItem();
mnuMetaData = new javax.swing.JMenu();
mnuAddPivot = new javax.swing.JMenuItem();
mnuHelp = new javax.swing.JMenu();
mnuGettingStarted = new javax.swing.JMenuItem();
sceneChooser.setAcceptAllFileFilterUsed(false);
sceneChooser.setFileFilter(new FileNameExtensionFilter("Sandbox files","zbk"));
jToggleButton1.setText("jToggleButton1"); | @SuppressWarnings(STR) void function() { sceneChooser = new javax.swing.JFileChooser(); gizmoButtonGroup = new javax.swing.ButtonGroup(); jToggleButton1 = new javax.swing.JToggleButton(); pnlMainSplitPane = new javax.swing.JSplitPane(); pnlProjectSplit = new javax.swing.JSplitPane(); projectPanel1 = new dae.gui.ProjectPanel(); assetPanel2 = new dae.gui.AssetPanel(); pnlOutputSplit = new javax.swing.JSplitPane(); pnlTabOutputs = new javax.swing.JTabbedPane(); outputPanel1 = new dae.gui.OutputPanel(); pnlToolbarViewport = new javax.swing.JPanel(); pnlViewPort = new javax.swing.JSplitPane(); scrProperties = new javax.swing.JScrollPane(); propertiesPanel1 = new dae.prefabs.ui.PropertiesPanel(); pnlToolbar = new javax.swing.JPanel(); gizmoToolbar = new javax.swing.JToolBar(); btnLink = new javax.swing.JToggleButton(); btnMove = new javax.swing.JToggleButton(); pnlTranslateSpaceChoice = new javax.swing.JPanel(); cboTranslateSpace = new javax.swing.JComboBox(); btnRotate = new javax.swing.JToggleButton(); cboRotateSpace = new javax.swing.JComboBox(); zoomToolbar = new javax.swing.JToolBar(); btnZoomExtents = new javax.swing.JButton(); snapToolbar = new javax.swing.JToolBar(); toggleSnap = new javax.swing.JToggleButton(); toggleAutogrid = new javax.swing.JToggleButton(); brushToolbar = new javax.swing.JToolBar(); btnToggleBrush = new javax.swing.JToggleButton(); cboBrushes = new javax.swing.JComboBox(); playToolbar = new javax.swing.JToolBar(); btnPlay = new javax.swing.JToggleButton(); mnuSandboxMenu = new javax.swing.JMenuBar(); mnuFile = new javax.swing.JMenu(); mnuNewProject = new javax.swing.JMenuItem(); mnuOpenScene = new javax.swing.JMenuItem(); mnuImportScene = new javax.swing.JMenuItem(); openSeparator = new javax.swing.JPopupMenu.Separator(); mnuSaveProject = new javax.swing.JMenuItem(); mnuExit = new javax.swing.JMenuItem(); mnuEdit = new javax.swing.JMenu(); mnuUndo = new javax.swing.JMenuItem(); mnuRedo = new javax.swing.JMenuItem(); jSeparator9 = new javax.swing.JPopupMenu.Separator(); mnuCutAction = new javax.swing.JMenuItem(); mnuPaste = new javax.swing.JMenuItem(); jSeparator10 = new javax.swing.JPopupMenu.Separator(); mnuPreferences = new javax.swing.JMenuItem(); mnuComponents = new javax.swing.JMenu(); mnuAddPhysicsBox = new javax.swing.JMenuItem(); mnuConvexShape = new javax.swing.JMenuItem(); mnuAddCollider = new javax.swing.JMenuItem(); mnuPhysicsTerrain = new javax.swing.JMenuItem(); mnuCharacterController = new javax.swing.JMenuItem(); jSeparator5 = new javax.swing.JPopupMenu.Separator(); mnuAddBoxComponent = new javax.swing.JMenuItem(); mnuAddCylinderComponent = new javax.swing.JMenuItem(); mnuAddSphereComponent = new javax.swing.JMenuItem(); jSeparator8 = new javax.swing.JPopupMenu.Separator(); mnuAddAnimationComponent = new javax.swing.JMenuItem(); mnuAddPath = new javax.swing.JMenuItem(); jSeparator6 = new javax.swing.JPopupMenu.Separator(); mnuAddPersonalityComponent = new javax.swing.JMenuItem(); jSeparator7 = new javax.swing.JPopupMenu.Separator(); mnuRemoveComponent = new javax.swing.JMenuItem(); mnuStandardObjects = new javax.swing.JMenu(); mnuTerrain = new javax.swing.JMenuItem(); mnuCreateTerrainBrush = new javax.swing.JMenuItem(); mnuEntities = new javax.swing.JMenu(); mnuAddCamera = new javax.swing.JMenuItem(); mnuAddSound = new javax.swing.JMenuItem(); mnuAddNPC = new javax.swing.JMenuItem(); mnuAdd = new javax.swing.JMenu(); mnuCreateRig = new javax.swing.JMenuItem(); mnuAddRevoluteJoint = new javax.swing.JMenuItem(); mnuAddFreeJoint = new javax.swing.JMenuItem(); mnuAddTarget = new javax.swing.JMenuItem(); jSeparator4 = new javax.swing.JPopupMenu.Separator(); mnuAddEye = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); mnuAddHandle = new javax.swing.JMenuItem(); mnuAdd2HandleAxis = new javax.swing.JMenuItem(); jMenuItem1 = new javax.swing.JMenuItem(); munAddFootcurve = new javax.swing.JMenuItem(); mnuHandCurve = new javax.swing.JMenuItem(); jSeparator2 = new javax.swing.JPopupMenu.Separator(); mnuAddCharacterPath = new javax.swing.JMenuItem(); mnuAddWaypoint = new javax.swing.JMenuItem(); mnuLights = new javax.swing.JMenu(); mnuAddAmbientLight = new javax.swing.JMenuItem(); mnuAddSpotLight = new javax.swing.JMenuItem(); mnuAddDirectionalLight = new javax.swing.JMenuItem(); mnuSpotLight = new javax.swing.JMenuItem(); mnuPhysics = new javax.swing.JMenu(); mnuAddCrate = new javax.swing.JMenuItem(); mnuAddSphere = new javax.swing.JMenuItem(); mnuAddCylinder = new javax.swing.JMenuItem(); mnuAddTriggerBox = new javax.swing.JMenuItem(); jSeparator3 = new javax.swing.JPopupMenu.Separator(); mnuAddHingeJoint = new javax.swing.JMenuItem(); mnuMetaData = new javax.swing.JMenu(); mnuAddPivot = new javax.swing.JMenuItem(); mnuHelp = new javax.swing.JMenu(); mnuGettingStarted = new javax.swing.JMenuItem(); sceneChooser.setAcceptAllFileFilterUsed(false); sceneChooser.setFileFilter(new FileNameExtensionFilter(STR,"zbk")); jToggleButton1.setText(STR); | /**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. regenerated by the Form Editor | initComponents | {
"repo_name": "samynk/DArtE",
"path": "src/dae/gui/SandboxFrame.java",
"license": "bsd-2-clause",
"size": 79091
} | [
"javax.swing.JFileChooser",
"javax.swing.JPopupMenu",
"javax.swing.filechooser.FileNameExtensionFilter"
]
| import javax.swing.JFileChooser; import javax.swing.JPopupMenu; import javax.swing.filechooser.FileNameExtensionFilter; | import javax.swing.*; import javax.swing.filechooser.*; | [
"javax.swing"
]
| javax.swing; | 947,481 |
public void setSourceClassName(Class<? extends BusinessObject> sourceClass) {
this.sourceClassName = sourceClass;
} | void function(Class<? extends BusinessObject> sourceClass) { this.sourceClassName = sourceClass; } | /**
* BusinessObject class which should be used for multiple value lookups for this collection.
*/ | BusinessObject class which should be used for multiple value lookups for this collection | setSourceClassName | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-kns/src/main/java/org/kuali/kfs/kns/datadictionary/MaintainableCollectionDefinition.java",
"license": "agpl-3.0",
"size": 13907
} | [
"org.kuali.rice.krad.bo.BusinessObject"
]
| import org.kuali.rice.krad.bo.BusinessObject; | import org.kuali.rice.krad.bo.*; | [
"org.kuali.rice"
]
| org.kuali.rice; | 1,299,626 |
private void addSelectorContent(SerialisationContext pSerialisationContext, PDFSerialiser pSerialiser, EvaluatedNodeInfoItem pEvalNode) {
getNonNullSelectedOptions(pEvalNode).forEach(pSerialiser::addParagraphText);
} | void function(SerialisationContext pSerialisationContext, PDFSerialiser pSerialiser, EvaluatedNodeInfoItem pEvalNode) { getNonNullSelectedOptions(pEvalNode).forEach(pSerialiser::addParagraphText); } | /**
* Adds the selector content text
* @param pSerialisationContext
* @param pSerialiser
* @param pEvalNode
*/ | Adds the selector content text | addSelectorContent | {
"repo_name": "Fivium/FOXopen",
"path": "src/main/java/net/foxopen/fox/module/serialiser/widgets/pdf/SelectorWidgetBuilder.java",
"license": "gpl-3.0",
"size": 2274
} | [
"net.foxopen.fox.module.datanode.EvaluatedNodeInfoItem",
"net.foxopen.fox.module.serialiser.SerialisationContext",
"net.foxopen.fox.module.serialiser.pdf.PDFSerialiser"
]
| import net.foxopen.fox.module.datanode.EvaluatedNodeInfoItem; import net.foxopen.fox.module.serialiser.SerialisationContext; import net.foxopen.fox.module.serialiser.pdf.PDFSerialiser; | import net.foxopen.fox.module.datanode.*; import net.foxopen.fox.module.serialiser.*; import net.foxopen.fox.module.serialiser.pdf.*; | [
"net.foxopen.fox"
]
| net.foxopen.fox; | 2,768,957 |
DocumentNodeState.Children readChildren(@NotNull AbstractDocumentNodeState parent,
@NotNull String name, int limit) {
String queriedName = name;
Path path = parent.getPath();
RevisionVector rev = parent.getLastRevision();
LOG.trace("Reading children for [{}] at rev [{}]", path, rev);
Iterable<NodeDocument> docs;
DocumentNodeState.Children c = new DocumentNodeState.Children();
// add one to the requested limit for the raw limit
// this gives us a chance to detect whether there are more
// child nodes than requested.
int rawLimit = (int) Math.min(Integer.MAX_VALUE, ((long) limit) + 1);
for (;;) {
docs = readChildDocs(path, name, rawLimit);
int numReturned = 0;
for (NodeDocument doc : docs) {
numReturned++;
Path p = doc.getPath();
// remember name of last returned document for
// potential next round of readChildDocs()
name = p.getName();
// filter out deleted children
DocumentNodeState child = getNode(p, rev);
if (child == null) {
continue;
}
if (c.children.size() < limit) {
// add to children until limit is reached
c.children.add(p.getName());
} else {
// enough collected and we know there are more
c.hasMore = true;
return c;
}
}
// if we get here we have less than or equal the requested children
if (numReturned < rawLimit) {
// fewer documents returned than requested
// -> no more documents
c.hasMore = false;
if (queriedName.isEmpty()) {
//we've got to the end of list and we started from the top
//This list is complete and can be sorted
Collections.sort(c.children);
}
return c;
}
}
} | DocumentNodeState.Children readChildren(@NotNull AbstractDocumentNodeState parent, @NotNull String name, int limit) { String queriedName = name; Path path = parent.getPath(); RevisionVector rev = parent.getLastRevision(); LOG.trace(STR, path, rev); Iterable<NodeDocument> docs; DocumentNodeState.Children c = new DocumentNodeState.Children(); int rawLimit = (int) Math.min(Integer.MAX_VALUE, ((long) limit) + 1); for (;;) { docs = readChildDocs(path, name, rawLimit); int numReturned = 0; for (NodeDocument doc : docs) { numReturned++; Path p = doc.getPath(); name = p.getName(); DocumentNodeState child = getNode(p, rev); if (child == null) { continue; } if (c.children.size() < limit) { c.children.add(p.getName()); } else { c.hasMore = true; return c; } } if (numReturned < rawLimit) { c.hasMore = false; if (queriedName.isEmpty()) { Collections.sort(c.children); } return c; } } } | /**
* Read the children of the given parent node state starting at the child
* node with {@code name}. The given {@code name} is exclusive and will not
* appear in the list of children. The returned children are sorted in
* ascending order.
*
* @param parent the parent node.
* @param name the name of the lower bound child node (exclusive) or the
* empty {@code String} if no lower bound is given.
* @param limit the maximum number of child nodes to return.
* @return the children of {@code parent}.
*/ | Read the children of the given parent node state starting at the child node with name. The given name is exclusive and will not appear in the list of children. The returned children are sorted in ascending order | readChildren | {
"repo_name": "stillalex/jackrabbit-oak",
"path": "oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java",
"license": "apache-2.0",
"size": 136761
} | [
"java.util.Collections",
"org.jetbrains.annotations.NotNull"
]
| import java.util.Collections; import org.jetbrains.annotations.NotNull; | import java.util.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.jetbrains.annotations"
]
| java.util; org.jetbrains.annotations; | 538,229 |
public static List <NameValuePair> parse(
final HttpEntity entity) throws IOException {
final ContentType contentType = ContentType.get(entity);
if (contentType == null || !contentType.getMimeType().equalsIgnoreCase(CONTENT_TYPE)) {
return Collections.emptyList();
}
final long len = entity.getContentLength();
Args.check(len <= Integer.MAX_VALUE, "HTTP entity is too large");
final Charset charset = contentType.getCharset() != null ? contentType.getCharset() : HTTP.DEF_CONTENT_CHARSET;
final InputStream instream = entity.getContent();
if (instream == null) {
return Collections.emptyList();
}
final CharArrayBuffer buf;
try {
buf = new CharArrayBuffer(len > 0 ? (int) len : 1024);
final Reader reader = new InputStreamReader(instream, charset);
final char[] tmp = new char[1024];
int l;
while((l = reader.read(tmp)) != -1) {
buf.append(tmp, 0, l);
}
} finally {
instream.close();
}
if (buf.length() == 0) {
return Collections.emptyList();
}
return parse(buf, charset, QP_SEP_A);
} | static List <NameValuePair> function( final HttpEntity entity) throws IOException { final ContentType contentType = ContentType.get(entity); if (contentType == null !contentType.getMimeType().equalsIgnoreCase(CONTENT_TYPE)) { return Collections.emptyList(); } final long len = entity.getContentLength(); Args.check(len <= Integer.MAX_VALUE, STR); final Charset charset = contentType.getCharset() != null ? contentType.getCharset() : HTTP.DEF_CONTENT_CHARSET; final InputStream instream = entity.getContent(); if (instream == null) { return Collections.emptyList(); } final CharArrayBuffer buf; try { buf = new CharArrayBuffer(len > 0 ? (int) len : 1024); final Reader reader = new InputStreamReader(instream, charset); final char[] tmp = new char[1024]; int l; while((l = reader.read(tmp)) != -1) { buf.append(tmp, 0, l); } } finally { instream.close(); } if (buf.length() == 0) { return Collections.emptyList(); } return parse(buf, charset, QP_SEP_A); } | /**
* Returns a list of {@link NameValuePair NameValuePairs} as parsed from an {@link HttpEntity}.
* The encoding is taken from the entity's Content-Encoding header.
* <p>
* This is typically used while parsing an HTTP POST.
*
* @param entity
* The entity to parse
* @return a list of {@link NameValuePair} as built from the URI's query portion.
* @throws IOException
* If there was an exception getting the entity's data.
*/ | Returns a list of <code>NameValuePair NameValuePairs</code> as parsed from an <code>HttpEntity</code>. The encoding is taken from the entity's Content-Encoding header. This is typically used while parsing an HTTP POST | parse | {
"repo_name": "byronka/xenos",
"path": "lib/lib_src/httpcomponents_source/httpcomponents-client-4.4/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java",
"license": "mit",
"size": 25343
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.io.Reader",
"java.nio.charset.Charset",
"java.util.Collections",
"java.util.List",
"org.apache.http.HttpEntity",
"org.apache.http.NameValuePair",
"org.apache.http.entity.ContentType",
"org.apache.http.util.Args",
"org.apache.http.util.CharArrayBuffer"
]
| import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.nio.charset.Charset; import java.util.Collections; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.NameValuePair; import org.apache.http.entity.ContentType; import org.apache.http.util.Args; import org.apache.http.util.CharArrayBuffer; | import java.io.*; import java.nio.charset.*; import java.util.*; import org.apache.http.*; import org.apache.http.entity.*; import org.apache.http.util.*; | [
"java.io",
"java.nio",
"java.util",
"org.apache.http"
]
| java.io; java.nio; java.util; org.apache.http; | 712,794 |
interface WithSecurityPartnerProvider {
WithCreate withSecurityPartnerProvider(SubResource securityPartnerProvider);
} | interface WithSecurityPartnerProvider { WithCreate withSecurityPartnerProvider(SubResource securityPartnerProvider); } | /**
* Specifies securityPartnerProvider.
* @param securityPartnerProvider The securityPartnerProvider associated with this VirtualHub
* @return the next definition stage
*/ | Specifies securityPartnerProvider | withSecurityPartnerProvider | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/network/v2020_06_01/VirtualHub.java",
"license": "mit",
"size": 18946
} | [
"com.microsoft.azure.SubResource"
]
| import com.microsoft.azure.SubResource; | import com.microsoft.azure.*; | [
"com.microsoft.azure"
]
| com.microsoft.azure; | 2,270,242 |
void enterPrimaryExpr(@NotNull GolangParser.PrimaryExprContext ctx);
void exitPrimaryExpr(@NotNull GolangParser.PrimaryExprContext ctx); | void enterPrimaryExpr(@NotNull GolangParser.PrimaryExprContext ctx); void exitPrimaryExpr(@NotNull GolangParser.PrimaryExprContext ctx); | /**
* Exit a parse tree produced by {@link GolangParser#primaryExpr}.
* @param ctx the parse tree
*/ | Exit a parse tree produced by <code>GolangParser#primaryExpr</code> | exitPrimaryExpr | {
"repo_name": "IsThisThePayneResidence/intellidots",
"path": "src/main/java/ua/edu/hneu/ast/parsers/GolangListener.java",
"license": "gpl-3.0",
"size": 35467
} | [
"org.antlr.v4.runtime.misc.NotNull"
]
| import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
]
| org.antlr.v4; | 2,315,706 |
private void doPly(IPly ply) {
game.doPly(ply);
board.doPly(ply);
} | void function(IPly ply) { game.doPly(ply); board.doPly(ply); } | /**
* Perform a ply.
*
* @param ply
* The ply to perform.
*/ | Perform a ply | doPly | {
"repo_name": "warpwe/java-chess",
"path": "src/com/github/warpwe/javachess/test/engine/PlyGeneratorTest12.java",
"license": "gpl-2.0",
"size": 6240
} | [
"com.github.warpwe.javachess.ply.IPly"
]
| import com.github.warpwe.javachess.ply.IPly; | import com.github.warpwe.javachess.ply.*; | [
"com.github.warpwe"
]
| com.github.warpwe; | 1,989,747 |
@Override
public void setQtyReject (java.math.BigDecimal QtyReject)
{
set_Value (COLUMNNAME_QtyReject, QtyReject);
} | void function (java.math.BigDecimal QtyReject) { set_Value (COLUMNNAME_QtyReject, QtyReject); } | /** Set Qty Reject.
@param QtyReject Qty Reject */ | Set Qty Reject | setQtyReject | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/eevolution/model/X_PP_Order_Node.java",
"license": "gpl-2.0",
"size": 43763
} | [
"java.math.BigDecimal"
]
| import java.math.BigDecimal; | import java.math.*; | [
"java.math"
]
| java.math; | 740,224 |
public void append(PathQuery pq) {
update(services.getListService().append(this, pq));
} | void function(PathQuery pq) { update(services.getListService().append(this, pq)); } | /**
* Add new items to the list by resolving the identifiers of objects.
*
* This method will update the size of the list, and clear the items cache.
* @param pq The query to run to find objects with.
**/ | Add new items to the list by resolving the identifiers of objects. This method will update the size of the list, and clear the items cache | append | {
"repo_name": "joshkh/intermine",
"path": "intermine/webservice/client/main/src/org/intermine/webservice/client/lists/ItemList.java",
"license": "lgpl-2.1",
"size": 18291
} | [
"org.intermine.pathquery.PathQuery"
]
| import org.intermine.pathquery.PathQuery; | import org.intermine.pathquery.*; | [
"org.intermine.pathquery"
]
| org.intermine.pathquery; | 45,651 |
public static void maybePropagateUnprocessedThrowableIfInTest() {
if (TestType.isInTest()) {
// Instead of the jvm having been halted, we might have a saved Throwable.
synchronized (LOCK) {
Throwable lastUnprocessedThrowableInTest = unprocessedThrowableInTest;
unprocessedThrowableInTest = null;
if (lastUnprocessedThrowableInTest != null) {
Throwables.throwIfUnchecked(lastUnprocessedThrowableInTest);
throw new RuntimeException(lastUnprocessedThrowableInTest);
}
}
}
} | static void function() { if (TestType.isInTest()) { synchronized (LOCK) { Throwable lastUnprocessedThrowableInTest = unprocessedThrowableInTest; unprocessedThrowableInTest = null; if (lastUnprocessedThrowableInTest != null) { Throwables.throwIfUnchecked(lastUnprocessedThrowableInTest); throw new RuntimeException(lastUnprocessedThrowableInTest); } } } } | /**
* In tests, Runtime#halt is disabled. Thus, the main thread should call this method whenever it
* is about to block on thread completion that might hang because of a failed halt below.
*/ | In tests, Runtime#halt is disabled. Thus, the main thread should call this method whenever it is about to block on thread completion that might hang because of a failed halt below | maybePropagateUnprocessedThrowableIfInTest | {
"repo_name": "akira-baruah/bazel",
"path": "src/main/java/com/google/devtools/build/lib/bugreport/BugReport.java",
"license": "apache-2.0",
"size": 12539
} | [
"com.google.common.base.Throwables",
"com.google.devtools.build.lib.util.TestType"
]
| import com.google.common.base.Throwables; import com.google.devtools.build.lib.util.TestType; | import com.google.common.base.*; import com.google.devtools.build.lib.util.*; | [
"com.google.common",
"com.google.devtools"
]
| com.google.common; com.google.devtools; | 2,727,047 |
public static void unzipFileToDirectory(String fullFilePath, String directoryPath, boolean deleteAfterUnzip) {
// at this point we should have the zip downloaded and on the local filesystem
// now we want to unzip it
try {
ZipFile zf = new ZipFile(fullFilePath);
Enumeration list = zf.entries();
while (list.hasMoreElements()) {
ZipEntry ze = (ZipEntry)list.nextElement();
if (ze.isDirectory()) {
continue;
}
try {
dumpZipEntry(directoryPath, zf, ze);
} catch (IOException e) {
e.printStackTrace();
MesquiteMessage.warnUser("problem dumping zip entry: " + ze.getName());
}
}
// Clean up the zip file once the individual entries have been written out.
File zip = new File(fullFilePath);
if (deleteAfterUnzip && zip.exists()) {
zip.delete();
}
zf.close();
} catch (ZipException e1) {
e1.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
}
}
| static void function(String fullFilePath, String directoryPath, boolean deleteAfterUnzip) { try { ZipFile zf = new ZipFile(fullFilePath); Enumeration list = zf.entries(); while (list.hasMoreElements()) { ZipEntry ze = (ZipEntry)list.nextElement(); if (ze.isDirectory()) { continue; } try { dumpZipEntry(directoryPath, zf, ze); } catch (IOException e) { e.printStackTrace(); MesquiteMessage.warnUser(STR + ze.getName()); } } File zip = new File(fullFilePath); if (deleteAfterUnzip && zip.exists()) { zip.delete(); } zf.close(); } catch (ZipException e1) { e1.printStackTrace(); } catch (IOException e2) { e2.printStackTrace(); } } | /**
* Unzips the zip file at the specified path to the specified directory
* optionally deletes the zip afterwards
* @param fullFilePath The full path to the zip file
* @param directoryPath The path to the directory where things should be unzipped
* @param deleteAfterUnzip Whether to delete the original zip after unzipping
*/ | Unzips the zip file at the specified path to the specified directory optionally deletes the zip afterwards | unzipFileToDirectory | {
"repo_name": "MesquiteProject/MesquiteArchive",
"path": "releases/Mesquite2.7/Mesquite Project/Source/mesquite/lib/ZipUtil.java",
"license": "lgpl-3.0",
"size": 5258
} | [
"java.io.File",
"java.io.IOException",
"java.util.Enumeration",
"java.util.zip.ZipEntry",
"java.util.zip.ZipException",
"java.util.zip.ZipFile"
]
| import java.io.File; import java.io.IOException; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; | import java.io.*; import java.util.*; import java.util.zip.*; | [
"java.io",
"java.util"
]
| java.io; java.util; | 1,825,108 |
private static void processResult(Context context, String title, String text,
String statusText, int result, int iconStatus, String numberOfSuccessfulDownloads,
boolean showDialog) {
if (Utils.isInForeground(context)) {
if (showDialog) {
// start BaseActivity with result
Intent resultIntent = new Intent(context, BaseActivity.class);
resultIntent.putExtra(BaseActivity.EXTRA_APPLYING_RESULT, result);
if (numberOfSuccessfulDownloads != null) {
resultIntent.putExtra(BaseActivity.EXTRA_NUMBER_OF_SUCCESSFUL_DOWNLOADS,
numberOfSuccessfulDownloads);
}
resultIntent.addFlags(Intent.FLAG_FROM_BACKGROUND);
resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(resultIntent);
}
} else {
// show notification
showResultNotification(context, title, text, result, numberOfSuccessfulDownloads);
}
if (numberOfSuccessfulDownloads != null) {
BaseActivity.setStatusBroadcast(context, title, statusText + " "
+ numberOfSuccessfulDownloads, iconStatus);
} else {
BaseActivity.setStatusBroadcast(context, title, statusText, iconStatus);
}
} | static void function(Context context, String title, String text, String statusText, int result, int iconStatus, String numberOfSuccessfulDownloads, boolean showDialog) { if (Utils.isInForeground(context)) { if (showDialog) { Intent resultIntent = new Intent(context, BaseActivity.class); resultIntent.putExtra(BaseActivity.EXTRA_APPLYING_RESULT, result); if (numberOfSuccessfulDownloads != null) { resultIntent.putExtra(BaseActivity.EXTRA_NUMBER_OF_SUCCESSFUL_DOWNLOADS, numberOfSuccessfulDownloads); } resultIntent.addFlags(Intent.FLAG_FROM_BACKGROUND); resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(resultIntent); } } else { showResultNotification(context, title, text, result, numberOfSuccessfulDownloads); } if (numberOfSuccessfulDownloads != null) { BaseActivity.setStatusBroadcast(context, title, statusText + " " + numberOfSuccessfulDownloads, iconStatus); } else { BaseActivity.setStatusBroadcast(context, title, statusText, iconStatus); } } | /**
* Private helper used in showNotificationBasedOnResult
*
* @param context
* @param title
* @param text
* @param statusText
* @param result
* @param iconStatus
* @param numberOfSuccessfulDownloads
* @param showDialog
*/ | Private helper used in showNotificationBasedOnResult | processResult | {
"repo_name": "Hainish/ad-away",
"path": "AdAway/src/main/java/org/adaway/helper/ResultHelper.java",
"license": "gpl-3.0",
"size": 20832
} | [
"android.content.Context",
"android.content.Intent",
"org.adaway.ui.BaseActivity",
"org.adaway.util.Utils"
]
| import android.content.Context; import android.content.Intent; import org.adaway.ui.BaseActivity; import org.adaway.util.Utils; | import android.content.*; import org.adaway.ui.*; import org.adaway.util.*; | [
"android.content",
"org.adaway.ui",
"org.adaway.util"
]
| android.content; org.adaway.ui; org.adaway.util; | 1,152,193 |
public void testDoBody_oneElement() throws Exception {
Debug.println("");
Debug.println("[JUnit:ListGet] List with one element, get element");
// Create a ValueList with one element
ValueList vl = new ValueList();
IntegerValue iv1 = new IntegerValue();
iv1.value = 99;
vl.addValue(iv1);
// Put this list in the inputParameters argument
ParameterValue pv = new ParameterValue();
inputParameters.addValue(pv);
inputParameters.getValue(0).values = vl;
// Specify list element to get as index value 1 (first item in list)
IntegerConversion.insertOneIntegerIntoParameterValueList(1, inputParameters);
// Run get function on list
ListGetFunctionBehaviorExecution obj = new ListGetFunctionBehaviorExecution();
obj.doBody(inputParameters, outputParameters);
// Get the returned Value object
IntegerValue iv2 = (IntegerValue) outputParameters.getValue(0).values.getValue(0);
assertEquals(99, iv2.value);
}
| void function() throws Exception { Debug.println(STR[JUnit:ListGet] List with one element, get element"); ValueList vl = new ValueList(); IntegerValue iv1 = new IntegerValue(); iv1.value = 99; vl.addValue(iv1); ParameterValue pv = new ParameterValue(); inputParameters.addValue(pv); inputParameters.getValue(0).values = vl; IntegerConversion.insertOneIntegerIntoParameterValueList(1, inputParameters); ListGetFunctionBehaviorExecution obj = new ListGetFunctionBehaviorExecution(); obj.doBody(inputParameters, outputParameters); IntegerValue iv2 = (IntegerValue) outputParameters.getValue(0).values.getValue(0); assertEquals(99, iv2.value); } | /**
* Tests the doBody() method in the ListGetFunctionBehaviorExecution
*
* @throws Exception
*/ | Tests the doBody() method in the ListGetFunctionBehaviorExecution | testDoBody_oneElement | {
"repo_name": "moliz/moliz.fuml",
"path": "test/org/modeldriven/fuml/library/listfunctions/ListGetFunctionBehaviorExecutionTest.java",
"license": "epl-1.0",
"size": 7065
} | [
"org.modeldriven.fuml.library.integerfunctions.IntegerConversion"
]
| import org.modeldriven.fuml.library.integerfunctions.IntegerConversion; | import org.modeldriven.fuml.library.integerfunctions.*; | [
"org.modeldriven.fuml"
]
| org.modeldriven.fuml; | 328,868 |
public SearchResults<SearchResult> searchFaceted(Query query); | SearchResults<SearchResult> function(Query query); | /**
* Filter a query by facets. Returns only those results that match the facet.
*
* @param query
* @return A json answer
*/ | Filter a query by facets. Returns only those results that match the facet | searchFaceted | {
"repo_name": "Deutsche-Digitale-Bibliothek/ddb-backend",
"path": "CoreServices/src/main/java/de/fhg/iais/cortex/services/ISearchService.java",
"license": "apache-2.0",
"size": 2197
} | [
"de.fhg.iais.cortex.search.types.Query",
"de.fhg.iais.cortex.search.types.SearchResult",
"de.fhg.iais.cortex.search.types.SearchResults"
]
| import de.fhg.iais.cortex.search.types.Query; import de.fhg.iais.cortex.search.types.SearchResult; import de.fhg.iais.cortex.search.types.SearchResults; | import de.fhg.iais.cortex.search.types.*; | [
"de.fhg.iais"
]
| de.fhg.iais; | 545,345 |
public Map toMap() {
Map map = new HashMap();
map.put("transferid",StringUtils.toString(transferid, eiMetadata.getMeta("transferid")));
map.put("sourceaccount",StringUtils.toString(sourceaccount, eiMetadata.getMeta("sourceaccount")));
map.put("destinationaccount",StringUtils.toString(destinationaccount, eiMetadata.getMeta("destinationaccount")));
map.put("amount",StringUtils.toString(amount, eiMetadata.getMeta("amount")));
map.put("description",StringUtils.toString(description, eiMetadata.getMeta("description")));
return map;
}
| Map function() { Map map = new HashMap(); map.put(STR,StringUtils.toString(transferid, eiMetadata.getMeta(STR))); map.put(STR,StringUtils.toString(sourceaccount, eiMetadata.getMeta(STR))); map.put(STR,StringUtils.toString(destinationaccount, eiMetadata.getMeta(STR))); map.put(STR,StringUtils.toString(amount, eiMetadata.getMeta(STR))); map.put(STR,StringUtils.toString(description, eiMetadata.getMeta(STR))); return map; } | /**
* set the value to Map
*/ | set the value to Map | toMap | {
"repo_name": "stserp/erp1",
"path": "source/src/com/baosight/iplat4j/ee/domain/Transfer.java",
"license": "apache-2.0",
"size": 4469
} | [
"com.baosight.iplat4j.util.StringUtils",
"java.util.HashMap",
"java.util.Map"
]
| import com.baosight.iplat4j.util.StringUtils; import java.util.HashMap; import java.util.Map; | import com.baosight.iplat4j.util.*; import java.util.*; | [
"com.baosight.iplat4j",
"java.util"
]
| com.baosight.iplat4j; java.util; | 1,801,348 |
public static void validateAttrNotFoundInSpec(@Nonnull final ParsedTagSpec parsedTagSpec,
@Nonnull final Context context, @Nonnull final String attrName,
@Nonnull final ValidatorProtos.ValidationResult.Builder result) {
// For now, we just skip data- attributes in the validator, because
// our schema doesn't capture which ones would be ok or not. E.g.
// in practice, some type of ad or perhaps other custom elements require
// particular data attributes.
// http://www.w3.org/TR/html5/single-page.html#attr-data-*
// http://w3c.github.io/aria-in-html/
// However, to avoid parsing differences, we restrict the set of allowed
// characters in the document.
// If explicitAttrsOnly is true then do not allow data- attributes by default.
// They must be explicitly added to the tagSpec.
if (!parsedTagSpec.getSpec().hasExplicitAttrsOnly()
&& (DATA_PATTERN.matcher(attrName).matches())) {
return;
}
// At this point, it's an error either way, but we try to give a
// more specific error in the case of Mustache template characters.
if (attrName.indexOf("{{") != -1) {
List<String> params = new ArrayList<>();
params.add(attrName);
params.add(TagSpecUtils.getTagSpecName(parsedTagSpec.getSpec()));
context.addError(
ValidatorProtos.ValidationError.Code.TEMPLATE_IN_ATTR_NAME,
context.getLineCol(),
params,
context.getRules().getTemplateSpecUrl(), result);
} else {
List<String> params = new ArrayList<>();
params.add(attrName);
params.add(TagSpecUtils.getTagSpecName(parsedTagSpec.getSpec()));
context.addError(
ValidatorProtos.ValidationError.Code.DISALLOWED_ATTR,
context.getLineCol(),
params,
TagSpecUtils.getTagSpecUrl(parsedTagSpec.getSpec()),
result);
}
} | static void function(@Nonnull final ParsedTagSpec parsedTagSpec, @Nonnull final Context context, @Nonnull final String attrName, @Nonnull final ValidatorProtos.ValidationResult.Builder result) { if (!parsedTagSpec.getSpec().hasExplicitAttrsOnly() && (DATA_PATTERN.matcher(attrName).matches())) { return; } if (attrName.indexOf("{{") != -1) { List<String> params = new ArrayList<>(); params.add(attrName); params.add(TagSpecUtils.getTagSpecName(parsedTagSpec.getSpec())); context.addError( ValidatorProtos.ValidationError.Code.TEMPLATE_IN_ATTR_NAME, context.getLineCol(), params, context.getRules().getTemplateSpecUrl(), result); } else { List<String> params = new ArrayList<>(); params.add(attrName); params.add(TagSpecUtils.getTagSpecName(parsedTagSpec.getSpec())); context.addError( ValidatorProtos.ValidationError.Code.DISALLOWED_ATTR, context.getLineCol(), params, TagSpecUtils.getTagSpecUrl(parsedTagSpec.getSpec()), result); } } | /**
* Helper method for validateAttributes, for when an attribute is
* encountered which is not specified by the validator.protoascii
* specification.
*
* @param parsedTagSpec the parsed tag spec.
* @param context the context.
* @param attrName attribute name.
* @param result validation result.
*/ | Helper method for validateAttributes, for when an attribute is encountered which is not specified by the validator.protoascii specification | validateAttrNotFoundInSpec | {
"repo_name": "ampproject/validator-java",
"path": "src/main/java/dev/amp/validator/utils/AttributeSpecUtils.java",
"license": "apache-2.0",
"size": 67199
} | [
"dev.amp.validator.Context",
"dev.amp.validator.ParsedTagSpec",
"dev.amp.validator.ValidatorProtos",
"java.util.ArrayList",
"java.util.List",
"javax.annotation.Nonnull"
]
| import dev.amp.validator.Context; import dev.amp.validator.ParsedTagSpec; import dev.amp.validator.ValidatorProtos; import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; | import dev.amp.validator.*; import java.util.*; import javax.annotation.*; | [
"dev.amp.validator",
"java.util",
"javax.annotation"
]
| dev.amp.validator; java.util; javax.annotation; | 2,196,529 |
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeByte(this.field_194314_a);
buf.writeVarInt(CraftingManager.getIDForRecipe(this.field_194315_b));
} | void function(PacketBuffer buf) throws IOException { buf.writeByte(this.field_194314_a); buf.writeVarInt(CraftingManager.getIDForRecipe(this.field_194315_b)); } | /**
* Writes the raw packet data to the data stream.
*/ | Writes the raw packet data to the data stream | writePacketData | {
"repo_name": "Severed-Infinity/technium",
"path": "build/tmp/recompileMc/sources/net/minecraft/network/play/server/SPacketPlaceGhostRecipe.java",
"license": "gpl-3.0",
"size": 1734
} | [
"java.io.IOException",
"net.minecraft.item.crafting.CraftingManager",
"net.minecraft.network.PacketBuffer"
]
| import java.io.IOException; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.network.PacketBuffer; | import java.io.*; import net.minecraft.item.crafting.*; import net.minecraft.network.*; | [
"java.io",
"net.minecraft.item",
"net.minecraft.network"
]
| java.io; net.minecraft.item; net.minecraft.network; | 354,233 |
public void value(
@NotNull final LongField field, @NotNull final String value, final boolean escape)
{
addValue(field, value, escape);
} | void function( @NotNull final LongField field, @NotNull final String value, final boolean escape) { addValue(field, value, escape); } | /**
* Specifies the keyword of a field.
* @param field the field.
* @param value the value.
* @param escape to forcing value escaping or not.
*/ | Specifies the keyword of a field | value | {
"repo_name": "rydnr/queryj-sql",
"path": "src/main/java/org/acmsl/queryj/sql/InsertQuery.java",
"license": "gpl-3.0",
"size": 10673
} | [
"org.jetbrains.annotations.NotNull"
]
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
]
| org.jetbrains.annotations; | 1,531,964 |
public static void streamToFile(final InputStream inputStream, final String outputFileName) {
streamToFile(inputStream, Paths.get(outputFileName));
} | static void function(final InputStream inputStream, final String outputFileName) { streamToFile(inputStream, Paths.get(outputFileName)); } | /**
* Take a stream to a file.
*
* @param inputStream to read and close
* @param outputFileName to (over)write and close
*/ | Take a stream to a file | streamToFile | {
"repo_name": "gchq/stroom",
"path": "stroom-legacy/stroom-legacy-model_6_1/src/main/java/stroom/legacy/model_6_1/StreamUtil.java",
"license": "apache-2.0",
"size": 13406
} | [
"java.io.InputStream",
"java.nio.file.Paths"
]
| import java.io.InputStream; import java.nio.file.Paths; | import java.io.*; import java.nio.file.*; | [
"java.io",
"java.nio"
]
| java.io; java.nio; | 492,212 |
public void setDefaultChar(String v)
{
if (!ObjectUtils.equals(this.defaultChar, v))
{
this.defaultChar = v;
setModified(true);
}
} | void function(String v) { if (!ObjectUtils.equals(this.defaultChar, v)) { this.defaultChar = v; setModified(true); } } | /**
* Set the value of DefaultChar
*
* @param v new value
*/ | Set the value of DefaultChar | setDefaultChar | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/BaseTTextBoxSettings.java",
"license": "gpl-3.0",
"size": 59636
} | [
"org.apache.commons.lang.ObjectUtils"
]
| import org.apache.commons.lang.ObjectUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
]
| org.apache.commons; | 2,001,103 |
private void restore(CmsObject cms, CmsResource resource, CmsShellReport report) throws Exception {
String resName = cms.getRequestContext().getSitePath(resource);
// restore the first historical resource
cms.importResource(resName, resource, "import".getBytes(), null);
List historicalVersions = cms.readAllAvailableVersions(resName);
I_CmsHistoryResource history = (I_CmsHistoryResource)historicalVersions.get(historicalVersions.size() - 1);
cms.restoreResourceVersion(history.getStructureId(), history.getVersion());
cms.unlockResource(resName);
OpenCms.getPublishManager().publishResource(cms, resName, true, report);
OpenCms.getPublishManager().waitWhileRunning();
cms.lockResource(resName);
} | void function(CmsObject cms, CmsResource resource, CmsShellReport report) throws Exception { String resName = cms.getRequestContext().getSitePath(resource); cms.importResource(resName, resource, STR.getBytes(), null); List historicalVersions = cms.readAllAvailableVersions(resName); I_CmsHistoryResource history = (I_CmsHistoryResource)historicalVersions.get(historicalVersions.size() - 1); cms.restoreResourceVersion(history.getStructureId(), history.getVersion()); cms.unlockResource(resName); OpenCms.getPublishManager().publishResource(cms, resName, true, report); OpenCms.getPublishManager().waitWhileRunning(); cms.lockResource(resName); } | /**
* Restores the first version of a resource.<p>
*
* @param cms the cms context
* @param resource the resource
* @param report the report
*
* @throws Exception if something goes wrong
*/ | Restores the first version of a resource | restore | {
"repo_name": "it-tavis/opencms-core",
"path": "test/org/opencms/file/TestLinkValidation.java",
"license": "lgpl-2.1",
"size": 44295
} | [
"java.util.List",
"org.opencms.main.OpenCms",
"org.opencms.report.CmsShellReport"
]
| import java.util.List; import org.opencms.main.OpenCms; import org.opencms.report.CmsShellReport; | import java.util.*; import org.opencms.main.*; import org.opencms.report.*; | [
"java.util",
"org.opencms.main",
"org.opencms.report"
]
| java.util; org.opencms.main; org.opencms.report; | 1,461,942 |
public ServiceResponse<A> getDefaultModelA400None() throws MyException, IOException {
Call<ResponseBody> call = service.getDefaultModelA400None();
return getDefaultModelA400NoneDelegate(call.execute());
} | ServiceResponse<A> function() throws MyException, IOException { Call<ResponseBody> call = service.getDefaultModelA400None(); return getDefaultModelA400NoneDelegate(call.execute()); } | /**
* Send a 400 response with no payload.
*
* @throws MyException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the A object wrapped in {@link ServiceResponse} if successful.
*/ | Send a 400 response with no payload | getDefaultModelA400None | {
"repo_name": "John-Hart/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/http/implementation/MultipleResponsesImpl.java",
"license": "mit",
"size": 84047
} | [
"com.microsoft.rest.ServiceResponse",
"java.io.IOException"
]
| import com.microsoft.rest.ServiceResponse; import java.io.IOException; | import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.rest",
"java.io"
]
| com.microsoft.rest; java.io; | 120,860 |
Matcher matcher = sLogHeaderPattern.matcher(line);
if (!matcher.matches()) {
return null;
}
int pid = -1;
try {
pid = Integer.parseInt(matcher.group(2));
} catch (NumberFormatException ignored) {
}
int tid = -1;
try {
// Thread id's may be in hex on some platforms.
// Decode and store them in radix 10.
tid = Integer.decode(matcher.group(3));
} catch (NumberFormatException ignored) {
}
if (pkgName == null || pkgName.isEmpty()) {
pkgName = "?";
}
LogLevel logLevel = LogLevel.getByLetterString(matcher.group(4));
if (logLevel == null && matcher.group(4).equals("F")) {
logLevel = LogLevel.ASSERT;
}
if (logLevel == null) {
// Should never happen but warn seems like a decent default just in case
logLevel = LogLevel.WARN;
}
mPrevHeader = new LogCatHeader(logLevel, pid, tid, pkgName,
matcher.group(5), LogCatTimestamp.fromString(matcher.group(1)));
return mPrevHeader;
}
| Matcher matcher = sLogHeaderPattern.matcher(line); if (!matcher.matches()) { return null; } int pid = -1; try { pid = Integer.parseInt(matcher.group(2)); } catch (NumberFormatException ignored) { } int tid = -1; try { tid = Integer.decode(matcher.group(3)); } catch (NumberFormatException ignored) { } if (pkgName == null pkgName.isEmpty()) { pkgName = "?"; } LogLevel logLevel = LogLevel.getByLetterString(matcher.group(4)); if (logLevel == null && matcher.group(4).equals("F")) { logLevel = LogLevel.ASSERT; } if (logLevel == null) { logLevel = LogLevel.WARN; } mPrevHeader = new LogCatHeader(logLevel, pid, tid, pkgName, matcher.group(5), LogCatTimestamp.fromString(matcher.group(1))); return mPrevHeader; } | /**
* Parse a header line into a {@link LogCatHeader} object, or {@code null} if the input line
* doesn't match the expected format.
*
* @param line raw text that should be the header line from logcat -v long
* @return a {@link LogCatHeader} which represents the passed in text
*/ | Parse a header line into a <code>LogCatHeader</code> object, or null if the input line doesn't match the expected format | processLogHeader | {
"repo_name": "nsavageJVM/logcat-utls",
"path": "as-includes/src/main/java/com/android/ddmlib/LogCatMessageParser.java",
"license": "bsd-2-clause",
"size": 4630
} | [
"java.util.regex.Matcher"
]
| import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
]
| java.util; | 1,801,744 |
public User findUserByUsername(User userRegistration) throws Exception;
| User function(User userRegistration) throws Exception; | /**
* Permette di cercare un utente partendo dal suo username.
*
* @param userFind contiene l'username dell'utente da cercare
* @return l'utente cercato se è stato trovato, null altrimenti
* @throws Exception
*/ | Permette di cercare un utente partendo dal suo username | findUserByUsername | {
"repo_name": "MDaino/Seq",
"path": "src/main/java/com/sequenziatore/server/databaseutil/dao/IDAOUserData.java",
"license": "apache-2.0",
"size": 2516
} | [
"com.sequenziatore.server.entity.User"
]
| import com.sequenziatore.server.entity.User; | import com.sequenziatore.server.entity.*; | [
"com.sequenziatore.server"
]
| com.sequenziatore.server; | 2,552,853 |
final SourceStreamTask<String, SourceFunction<String>, StreamSource<String, SourceFunction<String>>> sourceTask = new SourceStreamTask<>();
final StreamTaskTestHarness<String> testHarness = new StreamTaskTestHarness<String>(sourceTask, BasicTypeInfo.STRING_TYPE_INFO);
testHarness.setupOutputForSingletonOperatorChain();
StreamConfig streamConfig = testHarness.getStreamConfig();
StreamSource<String, ?> sourceOperator = new StreamSource<>(new OpenCloseTestSource());
streamConfig.setStreamOperator(sourceOperator);
streamConfig.setOperatorID(new OperatorID());
testHarness.invoke();
testHarness.waitForTaskCompletion();
Assert.assertTrue("RichFunction methods where not called.", OpenCloseTestSource.closeCalled);
List<String> resultElements = TestHarnessUtil.getRawElementsFromOutput(testHarness.getOutput());
Assert.assertEquals(10, resultElements.size());
} | final SourceStreamTask<String, SourceFunction<String>, StreamSource<String, SourceFunction<String>>> sourceTask = new SourceStreamTask<>(); final StreamTaskTestHarness<String> testHarness = new StreamTaskTestHarness<String>(sourceTask, BasicTypeInfo.STRING_TYPE_INFO); testHarness.setupOutputForSingletonOperatorChain(); StreamConfig streamConfig = testHarness.getStreamConfig(); StreamSource<String, ?> sourceOperator = new StreamSource<>(new OpenCloseTestSource()); streamConfig.setStreamOperator(sourceOperator); streamConfig.setOperatorID(new OperatorID()); testHarness.invoke(); testHarness.waitForTaskCompletion(); Assert.assertTrue(STR, OpenCloseTestSource.closeCalled); List<String> resultElements = TestHarnessUtil.getRawElementsFromOutput(testHarness.getOutput()); Assert.assertEquals(10, resultElements.size()); } | /**
* This test verifies that open() and close() are correctly called by the StreamTask.
*/ | This test verifies that open() and close() are correctly called by the StreamTask | testOpenClose | {
"repo_name": "zimmermatt/flink",
"path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java",
"license": "apache-2.0",
"size": 10085
} | [
"java.util.List",
"org.apache.flink.api.common.typeinfo.BasicTypeInfo",
"org.apache.flink.runtime.jobgraph.OperatorID",
"org.apache.flink.streaming.api.functions.source.SourceFunction",
"org.apache.flink.streaming.api.graph.StreamConfig",
"org.apache.flink.streaming.api.operators.StreamSource",
"org.apache.flink.streaming.util.TestHarnessUtil",
"org.junit.Assert"
]
| import java.util.List; import org.apache.flink.api.common.typeinfo.BasicTypeInfo; import org.apache.flink.runtime.jobgraph.OperatorID; import org.apache.flink.streaming.api.functions.source.SourceFunction; import org.apache.flink.streaming.api.graph.StreamConfig; import org.apache.flink.streaming.api.operators.StreamSource; import org.apache.flink.streaming.util.TestHarnessUtil; import org.junit.Assert; | import java.util.*; import org.apache.flink.api.common.typeinfo.*; import org.apache.flink.runtime.jobgraph.*; import org.apache.flink.streaming.api.functions.source.*; import org.apache.flink.streaming.api.graph.*; import org.apache.flink.streaming.api.operators.*; import org.apache.flink.streaming.util.*; import org.junit.*; | [
"java.util",
"org.apache.flink",
"org.junit"
]
| java.util; org.apache.flink; org.junit; | 131,267 |
protected Schema getFixedSchema(Object fixed) {
return ((GenericContainer)fixed).getSchema();
} | Schema function(Object fixed) { return ((GenericContainer)fixed).getSchema(); } | /** Called to obtain the schema of a fixed. By default calls
* {GenericContainer#getSchema(). May be overridden for alternate fixed
* representations. */ | Called to obtain the schema of a fixed. By default calls {GenericContainer#getSchema(). May be overridden for alternate fixed | getFixedSchema | {
"repo_name": "Asana/mypipe",
"path": "avro/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java",
"license": "apache-2.0",
"size": 36276
} | [
"org.apache.avro.Schema"
]
| import org.apache.avro.Schema; | import org.apache.avro.*; | [
"org.apache.avro"
]
| org.apache.avro; | 1,682,489 |
public EDataType getVoltagePerReactivePower() {
if (voltagePerReactivePowerEDataType == null) {
voltagePerReactivePowerEDataType = (EDataType)EPackage.Registry.INSTANCE.getEPackage(DomainPackage.eNS_URI).getEClassifiers().get(37);
}
return voltagePerReactivePowerEDataType;
} | EDataType function() { if (voltagePerReactivePowerEDataType == null) { voltagePerReactivePowerEDataType = (EDataType)EPackage.Registry.INSTANCE.getEPackage(DomainPackage.eNS_URI).getEClassifiers().get(37); } return voltagePerReactivePowerEDataType; } | /**
* Returns the meta object for data type '<em>Voltage Per Reactive Power</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for data type '<em>Voltage Per Reactive Power</em>'.
* @generated
*/ | Returns the meta object for data type 'Voltage Per Reactive Power'. | getVoltagePerReactivePower | {
"repo_name": "SES-fortiss/SmartGridCoSimulation",
"path": "core/cim15/src/CIM15/IEC61970/Domain/DomainPackage.java",
"license": "apache-2.0",
"size": 81342
} | [
"org.eclipse.emf.ecore.EDataType",
"org.eclipse.emf.ecore.EPackage"
]
| import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EPackage; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
]
| org.eclipse.emf; | 599,606 |
public void requireNonFinalFieldAssignment(final IConstruct site,
final IField field)
{
if (Modifier.isFinal(field.getModifiers()) == false)
{
return; // OK
}
final ErrorCode ERROR_CODE = ErrorCode.ASSIGNMENT_TO_READONLY;
final String MESSAGE = "A value cannot be assigned to a final field.";
final ErrorReport report = new ErrorReport(site, ERROR_CODE, MESSAGE);
final String dot = Modifier.isStatic(field.getModifiers()) ? "::" : ".";
report.addDetail("Field", Utils.simpleName(field.getOwner()) + dot + field.getName());
report(report);
} | void function(final IConstruct site, final IField field) { if (Modifier.isFinal(field.getModifiers()) == false) { return; } final ErrorCode ERROR_CODE = ErrorCode.ASSIGNMENT_TO_READONLY; final String MESSAGE = STR; final ErrorReport report = new ErrorReport(site, ERROR_CODE, MESSAGE); final String dot = Modifier.isStatic(field.getModifiers()) ? "::" : "."; report.addDetail("Field", Utils.simpleName(field.getOwner()) + dot + field.getName()); report(report); } | /**
* This method reports that an assignment is not to a readonly field.
*
* @param site is the construct that is performing the assignment.
* @param field is the field being assigned to.
*/ | This method reports that an assignment is not to a readonly field | requireNonFinalFieldAssignment | {
"repo_name": "Mackenzie-High/autumn",
"path": "src/high/mackenzie/autumn/lang/compiler/compilers/StaticChecker.java",
"license": "apache-2.0",
"size": 58827
} | [
"java.lang.reflect.Modifier"
]
| import java.lang.reflect.Modifier; | import java.lang.reflect.*; | [
"java.lang"
]
| java.lang; | 1,938,223 |
public SetAccessControlRecursiveResponse setFailedEntries(List<AclFailedEntry> failedEntries) {
this.failedEntries = failedEntries;
return this;
} | SetAccessControlRecursiveResponse function(List<AclFailedEntry> failedEntries) { this.failedEntries = failedEntries; return this; } | /**
* Set the failedEntries property: The failedEntries property.
*
* @param failedEntries the failedEntries value to set.
* @return the SetAccessControlRecursiveResponse object itself.
*/ | Set the failedEntries property: The failedEntries property | setFailedEntries | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/models/SetAccessControlRecursiveResponse.java",
"license": "mit",
"size": 3701
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 7,653 |
public void deleteShaderSource(ShaderSource source); | void function(ShaderSource source); | /**
* Deletes the provided shader source.
*
* @param source The ShaderSource to delete.
*/ | Deletes the provided shader source | deleteShaderSource | {
"repo_name": "PlanetWaves/clockworkengine",
"path": "branches/3.0/engine/src/core/com/clockwork/renderer/Renderer.java",
"license": "apache-2.0",
"size": 9112
} | [
"com.clockwork.shader.Shader"
]
| import com.clockwork.shader.Shader; | import com.clockwork.shader.*; | [
"com.clockwork.shader"
]
| com.clockwork.shader; | 1,942,828 |
return this.azureClient;
}
private AzureRegions azureRegion; | return this.azureClient; } private AzureRegions azureRegion; | /**
* Gets the {@link AzureClient} used for long running operations.
* @return the azure client;
*/ | Gets the <code>AzureClient</code> used for long running operations | getAzureClient | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cognitiveservices/ms-azure-cs-faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceAPIImpl.java",
"license": "mit",
"size": 7945
} | [
"com.microsoft.azure.cognitiveservices.vision.faceapi.models.AzureRegions"
]
| import com.microsoft.azure.cognitiveservices.vision.faceapi.models.AzureRegions; | import com.microsoft.azure.cognitiveservices.vision.faceapi.models.*; | [
"com.microsoft.azure"
]
| com.microsoft.azure; | 1,421,333 |
Element getXblShadowTree(); | Element getXblShadowTree(); | /**
* Get the shadow tree of this node.
*/ | Get the shadow tree of this node | getXblShadowTree | {
"repo_name": "shyamalschandra/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/dom/xbl/NodeXBL.java",
"license": "apache-2.0",
"size": 2930
} | [
"org.w3c.dom.Element"
]
| import org.w3c.dom.Element; | import org.w3c.dom.*; | [
"org.w3c.dom"
]
| org.w3c.dom; | 2,068,165 |
public static void printTable(final String tableName, final AccumuloRdfConfiguration config, final IteratorSetting... settings) throws IOException {
printTable(tableName, config, true, settings);
} | static void function(final String tableName, final AccumuloRdfConfiguration config, final IteratorSetting... settings) throws IOException { printTable(tableName, config, true, settings); } | /**
* Prints the table with the specified config and additional settings.
* This applies common iterator settings to the table scanner that ignore internal metadata keys.
* @param tableName the name of the table to print.
* @param config the {@link AccumuloRdfConfiguration}.
* @param settings the additional {@link IteratorSetting}s to add besides the common ones.
* @throws IOException
*/ | Prints the table with the specified config and additional settings. This applies common iterator settings to the table scanner that ignore internal metadata keys | printTable | {
"repo_name": "kchilton2/incubator-rya",
"path": "extras/rya.export/export.accumulo/src/main/java/org/apache/rya/export/accumulo/util/AccumuloRyaUtils.java",
"license": "apache-2.0",
"size": 21731
} | [
"java.io.IOException",
"org.apache.accumulo.core.client.IteratorSetting",
"org.apache.rya.accumulo.AccumuloRdfConfiguration"
]
| import java.io.IOException; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.rya.accumulo.AccumuloRdfConfiguration; | import java.io.*; import org.apache.accumulo.core.client.*; import org.apache.rya.accumulo.*; | [
"java.io",
"org.apache.accumulo",
"org.apache.rya"
]
| java.io; org.apache.accumulo; org.apache.rya; | 2,246,324 |
public Control cloneForSpatial(Spatial spatial) {
MotionTrack control = new MotionTrack(spatial, path);
control.playState = playState;
control.currentWayPoint = currentWayPoint;
control.currentValue = currentValue;
control.direction = direction.clone();
control.lookAt = lookAt.clone();
control.upVector = upVector.clone();
control.rotation = rotation.clone();
control.initialDuration = initialDuration;
control.speed = speed;
control.loopMode = loopMode;
control.directionType = directionType;
return control;
} | Control function(Spatial spatial) { MotionTrack control = new MotionTrack(spatial, path); control.playState = playState; control.currentWayPoint = currentWayPoint; control.currentValue = currentValue; control.direction = direction.clone(); control.lookAt = lookAt.clone(); control.upVector = upVector.clone(); control.rotation = rotation.clone(); control.initialDuration = initialDuration; control.speed = speed; control.loopMode = loopMode; control.directionType = directionType; return control; } | /**
* Clone this control for the given spatial
* @param spatial
* @return
*/ | Clone this control for the given spatial | cloneForSpatial | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "external/jmonkeyengine/engine/src/core/com/jme3/cinematic/events/MotionTrack.java",
"license": "gpl-2.0",
"size": 13022
} | [
"com.jme3.scene.Spatial",
"com.jme3.scene.control.Control"
]
| import com.jme3.scene.Spatial; import com.jme3.scene.control.Control; | import com.jme3.scene.*; import com.jme3.scene.control.*; | [
"com.jme3.scene"
]
| com.jme3.scene; | 2,843,910 |
public static boolean booleanValue(Map<String,?> map, String key, boolean defaultValue) {
Object obj = map.get(key);
if (obj == null) {
return defaultValue;
} else if (obj instanceof Boolean) {
Boolean value = (Boolean)obj;
return value.booleanValue();
}
else {
String text = obj.toString();
return Boolean.parseBoolean(text);
}
} | static boolean function(Map<String,?> map, String key, boolean defaultValue) { Object obj = map.get(key); if (obj == null) { return defaultValue; } else if (obj instanceof Boolean) { Boolean value = (Boolean)obj; return value.booleanValue(); } else { String text = obj.toString(); return Boolean.parseBoolean(text); } } | /**
* Returns the boolean value of the given property in the map or returns the default value if its not present
*/ | Returns the boolean value of the given property in the map or returns the default value if its not present | booleanValue | {
"repo_name": "janstey/fuse",
"path": "common-util/src/main/java/org/fusesource/common/util/Maps.java",
"license": "apache-2.0",
"size": 3241
} | [
"java.util.Map"
]
| import java.util.Map; | import java.util.*; | [
"java.util"
]
| java.util; | 1,959,701 |
private HashMap<String, String> parseHisUpdates(BufferedReader buffer)
throws TextFileExtractionException {
String textLine = "";
HashMap<String, String> hisUpdates=null;
// testLogger.info("... Parsing text data update section ...");
try { // parse line for initial "gggg,eeee" or "gggg,eeee gggg,eeee" tags
do {
textLine = this.getNextTextLine(buffer);
} while(!(textLine.startsWith("$$BEGIN HIS UPDATE")));
}
catch(TextFileExtractionException tfee) { // catch all
logger.info("Warning: NO HIS Update section in text data !!!");
logger.debug("Warning: obsolete TXT format NO VistA updates !!! ");
return hisUpdates;
}
textLine = this.getNextTextLine(buffer); // skip to first HIS update line
hisUpdates=new HashMap<String, String>();
while(!(textLine.startsWith("$$END HIS UPDATE"))) {
try { // parse line for initial "gggg,eeee" or "gggg,eeee gggg,eeee" tags
// and ending text value
String splitPipePattern = "\\|";
Pattern pFields = Pattern.compile(splitPipePattern);
String fields[] = new String[4];
fields = pFields.split(textLine);
if ( ((fields[0].length()==9) || (fields[0].length()==18)) &&
(fields[3].length()>0)) {
// place tag(s)-value pairs to HashMap
hisUpdates.put(fields[0], fields[3]);
}
}
catch(Throwable t) { // catch all
}
textLine = this.getNextTextLine(buffer);
} // end wile
if (hisUpdates.isEmpty())
return null;
else
return hisUpdates;
} | HashMap<String, String> function(BufferedReader buffer) throws TextFileExtractionException { String textLine = STR$$BEGIN HIS UPDATESTRWarning: NO HIS Update section in text data !!!STRWarning: obsolete TXT format NO VistA updates !!! STR$$END HIS UPDATESTR\\ "; Pattern pFields = Pattern.compile(splitPipePattern); String fields[] = new String[4]; fields = pFields.split(textLine); if ( ((fields[0].length()==9) (fields[0].length()==18)) && (fields[3].length()>0)) { hisUpdates.put(fields[0], fields[3]); } } catch(Throwable t) { } textLine = this.getNextTextLine(buffer); } if (hisUpdates.isEmpty()) return null; else return hisUpdates; } | /**
* Parse the Text file HIS Update section. The Text file is made up of three sections,
* "Data1", "DICOM Data" and optionally "HIS UPDATE". Here only the HIS UPDATE section
* is read and decoded.
*
* @param buffer represents the Text file now in the form of a BufferReader object.
* @throws TextFileExtractionException
*/ | Parse the Text file HIS Update section. The Text file is made up of three sections, "Data1", "DICOM Data" and optionally "HIS UPDATE". Here only the HIS UPDATE section is read and decoded | parseHisUpdates | {
"repo_name": "VHAINNOVATIONS/Telepathology",
"path": "Source/Java/ImagingDicomDCFUtilities/src/java/gov/va/med/imaging/dicom/dcftoolkit/utilities/reconstitution/LegacyTextFileParser.java",
"license": "apache-2.0",
"size": 50426
} | [
"gov.va.med.imaging.exceptions.TextFileExtractionException",
"java.io.BufferedReader",
"java.util.HashMap",
"java.util.regex.Pattern"
]
| import gov.va.med.imaging.exceptions.TextFileExtractionException; import java.io.BufferedReader; import java.util.HashMap; import java.util.regex.Pattern; | import gov.va.med.imaging.exceptions.*; import java.io.*; import java.util.*; import java.util.regex.*; | [
"gov.va.med",
"java.io",
"java.util"
]
| gov.va.med; java.io; java.util; | 2,141,090 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.