method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public void addExclude(String term) { if (includes != null) { throw new IllegalArgumentException("Cannot have both include and exclude clauses"); } if (excludes == null) { excludes = new HashSet<>(); } excludes.add(term); }
void function(String term) { if (includes != null) { throw new IllegalArgumentException(STR); } if (excludes == null) { excludes = new HashSet<>(); } excludes.add(term); }
/** * Adds a term that should be excluded from results * @param term A term to be excluded */
Adds a term that should be excluded from results
addExclude
{ "repo_name": "GlenRSmith/elasticsearch", "path": "x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/VertexRequest.java", "license": "apache-2.0", "size": 7236 }
[ "java.util.HashSet" ]
import java.util.HashSet;
import java.util.*;
[ "java.util" ]
java.util;
1,343,409
public IgniteConfiguration setSslContextFactory(Factory<SSLContext> sslCtxFactory) { this.sslCtxFactory = sslCtxFactory; return this; }
IgniteConfiguration function(Factory<SSLContext> sslCtxFactory) { this.sslCtxFactory = sslCtxFactory; return this; }
/** * Sets SSL context factory that will be used for creating a secure socket layer. * * @param sslCtxFactory Ssl context factory. * @see SslContextFactory */
Sets SSL context factory that will be used for creating a secure socket layer
setSslContextFactory
{ "repo_name": "agura/incubator-ignite", "path": "modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java", "license": "apache-2.0", "size": 83303 }
[ "javax.cache.configuration.Factory", "javax.net.ssl.SSLContext" ]
import javax.cache.configuration.Factory; import javax.net.ssl.SSLContext;
import javax.cache.configuration.*; import javax.net.ssl.*;
[ "javax.cache", "javax.net" ]
javax.cache; javax.net;
111,112
public SVGLength replaceItem(SVGLength newItem, int index) throws DOMException, SVGException { return (SVGLength) replaceItemImpl(newItem,index); }
SVGLength function(SVGLength newItem, int index) throws DOMException, SVGException { return (SVGLength) replaceItemImpl(newItem,index); }
/** * <b>DOM</b>: Implements {@link * SVGLengthList#replaceItem(SVGLength,int)}. */
DOM: Implements <code>SVGLengthList#replaceItem(SVGLength,int)</code>
replaceItem
{ "repo_name": "git-moss/Push2Display", "path": "lib/batik-1.8/sources/org/apache/batik/anim/dom/AbstractSVGLengthList.java", "license": "lgpl-3.0", "size": 10092 }
[ "org.w3c.dom.DOMException", "org.w3c.dom.svg.SVGException", "org.w3c.dom.svg.SVGLength" ]
import org.w3c.dom.DOMException; import org.w3c.dom.svg.SVGException; import org.w3c.dom.svg.SVGLength;
import org.w3c.dom.*; import org.w3c.dom.svg.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,881,822
public List<DiskDetails> vMDiskDetails() { return this.vMDiskDetails; }
List<DiskDetails> function() { return this.vMDiskDetails; }
/** * Get vM disk details. * * @return the vMDiskDetails value */
Get vM disk details
vMDiskDetails
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/recoveryservices.siterecovery/mgmt-v2018_01_10/src/main/java/com/microsoft/azure/management/recoveryservices/siterecovery/v2018_01_10/HyperVReplicaBaseReplicationDetails.java", "license": "mit", "size": 5834 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,357,590
public void setInputStyle(int style) { if (getLength() != 0) { throw new RuntimeException("Console styles and colors cannot be " + "changed after I/O has started."); } inputAttributes.addAttribute(StyleConstants.Bold, new Boolean((style & Font.BOLD) != 0)); inputAttributes.addAttribute(StyleConstants.Italic, new Boolean((style & Font.ITALIC) != 0)); }
void function(int style) { if (getLength() != 0) { throw new RuntimeException(STR + STR); } inputAttributes.addAttribute(StyleConstants.Bold, new Boolean((style & Font.BOLD) != 0)); inputAttributes.addAttribute(StyleConstants.Italic, new Boolean((style & Font.ITALIC) != 0)); }
/** * Sets the style parameters for console input. The style parameter * is either <code>Font.PLAIN</code> or a sum of one or more of the attributes * <code>Font.BOLD</code> and <code>Font.ITALIC</code>. */
Sets the style parameters for console input. The style parameter is either <code>Font.PLAIN</code> or a sum of one or more of the attributes <code>Font.BOLD</code> and <code>Font.ITALIC</code>
setInputStyle
{ "repo_name": "jlutgen/stanford-whittier-cpplib", "path": "java/src/edu/stanford/cs/java/spl/JBEConsole.java", "license": "gpl-3.0", "size": 16397 }
[ "java.awt.Font", "javax.swing.text.StyleConstants" ]
import java.awt.Font; import javax.swing.text.StyleConstants;
import java.awt.*; import javax.swing.text.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,613,735
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request, io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) { asyncUnimplementedUnaryCall(METHOD_GET_GAUGE, responseObserver); }
void function(io.grpc.testing.integration.Metrics.GaugeRequest request, io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) { asyncUnimplementedUnaryCall(METHOD_GET_GAUGE, responseObserver); }
/** * <pre> * Returns the value of one gauge * </pre> */
<code> Returns the value of one gauge </code>
getGauge
{ "repo_name": "pieterjanpintens/grpc-java", "path": "interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java", "license": "apache-2.0", "size": 13074 }
[ "io.grpc.stub.ServerCalls" ]
import io.grpc.stub.ServerCalls;
import io.grpc.stub.*;
[ "io.grpc.stub" ]
io.grpc.stub;
2,267,202
@Override public void setComponentSecurity(ComponentSecurity componentSecurity) { if (!(componentSecurity instanceof CollectionGroupSecurity)) { throw new RiceRuntimeException( "Component security for CollectionGroup should be instance of CollectionGroupSecurity"); } super.setComponentSecurity(componentSecurity); }
void function(ComponentSecurity componentSecurity) { if (!(componentSecurity instanceof CollectionGroupSecurity)) { throw new RiceRuntimeException( STR); } super.setComponentSecurity(componentSecurity); }
/** * Override to assert a {@link CollectionGroupSecurity} instance is set * * @param componentSecurity - instance of CollectionGroupSecurity */
Override to assert a <code>CollectionGroupSecurity</code> instance is set
setComponentSecurity
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-kns/src/main/java/org/kuali/kfs/krad/uif/container/CollectionGroup.java", "license": "agpl-3.0", "size": 26974 }
[ "org.kuali.kfs.krad.uif.component.ComponentSecurity", "org.kuali.rice.core.api.exception.RiceRuntimeException" ]
import org.kuali.kfs.krad.uif.component.ComponentSecurity; import org.kuali.rice.core.api.exception.RiceRuntimeException;
import org.kuali.kfs.krad.uif.component.*; import org.kuali.rice.core.api.exception.*;
[ "org.kuali.kfs", "org.kuali.rice" ]
org.kuali.kfs; org.kuali.rice;
2,591,797
public boolean controlConcurrency(Request request, Response response) { return true; }
boolean function(Request request, Response response) { return true; }
/** * Subclass friendly method to add conditions. * @param request * @param response */
Subclass friendly method to add conditions
controlConcurrency
{ "repo_name": "pistolove/sourcecode4junit", "path": "Source4Tomcat/src/org/apache/catalina/valves/SemaphoreValve.java", "license": "apache-2.0", "size": 6702 }
[ "org.apache.catalina.connector.Request", "org.apache.catalina.connector.Response" ]
import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response;
import org.apache.catalina.connector.*;
[ "org.apache.catalina" ]
org.apache.catalina;
671,633
public TreeItem buildComponentsTree() { return buildTree(); } // PropertyChangeListener implementation
TreeItem function() { return buildTree(); }
/** * Builds a tree of the component hierarchy of the form for display in the * {@code SourceStructureExplorer}. * * @return tree showing the component hierarchy of the form */
Builds a tree of the component hierarchy of the form for display in the SourceStructureExplorer
buildComponentsTree
{ "repo_name": "josmas/app-inventor", "path": "appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockForm.java", "license": "apache-2.0", "size": 59920 }
[ "com.google.gwt.user.client.ui.TreeItem" ]
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.*;
[ "com.google.gwt" ]
com.google.gwt;
865,197
public static DataSource createCSVSource(String file, Charset charset, char separator, boolean containsHeader) { return createCSVSource(new File(file), charset, separator, containsHeader); }
static DataSource function(String file, Charset charset, char separator, boolean containsHeader) { return createCSVSource(new File(file), charset, separator, containsHeader); }
/** * Creates a CSV data source. * * @param file * @param separator * @param containsHeader * @return */
Creates a CSV data source
createCSVSource
{ "repo_name": "arx-deidentifier/arx", "path": "src/main/org/deidentifier/arx/DataSource.java", "license": "apache-2.0", "size": 10980 }
[ "java.io.File", "java.nio.charset.Charset" ]
import java.io.File; import java.nio.charset.Charset;
import java.io.*; import java.nio.charset.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
2,424,166
public void remove() throws IOException, InterruptedException { if (props.remove(getPropertyKey())!=null) save(); }
void function() throws IOException, InterruptedException { if (props.remove(getPropertyKey())!=null) save(); }
/** * Removes the persisted credential, if there's one. */
Removes the persisted credential, if there's one
remove
{ "repo_name": "synopsys-arc-oss/jenkins", "path": "core/src/main/java/hudson/cli/ClientAuthenticationCache.java", "license": "mit", "size": 4020 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,055,896
@Override public void inputChanged(InputChangeEvent ae) { inputs[ae.getIndex()].set(ae.getState()); }
void function(InputChangeEvent ae) { inputs[ae.getIndex()].set(ae.getState()); }
/** * Called when any relevant Phidget boolean input changes. * * @param ae The input change event. */
Called when any relevant Phidget boolean input changes
inputChanged
{ "repo_name": "Ja-ake/Common-Chicken-Runtime-Engine", "path": "PoultryInspector/src/ccre/supercanvas/phidget/PhidgetMonitor.java", "license": "lgpl-3.0", "size": 13151 }
[ "com.phidgets.event.InputChangeEvent" ]
import com.phidgets.event.InputChangeEvent;
import com.phidgets.event.*;
[ "com.phidgets.event" ]
com.phidgets.event;
2,259,528
public boolean match(List<String> wordList, int i) { boolean result = false; int size = this.size(); if (i < wordList.size() - size + 1) { List<String> phraseWords = this.termPhrase.getWordList(); result = true; for (int j = 0; j < size; j++) { if (!wordList.get(i + j).equals(phraseWords.get(j))) { result = false; break; } } } return result; }
boolean function(List<String> wordList, int i) { boolean result = false; int size = this.size(); if (i < wordList.size() - size + 1) { List<String> phraseWords = this.termPhrase.getWordList(); result = true; for (int j = 0; j < size; j++) { if (!wordList.get(i + j).equals(phraseWords.get(j))) { result = false; break; } } } return result; }
/** match against term phrase * * very crude - no hashing, just for test * * @param wordList * @param i * @return */
match against term phrase very crude - no hashing, just for test
match
{ "repo_name": "anusharanganathan/ami-plugin", "path": "src/main/java/org/xmlcml/ami2/dictionary/DictionaryTerm.java", "license": "apache-2.0", "size": 2308 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
810,113
@Override @PublicAtsApi public void verifyNotValue( String notExpectedValue ) { notExpectedValue = notExpectedValue.trim(); String actualText = getValue().trim(); if (actualText.equals(notExpectedValue)) { throw new VerifyNotEqualityException(notExpectedValue, this); } }
void function( String notExpectedValue ) { notExpectedValue = notExpectedValue.trim(); String actualText = getValue().trim(); if (actualText.equals(notExpectedValue)) { throw new VerifyNotEqualityException(notExpectedValue, this); } }
/** * Verify the selected value is NOT as specified * * @param notExpectedValue */
Verify the selected value is NOT as specified
verifyNotValue
{ "repo_name": "Axway/ats-framework", "path": "uiengine/src/main/java/com/axway/ats/uiengine/elements/html/realbrowser/RealHtmlSingleSelectList.java", "license": "apache-2.0", "size": 5718 }
[ "com.axway.ats.uiengine.exceptions.VerifyNotEqualityException" ]
import com.axway.ats.uiengine.exceptions.VerifyNotEqualityException;
import com.axway.ats.uiengine.exceptions.*;
[ "com.axway.ats" ]
com.axway.ats;
2,336,387
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); org.openide.awt.Mnemonics.setLocalizedText(jLabel1, I18n.getString("CrosstabVisualPanel6.Label.Info")); // NOI18N org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(29, 29, 29) .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 322, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(49, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(70, 70, 70) .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 140, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(90, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; // End of variables declaration//GEN-END:variables
void function() { jLabel1 = new javax.swing.JLabel(); jLabel1.setFont(new java.awt.Font(STR, 0, 14)); org.openide.awt.Mnemonics.setLocalizedText(jLabel1, I18n.getString(STR)); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(29, 29, 29) .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 322, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(49, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(70, 70, 70) .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 140, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(90, Short.MAX_VALUE)) ); } private javax.swing.JLabel jLabel1;
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */
This method is called from within the constructor to initialize the form. always regenerated by the Form Editor
initComponents
{ "repo_name": "klebergraciasoares/ireport-fork", "path": "ireport-designer/src/com/jaspersoft/ireport/designer/crosstab/wizard/CrosstabVisualPanel6.java", "license": "agpl-3.0", "size": 3084 }
[ "com.jaspersoft.ireport.locale.I18n" ]
import com.jaspersoft.ireport.locale.I18n;
import com.jaspersoft.ireport.locale.*;
[ "com.jaspersoft.ireport" ]
com.jaspersoft.ireport;
862,900
public static Date parseDateString(String dateString) { return TextTools.parseDate(dateString); }
static Date function(String dateString) { return TextTools.parseDate(dateString); }
/** * parse Date String * @param dateString * @return */
parse Date String
parseDateString
{ "repo_name": "harryhoch/DeepPhe", "path": "src/edu/pitt/dbmi/deep/phe/util/TextUtils.java", "license": "apache-2.0", "size": 2048 }
[ "edu.pitt.dbmi.nlp.noble.tools.TextTools", "java.util.Date" ]
import edu.pitt.dbmi.nlp.noble.tools.TextTools; import java.util.Date;
import edu.pitt.dbmi.nlp.noble.tools.*; import java.util.*;
[ "edu.pitt.dbmi", "java.util" ]
edu.pitt.dbmi; java.util;
2,536,621
@Override protected void deploy() { // create configuration factory final ConfigurationFactory configurationFactory = new DefaultConfigurationFactory(); // create Glassfish configuration final LocalConfiguration configuration = (LocalConfiguration) configurationFactory.createConfiguration("glassfish2", ContainerType.INSTALLED, ConfigurationType.STANDALONE, containerHome + "cargo-conf/"); // setup configuration final StringBuilder args = new StringBuilder(); for (final String arg : jvmArguments) { args.append(arg); args.append(" "); if (LOGGER.isInfoEnabled()) { LOGGER.info("Added JVM argument: " + arg); } } configuration.setProperty(GeneralPropertySet.JVMARGS, args.toString()); configuration.setProperty(ServletPropertySet.PORT, containerPort.toString()); final Set<Entry<String, String>> entrySet = deployableLocations.entrySet(); final Iterator<Entry<String, String>> iterator = entrySet.iterator(); while (iterator.hasNext()) { final Entry<String, String> entry = iterator.next(); final String key = entry.getKey(); final String value = entry.getValue(); DeployableType deployableType = null; deployableType = determineDeployableType(value); addDeployable(configuration, key, deployableType); } for (final DeployableLocationConfiguration config : deployableLocationConfigurations) { final String contextName = config.getContextName(); final String type = config.getType(); String path = config.getPath(); DeployableType deployableType = null; if (contextName != null && contextName.length() > 0) { deployableType = determineDeployableType(type); if (DeployableType.WAR.equals(deployableType)) { final File srcFile = new File(path); final File destFile = new File("target/" + contextName + ".war"); try { FileUtils.copyFile(srcFile, destFile); } catch (final IOException e) { throw new DeployException("Failed to copy WAR file: " + path, e); } path = destFile.getPath(); } } else { deployableType = determineDeployableType(type); } addDeployable(configuration, path, deployableType); } // create installedLocalContainer installedLocalContainer = (InstalledLocalContainer) new DefaultContainerFactory().createContainer("glassfish2", ContainerType.INSTALLED, configuration); // configure installedLocalContainer installedLocalContainer.setHome(containerHome); final Logger fileLogger = new FileLogger(new File(cargoLogFilePath + "cargo.log"), true); fileLogger.setLevel(LogLevel.DEBUG); installedLocalContainer.setLogger(fileLogger); installedLocalContainer.setOutput(cargoLogFilePath + "output.log"); // set the system properties installedLocalContainer.setSystemProperties(systemProperties); try { completeGlassfishConfiguration(); } catch (final IOException e) { throw new DeployException("Failed to complete the Glassfish configuration while setting the env files", e); } if (LOGGER.isInfoEnabled()) { LOGGER.info("Starting Glassfish [" + configurationName + "]..."); } // startup installedLocalContainer installedLocalContainer.start(); // Here you are assured the container is started. if (LOGGER.isInfoEnabled()) { LOGGER.info("Glassfish up and running!"); } }
void function() { final ConfigurationFactory configurationFactory = new DefaultConfigurationFactory(); final LocalConfiguration configuration = (LocalConfiguration) configurationFactory.createConfiguration(STR, ContainerType.INSTALLED, ConfigurationType.STANDALONE, containerHome + STR); final StringBuilder args = new StringBuilder(); for (final String arg : jvmArguments) { args.append(arg); args.append(" "); if (LOGGER.isInfoEnabled()) { LOGGER.info(STR + arg); } } configuration.setProperty(GeneralPropertySet.JVMARGS, args.toString()); configuration.setProperty(ServletPropertySet.PORT, containerPort.toString()); final Set<Entry<String, String>> entrySet = deployableLocations.entrySet(); final Iterator<Entry<String, String>> iterator = entrySet.iterator(); while (iterator.hasNext()) { final Entry<String, String> entry = iterator.next(); final String key = entry.getKey(); final String value = entry.getValue(); DeployableType deployableType = null; deployableType = determineDeployableType(value); addDeployable(configuration, key, deployableType); } for (final DeployableLocationConfiguration config : deployableLocationConfigurations) { final String contextName = config.getContextName(); final String type = config.getType(); String path = config.getPath(); DeployableType deployableType = null; if (contextName != null && contextName.length() > 0) { deployableType = determineDeployableType(type); if (DeployableType.WAR.equals(deployableType)) { final File srcFile = new File(path); final File destFile = new File(STR + contextName + ".war"); try { FileUtils.copyFile(srcFile, destFile); } catch (final IOException e) { throw new DeployException(STR + path, e); } path = destFile.getPath(); } } else { deployableType = determineDeployableType(type); } addDeployable(configuration, path, deployableType); } installedLocalContainer = (InstalledLocalContainer) new DefaultContainerFactory().createContainer(STR, ContainerType.INSTALLED, configuration); installedLocalContainer.setHome(containerHome); final Logger fileLogger = new FileLogger(new File(cargoLogFilePath + STR), true); fileLogger.setLevel(LogLevel.DEBUG); installedLocalContainer.setLogger(fileLogger); installedLocalContainer.setOutput(cargoLogFilePath + STR); installedLocalContainer.setSystemProperties(systemProperties); try { completeGlassfishConfiguration(); } catch (final IOException e) { throw new DeployException(STR, e); } if (LOGGER.isInfoEnabled()) { LOGGER.info(STR + configurationName + "]..."); } installedLocalContainer.start(); if (LOGGER.isInfoEnabled()) { LOGGER.info(STR); } }
/** * Deploys the application to the correct */
Deploys the application to the correct
deploy
{ "repo_name": "snkpetrus/cargo-itest", "path": "src/main/java/nl/tranquilizedquality/itest/cargo/AbstractGlassfishContainerUtil.java", "license": "apache-2.0", "size": 12671 }
[ "java.io.File", "java.io.IOException", "java.util.Iterator", "java.util.Map", "java.util.Set", "nl.tranquilizedquality.itest.cargo.exception.DeployException", "nl.tranquilizedquality.itest.domain.DeployableLocationConfiguration", "org.apache.commons.io.FileUtils", "org.codehaus.cargo.container.ContainerType", "org.codehaus.cargo.container.InstalledLocalContainer", "org.codehaus.cargo.container.configuration.ConfigurationType", "org.codehaus.cargo.container.configuration.LocalConfiguration", "org.codehaus.cargo.container.deployable.DeployableType", "org.codehaus.cargo.container.property.GeneralPropertySet", "org.codehaus.cargo.container.property.ServletPropertySet", "org.codehaus.cargo.generic.DefaultContainerFactory", "org.codehaus.cargo.generic.configuration.ConfigurationFactory", "org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory", "org.codehaus.cargo.util.log.FileLogger", "org.codehaus.cargo.util.log.LogLevel", "org.codehaus.cargo.util.log.Logger" ]
import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.Set; import nl.tranquilizedquality.itest.cargo.exception.DeployException; import nl.tranquilizedquality.itest.domain.DeployableLocationConfiguration; import org.apache.commons.io.FileUtils; import org.codehaus.cargo.container.ContainerType; import org.codehaus.cargo.container.InstalledLocalContainer; import org.codehaus.cargo.container.configuration.ConfigurationType; import org.codehaus.cargo.container.configuration.LocalConfiguration; import org.codehaus.cargo.container.deployable.DeployableType; import org.codehaus.cargo.container.property.GeneralPropertySet; import org.codehaus.cargo.container.property.ServletPropertySet; import org.codehaus.cargo.generic.DefaultContainerFactory; import org.codehaus.cargo.generic.configuration.ConfigurationFactory; import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory; import org.codehaus.cargo.util.log.FileLogger; import org.codehaus.cargo.util.log.LogLevel; import org.codehaus.cargo.util.log.Logger;
import java.io.*; import java.util.*; import nl.tranquilizedquality.itest.cargo.exception.*; import nl.tranquilizedquality.itest.domain.*; import org.apache.commons.io.*; import org.codehaus.cargo.container.*; import org.codehaus.cargo.container.configuration.*; import org.codehaus.cargo.container.deployable.*; import org.codehaus.cargo.container.property.*; import org.codehaus.cargo.generic.*; import org.codehaus.cargo.generic.configuration.*; import org.codehaus.cargo.util.log.*;
[ "java.io", "java.util", "nl.tranquilizedquality.itest", "org.apache.commons", "org.codehaus.cargo" ]
java.io; java.util; nl.tranquilizedquality.itest; org.apache.commons; org.codehaus.cargo;
1,066,130
EClass getInlineAssociation_();
EClass getInlineAssociation_();
/** * Returns the meta object for class '{@link cruise.umple.umple.InlineAssociation_ <em>Inline Association </em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Inline Association </em>'. * @see cruise.umple.umple.InlineAssociation_ * @generated */
Returns the meta object for class '<code>cruise.umple.umple.InlineAssociation_ Inline Association </code>'.
getInlineAssociation_
{ "repo_name": "ahmedvc/umple", "path": "cruise.umple.xtext/src-gen/cruise/umple/umple/UmplePackage.java", "license": "mit", "size": 485842 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
392,110
Task[] getTasks() throws RemoteException;
Task[] getTasks() throws RemoteException;
/** * Returns a list of all tasks of this measurement. * * @return List of tasks. * @throws RemoteException */
Returns a list of all tasks of this measurement
getTasks
{ "repo_name": "langmo/youscope", "path": "core/api/src/main/java/org/youscope/common/measurement/Measurement.java", "license": "gpl-2.0", "size": 13274 }
[ "java.rmi.RemoteException", "org.youscope.common.task.Task" ]
import java.rmi.RemoteException; import org.youscope.common.task.Task;
import java.rmi.*; import org.youscope.common.task.*;
[ "java.rmi", "org.youscope.common" ]
java.rmi; org.youscope.common;
637,830
public int unentitle(String clientCert) { Server server = validateClientCertificate(clientCert); SystemManager.removeAllServerEntitlements(server.getId()); SystemManager.snapshotServer(server, LocalizationService .getInstance().getMessage("snapshots.entitlements")); return 1; }
int function(String clientCert) { Server server = validateClientCertificate(clientCert); SystemManager.removeAllServerEntitlements(server.getId()); SystemManager.snapshotServer(server, LocalizationService .getInstance().getMessage(STR)); return 1; }
/** * Unentitle the system completely * @param clientCert client system id file * @return 1 if successful * * @xmlrpc.doc Unentitle the system completely * @xmlrpc.param #param_desc("string", "systemid", "systemid file") * @xmlrpc.returntype #return_int_success() */
Unentitle the system completely
unentitle
{ "repo_name": "moio/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java", "license": "gpl-2.0", "size": 230187 }
[ "com.redhat.rhn.common.localization.LocalizationService", "com.redhat.rhn.domain.server.Server", "com.redhat.rhn.manager.system.SystemManager" ]
import com.redhat.rhn.common.localization.LocalizationService; import com.redhat.rhn.domain.server.Server; import com.redhat.rhn.manager.system.SystemManager;
import com.redhat.rhn.common.localization.*; import com.redhat.rhn.domain.server.*; import com.redhat.rhn.manager.system.*;
[ "com.redhat.rhn" ]
com.redhat.rhn;
227,675
public void loadFromFolder(File folder, String... ignoredFiles) { List<String> ignored = Arrays.asList(ignoredFiles); if (folder.exists()) { for (File f : folder.listFiles()) { if (ignored.contains(f.getName())) { TranslateAPI.warn("Skipping " + f.getName()); } else { TranslateAPI.warn("Adding " + f.getName()); addLanguage(new Language(f.getName().replace(".yml", ""), f)); } } } else { TranslateAPI.warn("§4Folder " + folder.getName() + " don't exist (Rt if you cry everyday)"); } }
void function(File folder, String... ignoredFiles) { List<String> ignored = Arrays.asList(ignoredFiles); if (folder.exists()) { for (File f : folder.listFiles()) { if (ignored.contains(f.getName())) { TranslateAPI.warn(STR + f.getName()); } else { TranslateAPI.warn(STR + f.getName()); addLanguage(new Language(f.getName().replace(".yml", STR§4Folder STR don't exist (Rt if you cry everyday)"); } }
/** * Load all languages from a folder excepting some files * * @param folder * @param ignoredFiles */
Load all languages from a folder excepting some files
loadFromFolder
{ "repo_name": "SkyLouna/TranslateAPI", "path": "src/ch/skylouna/translateapi/manager/LanguageManager.java", "license": "mit", "size": 3234 }
[ "ch.skylouna.translateapi.TranslateAPI", "ch.skylouna.translateapi.object.Language", "java.io.File", "java.util.Arrays", "java.util.List" ]
import ch.skylouna.translateapi.TranslateAPI; import ch.skylouna.translateapi.object.Language; import java.io.File; import java.util.Arrays; import java.util.List;
import ch.skylouna.translateapi.*; import ch.skylouna.translateapi.object.*; import java.io.*; import java.util.*;
[ "ch.skylouna.translateapi", "java.io", "java.util" ]
ch.skylouna.translateapi; java.io; java.util;
315,213
public void saveStatistics(ClientStats stats, String file) throws IOException { this.client.get().writeSummaryCSV(stats, file); }
void function(ClientStats stats, String file) throws IOException { this.client.get().writeSummaryCSV(stats, file); }
/** * Save statistics to a CSV file. * * @param file * File path * @throws IOException */
Save statistics to a CSV file
saveStatistics
{ "repo_name": "eoneil1942/voltdb-4.7fix", "path": "src/frontend/org/voltdb/jdbc/JDBC4ClientConnection.java", "license": "agpl-3.0", "size": 18714 }
[ "java.io.IOException", "org.voltdb.client.ClientStats" ]
import java.io.IOException; import org.voltdb.client.ClientStats;
import java.io.*; import org.voltdb.client.*;
[ "java.io", "org.voltdb.client" ]
java.io; org.voltdb.client;
1,627,016
if (file == null) { return Collections.emptyMap(); } else if (!file.isFile() || !file.canRead()) { throw new IOException(String.format("%s is not a readable file", file.getAbsolutePath())); } else { try { return new Gson().fromJson(new FileReader(file), new TypeToken<Map<String, Object>>() { }.getType()); } catch (JsonSyntaxException e) { throw new AmbariException(String.format("Failed to parse JSON-formatted file: %s", file.getAbsolutePath()), e); } } }
if (file == null) { return Collections.emptyMap(); } else if (!file.isFile() !file.canRead()) { throw new IOException(String.format(STR, file.getAbsolutePath())); } else { try { return new Gson().fromJson(new FileReader(file), new TypeToken<Map<String, Object>>() { }.getType()); } catch (JsonSyntaxException e) { throw new AmbariException(String.format(STR, file.getAbsolutePath()), e); } } }
/** * Parses a file containing JSON-formatted text into a (generic) Map. * * @param file a File containing the JSON-formatted text to parse * @return a Map of the data * @throws java.io.FileNotFoundException if the specified File does not point to a valid file * @throws java.io.IOException if the specified File is not a readable file * @throws org.apache.ambari.server.AmbariException if the specified File does not contain valid JSON data */
Parses a file containing JSON-formatted text into a (generic) Map
parseFile
{ "repo_name": "zouzhberk/ambaridemo", "path": "demo-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptorFactory.java", "license": "apache-2.0", "size": 3177 }
[ "com.google.gson.Gson", "com.google.gson.JsonSyntaxException", "com.google.gson.reflect.TypeToken", "java.io.FileReader", "java.io.IOException", "java.util.Collections", "java.util.Map", "org.apache.ambari.server.AmbariException" ]
import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; import com.google.gson.reflect.TypeToken; import java.io.FileReader; import java.io.IOException; import java.util.Collections; import java.util.Map; import org.apache.ambari.server.AmbariException;
import com.google.gson.*; import com.google.gson.reflect.*; import java.io.*; import java.util.*; import org.apache.ambari.server.*;
[ "com.google.gson", "java.io", "java.util", "org.apache.ambari" ]
com.google.gson; java.io; java.util; org.apache.ambari;
748,191
private Properties getUDFProperties() { return UDFContext.getUDFContext() .getUDFProperties(this.getClass(), new String[] {contextSignature}); }
Properties function() { return UDFContext.getUDFContext() .getUDFProperties(this.getClass(), new String[] {contextSignature}); }
/** * Returns UDFProperties based on <code>contextSignature</code>. */
Returns UDFProperties based on <code>contextSignature</code>
getUDFProperties
{ "repo_name": "netxillon/pig", "path": "src/org/apache/pig/backend/hadoop/hbase/HBaseStorage.java", "license": "apache-2.0", "size": 58953 }
[ "java.util.Properties", "org.apache.pig.impl.util.UDFContext" ]
import java.util.Properties; import org.apache.pig.impl.util.UDFContext;
import java.util.*; import org.apache.pig.impl.util.*;
[ "java.util", "org.apache.pig" ]
java.util; org.apache.pig;
1,364,877
public void handleResult(Object result) { if (viewer.getState() == Browser.DISCARDED) return; //Async cancel. if (parent == null) viewer.setExperimenterData(expNode, (Collection) result); else { } }
void function(Object result) { if (viewer.getState() == Browser.DISCARDED) return; if (parent == null) viewer.setExperimenterData(expNode, (Collection) result); else { } }
/** * Feeds the result back to the viewer. * @see DataBrowserLoader#handleResult(Object) */
Feeds the result back to the viewer
handleResult
{ "repo_name": "joshmoore/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScreenPlateLoader.java", "license": "gpl-2.0", "size": 5183 }
[ "java.util.Collection", "org.openmicroscopy.shoola.agents.treeviewer.browser.Browser" ]
import java.util.Collection; import org.openmicroscopy.shoola.agents.treeviewer.browser.Browser;
import java.util.*; import org.openmicroscopy.shoola.agents.treeviewer.browser.*;
[ "java.util", "org.openmicroscopy.shoola" ]
java.util; org.openmicroscopy.shoola;
1,556,799
@NotNull SourceFolder addSourceFolder(@NotNull String url, boolean isTestSource);
SourceFolder addSourceFolder(@NotNull String url, boolean isTestSource);
/** * Adds a source or test source root under the content root. * * @param url the file or directory url to add as a source root. * @param isTestSource true if the file or directory is added as a test source root. * @return the object representing the added root. */
Adds a source or test source root under the content root
addSourceFolder
{ "repo_name": "caot/intellij-community", "path": "platform/projectModel-api/src/com/intellij/openapi/roots/ContentEntry.java", "license": "apache-2.0", "size": 6778 }
[ "org.jetbrains.annotations.NotNull" ]
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
710,514
public boolean isApplicable(RelationSet rset1) { boolean result = true; this.setParentIndex (rset1.getIndex()); int curLevel = rset1.getNestingLevel() + 1; this.setNestingLevel (curLevel); this.setOldSiblingIndex(-1); RefiningMap vmap1 = rset1.getMapping(); this.setRefiningMap (vmap1); BigInteger factor = BigInteger.valueOf(solver.getModBase()).pow(curLevel); ModoMeter meter = solver.getPreparedMeter(rset1, vmap1, factor); this.setDispenser (meter); return result; } // isApplicable
boolean function(RelationSet rset1) { boolean result = true; this.setParentIndex (rset1.getIndex()); int curLevel = rset1.getNestingLevel() + 1; this.setNestingLevel (curLevel); this.setOldSiblingIndex(-1); RefiningMap vmap1 = rset1.getMapping(); this.setRefiningMap (vmap1); BigInteger factor = BigInteger.valueOf(solver.getModBase()).pow(curLevel); ModoMeter meter = solver.getPreparedMeter(rset1, vmap1, factor); this.setDispenser (meter); return result; }
/** Whether <em>this</em> branch can and should be applied to the * current {@link RelationSet}. * This method is tested for all coded branches, and the * first with result <em>true</em> stops the testing sequence. * The last entry ({@link BaseBranch}) is always true. * Pseudo-abstract, will be refined by derived classes. * @param rset1 RelationSet to be expanded * @return <em>true</em> if the <em>this</em> branch can be applied, * or <em>false</em> otherwise. */
Whether this branch can and should be applied to the current <code>RelationSet</code>. This method is tested for all coded branches, and the first with result true stops the testing sequence. The last entry (<code>BaseBranch</code>) is always true. Pseudo-abstract, will be refined by derived classes
isApplicable
{ "repo_name": "gfis/ramath", "path": "src/main/java/org/teherba/ramath/symbolic/branch/BaseBranch.java", "license": "apache-2.0", "size": 10212 }
[ "java.math.BigInteger", "org.teherba.ramath.symbolic.RefiningMap", "org.teherba.ramath.symbolic.RelationSet", "org.teherba.ramath.util.ModoMeter" ]
import java.math.BigInteger; import org.teherba.ramath.symbolic.RefiningMap; import org.teherba.ramath.symbolic.RelationSet; import org.teherba.ramath.util.ModoMeter;
import java.math.*; import org.teherba.ramath.symbolic.*; import org.teherba.ramath.util.*;
[ "java.math", "org.teherba.ramath" ]
java.math; org.teherba.ramath;
1,981,686
public boolean saveSettings(Context ctx) { JSONObject json = new JSONObject(); try { json.put("evaluationAlgorithm", evaluationAlgorithm); json.put("templateCreateCount", templateCreateCount); json.put("templateHoldCount", templateHoldCount); json.put("externalSaving", externalSaving); json.put("flag", flag); json.put("graphs", graphs); json.put("pThreshold", pThreshold); json.put("tTestsSensitivity", sensitivity[T_TESTS]); json.put("manhattanSensitivity", sensitivity[MANHATTAN]); json.put("euclideanSensitivity", sensitivity[EUCLIDEAN]); } catch (JSONException e) { Log.e(UserLoggerManager.LOGNAME, e.getMessage(), e); return false; } try { StorageHandler.saveFile(UserLoggerManager.SETTINGS_FILE, json.toString(), ctx, false); } catch (IOException e) { Log.e(UserLoggerManager.LOGNAME, e.getMessage(), e); return false; } return true; }
boolean function(Context ctx) { JSONObject json = new JSONObject(); try { json.put(STR, evaluationAlgorithm); json.put(STR, templateCreateCount); json.put(STR, templateHoldCount); json.put(STR, externalSaving); json.put("flag", flag); json.put(STR, graphs); json.put(STR, pThreshold); json.put(STR, sensitivity[T_TESTS]); json.put(STR, sensitivity[MANHATTAN]); json.put(STR, sensitivity[EUCLIDEAN]); } catch (JSONException e) { Log.e(UserLoggerManager.LOGNAME, e.getMessage(), e); return false; } try { StorageHandler.saveFile(UserLoggerManager.SETTINGS_FILE, json.toString(), ctx, false); } catch (IOException e) { Log.e(UserLoggerManager.LOGNAME, e.getMessage(), e); return false; } return true; }
/** * Save default settings to file. * * @param ctx * activity context * @return true on success, error on fail */
Save default settings to file
saveSettings
{ "repo_name": "Morzeux/BiosecLogger", "path": "src/biosecLogger/core/OptionsManager.java", "license": "apache-2.0", "size": 7630 }
[ "android.content.Context", "android.util.Log", "java.io.IOException", "org.json.JSONException", "org.json.JSONObject" ]
import android.content.Context; import android.util.Log; import java.io.IOException; import org.json.JSONException; import org.json.JSONObject;
import android.content.*; import android.util.*; import java.io.*; import org.json.*;
[ "android.content", "android.util", "java.io", "org.json" ]
android.content; android.util; java.io; org.json;
1,853,707
ApiConfig config = new ApiConfig().setDebugLevel(Level.FINEST).setKey(apiKey).setTournamentKey(tournamentApiKey); return new RiotApi(config); }
ApiConfig config = new ApiConfig().setDebugLevel(Level.FINEST).setKey(apiKey).setTournamentKey(tournamentApiKey); return new RiotApi(config); }
/** * This method provides an {@link RiotApi} object with the {@code apiKey} specified in this class to other tests. * * @return {@code RiotApi} object * @see RiotApi */
This method provides an <code>RiotApi</code> object with the apiKey specified in this class to other tests
getRiotApi
{ "repo_name": "rithms/riot-api-java", "path": "src/test/java/net/rithms/test/RiotApiTest.java", "license": "apache-2.0", "size": 2143 }
[ "java.util.logging.Level", "net.rithms.riot.api.ApiConfig", "net.rithms.riot.api.RiotApi" ]
import java.util.logging.Level; import net.rithms.riot.api.ApiConfig; import net.rithms.riot.api.RiotApi;
import java.util.logging.*; import net.rithms.riot.api.*;
[ "java.util", "net.rithms.riot" ]
java.util; net.rithms.riot;
2,440,502
public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING))); }
IBlockState function(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING))); }
/** * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed * blockstate. */
Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed blockstate
withRotation
{ "repo_name": "SparkyTheFox/Sparkys-Mod-1.11.2-1.4.0-Alpha-SourceCode", "path": "common/mod/sparkyfox/servermod/block/adventure/BlockRuinsBridge.java", "license": "lgpl-3.0", "size": 4334 }
[ "net.minecraft.block.state.IBlockState", "net.minecraft.util.EnumFacing", "net.minecraft.util.Rotation" ]
import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.Rotation;
import net.minecraft.block.state.*; import net.minecraft.util.*;
[ "net.minecraft.block", "net.minecraft.util" ]
net.minecraft.block; net.minecraft.util;
1,413,302
public static MutateRequest buildMutateRequest( final byte[] regionName, final Put put) throws IOException { MutateRequest.Builder builder = MutateRequest.newBuilder(); RegionSpecifier region = buildRegionSpecifier( RegionSpecifierType.REGION_NAME, regionName); builder.setRegion(region); builder.setMutation(ProtobufUtil.toMutation(MutationType.PUT, put)); return builder.build(); }
static MutateRequest function( final byte[] regionName, final Put put) throws IOException { MutateRequest.Builder builder = MutateRequest.newBuilder(); RegionSpecifier region = buildRegionSpecifier( RegionSpecifierType.REGION_NAME, regionName); builder.setRegion(region); builder.setMutation(ProtobufUtil.toMutation(MutationType.PUT, put)); return builder.build(); }
/** * Create a protocol buffer MutateRequest for a put * * @param regionName * @param put * @return a mutate request * @throws IOException */
Create a protocol buffer MutateRequest for a put
buildMutateRequest
{ "repo_name": "francisliu/hbase_namespace", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java", "license": "apache-2.0", "size": 49508 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.Put", "org.apache.hadoop.hbase.protobuf.generated.ClientProtos", "org.apache.hadoop.hbase.protobuf.generated.HBaseProtos" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos;
import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.protobuf.generated.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,589,144
protected RequestState getState() { return DefaultAuthenticationManager.getRequestState( this.context ); }
RequestState function() { return DefaultAuthenticationManager.getRequestState( this.context ); }
/** * Return the current authentication state */
Return the current authentication state
getState
{ "repo_name": "apache/cocoon", "path": "blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/context/AuthenticationContext.java", "license": "apache-2.0", "size": 34738 }
[ "org.apache.cocoon.webapps.authentication.components.DefaultAuthenticationManager", "org.apache.cocoon.webapps.authentication.user.RequestState" ]
import org.apache.cocoon.webapps.authentication.components.DefaultAuthenticationManager; import org.apache.cocoon.webapps.authentication.user.RequestState;
import org.apache.cocoon.webapps.authentication.components.*; import org.apache.cocoon.webapps.authentication.user.*;
[ "org.apache.cocoon" ]
org.apache.cocoon;
424,779
public void showDialogMessage(final String text, final int mode) { if (Dbg.DEBUG) { Dbg.v("showDialogMessage: mode: " + mode + ", text: " + text); } Intent intent = new Intent(SmartEyeglassControl.Intents.CONTROL_DIALOG_OPEN_INTENT); intent.putExtra(SmartEyeglassControl.Intents.EXTRA_DIALOG_MODE, mode); intent.putExtra(SmartEyeglassControl.Intents.EXTRA_DIALOG_MESSAGE, text); sendToHostApp(intent); } /** * Displays a customized dialog with up to three custom buttons. The user closes * the dialog by selecting one of the buttons. * * @param title The dialog title. * @param message The message text. * @param buttons An array of one to three button labels. A 0-based index pointing into this array * is returned to the {@link com.sony.smarteyeglass.extension.util.SmartEyeglassEventListener#onDialogClosed}
void function(final String text, final int mode) { if (Dbg.DEBUG) { Dbg.v(STR + mode + STR + text); } Intent intent = new Intent(SmartEyeglassControl.Intents.CONTROL_DIALOG_OPEN_INTENT); intent.putExtra(SmartEyeglassControl.Intents.EXTRA_DIALOG_MODE, mode); intent.putExtra(SmartEyeglassControl.Intents.EXTRA_DIALOG_MESSAGE, text); sendToHostApp(intent); } /** * Displays a customized dialog with up to three custom buttons. The user closes * the dialog by selecting one of the buttons. * * @param title The dialog title. * @param message The message text. * @param buttons An array of one to three button labels. A 0-based index pointing into this array * is returned to the {@link com.sony.smarteyeglass.extension.util.SmartEyeglassEventListener#onDialogClosed}
/** * Displays a simple dialog. * * @param text The message text. * @param mode The dialog mode, one of: * <ul> * <li> {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#DIALOG_MODE_TIMEOUT}</li> * <li> {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#DIALOG_MODE_OK}</li> * </ul> */
Displays a simple dialog
showDialogMessage
{ "repo_name": "jphacks/HK_08", "path": "SmartEyeglassAPI/src/main/java/com/sony/smarteyeglass/extension/util/SmartEyeglassControlUtils.java", "license": "mit", "size": 71971 }
[ "android.content.Intent", "com.sony.smarteyeglass.SmartEyeglassControl" ]
import android.content.Intent; import com.sony.smarteyeglass.SmartEyeglassControl;
import android.content.*; import com.sony.smarteyeglass.*;
[ "android.content", "com.sony.smarteyeglass" ]
android.content; com.sony.smarteyeglass;
1,378,367
public static Object invokeCount(String methodName, Object obj, Class<?> objClass, Object args, int invokeMaxCount) throws RemoteException { return invokeCount(methodName, obj, objClass, args, args.getClass(), invokeMaxCount); }
static Object function(String methodName, Object obj, Class<?> objClass, Object args, int invokeMaxCount) throws RemoteException { return invokeCount(methodName, obj, objClass, args, args.getClass(), invokeMaxCount); }
/** * A reflection Invoke method with Retries for SocketException, InternalApiError * and RateExceededError with getRetryAfterSeconds sleep. * * @param methodName * @param obj the object the underlying method is invoked from * @param objClass the class of the object the underlying method is invoked from * @param args the arguments used for the method call * @param invokeMaxCount number of maximum calls * @return Object, result from reflexion call * @throws RemoteException for communication-related exceptions */
A reflection Invoke method with Retries for SocketException, InternalApiError and RateExceededError with getRetryAfterSeconds sleep
invokeCount
{ "repo_name": "raja15792/googleads-java-lib", "path": "modules/adwords_axis_utility_extension/src/main/java/com/google/api/ads/adwords/axis/utility/extension/util/ReflectionUtil.java", "license": "apache-2.0", "size": 7874 }
[ "java.rmi.RemoteException" ]
import java.rmi.RemoteException;
import java.rmi.*;
[ "java.rmi" ]
java.rmi;
875,602
public static boolean isAccountLocked(final Connection connection, final String username) throws SQLException { try ( PreparedStatement prep = connection.prepareStatement("SELECT num_failures, last_failure FROM fll_authentication WHERE fll_user = ?")) { prep.setString(1, username); try (ResultSet rs = prep.executeQuery()) { if (rs.next()) { final Timestamp lastFailure = rs.getTimestamp("last_failure"); if (null == lastFailure) { // no last failure timestamp, can't be locked out return false; } else { final int numFailures = rs.getInt("num_failures"); if (numFailures >= ALLOWED_FAILURES) { final LocalDateTime unlockTime = lastFailure.toLocalDateTime() .plus(WAIT_PER_FAILURE.multipliedBy(numFailures)); return unlockTime.isAfter(LocalDateTime.now()); } else { // not enough failures return false; } } } else { // non-existant users can't be locked out return false; } } } }
static boolean function(final Connection connection, final String username) throws SQLException { try ( PreparedStatement prep = connection.prepareStatement(STR)) { prep.setString(1, username); try (ResultSet rs = prep.executeQuery()) { if (rs.next()) { final Timestamp lastFailure = rs.getTimestamp(STR); if (null == lastFailure) { return false; } else { final int numFailures = rs.getInt(STR); if (numFailures >= ALLOWED_FAILURES) { final LocalDateTime unlockTime = lastFailure.toLocalDateTime() .plus(WAIT_PER_FAILURE.multipliedBy(numFailures)); return unlockTime.isAfter(LocalDateTime.now()); } else { return false; } } } else { return false; } } } }
/** * Check if {@code username} is currently locked. * * @param connection database connection * @param username username to check * @return true if {@code username} is locked * @throws SQLException on a database error */
Check if username is currently locked
isAccountLocked
{ "repo_name": "jpschewe/fll-sw", "path": "src/main/java/fll/db/Authentication.java", "license": "gpl-2.0", "size": 15292 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.sql.Timestamp", "java.time.LocalDateTime" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.time.LocalDateTime;
import java.sql.*; import java.time.*;
[ "java.sql", "java.time" ]
java.sql; java.time;
1,759,702
protected void initWelcomeFileList(XmlParser.Node node) { Iterator iter = node.iterator("welcome-file"); while (iter.hasNext()) { XmlParser.Node indexNode = (XmlParser.Node) iter.next(); String index = indexNode.toString(false, true); if (log.isDebugEnabled()) log.debug("Index: " + index); getWebApplicationContext().addWelcomeFile(index); } }
void function(XmlParser.Node node) { Iterator iter = node.iterator(STR); while (iter.hasNext()) { XmlParser.Node indexNode = (XmlParser.Node) iter.next(); String index = indexNode.toString(false, true); if (log.isDebugEnabled()) log.debug(STR + index); getWebApplicationContext().addWelcomeFile(index); } }
/** * Inits the welcome file list. * * @param node * the node */
Inits the welcome file list
initWelcomeFileList
{ "repo_name": "confluxtoo/finflux_automation_test", "path": "browsermob-proxy/src/main/java/org/browsermob/proxy/jetty/jetty/servlet/XMLConfiguration.java", "license": "mpl-2.0", "size": 27731 }
[ "java.util.Iterator", "org.browsermob.proxy.jetty.xml.XmlParser" ]
import java.util.Iterator; import org.browsermob.proxy.jetty.xml.XmlParser;
import java.util.*; import org.browsermob.proxy.jetty.xml.*;
[ "java.util", "org.browsermob.proxy" ]
java.util; org.browsermob.proxy;
2,183,635
protected void setUp() throws Exception { super.setUp(); tag = new TextTag(); tag.setPageContext(pageContext); ActionContext.setContext(new ActionContext(stack.getContext())); }
void function() throws Exception { super.setUp(); tag = new TextTag(); tag.setPageContext(pageContext); ActionContext.setContext(new ActionContext(stack.getContext())); }
/** * todo remove ActionContext set after LocalizedTextUtil is fixed to not use ThreadLocal * * @throws Exception */
todo remove ActionContext set after LocalizedTextUtil is fixed to not use ThreadLocal
setUp
{ "repo_name": "Ile2/struts2-showcase-demo", "path": "src/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java", "license": "apache-2.0", "size": 11563 }
[ "com.opensymphony.xwork2.ActionContext" ]
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.*;
[ "com.opensymphony.xwork2" ]
com.opensymphony.xwork2;
200,093
private void computeProbabilities() throws IOException { computeWordGivenTagLogProbsUsingOneCountSmoothing(); computeTransitionLogProbabilitiesUsingOneCountSmoothing(); }
void function() throws IOException { computeWordGivenTagLogProbsUsingOneCountSmoothing(); computeTransitionLogProbabilitiesUsingOneCountSmoothing(); }
/** * Computes the probabilities p_tt and p_tw */
Computes the probabilities p_tt and p_tw
computeProbabilities
{ "repo_name": "Khalian/NLPBlues", "path": "src/EMTagger.java", "license": "apache-2.0", "size": 32166 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
444,042
protected Object fromNumber(Class<?> targetClass, Number value) { if (targetClass.isInstance(value)) { return value; } if (targetClass == BigInteger.class) { // Don't handle value = BigDecimal separately as property readers should only use basic types anyway if (value instanceof Double || value instanceof Float) { return BigDecimal.valueOf(value.doubleValue()).toBigInteger(); } return BigInteger.valueOf(value.longValue()); } // targetClass is BigDecimal if we reach this part. Check for Long first as we might lose precision if we // use doubleValue (seems like integer would be fine, but let's do it anyway too). // Smaller types like short are fine as all values can be precisely represented as a double. if (value instanceof Integer || value instanceof Long) { return BigDecimal.valueOf(value.longValue()); } return BigDecimal.valueOf(value.doubleValue()).stripTrailingZeros(); }
Object function(Class<?> targetClass, Number value) { if (targetClass.isInstance(value)) { return value; } if (targetClass == BigInteger.class) { if (value instanceof Double value instanceof Float) { return BigDecimal.valueOf(value.doubleValue()).toBigInteger(); } return BigInteger.valueOf(value.longValue()); } if (value instanceof Integer value instanceof Long) { return BigDecimal.valueOf(value.longValue()); } return BigDecimal.valueOf(value.doubleValue()).stripTrailingZeros(); }
/** * Creates a BigInteger or BigDecimal value from the given number value, if possible. * * @param targetClass the target class to convert to (can only be BigInteger or BigDecimal) * @param value the value to convert * @return BigInteger or BigDecimal as defined by the target class */
Creates a BigInteger or BigDecimal value from the given number value, if possible
fromNumber
{ "repo_name": "AuthMe/ConfigMe", "path": "src/main/java/ch/jalu/configme/beanmapper/leafvaluehandler/BigNumberLeafValueHandler.java", "license": "mit", "size": 3638 }
[ "java.math.BigDecimal", "java.math.BigInteger" ]
import java.math.BigDecimal; import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
1,208,899
class TimeListener implements ActionListener { public void actionPerformed(ActionEvent e) { if (secs > 0) { secs--; updateTimerLabel(); } else { timer.stop(); descLabel.setText ("Sorry, your time is up."); endGame (EG_TIMEOUT); } } }
class TimeListener implements ActionListener { void function(ActionEvent e) { if (secs > 0) { secs--; updateTimerLabel(); } else { timer.stop(); descLabel.setText (STR); endGame (EG_TIMEOUT); } } }
/** * Decrement the time remaining, if there is any. If the user has run * out of time, then exit. * * @param e The ActionEvent. */
Decrement the time remaining, if there is any. If the user has run out of time, then exit
actionPerformed
{ "repo_name": "cookies245/gte2", "path": "game/PublicGoods.java", "license": "apache-2.0", "size": 11482 }
[ "java.awt.event.ActionEvent", "java.awt.event.ActionListener" ]
import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
37,996
public void execute(ICommandSender sender, String[] args) throws CommandException { if (args.length <= 0) { throw new WrongUsageException("commands.xp.usage", new Object[0]); } else { String s = args[0]; boolean flag = s.endsWith("l") || s.endsWith("L"); if (flag && s.length() > 1) { s = s.substring(0, s.length() - 1); } int i = parseInt(s); boolean flag1 = i < 0; if (flag1) { i *= -1; } EntityPlayerMP entityplayermp = args.length > 1 ? getPlayer(sender, args[1]) : getCommandSenderAsPlayer(sender); if (flag) { sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, entityplayermp.experienceLevel); if (flag1) { entityplayermp.addExperienceLevel(-i); notifyOperators(sender, this, "commands.xp.success.negative.levels", new Object[] {Integer.valueOf(i), entityplayermp.getName()}); } else { entityplayermp.addExperienceLevel(i); notifyOperators(sender, this, "commands.xp.success.levels", new Object[] {Integer.valueOf(i), entityplayermp.getName()}); } } else { sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, entityplayermp.experienceTotal); if (flag1) { throw new CommandException("commands.xp.failure.widthdrawXp", new Object[0]); } entityplayermp.addExperience(i); notifyOperators(sender, this, "commands.xp.success", new Object[] {Integer.valueOf(i), entityplayermp.getName()}); } } }
void function(ICommandSender sender, String[] args) throws CommandException { if (args.length <= 0) { throw new WrongUsageException(STR, new Object[0]); } else { String s = args[0]; boolean flag = s.endsWith("l") s.endsWith("L"); if (flag && s.length() > 1) { s = s.substring(0, s.length() - 1); } int i = parseInt(s); boolean flag1 = i < 0; if (flag1) { i *= -1; } EntityPlayerMP entityplayermp = args.length > 1 ? getPlayer(sender, args[1]) : getCommandSenderAsPlayer(sender); if (flag) { sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, entityplayermp.experienceLevel); if (flag1) { entityplayermp.addExperienceLevel(-i); notifyOperators(sender, this, STR, new Object[] {Integer.valueOf(i), entityplayermp.getName()}); } else { entityplayermp.addExperienceLevel(i); notifyOperators(sender, this, STR, new Object[] {Integer.valueOf(i), entityplayermp.getName()}); } } else { sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, entityplayermp.experienceTotal); if (flag1) { throw new CommandException(STR, new Object[0]); } entityplayermp.addExperience(i); notifyOperators(sender, this, STR, new Object[] {Integer.valueOf(i), entityplayermp.getName()}); } } }
/** * Called when a CommandSender executes this command */
Called when a CommandSender executes this command
execute
{ "repo_name": "trixmot/mod1", "path": "build/tmp/recompileMc/sources/net/minecraft/command/CommandXP.java", "license": "lgpl-2.1", "size": 3201 }
[ "net.minecraft.entity.player.EntityPlayerMP" ]
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
479,288
static JavaSparkContext createJavaSparkContext(String appName) { SparkConf sparkConf = new SparkConf().setAppName(appName); return new JavaSparkContext(sparkConf); }
static JavaSparkContext createJavaSparkContext(String appName) { SparkConf sparkConf = new SparkConf().setAppName(appName); return new JavaSparkContext(sparkConf); }
/** * create a Factory context object * */
create a Factory context object
createJavaSparkContext
{ "repo_name": "batermj/algorithm-challenger", "path": "Interviews/Basics/MapReduce/ISBN978-7-5123-9594-7/data-algorithms-book-master/src/main/java/org/dataalgorithms/machinelearning/logistic/cancer/Util.java", "license": "apache-2.0", "size": 882 }
[ "org.apache.spark.SparkConf", "org.apache.spark.api.java.JavaSparkContext" ]
import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.*; import org.apache.spark.api.java.*;
[ "org.apache.spark" ]
org.apache.spark;
88,513
public SeekableByteChannel open(GcsPath path) throws IOException { return new GoogleCloudStorageReadChannel(storageClient, path.getBucket(), path.getObject(), errorExtractor, new ClientRequestHelper<StorageObject>()); }
SeekableByteChannel function(GcsPath path) throws IOException { return new GoogleCloudStorageReadChannel(storageClient, path.getBucket(), path.getObject(), errorExtractor, new ClientRequestHelper<StorageObject>()); }
/** * Opens an object in GCS. * * <p>Returns a SeekableByteChannel that provides access to data in the bucket. * * @param path the GCS filename to read from * @return a SeekableByteChannel that can read the object data */
Opens an object in GCS. Returns a SeekableByteChannel that provides access to data in the bucket
open
{ "repo_name": "yafengguo/Apache-beam", "path": "sdks/java/core/src/main/java/org/apache/beam/sdk/util/GcsUtil.java", "license": "apache-2.0", "size": 22750 }
[ "com.google.api.services.storage.model.StorageObject", "com.google.cloud.hadoop.gcsio.GoogleCloudStorageReadChannel", "com.google.cloud.hadoop.util.ClientRequestHelper", "java.io.IOException", "java.nio.channels.SeekableByteChannel", "org.apache.beam.sdk.util.gcsfs.GcsPath" ]
import com.google.api.services.storage.model.StorageObject; import com.google.cloud.hadoop.gcsio.GoogleCloudStorageReadChannel; import com.google.cloud.hadoop.util.ClientRequestHelper; import java.io.IOException; import java.nio.channels.SeekableByteChannel; import org.apache.beam.sdk.util.gcsfs.GcsPath;
import com.google.api.services.storage.model.*; import com.google.cloud.hadoop.gcsio.*; import com.google.cloud.hadoop.util.*; import java.io.*; import java.nio.channels.*; import org.apache.beam.sdk.util.gcsfs.*;
[ "com.google.api", "com.google.cloud", "java.io", "java.nio", "org.apache.beam" ]
com.google.api; com.google.cloud; java.io; java.nio; org.apache.beam;
689,999
public void close() throws IOException { if (type != null) { encode(out, buf, bufPtr); for (int i = 0; i != nl.length(); i++) { out.write(nl.charAt(i)); } out.write('='); int crcV = crc.getValue(); buf[0] = ((crcV >> 16) & 0xff); buf[1] = ((crcV >> 8) & 0xff); buf[2] = (crcV & 0xff); encode(out, buf, 3); for (int i = 0; i != nl.length(); i++) { out.write(nl.charAt(i)); } for (int i = 0; i != footerStart.length(); i++) { out.write(footerStart.charAt(i)); } for (int i = 0; i != type.length(); i++) { out.write(type.charAt(i)); } for (int i = 0; i != footerTail.length(); i++) { out.write(footerTail.charAt(i)); } for (int i = 0; i != nl.length(); i++) { out.write(nl.charAt(i)); } out.flush(); type = null; start = true; } }
void function() throws IOException { if (type != null) { encode(out, buf, bufPtr); for (int i = 0; i != nl.length(); i++) { out.write(nl.charAt(i)); } out.write('='); int crcV = crc.getValue(); buf[0] = ((crcV >> 16) & 0xff); buf[1] = ((crcV >> 8) & 0xff); buf[2] = (crcV & 0xff); encode(out, buf, 3); for (int i = 0; i != nl.length(); i++) { out.write(nl.charAt(i)); } for (int i = 0; i != footerStart.length(); i++) { out.write(footerStart.charAt(i)); } for (int i = 0; i != type.length(); i++) { out.write(type.charAt(i)); } for (int i = 0; i != footerTail.length(); i++) { out.write(footerTail.charAt(i)); } for (int i = 0; i != nl.length(); i++) { out.write(nl.charAt(i)); } out.flush(); type = null; start = true; } }
/** * <b>Note</b>: close does nor close the underlying stream. So it is possible to write * multiple objects using armoring to a single stream. */
Note: close does nor close the underlying stream. So it is possible to write multiple objects using armoring to a single stream
close
{ "repo_name": "savichris/spongycastle", "path": "pg/src/main/java/org/spongycastle/bcpg/ArmoredOutputStream.java", "license": "mit", "size": 10854 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
815,482
@Override public Vector3 getAiming(){ Vector3 aim; if (camera != null){ aim = new Vector3( Gdx.input.getX()- camera.getScreenWidth()/2, 2*(Gdx.input.getY()- camera.getScreenHeight()/2), 0 ); }else{ aim = getDirectionVector(); } return aim.nor(); }
Vector3 function(){ Vector3 aim; if (camera != null){ aim = new Vector3( Gdx.input.getX()- camera.getScreenWidth()/2, 2*(Gdx.input.getY()- camera.getScreenHeight()/2), 0 ); }else{ aim = getDirectionVector(); } return aim.nor(); }
/** * Getting aim relative to middle of view by reading mouse position. If no camera is configured dircetion of head. * @return */
Getting aim relative to middle of view by reading mouse position. If no camera is configured dircetion of head
getAiming
{ "repo_name": "thtomate/W-E-f-a", "path": "src/com/BombingGames/WurfelEngine/Core/Gameobjects/PlayerWithWeapon.java", "license": "bsd-3-clause", "size": 4009 }
[ "com.badlogic.gdx.Gdx", "com.badlogic.gdx.math.Vector3" ]
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.*; import com.badlogic.gdx.math.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
1,858,597
public XYSeries createCopy(int start, int end) throws CloneNotSupportedException { XYSeries copy = (XYSeries) super.clone(); copy.data = new java.util.ArrayList<XYDataItem>(); if (this.data.size() > 0) { for (int index = start; index <= end; index++) { XYDataItem item = this.data.get(index); XYDataItem clone = (XYDataItem) item.clone(); try { copy.add(clone); } catch (SeriesException e) { throw new RuntimeException("Unable to add cloned data item.", e); } } } return copy; }
XYSeries function(int start, int end) throws CloneNotSupportedException { XYSeries copy = (XYSeries) super.clone(); copy.data = new java.util.ArrayList<XYDataItem>(); if (this.data.size() > 0) { for (int index = start; index <= end; index++) { XYDataItem item = this.data.get(index); XYDataItem clone = (XYDataItem) item.clone(); try { copy.add(clone); } catch (SeriesException e) { throw new RuntimeException(STR, e); } } } return copy; }
/** * Creates a new series by copying a subset of the data in this time series. * * @param start the index of the first item to copy. * @param end the index of the last item to copy. * * @return A series containing a copy of this series from start until end. * * @throws CloneNotSupportedException if there is a cloning problem. */
Creates a new series by copying a subset of the data in this time series
createCopy
{ "repo_name": "greearb/jfreechart-fse-ct", "path": "src/main/java/org/jfree/data/xy/XYSeries.java", "license": "lgpl-2.1", "size": 33902 }
[ "org.jfree.data.general.SeriesException" ]
import org.jfree.data.general.SeriesException;
import org.jfree.data.general.*;
[ "org.jfree.data" ]
org.jfree.data;
1,460,588
public static void log(Context c, String msg) { appendMessage(c, msg); }
static void function(Context c, String msg) { appendMessage(c, msg); }
/** * Append message to protocol * * @param c context * @param msg message */
Append message to protocol
log
{ "repo_name": "zhujunsan/linuxdeploy", "path": "src/ru/meefik/linuxdeploy/Logger.java", "license": "gpl-3.0", "size": 4633 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
981,027
public NetworkInterfaceAssociation withSecurityRules(List<SecurityRuleInner> securityRules) { this.securityRules = securityRules; return this; }
NetworkInterfaceAssociation function(List<SecurityRuleInner> securityRules) { this.securityRules = securityRules; return this; }
/** * Set collection of custom security rules. * * @param securityRules the securityRules value to set * @return the NetworkInterfaceAssociation object itself. */
Set collection of custom security rules
withSecurityRules
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/NetworkInterfaceAssociation.java", "license": "mit", "size": 1572 }
[ "com.microsoft.azure.management.network.v2020_03_01.implementation.SecurityRuleInner", "java.util.List" ]
import com.microsoft.azure.management.network.v2020_03_01.implementation.SecurityRuleInner; import java.util.List;
import com.microsoft.azure.management.network.v2020_03_01.implementation.*; import java.util.*;
[ "com.microsoft.azure", "java.util" ]
com.microsoft.azure; java.util;
301,486
public static Path getWriterFilePath(State state, int numBranches, int branchId) { if (state.contains( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_FILE_PATH, numBranches, branchId))) { return new Path(state.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_FILE_PATH, numBranches, branchId))); } switch (getWriterFilePathType(state)) { case TABLENAME: return WriterUtils.getTableNameWriterFilePath(state); default: return WriterUtils.getDefaultWriterFilePath(state, numBranches, branchId); } }
static Path function(State state, int numBranches, int branchId) { if (state.contains( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_FILE_PATH, numBranches, branchId))) { return new Path(state.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_FILE_PATH, numBranches, branchId))); } switch (getWriterFilePathType(state)) { case TABLENAME: return WriterUtils.getTableNameWriterFilePath(state); default: return WriterUtils.getDefaultWriterFilePath(state, numBranches, branchId); } }
/** * Get the {@link Path} corresponding the the relative file path for a given {@link gobblin.writer.DataWriter}. * This method retrieves the value of {@link ConfigurationKeys#WRITER_FILE_PATH} from the given {@link State}. It also * constructs the default value of the {@link ConfigurationKeys#WRITER_FILE_PATH} if not is not specified in the given * {@link State}. * @param state is the {@link State} corresponding to a specific {@link gobblin.writer.DataWriter}. * @param numBranches is the total number of branches for the given {@link State}. * @param branchId is the id for the specific branch that the {{@link gobblin.writer.DataWriter} will write to. * @return a {@link Path} specifying the relative directory where the {@link gobblin.writer.DataWriter} will write to. */
Get the <code>Path</code> corresponding the the relative file path for a given <code>gobblin.writer.DataWriter</code>. This method retrieves the value of <code>ConfigurationKeys#WRITER_FILE_PATH</code> from the given <code>State</code>. It also constructs the default value of the <code>ConfigurationKeys#WRITER_FILE_PATH</code> if not is not specified in the given <code>State</code>
getWriterFilePath
{ "repo_name": "ydai1124/gobblin-1", "path": "gobblin-utility/src/main/java/gobblin/util/WriterUtils.java", "license": "apache-2.0", "size": 17248 }
[ "org.apache.hadoop.fs.Path" ]
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
442,975
public RepositoryDirectoryInterface getRepositoryDirectory() { return new RepositoryDirectory(); }
RepositoryDirectoryInterface function() { return new RepositoryDirectory(); }
/** * Not used in this case, simply return root / */
Not used in this case, simply return root
getRepositoryDirectory
{ "repo_name": "lihongqiang/kettle-4.4.0-stable", "path": "src-db/org/pentaho/di/core/database/DatabaseMeta.java", "license": "apache-2.0", "size": 86047 }
[ "org.pentaho.di.repository.RepositoryDirectory", "org.pentaho.di.repository.RepositoryDirectoryInterface" ]
import org.pentaho.di.repository.RepositoryDirectory; import org.pentaho.di.repository.RepositoryDirectoryInterface;
import org.pentaho.di.repository.*;
[ "org.pentaho.di" ]
org.pentaho.di;
1,222,529
public void enable() throws IOException { // This has to be synchronized or it can collide with the check in the // task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set // it. if (isOptOut()) { configuration.set("opt-out", false); configuration.save(configurationFile); } // Enable Task, if it is not running if (task == null) { start(); } } }
void function() throws IOException { synchronized (optOutLock) { if (isOptOut()) { configuration.set(STR, false); configuration.save(configurationFile); } if (task == null) { start(); } } }
/** * Enables metrics for the server by setting "opt-out" to false in the * config file and starting the metrics task. * * @throws java.io.IOException */
Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task
enable
{ "repo_name": "Co0sh/RoomRent", "path": "src/main/java/pl/betoncraft/roomrent/Metrics.java", "license": "gpl-3.0", "size": 26147 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,822,548
public Dimension getIntrinsicSize() { return this.intrinsicSize; }
Dimension function() { return this.intrinsicSize; }
/** * Returns the size of the image's intrinsic (natural) size. * @return the intrinsic size (in millipoints) */
Returns the size of the image's intrinsic (natural) size
getIntrinsicSize
{ "repo_name": "StrategyObject/fop", "path": "src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java", "license": "apache-2.0", "size": 13137 }
[ "java.awt.Dimension" ]
import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,085,388
protected Rectangle2D.Double getTextBounds() { if (textBounds == null) return new Rectangle2D.Double(0, 0, 0, 0); else return textBounds; } public void setEditable(boolean b) { this.editable = b; }
Rectangle2D.Double function() { if (textBounds == null) return new Rectangle2D.Double(0, 0, 0, 0); else return textBounds; } public void setEditable(boolean b) { this.editable = b; }
/** * Returns the bounds of the text. * * @return See above. */
Returns the bounds of the text
getTextBounds
{ "repo_name": "rleigh-dundee/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/drawingtools/figures/RectangleTextFigure.java", "license": "gpl-2.0", "size": 11588 }
[ "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
2,039,398
@Test public void testPersistentAuthDisabled() { assertEquals(0, getPrefer()); assertEquals(0, getPrefer("x", "y")); assertEquals(0, getPrefer("x", "y")); }
void function() { assertEquals(0, getPrefer()); assertEquals(0, getPrefer("x", "y")); assertEquals(0, getPrefer("x", "y")); }
/** * Check that the persistent authentication isn't enabled if the preference isn't present. */
Check that the persistent authentication isn't enabled if the preference isn't present
testPersistentAuthDisabled
{ "repo_name": "jtux270/translate", "path": "ovirt/backend/manager/modules/aaa/src/test/java/org/ovirt/engine/core/aaa/filters/FiltersHelperTest.java", "license": "gpl-3.0", "size": 4230 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,235,614
@Test(timeOut = 5000) public void testCloseConnectionOnInternalServerError() throws Exception { final PulsarClient pulsarClient; final String topicName = "persistent://prop/usw/my-ns/newTopic"; String lookupUrl = new URI("pulsar://localhost:" + BROKER_PORT).toString(); pulsarClient = PulsarClient.builder().serviceUrl(lookupUrl).statsInterval(0, TimeUnit.SECONDS).build(); ProducerImpl<byte[]> producer = (ProducerImpl<byte[]>) pulsarClient.newProducer().topic(topicName).create(); ClientCnx cnx = producer.cnx(); assertTrue(cnx.channel().isActive()); // Need broker to throw InternalServerError. so, make global-zk unavailable Field globalZkCacheField = PulsarService.class.getDeclaredField("globalZkCache"); globalZkCacheField.setAccessible(true); globalZkCacheField.set(pulsar, null); try { pulsarClient.newProducer().topic(topicName).create(); fail("it should have fail with lookup-exception:"); } catch (Exception e) { // ok } // connection must be closed assertFalse(cnx.channel().isActive()); pulsarClient.close(); }
@Test(timeOut = 5000) void function() throws Exception { final PulsarClient pulsarClient; final String topicName = STRpulsar: pulsarClient = PulsarClient.builder().serviceUrl(lookupUrl).statsInterval(0, TimeUnit.SECONDS).build(); ProducerImpl<byte[]> producer = (ProducerImpl<byte[]>) pulsarClient.newProducer().topic(topicName).create(); ClientCnx cnx = producer.cnx(); assertTrue(cnx.channel().isActive()); Field globalZkCacheField = PulsarService.class.getDeclaredField(STR); globalZkCacheField.setAccessible(true); globalZkCacheField.set(pulsar, null); try { pulsarClient.newProducer().topic(topicName).create(); fail(STR); } catch (Exception e) { } assertFalse(cnx.channel().isActive()); pulsarClient.close(); }
/** * It verifies that client closes the connection on internalSerevrError which is "ServiceNotReady" from Broker-side * * @throws Exception */
It verifies that client closes the connection on internalSerevrError which is "ServiceNotReady" from Broker-side
testCloseConnectionOnInternalServerError
{ "repo_name": "nkurihar/pulsar", "path": "pulsar-broker/src/test/java/org/apache/pulsar/client/impl/BrokerClientIntegrationTest.java", "license": "apache-2.0", "size": 38125 }
[ "java.lang.reflect.Field", "java.util.concurrent.TimeUnit", "org.apache.pulsar.broker.PulsarService", "org.apache.pulsar.client.api.PulsarClient", "org.testng.Assert", "org.testng.annotations.Test" ]
import java.lang.reflect.Field; import java.util.concurrent.TimeUnit; import org.apache.pulsar.broker.PulsarService; import org.apache.pulsar.client.api.PulsarClient; import org.testng.Assert; import org.testng.annotations.Test;
import java.lang.reflect.*; import java.util.concurrent.*; import org.apache.pulsar.broker.*; import org.apache.pulsar.client.api.*; import org.testng.*; import org.testng.annotations.*;
[ "java.lang", "java.util", "org.apache.pulsar", "org.testng", "org.testng.annotations" ]
java.lang; java.util; org.apache.pulsar; org.testng; org.testng.annotations;
1,842,765
public List<? extends MediaFile> getFingerprints(AudioBoxClient audioBoxClient) throws IOException { return getFingerprints( audioBoxClient, null ); }
List<? extends MediaFile> function(AudioBoxClient audioBoxClient) throws IOException { return getFingerprints( audioBoxClient, null ); }
/** * Returns known file fingerprints for this playlist. Available only for local and cloud playlist tokens. * <p> * Will return all MD5 fingerprints of the media files on this playlist. Useful to know what has already been uploaded. * * @param audioBoxClient the {@link fm.audiobox.core.AudioBoxClient} to use for the request * * @return A list of {@link MediaFile} elements * * @throws fm.audiobox.core.exceptions.AudioBoxException if any of the remote error exception is detected. * @throws java.io.IOException if any connection problem occurs. * @see fm.audiobox.core.exceptions.AudioBoxException */
Returns known file fingerprints for this playlist. Available only for local and cloud playlist tokens. Will return all MD5 fingerprints of the media files on this playlist. Useful to know what has already been uploaded
getFingerprints
{ "repo_name": "icoretech/audiobox-jlib", "path": "src/main/java/fm/audiobox/core/models/Playlist.java", "license": "apache-2.0", "size": 40739 }
[ "fm.audiobox.core.AudioBoxClient", "java.io.IOException", "java.util.List" ]
import fm.audiobox.core.AudioBoxClient; import java.io.IOException; import java.util.List;
import fm.audiobox.core.*; import java.io.*; import java.util.*;
[ "fm.audiobox.core", "java.io", "java.util" ]
fm.audiobox.core; java.io; java.util;
2,017,666
protected synchronized KeycloakDeployment getOrCreateDeployment(String pathFragment) { KeycloakDeployment deployment = getCachedDeployment(pathFragment); if (null == deployment) { // not found on the simple cache, try to load it from the file system if (keycloakConfigLocation == null) { throw new IllegalStateException("Neither \"keycloak.config\" nor \"karaf.etc\" java properties are set." + " Please set one of them."); } File configuration = new File(keycloakConfigLocation, pathFragment + ("".equals(pathFragment) ? "" : "-") + "keycloak.json"); if (!cacheConfiguration(pathFragment, configuration)) { throw new IllegalStateException("Not able to read the file " + configuration); } deployment = getCachedDeployment(pathFragment); } return deployment; }
synchronized KeycloakDeployment function(String pathFragment) { KeycloakDeployment deployment = getCachedDeployment(pathFragment); if (null == deployment) { if (keycloakConfigLocation == null) { throw new IllegalStateException(STRkeycloak.config\STRkaraf.etc\STR + STR); } File configuration = new File(keycloakConfigLocation, pathFragment + (STRSTR-STRkeycloak.jsonSTRNot able to read the file " + configuration); } deployment = getCachedDeployment(pathFragment); } return deployment; }
/** * {@code pathFragment} is a key for {@link KeycloakDeployment deployments}. The key is used to construct * a path relative to {@code keycloak.config} or {@code karaf.etc} system properties. * For given key, {@code <key>-keycloak.json} file is checked. * @param pathFragment * @return */
pathFragment is a key for <code>KeycloakDeployment deployments</code>. The key is used to construct a path relative to keycloak.config or karaf.etc system properties. For given key, -keycloak.json file is checked
getOrCreateDeployment
{ "repo_name": "thomasdarimont/keycloak", "path": "adapters/oidc/osgi-adapter/src/main/java/org/keycloak/adapters/osgi/PathBasedKeycloakConfigResolver.java", "license": "apache-2.0", "size": 7130 }
[ "java.io.File", "org.keycloak.adapters.KeycloakDeployment" ]
import java.io.File; import org.keycloak.adapters.KeycloakDeployment;
import java.io.*; import org.keycloak.adapters.*;
[ "java.io", "org.keycloak.adapters" ]
java.io; org.keycloak.adapters;
2,770,658
public Set getInterestRegistrationListeners() { final String s = LocalizedStrings. RemoteBridgeServer_INTERESTREGISTRATIONLISTENERS_CANNOT_BE_RETRIEVED_FROM_A_REMOTE_BRIDGESERVER .toLocalizedString(); throw new UnsupportedOperationException(s); }
Set function() { final String s = LocalizedStrings. RemoteBridgeServer_INTERESTREGISTRATIONLISTENERS_CANNOT_BE_RETRIEVED_FROM_A_REMOTE_BRIDGESERVER .toLocalizedString(); throw new UnsupportedOperationException(s); }
/** * Returns a read-only set of <code>InterestRegistrationListener</code>s * registered with this notifier. * * @return a read-only set of <code>InterestRegistrationListener</code>s * registered with this notifier * * @since 5.8Beta */
Returns a read-only set of <code>InterestRegistrationListener</code>s registered with this notifier
getInterestRegistrationListeners
{ "repo_name": "ameybarve15/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteBridgeServer.java", "license": "apache-2.0", "size": 10836 }
[ "com.gemstone.gemfire.internal.i18n.LocalizedStrings", "java.util.Set" ]
import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import java.util.Set;
import com.gemstone.gemfire.internal.i18n.*; import java.util.*;
[ "com.gemstone.gemfire", "java.util" ]
com.gemstone.gemfire; java.util;
2,626,710
private final void visitItemChildren(TreeItem item, IItemCallback callback) { if (item.getChildren() != null) { for (Iterator<TreeItem> i = item.getChildren().iterator(); i.hasNext();) { TreeItem child = (TreeItem)i.next(); visitItemAndChildren(child, callback); } } }
final void function(TreeItem item, IItemCallback callback) { if (item.getChildren() != null) { for (Iterator<TreeItem> i = item.getChildren().iterator(); i.hasNext();) { TreeItem child = (TreeItem)i.next(); visitItemAndChildren(child, callback); } } }
/** * Call the callback#visitItem method for every child of given item. * * @param item * The tree item * @param callback * The callback */
Call the callback#visitItem method for every child of given item
visitItemChildren
{ "repo_name": "astubbs/wicket.get-portals2", "path": "wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java", "license": "apache-2.0", "size": 38944 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,988,200
public ClientConnection newNetConnection( LogWriter logWriter,String user, String password, ClientBaseDataSourceRoot dataSource, int rmId,boolean isXAConn, ClientPooledConnection cpc) throws SqlException { return new NetConnection( logWriter, user, password, dataSource, rmId, isXAConn, cpc); } /** * @return an instance of {@link NetResultSet}
ClientConnection function( LogWriter logWriter,String user, String password, ClientBaseDataSourceRoot dataSource, int rmId,boolean isXAConn, ClientPooledConnection cpc) throws SqlException { return new NetConnection( logWriter, user, password, dataSource, rmId, isXAConn, cpc); } /** * @return an instance of {@link NetResultSet}
/** * Returns an instance of NetConnection. * @param logWriter LogWriter object associated with this connection. * @param user user id for this connection. * @param password password for this connection. * @param dataSource The DataSource object passed from the PooledConnection * object from which this constructor was called. * @param rmId The Resource Manager ID for XA Connections * @param isXAConn true if this is a XA connection * @param cpc The ClientPooledConnection object from which this * NetConnection constructor was called. This is used to * pass StatementEvents back to the pooledConnection * object. * @return a {@link ClientConnection} object * @throws SqlException */
Returns an instance of NetConnection
newNetConnection
{ "repo_name": "scnakandala/derby", "path": "java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java", "license": "apache-2.0", "size": 18409 }
[ "org.apache.derby.client.ClientPooledConnection", "org.apache.derby.client.am.ClientConnection", "org.apache.derby.client.am.LogWriter", "org.apache.derby.client.am.SqlException", "org.apache.derby.jdbc.ClientBaseDataSourceRoot" ]
import org.apache.derby.client.ClientPooledConnection; import org.apache.derby.client.am.ClientConnection; import org.apache.derby.client.am.LogWriter; import org.apache.derby.client.am.SqlException; import org.apache.derby.jdbc.ClientBaseDataSourceRoot;
import org.apache.derby.client.*; import org.apache.derby.client.am.*; import org.apache.derby.jdbc.*;
[ "org.apache.derby" ]
org.apache.derby;
687,525
public CompilationInfo compile(RuleContext ruleContext) throws RuleErrorException, InterruptedException { if (!generatePicAction && !generateNoPicAction) { ruleErrorConsumer.ruleError("Either PIC or no PIC actions have to be created."); } ccCompilationContext = initializeCcCompilationContext(ruleContext); boolean compileHeaderModules = featureConfiguration.isEnabled(CppRuleClasses.HEADER_MODULES); Preconditions.checkState( !compileHeaderModules || ccCompilationContext.getCppModuleMap() != null, "All cc rules must support module maps."); // Create compile actions (both PIC and no-PIC). CcCompilationOutputs ccOutputs = createCcCompileActions(); return new CompilationInfo(ccCompilationContext, ccOutputs); }
CompilationInfo function(RuleContext ruleContext) throws RuleErrorException, InterruptedException { if (!generatePicAction && !generateNoPicAction) { ruleErrorConsumer.ruleError(STR); } ccCompilationContext = initializeCcCompilationContext(ruleContext); boolean compileHeaderModules = featureConfiguration.isEnabled(CppRuleClasses.HEADER_MODULES); Preconditions.checkState( !compileHeaderModules ccCompilationContext.getCppModuleMap() != null, STR); CcCompilationOutputs ccOutputs = createCcCompileActions(); return new CompilationInfo(ccCompilationContext, ccOutputs); }
/** * Create the C++ compile actions, and the corresponding compilation related providers. * * @throws RuleErrorException */
Create the C++ compile actions, and the corresponding compilation related providers
compile
{ "repo_name": "twitter-forks/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java", "license": "apache-2.0", "size": 92871 }
[ "com.google.common.base.Preconditions", "com.google.devtools.build.lib.analysis.RuleContext", "com.google.devtools.build.lib.packages.RuleClass" ]
import com.google.common.base.Preconditions; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.packages.RuleClass;
import com.google.common.base.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.packages.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
1,746,868
public Champion getChampion() { if(champion != null) { return champion; } final Integer i = data.getParticipant().getChampionId(); if(i == null) { throw new MissingDataException("Champion ID is null."); } champion = RiotAPI.getChampionByID(i.longValue()); return champion; }
Champion function() { if(champion != null) { return champion; } final Integer i = data.getParticipant().getChampionId(); if(i == null) { throw new MissingDataException(STR); } champion = RiotAPI.getChampionByID(i.longValue()); return champion; }
/** * The participant's champion * * @return the participant's champion */
The participant's champion
getChampion
{ "repo_name": "sagiyemi/Orianna", "path": "src/com/robrua/orianna/type/core/match/Participant.java", "license": "mit", "size": 8967 }
[ "com.robrua.orianna.api.core.RiotAPI", "com.robrua.orianna.type.core.staticdata.Champion", "com.robrua.orianna.type.exception.MissingDataException" ]
import com.robrua.orianna.api.core.RiotAPI; import com.robrua.orianna.type.core.staticdata.Champion; import com.robrua.orianna.type.exception.MissingDataException;
import com.robrua.orianna.api.core.*; import com.robrua.orianna.type.core.staticdata.*; import com.robrua.orianna.type.exception.*;
[ "com.robrua.orianna" ]
com.robrua.orianna;
2,232,874
private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); // add if doesn't exist int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; }
int function( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; }
/** * Adds <code>String</code> value meta with given name if not present and returns index * * @param rowMeta * @param fieldName * @return Index in row meta of value meta with <code>fieldName</code> */
Adds <code>String</code> value meta with given name if not present and returns index
addValueMeta
{ "repo_name": "mbatchelor/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInput.java", "license": "apache-2.0", "size": 63605 }
[ "org.pentaho.di.core.row.RowMetaInterface", "org.pentaho.di.core.row.ValueMetaInterface", "org.pentaho.di.core.row.value.ValueMetaString" ]
import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.row.value.ValueMetaString;
import org.pentaho.di.core.row.*; import org.pentaho.di.core.row.value.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,397,049
private void init() { this.setLayout(new BorderLayout()); // MAIN PANEL JPanel mainPanel = new JPanel(); Border margin = new EmptyBorder(10, 10, 5, 10); mainPanel.setBorder(margin); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(makeTitlePanel()); // SortFilterModel mySortedModel = // new SortFilterModel(myStatTableModel); myJTable = new JTable(model); myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer()); myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70)); RendererUtils.applyRenderers(myJTable, RENDERERS); myScrollPane = new JScrollPane(myJTable); this.add(mainPanel, BorderLayout.NORTH); this.add(myScrollPane, BorderLayout.CENTER); saveTable.addActionListener(this); JPanel opts = new JPanel(); opts.add(useGroupName, BorderLayout.WEST); opts.add(saveTable, BorderLayout.CENTER); opts.add(saveHeaders, BorderLayout.EAST); this.add(opts,BorderLayout.SOUTH); }
void function() { this.setLayout(new BorderLayout()); JPanel mainPanel = new JPanel(); Border margin = new EmptyBorder(10, 10, 5, 10); mainPanel.setBorder(margin); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(makeTitlePanel()); myJTable = new JTable(model); myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer()); myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70)); RendererUtils.applyRenderers(myJTable, RENDERERS); myScrollPane = new JScrollPane(myJTable); this.add(mainPanel, BorderLayout.NORTH); this.add(myScrollPane, BorderLayout.CENTER); saveTable.addActionListener(this); JPanel opts = new JPanel(); opts.add(useGroupName, BorderLayout.WEST); opts.add(saveTable, BorderLayout.CENTER); opts.add(saveHeaders, BorderLayout.EAST); this.add(opts,BorderLayout.SOUTH); }
/** * Main visualizer setup. */
Main visualizer setup
init
{ "repo_name": "llllewicki/jmeter-diff", "path": "src/components/org/apache/jmeter/visualizers/StatVisualizer.java", "license": "apache-2.0", "size": 13067 }
[ "java.awt.BorderLayout", "java.awt.Dimension", "javax.swing.BoxLayout", "javax.swing.JPanel", "javax.swing.JScrollPane", "javax.swing.JTable", "javax.swing.border.Border", "javax.swing.border.EmptyBorder", "org.apache.jmeter.gui.util.HeaderAsPropertyRenderer", "org.apache.jorphan.gui.RendererUtils" ]
import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import org.apache.jmeter.gui.util.HeaderAsPropertyRenderer; import org.apache.jorphan.gui.RendererUtils;
import java.awt.*; import javax.swing.*; import javax.swing.border.*; import org.apache.jmeter.gui.util.*; import org.apache.jorphan.gui.*;
[ "java.awt", "javax.swing", "org.apache.jmeter", "org.apache.jorphan" ]
java.awt; javax.swing; org.apache.jmeter; org.apache.jorphan;
2,302,226
public List<PhysicalRegister> getRegisters() { return registers; }
List<PhysicalRegister> function() { return registers; }
/** * Get the list of physical registers. * * @return the list of physical registers */
Get the list of physical registers
getRegisters
{ "repo_name": "mcai/Archimulator", "path": "src/main/java/archimulator/core/PhysicalRegisterFile.java", "license": "mit", "size": 3464 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,294,459
public void writeClass(String className) throws IOException { ConstantPool pool = _javaClass.getConstantPool(); ClassConstant classConst = pool.getClass(className); if (classConst != null) writeShort(classConst.getIndex()); else writeShort(0); }
void function(String className) throws IOException { ConstantPool pool = _javaClass.getConstantPool(); ClassConstant classConst = pool.getClass(className); if (classConst != null) writeShort(classConst.getIndex()); else writeShort(0); }
/** * Writes a class constant. */
Writes a class constant
writeClass
{ "repo_name": "dwango/quercus", "path": "src/main/java/com/caucho/bytecode/ByteCodeWriter.java", "license": "gpl-2.0", "size": 4886 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
899,741
public boolean load( Properties properties, String namespace ) { // Get the qualifier. String typeProperty = String.format( "%s.type", namespace); String typeValue = properties.getProperty(typeProperty); if (typeValue == null) { return false; } if (getType() == null) { selectPlugin(typeValue); } JCommanderPropertiesTransformer jcpt = new JCommanderPropertiesTransformer( String.format( "%s.opts", namespace)); jcpt.addObject(this); jcpt.transformFromProperties(properties); return true; }
boolean function( Properties properties, String namespace ) { String typeProperty = String.format( STR, namespace); String typeValue = properties.getProperty(typeProperty); if (typeValue == null) { return false; } if (getType() == null) { selectPlugin(typeValue); } JCommanderPropertiesTransformer jcpt = new JCommanderPropertiesTransformer( String.format( STR, namespace)); jcpt.addObject(this); jcpt.transformFromProperties(properties); return true; }
/** * Transform from a map, reading values that live in the "opts" namespace. * * @param options */
Transform from a map, reading values that live in the "opts" namespace
load
{ "repo_name": "chizou/geowave", "path": "core/cli/src/main/java/mil/nga/giat/geowave/core/cli/api/DefaultPluginOptions.java", "license": "apache-2.0", "size": 1864 }
[ "java.util.Properties", "mil.nga.giat.geowave.core.cli.prefix.JCommanderPropertiesTransformer" ]
import java.util.Properties; import mil.nga.giat.geowave.core.cli.prefix.JCommanderPropertiesTransformer;
import java.util.*; import mil.nga.giat.geowave.core.cli.prefix.*;
[ "java.util", "mil.nga.giat" ]
java.util; mil.nga.giat;
1,873,029
private static void addParentFolderOperatorTags() { for (String operatorKey : getOperatorKeys()) { OperatorDescription operatorDescription = getOperatorDescription(operatorKey); if (operatorDescription == null) { continue; } if (ProcessRootOperator.class.equals(operatorDescription.getOperatorClass())) { // no tags for the root process continue; } GroupTree subTree = groupTreeRoot.findGroup(operatorDescription.getGroup()); if (subTree == null) { continue; } String groupName = subTree.getName(); if (groupName != null && !groupName.trim().isEmpty()) { if (!operatorDescription.getTags().contains(groupName.trim())) { OperatorDocumentation operatorDocumentation = operatorDescription.getOperatorDocumentation(); ArrayList<String> updatedTags = new ArrayList<>(operatorDocumentation.getTags().size() + 1); updatedTags.addAll(operatorDocumentation.getTags()); updatedTags.add(groupName.trim()); operatorDocumentation.setTags(updatedTags); } } } }
static void function() { for (String operatorKey : getOperatorKeys()) { OperatorDescription operatorDescription = getOperatorDescription(operatorKey); if (operatorDescription == null) { continue; } if (ProcessRootOperator.class.equals(operatorDescription.getOperatorClass())) { continue; } GroupTree subTree = groupTreeRoot.findGroup(operatorDescription.getGroup()); if (subTree == null) { continue; } String groupName = subTree.getName(); if (groupName != null && !groupName.trim().isEmpty()) { if (!operatorDescription.getTags().contains(groupName.trim())) { OperatorDocumentation operatorDocumentation = operatorDescription.getOperatorDocumentation(); ArrayList<String> updatedTags = new ArrayList<>(operatorDocumentation.getTags().size() + 1); updatedTags.addAll(operatorDocumentation.getTags()); updatedTags.add(groupName.trim()); operatorDocumentation.setTags(updatedTags); } } } }
/** * Adds parent folder name of each operator to the operator tags. */
Adds parent folder name of each operator to the operator tags
addParentFolderOperatorTags
{ "repo_name": "aborg0/rapidminer-studio", "path": "src/main/java/com/rapidminer/tools/OperatorService.java", "license": "agpl-3.0", "size": 36825 }
[ "com.rapidminer.operator.OperatorDescription", "com.rapidminer.operator.ProcessRootOperator", "com.rapidminer.tools.documentation.OperatorDocumentation", "java.util.ArrayList" ]
import com.rapidminer.operator.OperatorDescription; import com.rapidminer.operator.ProcessRootOperator; import com.rapidminer.tools.documentation.OperatorDocumentation; import java.util.ArrayList;
import com.rapidminer.operator.*; import com.rapidminer.tools.documentation.*; import java.util.*;
[ "com.rapidminer.operator", "com.rapidminer.tools", "java.util" ]
com.rapidminer.operator; com.rapidminer.tools; java.util;
2,679,706
public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(Blocks.FURNACE); }
Item function(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(Blocks.FURNACE); }
/** * Get the Item that this Block should drop when harvested. */
Get the Item that this Block should drop when harvested
getItemDropped
{ "repo_name": "lucemans/ShapeClient-SRC", "path": "net/minecraft/block/BlockFurnace.java", "license": "mpl-2.0", "size": 11411 }
[ "java.util.Random", "net.minecraft.block.state.IBlockState", "net.minecraft.init.Blocks", "net.minecraft.item.Item" ]
import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item;
import java.util.*; import net.minecraft.block.state.*; import net.minecraft.init.*; import net.minecraft.item.*;
[ "java.util", "net.minecraft.block", "net.minecraft.init", "net.minecraft.item" ]
java.util; net.minecraft.block; net.minecraft.init; net.minecraft.item;
905,720
public GetOverallBucketsResponse getOverallBuckets(GetOverallBucketsRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, MLRequestConverters::getOverallBuckets, options, GetOverallBucketsResponse::fromXContent, Collections.emptySet()); }
GetOverallBucketsResponse function(GetOverallBucketsRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, MLRequestConverters::getOverallBuckets, options, GetOverallBucketsResponse::fromXContent, Collections.emptySet()); }
/** * Gets overall buckets for a set of Machine Learning Jobs. * <p> * For additional info * see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html"> * ML GET overall buckets documentation</a> * * @param request The request * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized */
Gets overall buckets for a set of Machine Learning Jobs. For additional info see ML GET overall buckets documentation
getOverallBuckets
{ "repo_name": "gingerwizard/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/MachineLearningClient.java", "license": "apache-2.0", "size": 133077 }
[ "java.io.IOException", "java.util.Collections", "org.elasticsearch.client.ml.GetOverallBucketsRequest", "org.elasticsearch.client.ml.GetOverallBucketsResponse" ]
import java.io.IOException; import java.util.Collections; import org.elasticsearch.client.ml.GetOverallBucketsRequest; import org.elasticsearch.client.ml.GetOverallBucketsResponse;
import java.io.*; import java.util.*; import org.elasticsearch.client.ml.*;
[ "java.io", "java.util", "org.elasticsearch.client" ]
java.io; java.util; org.elasticsearch.client;
1,222,098
JcrPackageDefinition createPackageDefinition(Node defNode); /** * Opens a package that is based on the given node. If {@code allowInvalid} * is {@code true} also invalid packages are returned, but only if the * node is file like (i.e. is nt:hierarchyNode and has a * jcr:content/jcr:data property). * * This is a shortcut version of {@link org.apache.jackrabbit.vault.packaging.JcrPackageManager#open(javax.jcr.Node, boolean)}
JcrPackageDefinition createPackageDefinition(Node defNode); /** * Opens a package that is based on the given node. If {@code allowInvalid} * is {@code true} also invalid packages are returned, but only if the * node is file like (i.e. is nt:hierarchyNode and has a * jcr:content/jcr:data property). * * This is a shortcut version of {@link org.apache.jackrabbit.vault.packaging.JcrPackageManager#open(javax.jcr.Node, boolean)}
/** * Creates a new jcr package definition based on the given node. * @param defNode the node * @return the definition */
Creates a new jcr package definition based on the given node
createPackageDefinition
{ "repo_name": "apache/jackrabbit-filevault", "path": "vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/Packaging.java", "license": "apache-2.0", "size": 4433 }
[ "javax.jcr.Node" ]
import javax.jcr.Node;
import javax.jcr.*;
[ "javax.jcr" ]
javax.jcr;
2,486,188
public BufferedImage createFrame(long framePositionInAudioSamples, long totalLengthInAudioSamples, int width, int height);
BufferedImage function(long framePositionInAudioSamples, long totalLengthInAudioSamples, int width, int height);
/** * Returns a 8-bit ARGB AWT BufferedImage for the current frame. * * @param framePositionInAudioSamples * the current position of the frame in the movie, measured via the audio samples of the WAV input. For example, positionInAudioSamples=44100 represents the frame after exactly 44100 * audio samples (1second). With a WAV sample frequency of 44100 and a movie frame rate of 25fps this value will for example increment by 1764 with each call. * @param totalLengthInAudioSamples * the total length of the WAV file measured in audio samples * @param width * horizontal resolution of the image to be created, measured in pixels * @param height * vertical resolution of the image to be created, measured in pixels * @return */
Returns a 8-bit ARGB AWT BufferedImage for the current frame
createFrame
{ "repo_name": "TimbresDev/H264ACCEncoder", "path": "src/main/java/technology/timbres/FrameGenerator.java", "license": "mit", "size": 1041 }
[ "java.awt.image.BufferedImage" ]
import java.awt.image.BufferedImage;
import java.awt.image.*;
[ "java.awt" ]
java.awt;
1,861,928
private native boolean readImage(long structPointer, byte [] buffer, int numRasterBands, int [] srcBands, int [] bandSizes, int sourceXOffset, int sourceYOffset, int sourceWidth, int sourceHeight, int periodX, int periodY, JPEGQTable [] abbrevQTables, JPEGHuffmanTable [] abbrevDCHuffmanTables, JPEGHuffmanTable [] abbrevACHuffmanTables, int minProgressivePass, int maxProgressivePass, boolean wantUpdates);
native boolean function(long structPointer, byte [] buffer, int numRasterBands, int [] srcBands, int [] bandSizes, int sourceXOffset, int sourceYOffset, int sourceWidth, int sourceHeight, int periodX, int periodY, JPEGQTable [] abbrevQTables, JPEGHuffmanTable [] abbrevDCHuffmanTables, JPEGHuffmanTable [] abbrevACHuffmanTables, int minProgressivePass, int maxProgressivePass, boolean wantUpdates);
/** * Returns <code>true</code> if the read was aborted. */
Returns <code>true</code> if the read was aborted
readImage
{ "repo_name": "axDev-JDK/jdk", "path": "src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java", "license": "gpl-2.0", "size": 63686 }
[ "javax.imageio.plugins.jpeg.JPEGHuffmanTable", "javax.imageio.plugins.jpeg.JPEGQTable" ]
import javax.imageio.plugins.jpeg.JPEGHuffmanTable; import javax.imageio.plugins.jpeg.JPEGQTable;
import javax.imageio.plugins.jpeg.*;
[ "javax.imageio" ]
javax.imageio;
234,121
void describeProducersInfo(JSONArray objs) throws Exception;
void describeProducersInfo(JSONArray objs) throws Exception;
/** * Add all the producers detail to the JSONArray object. * This is a method to be used by the management layer. * * @param objs * @throws Exception */
Add all the producers detail to the JSONArray object. This is a method to be used by the management layer
describeProducersInfo
{ "repo_name": "wildfly/activemq-artemis", "path": "artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java", "license": "apache-2.0", "size": 4984 }
[ "org.apache.activemq.artemis.utils.json.JSONArray" ]
import org.apache.activemq.artemis.utils.json.JSONArray;
import org.apache.activemq.artemis.utils.json.*;
[ "org.apache.activemq" ]
org.apache.activemq;
61,250
void setAttrNode(AttrImpl attr, AttrImpl previous) { if (mutationEvents) { // MUTATION POST-EVENTS: if (previous == null) { dispatchAggregateEvents(attr.ownerNode, attr, null, MutationEvent.ADDITION); } else { dispatchAggregateEvents(attr.ownerNode, attr, previous.getNodeValue(), MutationEvent.MODIFICATION); } } }
void setAttrNode(AttrImpl attr, AttrImpl previous) { if (mutationEvents) { if (previous == null) { dispatchAggregateEvents(attr.ownerNode, attr, null, MutationEvent.ADDITION); } else { dispatchAggregateEvents(attr.ownerNode, attr, previous.getNodeValue(), MutationEvent.MODIFICATION); } } }
/** * A method to be called when an attribute node has been set */
A method to be called when an attribute node has been set
setAttrNode
{ "repo_name": "PrincetonUniversity/NVJVM", "path": "build/linux-amd64/jaxp/drop/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/DocumentImpl.java", "license": "gpl-2.0", "size": 50761 }
[ "org.w3c.dom.events.MutationEvent" ]
import org.w3c.dom.events.MutationEvent;
import org.w3c.dom.events.*;
[ "org.w3c.dom" ]
org.w3c.dom;
934,411
public boolean isWidgetMode() { return m_galleryMode == GalleryMode.widget; }
boolean function() { return m_galleryMode == GalleryMode.widget; }
/** * Returns if the current gallery mode is the widget mode (used within xml-content editor etc.).<p> * * @return <code>true</code> if the gallery was opened as a widget */
Returns if the current gallery mode is the widget mode (used within xml-content editor etc.)
isWidgetMode
{ "repo_name": "mediaworx/opencms-core", "path": "src/org/opencms/ade/galleries/CmsGalleryActionElement.java", "license": "lgpl-2.1", "size": 11241 }
[ "org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants" ]
import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants;
import org.opencms.ade.galleries.shared.*;
[ "org.opencms.ade" ]
org.opencms.ade;
2,350,705
private void walkComponentTree( final AbstractComponentType componentType, final int propertyNumber, int begin, final OuterJoinLoadable persister, final String alias, final String path, final int currentDepth ) throws MappingException { Type[] types = componentType.getSubtypes(); String[] propertyNames = componentType.getPropertyNames(); for ( int i=0; i <types.length; i++ ) { if ( types[i].isAssociationType() ) { AssociationType associationType = (AssociationType) types[i]; String[] aliasedLhsColumns = JoinHelper.getAliasedLHSColumnNames( associationType, alias, propertyNumber, begin, persister, getFactory() ); String[] lhsColumns = JoinHelper.getLHSColumnNames( associationType, propertyNumber, begin, persister, getFactory() ); String lhsTable = JoinHelper.getLHSTableName(associationType, propertyNumber, persister); String subpath = subPath( path, propertyNames[i] ); final boolean[] propertyNullability = componentType.getPropertyNullability(); final int joinType = getJoinType( associationType, componentType.getFetchMode(i), subpath, lhsTable, lhsColumns, propertyNullability==null || propertyNullability[i], currentDepth, componentType.getCascadeStyle(i) ); addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType ); } else if ( types[i].isComponentType() ) { String subpath = subPath( path, propertyNames[i] ); walkComponentTree( (AbstractComponentType) types[i], propertyNumber, begin, persister, alias, subpath, currentDepth ); } begin+=types[i].getColumnSpan( getFactory() ); } }
void function( final AbstractComponentType componentType, final int propertyNumber, int begin, final OuterJoinLoadable persister, final String alias, final String path, final int currentDepth ) throws MappingException { Type[] types = componentType.getSubtypes(); String[] propertyNames = componentType.getPropertyNames(); for ( int i=0; i <types.length; i++ ) { if ( types[i].isAssociationType() ) { AssociationType associationType = (AssociationType) types[i]; String[] aliasedLhsColumns = JoinHelper.getAliasedLHSColumnNames( associationType, alias, propertyNumber, begin, persister, getFactory() ); String[] lhsColumns = JoinHelper.getLHSColumnNames( associationType, propertyNumber, begin, persister, getFactory() ); String lhsTable = JoinHelper.getLHSTableName(associationType, propertyNumber, persister); String subpath = subPath( path, propertyNames[i] ); final boolean[] propertyNullability = componentType.getPropertyNullability(); final int joinType = getJoinType( associationType, componentType.getFetchMode(i), subpath, lhsTable, lhsColumns, propertyNullability==null propertyNullability[i], currentDepth, componentType.getCascadeStyle(i) ); addAssociationToJoinTreeIfNecessary( associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType ); } else if ( types[i].isComponentType() ) { String subpath = subPath( path, propertyNames[i] ); walkComponentTree( (AbstractComponentType) types[i], propertyNumber, begin, persister, alias, subpath, currentDepth ); } begin+=types[i].getColumnSpan( getFactory() ); } }
/** * For a component, add to a list of associations to be fetched by outerjoin */
For a component, add to a list of associations to be fetched by outerjoin
walkComponentTree
{ "repo_name": "renmeng8875/projects", "path": "Hibernate-source/源代码及重要说明/Hibernate相关资料/hibernate-3.2.0.ga/hibernate-3.2/src/org/hibernate/loader/JoinWalker.java", "license": "apache-2.0", "size": 27789 }
[ "org.hibernate.MappingException", "org.hibernate.engine.JoinHelper", "org.hibernate.persister.entity.OuterJoinLoadable", "org.hibernate.type.AbstractComponentType", "org.hibernate.type.AssociationType", "org.hibernate.type.Type" ]
import org.hibernate.MappingException; import org.hibernate.engine.JoinHelper; import org.hibernate.persister.entity.OuterJoinLoadable; import org.hibernate.type.AbstractComponentType; import org.hibernate.type.AssociationType; import org.hibernate.type.Type;
import org.hibernate.*; import org.hibernate.engine.*; import org.hibernate.persister.entity.*; import org.hibernate.type.*;
[ "org.hibernate", "org.hibernate.engine", "org.hibernate.persister", "org.hibernate.type" ]
org.hibernate; org.hibernate.engine; org.hibernate.persister; org.hibernate.type;
1,380,057
boolean isNestedAssign(Node parent) { return parent.isAssign() && !parent.getParent().isExprResult(); } /** * Gets a {@link Name} instance for a global name. Creates it if necessary, * as well as instances for any of its prefixes that are not yet defined. * * @param name A global name (e.g. "a", "a.b.c.d") * @return The {@link Name} instance for {@code name}
boolean isNestedAssign(Node parent) { return parent.isAssign() && !parent.getParent().isExprResult(); } /** * Gets a {@link Name} instance for a global name. Creates it if necessary, * as well as instances for any of its prefixes that are not yet defined. * * @param name A global name (e.g. "a", STR) * @return The {@link Name} instance for {@code name}
/** * Determines whether an assignment is nested (i.e. whether its return * value is used). * * @param parent The parent of the current traversal node (not null) * @return Whether it appears that the return value of the assignment is * used */
Determines whether an assignment is nested (i.e. whether its return value is used)
isNestedAssign
{ "repo_name": "Medium/closure-compiler", "path": "src/com/google/javascript/jscomp/GlobalNamespace.java", "license": "apache-2.0", "size": 43810 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
330,538
public boolean acceptInvite(Message inviteMessage) throws JMSException { log.debug("public boolean acceptInvite(Message inviteMessage): called"); // Test parameters don't matter, accept all invites. return true; }
boolean function(Message inviteMessage) throws JMSException { log.debug(STR); return true; }
/** * Determines whether the test invite that matched this test case is acceptable. * * @param inviteMessage The invitation to accept or reject. * * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it. * * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through. */
Determines whether the test invite that matched this test case is acceptable
acceptInvite
{ "repo_name": "wso2/andes", "path": "modules/andes-core/integrationtests/src/main/java/org/wso2/andes/interop/clienttestcases/TestCase1DummyRun.java", "license": "apache-2.0", "size": 4842 }
[ "javax.jms.JMSException", "javax.jms.Message" ]
import javax.jms.JMSException; import javax.jms.Message;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
2,744,145
protected void addColumnTo(List<Column<?>> columns) { CollectionUtils.addIgnoreNull(columns, getColumn()); }
void function(List<Column<?>> columns) { CollectionUtils.addIgnoreNull(columns, getColumn()); }
/** * Method that asks the Field to add its column to the provided list. * * Should be overridden in composite Fields like {@link Page}! * * @param columns */
Method that asks the Field to add its column to the provided list. Should be overridden in composite Fields like <code>Page</code>
addColumnTo
{ "repo_name": "dave-cassettari/sapelli", "path": "Library/src/uk/ac/ucl/excites/sapelli/collector/model/Field.java", "license": "unlicense", "size": 17133 }
[ "java.util.List", "uk.ac.ucl.excites.sapelli.shared.util.CollectionUtils", "uk.ac.ucl.excites.sapelli.storage.model.Column" ]
import java.util.List; import uk.ac.ucl.excites.sapelli.shared.util.CollectionUtils; import uk.ac.ucl.excites.sapelli.storage.model.Column;
import java.util.*; import uk.ac.ucl.excites.sapelli.shared.util.*; import uk.ac.ucl.excites.sapelli.storage.model.*;
[ "java.util", "uk.ac.ucl" ]
java.util; uk.ac.ucl;
2,673,231
public ReportingWorkItemRevisionsBatch readReportingRevisionsGet( final UUID project, final List<String> fields, final List<String> types, final String continuationToken, final Date startDateTime, final Boolean includeIdentityRef, final Boolean includeDeleted, final Boolean includeTagRef, final Boolean includeLatestOnly, final ReportingRevisionsExpand expand) { final UUID locationId = UUID.fromString("f828fe59-dd87-495d-a17c-7a8d6211ca6c"); //$NON-NLS-1$ final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.2"); //$NON-NLS-1$ final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put("project", project); //$NON-NLS-1$ final NameValueCollection queryParameters = new NameValueCollection(); queryParameters.addIfNotNull("fields", fields); //$NON-NLS-1$ queryParameters.addIfNotNull("types", types); //$NON-NLS-1$ queryParameters.addIfNotEmpty("continuationToken", continuationToken); //$NON-NLS-1$ queryParameters.addIfNotNull("startDateTime", startDateTime); //$NON-NLS-1$ queryParameters.addIfNotNull("includeIdentityRef", includeIdentityRef); //$NON-NLS-1$ queryParameters.addIfNotNull("includeDeleted", includeDeleted); //$NON-NLS-1$ queryParameters.addIfNotNull("includeTagRef", includeTagRef); //$NON-NLS-1$ queryParameters.addIfNotNull("includeLatestOnly", includeLatestOnly); //$NON-NLS-1$ queryParameters.addIfNotNull("$expand", expand); //$NON-NLS-1$ final VssRestRequest httpRequest = super.createRequest(HttpMethod.GET, locationId, routeValues, apiVersion, queryParameters, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, ReportingWorkItemRevisionsBatch.class); }
ReportingWorkItemRevisionsBatch function( final UUID project, final List<String> fields, final List<String> types, final String continuationToken, final Date startDateTime, final Boolean includeIdentityRef, final Boolean includeDeleted, final Boolean includeTagRef, final Boolean includeLatestOnly, final ReportingRevisionsExpand expand) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, project); final NameValueCollection queryParameters = new NameValueCollection(); queryParameters.addIfNotNull(STR, fields); queryParameters.addIfNotNull("types", types); queryParameters.addIfNotEmpty(STR, continuationToken); queryParameters.addIfNotNull(STR, startDateTime); queryParameters.addIfNotNull(STR, includeIdentityRef); queryParameters.addIfNotNull(STR, includeDeleted); queryParameters.addIfNotNull(STR, includeTagRef); queryParameters.addIfNotNull(STR, includeLatestOnly); queryParameters.addIfNotNull(STR, expand); final VssRestRequest httpRequest = super.createRequest(HttpMethod.GET, locationId, routeValues, apiVersion, queryParameters, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, ReportingWorkItemRevisionsBatch.class); }
/** * [Preview API 3.1-preview.2] Get a batch of work item revisions with the option of including deleted items * * @param project * Project ID * @param fields * A list of fields to return in work item revisions. Omit this parameter to get all reportable fields. * @param types * A list of types to filter the results to specific work item types. Omit this parameter to get work item revisions of all work item types. * @param continuationToken * Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions. * @param startDateTime * Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with &#039;watermark&#039; parameter. * @param includeIdentityRef * Return an identity reference instead of a string value for identity fields. * @param includeDeleted * Specify if the deleted item should be returned. * @param includeTagRef * Specify if the tag objects should be returned for System.Tags field. * @param includeLatestOnly * Return only the latest revisions of work items, skipping all historical revisions * @param expand * * @return ReportingWorkItemRevisionsBatch */
[Preview API 3.1-preview.2] Get a batch of work item revisions with the option of including deleted items
readReportingRevisionsGet
{ "repo_name": "Microsoft/vso-httpclient-java", "path": "Rest/alm-tfs-client/src/main/generated/com/microsoft/alm/teamfoundation/workitemtracking/webapi/WorkItemTrackingHttpClientBase.java", "license": "mit", "size": 169431 }
[ "com.microsoft.alm.client.HttpMethod", "com.microsoft.alm.client.VssMediaTypes", "com.microsoft.alm.client.VssRestRequest", "com.microsoft.alm.client.model.NameValueCollection", "com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.ReportingRevisionsExpand", "com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.ReportingWorkItemRevisionsBatch", "com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion", "java.util.Date", "java.util.HashMap", "java.util.List", "java.util.Map", "java.util.UUID" ]
import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.client.model.NameValueCollection; import com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.ReportingRevisionsExpand; import com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.ReportingWorkItemRevisionsBatch; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID;
import com.microsoft.alm.client.*; import com.microsoft.alm.client.model.*; import com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*;
[ "com.microsoft.alm", "java.util" ]
com.microsoft.alm; java.util;
2,347,245
private static void run() throws IOException { // Create a test event. Event event = Utils.createTestEvent(client, "Test Event"); System.out.println(String.format("Event created: %s", event.getHtmlLink())); // Pause while the user modifies the event in the Calendar UI. System.out.println("Modify the event's description and hit enter to continue."); System.in.read(); // Modify the local copy of the event. event.setSummary("Updated Test Event"); // Update the event, making sure that we don't overwrite other changes. int numAttempts = 0; boolean isUpdated = false; do { Calendar.Events.Update request = client.events().update("primary", event.getId(), event); request.setRequestHeaders(new HttpHeaders().setIfMatch(event.getEtag())); try { event = request.execute(); isUpdated = true; } catch (GoogleJsonResponseException e) { if (e.getStatusCode() == 412) { // A 412 status code, "Precondition failed", indicates that the etag values didn't // match, and the event was updated on the server since we last retrieved it. Use // {@link Calendar.Events.Get} to retrieve the latest version. Event latestEvent = client.events().get("primary", event.getId()).execute(); // You may want to have more complex logic here to resolve conflicts. In this sample we're // simply overwriting the summary. latestEvent.setSummary(event.getSummary()); event = latestEvent; } else { throw e; } } numAttempts++; } while (!isUpdated && numAttempts <= MAX_UPDATE_ATTEMPTS); if (isUpdated) { System.out.println("Event updated."); } else { System.out.println(String.format("Failed to update event after %d attempts.", numAttempts)); } }
static void function() throws IOException { Event event = Utils.createTestEvent(client, STR); System.out.println(String.format(STR, event.getHtmlLink())); System.out.println(STR); System.in.read(); event.setSummary(STR); int numAttempts = 0; boolean isUpdated = false; do { Calendar.Events.Update request = client.events().update(STR, event.getId(), event); request.setRequestHeaders(new HttpHeaders().setIfMatch(event.getEtag())); try { event = request.execute(); isUpdated = true; } catch (GoogleJsonResponseException e) { if (e.getStatusCode() == 412) { Event latestEvent = client.events().get(STR, event.getId()).execute(); latestEvent.setSummary(event.getSummary()); event = latestEvent; } else { throw e; } } numAttempts++; } while (!isUpdated && numAttempts <= MAX_UPDATE_ATTEMPTS); if (isUpdated) { System.out.println(STR); } else { System.out.println(String.format(STR, numAttempts)); } }
/** * Creates a test event, pauses while the user modifies the event in the Calendar UI, and then * updates the event with a new location, ensure that the user's changes aren't overwritten. */
Creates a test event, pauses while the user modifies the event in the Calendar UI, and then updates the event with a new location, ensure that the user's changes aren't overwritten
run
{ "repo_name": "googleworkspace/java-samples", "path": "calendar/sync/src/main/java/com/google/api/services/samples/calendar/sync/ConditionalModificationSample.java", "license": "apache-2.0", "size": 4107 }
[ "com.google.api.client.googleapis.json.GoogleJsonResponseException", "com.google.api.client.http.HttpHeaders", "com.google.api.services.calendar.Calendar", "com.google.api.services.calendar.model.Event", "java.io.IOException" ]
import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.http.HttpHeaders; import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.model.Event; import java.io.IOException;
import com.google.api.client.googleapis.json.*; import com.google.api.client.http.*; import com.google.api.services.calendar.*; import com.google.api.services.calendar.model.*; import java.io.*;
[ "com.google.api", "java.io" ]
com.google.api; java.io;
1,702,400
return DIOJNI.getDIO(m_port); }
return DIOJNI.getDIO(m_port); }
/** * Get the value from a digital input channel. Retrieve the value of a single * digital input channel from the FPGA. * * @return the status of the digital input */
Get the value from a digital input channel. Retrieve the value of a single digital input channel from the FPGA
get
{ "repo_name": "RAR1741/wpilib", "path": "wpilibj/src/athena/java/edu/wpi/first/wpilibj/DigitalInput.java", "license": "bsd-3-clause", "size": 3020 }
[ "edu.wpi.first.wpilibj.hal.DIOJNI" ]
import edu.wpi.first.wpilibj.hal.DIOJNI;
import edu.wpi.first.wpilibj.hal.*;
[ "edu.wpi.first" ]
edu.wpi.first;
1,548,474
public Extension getExtension(ASN1ObjectIdentifier oid) { if (extensions != null) { return extensions.getExtension(oid); } return null; }
Extension function(ASN1ObjectIdentifier oid) { if (extensions != null) { return extensions.getExtension(oid); } return null; }
/** * Look up the extension associated with the passed in OID. * * @param oid the OID of the extension of interest. * * @return the extension if present, null otherwise. */
Look up the extension associated with the passed in OID
getExtension
{ "repo_name": "Skywalker-11/spongycastle", "path": "pkix/src/main/java/org/spongycastle/cert/X509AttributeCertificateHolder.java", "license": "mit", "size": 10935 }
[ "org.spongycastle.asn1.ASN1ObjectIdentifier", "org.spongycastle.asn1.x509.Extension" ]
import org.spongycastle.asn1.ASN1ObjectIdentifier; import org.spongycastle.asn1.x509.Extension;
import org.spongycastle.asn1.*; import org.spongycastle.asn1.x509.*;
[ "org.spongycastle.asn1" ]
org.spongycastle.asn1;
54,170
public void horizontalBlurTransp(int[] originalPixels, int[] blurredPixels, Dimension dim) { int width = dim.width; int height = dim.height; int sourcePosition, destPosition, rgb1, rgb2, tr, tg, tb, pixelCount, alpha; for (int i = 0; i < height; i++) { sourcePosition = i * width; destPosition = i + height * (width - 1); tr = 0; tg = 0; tb = 0; alpha = 0; for (int j = 0; j <= radius; j++) { rgb1 = originalPixels[sourcePosition + j]; tr += ((rgb1 & 0xff0000) >> 16); tg += ((rgb1 & 0x00ff00) >> 8); tb += (rgb1 & 0xff); alpha += ((rgb1 & 0xff000000) >> 24); } pixelCount = radius + 1; blurredPixels[destPosition] = ((alpha / pixelCount) << 24) | ((tr / pixelCount) << 16) | ((tg / pixelCount) << 8) | (tb / pixelCount); sourcePosition++; destPosition -= height; pixelCount++; for (int j = 1; j <= radius; j++, sourcePosition++, destPosition -= height, pixelCount++) { rgb1 = originalPixels[sourcePosition + radius]; tr += ((rgb1 & 0xff0000) >> 16); tg += ((rgb1 & 0x00ff00) >> 8); tb += (rgb1 & 0xff); alpha += ((rgb1 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) | ((tr / pixelCount) << 16) | ((tg / pixelCount) << 8) | (tb / pixelCount); } pixelCount--; for (int j = radius + 1; j < width - radius; j++, sourcePosition++, destPosition -= height) { rgb1 = originalPixels[sourcePosition + radius]; rgb2 = originalPixels[sourcePosition - radius - 1]; tr += (((rgb1 & 0xff0000) - (rgb2 & 0xff0000)) >> 16); tg += (((rgb1 & 0x00ff00) - (rgb2 & 0x00ff00)) >> 8); tb += ((rgb1 & 0xff) - (rgb2 & 0xff)); alpha += ((rgb1 & 0xff000000) >> 24) - ((rgb2 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) | ((tr / pixelCount) << 16) | ((tg / pixelCount) << 8) | (tb / pixelCount); } pixelCount--; for (int j = width - radius; j < width; j++, sourcePosition++, destPosition -= height, pixelCount--) { rgb2 = originalPixels[sourcePosition - radius - 1]; tr -= ((rgb2 & 0xff0000) >> 16); tg -= ((rgb2 & 0x00ff00) >> 8); tb -= (rgb2 & 0xff); alpha -= ((rgb2 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) | ((tr / pixelCount) << 16) | ((tg / pixelCount) << 8) | (tb / pixelCount); } } }
void function(int[] originalPixels, int[] blurredPixels, Dimension dim) { int width = dim.width; int height = dim.height; int sourcePosition, destPosition, rgb1, rgb2, tr, tg, tb, pixelCount, alpha; for (int i = 0; i < height; i++) { sourcePosition = i * width; destPosition = i + height * (width - 1); tr = 0; tg = 0; tb = 0; alpha = 0; for (int j = 0; j <= radius; j++) { rgb1 = originalPixels[sourcePosition + j]; tr += ((rgb1 & 0xff0000) >> 16); tg += ((rgb1 & 0x00ff00) >> 8); tb += (rgb1 & 0xff); alpha += ((rgb1 & 0xff000000) >> 24); } pixelCount = radius + 1; blurredPixels[destPosition] = ((alpha / pixelCount) << 24) ((tr / pixelCount) << 16) ((tg / pixelCount) << 8) (tb / pixelCount); sourcePosition++; destPosition -= height; pixelCount++; for (int j = 1; j <= radius; j++, sourcePosition++, destPosition -= height, pixelCount++) { rgb1 = originalPixels[sourcePosition + radius]; tr += ((rgb1 & 0xff0000) >> 16); tg += ((rgb1 & 0x00ff00) >> 8); tb += (rgb1 & 0xff); alpha += ((rgb1 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) ((tr / pixelCount) << 16) ((tg / pixelCount) << 8) (tb / pixelCount); } pixelCount--; for (int j = radius + 1; j < width - radius; j++, sourcePosition++, destPosition -= height) { rgb1 = originalPixels[sourcePosition + radius]; rgb2 = originalPixels[sourcePosition - radius - 1]; tr += (((rgb1 & 0xff0000) - (rgb2 & 0xff0000)) >> 16); tg += (((rgb1 & 0x00ff00) - (rgb2 & 0x00ff00)) >> 8); tb += ((rgb1 & 0xff) - (rgb2 & 0xff)); alpha += ((rgb1 & 0xff000000) >> 24) - ((rgb2 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) ((tr / pixelCount) << 16) ((tg / pixelCount) << 8) (tb / pixelCount); } pixelCount--; for (int j = width - radius; j < width; j++, sourcePosition++, destPosition -= height, pixelCount--) { rgb2 = originalPixels[sourcePosition - radius - 1]; tr -= ((rgb2 & 0xff0000) >> 16); tg -= ((rgb2 & 0x00ff00) >> 8); tb -= (rgb2 & 0xff); alpha -= ((rgb2 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) ((tr / pixelCount) << 16) ((tg / pixelCount) << 8) (tb / pixelCount); } } }
/** * Perform the horizontal blur while handling transparency and the alpha * channel. * * @param originalPixels Original image raster. * @param blurredPixels Blurred image raster. * @param dim Dimension object. */
Perform the horizontal blur while handling transparency and the alpha channel
horizontalBlurTransp
{ "repo_name": "datapoet/hubminer", "path": "src/main/java/draw/basic/BoxBlur.java", "license": "gpl-3.0", "size": 15056 }
[ "java.awt.Dimension" ]
import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
72,049
@Override public int delete(Uri uri, String selection, String[] selectionArgs) { // ContentProvider has already checked granted permissions final File file = mStrategy.getFileForUri(uri); return file.delete() ? 1 : 0; }
int function(Uri uri, String selection, String[] selectionArgs) { final File file = mStrategy.getFileForUri(uri); return file.delete() ? 1 : 0; }
/** * Deletes the file associated with the specified content URI, as * returned by {@link #getUriForFile(Context, String, File) getUriForFile()}. Notice that this * method does <b>not</b> throw an {@link java.io.IOException}; you must check its return value. * * @param uri A content URI for a file, as returned by * {@link #getUriForFile(Context, String, File) getUriForFile()}. * @param selection Ignored. Set to {@code null}. * @param selectionArgs Ignored. Set to {@code null}. * @return 1 if the delete succeeds; otherwise, 0. */
Deletes the file associated with the specified content URI, as returned by <code>#getUriForFile(Context, String, File) getUriForFile()</code>. Notice that this method does not throw an <code>java.io.IOException</code>; you must check its return value
delete
{ "repo_name": "forgodsake/TowerPlus", "path": "Android/src/com/fuav/android/data/provider/FileProvider.java", "license": "gpl-3.0", "size": 33666 }
[ "android.net.Uri", "java.io.File" ]
import android.net.Uri; import java.io.File;
import android.net.*; import java.io.*;
[ "android.net", "java.io" ]
android.net; java.io;
1,288,297
public int getMetaFromState(IBlockState state) { int i = 0; if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { i |= 8; } return i; }
int function(IBlockState state) { int i = 0; if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { i = 8; } return i; }
/** * Convert the BlockState into the correct metadata value */
Convert the BlockState into the correct metadata value
getMetaFromState
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/block/BlockPurpurSlab.java", "license": "gpl-3.0", "size": 3570 }
[ "net.minecraft.block.state.IBlockState" ]
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.state.*;
[ "net.minecraft.block" ]
net.minecraft.block;
2,111,937
public void test_11_booleanFunctionParameters() throws Exception { Connection conn = getConnection(); assertResults ( conn, "values ( booleanValue( true ) ), ( booleanValue( false ) ), ( booleanValue( null ) )", new String[][] { { "True value", }, { "False value", }, { "Null value", }, }, false ); PreparedStatement ps = chattyPrepare( conn, "values ( booleanValue( ? ) )" ); ps.setBoolean( 1, true ); assertScalarResult( ps, "True value" ); ps.setBoolean( 1, false ); assertScalarResult( ps, "False value" ); ps.setNull( 1, Types.BOOLEAN ); assertScalarResult( ps, "Null value" ); ps.close(); }
void function() throws Exception { Connection conn = getConnection(); assertResults ( conn, STR, new String[][] { { STR, }, { STR, }, { STR, }, }, false ); PreparedStatement ps = chattyPrepare( conn, STR ); ps.setBoolean( 1, true ); assertScalarResult( ps, STR ); ps.setBoolean( 1, false ); assertScalarResult( ps, STR ); ps.setNull( 1, Types.BOOLEAN ); assertScalarResult( ps, STR ); ps.close(); }
/** * <p> * Verify that boolean function parameters behave well. * </p> */
Verify that boolean function parameters behave well.
test_11_booleanFunctionParameters
{ "repo_name": "splicemachine/spliceengine", "path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/lang/BooleanValuesTest.java", "license": "agpl-3.0", "size": 69208 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.Types" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Types;
import java.sql.*;
[ "java.sql" ]
java.sql;
520,815
public StringList getErrorMessages() { if (fErrors == null || fErrors.length == 0) { return StringListImpl.EMPTY_LIST; } return new PSVIErrorList(fErrors, false); }
StringList function() { if (fErrors == null fErrors.length == 0) { return StringListImpl.EMPTY_LIST; } return new PSVIErrorList(fErrors, false); }
/** * A list of error messages generated from the validation attempt or * an empty <code>StringList</code> if no errors occurred during the * validation attempt. The indices of error messages in this list are * aligned with those in the <code>[schema error code]</code> list. */
A list of error messages generated from the validation attempt or an empty <code>StringList</code> if no errors occurred during the validation attempt. The indices of error messages in this list are aligned with those in the <code>[schema error code]</code> list
getErrorMessages
{ "repo_name": "AaronZhangL/SplitCharater", "path": "xerces-2_11_0/src/org/apache/xerces/impl/xs/AttributePSVImpl.java", "license": "gpl-2.0", "size": 7688 }
[ "org.apache.xerces.impl.xs.util.StringListImpl", "org.apache.xerces.xs.StringList" ]
import org.apache.xerces.impl.xs.util.StringListImpl; import org.apache.xerces.xs.StringList;
import org.apache.xerces.impl.xs.util.*; import org.apache.xerces.xs.*;
[ "org.apache.xerces" ]
org.apache.xerces;
2,017,016
private JPopupMenu getScriptsMenu() { JPopupMenu menu = new JPopupMenu(); Collection<ScriptObject> scripts = model.getScripts(); //Scripts are sorted. if (scripts == null || scripts.size() == 0) return menu; IconManager icons = IconManager.getInstance(); JMenuItem refresh = new JMenuItem(icons.getIcon( IconManager.REFRESH)); refresh.setText("Reload Scripts"); refresh.setToolTipText("Reloads the existing scripts."); refresh.addActionListener(controller); refresh.setActionCommand(""+EditorControl.RELOAD_SCRIPT); menu.add(refresh); menu.add(new JSeparator()); Iterator<ScriptObject> i = scripts.iterator(); ScriptObject so; Map<String, ScriptSubMenu> menus = new HashMap<String, ScriptSubMenu>(); String path; ScriptSubMenu subMenu; List<ScriptSubMenu> others = new ArrayList<ScriptSubMenu>(); List<String> formattedName = new ArrayList<String>(); while (i.hasNext()) { so = i.next(); setScriptIcon(so); path = so.getPath(); subMenu = menus.get(path); if (subMenu == null) { subMenu = new ScriptSubMenu(path, formattedName); //formattedName.add(subMenu.getUnformattedText()); menus.put(path, subMenu); if (so.isOfficialScript()) menu.add(subMenu); else others.add(subMenu); } //if (!ScriptMenuItem.isScriptWithUI(so.getScriptLabel())) subMenu.addScript(so).addActionListener(controller); } if (others.size() > 0) { menu.add(new JSeparator()); JMenu uploadedMenu = new JMenu("User Scripts"); menu.add(uploadedMenu); Iterator<ScriptSubMenu> j = others.iterator(); while (j.hasNext()) uploadedMenu.add(j.next()); } return menu; } ToolBar(EditorModel model, EditorControl controller) { if (model == null) throw new IllegalArgumentException("No model."); if (controller == null) throw new IllegalArgumentException("No control."); this.model = model; this.controller = controller; initComponents(); buildGUI(); } void setDataToSave(boolean b) { saveButton.setEnabled(b); }
JPopupMenu function() { JPopupMenu menu = new JPopupMenu(); Collection<ScriptObject> scripts = model.getScripts(); if (scripts == null scripts.size() == 0) return menu; IconManager icons = IconManager.getInstance(); JMenuItem refresh = new JMenuItem(icons.getIcon( IconManager.REFRESH)); refresh.setText(STR); refresh.setToolTipText(STR); refresh.addActionListener(controller); refresh.setActionCommand(STRUser ScriptsSTRNo model.STRNo control."); this.model = model; this.controller = controller; initComponents(); buildGUI(); } void setDataToSave(boolean b) { saveButton.setEnabled(b); }
/** * Builds the menu displaying the available scripts. * * @return See above. */
Builds the menu displaying the available scripts
getScriptsMenu
{ "repo_name": "ximenesuk/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/editor/ToolBar.java", "license": "gpl-2.0", "size": 29272 }
[ "java.util.Collection", "javax.swing.JMenuItem", "javax.swing.JPopupMenu", "org.openmicroscopy.shoola.agents.metadata.IconManager", "org.openmicroscopy.shoola.env.data.model.ScriptObject" ]
import java.util.Collection; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import org.openmicroscopy.shoola.agents.metadata.IconManager; import org.openmicroscopy.shoola.env.data.model.ScriptObject;
import java.util.*; import javax.swing.*; import org.openmicroscopy.shoola.agents.metadata.*; import org.openmicroscopy.shoola.env.data.model.*;
[ "java.util", "javax.swing", "org.openmicroscopy.shoola" ]
java.util; javax.swing; org.openmicroscopy.shoola;
1,816,195
public OneResponse info() { OneResponse response = info(client, filter); processInfo(response); return response; }
OneResponse function() { OneResponse response = info(client, filter); processInfo(response); return response; }
/** * Loads the xml representation of all or part of the * Virtual Machines in the pool. The filter used is the one set in * the constructor. * * @see VirtualMachinePool#info(Client, int) * * @return If successful the message contains the string * with the information returned by OpenNebula. */
Loads the xml representation of all or part of the Virtual Machines in the pool. The filter used is the one set in the constructor
info
{ "repo_name": "philsavor/opennebula3.2.1", "path": "src/oca/java/src/org/opennebula/client/vm/VirtualMachinePool.java", "license": "apache-2.0", "size": 9428 }
[ "org.opennebula.client.OneResponse" ]
import org.opennebula.client.OneResponse;
import org.opennebula.client.*;
[ "org.opennebula.client" ]
org.opennebula.client;
1,508,250
public byte[] getBytes(String name) throws IOException { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if (in == null) { throw new IllegalStateException("resource " + name + " not found"); } ByteArrayOutputStream bos = new ByteArrayOutputStream(); IOUtils.copy(in, bos); return bos.toByteArray(); }
byte[] function(String name) throws IOException { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if (in == null) { throw new IllegalStateException(STR + name + STR); } ByteArrayOutputStream bos = new ByteArrayOutputStream(); IOUtils.copy(in, bos); return bos.toByteArray(); }
/** * Gets bytes. * @param name The name. * @return The bytes. * @throws IOException - if something is wrong this exception is thrown. */
Gets bytes
getBytes
{ "repo_name": "astrolox/cosmo", "path": "cosmo-core/src/test/unit/java/org/unitedinternet/cosmo/TestHelper.java", "license": "apache-2.0", "size": 16761 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.io.InputStream", "org.apache.commons.io.IOUtils" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils;
import java.io.*; import org.apache.commons.io.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
764,555
protected FormFieldValueEntity getFormFieldValue(FieldTemplate fieldTemplate, DataRecord data, String lang) throws FormException { // Field data final Field field = data.getField(fieldTemplate.getFieldName()); return getFormFieldValue(fieldTemplate, field, lang); }
FormFieldValueEntity function(FieldTemplate fieldTemplate, DataRecord data, String lang) throws FormException { final Field field = data.getField(fieldTemplate.getFieldName()); return getFormFieldValue(fieldTemplate, field, lang); }
/** * Gets the value of a field. * @param fieldTemplate a field template. * @param data the data of a form registration. * @param lang the content language of data. * @return a {@link FormFieldValueEntity} instance initialized with given form data. * @throws FormException which could be thrown by form services. */
Gets the value of a field
getFormFieldValue
{ "repo_name": "SilverDav/Silverpeas-Core", "path": "core-web/src/main/java/org/silverpeas/core/webapi/contribution/AbstractContributionResource.java", "license": "agpl-3.0", "size": 9118 }
[ "org.silverpeas.core.contribution.content.form.DataRecord", "org.silverpeas.core.contribution.content.form.Field", "org.silverpeas.core.contribution.content.form.FieldTemplate", "org.silverpeas.core.contribution.content.form.FormException" ]
import org.silverpeas.core.contribution.content.form.DataRecord; import org.silverpeas.core.contribution.content.form.Field; import org.silverpeas.core.contribution.content.form.FieldTemplate; import org.silverpeas.core.contribution.content.form.FormException;
import org.silverpeas.core.contribution.content.form.*;
[ "org.silverpeas.core" ]
org.silverpeas.core;
829,124
@Override public byte[] decode(final byte[] bytes) throws DecoderException { return decodeQuotedPrintable(bytes); }
byte[] function(final byte[] bytes) throws DecoderException { return decodeQuotedPrintable(bytes); }
/** * Decodes an array of quoted-printable characters into an array of original bytes. Escaped characters are converted * back to their original representation. * <p> * This function fully implements the quoted-printable encoding specification (rule #1 through rule #5) as * defined in RFC 1521. * * @param bytes * array of quoted-printable characters * @return array of original bytes * @throws DecoderException * Thrown if quoted-printable decoding is unsuccessful */
Decodes an array of quoted-printable characters into an array of original bytes. Escaped characters are converted back to their original representation. This function fully implements the quoted-printable encoding specification (rule #1 through rule #5) as defined in RFC 1521
decode
{ "repo_name": "gusavila92/java-android-websocket-client", "path": "src/main/java/tech/gusavila92/apache/commons/codec/net/QuotedPrintableCodec.java", "license": "apache-2.0", "size": 23298 }
[ "tech.gusavila92.apache.commons.codec.DecoderException" ]
import tech.gusavila92.apache.commons.codec.DecoderException;
import tech.gusavila92.apache.commons.codec.*;
[ "tech.gusavila92.apache" ]
tech.gusavila92.apache;
2,462,967
public void testCalendarToNumber() { NumberConverter converter = makeConverter(); Calendar calendarValue = Calendar.getInstance(); long longValue = calendarValue.getTime().getTime(); // Calendar --> Long conversion assertEquals("Calendar to Long", new Long(longValue), converter.convert(Long.class, calendarValue)); // Calendar --> Integer try { converter.convert(Integer.class, calendarValue); fail("Calendar to Integer - expected a ConversionException"); } catch (ConversionException e) { // expected result - too large for Integer } }
void function() { NumberConverter converter = makeConverter(); Calendar calendarValue = Calendar.getInstance(); long longValue = calendarValue.getTime().getTime(); assertEquals(STR, new Long(longValue), converter.convert(Long.class, calendarValue)); try { converter.convert(Integer.class, calendarValue); fail(STR); } catch (ConversionException e) { } }
/** * Convert Calendar --> Long */
Convert Calendar --> Long
testCalendarToNumber
{ "repo_name": "SoftwareEngineeringToolDemos/FSE-2011-EvoSuite", "path": "master/src/test/java/com/examples/with/different/packagename/testcarver/NumberConverterTestBase.java", "license": "lgpl-3.0", "size": 14531 }
[ "com.examples.with.different.packagename.testcarver.ConversionException", "java.util.Calendar" ]
import com.examples.with.different.packagename.testcarver.ConversionException; import java.util.Calendar;
import com.examples.with.different.packagename.testcarver.*; import java.util.*;
[ "com.examples.with", "java.util" ]
com.examples.with; java.util;
1,641,679
public void extract(File input, File outputDir) throws IOException { extract(input, outputDir, ".vba"); }
void function(File input, File outputDir) throws IOException { extract(input, outputDir, ".vba"); }
/** * Extracts the VBA modules from a macro-enabled office file and writes them * to <tt>.vba</tt> files in <tt>outputDir</tt>. * * Creates the <tt>outputDir</tt>, directory, including any necessary but * nonexistent parent directories, if <tt>outputDir</tt> does not exist. * If <tt>outputDir</tt> is null, writes the contents to standard out instead. * * @param input the macro-enabled office file. * @param outputDir the directory to write the extracted VBA modules to. * @since 3.15-beta2 */
Extracts the VBA modules from a macro-enabled office file and writes them to .vba files in outputDir. Creates the outputDir, directory, including any necessary but nonexistent parent directories, if outputDir does not exist. If outputDir is null, writes the contents to standard out instead
extract
{ "repo_name": "lvweiwolf/poi-3.16", "path": "src/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java", "license": "apache-2.0", "size": 5201 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,405,255
@Override protected AuthorizationCodeFlow initializeFlow() throws IOException { String userID = userService.getCurrentUser().getUserId(); return OAuthHelper.createFlow(userID); }
AuthorizationCodeFlow function() throws IOException { String userID = userService.getCurrentUser().getUserId(); return OAuthHelper.createFlow(userID); }
/** * Creates authorization codeflow for current user * * @return OAuth authorization code flow for current user */
Creates authorization codeflow for current user
initializeFlow
{ "repo_name": "googleinterns/step43-2020", "path": "portfolio/src/main/java/com/google/sps/servlets/OAuthServlet.java", "license": "apache-2.0", "size": 2948 }
[ "com.google.api.client.auth.oauth2.AuthorizationCodeFlow", "com.google.sps.utils.OAuthHelper", "java.io.IOException" ]
import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; import com.google.sps.utils.OAuthHelper; import java.io.IOException;
import com.google.api.client.auth.oauth2.*; import com.google.sps.utils.*; import java.io.*;
[ "com.google.api", "com.google.sps", "java.io" ]
com.google.api; com.google.sps; java.io;
315,713
public synchronized void check() { if (pixelSize == null) { try { // use the configured toolkit to identify the image DocuImage di = DocuImageFactory.getInstance(); di.identify(this); } catch (IOException e) { logger.error("Error checking image from URL {}: {}", url, e); // nothing much to do... } } }
synchronized void function() { if (pixelSize == null) { try { DocuImage di = DocuImageFactory.getInstance(); di.identify(this); } catch (IOException e) { logger.error(STR, url, e); } } }
/** * Checks the image and sets size and type. */
Checks the image and sets size and type
check
{ "repo_name": "robcast/digilib", "path": "common-cdstar/src/main/java/digilib/io/ImageUrl.java", "license": "lgpl-3.0", "size": 3893 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,209,521
@Override public void finish(Writer out) throws IOException { // black and white Filter_BlackAndWhite bw = new Filter_BlackAndWhite(255); TransformedImage img = bw.filter(sourceImage); imageStart(out); liftPen(out); machine.writeChangeTo(out); double toolDiameter = machine.getDiameter(); int i, j; final int steps = 4; double leveladd = 255.0 / 5.0f; double level; int z = 0; float maxr; convertToCorners=false; if (convertToCorners) { // go right to the corners float h2 = (float)machine.getPaperHeight() * 10; float w2 = (float)machine.getPaperWidth() * 10; maxr = (float) (Math.sqrt(h2 * h2 + w2 * w2) + 1.0f); } else { // do the largest circle that still fits in the image. float w = (float)machine.getPaperWidth()/2.0f; float h = (float)machine.getPaperHeight()/2.0f; maxr = (float)( h < w ? h : w ); maxr *= machine.getPaperMargin() * 10.0f; } float r = maxr, f; float fx, fy; int numRings = 0; double[] each_level = new double[steps]; each_level[0] = leveladd * 1; each_level[1] = leveladd * 3; each_level[2] = leveladd * 2; each_level[3] = leveladd * 4; j = 0; while (r > toolDiameter) { ++j; level = each_level[j % steps]; // find circumference of current circle float circumference = (float) Math.floor((2.0f * r - toolDiameter) * Math.PI); if (circumference > 360.0f) circumference = 360.0f; for (i = 0; i <= circumference; ++i) { f = (float) Math.PI * 2.0f * (float)i / (float)circumference; fx = (float) (Math.cos(f) * r); fy = (float) (Math.sin(f) * r); // clip to paper boundaries if( isInsidePaperMargins(fx, fy) ) { try { z = img.sample3x3(fx, fy); } catch(Exception e) { e.printStackTrace(); } moveTo(out, fx, fy, (z >= level)); } else { moveTo(out, fx, fy, true); } } r -= toolDiameter; ++numRings; } Log.write("yellow", numRings + " rings."); liftPen(out); moveTo(out, (float)machine.getHomeX(), (float)machine.getHomeY(),true); } } /** * This file is part of Makelangelo. * <p> * Makelangelo is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * <p> * Makelangelo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * <p> * You should have received a copy of the GNU General Public License * along with Makelangelo. If not, see <http://www.gnu.org/licenses/>.
void function(Writer out) throws IOException { Filter_BlackAndWhite bw = new Filter_BlackAndWhite(255); TransformedImage img = bw.filter(sourceImage); imageStart(out); liftPen(out); machine.writeChangeTo(out); double toolDiameter = machine.getDiameter(); int i, j; final int steps = 4; double leveladd = 255.0 / 5.0f; double level; int z = 0; float maxr; convertToCorners=false; if (convertToCorners) { float h2 = (float)machine.getPaperHeight() * 10; float w2 = (float)machine.getPaperWidth() * 10; maxr = (float) (Math.sqrt(h2 * h2 + w2 * w2) + 1.0f); } else { float w = (float)machine.getPaperWidth()/2.0f; float h = (float)machine.getPaperHeight()/2.0f; maxr = (float)( h < w ? h : w ); maxr *= machine.getPaperMargin() * 10.0f; } float r = maxr, f; float fx, fy; int numRings = 0; double[] each_level = new double[steps]; each_level[0] = leveladd * 1; each_level[1] = leveladd * 3; each_level[2] = leveladd * 2; each_level[3] = leveladd * 4; j = 0; while (r > toolDiameter) { ++j; level = each_level[j % steps]; float circumference = (float) Math.floor((2.0f * r - toolDiameter) * Math.PI); if (circumference > 360.0f) circumference = 360.0f; for (i = 0; i <= circumference; ++i) { f = (float) Math.PI * 2.0f * (float)i / (float)circumference; fx = (float) (Math.cos(f) * r); fy = (float) (Math.sin(f) * r); if( isInsidePaperMargins(fx, fy) ) { try { z = img.sample3x3(fx, fy); } catch(Exception e) { e.printStackTrace(); } moveTo(out, fx, fy, (z >= level)); } else { moveTo(out, fx, fy, true); } } r -= toolDiameter; ++numRings; } Log.write(STR, numRings + STR); liftPen(out); moveTo(out, (float)machine.getHomeX(), (float)machine.getHomeY(),true); } } /** * This file is part of Makelangelo. * <p> * Makelangelo is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * <p> * Makelangelo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * <p> * You should have received a copy of the GNU General Public License * along with Makelangelo. If not, see <http:
/** * create a spiral across the image. raise and lower the pen to darken the appropriate areas * * @param img the image to convert. */
create a spiral across the image. raise and lower the pen to darken the appropriate areas
finish
{ "repo_name": "ar4k/RAM", "path": "modelli/progetti/plotter_a_corde/Makelangelo-software-master/java/src/main/java/com/marginallyclever/makelangeloRobot/converters/Converter_Spiral.java", "license": "agpl-3.0", "size": 3713 }
[ "com.marginallyclever.makelangelo.Log", "com.marginallyclever.makelangeloRobot.TransformedImage", "java.io.IOException", "java.io.Writer" ]
import com.marginallyclever.makelangelo.Log; import com.marginallyclever.makelangeloRobot.TransformedImage; import java.io.IOException; import java.io.Writer;
import com.marginallyclever.*; import com.marginallyclever.makelangelo.*; import java.io.*;
[ "com.marginallyclever", "com.marginallyclever.makelangelo", "java.io" ]
com.marginallyclever; com.marginallyclever.makelangelo; java.io;
2,818,915
Optional<List<Map<?, ?>>> getMapList(DataQuery path);
Optional<List<Map<?, ?>>> getMapList(DataQuery path);
/** * Gets the {@link List} of {@link Map} by path, if available. * * <p>If a {@link List} of {@link Map} does not exist, or the data * residing at the path is not an instance of a {@link List} of * {@link Map}, an absent is returned.</p> * * @param path The path of the value to get * @return The list of maps, if available */
Gets the <code>List</code> of <code>Map</code> by path, if available. If a <code>List</code> of <code>Map</code> does not exist, or the data residing at the path is not an instance of a <code>List</code> of <code>Map</code>, an absent is returned
getMapList
{ "repo_name": "kashike/SpongeAPI", "path": "src/main/java/org/spongepowered/api/data/DataView.java", "license": "mit", "size": 18470 }
[ "java.util.List", "java.util.Map", "java.util.Optional" ]
import java.util.List; import java.util.Map; import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
849,500