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 List<NameValuePair> values() { return this.values; }
List<NameValuePair> function() { return this.values; }
/** * Get the values value. * * @return the values value */
Get the values value
values
{ "repo_name": "pomortaz/azure-sdk-for-java", "path": "azure-batch/src/main/java/com/microsoft/azure/batch/protocol/models/ResizeError.java", "license": "mit", "size": 2068 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
431,892
@Nonnull Context setUser(@Nullable Object user);
@Nonnull Context setUser(@Nullable Object user);
/** * Set current user. * * @param user Current user. * @return This context. */
Set current user
setUser
{ "repo_name": "jooby-project/jooby", "path": "jooby/src/main/java/io/jooby/Context.java", "license": "apache-2.0", "size": 41138 }
[ "javax.annotation.Nonnull", "javax.annotation.Nullable" ]
import javax.annotation.Nonnull; import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,850,234
private static String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) { return model; } else { return manufacturer + StringUtils.SPACE + model; } }
static String function() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) { return model; } else { return manufacturer + StringUtils.SPACE + model; } }
/** * Forked from http://stackoverflow.com/a/12707479 */
Forked from HREF
getDeviceName
{ "repo_name": "floating-cat/S1-Next", "path": "app/src/main/java/cl/monsoon/s1next/util/DeviceUtil.java", "license": "unlicense", "size": 1049 }
[ "android.os.Build", "org.apache.commons.lang3.StringUtils" ]
import android.os.Build; import org.apache.commons.lang3.StringUtils;
import android.os.*; import org.apache.commons.lang3.*;
[ "android.os", "org.apache.commons" ]
android.os; org.apache.commons;
1,024,178
private static void executeForNonServiceFailure(final ModelControllerClient client, final ModelNode operation) { try { final ModelNode result = client.execute(operation); if (! result.hasDefined("outcome") && ! ModelDescriptionConstants.FAILED.equals(result.get("outcome").asString())) { Assert.fail("Operation outcome is " + result.get("outcome").asString()); } System.out.println("Failure for " + operation + "\n is:\n" + result); Assert.assertFalse(result.toString(), result.get(ModelDescriptionConstants.FAILURE_DESCRIPTION).toString().contains(ControllerLogger.MGMT_OP_LOGGER.failedServices())); } catch (IOException e) { throw new RuntimeException(e); } }
static void function(final ModelControllerClient client, final ModelNode operation) { try { final ModelNode result = client.execute(operation); if (! result.hasDefined(STR) && ! ModelDescriptionConstants.FAILED.equals(result.get(STR).asString())) { Assert.fail(STR + result.get(STR).asString()); } System.out.println(STR + operation + STR + result); Assert.assertFalse(result.toString(), result.get(ModelDescriptionConstants.FAILURE_DESCRIPTION).toString().contains(ControllerLogger.MGMT_OP_LOGGER.failedServices())); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Assert that the operation failed, but not with the failure message that indicates a service start problem. * Use this to check that problems that should be detected in the OSH and not in the service are properly * detected. * * @param client the client to use to execute the operation * @param operation the operation to execute */
Assert that the operation failed, but not with the failure message that indicates a service start problem. Use this to check that problems that should be detected in the OSH and not in the service are properly detected
executeForNonServiceFailure
{ "repo_name": "yersan/wildfly-core", "path": "server/src/test/java/org/jboss/as/server/test/InterfaceManagementUnitTestCase.java", "license": "lgpl-2.1", "size": 24763 }
[ "java.io.IOException", "org.jboss.as.controller.client.ModelControllerClient", "org.jboss.as.controller.descriptions.ModelDescriptionConstants", "org.jboss.as.controller.logging.ControllerLogger", "org.jboss.dmr.ModelNode", "org.junit.Assert" ]
import java.io.IOException; import org.jboss.as.controller.client.ModelControllerClient; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; import org.jboss.as.controller.logging.ControllerLogger; import org.jboss.dmr.ModelNode; import org.junit.Assert;
import java.io.*; import org.jboss.as.controller.client.*; import org.jboss.as.controller.descriptions.*; import org.jboss.as.controller.logging.*; import org.jboss.dmr.*; import org.junit.*;
[ "java.io", "org.jboss.as", "org.jboss.dmr", "org.junit" ]
java.io; org.jboss.as; org.jboss.dmr; org.junit;
1,642,197
EList<SystemFault> getItsFaults();
EList<SystemFault> getItsFaults();
/** * Returns the value of the '<em><b>Its Faults</b></em>' containment reference list. * The list contents are of type {@link WTSpec4M.SystemFault}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Its Faults</em>' containment reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Its Faults</em>' containment reference list. * @see WTSpec4M.WTSpec4MPackage#getWT_ItsFaults() * @model containment="true" resolveProxies="true" * @generated */
Returns the value of the 'Its Faults' containment reference list. The list contents are of type <code>WTSpec4M.SystemFault</code>. If the meaning of the 'Its Faults' containment reference list isn't clear, there really should be more of a description here...
getItsFaults
{ "repo_name": "mondo-project/mondo-demo-wt", "path": "DSL-tao/org.mondo.wt.cstudy/src/WTSpec4M/WT.java", "license": "epl-1.0", "size": 6994 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,355,917
public RectF getLimits() { return limits; }
RectF function() { return limits; }
/** * Gets the bounding rectangle for the SVG that was computed upon parsing. It may not be entirely accurate for certain curves or transformations, but is often better than nothing. * @return rectangle representing the computed bounds. */
Gets the bounding rectangle for the SVG that was computed upon parsing. It may not be entirely accurate for certain curves or transformations, but is often better than nothing
getLimits
{ "repo_name": "b2renger/PdDroidPublisher", "path": "svg-android/src/com/larvalabs/svgandroid/SVG.java", "license": "gpl-3.0", "size": 3728 }
[ "android.graphics.RectF" ]
import android.graphics.RectF;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,031,851
void applyTextStyle(StyleRange styleRange, Color annotationColor); }
void applyTextStyle(StyleRange styleRange, Color annotationColor); }
/** * Applies a text style on the given <code>StyleRange</code>. * * @param styleRange the style range on which to apply the text style * @param annotationColor the color of the annotation */
Applies a text style on the given <code>StyleRange</code>
applyTextStyle
{ "repo_name": "neelance/jface4ruby", "path": "jface4ruby/src/org/eclipse/jface/text/source/AnnotationPainter.java", "license": "epl-1.0", "size": 53878 }
[ "org.eclipse.swt.custom.StyleRange", "org.eclipse.swt.graphics.Color" ]
import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.custom.*; import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
201,437
@Override public List<Quota> getQuotaByAdElementId(Guid adElementId, Guid storagePoolId) { MapSqlParameterSource quotaParameterSource = getCustomMapSqlParameterSource(); quotaParameterSource.addValue("ad_element_id", adElementId); quotaParameterSource.addValue("storage_pool_id", storagePoolId); List<Quota> quotaEntityList = getCallsHandler().executeReadList("GetQuotaByAdElementId", getQuotaMetaDataFromResultSet(), quotaParameterSource); return quotaEntityList; }
List<Quota> function(Guid adElementId, Guid storagePoolId) { MapSqlParameterSource quotaParameterSource = getCustomMapSqlParameterSource(); quotaParameterSource.addValue(STR, adElementId); quotaParameterSource.addValue(STR, storagePoolId); List<Quota> quotaEntityList = getCallsHandler().executeReadList(STR, getQuotaMetaDataFromResultSet(), quotaParameterSource); return quotaEntityList; }
/** * Get list of <code>Quotas</code> which are consumed by ad element id in storage pool (if not storage pool id not * null). * * @param adElementId * - The user ID or group ID. * @param storagePoolId * - The storage pool Id to search the quotas in (If null search all over the setup). * @return All quotas for user. */
Get list of <code>Quotas</code> which are consumed by ad element id in storage pool (if not storage pool id not null)
getQuotaByAdElementId
{ "repo_name": "derekhiggins/ovirt-engine", "path": "backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/QuotaDAODbFacadeImpl.java", "license": "apache-2.0", "size": 23067 }
[ "java.util.List", "org.ovirt.engine.core.common.businessentities.Quota", "org.ovirt.engine.core.compat.Guid", "org.springframework.jdbc.core.namedparam.MapSqlParameterSource" ]
import java.util.List; import org.ovirt.engine.core.common.businessentities.Quota; import org.ovirt.engine.core.compat.Guid; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import java.util.*; import org.ovirt.engine.core.common.businessentities.*; import org.ovirt.engine.core.compat.*; import org.springframework.jdbc.core.namedparam.*;
[ "java.util", "org.ovirt.engine", "org.springframework.jdbc" ]
java.util; org.ovirt.engine; org.springframework.jdbc;
1,530,092
public final void setNoView(boolean noView) { annot.setFlag(COSName.F, FLAG_NO_VIEW, noView); }
final void function(boolean noView) { annot.setFlag(COSName.F, FLAG_NO_VIEW, noView); }
/** * Set the noView flag. * * @param noView The new noView flag. */
Set the noView flag
setNoView
{ "repo_name": "TomRoush/PdfBox-Android", "path": "library/src/main/java/com/tom_roush/pdfbox/pdmodel/fdf/FDFAnnotation.java", "license": "apache-2.0", "size": 27928 }
[ "com.tom_roush.pdfbox.cos.COSName" ]
import com.tom_roush.pdfbox.cos.COSName;
import com.tom_roush.pdfbox.cos.*;
[ "com.tom_roush.pdfbox" ]
com.tom_roush.pdfbox;
2,905,606
public Optional<MasterSlaveRule> findMasterSlaveRule(final String dataSourceName) { for (MasterSlaveRule each : masterSlaveRules) { if (each.containDataSourceName(dataSourceName)) { return Optional.of(each); } } return Optional.absent(); }
Optional<MasterSlaveRule> function(final String dataSourceName) { for (MasterSlaveRule each : masterSlaveRules) { if (each.containDataSourceName(dataSourceName)) { return Optional.of(each); } } return Optional.absent(); }
/** * Find master slave rule. * * @param dataSourceName data source name * @return master slave rule */
Find master slave rule
findMasterSlaveRule
{ "repo_name": "dangdangdotcom/sharding-jdbc", "path": "sharding-core/src/main/java/io/shardingsphere/core/rule/ShardingRule.java", "license": "apache-2.0", "size": 16890 }
[ "com.google.common.base.Optional" ]
import com.google.common.base.Optional;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,737,146
public static String formatHostnameForHttp(InetSocketAddress addr) { String hostString = NetUtil.getHostname(addr); if (NetUtil.isValidIpV6Address(hostString)) { if (!addr.isUnresolved()) { hostString = NetUtil.toAddressString(addr.getAddress()); } return '[' + hostString + ']'; } return hostString; }
static String function(InetSocketAddress addr) { String hostString = NetUtil.getHostname(addr); if (NetUtil.isValidIpV6Address(hostString)) { if (!addr.isUnresolved()) { hostString = NetUtil.toAddressString(addr.getAddress()); } return '[' + hostString + ']'; } return hostString; }
/** * Formats the host string of an address so it can be used for computing an HTTP component * such as an URL or a Host header * * @param addr the address * @return the formatted String */
Formats the host string of an address so it can be used for computing an HTTP component such as an URL or a Host header
formatHostnameForHttp
{ "repo_name": "fengjiachun/netty", "path": "codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java", "license": "apache-2.0", "size": 23036 }
[ "io.netty.util.NetUtil", "java.net.InetSocketAddress" ]
import io.netty.util.NetUtil; import java.net.InetSocketAddress;
import io.netty.util.*; import java.net.*;
[ "io.netty.util", "java.net" ]
io.netty.util; java.net;
1,940,281
private boolean readAliasForm(RunData data, SessionState state) { // read the form String id = StringUtils.trimToNull(data.getParameters().getString("id")); String target = StringUtils.trimToNull(data.getParameters().getString("target")); // get the alias AliasEdit alias = (AliasEdit) state.getAttribute("alias"); // add if needed if (alias == null) { try { // add the alias, getting an edit clone to it alias = AliasService.add(id); // put the alias in the state state.setAttribute("alias", alias); } catch (IdUsedException e) { addAlert(state, rb.getFormattedMessage("alias.use", new Object[]{id})); return false; } catch (IdInvalidException e) { addAlert(state, rb.getFormattedMessage("alias.invalid", new Object[]{id})); return false; } catch (PermissionException e) { addAlert(state, rb.getFormattedMessage("alias.notpermis2", new Object[]{id})); return false; } } // update if (alias != null) { alias.setTarget(target); } return true; } // readAliasForm /** * {@inheritDoc}
boolean function(RunData data, SessionState state) { String id = StringUtils.trimToNull(data.getParameters().getString("id")); String target = StringUtils.trimToNull(data.getParameters().getString(STR)); AliasEdit alias = (AliasEdit) state.getAttribute("alias"); if (alias == null) { try { alias = AliasService.add(id); state.setAttribute("alias", alias); } catch (IdUsedException e) { addAlert(state, rb.getFormattedMessage(STR, new Object[]{id})); return false; } catch (IdInvalidException e) { addAlert(state, rb.getFormattedMessage(STR, new Object[]{id})); return false; } catch (PermissionException e) { addAlert(state, rb.getFormattedMessage(STR, new Object[]{id})); return false; } } if (alias != null) { alias.setTarget(target); } return true; } /** * {@inheritDoc}
/** * Read the alias form and update the alias in state. * * @return true if the form is accepted, false if there's a validation error (an alertMessage will be set) */
Read the alias form and update the alias in state
readAliasForm
{ "repo_name": "eemirtekin/Sakai-10.6-TR", "path": "alias/alias-tool/tool/src/java/org/sakaiproject/alias/tool/AliasesAction.java", "license": "apache-2.0", "size": 16119 }
[ "org.apache.commons.lang.StringUtils", "org.sakaiproject.alias.api.AliasEdit", "org.sakaiproject.alias.cover.AliasService", "org.sakaiproject.cheftool.RunData", "org.sakaiproject.event.api.SessionState", "org.sakaiproject.exception.IdInvalidException", "org.sakaiproject.exception.IdUsedException", "org.sakaiproject.exception.PermissionException" ]
import org.apache.commons.lang.StringUtils; import org.sakaiproject.alias.api.AliasEdit; import org.sakaiproject.alias.cover.AliasService; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.event.api.SessionState; import org.sakaiproject.exception.IdInvalidException; import org.sakaiproject.exception.IdUsedException; import org.sakaiproject.exception.PermissionException;
import org.apache.commons.lang.*; import org.sakaiproject.alias.api.*; import org.sakaiproject.alias.cover.*; import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*; import org.sakaiproject.exception.*;
[ "org.apache.commons", "org.sakaiproject.alias", "org.sakaiproject.cheftool", "org.sakaiproject.event", "org.sakaiproject.exception" ]
org.apache.commons; org.sakaiproject.alias; org.sakaiproject.cheftool; org.sakaiproject.event; org.sakaiproject.exception;
158,007
public static CustomExpression getExpression( QName elName ) { return getCustomExpressions().get( elName ); }
static CustomExpression function( QName elName ) { return getCustomExpressions().get( elName ); }
/** * Returns the {@link CustomExpression} for the given element name. * * @param elName * name of the element, must not be <code>null</code> * @return custom expression instance, or <code>null</code> if there is no expression with this name */
Returns the <code>CustomExpression</code> for the given element name
getExpression
{ "repo_name": "deegree/deegree3", "path": "deegree-core/deegree-core-base/src/main/java/org/deegree/filter/expression/custom/CustomExpressionManager.java", "license": "lgpl-2.1", "size": 3680 }
[ "javax.xml.namespace.QName" ]
import javax.xml.namespace.QName;
import javax.xml.namespace.*;
[ "javax.xml" ]
javax.xml;
492,022
@Override public Post getLastPostFor(Branch branch) { List<Post> posts = (List<Post>) session() .getNamedQuery("getLastPostForBranch") .setParameter("branchId", branch.getId()) .setMaxResults(1) .list(); if (!posts.isEmpty()) { return posts.get(0); } return null; } /** * {@inheritDoc}
Post function(Branch branch) { List<Post> posts = (List<Post>) session() .getNamedQuery(STR) .setParameter(STR, branch.getId()) .setMaxResults(1) .list(); if (!posts.isEmpty()) { return posts.get(0); } return null; } /** * {@inheritDoc}
/** * Get last post that was posted in a topic of branch. * Uses hibernate criteria instead of invoking {@link #getLastPostsFor} method that uses hql query. * Done for better performance results. This solution can return only one last post so method * {@link #getLastPostsFor} stay without changes. * * @param branch in this branch post was posted * @return last post that was posted in a topic of branch */
Get last post that was posted in a topic of branch. Uses hibernate criteria instead of invoking <code>#getLastPostsFor</code> method that uses hql query. Done for better performance results. This solution can return only one last post so method <code>#getLastPostsFor</code> stay without changes
getLastPostFor
{ "repo_name": "Noctrunal/jcommune", "path": "jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/PostHibernateDao.java", "license": "lgpl-2.1", "size": 5134 }
[ "java.util.List", "org.jtalks.jcommune.model.entity.Branch", "org.jtalks.jcommune.model.entity.Post" ]
import java.util.List; import org.jtalks.jcommune.model.entity.Branch; import org.jtalks.jcommune.model.entity.Post;
import java.util.*; import org.jtalks.jcommune.model.entity.*;
[ "java.util", "org.jtalks.jcommune" ]
java.util; org.jtalks.jcommune;
149,795
public static void set18CompilerOptions(IJavaProject project) { Map options = project.getOptions(false); set18CompilerOptions(options); project.setOptions(options); }
static void function(IJavaProject project) { Map options = project.getOptions(false); set18CompilerOptions(options); project.setOptions(options); }
/** * Sets the compiler options to 1.8 for the given project. * * @param project the java project * @since 3.10 */
Sets the compiler options to 1.8 for the given project
set18CompilerOptions
{ "repo_name": "gazarenkov/che-sketch", "path": "plugins/plugin-java/che-plugin-java-ext-lang-server/src/test/java/org/eclipse/che/plugin/java/server/jdt/testplugin/JavaProjectHelper.java", "license": "epl-1.0", "size": 39409 }
[ "java.util.Map", "org.eclipse.jdt.core.IJavaProject" ]
import java.util.Map; import org.eclipse.jdt.core.IJavaProject;
import java.util.*; import org.eclipse.jdt.core.*;
[ "java.util", "org.eclipse.jdt" ]
java.util; org.eclipse.jdt;
732,872
protected void checkThreshold(int count) throws IOException { if (!thresholdExceeded && written + count > threshold) { thresholdExceeded = true; thresholdReached(); } }
void function(int count) throws IOException { if (!thresholdExceeded && written + count > threshold) { thresholdExceeded = true; thresholdReached(); } }
/** * Checks to see if writing the specified number of bytes would cause the * configured threshold to be exceeded. If so, triggers an event to allow * a concrete implementation to take action on this. * * @param count The number of bytes about to be written to the underlying * output stream. * * @exception IOException if an error occurs. */
Checks to see if writing the specified number of bytes would cause the configured threshold to be exceeded. If so, triggers an event to allow a concrete implementation to take action on this
checkThreshold
{ "repo_name": "wspeirs/sop4j-base", "path": "src/main/java/com/sop4j/base/apache/io/output/ThresholdingOutputStream.java", "license": "apache-2.0", "size": 7237 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,048,324
private synchronized void retireMap(TaskInProgress tip) { // Since a list for running maps is maintained if speculation is 'ON' if (hasSpeculativeMaps) { if (runningMapCache == null) { LOG.warn("Running cache for maps missing!! " + "Job details are missing."); return; } String[] splitLocations = tip.getSplitLocations(); // Remove the TIP from the list for running non-local maps if (splitLocations.length == 0) { nonLocalRunningMaps.remove(tip); return; } // Remove from the running map caches for (String host : splitLocations) { Node node = jobtracker.getNode(host); for (int j = 0; j < maxLevel; ++j) { Set<TaskInProgress> hostMaps = runningMapCache.get(node); if (hostMaps != null) { hostMaps.remove(tip); if (hostMaps.size() == 0) { runningMapCache.remove(node); } } node = node.getParent(); } } } }
synchronized void function(TaskInProgress tip) { if (hasSpeculativeMaps) { if (runningMapCache == null) { LOG.warn(STR + STR); return; } String[] splitLocations = tip.getSplitLocations(); if (splitLocations.length == 0) { nonLocalRunningMaps.remove(tip); return; } for (String host : splitLocations) { Node node = jobtracker.getNode(host); for (int j = 0; j < maxLevel; ++j) { Set<TaskInProgress> hostMaps = runningMapCache.get(node); if (hostMaps != null) { hostMaps.remove(tip); if (hostMaps.size() == 0) { runningMapCache.remove(node); } } node = node.getParent(); } } } }
/** * Remove a map TIP from the lists for running maps. Called when a map * fails/completes (note if a map is killed, it won't be present in the list * since it was completed earlier) * * @param tip * the tip that needs to be retired */
Remove a map TIP from the lists for running maps. Called when a map fails/completes (note if a map is killed, it won't be present in the list since it was completed earlier)
retireMap
{ "repo_name": "dongpf/hadoop-0.19.1", "path": "src/mapred/org/apache/hadoop/mapred/JobInProgress.java", "license": "apache-2.0", "size": 91919 }
[ "java.util.Set", "org.apache.hadoop.net.Node" ]
import java.util.Set; import org.apache.hadoop.net.Node;
import java.util.*; import org.apache.hadoop.net.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,123,038
@Override public Set<String> smembers(final String key) { checkIsInMultiOrPipeline(); client.smembers(key); final List<String> members = client.getMultiBulkReply(); return SetFromList.of(members); }
Set<String> function(final String key) { checkIsInMultiOrPipeline(); client.smembers(key); final List<String> members = client.getMultiBulkReply(); return SetFromList.of(members); }
/** * Return all the members (elements) of the set value stored at key. This is just syntax glue for * {@link #sinter(String...) SINTER}. * <p> * Time complexity O(N) * @param key * @return Multi bulk reply */
Return all the members (elements) of the set value stored at key. This is just syntax glue for <code>#sinter(String...) SINTER</code>. Time complexity O(N)
smembers
{ "repo_name": "yapei123/jedis", "path": "src/main/java/redis/clients/jedis/Jedis.java", "license": "mit", "size": 127680 }
[ "java.util.List", "java.util.Set" ]
import java.util.List; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,780,399
public void exitApplication(boolean forceQuit, boolean exit) { if (!forceQuit) { List<AgentInfo> agents = (List<AgentInfo>) registry.lookup(LookupNames.AGENTS); Iterator<AgentInfo> i = agents.iterator(); AgentInfo agentInfo; Agent a; //Agents termination phase. i = agents.iterator(); List<AgentInfo> notTerminated = new ArrayList<AgentInfo>(); while (i.hasNext()) { agentInfo = i.next(); if (agentInfo.isActive()) { a = agentInfo.getAgent(); if (a.canTerminate()) { a.terminate(); } else notTerminated.add(agentInfo); } } if (notTerminated.size() > 0) { i = notTerminated.iterator(); StringBuffer buffer = new StringBuffer(); while (i.hasNext()) { agentInfo = i.next(); buffer.append(agentInfo.getName()); buffer.append("\n"); } String message = "The following components " + "could not be closed safely:\n"+buffer.toString()+"\n" + "Please check."; String title = "Exit Application"; Environment env = (Environment) registry.lookup(LookupNames.ENV); if (env != null && env.isRunAsPlugin()) title = "Exit Plugin"; MessageBox box = new MessageBox( DataServicesFactory.registry.getTaskBar().getFrame(), title, message, IconManager.getInstance().getIcon( IconManager.INFORMATION_MESSAGE_48)); box.setNoText("OK"); box.setYesText("Force Quit"); box.setSize(400, 250); if (!env.isRunAsPlugin() && box.centerMsgBox() == MessageBox.NO_OPTION) return; } } shutdown(null); if (exit) { CacheServiceFactory.shutdown(container); container.exit(); } singleton = null; }
void function(boolean forceQuit, boolean exit) { if (!forceQuit) { List<AgentInfo> agents = (List<AgentInfo>) registry.lookup(LookupNames.AGENTS); Iterator<AgentInfo> i = agents.iterator(); AgentInfo agentInfo; Agent a; i = agents.iterator(); List<AgentInfo> notTerminated = new ArrayList<AgentInfo>(); while (i.hasNext()) { agentInfo = i.next(); if (agentInfo.isActive()) { a = agentInfo.getAgent(); if (a.canTerminate()) { a.terminate(); } else notTerminated.add(agentInfo); } } if (notTerminated.size() > 0) { i = notTerminated.iterator(); StringBuffer buffer = new StringBuffer(); while (i.hasNext()) { agentInfo = i.next(); buffer.append(agentInfo.getName()); buffer.append("\n"); } String message = STR + STR+buffer.toString()+"\n" + STR; String title = STR; Environment env = (Environment) registry.lookup(LookupNames.ENV); if (env != null && env.isRunAsPlugin()) title = STR; MessageBox box = new MessageBox( DataServicesFactory.registry.getTaskBar().getFrame(), title, message, IconManager.getInstance().getIcon( IconManager.INFORMATION_MESSAGE_48)); box.setNoText("OK"); box.setYesText(STR); box.setSize(400, 250); if (!env.isRunAsPlugin() && box.centerMsgBox() == MessageBox.NO_OPTION) return; } } shutdown(null); if (exit) { CacheServiceFactory.shutdown(container); container.exit(); } singleton = null; }
/** Shuts the services down and exits the application. * * @param forceQuit Pass <code>true</code> to force i.e. do not check if * the application can terminate, * <code>false</code> otherwise. * @param exit Pass <code>true</code> to quit, <code>false</code> to * only shut down the services. */
Shuts the services down and exits the application
exitApplication
{ "repo_name": "aleksandra-tarkowska/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/DataServicesFactory.java", "license": "gpl-2.0", "size": 28581 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.openmicroscopy.shoola.env.Agent", "org.openmicroscopy.shoola.env.Environment", "org.openmicroscopy.shoola.env.LookupNames", "org.openmicroscopy.shoola.env.cache.CacheServiceFactory", "org.openmicroscopy.shoola.env.config.AgentInfo", "org.openmicroscopy.shoola.util.ui.IconManager", "org.openmicroscopy.shoola.util.ui.MessageBox" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.openmicroscopy.shoola.env.Agent; import org.openmicroscopy.shoola.env.Environment; import org.openmicroscopy.shoola.env.LookupNames; import org.openmicroscopy.shoola.env.cache.CacheServiceFactory; import org.openmicroscopy.shoola.env.config.AgentInfo; import org.openmicroscopy.shoola.util.ui.IconManager; import org.openmicroscopy.shoola.util.ui.MessageBox;
import java.util.*; import org.openmicroscopy.shoola.env.*; import org.openmicroscopy.shoola.env.cache.*; import org.openmicroscopy.shoola.env.config.*; import org.openmicroscopy.shoola.util.ui.*;
[ "java.util", "org.openmicroscopy.shoola" ]
java.util; org.openmicroscopy.shoola;
2,895,050
private void invokeBinaryValueDialog(TableItem item, String attributeName, int column, int rowNum) { Dialog dialog = new MessageDialog( Display.getDefault().getActiveShell(), "Binary attribute", AwsToolkitCore.getDefault().getImageRegistry().get(AwsToolkitCore.IMAGE_AWS_ICON), "This is a binary attribute. Editing binary attributes is unsupported, " + "but you can copy the base64 encoding of this attribute to the clipboard.", MessageDialog.NONE, new String[] { "Copy to clipboard", "Cancel" }, 0); int result = dialog.open(); if ( result == 0 ) { Clipboard cb = new Clipboard(Display.getDefault()); String data = item.getText(column); TextTransfer textTransfer = TextTransfer.getInstance(); cb.setContents(new Object[] { data }, new Transfer[] { textTransfer }); } }
void function(TableItem item, String attributeName, int column, int rowNum) { Dialog dialog = new MessageDialog( Display.getDefault().getActiveShell(), STR, AwsToolkitCore.getDefault().getImageRegistry().get(AwsToolkitCore.IMAGE_AWS_ICON), STR + STR, MessageDialog.NONE, new String[] { STR, STR }, 0); int result = dialog.open(); if ( result == 0 ) { Clipboard cb = new Clipboard(Display.getDefault()); String data = item.getText(column); TextTransfer textTransfer = TextTransfer.getInstance(); cb.setContents(new Object[] { data }, new Transfer[] { textTransfer }); } }
/** * Invokes a dialog showing a binary value or set of values. */
Invokes a dialog showing a binary value or set of values
invokeBinaryValueDialog
{ "repo_name": "aws/aws-toolkit-eclipse", "path": "bundles/com.amazonaws.eclipse.dynamodb/src/com/amazonaws/eclipse/dynamodb/editor/DynamoDBTableEditor.java", "license": "apache-2.0", "size": 64097 }
[ "com.amazonaws.eclipse.core.AwsToolkitCore", "org.eclipse.jface.dialogs.Dialog", "org.eclipse.jface.dialogs.MessageDialog", "org.eclipse.swt.dnd.Clipboard", "org.eclipse.swt.dnd.TextTransfer", "org.eclipse.swt.dnd.Transfer", "org.eclipse.swt.widgets.Display", "org.eclipse.swt.widgets.TableItem" ]
import com.amazonaws.eclipse.core.AwsToolkitCore; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.TableItem;
import com.amazonaws.eclipse.core.*; import org.eclipse.jface.dialogs.*; import org.eclipse.swt.dnd.*; import org.eclipse.swt.widgets.*;
[ "com.amazonaws.eclipse", "org.eclipse.jface", "org.eclipse.swt" ]
com.amazonaws.eclipse; org.eclipse.jface; org.eclipse.swt;
1,066,225
public void construct() { Node actualNode = root; ArrayList<Node> recNodes = new ArrayList<Node>(); trainedList.add(actualNode); while (actualNode != null) { if (actualNode.classes.size() > 1) { // Compute the distances to the center node (mean center) double[] dist = distances(actualNode); // Take the two lowest distances! TreeMap<Double, List<Integer>> map = new TreeMap<Double, List<Integer>>(); for(int i = 0; i < dist.length; i++) { List<Integer> ind = map.get(dist[i]); if(ind == null){ ind = new ArrayList<Integer>(); map.put(dist[i], ind); } ind.add(i); } // Now flatten the list List<Integer> indices = new ArrayList<Integer>(); for(List<Integer> arr : map.values()) { indices.addAll(arr); } boolean accepted = false; for (int p = 0; p < dist.length && !accepted; p++) { for (int q = p + 1; q < dist.length && !accepted; q++) { int i = actualNode.classes.get(indices.get(p)); int j = actualNode.classes.get(indices.get(q)); actualNode.i = i < j ? i : j; actualNode.j = i >= j ? i : j; actualNode.constructNextNodes(); if (actualNode.nextNodes[0].classes.size() < actualNode.classes.size() || actualNode.nextNodes[1].classes.size() < actualNode.classes.size()) // Instances properly divided! -> the node is accepted accepted = true; System.out.println("Nodo actual: " + actualNode.classes.size() + " Nodo 0: " + actualNode.nextNodes[0].classes.size() + " Nodo 1: " + actualNode.nextNodes[1].classes.size() + " accepted = " + accepted); } } if (!accepted) { System.out.println("Worst situation, nClasses = " + actualNode.classes.size() + " / " + classifier.nClasses); actualNode.nextNodes = null; } else { if (actualNode.nextNodes[0].classes.size() > 1 && !trainedList.contains(actualNode.nextNodes[0])) { recNodes.add(actualNode.nextNodes[0]); trainedList.add(actualNode.nextNodes[0]); } else if (trainedList.contains(actualNode.nextNodes[0])) { actualNode.nextNodes[0] = trainedList.get(trainedList.indexOf(actualNode.nextNodes[0])); } if (actualNode.nextNodes[1].classes.size() > 1 && !trainedList.contains(actualNode.nextNodes[1])) { recNodes.add(actualNode.nextNodes[1]); trainedList.add(actualNode.nextNodes[1]); } else if (trainedList.contains(actualNode.nextNodes[1])) { actualNode.nextNodes[1] = trainedList.get(trainedList.indexOf(actualNode.nextNodes[1])); } Collections.sort(actualNode.nextNodes[0].classes); Collections.sort(actualNode.nextNodes[1].classes); } } if (recNodes.size() > 0) { // Go for the next node! actualNode = recNodes.get(0); recNodes.remove(0); } else actualNode = null; } }
void function() { Node actualNode = root; ArrayList<Node> recNodes = new ArrayList<Node>(); trainedList.add(actualNode); while (actualNode != null) { if (actualNode.classes.size() > 1) { double[] dist = distances(actualNode); TreeMap<Double, List<Integer>> map = new TreeMap<Double, List<Integer>>(); for(int i = 0; i < dist.length; i++) { List<Integer> ind = map.get(dist[i]); if(ind == null){ ind = new ArrayList<Integer>(); map.put(dist[i], ind); } ind.add(i); } List<Integer> indices = new ArrayList<Integer>(); for(List<Integer> arr : map.values()) { indices.addAll(arr); } boolean accepted = false; for (int p = 0; p < dist.length && !accepted; p++) { for (int q = p + 1; q < dist.length && !accepted; q++) { int i = actualNode.classes.get(indices.get(p)); int j = actualNode.classes.get(indices.get(q)); actualNode.i = i < j ? i : j; actualNode.j = i >= j ? i : j; actualNode.constructNextNodes(); if (actualNode.nextNodes[0].classes.size() < actualNode.classes.size() actualNode.nextNodes[1].classes.size() < actualNode.classes.size()) accepted = true; System.out.println(STR + actualNode.classes.size() + STR + actualNode.nextNodes[0].classes.size() + STR + actualNode.nextNodes[1].classes.size() + STR + accepted); } } if (!accepted) { System.out.println(STR + actualNode.classes.size() + STR + classifier.nClasses); actualNode.nextNodes = null; } else { if (actualNode.nextNodes[0].classes.size() > 1 && !trainedList.contains(actualNode.nextNodes[0])) { recNodes.add(actualNode.nextNodes[0]); trainedList.add(actualNode.nextNodes[0]); } else if (trainedList.contains(actualNode.nextNodes[0])) { actualNode.nextNodes[0] = trainedList.get(trainedList.indexOf(actualNode.nextNodes[0])); } if (actualNode.nextNodes[1].classes.size() > 1 && !trainedList.contains(actualNode.nextNodes[1])) { recNodes.add(actualNode.nextNodes[1]); trainedList.add(actualNode.nextNodes[1]); } else if (trainedList.contains(actualNode.nextNodes[1])) { actualNode.nextNodes[1] = trainedList.get(trainedList.indexOf(actualNode.nextNodes[1])); } Collections.sort(actualNode.nextNodes[0].classes); Collections.sort(actualNode.nextNodes[1].classes); } } if (recNodes.size() > 0) { actualNode = recNodes.get(0); recNodes.remove(0); } else actualNode = null; } }
/** * It constructs the balanced binary tree */
It constructs the balanced binary tree
construct
{ "repo_name": "triguero/Keel3.0", "path": "src/keel/Algorithms/Decision_Trees/C45_Binarization/BTS.java", "license": "gpl-3.0", "size": 13026 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "java.util.TreeMap" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.TreeMap;
import java.util.*;
[ "java.util" ]
java.util;
1,855,453
protected void readStructureFromNBT(NBTTagCompound tagCompound, TemplateManager p_143011_2_) { this.averageGroundLvl = tagCompound.getInteger("HPos"); this.villagersSpawned = tagCompound.getInteger("VCount"); this.structureType = tagCompound.getByte("Type"); if (tagCompound.getBoolean("Desert")) { this.structureType = 1; } this.isZombieInfested = tagCompound.getBoolean("Zombie"); }
void function(NBTTagCompound tagCompound, TemplateManager p_143011_2_) { this.averageGroundLvl = tagCompound.getInteger("HPos"); this.villagersSpawned = tagCompound.getInteger(STR); this.structureType = tagCompound.getByte("Type"); if (tagCompound.getBoolean(STR)) { this.structureType = 1; } this.isZombieInfested = tagCompound.getBoolean(STR); }
/** * (abstract) Helper method to read subclass data from NBT */
(abstract) Helper method to read subclass data from NBT
readStructureFromNBT
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraft/world/gen/structure/StructureVillagePieces.java", "license": "lgpl-2.1", "size": 136606 }
[ "net.minecraft.nbt.NBTTagCompound", "net.minecraft.world.gen.structure.template.TemplateManager" ]
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.gen.structure.template.TemplateManager;
import net.minecraft.nbt.*; import net.minecraft.world.gen.structure.template.*;
[ "net.minecraft.nbt", "net.minecraft.world" ]
net.minecraft.nbt; net.minecraft.world;
166,095
List<Ehitised> findENEhitiseOtsing(BigInteger aadressId) throws XRoadServiceConsumptionException;
List<Ehitised> findENEhitiseOtsing(BigInteger aadressId) throws XRoadServiceConsumptionException;
/** * Find list of {@link Ehitised} objects by specified address id * * @param aadressId Aadressi ID * @return list of {@link Ehitised} objects * @throws XRoadServiceConsumptionException */
Find list of <code>Ehitised</code> objects by specified address id
findENEhitiseOtsing
{ "repo_name": "nortal/j-road", "path": "client-service/ehr/src/main/java/com/nortal/jroad/client/ehr/EhrXTeeService.java", "license": "apache-2.0", "size": 2898 }
[ "com.nortal.jroad.client.ehr.types.ee.riik.xtee.ehr.producers.producer.ehr.ENEhitiseOtsingResponse", "com.nortal.jroad.client.exception.XRoadServiceConsumptionException", "java.math.BigInteger", "java.util.List" ]
import com.nortal.jroad.client.ehr.types.ee.riik.xtee.ehr.producers.producer.ehr.ENEhitiseOtsingResponse; import com.nortal.jroad.client.exception.XRoadServiceConsumptionException; import java.math.BigInteger; import java.util.List;
import com.nortal.jroad.client.ehr.types.ee.riik.xtee.ehr.producers.producer.ehr.*; import com.nortal.jroad.client.exception.*; import java.math.*; import java.util.*;
[ "com.nortal.jroad", "java.math", "java.util" ]
com.nortal.jroad; java.math; java.util;
2,736,965
public static Name fromConstantString(String s) { try { return fromString(s, null); } catch (TextParseException e) { throw new IllegalArgumentException("Invalid name '" + s + "'"); } } public Name(DNSInput in) throws WireParseException { int len, pos; boolean done = false; byte[] label = new byte[MAXLABEL + 1]; boolean savedState = false; while (!done) { len = in.readU8(); switch (len & LABEL_MASK) { case LABEL_NORMAL: if (getlabels() >= MAXLABELS) throw new WireParseException("too many labels"); if (len == 0) { append(emptyLabel, 0, 1); done = true; } else { label[0] = (byte) len; in.readByteArray(label, 1, len); append(label, 0, 1); } break; case LABEL_COMPRESSION: pos = in.readU8(); pos += ((len & ~LABEL_MASK) << 8); if (Options.check("verbosecompression")) System.err.println("currently " + in.current() + ", pointer to " + pos); if (pos >= in.current() - 2) throw new WireParseException("bad compression"); if (!savedState) { in.save(); savedState = true; } in.jump(pos); if (Options.check("verbosecompression")) System.err.println("current name '" + this + "', seeking to " + pos); break; default: throw new WireParseException("bad label type"); } } if (savedState) { in.restore(); } } public Name(byte[] b) throws IOException { this(new DNSInput(b)); } public Name(Name src, int n) { int slabels = src.labels(); if (n > slabels) throw new IllegalArgumentException("attempted to remove too " + "many labels"); name = src.name; setlabels(slabels - n); for (int i = 0; i < MAXOFFSETS && i < slabels - n; i++) setoffset(i, src.offset(i + n)); }
static Name function(String s) { try { return fromString(s, null); } catch (TextParseException e) { throw new IllegalArgumentException(STR + s + "'"); } } public Name(DNSInput in) throws WireParseException { int len, pos; boolean done = false; byte[] label = new byte[MAXLABEL + 1]; boolean savedState = false; while (!done) { len = in.readU8(); switch (len & LABEL_MASK) { case LABEL_NORMAL: if (getlabels() >= MAXLABELS) throw new WireParseException(STR); if (len == 0) { append(emptyLabel, 0, 1); done = true; } else { label[0] = (byte) len; in.readByteArray(label, 1, len); append(label, 0, 1); } break; case LABEL_COMPRESSION: pos = in.readU8(); pos += ((len & ~LABEL_MASK) << 8); if (Options.check(STR)) System.err.println(STR + in.current() + STR + pos); if (pos >= in.current() - 2) throw new WireParseException(STR); if (!savedState) { in.save(); savedState = true; } in.jump(pos); if (Options.check(STR)) System.err.println(STR + this + STR + pos); break; default: throw new WireParseException(STR); } } if (savedState) { in.restore(); } } public Name(byte[] b) throws IOException { this(new DNSInput(b)); } public Name(Name src, int n) { int slabels = src.labels(); if (n > slabels) throw new IllegalArgumentException(STR + STR); name = src.name; setlabels(slabels - n); for (int i = 0; i < MAXOFFSETS && i < slabels - n; i++) setoffset(i, src.offset(i + n)); }
/** * Create a new name from a constant string. This should only be used when * the name is known to be good - that is, when it is constant. * * @param s * The string to be converted * @return the name */
Create a new name from a constant string. This should only be used when the name is known to be good - that is, when it is constant
fromConstantString
{ "repo_name": "confluxtoo/finflux_automation_test", "path": "browsermob-proxy/src/main/java/org/xbill/DNS/Name.java", "license": "mpl-2.0", "size": 24035 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,236,830
public void saveNewGroupWithAcls(DBGroup group, List<DBAcl> acls) throws InvalidRequestException, SQLException { // verify that the acls actually apply correctly to group validateGroupAcls(group, acls); // The requestor must be able to edit secrets in the new group Set<Integer> groupAdmins = getFirstLevelUsers(acls, DBAcl.modifyGroupSecretsAccess()); if (!groupAdmins.contains(identity.getId())) { // We cannot allow a group to be created where the requestor cannot modify // group secrets. throw new InvalidRequestException("Cannot create group where requestor " + identity.getName() + " does not have permission to modify group secrets"); } // save the group and the acls manager.groupDao.create(group); for (DBAcl acl : acls) { manager.aclDao.create(acl); } }
void function(DBGroup group, List<DBAcl> acls) throws InvalidRequestException, SQLException { validateGroupAcls(group, acls); Set<Integer> groupAdmins = getFirstLevelUsers(acls, DBAcl.modifyGroupSecretsAccess()); if (!groupAdmins.contains(identity.getId())) { throw new InvalidRequestException(STR + identity.getName() + STR); } manager.groupDao.create(group); for (DBAcl acl : acls) { manager.aclDao.create(acl); } }
/** * Saves a new group with new acls, if this user has permission and the group and ACLs * are valid. This will throw an exception if the group and ACLs already exist. */
Saves a new group with new acls, if this user has permission and the group and ACLs are valid. This will throw an exception if the group and ACLs already exist
saveNewGroupWithAcls
{ "repo_name": "ssgeejr/mitropm", "path": "mitro-core/java/server/src/co/mitro/core/accesscontrol/AuthenticatedDB.java", "license": "gpl-3.0", "size": 20789 }
[ "co.mitro.core.exceptions.InvalidRequestException", "co.mitro.core.server.data.DBAcl", "co.mitro.core.server.data.DBGroup", "java.sql.SQLException", "java.util.List", "java.util.Set" ]
import co.mitro.core.exceptions.InvalidRequestException; import co.mitro.core.server.data.DBAcl; import co.mitro.core.server.data.DBGroup; import java.sql.SQLException; import java.util.List; import java.util.Set;
import co.mitro.core.exceptions.*; import co.mitro.core.server.data.*; import java.sql.*; import java.util.*;
[ "co.mitro.core", "java.sql", "java.util" ]
co.mitro.core; java.sql; java.util;
2,768,550
public void exitAnd_predicate(SQLParser.And_predicateContext ctx) { }
public void exitAnd_predicate(SQLParser.And_predicateContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterAnd_predicate
{ "repo_name": "HEIG-GAPS/slasher", "path": "slasher.corrector/src/main/java/ch/gaps/slasher/corrector/SQLParserBaseListener.java", "license": "mit", "size": 73849 }
[ "ch.gaps.slasher.corrector.SQLParser" ]
import ch.gaps.slasher.corrector.SQLParser;
import ch.gaps.slasher.corrector.*;
[ "ch.gaps.slasher" ]
ch.gaps.slasher;
761,199
public void setValue(double theValue) throws StandardException { throwLangSetMismatch("double"); }
void function(double theValue) throws StandardException { throwLangSetMismatch(STR); }
/** * Set the value of this DataValueDescriptor to the given double value * At DataType level just throws an error lower classes will override * * @param theValue The value to set this DataValueDescriptor to * * @exception StandardException Thrown on error */
Set the value of this DataValueDescriptor to the given double value At DataType level just throws an error lower classes will override
setValue
{ "repo_name": "lpxz/grail-derby104", "path": "java/engine/org/apache/derby/iapi/types/DataType.java", "license": "apache-2.0", "size": 34458 }
[ "org.apache.derby.iapi.error.StandardException" ]
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.error.*;
[ "org.apache.derby" ]
org.apache.derby;
339,406
@ReturnNullAsFalse public LongValue size(Env env) { try { return LongValue.create(_javaCollection.size()); } catch (Exception ex) { log.log(Level.FINE, ex.toString(), ex); return null; } }
LongValue function(Env env) { try { return LongValue.create(_javaCollection.size()); } catch (Exception ex) { log.log(Level.FINE, ex.toString(), ex); return null; } }
/** * Returns size of the collection */
Returns size of the collection
size
{ "repo_name": "dwango/quercus", "path": "src/main/java/com/caucho/quercus/lib/db/OracleOciCollection.java", "license": "gpl-2.0", "size": 7128 }
[ "com.caucho.quercus.env.Env", "com.caucho.quercus.env.LongValue", "java.util.logging.Level" ]
import com.caucho.quercus.env.Env; import com.caucho.quercus.env.LongValue; import java.util.logging.Level;
import com.caucho.quercus.env.*; import java.util.logging.*;
[ "com.caucho.quercus", "java.util" ]
com.caucho.quercus; java.util;
298,287
public void calculateLogLikelihoods(BigDecimal[] partials, double[] frequencies, double[] outLogLikelihoods) { BigDecimal[] freqs = new BigDecimal[frequencies.length]; for (int i = 0; i < freqs.length; i++) { freqs[i] = new BigDecimal(frequencies[i], precision); } int v = 0; for (int k = 0; k < patternCount; k++) { BigDecimal sum = BigDecimal.ZERO; for (int i = 0; i < stateCount; i++) { sum = sum.add(freqs[i].multiply(partials[v], precision), precision); v++; } double scale = sum.scale(); double value = sum.unscaledValue().doubleValue(); outLogLikelihoods[k] = Math.log(value) - (scale * Math.log(10)); } }
void function(BigDecimal[] partials, double[] frequencies, double[] outLogLikelihoods) { BigDecimal[] freqs = new BigDecimal[frequencies.length]; for (int i = 0; i < freqs.length; i++) { freqs[i] = new BigDecimal(frequencies[i], precision); } int v = 0; for (int k = 0; k < patternCount; k++) { BigDecimal sum = BigDecimal.ZERO; for (int i = 0; i < stateCount; i++) { sum = sum.add(freqs[i].multiply(partials[v], precision), precision); v++; } double scale = sum.scale(); double value = sum.unscaledValue().doubleValue(); outLogLikelihoods[k] = Math.log(value) - (scale * Math.log(10)); } }
/** * Calculates patten log likelihoods at a node. * @param partials the partials used to calculate the likelihoods * @param frequencies an array of state frequencies * @param outLogLikelihoods an array into which the likelihoods will go */
Calculates patten log likelihoods at a node
calculateLogLikelihoods
{ "repo_name": "whdc/ieo-beast", "path": "src/dr/evomodel/treelikelihood/ArbitraryPrecisionLikelihoodCore.java", "license": "lgpl-2.1", "size": 17270 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
429,376
public List<String> getCreateAuthorizedLayersExclude() { return createAuthorizedLayersExclude; }
List<String> function() { return createAuthorizedLayersExclude; }
/** * List of regular expressions of to exclude layers in which features can be created. * * @return list of regular expressions */
List of regular expressions of to exclude layers in which features can be created
getCreateAuthorizedLayersExclude
{ "repo_name": "geomajas/geomajas-project-server", "path": "plugin/staticsecurity/staticsecurity/src/main/java/org/geomajas/plugin/staticsecurity/configuration/LayerAuthorizationInfo.java", "license": "agpl-3.0", "size": 7689 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,754,791
private boolean isEnumeration(SemType type) { if (type instanceof SemClass) { Class<?> nativeClass = ((SemClass) type).getNativeClass(); if (nativeClass != null && nativeClass.isEnum()) return true; return heuristicEnum((SemClass) type); } return false; }
boolean function(SemType type) { if (type instanceof SemClass) { Class<?> nativeClass = ((SemClass) type).getNativeClass(); if (nativeClass != null && nativeClass.isEnum()) return true; return heuristicEnum((SemClass) type); } return false; }
/** * Test whether a type is an enumeration type; if so, its translation is integer (at least for now). * @param type the type to test * @return true if it is an an enumeration */
Test whether a type is an enumeration type; if so, its translation is integer (at least for now)
isEnumeration
{ "repo_name": "querycert/qcert", "path": "compiler/parsingJava/jrulesParser/src/org/qcert/camp/translator/SemRule2CAMP.java", "license": "apache-2.0", "size": 70950 }
[ "com.ibm.rules.engine.lang.semantics.SemClass", "com.ibm.rules.engine.lang.semantics.SemType" ]
import com.ibm.rules.engine.lang.semantics.SemClass; import com.ibm.rules.engine.lang.semantics.SemType;
import com.ibm.rules.engine.lang.semantics.*;
[ "com.ibm.rules" ]
com.ibm.rules;
1,273,877
int paintUnselected(Graphics g, int start, int end, int x, int y) throws BadLocationException;
int paintUnselected(Graphics g, int start, int end, int x, int y) throws BadLocationException;
/** * Paints unselected range of text. * * @param g graphics to paint on. * @param start the start of the unselected range. * @param end the end of the unselected range. * @param x the <var>x</var> coordinate of the text. * @param y the <var>y</var> coordinate of the text. * It assumed to be the baseline position. * @return the <var>x</var> coordinate where the next interval is * to be painted. * * @throws BadLocationException if interval represents invalid * model range. */
Paints unselected range of text
paintUnselected
{ "repo_name": "freeVM/freeVM", "path": "enhanced/java/classlib/modules/swing/src/main/java/common/javax/swing/text/TextInterval.java", "license": "apache-2.0", "size": 10411 }
[ "java.awt.Graphics" ]
import java.awt.Graphics;
import java.awt.*;
[ "java.awt" ]
java.awt;
294,270
public IScope scope_MParameterValueRefObject_object(MParameterSWPSPSwitchCase switchCase, EReference reference) { MParameterSWPSPSwitch parameter = (MParameterSWPSPSwitch) switchCase.eContainer(); MSwPackage swp = (MSwPackage)parameter.eContainer(); Set<MParameter> params = mesputil.getParameters(swp); for (MAbstractSwPackage aswp : swp.getInherits()) { if (aswp.eIsProxy() == false) { params.addAll(mesputil.getAllParameters(aswp)); } } for (MSwPackageRequiredInterface rswi : swp.getRequires()) { if (rswi.getInterface() != null && rswi.getInterface().eIsProxy() == false && rswi.getInterface() instanceof MSwInterface) { MSwInterface swi = (MSwInterface)rswi.getInterface(); params.addAll(mesputil.getAllParameters(swi)); } } if (switchCase.getPlatform() != null && switchCase.getPlatform().eIsProxy() == false) { params.addAll(mesputil.getParameters(switchCase.getPlatform())); params.addAll(getAllPlatformParameters(switchCase.getPlatform())); for (MSwPackageRequiredInterface rswi : switchCase.getPlatform().getRequires()) { if (rswi.getInterface() != null && rswi.getInterface().eIsProxy() == false && rswi.getInterface() instanceof MSwInterface) { MSwInterface swi = (MSwInterface)rswi; params.addAll(mesputil.getAllParameters(swi)); } } } params.remove(parameter); IScope innerScope = getFullObjectScope(params); if (parameter instanceof MEnumParamSWPSPSwitch) { // Then we have to return the literals MEnumParamSWPSPSwitch param = (MEnumParamSWPSPSwitch)parameter; if (param.getEnumDefinition() != null && param.getEnumDefinition().eIsProxy() == false) { return getSimpleObjectScope(param.getEnumDefinition().getLiterals(), innerScope); } } return innerScope; }
IScope function(MParameterSWPSPSwitchCase switchCase, EReference reference) { MParameterSWPSPSwitch parameter = (MParameterSWPSPSwitch) switchCase.eContainer(); MSwPackage swp = (MSwPackage)parameter.eContainer(); Set<MParameter> params = mesputil.getParameters(swp); for (MAbstractSwPackage aswp : swp.getInherits()) { if (aswp.eIsProxy() == false) { params.addAll(mesputil.getAllParameters(aswp)); } } for (MSwPackageRequiredInterface rswi : swp.getRequires()) { if (rswi.getInterface() != null && rswi.getInterface().eIsProxy() == false && rswi.getInterface() instanceof MSwInterface) { MSwInterface swi = (MSwInterface)rswi.getInterface(); params.addAll(mesputil.getAllParameters(swi)); } } if (switchCase.getPlatform() != null && switchCase.getPlatform().eIsProxy() == false) { params.addAll(mesputil.getParameters(switchCase.getPlatform())); params.addAll(getAllPlatformParameters(switchCase.getPlatform())); for (MSwPackageRequiredInterface rswi : switchCase.getPlatform().getRequires()) { if (rswi.getInterface() != null && rswi.getInterface().eIsProxy() == false && rswi.getInterface() instanceof MSwInterface) { MSwInterface swi = (MSwInterface)rswi; params.addAll(mesputil.getAllParameters(swi)); } } } params.remove(parameter); IScope innerScope = getFullObjectScope(params); if (parameter instanceof MEnumParamSWPSPSwitch) { MEnumParamSWPSPSwitch param = (MEnumParamSWPSPSwitch)parameter; if (param.getEnumDefinition() != null && param.getEnumDefinition().eIsProxy() == false) { return getSimpleObjectScope(param.getEnumDefinition().getLiterals(), innerScope); } } return innerScope; }
/** * Provides the scope for the referenceable objects that can be used * in the default value assignment expressions of parameter * depending on the supported platforms. * * @param pvaSwitchCase the platform-dependent value assignment expression. * @param reference the object representing the reference within the * given class. * @return the scope of the reference. */
Provides the scope for the referenceable objects that can be used in the default value assignment expressions of parameter depending on the supported platforms
scope_MParameterValueRefObject_object
{ "repo_name": "parraman/micobs", "path": "mesp/es.uah.aut.srg.micobs.mesp.editor.swp/src/es/uah/aut/srg/micobs/mesp/lang/scoping/SWPScopeProvider.java", "license": "epl-1.0", "size": 45945 }
[ "es.uah.aut.srg.micobs.common.MParameter", "es.uah.aut.srg.micobs.mesp.mespswi.MSwInterface", "es.uah.aut.srg.micobs.mesp.mespswp.MAbstractSwPackage", "es.uah.aut.srg.micobs.mesp.mespswp.MEnumParamSWPSPSwitch", "es.uah.aut.srg.micobs.mesp.mespswp.MParameterSWPSPSwitch", "es.uah.aut.srg.micobs.mesp.mespswp.MParameterSWPSPSwitchCase", "es.uah.aut.srg.micobs.mesp.mespswp.MSwPackage", "es.uah.aut.srg.micobs.mesp.mespswp.MSwPackageRequiredInterface", "java.util.Set", "org.eclipse.emf.ecore.EReference", "org.eclipse.xtext.scoping.IScope" ]
import es.uah.aut.srg.micobs.common.MParameter; import es.uah.aut.srg.micobs.mesp.mespswi.MSwInterface; import es.uah.aut.srg.micobs.mesp.mespswp.MAbstractSwPackage; import es.uah.aut.srg.micobs.mesp.mespswp.MEnumParamSWPSPSwitch; import es.uah.aut.srg.micobs.mesp.mespswp.MParameterSWPSPSwitch; import es.uah.aut.srg.micobs.mesp.mespswp.MParameterSWPSPSwitchCase; import es.uah.aut.srg.micobs.mesp.mespswp.MSwPackage; import es.uah.aut.srg.micobs.mesp.mespswp.MSwPackageRequiredInterface; import java.util.Set; import org.eclipse.emf.ecore.EReference; import org.eclipse.xtext.scoping.IScope;
import es.uah.aut.srg.micobs.common.*; import es.uah.aut.srg.micobs.mesp.mespswi.*; import es.uah.aut.srg.micobs.mesp.mespswp.*; import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.scoping.*;
[ "es.uah.aut", "java.util", "org.eclipse.emf", "org.eclipse.xtext" ]
es.uah.aut; java.util; org.eclipse.emf; org.eclipse.xtext;
2,320,468
public static String doGet(String coapURI) { // create a Coap client to make a request to the URI if (coapURI == null) { return null; } CoapClient client = new CoapClient(coapURI); CoapResponse response = client.get(MediaTypeRegistry.APPLICATION_JSON); // if the Coap request succeed, return the payload if (response.isSuccess()) { System.out.println("CoapProxy.doGet() : " + coapURI); return response.getResponseText(); } else { System.out.println("CoapProxy.doGet() : ERROR " + coapURI); } return null; }
static String function(String coapURI) { if (coapURI == null) { return null; } CoapClient client = new CoapClient(coapURI); CoapResponse response = client.get(MediaTypeRegistry.APPLICATION_JSON); if (response.isSuccess()) { System.out.println(STR + coapURI); return response.getResponseText(); } else { System.out.println(STR + coapURI); } return null; }
/** * method for performing a GET COAP request * * @param coapUri * - Uri for the coap request * @param returns * the Coap response */
method for performing a GET COAP request
doGet
{ "repo_name": "mertenats/heia", "path": "internet-applications/TP4/CoapProxy/src/ch/heiafr/tic/CoapWrapper.java", "license": "gpl-3.0", "size": 5558 }
[ "org.eclipse.californium.core.CoapClient", "org.eclipse.californium.core.CoapResponse", "org.eclipse.californium.core.coap.MediaTypeRegistry" ]
import org.eclipse.californium.core.CoapClient; import org.eclipse.californium.core.CoapResponse; import org.eclipse.californium.core.coap.MediaTypeRegistry;
import org.eclipse.californium.core.*; import org.eclipse.californium.core.coap.*;
[ "org.eclipse.californium" ]
org.eclipse.californium;
78,945
@Override public boolean registerTaskManager(final ResourceID resourceID) { componentMainThreadExecutor.assertRunningInMainThread(); log.debug("Register new TaskExecutor {}.", resourceID); return registeredTaskManagers.add(resourceID); }
boolean function(final ResourceID resourceID) { componentMainThreadExecutor.assertRunningInMainThread(); log.debug(STR, resourceID); return registeredTaskManagers.add(resourceID); }
/** * Register TaskManager to this pool, only those slots come from registered TaskManager will be considered valid. * Also it provides a way for us to keep "dead" or "abnormal" TaskManagers out of this pool. * * @param resourceID The id of the TaskManager */
Register TaskManager to this pool, only those slots come from registered TaskManager will be considered valid. Also it provides a way for us to keep "dead" or "abnormal" TaskManagers out of this pool
registerTaskManager
{ "repo_name": "gyfora/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java", "license": "apache-2.0", "size": 49781 }
[ "org.apache.flink.runtime.clusterframework.types.ResourceID" ]
import org.apache.flink.runtime.clusterframework.types.ResourceID;
import org.apache.flink.runtime.clusterframework.types.*;
[ "org.apache.flink" ]
org.apache.flink;
2,727,028
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<StreamResponse> submitBatchWithResponseAsync( String containerName, long contentLength, String multipartContentType, Flux<ByteBuffer> body, Integer timeout, String requestId, Context context) { final String restype = "container"; final String comp = "batch"; final String accept = "application/xml"; return service.submitBatch( this.client.getUrl(), containerName, restype, comp, contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<StreamResponse> function( String containerName, long contentLength, String multipartContentType, Flux<ByteBuffer> body, Integer timeout, String requestId, Context context) { final String restype = STR; final String comp = "batch"; final String accept = STR; return service.submitBatch( this.client.getUrl(), containerName, restype, comp, contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context); }
/** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_&lt;GUID&gt;. * @param body Initial data. * @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations"&gt;Setting * Timeouts for Blob Service Operations.&lt;/a&gt;. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */
The Batch operation allows multiple API calls to be embedded into a single HTTP request
submitBatchWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java", "license": "mit", "size": 69007 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.StreamResponse", "com.azure.core.util.Context", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.StreamResponse; import com.azure.core.util.Context; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import java.nio.*;
[ "com.azure.core", "java.nio" ]
com.azure.core; java.nio;
1,743,604
private void scheduleNextChunk() { synchronized (this) { if (scheduled) { // Dispatch task is already scheduled. return; } // Schedule the next response chunk if there is one. Chunk nextChunk = chunks.peek(); if (nextChunk != null) { scheduled = true; executor.schedule(dispatchTask, nextChunk.delayMicroseconds, TimeUnit.MICROSECONDS); return; } } if (isInputComplete) { // All of the response chunks have been enqueued but there is no chunks left. Close the // stream. responseStream.onCompleted(); } // Otherwise, the input is not yet complete - wait for more chunks to arrive. } }
void function() { synchronized (this) { if (scheduled) { return; } Chunk nextChunk = chunks.peek(); if (nextChunk != null) { scheduled = true; executor.schedule(dispatchTask, nextChunk.delayMicroseconds, TimeUnit.MICROSECONDS); return; } } if (isInputComplete) { responseStream.onCompleted(); } } }
/** * Schedules the next response chunk to be dispatched. If all input has been received and there * are no more chunks in the queue, the stream is closed. */
Schedules the next response chunk to be dispatched. If all input has been received and there are no more chunks in the queue, the stream is closed
scheduleNextChunk
{ "repo_name": "mingfly/grpc-java", "path": "interop-testing/src/main/java/io/grpc/testing/integration/TestServiceImpl.java", "license": "bsd-3-clause", "size": 15306 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,696,353
public static <T extends NamedElement> ElementMatcher.Junction<T> namedIgnoreCase(String name) { return new NameMatcher<T>(new StringMatcher(name, StringMatcher.Mode.EQUALS_FULLY_IGNORE_CASE)); }
static <T extends NamedElement> ElementMatcher.Junction<T> function(String name) { return new NameMatcher<T>(new StringMatcher(name, StringMatcher.Mode.EQUALS_FULLY_IGNORE_CASE)); }
/** * Matches a {@link NamedElement} for its name. The name's * capitalization is ignored. * * @param name The expected name. * @param <T> The type of the matched object. * @return An element matcher for a named element's name. */
Matches a <code>NamedElement</code> for its name. The name's capitalization is ignored
namedIgnoreCase
{ "repo_name": "DALDEI/byte-buddy", "path": "byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java", "license": "apache-2.0", "size": 103880 }
[ "net.bytebuddy.description.NamedElement" ]
import net.bytebuddy.description.NamedElement;
import net.bytebuddy.description.*;
[ "net.bytebuddy.description" ]
net.bytebuddy.description;
1,827,766
public static <T> T getAt(List<T> self, int idx) { int size = self.size(); int i = normaliseIndex(idx, size); if (i < size) { return self.get(i); } else { return null; } }
static <T> T function(List<T> self, int idx) { int size = self.size(); int i = normaliseIndex(idx, size); if (i < size) { return self.get(i); } else { return null; } }
/** * Support the subscript operator for a List. * <pre class="groovyTestCase">def list = [2, "a", 5.3] * assert list[1] == "a"</pre> * * @param self a List * @param idx an index * @return the value at the given index * @since 1.0 */
Support the subscript operator for a List. def list = [2, "a", 5.3] assert list[1] == "a"</code>
getAt
{ "repo_name": "armsargis/groovy", "path": "src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "apache-2.0", "size": 698233 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,497,077
@Override public Integer save(TOptionSettingsBean optionSettingsBean) { Criteria criteria = new Criteria(); if (optionSettingsBean!=null && optionSettingsBean.getObjectID()==null && optionSettingsBean.getConfig()!=null) { criteria.add(CONFIG, optionSettingsBean.getConfig()); if (optionSettingsBean.getParameterCode()==null) { criteria.add(PARAMETERCODE, (Object)null, Criteria.ISNULL); } else { criteria.add(PARAMETERCODE, optionSettingsBean.getParameterCode()); } try { doDelete(criteria); } catch (TorqueException e) { LOGGER.error("Deleting the old configuration objects failed with"); } } TOptionSettings tOptionSettings; try { tOptionSettings = BaseTOptionSettings.createTOptionSettings(optionSettingsBean); tOptionSettings.save(); return tOptionSettings.getObjectID(); } catch (Exception e) { LOGGER.error("Saving of an option settings failed with " + e.getMessage()); return null; } }
Integer function(TOptionSettingsBean optionSettingsBean) { Criteria criteria = new Criteria(); if (optionSettingsBean!=null && optionSettingsBean.getObjectID()==null && optionSettingsBean.getConfig()!=null) { criteria.add(CONFIG, optionSettingsBean.getConfig()); if (optionSettingsBean.getParameterCode()==null) { criteria.add(PARAMETERCODE, (Object)null, Criteria.ISNULL); } else { criteria.add(PARAMETERCODE, optionSettingsBean.getParameterCode()); } try { doDelete(criteria); } catch (TorqueException e) { LOGGER.error(STR); } } TOptionSettings tOptionSettings; try { tOptionSettings = BaseTOptionSettings.createTOptionSettings(optionSettingsBean); tOptionSettings.save(); return tOptionSettings.getObjectID(); } catch (Exception e) { LOGGER.error(STR + e.getMessage()); return null; } }
/** * Saves an optionSettingsBean in the TOptionSettings table * @param optionSettingsBean * @return */
Saves an optionSettingsBean in the TOptionSettings table
save
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/TOptionSettingsPeer.java", "license": "gpl-3.0", "size": 8743 }
[ "com.aurel.track.beans.TOptionSettingsBean", "org.apache.torque.TorqueException", "org.apache.torque.util.Criteria" ]
import com.aurel.track.beans.TOptionSettingsBean; import org.apache.torque.TorqueException; import org.apache.torque.util.Criteria;
import com.aurel.track.beans.*; import org.apache.torque.*; import org.apache.torque.util.*;
[ "com.aurel.track", "org.apache.torque" ]
com.aurel.track; org.apache.torque;
1,303,837
private boolean processCas(Object aCas) { if (!(aCas instanceof CasData)) // || skipIfCasEmpty == null) { return false; } if (DATACasUtils.isCasEmpty((CasData) aCas)) { return false; // dont process empty CAS'es } return hasFeature((CasData) aCas); }
boolean function(Object aCas) { if (!(aCas instanceof CasData)) { return false; } if (DATACasUtils.isCasEmpty((CasData) aCas)) { return false; } return hasFeature((CasData) aCas); }
/** * Checks if a given Cas has required features. * * @param aCas * - Cas instance to check * * @return - true if feature is in the Cas, false otherwise */
Checks if a given Cas has required features
processCas
{ "repo_name": "apache/uima-uimaj", "path": "uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ProcessingContainer_Impl.java", "license": "apache-2.0", "size": 60623 }
[ "org.apache.uima.cas_data.CasData", "org.apache.uima.collection.impl.cpm.vinci.DATACasUtils" ]
import org.apache.uima.cas_data.CasData; import org.apache.uima.collection.impl.cpm.vinci.DATACasUtils;
import org.apache.uima.cas_data.*; import org.apache.uima.collection.impl.cpm.vinci.*;
[ "org.apache.uima" ]
org.apache.uima;
2,832,763
@Override public List<HSSFHyperlink> getHyperlinkList() { final List<HSSFHyperlink> hyperlinkList = new ArrayList<>(); for (RecordBase rec : _sheet.getRecords()) { if (rec instanceof HyperlinkRecord) { HyperlinkRecord link = (HyperlinkRecord) rec; hyperlinkList.add(new HSSFHyperlink(link)); } } return hyperlinkList; }
List<HSSFHyperlink> function() { final List<HSSFHyperlink> hyperlinkList = new ArrayList<>(); for (RecordBase rec : _sheet.getRecords()) { if (rec instanceof HyperlinkRecord) { HyperlinkRecord link = (HyperlinkRecord) rec; hyperlinkList.add(new HSSFHyperlink(link)); } } return hyperlinkList; }
/** * Get a list of Hyperlinks in this sheet * * @return Hyperlinks for the sheet */
Get a list of Hyperlinks in this sheet
getHyperlinkList
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/poi/org/apache/poi/hssf/usermodel/HSSFSheet.java", "license": "gpl-2.0", "size": 94953 }
[ "java.util.ArrayList", "java.util.List", "org.apache.poi.hssf.record.HyperlinkRecord", "org.apache.poi.hssf.record.RecordBase" ]
import java.util.ArrayList; import java.util.List; import org.apache.poi.hssf.record.HyperlinkRecord; import org.apache.poi.hssf.record.RecordBase;
import java.util.*; import org.apache.poi.hssf.record.*;
[ "java.util", "org.apache.poi" ]
java.util; org.apache.poi;
2,619,538
public Observable<ServiceResponse<Page<SqlVirtualMachineGroupInner>>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<SqlVirtualMachineGroupInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * Gets all SQL virtual machine groups in a resource group. * ServiceResponse<PageImpl<SqlVirtualMachineGroupInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;SqlVirtualMachineGroupInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Gets all SQL virtual machine groups in a resource group
listByResourceGroupNextSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/sqlvirtualmachine/mgmt-v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sqlvirtualmachine/v2017_03_01_preview/implementation/SqlVirtualMachineGroupsInner.java", "license": "mit", "size": 82749 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
526,124
@Asynchronous public void loadOntologies(List<OntologyBean> setupOntologyList, boolean clear, User currentUser, Identity identity) { CurrentUserFactory currentUserFactory = (CurrentUserFactory) Component.getInstance("currentUserFactory"); currentUserFactory.setCurrentUser(currentUser); SystemStatus status = new SystemStatus("ontology import"); status.setId("ontology import"); status.setProgress(0); statusService.addSystemStatus(status); ReasoningService reasoner = (ReasoningService) Component.getInstance("kiwi.core.reasoningService"); boolean enabled = reasoner.isReasoningEnabled(); reasoner.disableReasoning(); try { Transaction.instance().setTransactionTimeout(60000); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { if(!Transaction.instance().isActive()) { Transaction.instance().begin(); transactionService.registerSynchronization( KiWiSynchronizationImpl.getInstance(), transactionService.getUserTransaction() ); } else { log.error("Another transaction has been active."); return; } } catch (SystemException e1) { e1.printStackTrace(); } catch (NotSupportedException e1) { e1.printStackTrace(); } log.info("current transaction: #0", Transaction.instance().hashCode()); if(clear) { // this is now transaction save importService.clearTripleStore(); } int progress = 0; int max = 0; for(OntologyBean ob : setupOntologyList) { if(ob.isLoad()) max++; } long time = 0; for(OntologyBean bean : setupOntologyList) { if(bean.isLoad()) { status.setMessage("Importing " + bean.getName()); log.info("loading ontology '#0'", bean.getName()); try { time = System.currentTimeMillis(); if(!Transaction.instance().isActive()) { Transaction.instance().begin(); transactionService.registerSynchronization( KiWiSynchronizationImpl.getInstance(), transactionService.getUserTransaction() ); } InputStream resourceStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(bean.getUri()); if(resourceStream == null) throw new KiWiImportException("The uri '" + bean.getUri() + "' couldn't be opened."); importService.importData(resourceStream, "application/rdf+xml", null, null, currentUser, null); // importService.importData(resourceStream, bean.getFormat()); Transaction.instance().commit(); log.info("loading the ontology '#0' finished (#1 ms).", bean.getName(), System.currentTimeMillis()-time); } catch(Exception ex) { log.error("Error importing the ontology '#0': #1", bean.getName(), ex.getMessage()); } progress ++; status.setProgress(100 * progress / max); } else { log.debug("not loading ontology '#0'", bean.getName()); } } reasoner.setReasoningEnabled(enabled); statusService.removeSystemStatus(status); try { if(Transaction.instance().isActive()) { Transaction.instance().commit(); } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } catch (RollbackException e) { e.printStackTrace(); } catch (HeuristicMixedException e) { e.printStackTrace(); } catch (HeuristicRollbackException e) { e.printStackTrace(); } reasoner.runEnqueuedTasks(); log.info("ontology import finished"); }
void function(List<OntologyBean> setupOntologyList, boolean clear, User currentUser, Identity identity) { CurrentUserFactory currentUserFactory = (CurrentUserFactory) Component.getInstance(STR); currentUserFactory.setCurrentUser(currentUser); SystemStatus status = new SystemStatus(STR); status.setId(STR); status.setProgress(0); statusService.addSystemStatus(status); ReasoningService reasoner = (ReasoningService) Component.getInstance(STR); boolean enabled = reasoner.isReasoningEnabled(); reasoner.disableReasoning(); try { Transaction.instance().setTransactionTimeout(60000); } catch (SystemException e) { e.printStackTrace(); } try { if(!Transaction.instance().isActive()) { Transaction.instance().begin(); transactionService.registerSynchronization( KiWiSynchronizationImpl.getInstance(), transactionService.getUserTransaction() ); } else { log.error(STR); return; } } catch (SystemException e1) { e1.printStackTrace(); } catch (NotSupportedException e1) { e1.printStackTrace(); } log.info(STR, Transaction.instance().hashCode()); if(clear) { importService.clearTripleStore(); } int progress = 0; int max = 0; for(OntologyBean ob : setupOntologyList) { if(ob.isLoad()) max++; } long time = 0; for(OntologyBean bean : setupOntologyList) { if(bean.isLoad()) { status.setMessage(STR + bean.getName()); log.info(STR, bean.getName()); try { time = System.currentTimeMillis(); if(!Transaction.instance().isActive()) { Transaction.instance().begin(); transactionService.registerSynchronization( KiWiSynchronizationImpl.getInstance(), transactionService.getUserTransaction() ); } InputStream resourceStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(bean.getUri()); if(resourceStream == null) throw new KiWiImportException(STR + bean.getUri() + STR); importService.importData(resourceStream, STR, null, null, currentUser, null); Transaction.instance().commit(); log.info(STR, bean.getName(), System.currentTimeMillis()-time); } catch(Exception ex) { log.error(STR, bean.getName(), ex.getMessage()); } progress ++; status.setProgress(100 * progress / max); } else { log.debug(STR, bean.getName()); } } reasoner.setReasoningEnabled(enabled); statusService.removeSystemStatus(status); try { if(Transaction.instance().isActive()) { Transaction.instance().commit(); } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } catch (RollbackException e) { e.printStackTrace(); } catch (HeuristicMixedException e) { e.printStackTrace(); } catch (HeuristicRollbackException e) { e.printStackTrace(); } reasoner.runEnqueuedTasks(); log.info(STR); }
/** * Imports ontologies into the system. The currentUser and the identity MUST be * given as a parameter to ensure, that the importer has the correct user, otherwise * the anonymous user would be used to import ontologies. * * @param setupOntologyList * @param clear * @param currentUser * @param identity */
Imports ontologies into the system. The currentUser and the identity MUST be given as a parameter to ensure, that the importer has the correct user, otherwise the anonymous user would be used to import ontologies
loadOntologies
{ "repo_name": "fregaham/KiWi", "path": "src/action/kiwi/action/setup/AsynchronousOntologyLoader.java", "license": "bsd-3-clause", "size": 7496 }
[ "java.io.InputStream", "java.util.List", "javax.transaction.HeuristicMixedException", "javax.transaction.HeuristicRollbackException", "javax.transaction.NotSupportedException", "javax.transaction.RollbackException", "javax.transaction.SystemException", "kiwi.api.reasoning.ReasoningService", "kiwi.api.setup.OntologyBean", "kiwi.context.CurrentUserFactory", "kiwi.model.status.SystemStatus", "kiwi.model.user.User", "kiwi.service.importexport.KiWiImportException", "kiwi.service.transaction.KiWiSynchronizationImpl", "org.jboss.seam.Component", "org.jboss.seam.security.Identity", "org.jboss.seam.transaction.Transaction" ]
import java.io.InputStream; import java.util.List; import javax.transaction.HeuristicMixedException; import javax.transaction.HeuristicRollbackException; import javax.transaction.NotSupportedException; import javax.transaction.RollbackException; import javax.transaction.SystemException; import kiwi.api.reasoning.ReasoningService; import kiwi.api.setup.OntologyBean; import kiwi.context.CurrentUserFactory; import kiwi.model.status.SystemStatus; import kiwi.model.user.User; import kiwi.service.importexport.KiWiImportException; import kiwi.service.transaction.KiWiSynchronizationImpl; import org.jboss.seam.Component; import org.jboss.seam.security.Identity; import org.jboss.seam.transaction.Transaction;
import java.io.*; import java.util.*; import javax.transaction.*; import kiwi.api.reasoning.*; import kiwi.api.setup.*; import kiwi.context.*; import kiwi.model.status.*; import kiwi.model.user.*; import kiwi.service.importexport.*; import kiwi.service.transaction.*; import org.jboss.seam.*; import org.jboss.seam.security.*; import org.jboss.seam.transaction.*;
[ "java.io", "java.util", "javax.transaction", "kiwi.api.reasoning", "kiwi.api.setup", "kiwi.context", "kiwi.model.status", "kiwi.model.user", "kiwi.service.importexport", "kiwi.service.transaction", "org.jboss.seam" ]
java.io; java.util; javax.transaction; kiwi.api.reasoning; kiwi.api.setup; kiwi.context; kiwi.model.status; kiwi.model.user; kiwi.service.importexport; kiwi.service.transaction; org.jboss.seam;
352,468
public static Set<Double> toSet(double... array) { PreCon.notNull(array); HashSet<Double> result = new HashSet<>(array.length + 5); for (double b : array) { result.add(b); } return result; }
static Set<Double> function(double... array) { PreCon.notNull(array); HashSet<Double> result = new HashSet<>(array.length + 5); for (double b : array) { result.add(b); } return result; }
/** * Convert an array to a {@link java.util.Set}. * * @param array The array to convert. */
Convert an array to a <code>java.util.Set</code>
toSet
{ "repo_name": "JCThePants/NucleusFramework", "path": "src/com/jcwhatever/nucleus/utils/ArrayUtils.java", "license": "mit", "size": 83295 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,472,208
public static boolean allowListExport() { return getBooleanProperty(DynamoConstants.SP_ALLOW_LIST_EXPORT, null); }
static boolean function() { return getBooleanProperty(DynamoConstants.SP_ALLOW_LIST_EXPORT, null); }
/** * Returns whether export of grid contents to Excel/CSV is allowed. This system * property can be used to either enable or disable this on the application * level. * * @return */
Returns whether export of grid contents to Excel/CSV is allowed. This system property can be used to either enable or disable this on the application level
allowListExport
{ "repo_name": "opencirclesolutions/dynamo", "path": "dynamo-api/src/main/java/com/ocs/dynamo/util/SystemPropertyUtils.java", "license": "apache-2.0", "size": 11653 }
[ "com.ocs.dynamo.constants.DynamoConstants" ]
import com.ocs.dynamo.constants.DynamoConstants;
import com.ocs.dynamo.constants.*;
[ "com.ocs.dynamo" ]
com.ocs.dynamo;
1,349,555
public RexNode and(Iterable<? extends RexNode> operands) { return RexUtil.composeConjunction(cluster.getRexBuilder(), operands); }
RexNode function(Iterable<? extends RexNode> operands) { return RexUtil.composeConjunction(cluster.getRexBuilder(), operands); }
/** Creates an AND. * * <p>Simplifies the expression a little: * {@code e AND TRUE} becomes {@code e}; * {@code e AND e2 AND NOT e} becomes {@code e2}. */
Creates an AND. Simplifies the expression a little: e AND TRUE becomes e
and
{ "repo_name": "nishantmonu51/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveSubQRemoveRelBuilder.java", "license": "apache-2.0", "size": 62589 }
[ "org.apache.calcite.rex.RexNode", "org.apache.calcite.rex.RexUtil" ]
import org.apache.calcite.rex.RexNode; import org.apache.calcite.rex.RexUtil;
import org.apache.calcite.rex.*;
[ "org.apache.calcite" ]
org.apache.calcite;
2,519,194
@Override public Adapter createApplicationInstanceAdapter() { if (applicationInstanceItemProvider == null) { applicationInstanceItemProvider = new ApplicationInstanceItemProvider(this); } return applicationInstanceItemProvider; } protected RequestItemProvider requestItemProvider;
Adapter function() { if (applicationInstanceItemProvider == null) { applicationInstanceItemProvider = new ApplicationInstanceItemProvider(this); } return applicationInstanceItemProvider; } protected RequestItemProvider requestItemProvider;
/** * This creates an adapter for a {@link org.eclipse.incquery.examples.cps.cyberPhysicalSystem.ApplicationInstance}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This creates an adapter for a <code>org.eclipse.incquery.examples.cps.cyberPhysicalSystem.ApplicationInstance</code>.
createApplicationInstanceAdapter
{ "repo_name": "ZsoltKovari/incquery-examples-cps", "path": "domains/org.eclipse.incquery.examples.cps.model.edit/src/org/eclipse/incquery/examples/cps/cyberPhysicalSystem/provider/CyberPhysicalSystemItemProviderAdapterFactory.java", "license": "epl-1.0", "size": 13614 }
[ "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;
2,239,743
public CountDownLatch getEntityAsync(String entityListFullName, String id, AsyncCallback<com.fasterxml.jackson.databind.JsonNode> callback) throws Exception { return getEntityAsync( entityListFullName, id, null, callback); }
CountDownLatch function(String entityListFullName, String id, AsyncCallback<com.fasterxml.jackson.databind.JsonNode> callback) throws Exception { return getEntityAsync( entityListFullName, id, null, callback); }
/** * Retrieves an entity with an associated entity list and context level at tenant, master catalog, catalog, or site. * <p><pre><code> * Entity entity = new Entity(); * CountDownLatch latch = entity.getEntity( entityListFullName, id, callback ); * latch.await() * </code></pre></p> * @param entityListFullName The full name of the EntityList including namespace in name@nameSpace format * @param id Unique identifier of the customer segment to retrieve. * @param callback callback handler for asynchronous operations * @return JObject * @see JObject */
Retrieves an entity with an associated entity list and context level at tenant, master catalog, catalog, or site. <code><code> Entity entity = new Entity(); CountDownLatch latch = entity.getEntity( entityListFullName, id, callback ); latch.await() * </code></code>
getEntityAsync
{ "repo_name": "sanjaymandadi/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/platform/entitylists/EntityResource.java", "license": "mit", "size": 19390 }
[ "com.mozu.api.AsyncCallback", "java.util.concurrent.CountDownLatch" ]
import com.mozu.api.AsyncCallback; import java.util.concurrent.CountDownLatch;
import com.mozu.api.*; import java.util.concurrent.*;
[ "com.mozu.api", "java.util" ]
com.mozu.api; java.util;
190,137
RemoteAsyncResult exportObject() throws RemoteException { ivObjectID = ivRemoteRuntime.activateAsyncResult((Servant) createTie()); return ivRemoteRuntime.getAsyncResultReference(ivObjectID); }
RemoteAsyncResult exportObject() throws RemoteException { ivObjectID = ivRemoteRuntime.activateAsyncResult((Servant) createTie()); return ivRemoteRuntime.getAsyncResultReference(ivObjectID); }
/** * Export this object so that it is remotely accessible. * * <p>This method must be called before the async work is scheduled. */
Export this object so that it is remotely accessible. This method must be called before the async work is scheduled
exportObject
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java", "license": "epl-1.0", "size": 10999 }
[ "com.ibm.ejs.container.RemoteAsyncResult", "java.rmi.RemoteException", "org.omg.PortableServer" ]
import com.ibm.ejs.container.RemoteAsyncResult; import java.rmi.RemoteException; import org.omg.PortableServer;
import com.ibm.ejs.container.*; import java.rmi.*; import org.omg.*;
[ "com.ibm.ejs", "java.rmi", "org.omg" ]
com.ibm.ejs; java.rmi; org.omg;
481,490
@Test(expected = AccountNotFoundException.class) public void isExceptionThrownWhenTryModifyAccountThatDoesntExist() throws AccountAlreadyExistsException, AccountNotFoundException { instance.updateAccount(USERNAME, NONEXISTENT, walletAccount); }
@Test(expected = AccountNotFoundException.class) void function() throws AccountAlreadyExistsException, AccountNotFoundException { instance.updateAccount(USERNAME, NONEXISTENT, walletAccount); }
/** * Method updateAccount should throws AccountNotFoundException when the account with given name * doesn't exist. * * @throws AccountAlreadyExistsException * @throws AccountNotFoundException */
Method updateAccount should throws AccountNotFoundException when the account with given name doesn't exist
isExceptionThrownWhenTryModifyAccountThatDoesntExist
{ "repo_name": "mariuszfoltak/my-budget", "path": "server/src/test/java/pl/foltak/mybudget/server/dao/MyBudgetDaoAccountTest.java", "license": "gpl-2.0", "size": 7237 }
[ "org.junit.Test", "pl.foltak.mybudget.server.dao.exception.AccountAlreadyExistsException", "pl.foltak.mybudget.server.dao.exception.AccountNotFoundException" ]
import org.junit.Test; import pl.foltak.mybudget.server.dao.exception.AccountAlreadyExistsException; import pl.foltak.mybudget.server.dao.exception.AccountNotFoundException;
import org.junit.*; import pl.foltak.mybudget.server.dao.exception.*;
[ "org.junit", "pl.foltak.mybudget" ]
org.junit; pl.foltak.mybudget;
847,177
static <K, V> void populateMap(Map<K, V> map, ObjectInputStream stream, int size) throws IOException, ClassNotFoundException { for (int i = 0; i < size; i++) { @SuppressWarnings("unchecked") // reading data stored by writeMap K key = (K) stream.readObject(); @SuppressWarnings("unchecked") // reading data stored by writeMap V value = (V) stream.readObject(); map.put(key, value); } }
static <K, V> void populateMap(Map<K, V> map, ObjectInputStream stream, int size) throws IOException, ClassNotFoundException { for (int i = 0; i < size; i++) { @SuppressWarnings(STR) K key = (K) stream.readObject(); @SuppressWarnings(STR) V value = (V) stream.readObject(); map.put(key, value); } }
/** * Populates a map by reading an input stream, as part of deserialization. * See {@link #writeMap} for the data format. The size is determined by a * prior call to {@link #readCount}. */
Populates a map by reading an input stream, as part of deserialization. See <code>#writeMap</code> for the data format. The size is determined by a prior call to <code>#readCount</code>
populateMap
{ "repo_name": "mike10004/appengine-imaging", "path": "gaecompat-awt-imaging/src/common/com/gaecompat/repackaged/com/google/common/collect/Serialization.java", "license": "apache-2.0", "size": 8363 }
[ "java.io.IOException", "java.io.ObjectInputStream", "java.util.Map" ]
import java.io.IOException; import java.io.ObjectInputStream; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
216,307
private void refreshMetadataCache(final Queue<MetadataSystem> metadataSystemCache, final DecompilerSettings settings) { metadataSystemCache.clear(); for (int i = 0; i < this.getNumberOfThreads(); i++) { metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoader())); } } private class DecompileExecutor extends Thread { private DecompilerSettings settings; private MetadataSystem metadataSystem; private String typeName; private Exception e; private File outputFile; private boolean success; public DecompileExecutor(DecompilerSettings settings, MetadataSystem metadataSystem, String typeName) { this.settings = settings; this.metadataSystem = metadataSystem; this.typeName = typeName; setDaemon(true); }
void function(final Queue<MetadataSystem> metadataSystemCache, final DecompilerSettings settings) { metadataSystemCache.clear(); for (int i = 0; i < this.getNumberOfThreads(); i++) { metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoader())); } } private class DecompileExecutor extends Thread { private DecompilerSettings settings; private MetadataSystem metadataSystem; private String typeName; private Exception e; private File outputFile; private boolean success; public DecompileExecutor(DecompilerSettings settings, MetadataSystem metadataSystem, String typeName) { this.settings = settings; this.metadataSystem = metadataSystem; this.typeName = typeName; setDaemon(true); }
/** * The metadata cache can become huge over time. This simply flushes it periodically. */
The metadata cache can become huge over time. This simply flushes it periodically
refreshMetadataCache
{ "repo_name": "OndraZizka/windup", "path": "decompiler/impl-procyon/src/main/java/org/jboss/windup/decompiler/procyon/ProcyonDecompiler.java", "license": "epl-1.0", "size": 29948 }
[ "com.strobel.assembler.metadata.MetadataSystem", "com.strobel.assembler.metadata.NoRetryMetadataSystem", "com.strobel.decompiler.DecompilerSettings", "java.io.File", "java.util.Queue" ]
import com.strobel.assembler.metadata.MetadataSystem; import com.strobel.assembler.metadata.NoRetryMetadataSystem; import com.strobel.decompiler.DecompilerSettings; import java.io.File; import java.util.Queue;
import com.strobel.assembler.metadata.*; import com.strobel.decompiler.*; import java.io.*; import java.util.*;
[ "com.strobel.assembler", "com.strobel.decompiler", "java.io", "java.util" ]
com.strobel.assembler; com.strobel.decompiler; java.io; java.util;
453,937
omitProperties = true; return this; } /** * Tells GSON to parse properties in a {@link Message} * * @return the newly configured {@link MessageTypeAdapterFactory}
omitProperties = true; return this; } /** * Tells GSON to parse properties in a {@link Message} * * @return the newly configured {@link MessageTypeAdapterFactory}
/** * Tells GSON to skip parsing properties in a {@link Message} * * @return the newly configured {@link MessageTypeAdapterFactory} */
Tells GSON to skip parsing properties in a <code>Message</code>
omitParsingProperties
{ "repo_name": "zoozooll/MyExercise", "path": "meep/Meep/src/com/oregonscientific/meep/msm/internal/MessageTypeAdapterFactory.java", "license": "apache-2.0", "size": 6455 }
[ "com.oregonscientific.meep.msm.Message" ]
import com.oregonscientific.meep.msm.Message;
import com.oregonscientific.meep.msm.*;
[ "com.oregonscientific.meep" ]
com.oregonscientific.meep;
910,916
public Observable<ServiceResponse<Void>> beginDeleteWithServiceResponseAsync(String resourceGroupName, String name, Boolean forceDelete) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); }
Observable<ServiceResponse<Void>> function(String resourceGroupName, String name, Boolean forceDelete) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (name == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); }
/** * Delete an App Service Environment. * Delete an App Service Environment. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service Environment. * @param forceDelete Specify &lt;code&gt;true&lt;/code&gt; to force the deletion even if the App Service Environment contains resources. The default is &lt;code&gt;false&lt;/code&gt;. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */
Delete an App Service Environment. Delete an App Service Environment
beginDeleteWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/appservice/mgmt-v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java", "license": "mit", "size": 595166 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,234,474
public void addChangeListener(ChangeListener l) { changeListeners.add(l); }
void function(ChangeListener l) { changeListeners.add(l); }
/** * Adds the listener to the internal set of listeners. Gets notified when * the option string changes. * * @param l the listener to add */
Adds the listener to the internal set of listeners. Gets notified when the option string changes
addChangeListener
{ "repo_name": "gditzler/MassiveOnlineAnalysis", "path": "moa/src/moa-2013.08-sources/moa-src/src/main/java/moa/gui/ClassOptionEditComponent.java", "license": "gpl-3.0", "size": 4390 }
[ "javax.swing.event.ChangeListener" ]
import javax.swing.event.ChangeListener;
import javax.swing.event.*;
[ "javax.swing" ]
javax.swing;
34,060
public boolean onCustomEvent(DiscoveryCustomMessage msg, AffinityTopologyVersion topVer, ClusterNode node) { if (msg instanceof SchemaAbstractDiscoveryMessage) { ctx.query().onDiscovery((SchemaAbstractDiscoveryMessage)msg); return false; } if (msg instanceof CacheAffinityChangeMessage) return sharedCtx.affinity().onCustomEvent(((CacheAffinityChangeMessage)msg)); if (msg instanceof SnapshotDiscoveryMessage && ((SnapshotDiscoveryMessage)msg).needExchange()) return true; if (msg instanceof WalStateAbstractMessage) { WalStateAbstractMessage msg0 = (WalStateAbstractMessage)msg; if (msg0 instanceof WalStateProposeMessage) sharedCtx.walState().onProposeDiscovery((WalStateProposeMessage)msg); else if (msg0 instanceof WalStateFinishMessage) sharedCtx.walState().onFinishDiscovery((WalStateFinishMessage)msg); return msg0.needExchange(); } if (msg instanceof DynamicCacheChangeBatch) { boolean changeRequested = cachesInfo.onCacheChangeRequested((DynamicCacheChangeBatch)msg, topVer); ctx.query().onCacheChangeRequested((DynamicCacheChangeBatch)msg); return changeRequested; } if (msg instanceof DynamicCacheChangeFailureMessage) cachesInfo.onCacheChangeRequested((DynamicCacheChangeFailureMessage)msg, topVer); if (msg instanceof ClientCacheChangeDiscoveryMessage) cachesInfo.onClientCacheChange((ClientCacheChangeDiscoveryMessage)msg, node); if (msg instanceof CacheStatisticsModeChangeMessage) onCacheStatisticsModeChange((CacheStatisticsModeChangeMessage)msg); if (msg instanceof CacheStatisticsClearMessage) onCacheStatisticsClear((CacheStatisticsClearMessage)msg); if (msg instanceof TxTimeoutOnPartitionMapExchangeChangeMessage) sharedCtx.tm().onTxTimeoutOnPartitionMapExchangeChange((TxTimeoutOnPartitionMapExchangeChangeMessage)msg); return false; }
boolean function(DiscoveryCustomMessage msg, AffinityTopologyVersion topVer, ClusterNode node) { if (msg instanceof SchemaAbstractDiscoveryMessage) { ctx.query().onDiscovery((SchemaAbstractDiscoveryMessage)msg); return false; } if (msg instanceof CacheAffinityChangeMessage) return sharedCtx.affinity().onCustomEvent(((CacheAffinityChangeMessage)msg)); if (msg instanceof SnapshotDiscoveryMessage && ((SnapshotDiscoveryMessage)msg).needExchange()) return true; if (msg instanceof WalStateAbstractMessage) { WalStateAbstractMessage msg0 = (WalStateAbstractMessage)msg; if (msg0 instanceof WalStateProposeMessage) sharedCtx.walState().onProposeDiscovery((WalStateProposeMessage)msg); else if (msg0 instanceof WalStateFinishMessage) sharedCtx.walState().onFinishDiscovery((WalStateFinishMessage)msg); return msg0.needExchange(); } if (msg instanceof DynamicCacheChangeBatch) { boolean changeRequested = cachesInfo.onCacheChangeRequested((DynamicCacheChangeBatch)msg, topVer); ctx.query().onCacheChangeRequested((DynamicCacheChangeBatch)msg); return changeRequested; } if (msg instanceof DynamicCacheChangeFailureMessage) cachesInfo.onCacheChangeRequested((DynamicCacheChangeFailureMessage)msg, topVer); if (msg instanceof ClientCacheChangeDiscoveryMessage) cachesInfo.onClientCacheChange((ClientCacheChangeDiscoveryMessage)msg, node); if (msg instanceof CacheStatisticsModeChangeMessage) onCacheStatisticsModeChange((CacheStatisticsModeChangeMessage)msg); if (msg instanceof CacheStatisticsClearMessage) onCacheStatisticsClear((CacheStatisticsClearMessage)msg); if (msg instanceof TxTimeoutOnPartitionMapExchangeChangeMessage) sharedCtx.tm().onTxTimeoutOnPartitionMapExchangeChange((TxTimeoutOnPartitionMapExchangeChangeMessage)msg); return false; }
/** * Callback invoked from discovery thread when discovery custom message is received. * * @param msg Customer message. * @param topVer Current topology version. * @param node Node sent message. * @return {@code True} if minor topology version should be increased. */
Callback invoked from discovery thread when discovery custom message is received
onCustomEvent
{ "repo_name": "SomeFire/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java", "license": "apache-2.0", "size": 207339 }
[ "org.apache.ignite.cluster.ClusterNode", "org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage", "org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion", "org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDiscoveryMessage", "org.apache.ignite.internal.processors.query.schema.message.SchemaAbstractDiscoveryMessage" ]
import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDiscoveryMessage; import org.apache.ignite.internal.processors.query.schema.message.SchemaAbstractDiscoveryMessage;
import org.apache.ignite.cluster.*; import org.apache.ignite.internal.managers.discovery.*; import org.apache.ignite.internal.processors.affinity.*; import org.apache.ignite.internal.processors.cache.persistence.snapshot.*; import org.apache.ignite.internal.processors.query.schema.message.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,420,351
public BlockInputStreams getTmpInputStreams(Block b, long blkoff, long ckoff) throws IOException; static class BlockWriteStreams { OutputStream dataOut; OutputStream checksumOut; BlockWriteStreams(OutputStream dOut, OutputStream cOut) { dataOut = dOut; checksumOut = cOut; } } static class BlockInputStreams implements Closeable { final InputStream dataIn; final InputStream checksumIn; BlockInputStreams(InputStream dataIn, InputStream checksumIn) { this.dataIn = dataIn; this.checksumIn = checksumIn; }
BlockInputStreams function(Block b, long blkoff, long ckoff) throws IOException; static class BlockWriteStreams { OutputStream dataOut; OutputStream checksumOut; BlockWriteStreams(OutputStream dOut, OutputStream cOut) { dataOut = dOut; checksumOut = cOut; } } static class BlockInputStreams implements Closeable { final InputStream dataIn; final InputStream checksumIn; BlockInputStreams(InputStream dataIn, InputStream checksumIn) { this.dataIn = dataIn; this.checksumIn = checksumIn; }
/** * Returns an input stream at specified offset of the specified block * The block is still in the tmp directory and is not finalized * @param b * @param blkoff * @param ckoff * @return an input stream to read the contents of the specified block, * starting at the offset * @throws IOException */
Returns an input stream at specified offset of the specified block The block is still in the tmp directory and is not finalized
getTmpInputStreams
{ "repo_name": "baggioss/hadoop-with-transparentcompress", "path": "src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java", "license": "apache-2.0", "size": 8180 }
[ "java.io.Closeable", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream", "org.apache.hadoop.hdfs.protocol.Block" ]
import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.hadoop.hdfs.protocol.Block;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
597,426
Collection<TPolicy> list();
Collection<TPolicy> list();
/** * List the policies * * @return policy list */
List the policies
list
{ "repo_name": "KromatikSolutions/dasshy", "path": "dasshy-server/src/main/java/com/kromatik/dasshy/server/dao/PolicyDao.java", "license": "gpl-3.0", "size": 1619 }
[ "com.kromatik.dasshy.thrift.model.TPolicy", "java.util.Collection" ]
import com.kromatik.dasshy.thrift.model.TPolicy; import java.util.Collection;
import com.kromatik.dasshy.thrift.model.*; import java.util.*;
[ "com.kromatik.dasshy", "java.util" ]
com.kromatik.dasshy; java.util;
1,719,922
public int compare(final Object a_program1, final Object a_program2) { IGPProgram progOne = (IGPProgram) a_program1; IGPProgram progTwo = (IGPProgram) a_program2; if (m_fitnessEvaluator.isFitter(progOne, progTwo)) { return -1; } else if (m_fitnessEvaluator.isFitter(progTwo, progOne)) { return 1; } else { return 0; } }
int function(final Object a_program1, final Object a_program2) { IGPProgram progOne = (IGPProgram) a_program1; IGPProgram progTwo = (IGPProgram) a_program2; if (m_fitnessEvaluator.isFitter(progOne, progTwo)) { return -1; } else if (m_fitnessEvaluator.isFitter(progTwo, progOne)) { return 1; } else { return 0; } }
/** * Compares two programs by using a FitnessEvaluator. * * @param a_program1 the first program to compare * @param a_program2 the second program to compare * @return -1 if a_program1 is fitter than a_program2, 1 if it is the other * way round and 0 if both are equal * * @author Klaus Meffert * @since 3.0 */
Compares two programs by using a FitnessEvaluator
compare
{ "repo_name": "jsubercaze/parallelJGAP", "path": "src/main/java/org/jgap/gp/impl/GPProgramFitnessComparator.java", "license": "lgpl-2.1", "size": 2381 }
[ "org.jgap.gp.IGPProgram" ]
import org.jgap.gp.IGPProgram;
import org.jgap.gp.*;
[ "org.jgap.gp" ]
org.jgap.gp;
90,145
@FIXVersion(introduced = "4.3") @TagNumRef(tagNum = TagNum.SettlType) public String getSettlType() { return settlType; }
@FIXVersion(introduced = "4.3") @TagNumRef(tagNum = TagNum.SettlType) String function() { return settlType; }
/** * Message field getter. * @return field value */
Message field getter
getSettlType
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/group/QuoteRequestRejectGroup.java", "license": "gpl-3.0", "size": 50378 }
[ "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.TagNum" ]
import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum;
import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*;
[ "net.hades.fix" ]
net.hades.fix;
1,896,676
public static ClusterGroupEmptyCheckedException emptyTopologyException() { return new ClusterGroupEmptyCheckedException("Cluster group is empty."); }
static ClusterGroupEmptyCheckedException function() { return new ClusterGroupEmptyCheckedException(STR); }
/** * Creates appropriate empty projection exception. * * @return Empty projection exception. */
Creates appropriate empty projection exception
emptyTopologyException
{ "repo_name": "apache/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 387878 }
[ "org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException" ]
import org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException;
import org.apache.ignite.internal.cluster.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,234,754
public static void deleteTable( Connection con, String schema, String table ) { LOG.log( Level.INFO, () -> "Deleting " + schema + "." + table ); try( Statement s = con.createStatement() ) { s.execute( "DELETE FROM " + schema + "." + table ); } catch( SQLException ex ) { throw new UncheckedSQLException( ex ); } }
static void function( Connection con, String schema, String table ) { LOG.log( Level.INFO, () -> STR + schema + "." + table ); try( Statement s = con.createStatement() ) { s.execute( STR + schema + "." + table ); } catch( SQLException ex ) { throw new UncheckedSQLException( ex ); } }
/** * Delete the contents of a table * <p> * @param con Connection * @param schema Database schema * @param table Table name */
Delete the contents of a table
deleteTable
{ "repo_name": "peter-mount/opendata-common", "path": "core/src/main/java/uk/trainwatch/util/sql/SQL.java", "license": "apache-2.0", "size": 15799 }
[ "java.sql.Connection", "java.sql.SQLException", "java.sql.Statement", "java.util.logging.Level" ]
import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level;
import java.sql.*; import java.util.logging.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
74,809
protected static void setDistributionManagerType(int vmType) { switch (vmType) { case NORMAL_DM_TYPE: case LONER_DM_TYPE: case ADMIN_ONLY_DM_TYPE: case LOCATOR_DM_TYPE: distributionManagerType.set(Integer.valueOf(vmType)); break; default: throw new IllegalArgumentException(LocalizedStrings.DistributionManager_UNKNOWN_DISTRIBUTIONMANAGERTYPE_0.toLocalizedString(Integer.valueOf(vmType))); } } /** * Returns the DistributionManager type which should match {@link * #NORMAL_DM_TYPE}, {@link #ADMIN_ONLY_DM_TYPE}, {@link #LOCATOR_DM_TYPE}
static void function(int vmType) { switch (vmType) { case NORMAL_DM_TYPE: case LONER_DM_TYPE: case ADMIN_ONLY_DM_TYPE: case LOCATOR_DM_TYPE: distributionManagerType.set(Integer.valueOf(vmType)); break; default: throw new IllegalArgumentException(LocalizedStrings.DistributionManager_UNKNOWN_DISTRIBUTIONMANAGERTYPE_0.toLocalizedString(Integer.valueOf(vmType))); } } /** * Returns the DistributionManager type which should match { * #NORMAL_DM_TYPE}, {@link #ADMIN_ONLY_DM_TYPE}, {@link #LOCATOR_DM_TYPE}
/** * Sets the distribution manager's type (using an InheritableThreadLocal). * * @since 3.5 */
Sets the distribution manager's type (using an InheritableThreadLocal)
setDistributionManagerType
{ "repo_name": "fengshao0907/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java", "license": "apache-2.0", "size": 176212 }
[ "com.gemstone.gemfire.internal.i18n.LocalizedStrings" ]
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.i18n.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
2,507,981
long averageLong(Queryable<T> source, FunctionExpression<LongFunction1<T>> selector);
long averageLong(Queryable<T> source, FunctionExpression<LongFunction1<T>> selector);
/** * Computes the average of a sequence of long values * that is obtained by invoking a projection function on each * element of the input sequence. */
Computes the average of a sequence of long values that is obtained by invoking a projection function on each element of the input sequence
averageLong
{ "repo_name": "YrAuYong/incubator-calcite", "path": "linq4j/src/main/java/org/apache/calcite/linq4j/QueryableFactory.java", "license": "apache-2.0", "size": 27890 }
[ "org.apache.calcite.linq4j.function.LongFunction1", "org.apache.calcite.linq4j.tree.FunctionExpression" ]
import org.apache.calcite.linq4j.function.LongFunction1; import org.apache.calcite.linq4j.tree.FunctionExpression;
import org.apache.calcite.linq4j.function.*; import org.apache.calcite.linq4j.tree.*;
[ "org.apache.calcite" ]
org.apache.calcite;
2,326,802
String command = (String) msg; if (command.startsWith("get ")) { String key = command.substring("get ".length()); BinaryMemcacheRequest req = new DefaultBinaryMemcacheRequest(key); req.setOpcode(BinaryMemcacheOpcodes.GET); req.setKeyLength((short) key.length()); req.setTotalBodyLength(key.length()); ctx.write(req, promise); } else if (command.startsWith("set ")) { String[] parts = command.split(" ", 3); if (parts.length < 3) { throw new IllegalArgumentException("Malformed Command: " + command); } String key = parts[1]; String value = parts[2]; ByteBuf content = Unpooled.wrappedBuffer(value.getBytes(CharsetUtil.UTF_8)); ByteBuf extras = ctx.alloc().buffer(8); BinaryMemcacheRequest req = new DefaultFullBinaryMemcacheRequest(key, extras, content); req.setOpcode(BinaryMemcacheOpcodes.SET); req.setKeyLength((short) key.length()); req.setExtrasLength((byte) 8); req.setTotalBodyLength(key.length() + 8 + value.length()); ctx.write(req, promise); } else { throw new IllegalStateException("Unknown Message: " + msg); } }
String command = (String) msg; if (command.startsWith(STR)) { String key = command.substring(STR.length()); BinaryMemcacheRequest req = new DefaultBinaryMemcacheRequest(key); req.setOpcode(BinaryMemcacheOpcodes.GET); req.setKeyLength((short) key.length()); req.setTotalBodyLength(key.length()); ctx.write(req, promise); } else if (command.startsWith(STR)) { String[] parts = command.split(" ", 3); if (parts.length < 3) { throw new IllegalArgumentException(STR + command); } String key = parts[1]; String value = parts[2]; ByteBuf content = Unpooled.wrappedBuffer(value.getBytes(CharsetUtil.UTF_8)); ByteBuf extras = ctx.alloc().buffer(8); BinaryMemcacheRequest req = new DefaultFullBinaryMemcacheRequest(key, extras, content); req.setOpcode(BinaryMemcacheOpcodes.SET); req.setKeyLength((short) key.length()); req.setExtrasLength((byte) 8); req.setTotalBodyLength(key.length() + 8 + value.length()); ctx.write(req, promise); } else { throw new IllegalStateException(STR + msg); } }
/** * Transforms basic string requests to binary memcache requests */
Transforms basic string requests to binary memcache requests
write
{ "repo_name": "XClouded/t4f-core", "path": "java/io/src/main/tmp/netty5/memcache/binary/MemcacheClientHandler.java", "license": "apache-2.0", "size": 3251 }
[ "io.netty.buffer.ByteBuf", "io.netty.buffer.Unpooled", "io.netty.handler.codec.memcache.binary.BinaryMemcacheOpcodes", "io.netty.handler.codec.memcache.binary.BinaryMemcacheRequest", "io.netty.handler.codec.memcache.binary.DefaultBinaryMemcacheRequest", "io.netty.handler.codec.memcache.binary.DefaultFullBinaryMemcacheRequest", "io.netty.util.CharsetUtil" ]
import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.memcache.binary.BinaryMemcacheOpcodes; import io.netty.handler.codec.memcache.binary.BinaryMemcacheRequest; import io.netty.handler.codec.memcache.binary.DefaultBinaryMemcacheRequest; import io.netty.handler.codec.memcache.binary.DefaultFullBinaryMemcacheRequest; import io.netty.util.CharsetUtil;
import io.netty.buffer.*; import io.netty.handler.codec.memcache.binary.*; import io.netty.util.*;
[ "io.netty.buffer", "io.netty.handler", "io.netty.util" ]
io.netty.buffer; io.netty.handler; io.netty.util;
2,106,552
private int addNewTerminalView(TerminalBridge bridge) { // let them know about our prompt handler services bridge.promptHelper.setHandler(promptHandler); // inflate each terminal view RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.item_terminal, flip, false); // set the terminal overlay text TextView overlay = (TextView) view.findViewById(R.id.terminal_overlay); overlay.setText(bridge.host.getNickname()); // and add our terminal view control, using index to place behind // overlay TerminalView terminal = new TerminalView(ConsoleActivity.this, bridge); terminal.setId(R.id.console_flip); view.addView(terminal, 0); synchronized (flip) { // finally attach to the flipper flip.addView(view); return flip.getChildCount() - 1; } }
int function(TerminalBridge bridge) { bridge.promptHelper.setHandler(promptHandler); RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.item_terminal, flip, false); TextView overlay = (TextView) view.findViewById(R.id.terminal_overlay); overlay.setText(bridge.host.getNickname()); TerminalView terminal = new TerminalView(ConsoleActivity.this, bridge); terminal.setId(R.id.console_flip); view.addView(terminal, 0); synchronized (flip) { flip.addView(view); return flip.getChildCount() - 1; } }
/** * Adds a new TerminalBridge to the current set of views in our ViewFlipper. * * @param bridge * TerminalBridge to add to our ViewFlipper * @return the child index of the new view in the ViewFlipper */
Adds a new TerminalBridge to the current set of views in our ViewFlipper
addNewTerminalView
{ "repo_name": "ddrown/irssiconnectbot", "path": "src/org/woltage/irssiconnectbot/ConsoleActivity.java", "license": "apache-2.0", "size": 49405 }
[ "android.widget.RelativeLayout", "android.widget.TextView", "org.woltage.irssiconnectbot.service.TerminalBridge" ]
import android.widget.RelativeLayout; import android.widget.TextView; import org.woltage.irssiconnectbot.service.TerminalBridge;
import android.widget.*; import org.woltage.irssiconnectbot.service.*;
[ "android.widget", "org.woltage.irssiconnectbot" ]
android.widget; org.woltage.irssiconnectbot;
2,848,253
public static java.util.List extractEDPrescriptionList(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.EDPrescriptionVoCollection voCollection) { return extractEDPrescriptionList(domainFactory, voCollection, null, new HashMap()); }
static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.EDPrescriptionVoCollection voCollection) { return extractEDPrescriptionList(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.emergency.domain.objects.EDPrescription list from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.emergency.domain.objects.EDPrescription list from the value object collection
extractEDPrescriptionList
{ "repo_name": "FreudianNM/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/emergency/vo/domain/EDPrescriptionVoAssembler.java", "license": "agpl-3.0", "size": 22100 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,038,763
@Override public int compareTo(Pattern o) { List<ItemAbstractionPair> elementsOfGreaterPattern, elementOfSmallerPattern; if (getElements().size() >= o.getElements().size()) { elementsOfGreaterPattern = getElements(); elementOfSmallerPattern = o.getElements(); } else { elementOfSmallerPattern = getElements(); elementsOfGreaterPattern = o.getElements(); } for (int i = 0; i < elementOfSmallerPattern.size(); i++) { int comparison = elementOfSmallerPattern.get(i).compareTo(elementsOfGreaterPattern.get(i)); if (comparison != 0) { return comparison; } } if (elementsOfGreaterPattern.size() == elementOfSmallerPattern.size()) { return 0; } if (getElements().size() < o.getElements().size()) { return -1; } return 1; }
int function(Pattern o) { List<ItemAbstractionPair> elementsOfGreaterPattern, elementOfSmallerPattern; if (getElements().size() >= o.getElements().size()) { elementsOfGreaterPattern = getElements(); elementOfSmallerPattern = o.getElements(); } else { elementOfSmallerPattern = getElements(); elementsOfGreaterPattern = o.getElements(); } for (int i = 0; i < elementOfSmallerPattern.size(); i++) { int comparison = elementOfSmallerPattern.get(i).compareTo(elementsOfGreaterPattern.get(i)); if (comparison != 0) { return comparison; } } if (elementsOfGreaterPattern.size() == elementOfSmallerPattern.size()) { return 0; } if (getElements().size() < o.getElements().size()) { return -1; } return 1; }
/** * Check if this pattern is equal to another according to the lexicographic order. * @param o the other pattern * @return 0 if equal, -1 if smaller, 1 otherwise */
Check if this pattern is equal to another according to the lexicographic order
compareTo
{ "repo_name": "Quanhua-Guan/spmf", "path": "ca/pfv/spmf/algorithms/sequentialpatterns/clospan_AGP/items/patterns/Pattern.java", "license": "gpl-3.0", "size": 10633 }
[ "ca.pfv.spmf.algorithms.sequentialpatterns.clospan_AGP.items.abstractions.ItemAbstractionPair", "java.util.List" ]
import ca.pfv.spmf.algorithms.sequentialpatterns.clospan_AGP.items.abstractions.ItemAbstractionPair; import java.util.List;
import ca.pfv.spmf.algorithms.sequentialpatterns.*; import java.util.*;
[ "ca.pfv.spmf", "java.util" ]
ca.pfv.spmf; java.util;
473,692
public static void unregister() { synchronized (monitor) { checkState(handler != null, "Jaeger exporter is not registered."); unregister(Tracing.getExportComponent().getSpanExporter()); handler = null; } }
static void function() { synchronized (monitor) { checkState(handler != null, STR); unregister(Tracing.getExportComponent().getSpanExporter()); handler = null; } }
/** * Unregisters the {@link JaegerTraceExporter} from the OpenCensus library. * * @throws IllegalStateException if a Jaeger exporter is not registered. * @since 0.13 */
Unregisters the <code>JaegerTraceExporter</code> from the OpenCensus library
unregister
{ "repo_name": "songy23/instrumentation-java", "path": "exporters/trace/jaeger/src/main/java/io/opencensus/exporter/trace/jaeger/JaegerTraceExporter.java", "license": "apache-2.0", "size": 5631 }
[ "com.google.common.base.Preconditions", "io.opencensus.trace.Tracing" ]
import com.google.common.base.Preconditions; import io.opencensus.trace.Tracing;
import com.google.common.base.*; import io.opencensus.trace.*;
[ "com.google.common", "io.opencensus.trace" ]
com.google.common; io.opencensus.trace;
2,837,571
@Test() public void testOnlyTimestamp() throws Exception { // Get a timestamp that doesn't include milliseconds. Date d = new Date(); GregorianCalendar c = new GregorianCalendar(); c.setTime(d); c.set(GregorianCalendar.MILLISECOND, 0); d = c.getTime(); SimpleDateFormat f = new SimpleDateFormat("'['dd/MMM/yyyy:HH:mm:ss Z']'"); String s = f.format(d); UnbindRequestAccessLogMessage m = new UnbindRequestAccessLogMessage(s); m = new UnbindRequestAccessLogMessage(m); assertNotNull(m); assertNotNull(m.getTimestamp()); assertEquals(m.getTimestamp(), d); assertNotNull(m.getNamedValues()); assertTrue(m.getNamedValues().isEmpty()); assertNotNull(m.getUnnamedValues()); assertTrue(m.getUnnamedValues().isEmpty()); assertNotNull(m.getMessageType()); assertEquals(m.getMessageType(), AccessLogMessageType.REQUEST); assertNotNull(m.getOperationType()); assertEquals(m.getOperationType(), AccessLogOperationType.UNBIND); assertNull(m.getProductName()); assertNull(m.getInstanceName()); assertNull(m.getStartupID()); assertNull(m.getConnectionID()); assertNull(m.getOperationID()); assertNull(m.getMessageID()); assertNull(m.getOrigin()); assertNull(m.getRequesterDN()); assertNull(m.getRequesterIPAddress()); assertNull(m.getIntermediateClientRequest()); assertNull(m.getOperationPurpose()); assertNull(m.usingAdminSessionWorkerThread()); assertNotNull(m.toString()); assertEquals(m.toString(), s); }
@Test() void function() throws Exception { Date d = new Date(); GregorianCalendar c = new GregorianCalendar(); c.setTime(d); c.set(GregorianCalendar.MILLISECOND, 0); d = c.getTime(); SimpleDateFormat f = new SimpleDateFormat(STR); String s = f.format(d); UnbindRequestAccessLogMessage m = new UnbindRequestAccessLogMessage(s); m = new UnbindRequestAccessLogMessage(m); assertNotNull(m); assertNotNull(m.getTimestamp()); assertEquals(m.getTimestamp(), d); assertNotNull(m.getNamedValues()); assertTrue(m.getNamedValues().isEmpty()); assertNotNull(m.getUnnamedValues()); assertTrue(m.getUnnamedValues().isEmpty()); assertNotNull(m.getMessageType()); assertEquals(m.getMessageType(), AccessLogMessageType.REQUEST); assertNotNull(m.getOperationType()); assertEquals(m.getOperationType(), AccessLogOperationType.UNBIND); assertNull(m.getProductName()); assertNull(m.getInstanceName()); assertNull(m.getStartupID()); assertNull(m.getConnectionID()); assertNull(m.getOperationID()); assertNull(m.getMessageID()); assertNull(m.getOrigin()); assertNull(m.getRequesterDN()); assertNull(m.getRequesterIPAddress()); assertNull(m.getIntermediateClientRequest()); assertNull(m.getOperationPurpose()); assertNull(m.usingAdminSessionWorkerThread()); assertNotNull(m.toString()); assertEquals(m.toString(), s); }
/** * Tests the ability to create a log message from a string containing only a * timestamp. * * @throws Exception If an unexpected problem occurs. */
Tests the ability to create a log message from a string containing only a timestamp
testOnlyTimestamp
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/logs/UnbindRequestAccessLogMessageTestCase.java", "license": "gpl-2.0", "size": 8725 }
[ "java.text.SimpleDateFormat", "java.util.Date", "java.util.GregorianCalendar", "org.testng.annotations.Test" ]
import java.text.SimpleDateFormat; import java.util.Date; import java.util.GregorianCalendar; import org.testng.annotations.Test;
import java.text.*; import java.util.*; import org.testng.annotations.*;
[ "java.text", "java.util", "org.testng.annotations" ]
java.text; java.util; org.testng.annotations;
1,868,454
private void recreate(InputStream inputStream, InternalDistributedMember imageTarget) throws TimeoutException, IOException, ClassNotFoundException { String thePath = getFullPath(); Region newRegion = null; // recreate new region with snapshot data try { LocalRegion parent = parentRegion; // If specified diskDir in DEFAULT diskstore, we should not use null // as diskstore name any more if (diskStoreImpl != null && diskStoreImpl.getName().equals(DiskStoreFactory.DEFAULT_DISK_STORE_NAME) && diskStoreName == null && !useDefaultDiskStore()) { diskStoreName = diskStoreImpl.getName(); } RegionAttributes attrs = this; boolean getDestroyLock = false; InternalRegionArguments internalRegionArguments = new InternalRegionArguments() .setDestroyLockFlag(getDestroyLock).setSnapshotInputStream(inputStream) .setImageTarget(imageTarget).setRecreateFlag(true); if (this instanceof BucketRegion) { BucketRegion me = (BucketRegion) this; internalRegionArguments.setPartitionedRegionBucketRedundancy(me.getRedundancyLevel()); } if (parent == null) { newRegion = cache.createVMRegion(regionName, attrs, internalRegionArguments); } else { newRegion = parent.createSubregion(regionName, attrs, internalRegionArguments); } // note that createVMRegion and createSubregion now call regionReinitialized } catch (RegionExistsException e) { // shouldn't happen since we're holding the destroy lock throw new InternalGemFireError( "Got RegionExistsException in reinitialize when holding destroy lock", e); } finally { if (newRegion == null) { // failed to create region cache.unregisterReinitializingRegion(thePath); } } }
void function(InputStream inputStream, InternalDistributedMember imageTarget) throws TimeoutException, IOException, ClassNotFoundException { String thePath = getFullPath(); Region newRegion = null; try { LocalRegion parent = parentRegion; if (diskStoreImpl != null && diskStoreImpl.getName().equals(DiskStoreFactory.DEFAULT_DISK_STORE_NAME) && diskStoreName == null && !useDefaultDiskStore()) { diskStoreName = diskStoreImpl.getName(); } RegionAttributes attrs = this; boolean getDestroyLock = false; InternalRegionArguments internalRegionArguments = new InternalRegionArguments() .setDestroyLockFlag(getDestroyLock).setSnapshotInputStream(inputStream) .setImageTarget(imageTarget).setRecreateFlag(true); if (this instanceof BucketRegion) { BucketRegion me = (BucketRegion) this; internalRegionArguments.setPartitionedRegionBucketRedundancy(me.getRedundancyLevel()); } if (parent == null) { newRegion = cache.createVMRegion(regionName, attrs, internalRegionArguments); } else { newRegion = parent.createSubregion(regionName, attrs, internalRegionArguments); } } catch (RegionExistsException e) { throw new InternalGemFireError( STR, e); } finally { if (newRegion == null) { cache.unregisterReinitializingRegion(thePath); } } }
/** * must be holding destroy lock */
must be holding destroy lock
recreate
{ "repo_name": "davebarnes97/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java", "license": "apache-2.0", "size": 394235 }
[ "java.io.IOException", "java.io.InputStream", "org.apache.geode.InternalGemFireError", "org.apache.geode.cache.DiskStoreFactory", "org.apache.geode.cache.Region", "org.apache.geode.cache.RegionAttributes", "org.apache.geode.cache.RegionExistsException", "org.apache.geode.cache.TimeoutException", "org.apache.geode.distributed.internal.membership.InternalDistributedMember" ]
import java.io.IOException; import java.io.InputStream; import org.apache.geode.InternalGemFireError; import org.apache.geode.cache.DiskStoreFactory; import org.apache.geode.cache.Region; import org.apache.geode.cache.RegionAttributes; import org.apache.geode.cache.RegionExistsException; import org.apache.geode.cache.TimeoutException; import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import java.io.*; import org.apache.geode.*; import org.apache.geode.cache.*; import org.apache.geode.distributed.internal.membership.*;
[ "java.io", "org.apache.geode" ]
java.io; org.apache.geode;
1,785,492
public BigDecimal getCostAverageCumQty(); public static final String COLUMNNAME_CostStandard = "CostStandard";
BigDecimal function(); public static final String COLUMNNAME_CostStandard = STR;
/** Get Average Cost Quantity Sum. * Cumulative average cost quantities (internal) */
Get Average Cost Quantity Sum. Cumulative average cost quantities (internal)
getCostAverageCumQty
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/I_M_Product_Costing.java", "license": "gpl-2.0", "size": 9567 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
66,715
private synchronized <T> T executeRequest(HttpMethod method, String url, Object contentObject, Class<T> result) throws GardenaException { try { if (logger.isTraceEnabled()) { logger.trace("{} request: {}", method, url); if (contentObject != null) { logger.trace("{} data : {}", method, gson.toJson(contentObject)); } } Request request = httpClient.newRequest(url).method(method) .timeout(config.getConnectionTimeout(), TimeUnit.SECONDS) .header(HttpHeader.CONTENT_TYPE, "application/json").header(HttpHeader.ACCEPT, "application/json") .header(HttpHeader.ACCEPT_ENCODING, "gzip"); if (contentObject != null) { StringContentProvider content = new StringContentProvider(gson.toJson(contentObject)); request.content(content); } if (!result.equals(SessionWrapper.class)) { verifySession(); request.header("X-Session", session.getToken()); } ContentResponse contentResponse = request.send(); int status = contentResponse.getStatus(); if (logger.isTraceEnabled()) { logger.trace("Status : {}", status); logger.trace("Response: {}", contentResponse.getContentAsString()); } if (status == 500) { throw new GardenaException( gson.fromJson(contentResponse.getContentAsString(), Errors.class).toString()); } else if (status != 200 && status != 204) { throw new GardenaException(String.format("Error %s %s", status, contentResponse.getReason())); } if (result == NoResult.class) { return null; } return gson.fromJson(contentResponse.getContentAsString(), result); } catch (ExecutionException ex) { Throwable cause = ex.getCause(); if (cause instanceof HttpResponseException) { HttpResponseException responseException = (HttpResponseException) ex.getCause(); int status = responseException.getResponse().getStatus(); if (status == 401) { throw new GardenaUnauthorizedException(ex.getCause()); } } throw new GardenaException(ex.getMessage(), ex); } catch (Exception ex) { throw new GardenaException(ex.getMessage(), ex); } }
synchronized <T> T function(HttpMethod method, String url, Object contentObject, Class<T> result) throws GardenaException { try { if (logger.isTraceEnabled()) { logger.trace(STR, method, url); if (contentObject != null) { logger.trace(STR, method, gson.toJson(contentObject)); } } Request request = httpClient.newRequest(url).method(method) .timeout(config.getConnectionTimeout(), TimeUnit.SECONDS) .header(HttpHeader.CONTENT_TYPE, STR).header(HttpHeader.ACCEPT, STR) .header(HttpHeader.ACCEPT_ENCODING, "gzip"); if (contentObject != null) { StringContentProvider content = new StringContentProvider(gson.toJson(contentObject)); request.content(content); } if (!result.equals(SessionWrapper.class)) { verifySession(); request.header(STR, session.getToken()); } ContentResponse contentResponse = request.send(); int status = contentResponse.getStatus(); if (logger.isTraceEnabled()) { logger.trace(STR, status); logger.trace(STR, contentResponse.getContentAsString()); } if (status == 500) { throw new GardenaException( gson.fromJson(contentResponse.getContentAsString(), Errors.class).toString()); } else if (status != 200 && status != 204) { throw new GardenaException(String.format(STR, status, contentResponse.getReason())); } if (result == NoResult.class) { return null; } return gson.fromJson(contentResponse.getContentAsString(), result); } catch (ExecutionException ex) { Throwable cause = ex.getCause(); if (cause instanceof HttpResponseException) { HttpResponseException responseException = (HttpResponseException) ex.getCause(); int status = responseException.getResponse().getStatus(); if (status == 401) { throw new GardenaUnauthorizedException(ex.getCause()); } } throw new GardenaException(ex.getMessage(), ex); } catch (Exception ex) { throw new GardenaException(ex.getMessage(), ex); } }
/** * Communicates with Gardena Smart Home and parses the result. */
Communicates with Gardena Smart Home and parses the result
executeRequest
{ "repo_name": "aogorek/openhab2-addons", "path": "addons/binding/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/GardenaSmartImpl.java", "license": "epl-1.0", "size": 24299 }
[ "java.util.concurrent.ExecutionException", "java.util.concurrent.TimeUnit", "org.eclipse.jetty.client.HttpResponseException", "org.eclipse.jetty.client.api.ContentResponse", "org.eclipse.jetty.client.api.Request", "org.eclipse.jetty.client.util.StringContentProvider", "org.eclipse.jetty.http.HttpHeader", "org.eclipse.jetty.http.HttpMethod", "org.openhab.binding.gardena.internal.exception.GardenaException", "org.openhab.binding.gardena.internal.exception.GardenaUnauthorizedException", "org.openhab.binding.gardena.internal.model.Errors", "org.openhab.binding.gardena.internal.model.NoResult", "org.openhab.binding.gardena.internal.model.SessionWrapper" ]
import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import org.eclipse.jetty.client.HttpResponseException; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.util.StringContentProvider; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpMethod; import org.openhab.binding.gardena.internal.exception.GardenaException; import org.openhab.binding.gardena.internal.exception.GardenaUnauthorizedException; import org.openhab.binding.gardena.internal.model.Errors; import org.openhab.binding.gardena.internal.model.NoResult; import org.openhab.binding.gardena.internal.model.SessionWrapper;
import java.util.concurrent.*; import org.eclipse.jetty.client.*; import org.eclipse.jetty.client.api.*; import org.eclipse.jetty.client.util.*; import org.eclipse.jetty.http.*; import org.openhab.binding.gardena.internal.exception.*; import org.openhab.binding.gardena.internal.model.*;
[ "java.util", "org.eclipse.jetty", "org.openhab.binding" ]
java.util; org.eclipse.jetty; org.openhab.binding;
1,154,583
@Test public void parsesYamlConfigWhenBroken() throws Exception { MatcherAssert.assertThat( new YamlXML("a: alpha\nb:\nc:\n - beta").get(), XhtmlMatchers.hasXPaths( "/p/entry[@key='a' and .='alpha']", "/p/entry[@key='b' and .='']", "/p/entry[@key='c']/item[.='beta']" ) ); }
void function() throws Exception { MatcherAssert.assertThat( new YamlXML(STR).get(), XhtmlMatchers.hasXPaths( STR, STR, STR ) ); }
/** * YamlXML can parse a broken text. * @throws Exception In case of error. */
YamlXML can parse a broken text
parsesYamlConfigWhenBroken
{ "repo_name": "dalifreire/rultor", "path": "src/test/java/com/rultor/profiles/YamlXMLTest.java", "license": "bsd-3-clause", "size": 3606 }
[ "com.jcabi.matchers.XhtmlMatchers", "org.hamcrest.MatcherAssert" ]
import com.jcabi.matchers.XhtmlMatchers; import org.hamcrest.MatcherAssert;
import com.jcabi.matchers.*; import org.hamcrest.*;
[ "com.jcabi.matchers", "org.hamcrest" ]
com.jcabi.matchers; org.hamcrest;
2,669,232
@Test public void shouldNotLoadWithNullKeyUsingGetAll() { RecordingCacheLoader<String> cacheLoader = new RecordingCacheLoader<String>(); cacheLoaderServer.setCacheLoader(cacheLoader); //construct a set of keys HashSet<String> keys = new HashSet<String>(); keys.add("gudday"); keys.add("hello"); keys.add("howdy"); keys.add("bonjour"); keys.add(null); //attempt to get the keys try { Map<String, String> map = cache.getAll(keys); fail("Should have thrown a NullPointerException"); } catch (NullPointerException e) { //assert that nothing was actually loaded assertThat(cacheLoader.getLoadCount(), is(0)); for (String key : keys) { assertThat(cacheLoader.hasLoaded(key), is(false)); } } }
void function() { RecordingCacheLoader<String> cacheLoader = new RecordingCacheLoader<String>(); cacheLoaderServer.setCacheLoader(cacheLoader); HashSet<String> keys = new HashSet<String>(); keys.add(STR); keys.add("hello"); keys.add("howdy"); keys.add(STR); keys.add(null); try { Map<String, String> map = cache.getAll(keys); fail(STR); } catch (NullPointerException e) { assertThat(cacheLoader.getLoadCount(), is(0)); for (String key : keys) { assertThat(cacheLoader.hasLoaded(key), is(false)); } } }
/** * Ensure that a {@link Cache#getAll(java.util.Set)} using one or more * <code>null</code> keys will not load anything. */
Ensure that a <code>Cache#getAll(java.util.Set)</code> using one or more <code>null</code> keys will not load anything
shouldNotLoadWithNullKeyUsingGetAll
{ "repo_name": "headissue/cache2k", "path": "cache2k-jcache-tests/src/test/java/org/jsr107/tck/integration/CacheLoaderWithoutReadThroughTest.java", "license": "gpl-3.0", "size": 27230 }
[ "java.util.HashSet", "java.util.Map", "org.hamcrest.CoreMatchers", "org.junit.Assert" ]
import java.util.HashSet; import java.util.Map; import org.hamcrest.CoreMatchers; import org.junit.Assert;
import java.util.*; import org.hamcrest.*; import org.junit.*;
[ "java.util", "org.hamcrest", "org.junit" ]
java.util; org.hamcrest; org.junit;
918,130
public void setKualiModuleService(KualiModuleService kualiModuleService) { this.kualiModuleService = kualiModuleService; }
void function(KualiModuleService kualiModuleService) { this.kualiModuleService = kualiModuleService; }
/** * Sets the kualiModuleService attribute value. * * @param kualiModuleService The kualiModuleService to set. */
Sets the kualiModuleService attribute value
setKualiModuleService
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-core/src/main/java/org/kuali/kfs/sys/batch/service/impl/FiscalYearMakerServiceImpl.java", "license": "agpl-3.0", "size": 20881 }
[ "org.kuali.kfs.krad.service.KualiModuleService" ]
import org.kuali.kfs.krad.service.KualiModuleService;
import org.kuali.kfs.krad.service.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
1,223,533
public TroubleTicketState getTroubleTicketState() { return m_delegate.getTTicketState(); }
TroubleTicketState function() { return m_delegate.getTTicketState(); }
/** * <p>Getter for the field <code>troubleTicketState</code>.</p> * * @return a {@link org.opennms.netmgt.model.TroubleTicketState} object. */
Getter for the field <code>troubleTicketState</code>
getTroubleTicketState
{ "repo_name": "peternixon/opennms-mirror", "path": "opennms-webapp/src/main/java/org/opennms/web/alarm/Alarm.java", "license": "gpl-2.0", "size": 9542 }
[ "org.opennms.netmgt.model.TroubleTicketState" ]
import org.opennms.netmgt.model.TroubleTicketState;
import org.opennms.netmgt.model.*;
[ "org.opennms.netmgt" ]
org.opennms.netmgt;
1,998,695
public void writeInt32NoTag (final int value) throws IOException { if (value >= 0) { writeRawVarint32 (value); } else { // Must sign-extend. writeRawVarint64 (value); } }
void function (final int value) throws IOException { if (value >= 0) { writeRawVarint32 (value); } else { writeRawVarint64 (value); } }
/** * Write an {@code int32} field to the stream. */
Write an int32 field to the stream
writeInt32NoTag
{ "repo_name": "CodeBrig/Beam", "path": "src/com/google/protobuf/CodedOutputStream.java", "license": "mit", "size": 49129 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,606,981
public String getPandocPath() { // first, get the filepath, which is in relation to the zkn-path Element el = settingsFile.getRootElement().getChild(SETTING_PANDOCPATH); // create an empty string as return value String value = ""; // is the element exists, copy the text to the return value if (el != null) { value = el.getText(); } // when we have no filename, return null if (value.isEmpty()) { return null; } // else return filepath return value; }
String function() { Element el = settingsFile.getRootElement().getChild(SETTING_PANDOCPATH); String value = ""; if (el != null) { value = el.getText(); } if (value.isEmpty()) { return null; } return value; }
/** * Retrieves the filepath for the external converter tool "pandoc" * * @return the filepath for the external converter tool "pandoc" */
Retrieves the filepath for the external converter tool "pandoc"
getPandocPath
{ "repo_name": "RalfBarkow/Zettelkasten", "path": "src/main/java/de/danielluedecke/zettelkasten/database/Settings.java", "license": "gpl-3.0", "size": 218921 }
[ "org.jdom2.Element" ]
import org.jdom2.Element;
import org.jdom2.*;
[ "org.jdom2" ]
org.jdom2;
897,823
protected static List<URL> getResources(String path) throws IOException { return Collections.list(Thread.currentThread().getContextClassLoader().getResources(path)); }
static List<URL> function(String path) throws IOException { return Collections.list(Thread.currentThread().getContextClassLoader().getResources(path)); }
/** * Get a list of {@link URL}s from the context classloader for all the resources found at the * specified path. * * @param path The resource path. * @return A list of {@link URL}s, as returned by {@link ClassLoader#getResources(String)}. * @throws IOException If I/O errors occur */
Get a list of <code>URL</code>s from the context classloader for all the resources found at the specified path
getResources
{ "repo_name": "rodrigodealer/mybatis-crlf-fixed", "path": "src/main/java/org/apache/ibatis/io/VFS.java", "license": "apache-2.0", "size": 7344 }
[ "java.io.IOException", "java.util.Collections", "java.util.List" ]
import java.io.IOException; import java.util.Collections; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,938,889
public String getSQLOutput( String schemaName, String tableName, RowMetaInterface fields, Object[] r, String dateFormat ) throws KettleDatabaseException { StringBuilder ins = new StringBuilder( 128 ); try { String schemaTable = databaseMeta.getQuotedSchemaTableCombination( schemaName, tableName ); ins.append( "INSERT INTO " ).append( schemaTable ).append( '(' ); // now add the names in the row: for ( int i = 0; i < fields.size(); i++ ) { if ( i > 0 ) { ins.append( ", " ); } String name = fields.getValueMeta( i ).getName(); ins.append( databaseMeta.quoteField( name ) ); } ins.append( ") VALUES (" ); java.text.SimpleDateFormat[] fieldDateFormatters = new java.text.SimpleDateFormat[ fields.size() ]; // new add values ... for ( int i = 0; i < fields.size(); i++ ) { ValueMetaInterface valueMeta = fields.getValueMeta( i ); Object valueData = r[ i ]; if ( i > 0 ) { ins.append( "," ); } // Check for null values... // if ( valueMeta.isNull( valueData ) ) { ins.append( "null" ); } else { // Normal cases... // switch ( valueMeta.getType() ) { case ValueMetaInterface.TYPE_BOOLEAN: case ValueMetaInterface.TYPE_STRING: String string = valueMeta.getString( valueData ); // Have the database dialect do the quoting. // This also adds the single quotes around the string (thanks to // PostgreSQL) // string = databaseMeta.quoteSQLString( string ); ins.append( string ); break; case ValueMetaInterface.TYPE_DATE: Date date = fields.getDate( r, i ); if ( Utils.isEmpty( dateFormat ) ) { if ( databaseMeta.getDatabaseInterface() instanceof OracleDatabaseMeta ) { if ( fieldDateFormatters[ i ] == null ) { fieldDateFormatters[ i ] = new java.text.SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" ); } ins.append( "TO_DATE('" ).append( fieldDateFormatters[ i ].format( date ) ).append( "', 'YYYY/MM/DD HH24:MI:SS')" ); } else { ins.append( "'" + fields.getString( r, i ) + "'" ); } } else { try { java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat( dateFormat ); ins.append( "'" + formatter.format( fields.getDate( r, i ) ) + "'" ); } catch ( Exception e ) { throw new KettleDatabaseException( "Error : ", e ); } } break; default: ins.append( fields.getString( r, i ) ); break; } } } ins.append( ')' ); } catch ( Exception e ) { throw new KettleDatabaseException( e ); } return ins.toString(); }
String function( String schemaName, String tableName, RowMetaInterface fields, Object[] r, String dateFormat ) throws KettleDatabaseException { StringBuilder ins = new StringBuilder( 128 ); try { String schemaTable = databaseMeta.getQuotedSchemaTableCombination( schemaName, tableName ); ins.append( STR ).append( schemaTable ).append( '(' ); for ( int i = 0; i < fields.size(); i++ ) { if ( i > 0 ) { ins.append( STR ); } String name = fields.getValueMeta( i ).getName(); ins.append( databaseMeta.quoteField( name ) ); } ins.append( STR ); java.text.SimpleDateFormat[] fieldDateFormatters = new java.text.SimpleDateFormat[ fields.size() ]; for ( int i = 0; i < fields.size(); i++ ) { ValueMetaInterface valueMeta = fields.getValueMeta( i ); Object valueData = r[ i ]; if ( i > 0 ) { ins.append( "," ); } ins.append( "null" ); } else { case ValueMetaInterface.TYPE_BOOLEAN: case ValueMetaInterface.TYPE_STRING: String string = valueMeta.getString( valueData ); ins.append( string ); break; case ValueMetaInterface.TYPE_DATE: Date date = fields.getDate( r, i ); if ( Utils.isEmpty( dateFormat ) ) { if ( databaseMeta.getDatabaseInterface() instanceof OracleDatabaseMeta ) { if ( fieldDateFormatters[ i ] == null ) { fieldDateFormatters[ i ] = new java.text.SimpleDateFormat( STR ); } ins.append( STR ).append( fieldDateFormatters[ i ].format( date ) ).append( STR ); } else { ins.append( "'" + fields.getString( r, i ) + "'" ); } } else { try { java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat( dateFormat ); ins.append( "'" + formatter.format( fields.getDate( r, i ) ) + "'" ); } catch ( Exception e ) { throw new KettleDatabaseException( STR, e ); } } break; default: ins.append( fields.getString( r, i ) ); break; } } } ins.append( ')' ); } catch ( Exception e ) { throw new KettleDatabaseException( e ); } return ins.toString(); }
/** * Return SQL statement (INSERT INTO TableName ... * * @param schemaName tableName The schema * @param tableName * @param fields * @param dateFormat date format of field * @throws KettleDatabaseException */
Return SQL statement (INSERT INTO TableName ..
getSQLOutput
{ "repo_name": "pavel-sakun/pentaho-kettle", "path": "core/src/main/java/org/pentaho/di/core/database/Database.java", "license": "apache-2.0", "size": 170347 }
[ "java.util.Date", "org.pentaho.di.core.exception.KettleDatabaseException", "org.pentaho.di.core.row.RowMetaInterface", "org.pentaho.di.core.row.ValueMetaInterface", "org.pentaho.di.core.util.Utils" ]
import java.util.Date; import org.pentaho.di.core.exception.KettleDatabaseException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.util.Utils;
import java.util.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.*; import org.pentaho.di.core.util.*;
[ "java.util", "org.pentaho.di" ]
java.util; org.pentaho.di;
2,830,640
public void addImageCache(FragmentManager fragmentManager, ImageCache.ImageCacheParams cacheParams) { mImageCacheParams = cacheParams; mImageCache = ImageCache.getInstance(fragmentManager, mImageCacheParams); new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); }
void function(FragmentManager fragmentManager, ImageCache.ImageCacheParams cacheParams) { mImageCacheParams = cacheParams; mImageCache = ImageCache.getInstance(fragmentManager, mImageCacheParams); new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); }
/** * Adds an {@link ImageCache} to this {@link ImageWorker} to handle disk and memory bitmap * caching. * @param fragmentManager * @param cacheParams The cache parameters to use for the image cache. */
Adds an <code>ImageCache</code> to this <code>ImageWorker</code> to handle disk and memory bitmap caching
addImageCache
{ "repo_name": "Nowdone/fanxin", "path": "src/com/fanxin/app/video/util/ImageWorker.java", "license": "mit", "size": 16297 }
[ "android.support.v4.app.FragmentManager" ]
import android.support.v4.app.FragmentManager;
import android.support.v4.app.*;
[ "android.support" ]
android.support;
1,875,589
@Override public PasswordGroupField getField() { return (PasswordGroupField) super.getField(); }
PasswordGroupField function() { return (PasswordGroupField) super.getField(); }
/** * Returns the field. * * @return the field */
Returns the field
getField
{ "repo_name": "Murdock01/izpack", "path": "izpack-panel/src/main/java/com/izforge/izpack/panels/userinput/console/password/ConsolePasswordGroupField.java", "license": "apache-2.0", "size": 3574 }
[ "com.izforge.izpack.panels.userinput.field.password.PasswordGroupField" ]
import com.izforge.izpack.panels.userinput.field.password.PasswordGroupField;
import com.izforge.izpack.panels.userinput.field.password.*;
[ "com.izforge.izpack" ]
com.izforge.izpack;
219,887
@SuppressWarnings("unchecked") private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); final int count = in.readInt(); if (count > 3) { delegateMap = createDelegateMap(); } for (int i = count; i > 0; i--) { put((K) in.readObject(), (V) in.readObject()); } }
@SuppressWarnings(STR) void function(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); final int count = in.readInt(); if (count > 3) { delegateMap = createDelegateMap(); } for (int i = count; i > 0; i--) { put((K) in.readObject(), (V) in.readObject()); } }
/** * Read the map in using a custom routine. */
Read the map in using a custom routine
readObject
{ "repo_name": "krivachy/compgs03_mutation_testing", "path": "src/main/java/org/apache/commons/collections4/map/Flat3Map.java", "license": "apache-2.0", "size": 39790 }
[ "java.io.IOException", "java.io.ObjectInputStream" ]
import java.io.IOException; import java.io.ObjectInputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,758,750
public LocatorConnector createInstance() throws Exception { // JUnitDoclet begin method testcase.createInstance return new LocatorConnector(); // JUnitDoclet end method testcase.createInstance }
LocatorConnector function() throws Exception { return new LocatorConnector(); }
/** * Factory method for instances of the class to be tested. */
Factory method for instances of the class to be tested
createInstance
{ "repo_name": "samskivert/jhotdraw6", "path": "src/test/java/org/jhotdraw/test/standard/LocatorConnectorTest.java", "license": "lgpl-2.1", "size": 5307 }
[ "org.jhotdraw.standard.LocatorConnector" ]
import org.jhotdraw.standard.LocatorConnector;
import org.jhotdraw.standard.*;
[ "org.jhotdraw.standard" ]
org.jhotdraw.standard;
1,027,480
private void prepareDataSource() throws InternalException { // Binary predicates that will be offered to the data source. List<List<TBinaryPredicate>> offeredPredicates = Lists.newArrayList(); // The index into conjuncts_ for each element in offeredPredicates. List<Integer> conjunctsIdx = Lists.newArrayList(); for (int i = 0; i < conjuncts_.size(); ++i) { Expr conjunct = conjuncts_.get(i); List<TBinaryPredicate> disjuncts = getDisjuncts(conjunct); if (disjuncts != null) { offeredPredicates.add(disjuncts); conjunctsIdx.add(i); } } String hdfsLocation = table_.getDataSource().getHdfs_location(); TCacheJarResult cacheResult = FeSupport.CacheJar(hdfsLocation); TStatus cacheJarStatus = cacheResult.getStatus(); if (cacheJarStatus.getStatus_code() != TErrorCode.OK) { throw new InternalException(String.format( "Unable to cache data source library at location '%s'. Check that the file " + "exists and is readable. Message: %s", hdfsLocation, Joiner.on("\n").join(cacheJarStatus.getError_msgs()))); } String localPath = cacheResult.getLocal_path(); String className = table_.getDataSource().getClass_name(); String apiVersion = table_.getDataSource().getApi_version(); TPrepareResult prepareResult; TStatus prepareStatus; try { ExternalDataSourceExecutor executor = new ExternalDataSourceExecutor( localPath, className, apiVersion, table_.getInitString()); TPrepareParams prepareParams = new TPrepareParams(); prepareParams.setInit_string(table_.getInitString()); prepareParams.setPredicates(offeredPredicates); // TODO: Include DB (i.e. getFullName())? prepareParams.setTable_name(table_.getName()); prepareResult = executor.prepare(prepareParams); prepareStatus = prepareResult.getStatus(); } catch (Exception e) { throw new InternalException(String.format( "Error calling prepare() on data source %s", DataSource.debugString(table_.getDataSource())), e); } if (prepareStatus.getStatus_code() != TErrorCode.OK) { throw new InternalException(String.format( "Data source %s returned an error from prepare(): %s", DataSource.debugString(table_.getDataSource()), Joiner.on("\n").join(prepareStatus.getError_msgs()))); } numRowsEstimate_ = prepareResult.getNum_rows_estimate(); acceptedPredicates_ = Lists.newArrayList(); List<Integer> acceptedPredicatesIdx = prepareResult.isSetAccepted_conjuncts() ? prepareResult.getAccepted_conjuncts() : ImmutableList.<Integer>of(); for (Integer acceptedIdx: acceptedPredicatesIdx) { acceptedPredicates_.add(offeredPredicates.get(acceptedIdx)); } removeAcceptedConjuncts(acceptedPredicatesIdx, conjunctsIdx); }
void function() throws InternalException { List<List<TBinaryPredicate>> offeredPredicates = Lists.newArrayList(); List<Integer> conjunctsIdx = Lists.newArrayList(); for (int i = 0; i < conjuncts_.size(); ++i) { Expr conjunct = conjuncts_.get(i); List<TBinaryPredicate> disjuncts = getDisjuncts(conjunct); if (disjuncts != null) { offeredPredicates.add(disjuncts); conjunctsIdx.add(i); } } String hdfsLocation = table_.getDataSource().getHdfs_location(); TCacheJarResult cacheResult = FeSupport.CacheJar(hdfsLocation); TStatus cacheJarStatus = cacheResult.getStatus(); if (cacheJarStatus.getStatus_code() != TErrorCode.OK) { throw new InternalException(String.format( STR + STR, hdfsLocation, Joiner.on("\n").join(cacheJarStatus.getError_msgs()))); } String localPath = cacheResult.getLocal_path(); String className = table_.getDataSource().getClass_name(); String apiVersion = table_.getDataSource().getApi_version(); TPrepareResult prepareResult; TStatus prepareStatus; try { ExternalDataSourceExecutor executor = new ExternalDataSourceExecutor( localPath, className, apiVersion, table_.getInitString()); TPrepareParams prepareParams = new TPrepareParams(); prepareParams.setInit_string(table_.getInitString()); prepareParams.setPredicates(offeredPredicates); prepareParams.setTable_name(table_.getName()); prepareResult = executor.prepare(prepareParams); prepareStatus = prepareResult.getStatus(); } catch (Exception e) { throw new InternalException(String.format( STR, DataSource.debugString(table_.getDataSource())), e); } if (prepareStatus.getStatus_code() != TErrorCode.OK) { throw new InternalException(String.format( STR, DataSource.debugString(table_.getDataSource()), Joiner.on("\n").join(prepareStatus.getError_msgs()))); } numRowsEstimate_ = prepareResult.getNum_rows_estimate(); acceptedPredicates_ = Lists.newArrayList(); List<Integer> acceptedPredicatesIdx = prepareResult.isSetAccepted_conjuncts() ? prepareResult.getAccepted_conjuncts() : ImmutableList.<Integer>of(); for (Integer acceptedIdx: acceptedPredicatesIdx) { acceptedPredicates_.add(offeredPredicates.get(acceptedIdx)); } removeAcceptedConjuncts(acceptedPredicatesIdx, conjunctsIdx); }
/** * Calls prepare() on the data source to determine accepted predicates and get * stats. The accepted predicates are moved from conjuncts_ into acceptedConjuncts_ * and the associated TBinaryPredicates are set in acceptedPredicates_. */
Calls prepare() on the data source to determine accepted predicates and get stats. The accepted predicates are moved from conjuncts_ into acceptedConjuncts_ and the associated TBinaryPredicates are set in acceptedPredicates_
prepareDataSource
{ "repo_name": "924060929/impala-frontend", "path": "fe/src/main/java/org/apache/impala/planner/DataSourceScanNode.java", "license": "apache-2.0", "size": 15638 }
[ "com.google.common.base.Joiner", "com.google.common.collect.ImmutableList", "com.google.common.collect.Lists", "java.util.List", "org.apache.impala.analysis.Expr", "org.apache.impala.catalog.DataSource", "org.apache.impala.common.InternalException", "org.apache.impala.extdatasource.ExternalDataSourceExecutor", "org.apache.impala.extdatasource.thrift.TBinaryPredicate", "org.apache.impala.extdatasource.thrift.TPrepareParams", "org.apache.impala.extdatasource.thrift.TPrepareResult", "org.apache.impala.service.FeSupport", "org.apache.impala.thrift.TCacheJarResult", "org.apache.impala.thrift.TErrorCode", "org.apache.impala.thrift.TStatus" ]
import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import java.util.List; import org.apache.impala.analysis.Expr; import org.apache.impala.catalog.DataSource; import org.apache.impala.common.InternalException; import org.apache.impala.extdatasource.ExternalDataSourceExecutor; import org.apache.impala.extdatasource.thrift.TBinaryPredicate; import org.apache.impala.extdatasource.thrift.TPrepareParams; import org.apache.impala.extdatasource.thrift.TPrepareResult; import org.apache.impala.service.FeSupport; import org.apache.impala.thrift.TCacheJarResult; import org.apache.impala.thrift.TErrorCode; import org.apache.impala.thrift.TStatus;
import com.google.common.base.*; import com.google.common.collect.*; import java.util.*; import org.apache.impala.analysis.*; import org.apache.impala.catalog.*; import org.apache.impala.common.*; import org.apache.impala.extdatasource.*; import org.apache.impala.extdatasource.thrift.*; import org.apache.impala.service.*; import org.apache.impala.thrift.*;
[ "com.google.common", "java.util", "org.apache.impala" ]
com.google.common; java.util; org.apache.impala;
2,043,432
public static String generateActivationKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); }
static String function() { return RandomStringUtils.randomNumeric(DEF_COUNT); }
/** * Generate an activation key. * * @return the generated activation key */
Generate an activation key
generateActivationKey
{ "repo_name": "kalnee/trivor", "path": "gateway/src/main/java/org/kalnee/trivor/gateway/service/util/RandomUtil.java", "license": "mit", "size": 895 }
[ "org.apache.commons.lang3.RandomStringUtils" ]
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
1,900,978
private void loadIntegration(Class<AbstractIntegration> clazz) { try { Constructor<AbstractIntegration> constructor = clazz.getDeclaredConstructor(); constructor.setAccessible(true); AbstractIntegration integration = constructor.newInstance(); integrations.add(integration); bundledIntegrations.put(integration.key(), false); } catch (Exception e) { throw new AssertionError( "Could not create instance of " + clazz.getCanonicalName() + ".\n" + e); } }
void function(Class<AbstractIntegration> clazz) { try { Constructor<AbstractIntegration> constructor = clazz.getDeclaredConstructor(); constructor.setAccessible(true); AbstractIntegration integration = constructor.newInstance(); integrations.add(integration); bundledIntegrations.put(integration.key(), false); } catch (Exception e) { throw new AssertionError( STR + clazz.getCanonicalName() + ".\n" + e); } }
/** * Instantiates an instance of {@link AbstractIntegration} for the given class. The {@link * AbstractIntegration} *MUST* have an empty constructor. This will also update the {@code * bundledIntegrations} map so that events for this integration aren't sent server side. * <p/> * This will not initialize the integration. */
Instantiates an instance of <code>AbstractIntegration</code> for the given class. The <code>AbstractIntegration</code> *MUST* have an empty constructor. This will also update the bundledIntegrations map so that events for this integration aren't sent server side. This will not initialize the integration
loadIntegration
{ "repo_name": "palaniyappanBala/analytics-android", "path": "analytics-core/src/main/java/com/segment/analytics/IntegrationManager.java", "license": "mit", "size": 18687 }
[ "com.segment.analytics.internal.AbstractIntegration", "java.lang.reflect.Constructor" ]
import com.segment.analytics.internal.AbstractIntegration; import java.lang.reflect.Constructor;
import com.segment.analytics.internal.*; import java.lang.reflect.*;
[ "com.segment.analytics", "java.lang" ]
com.segment.analytics; java.lang;
568,610
public void setMetadata(PDMetadata meta) { stream.setItem(COSName.METADATA, meta); }
void function(PDMetadata meta) { stream.setItem(COSName.METADATA, meta); }
/** * Set the metadata for this object. This can be null. * * @param meta * The meta data for this object. */
Set the metadata for this object. This can be null
setMetadata
{ "repo_name": "myrridin/qz-print", "path": "pdfbox_1.8.4_qz/src/org/apache/pdfbox/pdmodel/common/PDStream.java", "license": "lgpl-2.1", "size": 18077 }
[ "org.apache.pdfbox.cos.COSName" ]
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
279,776
public static int advance(Iterator<?> iterator, int numberToAdvance) { checkNotNull(iterator); checkArgument(numberToAdvance >= 0, "numberToAdvance must be nonnegative"); int i; for (i = 0; i < numberToAdvance && iterator.hasNext(); i++) { iterator.next(); } return i; }
static int function(Iterator<?> iterator, int numberToAdvance) { checkNotNull(iterator); checkArgument(numberToAdvance >= 0, STR); int i; for (i = 0; i < numberToAdvance && iterator.hasNext(); i++) { iterator.next(); } return i; }
/** * Calls {@code next()} on {@code iterator}, either {@code numberToAdvance} times * or until {@code hasNext()} returns {@code false}, whichever comes first. * * @return the number of elements the iterator was advanced * @since 13.0 (since 3.0 as {@code Iterators.skip}) */
Calls next() on iterator, either numberToAdvance times or until hasNext() returns false, whichever comes first
advance
{ "repo_name": "liyazhou/guava", "path": "guava/src/com/google/common/collect/Iterators.java", "license": "apache-2.0", "size": 46112 }
[ "com.google.common.base.Preconditions", "java.util.Iterator" ]
import com.google.common.base.Preconditions; import java.util.Iterator;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,537,343
public TimeZone getTimeZone() { return calendar.getTimeZone(); }
TimeZone function() { return calendar.getTimeZone(); }
/** * Gets the time zone. * This method is equivalent to the following call. * <blockquote><pre>{@code * getCalendar().getTimeZone() * }</pre></blockquote> * * @return the time zone associated with the calendar of DateFormat. */
Gets the time zone. This method is equivalent to the following call. <code>getCalendar().getTimeZone() </code>
getTimeZone
{ "repo_name": "dmlloyd/openjdk-modules", "path": "jdk/src/java.base/share/classes/java/text/DateFormat.java", "license": "gpl-2.0", "size": 41671 }
[ "java.util.TimeZone" ]
import java.util.TimeZone;
import java.util.*;
[ "java.util" ]
java.util;
1,802,842
public ImageResult queryImagedata(int id) throws SQLException{ String query = "SELECT * FROM IMAGES WHERE ID = "+id; ResultSet rs = query(query); int x; int y; int width; int height; String url; rs.next(); url =(String) rs.getObject("URL"); x =(Integer) rs.getObject("X"); y =(Integer) rs.getObject("Y"); height =(Integer) rs.getObject("HEIGHT"); width =(Integer) rs.getObject("WIDTH"); rs.close(); return new ImageResult(id, x, y, height, width, url); }
ImageResult function(int id) throws SQLException{ String query = STR+id; ResultSet rs = query(query); int x; int y; int width; int height; String url; rs.next(); url =(String) rs.getObject("URL"); x =(Integer) rs.getObject("X"); y =(Integer) rs.getObject("Y"); height =(Integer) rs.getObject(STR); width =(Integer) rs.getObject("WIDTH"); rs.close(); return new ImageResult(id, x, y, height, width, url); }
/** * Returns all information about an Image stored in the DB * @param query * @return * @throws SQLException */
Returns all information about an Image stored in the DB
queryImagedata
{ "repo_name": "topahl/StoryBear", "path": "StoryBear/src/com/opticalcobra/storybear/db/Database.java", "license": "gpl-3.0", "size": 17966 }
[ "java.sql.ResultSet", "java.sql.SQLException" ]
import java.sql.ResultSet; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,640,498
public void widgetSelected(SelectionEvent e) { String command = (String) ((MenuItem) e.getSource()).getData(); if (command.equals(PROPERTIES_COMMAND)) { attemptEditChartProperties(); } else if (command.equals(SAVE_COMMAND)) { try { doSaveAs(); } catch (IOException ex) { ex.printStackTrace(); } } else if (command.equals(PRINT_COMMAND)) { createChartPrintJob(); } else if (command.equals(ZOOM_IN_BOTH_COMMAND)) { zoomInBoth(e.x, e.y); } else if (command.equals(ZOOM_IN_DOMAIN_COMMAND)) { zoomInDomain(e.x, e.y); } else if (command.equals(ZOOM_IN_RANGE_COMMAND)) { zoomInRange(e.x, e.y); } else if (command.equals(ZOOM_OUT_BOTH_COMMAND)) { zoomOutBoth(e.x, e.y); } else if (command.equals(ZOOM_OUT_DOMAIN_COMMAND)) { zoomOutDomain(e.x, e.y); } else if (command.equals(ZOOM_OUT_RANGE_COMMAND)) { zoomOutRange(e.x, e.y); } else if (command.equals(ZOOM_RESET_BOTH_COMMAND)) { restoreAutoBounds(); } else if (command.equals(ZOOM_RESET_DOMAIN_COMMAND)) { restoreAutoDomainBounds(); } else if (command.equals(ZOOM_RESET_RANGE_COMMAND)) { restoreAutoRangeBounds(); } this.forceRedraw(); }
void function(SelectionEvent e) { String command = (String) ((MenuItem) e.getSource()).getData(); if (command.equals(PROPERTIES_COMMAND)) { attemptEditChartProperties(); } else if (command.equals(SAVE_COMMAND)) { try { doSaveAs(); } catch (IOException ex) { ex.printStackTrace(); } } else if (command.equals(PRINT_COMMAND)) { createChartPrintJob(); } else if (command.equals(ZOOM_IN_BOTH_COMMAND)) { zoomInBoth(e.x, e.y); } else if (command.equals(ZOOM_IN_DOMAIN_COMMAND)) { zoomInDomain(e.x, e.y); } else if (command.equals(ZOOM_IN_RANGE_COMMAND)) { zoomInRange(e.x, e.y); } else if (command.equals(ZOOM_OUT_BOTH_COMMAND)) { zoomOutBoth(e.x, e.y); } else if (command.equals(ZOOM_OUT_DOMAIN_COMMAND)) { zoomOutDomain(e.x, e.y); } else if (command.equals(ZOOM_OUT_RANGE_COMMAND)) { zoomOutRange(e.x, e.y); } else if (command.equals(ZOOM_RESET_BOTH_COMMAND)) { restoreAutoBounds(); } else if (command.equals(ZOOM_RESET_DOMAIN_COMMAND)) { restoreAutoDomainBounds(); } else if (command.equals(ZOOM_RESET_RANGE_COMMAND)) { restoreAutoRangeBounds(); } this.forceRedraw(); }
/** * Handles action events generated by the popup menu. * * @see org.eclipse.swt.events.SelectionListener#widgetSelected( * org.eclipse.swt.events.SelectionEvent) */
Handles action events generated by the popup menu
widgetSelected
{ "repo_name": "raincs13/phd", "path": "swt/org/jfree/experimental/chart/swt/ChartComposite.java", "license": "lgpl-2.1", "size": 69511 }
[ "java.io.IOException", "org.eclipse.swt.events.SelectionEvent", "org.eclipse.swt.widgets.MenuItem" ]
import java.io.IOException; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.MenuItem;
import java.io.*; import org.eclipse.swt.events.*; import org.eclipse.swt.widgets.*;
[ "java.io", "org.eclipse.swt" ]
java.io; org.eclipse.swt;
1,964,957
public float getCurrent() { if (Build.VERSION.SDK_INT >= 19) { return ((AccessibilityNodeInfo.RangeInfo) mInfo).getCurrent(); } else { return 0; } }
float function() { if (Build.VERSION.SDK_INT >= 19) { return ((AccessibilityNodeInfo.RangeInfo) mInfo).getCurrent(); } else { return 0; } }
/** * Gets the current value. * * @return The current value. */
Gets the current value
getCurrent
{ "repo_name": "AndroidX/androidx", "path": "core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java", "license": "apache-2.0", "size": 160272 }
[ "android.os.Build", "android.view.accessibility.AccessibilityNodeInfo" ]
import android.os.Build; import android.view.accessibility.AccessibilityNodeInfo;
import android.os.*; import android.view.accessibility.*;
[ "android.os", "android.view" ]
android.os; android.view;
10,911
public static AIInfo makeGuess(ArrayList<String> possibleColours, int numOfPegs, ArrayList<String> coloursInCode, ArrayList<String> coloursNotChecked) { ArrayList<String> guess = new ArrayList<String>(); // Has the program worked out which colours are in the code. if (numOfPegs != coloursInCode.size()) { String colourGuessed = coloursNotChecked.get(0); // If the program has worked out some of the colours in the code // from a previous guess. Those colours are added to the new guess. if (!coloursInCode.isEmpty()) { for (int i=0; i<coloursInCode.size(); i++) { guess.add(coloursInCode.get(i)); } } // The rest of the colours in the guess are a single colour, taken // from the list of colours that have not yet been checked. for (int j=coloursInCode.size(); j<numOfPegs; j++) { guess.add(colourGuessed); } coloursNotChecked.remove(0); AIInfo info = new AIInfo(guess, coloursInCode, coloursNotChecked, colourGuessed); return info; } else { // Make sure that the program has indeed found all the colours in // the code, if not in the correct order. String lastColour = coloursInCode.get(numOfPegs-1); String colourGuessed = "no longer relevant"; // Shift all the colours in the list of colours the program knows // is in the code to the right by one. The last colour gets sent // to the front. for (int j=numOfPegs-2; j>=0; j--) { coloursInCode.set(j+1, coloursInCode.get(j)); } coloursInCode.set(0, lastColour); guess = coloursInCode; AIInfo info = new AIInfo(guess, coloursInCode, coloursNotChecked, colourGuessed); return info; } }
static AIInfo function(ArrayList<String> possibleColours, int numOfPegs, ArrayList<String> coloursInCode, ArrayList<String> coloursNotChecked) { ArrayList<String> guess = new ArrayList<String>(); if (numOfPegs != coloursInCode.size()) { String colourGuessed = coloursNotChecked.get(0); if (!coloursInCode.isEmpty()) { for (int i=0; i<coloursInCode.size(); i++) { guess.add(coloursInCode.get(i)); } } for (int j=coloursInCode.size(); j<numOfPegs; j++) { guess.add(colourGuessed); } coloursNotChecked.remove(0); AIInfo info = new AIInfo(guess, coloursInCode, coloursNotChecked, colourGuessed); return info; } else { String lastColour = coloursInCode.get(numOfPegs-1); String colourGuessed = STR; for (int j=numOfPegs-2; j>=0; j--) { coloursInCode.set(j+1, coloursInCode.get(j)); } coloursInCode.set(0, lastColour); guess = coloursInCode; AIInfo info = new AIInfo(guess, coloursInCode, coloursNotChecked, colourGuessed); return info; } }
/** * Attempts to make an intelligent guess based off parameters passed in. * * @param possibleColours * Possible colours to choose from when guessing code. * @param numOfPegs * The length of the code. * @param coloursInCode * The colours the program knows are in the code. If a colour * occurs n times in the code, it occurs n times here. * @param coloursNotChecked * List of colours in that could be in code that have not been * checked. * @return Object called info, of type AIInfo, this contains the guess * the program has made, the colours the program has worked out * is in the code so far, the possible colours that have not * yet been checked and the colour that was added to the guess * this turn. */
Attempts to make an intelligent guess based off parameters passed in
makeGuess
{ "repo_name": "1orwell/Mastermind", "path": "AI.java", "license": "gpl-3.0", "size": 3113 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,392,384
private List<Method> findMethods(Method[] methods, Collection params, String beanifiedMethod) throws XmlRpcFault { List<Method> toReturn = new ArrayList<Method>(); //Loop through the methods array and find the one we are trying to call. for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(beanifiedMethod)) { // We found a method with the right name, but does the parameter count // match? int numberOfParams = methods[i].getParameterTypes().length; if (numberOfParams == params.size()) { //Method name and number of parameters match. toReturn.add(methods[i]); } } } if (toReturn.isEmpty()) { //The caller didn't get the method name or number of parameters right String message = "Could not find method: " + beanifiedMethod + " in class: " + this.getClass().getName() + " with params: ["; for (Iterator iter = params.iterator(); iter.hasNext();) { Object param = iter.next(); message += (param.getClass().getName()); if (iter.hasNext()) { message = message + ", "; } } message = message + "]"; throw new XmlRpcFault(-1, message); } return toReturn; }
List<Method> function(Method[] methods, Collection params, String beanifiedMethod) throws XmlRpcFault { List<Method> toReturn = new ArrayList<Method>(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(beanifiedMethod)) { int numberOfParams = methods[i].getParameterTypes().length; if (numberOfParams == params.size()) { toReturn.add(methods[i]); } } } if (toReturn.isEmpty()) { String message = STR + beanifiedMethod + STR + this.getClass().getName() + STR; for (Iterator iter = params.iterator(); iter.hasNext();) { Object param = iter.next(); message += (param.getClass().getName()); if (iter.hasNext()) { message = message + STR; } } message = message + "]"; throw new XmlRpcFault(-1, message); } return toReturn; }
/** * Private method to find the method in the java class that is being called * via xml-rpc * @param methods The methods contained in the class * @param params The parameters sent to us via xml-rpc * @param beanifiedMethod The method name we are looking for * @return The matching method we're looking for * @throws XmlRpcFault Thrown if we can't find the method asked for */
Private method to find the method in the java class that is being called via xml-rpc
findMethods
{ "repo_name": "ogajduse/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/BaseHandler.java", "license": "gpl-2.0", "size": 18478 }
[ "java.lang.reflect.Method", "java.util.ArrayList", "java.util.Collection", "java.util.Iterator", "java.util.List" ]
import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,367,902
public static boolean isLegalWorkspaceName(String name) { Matcher matcher = LEGAL_WORKSPACE_NAME.matcher(name); return matcher.matches(); }
static boolean function(String name) { Matcher matcher = LEGAL_WORKSPACE_NAME.matcher(name); return matcher.matches(); }
/** * Returns true if the given name is a valid workspace name. */
Returns true if the given name is a valid workspace name
isLegalWorkspaceName
{ "repo_name": "dslomov/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/WorkspaceGlobals.java", "license": "apache-2.0", "size": 12965 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
611,925
private static byte[] convertCharsToBytes(char[] chars) { CharBuffer charBuffer = CharBuffer.wrap(chars); ByteBuffer byteBuffer = Charset.forName("UTF-8").encode(charBuffer); return Arrays.copyOfRange(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit()); }
static byte[] function(char[] chars) { CharBuffer charBuffer = CharBuffer.wrap(chars); ByteBuffer byteBuffer = Charset.forName("UTF-8").encode(charBuffer); return Arrays.copyOfRange(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit()); }
/** * Returns a {@code byte[]} containing the value of the provided {@code char[]} without using {@code new String(chars).getBytes()} which would put sensitive data (the password) in the String pool. * * @param chars the characters to convert * @return the byte[] */
Returns a byte[] containing the value of the provided char[] without using new String(chars).getBytes() which would put sensitive data (the password) in the String pool
convertCharsToBytes
{ "repo_name": "jskora/nifi", "path": "nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/kms/CryptoUtils.java", "license": "apache-2.0", "size": 23246 }
[ "java.nio.ByteBuffer", "java.nio.CharBuffer", "java.nio.charset.Charset", "java.util.Arrays" ]
import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; import java.util.Arrays;
import java.nio.*; import java.nio.charset.*; import java.util.*;
[ "java.nio", "java.util" ]
java.nio; java.util;
1,006,019
protected void sequence_InfoBox(EObject context, InfoBox semanticObject) { if(errorAcceptor != null) { if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getInfoBox_Title()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getInfoBox_Title())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getInfoBox_Text()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getInfoBox_Text())); } INodesForEObjectProvider nodes = createNodeProvider(semanticObject); SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes); feeder.accept(grammarAccess.getInfoBoxAccess().getTitleSTRINGTerminalRuleCall_2_0(), semanticObject.getTitle()); feeder.accept(grammarAccess.getInfoBoxAccess().getTextSTRINGTerminalRuleCall_4_0(), semanticObject.getText()); feeder.finish(); }
void function(EObject context, InfoBox semanticObject) { if(errorAcceptor != null) { if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getInfoBox_Title()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getInfoBox_Title())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getInfoBox_Text()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getInfoBox_Text())); } INodesForEObjectProvider nodes = createNodeProvider(semanticObject); SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes); feeder.accept(grammarAccess.getInfoBoxAccess().getTitleSTRINGTerminalRuleCall_2_0(), semanticObject.getTitle()); feeder.accept(grammarAccess.getInfoBoxAccess().getTextSTRINGTerminalRuleCall_4_0(), semanticObject.getText()); feeder.finish(); }
/** * Constraint: * (title=STRING text=STRING) */
Constraint: (title=STRING text=STRING)
sequence_InfoBox
{ "repo_name": "niksavis/mm-dsl", "path": "org.xtext.nv.dsl/src-gen/org/xtext/nv/dsl/serializer/MMDSLSemanticSequencer.java", "license": "epl-1.0", "size": 190481 }
[ "org.eclipse.emf.ecore.EObject", "org.eclipse.xtext.serializer.acceptor.SequenceFeeder", "org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider", "org.eclipse.xtext.serializer.sequencer.ITransientValueService", "org.xtext.nv.dsl.mMDSL.InfoBox", "org.xtext.nv.dsl.mMDSL.MMDSLPackage", "org.xtext.nv.dsl.mMDSL.Text" ]
import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.serializer.acceptor.SequenceFeeder; import org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider; import org.eclipse.xtext.serializer.sequencer.ITransientValueService; import org.xtext.nv.dsl.mMDSL.InfoBox; import org.xtext.nv.dsl.mMDSL.MMDSLPackage; import org.xtext.nv.dsl.mMDSL.Text;
import org.eclipse.emf.ecore.*; import org.eclipse.xtext.serializer.acceptor.*; import org.eclipse.xtext.serializer.sequencer.*; import org.xtext.nv.dsl.*;
[ "org.eclipse.emf", "org.eclipse.xtext", "org.xtext.nv" ]
org.eclipse.emf; org.eclipse.xtext; org.xtext.nv;
1,125,862