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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@JsonProperty("pathComponents") public List<PathComponent> getPathComponents() { return pathComponents; }
@JsonProperty(STR) List<PathComponent> function() { return pathComponents; }
/** * array of path components without slashes **/
array of path components without slashes
getPathComponents
{ "repo_name": "DFC-Incubator/base-service", "path": "base-service-impl/src/main/java/org/irods/jargon/rest/base/model/CollectionInfo.java", "license": "bsd-2-clause", "size": 8755 }
[ "com.fasterxml.jackson.annotation.JsonProperty", "java.util.List", "org.irods.jargon.rest.base.model.PathComponent" ]
import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import org.irods.jargon.rest.base.model.PathComponent;
import com.fasterxml.jackson.annotation.*; import java.util.*; import org.irods.jargon.rest.base.model.*;
[ "com.fasterxml.jackson", "java.util", "org.irods.jargon" ]
com.fasterxml.jackson; java.util; org.irods.jargon;
611,635
public Collection<TomcatProtocolHandlerCustomizer<?>> getTomcatProtocolHandlerCustomizers() { return this.tomcatProtocolHandlerCustomizers; }
Collection<TomcatProtocolHandlerCustomizer<?>> function() { return this.tomcatProtocolHandlerCustomizers; }
/** * Returns a mutable collection of the {@link TomcatProtocolHandlerCustomizer}s that * will be applied to the Tomcat {@link Connector}. * @return the customizers that will be applied * @since 2.2.0 */
Returns a mutable collection of the <code>TomcatProtocolHandlerCustomizer</code>s that will be applied to the Tomcat <code>Connector</code>
getTomcatProtocolHandlerCustomizers
{ "repo_name": "yangdd1205/spring-boot", "path": "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java", "license": "mit", "size": 30478 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
817,300
List<Change> findChanges(Object identifier, Class<T> clazz, String author, LocalDate fromDate, LocalDate toDate, int version, int skip, String branch);
List<Change> findChanges(Object identifier, Class<T> clazz, String author, LocalDate fromDate, LocalDate toDate, int version, int skip, String branch);
/** * Find changes list. * * @param identifier the identifier * @param clazz the clazz * @param author the author * @param fromDate the from date * @param toDate the to date * @param version the version * @param skip the skip * @param branch the branch * @return the list */
Find changes list
findChanges
{ "repo_name": "Unicon/cas", "path": "support/cas-server-support-changelog/src/main/java/org/apereo/cas/ObjectChangelog.java", "license": "apache-2.0", "size": 8691 }
[ "java.time.LocalDate", "java.util.List", "org.javers.core.diff.Change" ]
import java.time.LocalDate; import java.util.List; import org.javers.core.diff.Change;
import java.time.*; import java.util.*; import org.javers.core.diff.*;
[ "java.time", "java.util", "org.javers.core" ]
java.time; java.util; org.javers.core;
1,718,450
protected CookieUtils getCookieUtils() { if (cookieUtils == null) { cookieUtils = new CookieUtils(); } return cookieUtils; }
CookieUtils function() { if (cookieUtils == null) { cookieUtils = new CookieUtils(); } return cookieUtils; }
/** * Make sure you always return a valid CookieUtils * * @return CookieUtils */
Make sure you always return a valid CookieUtils
getCookieUtils
{ "repo_name": "afiantara/apache-wicket-1.5.7", "path": "src/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java", "license": "apache-2.0", "size": 4332 }
[ "org.apache.wicket.util.cookies.CookieUtils" ]
import org.apache.wicket.util.cookies.CookieUtils;
import org.apache.wicket.util.cookies.*;
[ "org.apache.wicket" ]
org.apache.wicket;
1,707,011
private int computeWidthHint() { int maxCommandStringWidth = 200; GC gc = new GC(commandHistoryTableViewer.getTable()); for (int index = 0; index < commandHistory.getSize(shellFacade.getShellDescriptor().getId()); index++) { String command = commandHistory.getCommand(index, shellFacade.getShellDescriptor().getId()); FontMetrics metrics = gc.getFontMetrics(); int commandStringWidth = metrics.getAverageCharWidth() * command.length(); maxCommandStringWidth = Math.max((commandStringWidth + 50), maxCommandStringWidth); } return maxCommandStringWidth; }
int function() { int maxCommandStringWidth = 200; GC gc = new GC(commandHistoryTableViewer.getTable()); for (int index = 0; index < commandHistory.getSize(shellFacade.getShellDescriptor().getId()); index++) { String command = commandHistory.getCommand(index, shellFacade.getShellDescriptor().getId()); FontMetrics metrics = gc.getFontMetrics(); int commandStringWidth = metrics.getAverageCharWidth() * command.length(); maxCommandStringWidth = Math.max((commandStringWidth + 50), maxCommandStringWidth); } return maxCommandStringWidth; }
/** * Computes the width hint for the <code>ListViewer</code> using the * width of the widest command which is present in the * <code>CommandHistory</code>. * * @return the computed width hint */
Computes the width hint for the <code>ListViewer</code> using the width of the widest command which is present in the <code>CommandHistory</code>
computeWidthHint
{ "repo_name": "stefanreichert/wickedshell", "path": "net.sf.wickedshell/src/net/sf/wickedshell/ui/shell/viewer/text/TextShellViewer.java", "license": "epl-1.0", "size": 22825 }
[ "org.eclipse.swt.graphics.FontMetrics" ]
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
277,403
public List<String> getTokenStrings() { if (strTokens == null) { // lazy initialization strTokens = Lists.newArrayListWithCapacity(tokens.size()); for (Token token : tokens) { strTokens.add(token.getTerm().toString()); } } return strTokens; }
List<String> function() { if (strTokens == null) { strTokens = Lists.newArrayListWithCapacity(tokens.size()); for (Token token : tokens) { strTokens.add(token.getTerm().toString()); } } return strTokens; }
/** * Returns all tokens as String. * * @return a list of tokens as String objects */
Returns all tokens as String
getTokenStrings
{ "repo_name": "foursquare/commons-old", "path": "src/java/com/twitter/common/text/token/TokenizedCharSequence.java", "license": "apache-2.0", "size": 8501 }
[ "com.google.common.collect.Lists", "java.util.List" ]
import com.google.common.collect.Lists; import java.util.List;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,387,313
public ConfigFinderBuilder systemPropertiesPrefixes(List<String> prefixes) { this.systemPropertiesPrefixes = prefixes; return this; }
ConfigFinderBuilder function(List<String> prefixes) { this.systemPropertiesPrefixes = prefixes; return this; }
/** * The allowed prefixes a system property can have * to be used as a configuration. * <p> * Those prefixes will be stripped to produce the configuration * keys! * <p> * Multiple prefixes are allowed so you can have configurations * specific to an application, but also configurations common to * multiple applications on the same server. */
The allowed prefixes a system property can have to be used as a configuration. Those prefixes will be stripped to produce the configuration keys! Multiple prefixes are allowed so you can have configurations specific to an application, but also configurations common to multiple applications on the same server
systemPropertiesPrefixes
{ "repo_name": "spincast/spincast-framework", "path": "spincast-plugins/spincast-plugins-config-parent/spincast-plugins-config/src/main/java/org/spincast/plugins/config/ConfigFinder.java", "license": "apache-2.0", "size": 49945 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,861,149
OperationTransformer.TransformedOperation transformOperation(OperationContext context, ModelNode operation) throws OperationFailedException;
OperationTransformer.TransformedOperation transformOperation(OperationContext context, ModelNode operation) throws OperationFailedException;
/** * Transform the operation. * * @param context the operation context * @param operation the operation to transform. * @return the transformed operation * @throws OperationFailedException */
Transform the operation
transformOperation
{ "repo_name": "jamezp/wildfly-core", "path": "controller/src/main/java/org/jboss/as/controller/TransformingProxyController.java", "license": "lgpl-2.1", "size": 10592 }
[ "org.jboss.as.controller.transform.OperationTransformer", "org.jboss.dmr.ModelNode" ]
import org.jboss.as.controller.transform.OperationTransformer; import org.jboss.dmr.ModelNode;
import org.jboss.as.controller.transform.*; import org.jboss.dmr.*;
[ "org.jboss.as", "org.jboss.dmr" ]
org.jboss.as; org.jboss.dmr;
140,079
@Override public List<IAcceleoTextGenerationListener> getGenerationListeners() { List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners(); return listeners; }
List<IAcceleoTextGenerationListener> function() { List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners(); return listeners; }
/** * If this generator needs to listen to text generation events, listeners can be returned from here. * * @return List of listeners that are to be notified when text is generated through this launch. * @generated */
If this generator needs to listen to text generation events, listeners can be returned from here
getGenerationListeners
{ "repo_name": "RobotML/RobotML-SDK-Juno", "path": "plugins/generators/RTMaps/org.eclipse.robotml.generators.acceleo.rtmaps/src/org/eclipse/papyrus/robotml/generators/intempora/rtmaps/Generate_rtmaps.java", "license": "epl-1.0", "size": 18705 }
[ "java.util.List", "org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener" ]
import java.util.List; import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
import java.util.*; import org.eclipse.acceleo.engine.event.*;
[ "java.util", "org.eclipse.acceleo" ]
java.util; org.eclipse.acceleo;
2,773,440
public void logout(Activity frontActivity) { logout(frontActivity, true); }
void function(Activity frontActivity) { logout(frontActivity, true); }
/** * Wipes out the stored authentication credentials (removes the account) * and restarts the app, if specified. * * @param frontActivity Front activity. */
Wipes out the stored authentication credentials (removes the account) and restarts the app, if specified
logout
{ "repo_name": "seethaa/force_analytics_example", "path": "native/SalesforceSDK/src/com/salesforce/androidsdk/app/SalesforceSDKManager.java", "license": "apache-2.0", "size": 38136 }
[ "android.app.Activity" ]
import android.app.Activity;
import android.app.*;
[ "android.app" ]
android.app;
244,330
public synchronized Shape createTransformedShape(AffineTransform at) { return path.createTransformedShape(at); }
synchronized Shape function(AffineTransform at) { return path.createTransformedShape(at); }
/** * Delegates to the enclosed <code>GeneralPath</code>. */
Delegates to the enclosed <code>GeneralPath</code>
createTransformedShape
{ "repo_name": "sflyphotobooks/crp-batik", "path": "sources/org/apache/batik/ext/awt/geom/ExtendedGeneralPath.java", "license": "apache-2.0", "size": 24105 }
[ "java.awt.Shape", "java.awt.geom.AffineTransform" ]
import java.awt.Shape; import java.awt.geom.AffineTransform;
import java.awt.*; import java.awt.geom.*;
[ "java.awt" ]
java.awt;
2,410,484
public static java.util.List extractElectiveListConfigurationList(ims.domain.ILightweightDomainFactory domainFactory, ims.careuk.vo.PatientElectiveListConfigForReferralDetailsVoCollection voCollection) { return extractElectiveListConfigurationList(domainFactory, voCollection, null, new HashMap()); }
static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.careuk.vo.PatientElectiveListConfigForReferralDetailsVoCollection voCollection) { return extractElectiveListConfigurationList(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.core.configuration.domain.objects.ElectiveListConfiguration list from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.core.configuration.domain.objects.ElectiveListConfiguration list from the value object collection
extractElectiveListConfigurationList
{ "repo_name": "open-health-hub/openmaxims-linux", "path": "openmaxims_workspace/ValueObjects/src/ims/careuk/vo/domain/PatientElectiveListConfigForReferralDetailsVoAssembler.java", "license": "agpl-3.0", "size": 18349 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,462,923
public void connect(IProject project) throws CoreException { ConnectProviderOperation op = new ConnectProviderOperation(project, this.getRepository().getDirectory()); op.execute(null); }
void function(IProject project) throws CoreException { ConnectProviderOperation op = new ConnectProviderOperation(project, this.getRepository().getDirectory()); op.execute(null); }
/** * Connect a project to this repository * * @param project * @throws CoreException */
Connect a project to this repository
connect
{ "repo_name": "chalstrick/egit", "path": "org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java", "license": "epl-1.0", "size": 14342 }
[ "org.eclipse.core.resources.IProject", "org.eclipse.core.runtime.CoreException", "org.eclipse.egit.core.op.ConnectProviderOperation" ]
import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.egit.core.op.ConnectProviderOperation;
import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.egit.core.op.*;
[ "org.eclipse.core", "org.eclipse.egit" ]
org.eclipse.core; org.eclipse.egit;
2,597,060
public UtilSSLSocketFactory trustAllCertificates() { if (trustingAllCertificates) //Already doing this, no need to do it again return this; trustingAllCertificates = true; try { TrustManager[] tm = new TrustManager[]{new TrustingX509TrustManager()}; SSLContext context = SSLContext.getInstance("SSL"); context.init(new KeyManager[0], tm, new SecureRandom()); wrappedFactory = context.getSocketFactory(); } catch (Exception e) { throw new RuntimeException("Can't recreate socket factory that trusts all certificates", e); } return this; }
UtilSSLSocketFactory function() { if (trustingAllCertificates) return this; trustingAllCertificates = true; try { TrustManager[] tm = new TrustManager[]{new TrustingX509TrustManager()}; SSLContext context = SSLContext.getInstance("SSL"); context.init(new KeyManager[0], tm, new SecureRandom()); wrappedFactory = context.getSocketFactory(); } catch (Exception e) { throw new RuntimeException(STR, e); } return this; }
/** * By default, trust ALL certificates. <b>This is very insecure.</b> It also * defeats one of the points of SSL: Making sure your connecting to the right * server. * @return The current UtilSSLSocketFactory instance */
By default, trust ALL certificates. This is very insecure. It also server
trustAllCertificates
{ "repo_name": "AnyBot/AnyBot-Lib", "path": "src/org/pircbotx/UtilSSLSocketFactory.java", "license": "gpl-3.0", "size": 7114 }
[ "java.security.SecureRandom", "javax.net.ssl.KeyManager", "javax.net.ssl.SSLContext", "javax.net.ssl.TrustManager" ]
import java.security.SecureRandom; import javax.net.ssl.KeyManager; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager;
import java.security.*; import javax.net.ssl.*;
[ "java.security", "javax.net" ]
java.security; javax.net;
478,191
private void extractSourceFromSoapHeader(Map<String, Object> headers, WebServiceMessage request) { if (request instanceof SoapMessage) { SoapMessage soapMessage = (SoapMessage) request; SoapHeader soapHeader = soapMessage.getSoapHeader(); if (soapHeader != null) { //Set the raw soap header as a header in the exchange. headers.put(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER, soapHeader.getSource()); //Set header values for the soap header attributes Iterator<QName> attIter = soapHeader.getAllAttributes(); while (attIter.hasNext()) { QName name = attIter.next(); headers.put(name.getLocalPart(), soapHeader.getAttributeValue(name)); } //Set header values for the soap header elements Iterator<SoapHeaderElement> elementIter = soapHeader.examineAllHeaderElements(); while (elementIter.hasNext()) { SoapHeaderElement element = elementIter.next(); QName name = element.getName(); headers.put(name.getLocalPart(), element); } } } }
void function(Map<String, Object> headers, WebServiceMessage request) { if (request instanceof SoapMessage) { SoapMessage soapMessage = (SoapMessage) request; SoapHeader soapHeader = soapMessage.getSoapHeader(); if (soapHeader != null) { headers.put(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER, soapHeader.getSource()); Iterator<QName> attIter = soapHeader.getAllAttributes(); while (attIter.hasNext()) { QName name = attIter.next(); headers.put(name.getLocalPart(), soapHeader.getAttributeValue(name)); } Iterator<SoapHeaderElement> elementIter = soapHeader.examineAllHeaderElements(); while (elementIter.hasNext()) { SoapHeaderElement element = elementIter.next(); QName name = element.getName(); headers.put(name.getLocalPart(), element); } } } }
/** * Extracts the SOAP headers and set them as headers in the Exchange. Also sets it as a header with the key * SpringWebserviceConstants.SPRING_WS_SOAP_HEADER and a value of type Source. * * @param headers the Exchange Headers * @param request the WebService Request */
Extracts the SOAP headers and set them as headers in the Exchange. Also sets it as a header with the key SpringWebserviceConstants.SPRING_WS_SOAP_HEADER and a value of type Source
extractSourceFromSoapHeader
{ "repo_name": "nikhilvibhav/camel", "path": "components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java", "license": "apache-2.0", "size": 10031 }
[ "java.util.Iterator", "java.util.Map", "javax.xml.namespace.QName", "org.springframework.ws.WebServiceMessage", "org.springframework.ws.soap.SoapHeader", "org.springframework.ws.soap.SoapHeaderElement", "org.springframework.ws.soap.SoapMessage" ]
import java.util.Iterator; import java.util.Map; import javax.xml.namespace.QName; import org.springframework.ws.WebServiceMessage; import org.springframework.ws.soap.SoapHeader; import org.springframework.ws.soap.SoapHeaderElement; import org.springframework.ws.soap.SoapMessage;
import java.util.*; import javax.xml.namespace.*; import org.springframework.ws.*; import org.springframework.ws.soap.*;
[ "java.util", "javax.xml", "org.springframework.ws" ]
java.util; javax.xml; org.springframework.ws;
2,749,268
private void useRegistryForConfigIfNecessary() { registries.stream().filter(RegistryConfig::isZookeeperProtocol).findFirst().ifPresent(rc -> { // we use the loading status of DynamicConfiguration to decide whether ConfigCenter has been initiated. Environment.getInstance().getDynamicConfiguration().orElseGet(() -> { ConfigManager configManager = ConfigManager.getInstance(); ConfigCenterConfig cc = configManager.getConfigCenter().orElse(new ConfigCenterConfig()); cc.setProtocol(rc.getProtocol()); cc.setAddress(rc.getAddress()); cc.setHighestPriority(false); setConfigCenter(cc); startConfigCenter(); return null; }); }); }
void function() { registries.stream().filter(RegistryConfig::isZookeeperProtocol).findFirst().ifPresent(rc -> { Environment.getInstance().getDynamicConfiguration().orElseGet(() -> { ConfigManager configManager = ConfigManager.getInstance(); ConfigCenterConfig cc = configManager.getConfigCenter().orElse(new ConfigCenterConfig()); cc.setProtocol(rc.getProtocol()); cc.setAddress(rc.getAddress()); cc.setHighestPriority(false); setConfigCenter(cc); startConfigCenter(); return null; }); }); }
/** * For compatibility purpose, use registry as the default config center if the registry protocol is zookeeper and * there's no config center specified explicitly. */
For compatibility purpose, use registry as the default config center if the registry protocol is zookeeper and there's no config center specified explicitly
useRegistryForConfigIfNecessary
{ "repo_name": "alibaba/dubbo", "path": "dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java", "license": "apache-2.0", "size": 31016 }
[ "org.apache.dubbo.common.config.Environment", "org.apache.dubbo.config.context.ConfigManager" ]
import org.apache.dubbo.common.config.Environment; import org.apache.dubbo.config.context.ConfigManager;
import org.apache.dubbo.common.config.*; import org.apache.dubbo.config.context.*;
[ "org.apache.dubbo" ]
org.apache.dubbo;
609,010
public int getPaintType() { return getCOSObject().getInt(COSName.PAINT_TYPE, 0); }
int function() { return getCOSObject().getInt(COSName.PAINT_TYPE, 0); }
/** * This will return the paint type. * * @return The paint type */
This will return the paint type
getPaintType
{ "repo_name": "torakiki/sambox", "path": "src/main/java/org/sejda/sambox/pdmodel/graphics/pattern/PDTilingPattern.java", "license": "apache-2.0", "size": 6345 }
[ "org.sejda.sambox.cos.COSName" ]
import org.sejda.sambox.cos.COSName;
import org.sejda.sambox.cos.*;
[ "org.sejda.sambox" ]
org.sejda.sambox;
276,013
public DatasetProcessedMolecule read(int molecule) { SqlSession session = sqlSessionFactory.openSession(); try { DatasetProcessedMolecule filter = new DatasetProcessedMolecule(); filter.setMolecule(molecule); DatasetProcessedMolecule result = (DatasetProcessedMolecule) session.selectOne("DatasetProcessedMolecules.selectOne", filter); return result; } finally { session.close(); } }
DatasetProcessedMolecule function(int molecule) { SqlSession session = sqlSessionFactory.openSession(); try { DatasetProcessedMolecule filter = new DatasetProcessedMolecule(); filter.setMolecule(molecule); DatasetProcessedMolecule result = (DatasetProcessedMolecule) session.selectOne(STR, filter); return result; } finally { session.close(); } }
/** * Returns the dataset_clean_molecules row that matches the PK * @param molecule Id of the molecule * @return */
Returns the dataset_clean_molecules row that matches the PK
read
{ "repo_name": "qsardw/qsardw-backend", "path": "datamodel/src/main/java/org/qsardw/datamodel/dao/DatasetProcessedMoleculesDAO.java", "license": "bsd-3-clause", "size": 5431 }
[ "org.apache.ibatis.session.SqlSession", "org.qsardw.datamodel.beans.DatasetProcessedMolecule" ]
import org.apache.ibatis.session.SqlSession; import org.qsardw.datamodel.beans.DatasetProcessedMolecule;
import org.apache.ibatis.session.*; import org.qsardw.datamodel.beans.*;
[ "org.apache.ibatis", "org.qsardw.datamodel" ]
org.apache.ibatis; org.qsardw.datamodel;
360,679
public Document getRequestDom() { return this.requestDom; }
Document function() { return this.requestDom; }
/** * Gets the XML request document. * @return the XML request document (can be null) */
Gets the XML request document
getRequestDom
{ "repo_name": "mhogeweg/OpenLS", "path": "src/com/esri/gpt/server/openls/provider/components/RequestOptions.java", "license": "apache-2.0", "size": 5572 }
[ "org.w3c.dom.Document" ]
import org.w3c.dom.Document;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,047,409
public LockFeature parse( String id ) throws XMLParsingException, InvalidParameterValueException { checkServiceAttribute(); String version = checkVersionAttribute(); Element root = this.getRootElement(); String handle = XMLTools.getNodeAsString( root, "@handle", nsContext, null ); long expiry = parseExpiry( root ); String lockActionString = XMLTools.getNodeAsString( root, "@lockAction", nsContext, "ALL" ); ALL_SOME_TYPE lockAction = ALL_SOME_TYPE.ALL; try { lockAction = LockFeature.validateLockAction( lockActionString ); } catch ( InvalidParameterValueException e ) { throw new XMLParsingException( e.getMessage() ); } List<Element> lockElements = XMLTools.getRequiredElements( root, "wfs:Lock", nsContext ); List<Lock> locks = new ArrayList<Lock>( lockElements.size() ); for ( Element lockElement : lockElements ) { locks.add( parseLock( lockElement ) ); } return new LockFeature( version, id, handle, expiry, lockAction, locks ); }
LockFeature function( String id ) throws XMLParsingException, InvalidParameterValueException { checkServiceAttribute(); String version = checkVersionAttribute(); Element root = this.getRootElement(); String handle = XMLTools.getNodeAsString( root, STR, nsContext, null ); long expiry = parseExpiry( root ); String lockActionString = XMLTools.getNodeAsString( root, STR, nsContext, "ALL" ); ALL_SOME_TYPE lockAction = ALL_SOME_TYPE.ALL; try { lockAction = LockFeature.validateLockAction( lockActionString ); } catch ( InvalidParameterValueException e ) { throw new XMLParsingException( e.getMessage() ); } List<Element> lockElements = XMLTools.getRequiredElements( root, STR, nsContext ); List<Lock> locks = new ArrayList<Lock>( lockElements.size() ); for ( Element lockElement : lockElements ) { locks.add( parseLock( lockElement ) ); } return new LockFeature( version, id, handle, expiry, lockAction, locks ); }
/** * Parses the underlying "wfs:LockFeature" document into a {@link LockFeature} object. * * @param id * @return corresponding <code>LockFeature</code> object * @throws XMLParsingException * @throws InvalidParameterValueException */
Parses the underlying "wfs:LockFeature" document into a <code>LockFeature</code> object
parse
{ "repo_name": "lat-lon/deegree2-base", "path": "deegree2-core/src/main/java/org/deegree/ogcwebservices/wfs/operation/LockFeatureDocument.java", "license": "lgpl-2.1", "size": 6756 }
[ "java.util.ArrayList", "java.util.List", "org.deegree.framework.xml.XMLParsingException", "org.deegree.framework.xml.XMLTools", "org.deegree.ogcwebservices.InvalidParameterValueException", "org.w3c.dom.Element" ]
import java.util.ArrayList; import java.util.List; import org.deegree.framework.xml.XMLParsingException; import org.deegree.framework.xml.XMLTools; import org.deegree.ogcwebservices.InvalidParameterValueException; import org.w3c.dom.Element;
import java.util.*; import org.deegree.framework.xml.*; import org.deegree.ogcwebservices.*; import org.w3c.dom.*;
[ "java.util", "org.deegree.framework", "org.deegree.ogcwebservices", "org.w3c.dom" ]
java.util; org.deegree.framework; org.deegree.ogcwebservices; org.w3c.dom;
1,191,435
public static String toHTML(String string) { String str = string; str = str.replaceAll(">", "&gt;"); str = str.replaceAll("<", "&lt;"); str = str.replaceAll(Tools.getLineSeparator(), "<br>"); return str; }
static String function(String string) { String str = string; str = str.replaceAll(">", "&gt;"); str = str.replaceAll("<", "&lt;"); str = str.replaceAll(Tools.getLineSeparator(), "<br>"); return str; }
/** * Encodes the given String as HTML. Only linebreaks and less then and greater than will be * encoded. */
Encodes the given String as HTML. Only linebreaks and less then and greater than will be encoded
toHTML
{ "repo_name": "transwarpio/rapidminer", "path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/operator/ResultObjectAdapter.java", "license": "gpl-3.0", "size": 4487 }
[ "com.rapidminer.tools.Tools" ]
import com.rapidminer.tools.Tools;
import com.rapidminer.tools.*;
[ "com.rapidminer.tools" ]
com.rapidminer.tools;
2,187,456
InputStream getInputStream(long pos) { return new LOBInputStream(this, pos); }
InputStream getInputStream(long pos) { return new LOBInputStream(this, pos); }
/** * returns input stream linked with this object. * @param pos initial postion * @return InputStream */
returns input stream linked with this object
getInputStream
{ "repo_name": "papicella/snappy-store", "path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/jdbc/LOBStreamControl.java", "license": "apache-2.0", "size": 22128 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,870,606
boolean matches(HintsMap map);
boolean matches(HintsMap map);
/** * Returns true if the specified weighting and encoder matches to this Weighting. */
Returns true if the specified weighting and encoder matches to this Weighting
matches
{ "repo_name": "komoot/graphhopper", "path": "core/src/main/java/com/graphhopper/routing/weighting/Weighting.java", "license": "apache-2.0", "size": 3119 }
[ "com.graphhopper.routing.util.HintsMap" ]
import com.graphhopper.routing.util.HintsMap;
import com.graphhopper.routing.util.*;
[ "com.graphhopper.routing" ]
com.graphhopper.routing;
1,758,365
private void processResources() throws SQLException { for (ResultSetRow row : getRows("SELECT * FROM MSP_RESOURCES WHERE PROJ_ID=?", m_projectID)) { processResource(row); } }
void function() throws SQLException { for (ResultSetRow row : getRows(STR, m_projectID)) { processResource(row); } }
/** * Process resources. * * @throws SQLException */
Process resources
processResources
{ "repo_name": "srnsw/xena", "path": "plugins/project/ext/src/mpxj/src/net/sf/mpxj/mpd/MPD9DatabaseReader.java", "license": "gpl-3.0", "size": 15141 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,875,873
public boolean updateAppServices(@NonNull List<AppServiceCapability> updatedAppServiceCapabilities){ if(updatedAppServiceCapabilities == null){ return false; } List<AppServiceCapability> appServiceCapabilities = getAppServices(); if(appServiceCapabilities == null){ //If there are currently no app services, create one to iterate over with no entries appServiceCapabilities = new ArrayList<>(0); } //Create a shallow copy for us to alter while iterating through the original list List<AppServiceCapability> tempList = new ArrayList<>(appServiceCapabilities); for(AppServiceCapability updatedAppServiceCapability: updatedAppServiceCapabilities){ if(updatedAppServiceCapability != null) { //First search if the record exists in the current list and remove it if so for (AppServiceCapability appServiceCapability : appServiceCapabilities) { if (updatedAppServiceCapability.matchesAppService(appServiceCapability)) { tempList.remove(appServiceCapability); //Remove the old entry break; } } if(!ServiceUpdateReason.REMOVED.equals(updatedAppServiceCapability.getUpdateReason())){ //If the app service was anything but removed, we can add the updated //record back into the temp list. If it was REMOVED as the update reason //it will not be added back. tempList.add(updatedAppServiceCapability); } } } setAppServices(tempList); return !tempList.equals(appServiceCapabilities); //Return if the list is not equal to the original }
boolean function(@NonNull List<AppServiceCapability> updatedAppServiceCapabilities){ if(updatedAppServiceCapabilities == null){ return false; } List<AppServiceCapability> appServiceCapabilities = getAppServices(); if(appServiceCapabilities == null){ appServiceCapabilities = new ArrayList<>(0); } List<AppServiceCapability> tempList = new ArrayList<>(appServiceCapabilities); for(AppServiceCapability updatedAppServiceCapability: updatedAppServiceCapabilities){ if(updatedAppServiceCapability != null) { for (AppServiceCapability appServiceCapability : appServiceCapabilities) { if (updatedAppServiceCapability.matchesAppService(appServiceCapability)) { tempList.remove(appServiceCapability); break; } } if(!ServiceUpdateReason.REMOVED.equals(updatedAppServiceCapability.getUpdateReason())){ tempList.add(updatedAppServiceCapability); } } } setAppServices(tempList); return !tempList.equals(appServiceCapabilities); }
/** * This method will update the current List<AppServiceCapability> with the updated items. If the * items don't exist in the original ist they will be added. If the original list is null or * empty, the new list will simply be set as the list. * @param updatedAppServiceCapabilities the List<AppServiceCapability> that have been updated * @return if the list was updated */
This method will update the current List with the updated items. If the items don't exist in the original ist they will be added. If the original list is null or empty, the new list will simply be set as the list
updateAppServices
{ "repo_name": "anildahiya/sdl_android", "path": "base/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java", "license": "bsd-3-clause", "size": 5112 }
[ "android.support.annotation.NonNull", "com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason", "java.util.ArrayList", "java.util.List" ]
import android.support.annotation.NonNull; import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason; import java.util.ArrayList; import java.util.List;
import android.support.annotation.*; import com.smartdevicelink.proxy.rpc.enums.*; import java.util.*;
[ "android.support", "com.smartdevicelink.proxy", "java.util" ]
android.support; com.smartdevicelink.proxy; java.util;
1,861,280
public GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) { LOGGER.debug("Getting stats for: " + cmd.getStorageId()); try { Linux host = new Linux(c); Linux.FileSystem fs = host.getFileSystemByUuid(cmd.getStorageId(), "nfs"); StoragePlugin store = new StoragePlugin(c); String propUuid = store.deDash(cmd.getStorageId()); String mntUuid = cmd.getStorageId(); if (store == null || propUuid == null || mntUuid == null || fs == null) { String msg = "Null returned when retrieving stats for " + cmd.getStorageId(); LOGGER.error(msg); return new GetStorageStatsAnswer(cmd, msg); } StorageDetails sd = store.storagePluginGetFileSystemInfo(propUuid, mntUuid, fs.getHost(), fs.getDevice()); if ("".equals(sd.getSize())) { String msg = "No size when retrieving stats for " + cmd.getStorageId(); LOGGER.debug(msg); return new GetStorageStatsAnswer(cmd, msg); } long total = Long.parseLong(sd.getSize()); long used = total - Long.parseLong(sd.getFreeSize()); return new GetStorageStatsAnswer(cmd, total, used); } catch (Ovm3ResourceException e) { LOGGER.debug("GetStorageStatsCommand for " + cmd.getStorageId() + " failed", e); return new GetStorageStatsAnswer(cmd, e.getMessage()); } }
GetStorageStatsAnswer function(final GetStorageStatsCommand cmd) { LOGGER.debug(STR + cmd.getStorageId()); try { Linux host = new Linux(c); Linux.FileSystem fs = host.getFileSystemByUuid(cmd.getStorageId(), "nfs"); StoragePlugin store = new StoragePlugin(c); String propUuid = store.deDash(cmd.getStorageId()); String mntUuid = cmd.getStorageId(); if (store == null propUuid == null mntUuid == null fs == null) { String msg = STR + cmd.getStorageId(); LOGGER.error(msg); return new GetStorageStatsAnswer(cmd, msg); } StorageDetails sd = store.storagePluginGetFileSystemInfo(propUuid, mntUuid, fs.getHost(), fs.getDevice()); if (STRNo size when retrieving stats for STRGetStorageStatsCommand for STR failed", e); return new GetStorageStatsAnswer(cmd, e.getMessage()); } }
/** * Gets statistics for storage. * * @param cmd * @return */
Gets statistics for storage
execute
{ "repo_name": "ikoula/cloudstack", "path": "plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/helpers/Ovm3StoragePool.java", "license": "gpl-2.0", "size": 30133 }
[ "com.cloud.agent.api.GetStorageStatsAnswer", "com.cloud.agent.api.GetStorageStatsCommand", "com.cloud.hypervisor.ovm3.objects.Linux", "com.cloud.hypervisor.ovm3.objects.StoragePlugin" ]
import com.cloud.agent.api.GetStorageStatsAnswer; import com.cloud.agent.api.GetStorageStatsCommand; import com.cloud.hypervisor.ovm3.objects.Linux; import com.cloud.hypervisor.ovm3.objects.StoragePlugin;
import com.cloud.agent.api.*; import com.cloud.hypervisor.ovm3.objects.*;
[ "com.cloud.agent", "com.cloud.hypervisor" ]
com.cloud.agent; com.cloud.hypervisor;
406,995
public CopyOnWriteArrayList<Frame> getFrames() { try { return this.oldFrames; } catch (Exception e) { System.err.println("Can not return list of last frames. Returning empty list instead."); System.err.println(e); return new CopyOnWriteArrayList<Frame>(); } }
CopyOnWriteArrayList<Frame> function() { try { return this.oldFrames; } catch (Exception e) { System.err.println(STR); System.err.println(e); return new CopyOnWriteArrayList<Frame>(); } }
/** * returns a CopyOnWriteArrayList<Frame> containing all recently buffered frames. * * @return a CopyOnWriteArrayList containing the newest elements */
returns a CopyOnWriteArrayList containing all recently buffered frames
getFrames
{ "repo_name": "manorius/Processing", "path": "libraries/LeapMotionP5/src/com/onformative/leap/LeapMotionP5.java", "license": "mit", "size": 31364 }
[ "com.leapmotion.leap.Frame", "java.util.concurrent.CopyOnWriteArrayList" ]
import com.leapmotion.leap.Frame; import java.util.concurrent.CopyOnWriteArrayList;
import com.leapmotion.leap.*; import java.util.concurrent.*;
[ "com.leapmotion.leap", "java.util" ]
com.leapmotion.leap; java.util;
2,183,940
OptionalLong getMaxColumnLength();
OptionalLong getMaxColumnLength();
/** * Gets the maximum data length of the column if provided. * @return an optional that is empty if no maximum length was provided. */
Gets the maximum data length of the column if provided
getMaxColumnLength
{ "repo_name": "spring-cloud/spring-cloud-gcp", "path": "spring-cloud-gcp-data-spanner/src/main/java/org/springframework/cloud/gcp/data/spanner/core/mapping/SpannerPersistentProperty.java", "license": "apache-2.0", "size": 4443 }
[ "java.util.OptionalLong" ]
import java.util.OptionalLong;
import java.util.*;
[ "java.util" ]
java.util;
1,837,653
public static String[] tokenizeUnquoted(String s) { List tokens = new LinkedList(); int first = 0; while (first < s.length()) { first = skipWhitespace(s, first); int last = scanToken(s, first); if (first < last) { tokens.add(s.substring(first, last)); } first = last; } return (String[])tokens.toArray(new String[tokens.size()]); }
static String[] function(String s) { List tokens = new LinkedList(); int first = 0; while (first < s.length()) { first = skipWhitespace(s, first); int last = scanToken(s, first); if (first < last) { tokens.add(s.substring(first, last)); } first = last; } return (String[])tokens.toArray(new String[tokens.size()]); }
/** * This method tokenizes a string by space characters, * but ignores spaces in quoted parts,that are parts in * '' or "". The method does allows the usage of "" in '' * and '' in "". The space character between tokens is not * returned. * * @param s the string to tokenize * @return the tokens */
This method tokenizes a string by space characters, but ignores spaces in quoted parts,that are parts in '' or "". The method does allows the usage of "" in '' and '' in "". The space character between tokens is not returned
tokenizeUnquoted
{ "repo_name": "antoaravinth/incubator-groovy", "path": "src/main/org/codehaus/groovy/tools/StringHelper.java", "license": "apache-2.0", "size": 2863 }
[ "java.util.LinkedList", "java.util.List" ]
import java.util.LinkedList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
180,916
@PUT @Path("ddl/database/{db}/table/{table}/column/{column}") @Produces(MediaType.APPLICATION_JSON) public Response addOneColumn(@PathParam("db") String db, @PathParam("table") String table, @PathParam("column") String column, ColumnDesc desc) throws HcatException, NotAuthorizedException, BusyException, BadParam, ExecuteException, IOException { verifyUser(); verifyDdlParam(db, ":db"); verifyDdlParam(table, ":table"); verifyParam(column, ":column"); verifyParam(desc.type, "type"); desc.name = column; HcatDelegator d = new HcatDelegator(appConf, execService); return d.addOneColumn(getDoAsUser(), db, table, desc); }
@Path(STR) @Produces(MediaType.APPLICATION_JSON) Response function(@PathParam("db") String db, @PathParam("table") String table, @PathParam(STR) String column, ColumnDesc desc) throws HcatException, NotAuthorizedException, BusyException, BadParam, ExecuteException, IOException { verifyUser(); verifyDdlParam(db, ":db"); verifyDdlParam(table, STR); verifyParam(column, STR); verifyParam(desc.type, "type"); desc.name = column; HcatDelegator d = new HcatDelegator(appConf, execService); return d.addOneColumn(getDoAsUser(), db, table, desc); }
/** * Create a column in an hcat table. */
Create a column in an hcat table
addOneColumn
{ "repo_name": "vergilchiu/hive", "path": "hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java", "license": "apache-2.0", "size": 44278 }
[ "java.io.IOException", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.apache.commons.exec.ExecuteException" ]
import java.io.IOException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.commons.exec.ExecuteException;
import java.io.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.commons.exec.*;
[ "java.io", "javax.ws", "org.apache.commons" ]
java.io; javax.ws; org.apache.commons;
2,015,528
public Contacts setCertificateContacts(String vaultBaseUrl, Contacts contacts) throws KeyVaultErrorException, IOException, IllegalArgumentException { return innerKeyVaultClient.setCertificateContacts(vaultBaseUrl, contacts); }
Contacts function(String vaultBaseUrl, Contacts contacts) throws KeyVaultErrorException, IOException, IllegalArgumentException { return innerKeyVaultClient.setCertificateContacts(vaultBaseUrl, contacts); }
/** * Sets the certificate contacts for the specified vault. * * @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net * @param contacts The contacts for the vault certificates. * @throws KeyVaultErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Contacts if successful. */
Sets the certificate contacts for the specified vault
setCertificateContacts
{ "repo_name": "herveyw/azure-sdk-for-java", "path": "azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClient.java", "license": "mit", "size": 97117 }
[ "com.microsoft.azure.keyvault.models.Contacts", "com.microsoft.azure.keyvault.models.KeyVaultErrorException", "java.io.IOException" ]
import com.microsoft.azure.keyvault.models.Contacts; import com.microsoft.azure.keyvault.models.KeyVaultErrorException; import java.io.IOException;
import com.microsoft.azure.keyvault.models.*; import java.io.*;
[ "com.microsoft.azure", "java.io" ]
com.microsoft.azure; java.io;
2,439,968
public void clearOldContentModels() { XPathSelector selector = DOM.createXPathSelector("our", "info:fedora/fedora-system:def/model#", "rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); String xpath = "//our:" + "hasModel"; NodeList nodes = selector.selectNodeList(rdfDescriptionNode, xpath); if (nodes != null) { for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); node.getParentNode().removeChild(node); } } }
void function() { XPathSelector selector = DOM.createXPathSelector("our", STR, "rdf", STR NodeList nodes = selector.selectNodeList(rdfDescriptionNode, xpath); if (nodes != null) { for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); node.getParentNode().removeChild(node); } } }
/** * Remove all content model relations. */
Remove all content model relations
clearOldContentModels
{ "repo_name": "statsbiblioteket/digital-pligtaflevering-aviser-tools", "path": "sbforge-parent-1.18/newspaper-parent-1.5/newspaper-prompt-doms-ingester/src/main/java/dk/statsbiblioteket/newspaper/promptdomsingester/util/RdfManipulator.java", "license": "apache-2.0", "size": 7951 }
[ "dk.statsbiblioteket.util.xml.DOM", "dk.statsbiblioteket.util.xml.XPathSelector", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import dk.statsbiblioteket.util.xml.DOM; import dk.statsbiblioteket.util.xml.XPathSelector; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import dk.statsbiblioteket.util.xml.*; import org.w3c.dom.*;
[ "dk.statsbiblioteket.util", "org.w3c.dom" ]
dk.statsbiblioteket.util; org.w3c.dom;
685,320
public TradingRecord run(Strategy strategy) { return run(strategy, OrderType.BUY); }
TradingRecord function(Strategy strategy) { return run(strategy, OrderType.BUY); }
/** * Runs the strategy over the series. * <p> * Opens the trades with {@link OrderType.BUY} orders. * @param strategy the trading strategy * @return the trading record coming from the run */
Runs the strategy over the series. Opens the trades with <code>OrderType.BUY</code> orders
run
{ "repo_name": "enkara/ta4j", "path": "ta4j/src/main/java/eu/verdelhan/ta4j/TimeSeries.java", "license": "mit", "size": 18049 }
[ "eu.verdelhan.ta4j.Order" ]
import eu.verdelhan.ta4j.Order;
import eu.verdelhan.ta4j.*;
[ "eu.verdelhan.ta4j" ]
eu.verdelhan.ta4j;
1,573,598
void draw(PoseStack stack, int xOffset, int yOffset, int maskTop, int maskBottom, int maskLeft, int maskRight);
void draw(PoseStack stack, int xOffset, int yOffset, int maskTop, int maskBottom, int maskLeft, int maskRight);
/** * Draw only part of the image, by masking off parts of it */
Draw only part of the image, by masking off parts of it
draw
{ "repo_name": "mezz/JustEnoughItems", "path": "src/api/java/mezz/jei/api/gui/drawable/IDrawableStatic.java", "license": "mit", "size": 404 }
[ "com.mojang.blaze3d.vertex.PoseStack" ]
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.*;
[ "com.mojang.blaze3d" ]
com.mojang.blaze3d;
1,341,025
@SkipForRepeat({ EE8_FEATURES }) @ExpectedFFDC(value = { "org.apache.ws.security.WSSecurityException" }, repeatAction = { EmptyAction.ID }) @Test public void CxfSAMLWSSTemplatesTests_X509SymmetricForMessageAndSamlForClient_omitProtectionPolicyEE7Only() throws Exception { WebClient webClient = SAMLCommonTestHelpers.getWebClient(); SAMLTestSettings updatedTestSettings = testSettings.copyTestSettings(); updatedTestSettings.updatePartnerInSettings("sp1", true); updatedTestSettings.setCXFSettings(_testName, null, servicePort, null, "user1", "user1pwd", "WSSTemplatesService6", "WSSTemplate6", "", "False", null, commonUtils.processClientWsdl("ClientSymOmitProtectionPolicy.wsdl", servicePort)); updatedTestSettings.getCXFSettings().setTitleToCheck(SAMLConstants.CXF_SAML_TOKEN_WSS_SERVLET); genericSAML(_testName, webClient, updatedTestSettings, standardFlow, helpers.setErrorSAMLCXFExpectations(null, flowType, updatedTestSettings, SAMLConstants.CXF_SAML_TOKEN_SYM_SIGN_ENCR_SERVICE_CLIENT_NOT_SIGN_OR_ENCR)); }
@SkipForRepeat({ EE8_FEATURES }) @ExpectedFFDC(value = { STR }, repeatAction = { EmptyAction.ID }) void function() throws Exception { WebClient webClient = SAMLCommonTestHelpers.getWebClient(); SAMLTestSettings updatedTestSettings = testSettings.copyTestSettings(); updatedTestSettings.updatePartnerInSettings("sp1", true); updatedTestSettings.setCXFSettings(_testName, null, servicePort, null, "user1", STR, STR, STR, STRFalseSTRClientSymOmitProtectionPolicy.wsdl", servicePort)); updatedTestSettings.getCXFSettings().setTitleToCheck(SAMLConstants.CXF_SAML_TOKEN_WSS_SERVLET); genericSAML(_testName, webClient, updatedTestSettings, standardFlow, helpers.setErrorSAMLCXFExpectations(null, flowType, updatedTestSettings, SAMLConstants.CXF_SAML_TOKEN_SYM_SIGN_ENCR_SERVICE_CLIENT_NOT_SIGN_OR_ENCR)); }
/** * TestDescription: * This test uses a policy with Symmetric X509 Message Policy and SAML. * Client uses policy that omits the Protection Policy * Test should fail to access the server side service. */
TestDescription: This test uses a policy with Symmetric X509 Message Policy and SAML. Client uses policy that omits the Protection Policy Test should fail to access the server side service
CxfSAMLWSSTemplatesTests_X509SymmetricForMessageAndSamlForClient_omitProtectionPolicyEE7Only
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.wssecurity_fat.wsscxf.saml.1/fat/src/com/ibm/ws/wssecurity/fat/cxf/samltoken1/common/CxfSAMLWSSTemplatesTests.java", "license": "epl-1.0", "size": 27423 }
[ "com.gargoylesoftware.htmlunit.WebClient", "com.ibm.ws.security.saml20.fat.commonTest.SAMLCommonTestHelpers", "com.ibm.ws.security.saml20.fat.commonTest.SAMLConstants", "com.ibm.ws.security.saml20.fat.commonTest.SAMLTestSettings" ]
import com.gargoylesoftware.htmlunit.WebClient; import com.ibm.ws.security.saml20.fat.commonTest.SAMLCommonTestHelpers; import com.ibm.ws.security.saml20.fat.commonTest.SAMLConstants; import com.ibm.ws.security.saml20.fat.commonTest.SAMLTestSettings;
import com.gargoylesoftware.htmlunit.*; import com.ibm.ws.security.saml20.fat.*;
[ "com.gargoylesoftware.htmlunit", "com.ibm.ws" ]
com.gargoylesoftware.htmlunit; com.ibm.ws;
1,873,708
public void union(final LShape shape) { this.union(shape.getPosition()); this.union(shape.getPosition().clone().add(shape.getSize().x, shape.getSize().y)); }
void function(final LShape shape) { this.union(shape.getPosition()); this.union(shape.getPosition().clone().add(shape.getSize().x, shape.getSize().y)); }
/** * Enlarges this rectangle to include the given shape. * * @param shape * The shape to include. */
Enlarges this rectangle to include the given shape
union
{ "repo_name": "ExplorViz/ExplorViz", "path": "src-external/de/cau/cs/kieler/klay/layered/p5edges/splines/Rectangle.java", "license": "apache-2.0", "size": 9483 }
[ "de.cau.cs.kieler.klay.layered.graph.LShape" ]
import de.cau.cs.kieler.klay.layered.graph.LShape;
import de.cau.cs.kieler.klay.layered.graph.*;
[ "de.cau.cs" ]
de.cau.cs;
505,422
public static PDDocument loadNonSeq(File file, RandomAccess scratchFile) throws IOException { return loadNonSeq(file, scratchFile, ""); }
static PDDocument function(File file, RandomAccess scratchFile) throws IOException { return loadNonSeq(file, scratchFile, ""); }
/** * Parses PDF with non sequential parser. * * @param file file to be loaded * @param scratchFile location to store temp PDFBox data for this document * * @return loaded document * * @throws IOException in case of a file reading or parsing error */
Parses PDF with non sequential parser
loadNonSeq
{ "repo_name": "sencko/NALB", "path": "nalb2013/src/org/apache/pdfbox/pdmodel/PDDocument.java", "license": "gpl-2.0", "size": 52170 }
[ "java.io.File", "java.io.IOException", "org.apache.pdfbox.io.RandomAccess" ]
import java.io.File; import java.io.IOException; import org.apache.pdfbox.io.RandomAccess;
import java.io.*; import org.apache.pdfbox.io.*;
[ "java.io", "org.apache.pdfbox" ]
java.io; org.apache.pdfbox;
1,387,775
LocatedBlocks getBlockLocations(String clientMachine, String src, long offset, long length) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { LocatedBlocks blocks = getBlockLocations(src, offset, length, true, true, true); if (blocks != null) { blockManager.getDatanodeManager().sortLocatedBlocks(clientMachine, blocks.getLocatedBlocks()); // lastBlock is not part of getLocatedBlocks(), might need to sort it too LocatedBlock lastBlock = blocks.getLastLocatedBlock(); if (lastBlock != null) { ArrayList<LocatedBlock> lastBlockList = Lists.newArrayListWithCapacity(1); lastBlockList.add(lastBlock); blockManager.getDatanodeManager().sortLocatedBlocks(clientMachine, lastBlockList); } } return blocks; }
LocatedBlocks getBlockLocations(String clientMachine, String src, long offset, long length) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { LocatedBlocks blocks = getBlockLocations(src, offset, length, true, true, true); if (blocks != null) { blockManager.getDatanodeManager().sortLocatedBlocks(clientMachine, blocks.getLocatedBlocks()); LocatedBlock lastBlock = blocks.getLastLocatedBlock(); if (lastBlock != null) { ArrayList<LocatedBlock> lastBlockList = Lists.newArrayListWithCapacity(1); lastBlockList.add(lastBlock); blockManager.getDatanodeManager().sortLocatedBlocks(clientMachine, lastBlockList); } } return blocks; }
/** * Get block locations within the specified range. * @see ClientProtocol#getBlockLocations(String, long, long) */
Get block locations within the specified range
getBlockLocations
{ "repo_name": "yncxcw/Yarn-SBlock", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java", "license": "apache-2.0", "size": 338725 }
[ "com.google.common.collect.Lists", "java.io.FileNotFoundException", "java.io.IOException", "java.util.ArrayList", "org.apache.hadoop.fs.UnresolvedLinkException", "org.apache.hadoop.hdfs.protocol.LocatedBlock", "org.apache.hadoop.hdfs.protocol.LocatedBlocks", "org.apache.hadoop.security.AccessControlException" ]
import com.google.common.collect.Lists; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import org.apache.hadoop.fs.UnresolvedLinkException; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlocks; import org.apache.hadoop.security.AccessControlException;
import com.google.common.collect.*; import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.security.*;
[ "com.google.common", "java.io", "java.util", "org.apache.hadoop" ]
com.google.common; java.io; java.util; org.apache.hadoop;
1,318,629
public static String newStringUtf16Be(byte[] bytes) { return StringUtils.newString(bytes, CharEncoding.UTF_16BE); }
static String function(byte[] bytes) { return StringUtils.newString(bytes, CharEncoding.UTF_16BE); }
/** * Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-16BE charset. * * @param bytes * The bytes to be decoded into characters * @return A new <code>String</code> decoded from the specified array of bytes using the given charset. * @throws IllegalStateException * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen since the * charset is required. */
Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-16BE charset
newStringUtf16Be
{ "repo_name": "raksha-rao/gluster-ovirt", "path": "frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/external/StringUtils.java", "license": "apache-2.0", "size": 12611 }
[ "org.apache.commons.codec.CharEncoding" ]
import org.apache.commons.codec.CharEncoding;
import org.apache.commons.codec.*;
[ "org.apache.commons" ]
org.apache.commons;
1,450,790
public void doMove(int process, int machine){ int previousMachine=assignment[process]; assignment[process]=machine; // hold the usage on the previous machine before the change (necessary for quadratic overload delta update) long[] previousMachineOldUsage = Arrays.copyOf(usage[previousMachine], problem.nrResources); // hold the usage on the new machine before the change (necessary for quadratic overload delta update) long[] newMachineOldUsage = Arrays.copyOf(usage[machine], problem.nrResources); // update usage and transient usage for (int r=0;r<problem.nrResources;r++){ if(problem.transientResourceMap[r]) { if(initialAssignment[process]==previousMachine) { transientUsage[previousMachine][r] += problem.processReq[process][r]; } if(initialAssignment[process]==machine){ transientUsage[machine][r] -= problem.processReq[process][r]; } } usage[previousMachine][r]-=problem.processReq[process][r]; usage[machine][r]+=problem.processReq[process][r]; } //update neighborhood count int service=problem.processServiceMap[process]; int nbefore=problem.machineNeighbourhoodMap[previousMachine]; int nNew=problem.machineNeighbourhoodMap[machine]; if (nbefore!=nNew){ neighborHoodCount[service][nbefore]--; neighborHoodCount[service][nNew]++; } //update location count int lbefore =problem.machineLocationMap[previousMachine]; int lNew=problem.machineLocationMap[machine]; if (lbefore!=lNew){ if(locationCount[service][lbefore] == 1) serviceSpread[service]--; if(locationCount[service][lNew] == 0) serviceSpread[service]++; locationCount[service][lbefore]--; locationCount[service][lNew]++; } //update service move count if (previousMachine==initialAssignment[process] && machine!=initialAssignment[process]){ serviceMoveCount[service]++; if (serviceMoveCount[service]>maxServiceMoveCount){ maxServiceMoveCount=serviceMoveCount[service]; serviceWithMaxMoveCount=service; } } else if (previousMachine!=initialAssignment[process] && machine==initialAssignment[process]){ serviceMoveCount[service]--; if (service==serviceWithMaxMoveCount){ maxServiceMoveCount=serviceMoveCount[service]; int maxCount=-1; int maxService=-1; for (int s=0;s<problem.nrServices;s++){ if (service!=s){ if (serviceMoveCount[s]>maxCount){ maxCount=serviceMoveCount[s]; maxService=s; } } } if (maxCount>serviceMoveCount[service]){ serviceWithMaxMoveCount=maxService; maxServiceMoveCount=maxCount; } } } //update machinemap machineToProcMap.get(previousMachine).remove(process); machineToProcMap.get(machine).add(process); //update quadraticoverload for(int r = 0; r<problem.nrResources; r++) { long delta = problem.processReq[process][r]; quadraticOverload[previousMachine][r] += (-delta)*(2*(previousMachineOldUsage[r]-problem.safetyCap[previousMachine][r]) - delta); quadraticOverload[machine][r] += delta*(2*(newMachineOldUsage[r]-problem.safetyCap[machine][r]) + delta); } }
void function(int process, int machine){ int previousMachine=assignment[process]; assignment[process]=machine; long[] previousMachineOldUsage = Arrays.copyOf(usage[previousMachine], problem.nrResources); long[] newMachineOldUsage = Arrays.copyOf(usage[machine], problem.nrResources); for (int r=0;r<problem.nrResources;r++){ if(problem.transientResourceMap[r]) { if(initialAssignment[process]==previousMachine) { transientUsage[previousMachine][r] += problem.processReq[process][r]; } if(initialAssignment[process]==machine){ transientUsage[machine][r] -= problem.processReq[process][r]; } } usage[previousMachine][r]-=problem.processReq[process][r]; usage[machine][r]+=problem.processReq[process][r]; } int service=problem.processServiceMap[process]; int nbefore=problem.machineNeighbourhoodMap[previousMachine]; int nNew=problem.machineNeighbourhoodMap[machine]; if (nbefore!=nNew){ neighborHoodCount[service][nbefore]--; neighborHoodCount[service][nNew]++; } int lbefore =problem.machineLocationMap[previousMachine]; int lNew=problem.machineLocationMap[machine]; if (lbefore!=lNew){ if(locationCount[service][lbefore] == 1) serviceSpread[service]--; if(locationCount[service][lNew] == 0) serviceSpread[service]++; locationCount[service][lbefore]--; locationCount[service][lNew]++; } if (previousMachine==initialAssignment[process] && machine!=initialAssignment[process]){ serviceMoveCount[service]++; if (serviceMoveCount[service]>maxServiceMoveCount){ maxServiceMoveCount=serviceMoveCount[service]; serviceWithMaxMoveCount=service; } } else if (previousMachine!=initialAssignment[process] && machine==initialAssignment[process]){ serviceMoveCount[service]--; if (service==serviceWithMaxMoveCount){ maxServiceMoveCount=serviceMoveCount[service]; int maxCount=-1; int maxService=-1; for (int s=0;s<problem.nrServices;s++){ if (service!=s){ if (serviceMoveCount[s]>maxCount){ maxCount=serviceMoveCount[s]; maxService=s; } } } if (maxCount>serviceMoveCount[service]){ serviceWithMaxMoveCount=maxService; maxServiceMoveCount=maxCount; } } } machineToProcMap.get(previousMachine).remove(process); machineToProcMap.get(machine).add(process); for(int r = 0; r<problem.nrResources; r++) { long delta = problem.processReq[process][r]; quadraticOverload[previousMachine][r] += (-delta)*(2*(previousMachineOldUsage[r]-problem.safetyCap[previousMachine][r]) - delta); quadraticOverload[machine][r] += delta*(2*(newMachineOldUsage[r]-problem.safetyCap[machine][r]) + delta); } }
/** * Performs a single reassignment of a process. Updates all maps for the change * @param process * @param machine */
Performs a single reassignment of a process. Updates all maps for the change
doMove
{ "repo_name": "wvc/CODeS-MRAP", "path": "src/be/kahosl/roadef2012/model/Assignment.java", "license": "apache-2.0", "size": 26744 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,854,147
public void xtestBatchUpdate() throws SQLException { // Setup table data Statement stmt = createStatement(); stmt.executeUpdate("INSERT INTO BATCH_TABLE VALUES(1, 'STRING_1',10)"); stmt.executeUpdate("INSERT INTO BATCH_TABLE VALUES(2, 'STRING_2',0)"); stmt.executeUpdate("INSERT INTO BATCH_TABLE VALUES(3, 'STRING_3',0)"); stmt.executeUpdate("INSERT INTO BATCH_TABLE VALUES(4, 'STRING_4a',0)"); stmt.executeUpdate("INSERT INTO BATCH_TABLE VALUES(4, 'STRING_4b',0)"); // Setup batch to modify value to 10 * the id (makes verification easy). CallableStatement cstmt = prepareCall("CALL BATCH_UPDATE_PROC(?,?)"); cstmt.setInt(1,2); // Id 2's value will be updated to 20. cstmt.setInt(2,20); cstmt.addBatch(); cstmt.setInt(1,3); // Id 3's value will be updated to 30. cstmt.setInt(2,30); cstmt.addBatch(); cstmt.setInt(1,4); // Two rows will be updated to 40 for id 4. cstmt.setInt(2,40); cstmt.addBatch(); cstmt.setInt(1,5); // No rows updated (no id 5). cstmt.setInt(2,50); cstmt.addBatch(); int[] updateCount=null; try { updateCount = cstmt.executeBatch(); assertEquals("updateCount length", 4, updateCount.length); for(int i=0; i< updateCount.length; i++){ if (usingEmbedded()) { assertEquals("Batch updateCount", 0, updateCount[0]); } else if (usingDerbyNetClient()) { assertEquals("Batch updateCount", -1, updateCount[0]); } } } catch (BatchUpdateException b) { assertSQLState("Unexpected SQL State", b.getSQLState(), b); } // Retrieve the updated values and verify they are correct. ResultSet rs = stmt.executeQuery( "SELECT id, tag, idval FROM BATCH_TABLE order by id, tag"); assertNotNull("SELECT from BATCH_TABLE", rs); while (rs.next()) { assertEquals(rs.getString(2), rs.getInt(1)*10, rs.getInt(3)); } }
void function() throws SQLException { Statement stmt = createStatement(); stmt.executeUpdate(STR); stmt.executeUpdate(STR); stmt.executeUpdate(STR); stmt.executeUpdate(STR); stmt.executeUpdate(STR); CallableStatement cstmt = prepareCall(STR); cstmt.setInt(1,2); cstmt.setInt(2,20); cstmt.addBatch(); cstmt.setInt(1,3); cstmt.setInt(2,30); cstmt.addBatch(); cstmt.setInt(1,4); cstmt.setInt(2,40); cstmt.addBatch(); cstmt.setInt(1,5); cstmt.setInt(2,50); cstmt.addBatch(); int[] updateCount=null; try { updateCount = cstmt.executeBatch(); assertEquals(STR, 4, updateCount.length); for(int i=0; i< updateCount.length; i++){ if (usingEmbedded()) { assertEquals(STR, 0, updateCount[0]); } else if (usingDerbyNetClient()) { assertEquals(STR, -1, updateCount[0]); } } } catch (BatchUpdateException b) { assertSQLState(STR, b.getSQLState(), b); } ResultSet rs = stmt.executeQuery( STR); assertNotNull(STR, rs); while (rs.next()) { assertEquals(rs.getString(2), rs.getInt(1)*10, rs.getInt(3)); } }
/** * Batches up calls to a SQL procedure that updates a value in a table. * Uses DriverManager and Batch calls, so requires JDBC 2 support. * @throws SQLException */
Batches up calls to a SQL procedure that updates a value in a table. Uses DriverManager and Batch calls, so requires JDBC 2 support
xtestBatchUpdate
{ "repo_name": "kavin256/Derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CallableTest.java", "license": "apache-2.0", "size": 42518 }
[ "java.sql.BatchUpdateException", "java.sql.CallableStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.BatchUpdateException; import java.sql.CallableStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,311,792
protected AccountAutoCreateDefaults getAccountDefaults(String unitNumber) { AccountAutoCreateDefaults defaults = null; if (unitNumber == null || unitNumber.isEmpty()) { return null; } Map<String, String> criteria = new HashMap<String, String>(); criteria.put("kcUnit", unitNumber); defaults = businessObjectService.findByPrimaryKey(AccountAutoCreateDefaults.class, criteria); // if the matching defaults is null, try the parents in the hierarchy if (defaults == null) { List<String> parentUnits = null; try { parentUnits = SpringContext.getBean(ContractsAndGrantsModuleService.class).getParentUnits(unitNumber); } catch (Exception ex) { LOG.error( KcUtils.getErrorMessage(KcConstants.AccountCreationService.ERROR_KC_ACCOUNT_PARAMS_UNIT_NOTFOUND, null) + ": " + ex.getMessage()); GlobalVariables.getMessageMap().putError(KcConstants.AccountCreationService.ERROR_KC_ACCOUNT_PARAMS_UNIT_NOTFOUND, "kcUnit", ex.getMessage()); } if (parentUnits != null) { for (String unit : parentUnits) { criteria.put("kcUnit", unit); defaults = businessObjectService.findByPrimaryKey(AccountAutoCreateDefaults.class, criteria); if (defaults != null) { break; } } } } return defaults; }
AccountAutoCreateDefaults function(String unitNumber) { AccountAutoCreateDefaults defaults = null; if (unitNumber == null unitNumber.isEmpty()) { return null; } Map<String, String> criteria = new HashMap<String, String>(); criteria.put(STR, unitNumber); defaults = businessObjectService.findByPrimaryKey(AccountAutoCreateDefaults.class, criteria); if (defaults == null) { List<String> parentUnits = null; try { parentUnits = SpringContext.getBean(ContractsAndGrantsModuleService.class).getParentUnits(unitNumber); } catch (Exception ex) { LOG.error( KcUtils.getErrorMessage(KcConstants.AccountCreationService.ERROR_KC_ACCOUNT_PARAMS_UNIT_NOTFOUND, null) + STR + ex.getMessage()); GlobalVariables.getMessageMap().putError(KcConstants.AccountCreationService.ERROR_KC_ACCOUNT_PARAMS_UNIT_NOTFOUND, STR, ex.getMessage()); } if (parentUnits != null) { for (String unit : parentUnits) { criteria.put(STR, unit); defaults = businessObjectService.findByPrimaryKey(AccountAutoCreateDefaults.class, criteria); if (defaults != null) { break; } } } } return defaults; }
/** * This method looks up the default table * * @param String unitNumber * @return AccountAutoCreateDefaults */
This method looks up the default table
getAccountDefaults
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/external/kc/service/impl/AccountCreationServiceImpl.java", "license": "agpl-3.0", "size": 40212 }
[ "java.util.HashMap", "java.util.List", "java.util.Map", "org.kuali.kfs.integration.cg.ContractsAndGrantsModuleService", "org.kuali.kfs.module.external.kc.KcConstants", "org.kuali.kfs.module.external.kc.businessobject.AccountAutoCreateDefaults", "org.kuali.kfs.module.external.kc.service.AccountCreationService", "org.kuali.kfs.module.external.kc.util.KcUtils", "org.kuali.kfs.sys.context.SpringContext", "org.kuali.rice.krad.util.GlobalVariables" ]
import java.util.HashMap; import java.util.List; import java.util.Map; import org.kuali.kfs.integration.cg.ContractsAndGrantsModuleService; import org.kuali.kfs.module.external.kc.KcConstants; import org.kuali.kfs.module.external.kc.businessobject.AccountAutoCreateDefaults; import org.kuali.kfs.module.external.kc.service.AccountCreationService; import org.kuali.kfs.module.external.kc.util.KcUtils; import org.kuali.kfs.sys.context.SpringContext; import org.kuali.rice.krad.util.GlobalVariables;
import java.util.*; import org.kuali.kfs.integration.cg.*; import org.kuali.kfs.module.external.kc.*; import org.kuali.kfs.module.external.kc.businessobject.*; import org.kuali.kfs.module.external.kc.service.*; import org.kuali.kfs.module.external.kc.util.*; import org.kuali.kfs.sys.context.*; import org.kuali.rice.krad.util.*;
[ "java.util", "org.kuali.kfs", "org.kuali.rice" ]
java.util; org.kuali.kfs; org.kuali.rice;
946
java.io.Reader getCharacterStream(String parameterName) throws SQLException;
java.io.Reader getCharacterStream(String parameterName) throws SQLException;
/** * Retrieves the value of the designated parameter as a * <code>java.io.Reader</code> object in the Java programming language. * * @param parameterName the name of the parameter * @return a <code>java.io.Reader</code> object that contains the parameter * value; if the value is SQL <code>NULL</code>, the value returned is * <code>null</code> in the Java programming language * @exception SQLException if parameterName does not correspond to a named * parameter; if a database access error occurs or * this method is called on a closed <code>CallableStatement</code> * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method * @since 1.6 */
Retrieves the value of the designated parameter as a <code>java.io.Reader</code> object in the Java programming language
getCharacterStream
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "src/java.sql/share/classes/java/sql/CallableStatement.java", "license": "gpl-2.0", "size": 135185 }
[ "java.io.Reader" ]
import java.io.Reader;
import java.io.*;
[ "java.io" ]
java.io;
1,949,330
public void textMondayThroughFridayTranslations() throws ParseException { verifyFillInExceptions(this.mondayFridayTimeline, US_HOLIDAYS, DATE_FORMAT); verifyTranslations(this.mondayFridayTimeline, this.monday.getTime().getTime()); }
void function() throws ParseException { verifyFillInExceptions(this.mondayFridayTimeline, US_HOLIDAYS, DATE_FORMAT); verifyTranslations(this.mondayFridayTimeline, this.monday.getTime().getTime()); }
/** * Tests translations for the Monday through Friday timeline * * @throws ParseException if there is a parsing error. */
Tests translations for the Monday through Friday timeline
textMondayThroughFridayTranslations
{ "repo_name": "martingwhite/astor", "path": "examples/chart_11/tests/org/jfree/chart/axis/junit/SegmentedTimelineTests.java", "license": "gpl-2.0", "size": 46257 }
[ "java.text.ParseException" ]
import java.text.ParseException;
import java.text.*;
[ "java.text" ]
java.text;
119,739
public static DefaultGroupHandler createGroupHandler( DeviceId deviceId, ApplicationId appId, DeviceProperties config, LinkService linkService, FlowObjectiveService flowObjService, SegmentRoutingManager srManager) throws DeviceConfigNotFoundException { return new DefaultGroupHandler(deviceId, appId, config, linkService, flowObjService, srManager); }
static DefaultGroupHandler function( DeviceId deviceId, ApplicationId appId, DeviceProperties config, LinkService linkService, FlowObjectiveService flowObjService, SegmentRoutingManager srManager) throws DeviceConfigNotFoundException { return new DefaultGroupHandler(deviceId, appId, config, linkService, flowObjService, srManager); }
/** * Creates a group handler object. * * @param deviceId device identifier * @param appId application identifier * @param config interface to retrieve the device properties * @param linkService link service object * @param flowObjService flow objective service object * @param srManager segment routing manager * @throws DeviceConfigNotFoundException if the device configuration is not found * @return default group handler type */
Creates a group handler object
createGroupHandler
{ "repo_name": "kuujo/onos", "path": "apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java", "license": "apache-2.0", "size": 73488 }
[ "org.onosproject.core.ApplicationId", "org.onosproject.net.DeviceId", "org.onosproject.net.flowobjective.FlowObjectiveService", "org.onosproject.net.link.LinkService", "org.onosproject.segmentrouting.SegmentRoutingManager", "org.onosproject.segmentrouting.config.DeviceConfigNotFoundException", "org.onosproject.segmentrouting.config.DeviceProperties" ]
import org.onosproject.core.ApplicationId; import org.onosproject.net.DeviceId; import org.onosproject.net.flowobjective.FlowObjectiveService; import org.onosproject.net.link.LinkService; import org.onosproject.segmentrouting.SegmentRoutingManager; import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException; import org.onosproject.segmentrouting.config.DeviceProperties;
import org.onosproject.core.*; import org.onosproject.net.*; import org.onosproject.net.flowobjective.*; import org.onosproject.net.link.*; import org.onosproject.segmentrouting.*; import org.onosproject.segmentrouting.config.*;
[ "org.onosproject.core", "org.onosproject.net", "org.onosproject.segmentrouting" ]
org.onosproject.core; org.onosproject.net; org.onosproject.segmentrouting;
193,860
public static void main(String[] args) throws IOException { boolean enableOutput = true; boolean outputToFile = false; String inputFolder = ""; String outputFolder = ""; String workload = "random"; // Random workload String vmAllocationPolicy = "thr"; // Static Threshold (THR) VM // allocation policy String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM // selection policy String parameter = "0.8"; // the static utilization threshold new RandomRunner(enableOutput, outputToFile, inputFolder, outputFolder, workload, vmAllocationPolicy, vmSelectionPolicy, parameter); }
static void function(String[] args) throws IOException { boolean enableOutput = true; boolean outputToFile = false; String inputFolder = STRSTRrandomSTRthrSTRmmtSTR0.8"; new RandomRunner(enableOutput, outputToFile, inputFolder, outputFolder, workload, vmAllocationPolicy, vmSelectionPolicy, parameter); }
/** * The main method. * * @param args * the arguments * @throws IOException * Signals that an I/O exception has occurred. */
The main method
main
{ "repo_name": "swethapts/cloudsim", "path": "examples/org/cloudbus/cloudsim/examples/power/random/ThrMmt.java", "license": "lgpl-3.0", "size": 1797 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
416,885
public AmberTable getAssociationTable() { return _associationTable; }
AmberTable function() { return _associationTable; }
/** * Returns the association table */
Returns the association table
getAssociationTable
{ "repo_name": "christianchristensen/resin", "path": "modules/resin/src/com/caucho/amber/field/ManyToManyField.java", "license": "gpl-2.0", "size": 30811 }
[ "com.caucho.amber.table.AmberTable" ]
import com.caucho.amber.table.AmberTable;
import com.caucho.amber.table.*;
[ "com.caucho.amber" ]
com.caucho.amber;
1,458,055
public void endFakeDrag() { if (!mFakeDragging) { throw new IllegalStateException( "No fake drag in progress. Call beginFakeDrag first."); } final VelocityTracker velocityTracker = mVelocityTracker; velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity); int initialVelocity = (int) VelocityTrackerCompat.getYVelocity( velocityTracker, mActivePointerId); mPopulatePending = true; final int height = getHeight(); final int scrollY = getScrollY(); final ItemInfo ii = infoForCurrentScrollPosition(); final int currentPage = ii.position; final float pageOffset = (((float) scrollY / height) - ii.offset) / ii.heightFactor; final int totalDelta = (int) (mLastMotionY - mInitialMotionY); int nextPage = determineTargetPage(currentPage, pageOffset, initialVelocity, totalDelta); setCurrentItemInternal(nextPage, true, true, initialVelocity); endDrag(); mFakeDragging = false; }
void function() { if (!mFakeDragging) { throw new IllegalStateException( STR); } final VelocityTracker velocityTracker = mVelocityTracker; velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity); int initialVelocity = (int) VelocityTrackerCompat.getYVelocity( velocityTracker, mActivePointerId); mPopulatePending = true; final int height = getHeight(); final int scrollY = getScrollY(); final ItemInfo ii = infoForCurrentScrollPosition(); final int currentPage = ii.position; final float pageOffset = (((float) scrollY / height) - ii.offset) / ii.heightFactor; final int totalDelta = (int) (mLastMotionY - mInitialMotionY); int nextPage = determineTargetPage(currentPage, pageOffset, initialVelocity, totalDelta); setCurrentItemInternal(nextPage, true, true, initialVelocity); endDrag(); mFakeDragging = false; }
/** * End a fake drag of the pager. * * @see #beginFakeDrag() * @see #fakeDragBy(float) */
End a fake drag of the pager
endFakeDrag
{ "repo_name": "darlyhellen/oto", "path": "ToWife/src/com/chenminna/towife/widget/vpager/VerticalViewPager.java", "license": "apache-2.0", "size": 87863 }
[ "android.support.v4.view.VelocityTrackerCompat", "android.view.VelocityTracker" ]
import android.support.v4.view.VelocityTrackerCompat; import android.view.VelocityTracker;
import android.support.v4.view.*; import android.view.*;
[ "android.support", "android.view" ]
android.support; android.view;
915,392
public MUCLightRoomInfo getFullInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getFullInfo(null); }
MUCLightRoomInfo function() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getFullInfo(null); }
/** * Get the MUC Light info. * * @return the room info * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws InterruptedException */
Get the MUC Light info
getFullInfo
{ "repo_name": "vanitasvitae/smack-omemo", "path": "smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java", "license": "apache-2.0", "size": 18314 }
[ "org.jivesoftware.smack.SmackException", "org.jivesoftware.smack.XMPPException" ]
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.*;
[ "org.jivesoftware.smack" ]
org.jivesoftware.smack;
234,724
public Base appendChild(Node child){ if(this == child){ throw new Error("Cannot append a node to itself."); } child.setParent(this); children.add(child); return this; }
Base function(Node child){ if(this == child){ throw new Error(STR); } child.setParent(this); children.add(child); return this; }
/** * Appends a child node to the end of this element's DOM tree * @param child node to be appended * @return the node */
Appends a child node to the end of this element's DOM tree
appendChild
{ "repo_name": "abdulmudabir/Gagawa", "path": "src/com/hp/gagawa/java/elements/Base.java", "license": "mit", "size": 3577 }
[ "com.hp.gagawa.java.Node" ]
import com.hp.gagawa.java.Node;
import com.hp.gagawa.java.*;
[ "com.hp.gagawa" ]
com.hp.gagawa;
899,957
public Map<String, ProjectType> getProjectTypes() { return this.projectTypes.getContent(); } /** * Return the default type to use or {@code null} if the metadata does not define any * default. * @return the default project type or {@code null}
Map<String, ProjectType> function() { return this.projectTypes.getContent(); } /** * Return the default type to use or {@code null} if the metadata does not define any * default. * @return the default project type or {@code null}
/** * Return the project types supported by the service. * @return the supported project types */
Return the project types supported by the service
getProjectTypes
{ "repo_name": "lburgazzoli/spring-boot", "path": "spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java", "license": "apache-2.0", "size": 7636 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,192,255
public Rectangle2D getRectangle(int x) { if ( x == 2) { return new Rectangle2D.Double(border[x][0]+55,border[x][1],45,border[x][3]); } if ( x == 3) { return new Rectangle2D.Double(border[x][0]+55,border[x][1],45,border[x][3]); } if ( x == 1) { return new Rectangle2D.Double(border[x][0],border[x][1]+20,border[x][2],border[x][3]-20); } return new Rectangle2D.Double(border[x][0],border[x][1],border[x][2],border[x][3]); }
Rectangle2D function(int x) { if ( x == 2) { return new Rectangle2D.Double(border[x][0]+55,border[x][1],45,border[x][3]); } if ( x == 3) { return new Rectangle2D.Double(border[x][0]+55,border[x][1],45,border[x][3]); } if ( x == 1) { return new Rectangle2D.Double(border[x][0],border[x][1]+20,border[x][2],border[x][3]-20); } return new Rectangle2D.Double(border[x][0],border[x][1],border[x][2],border[x][3]); }
/** * retorna cada Rectangulo que se pide * * @param x numero del rectangulo ( imagen de fondo o objeto) * @return Rectangle2D.Double */
retorna cada Rectangulo que se pide
getRectangle
{ "repo_name": "mariogrieco/The-Ninja-Challenge", "path": "APP/src/ScenasWorld/Scena6World.java", "license": "apache-2.0", "size": 4755 }
[ "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,862,614
public void processPacket(INetHandler p_148833_1_) { this.processPacket((INetHandlerPlayClient)p_148833_1_); }
void function(INetHandler p_148833_1_) { this.processPacket((INetHandlerPlayClient)p_148833_1_); }
/** * Passes this Packet on to the NetHandler for processing. */
Passes this Packet on to the NetHandler for processing
processPacket
{ "repo_name": "CheeseL0ver/Ore-TTM", "path": "build/tmp/recompSrc/net/minecraft/network/play/server/S2APacketParticles.java", "license": "lgpl-2.1", "size": 4106 }
[ "net.minecraft.network.INetHandler", "net.minecraft.network.play.INetHandlerPlayClient" ]
import net.minecraft.network.INetHandler; import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.network.*; import net.minecraft.network.play.*;
[ "net.minecraft.network" ]
net.minecraft.network;
1,668,541
public void performSearch() { new SearchDialog(textPane, new SearchableJTextComponent(textPane)).setVisible(true); }
void function() { new SearchDialog(textPane, new SearchableJTextComponent(textPane)).setVisible(true); }
/** * Opens a search dialog for the currently displayed log. */
Opens a search dialog for the currently displayed log
performSearch
{ "repo_name": "transwarpio/rapidminer", "path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/gui/tools/logging/LogViewer.java", "license": "gpl-3.0", "size": 26604 }
[ "com.rapidminer.gui.dialog.SearchDialog", "com.rapidminer.gui.dialog.SearchableJTextComponent" ]
import com.rapidminer.gui.dialog.SearchDialog; import com.rapidminer.gui.dialog.SearchableJTextComponent;
import com.rapidminer.gui.dialog.*;
[ "com.rapidminer.gui" ]
com.rapidminer.gui;
1,167,517
private StringBuilder detailsFormat(Intent intent, IntentState state) { StringBuilder builder = new StringBuilder(); if (state == null) { return builder; } if (!intent.resources().isEmpty()) { builder.append('\n').append(format(RESOURCES, intent.resources())); } if (intent instanceof ConnectivityIntent) { ConnectivityIntent ci = (ConnectivityIntent) intent; if (!ci.selector().criteria().isEmpty()) { builder.append('\n').append(format(COMMON_SELECTOR, formatSelector(ci.selector()))); } if (!ci.treatment().allInstructions().isEmpty()) { builder.append('\n').append(format(TREATMENT, ci.treatment().allInstructions())); } if (ci.constraints() != null && !ci.constraints().isEmpty()) { builder.append('\n').append(format(CONSTRAINTS, ci.constraints())); } } if (intent instanceof HostToHostIntent) { HostToHostIntent pi = (HostToHostIntent) intent; builder.append('\n').append(format(SRC + HOST, pi.one())); builder.append('\n').append(format(DST + HOST, pi.two())); } else if (intent instanceof PointToPointIntent) { PointToPointIntent pi = (PointToPointIntent) intent; builder.append('\n').append(formatFilteredCps(Sets.newHashSet(pi.filteredIngressPoint()), INGRESS)); builder.append('\n').append(formatFilteredCps(Sets.newHashSet(pi.filteredEgressPoint()), EGRESS)); } else if (intent instanceof MultiPointToSinglePointIntent) { MultiPointToSinglePointIntent pi = (MultiPointToSinglePointIntent) intent; builder.append('\n').append(formatFilteredCps(pi.filteredIngressPoints(), INGRESS)); builder.append('\n').append(formatFilteredCps(Sets.newHashSet(pi.filteredEgressPoint()), EGRESS)); } else if (intent instanceof SinglePointToMultiPointIntent) { SinglePointToMultiPointIntent pi = (SinglePointToMultiPointIntent) intent; builder.append('\n').append(formatFilteredCps(Sets.newHashSet(pi.filteredIngressPoint()), INGRESS)); builder.append('\n').append(formatFilteredCps(pi.filteredEgressPoints(), EGRESS)); } else if (intent instanceof PathIntent) { PathIntent pi = (PathIntent) intent; builder.append(format("path=%s, cost=%f", pi.path().links(), pi.path().cost())); } else if (intent instanceof LinkCollectionIntent) { LinkCollectionIntent li = (LinkCollectionIntent) intent; builder.append('\n').append(format("links=%s", li.links())); builder.append('\n').append(format(CP, li.egressPoints())); } else if (intent instanceof OpticalCircuitIntent) { OpticalCircuitIntent ci = (OpticalCircuitIntent) intent; builder.append('\n').append(format("src=%s, dst=%s", ci.getSrc(), ci.getDst())); builder.append('\n').append(format("signal type=%s", ci.getSignalType())); builder.append('\n').append(format("bidirectional=%s", ci.isBidirectional())); } else if (intent instanceof OpticalConnectivityIntent) { OpticalConnectivityIntent ci = (OpticalConnectivityIntent) intent; builder.append('\n').append(format("src=%s, dst=%s", ci.getSrc(), ci.getDst())); builder.append('\n').append(format("signal type=%s", ci.getSignalType())); builder.append('\n').append(format("bidirectional=%s", ci.isBidirectional())); } else if (intent instanceof OpticalOduIntent) { OpticalOduIntent ci = (OpticalOduIntent) intent; builder.append('\n').append(format("src=%s, dst=%s", ci.getSrc(), ci.getDst())); builder.append('\n').append(format("signal type=%s", ci.getSignalType())); builder.append('\n').append(format("bidirectional=%s", ci.isBidirectional())); } List<Intent> installable = service.getInstallableIntents(intent.key()); installable.stream().filter(i -> contentFilter.filter(i)); if (showInstallable && installable != null && !installable.isEmpty()) { builder.append('\n').append(format(INSTALLABLE, installable)); } return builder; }
StringBuilder function(Intent intent, IntentState state) { StringBuilder builder = new StringBuilder(); if (state == null) { return builder; } if (!intent.resources().isEmpty()) { builder.append('\n').append(format(RESOURCES, intent.resources())); } if (intent instanceof ConnectivityIntent) { ConnectivityIntent ci = (ConnectivityIntent) intent; if (!ci.selector().criteria().isEmpty()) { builder.append('\n').append(format(COMMON_SELECTOR, formatSelector(ci.selector()))); } if (!ci.treatment().allInstructions().isEmpty()) { builder.append('\n').append(format(TREATMENT, ci.treatment().allInstructions())); } if (ci.constraints() != null && !ci.constraints().isEmpty()) { builder.append('\n').append(format(CONSTRAINTS, ci.constraints())); } } if (intent instanceof HostToHostIntent) { HostToHostIntent pi = (HostToHostIntent) intent; builder.append('\n').append(format(SRC + HOST, pi.one())); builder.append('\n').append(format(DST + HOST, pi.two())); } else if (intent instanceof PointToPointIntent) { PointToPointIntent pi = (PointToPointIntent) intent; builder.append('\n').append(formatFilteredCps(Sets.newHashSet(pi.filteredIngressPoint()), INGRESS)); builder.append('\n').append(formatFilteredCps(Sets.newHashSet(pi.filteredEgressPoint()), EGRESS)); } else if (intent instanceof MultiPointToSinglePointIntent) { MultiPointToSinglePointIntent pi = (MultiPointToSinglePointIntent) intent; builder.append('\n').append(formatFilteredCps(pi.filteredIngressPoints(), INGRESS)); builder.append('\n').append(formatFilteredCps(Sets.newHashSet(pi.filteredEgressPoint()), EGRESS)); } else if (intent instanceof SinglePointToMultiPointIntent) { SinglePointToMultiPointIntent pi = (SinglePointToMultiPointIntent) intent; builder.append('\n').append(formatFilteredCps(Sets.newHashSet(pi.filteredIngressPoint()), INGRESS)); builder.append('\n').append(formatFilteredCps(pi.filteredEgressPoints(), EGRESS)); } else if (intent instanceof PathIntent) { PathIntent pi = (PathIntent) intent; builder.append(format(STR, pi.path().links(), pi.path().cost())); } else if (intent instanceof LinkCollectionIntent) { LinkCollectionIntent li = (LinkCollectionIntent) intent; builder.append('\n').append(format(STR, li.links())); builder.append('\n').append(format(CP, li.egressPoints())); } else if (intent instanceof OpticalCircuitIntent) { OpticalCircuitIntent ci = (OpticalCircuitIntent) intent; builder.append('\n').append(format(STR, ci.getSrc(), ci.getDst())); builder.append('\n').append(format(STR, ci.getSignalType())); builder.append('\n').append(format(STR, ci.isBidirectional())); } else if (intent instanceof OpticalConnectivityIntent) { OpticalConnectivityIntent ci = (OpticalConnectivityIntent) intent; builder.append('\n').append(format(STR, ci.getSrc(), ci.getDst())); builder.append('\n').append(format(STR, ci.getSignalType())); builder.append('\n').append(format(STR, ci.isBidirectional())); } else if (intent instanceof OpticalOduIntent) { OpticalOduIntent ci = (OpticalOduIntent) intent; builder.append('\n').append(format(STR, ci.getSrc(), ci.getDst())); builder.append('\n').append(format(STR, ci.getSignalType())); builder.append('\n').append(format(STR, ci.isBidirectional())); } List<Intent> installable = service.getInstallableIntents(intent.key()); installable.stream().filter(i -> contentFilter.filter(i)); if (showInstallable && installable != null && !installable.isEmpty()) { builder.append('\n').append(format(INSTALLABLE, installable)); } return builder; }
/** * Returns detailed information text about a specific intent. * * @param intent to print * @param state of intent * @return detailed information or "" if {@code state} was null */
Returns detailed information text about a specific intent
detailsFormat
{ "repo_name": "sdnwiselab/onos", "path": "cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java", "license": "apache-2.0", "size": 24759 }
[ "com.google.common.collect.Sets", "java.util.List", "org.onosproject.net.intent.ConnectivityIntent", "org.onosproject.net.intent.HostToHostIntent", "org.onosproject.net.intent.Intent", "org.onosproject.net.intent.IntentState", "org.onosproject.net.intent.LinkCollectionIntent", "org.onosproject.net.intent.MultiPointToSinglePointIntent", "org.onosproject.net.intent.OpticalCircuitIntent", "org.onosproject.net.intent.OpticalConnectivityIntent", "org.onosproject.net.intent.OpticalOduIntent", "org.onosproject.net.intent.PathIntent", "org.onosproject.net.intent.PointToPointIntent", "org.onosproject.net.intent.SinglePointToMultiPointIntent" ]
import com.google.common.collect.Sets; import java.util.List; import org.onosproject.net.intent.ConnectivityIntent; import org.onosproject.net.intent.HostToHostIntent; import org.onosproject.net.intent.Intent; import org.onosproject.net.intent.IntentState; import org.onosproject.net.intent.LinkCollectionIntent; import org.onosproject.net.intent.MultiPointToSinglePointIntent; import org.onosproject.net.intent.OpticalCircuitIntent; import org.onosproject.net.intent.OpticalConnectivityIntent; import org.onosproject.net.intent.OpticalOduIntent; import org.onosproject.net.intent.PathIntent; import org.onosproject.net.intent.PointToPointIntent; import org.onosproject.net.intent.SinglePointToMultiPointIntent;
import com.google.common.collect.*; import java.util.*; import org.onosproject.net.intent.*;
[ "com.google.common", "java.util", "org.onosproject.net" ]
com.google.common; java.util; org.onosproject.net;
2,269,022
static String replaceParameters(String format, String[] params) throws BadFormatString { Matcher match = parameterPattern.matcher(format); int start = 0; StringBuilder result = new StringBuilder(); while (start < format.length() && match.find(start)) { result.append(match.group(1)); String paramNum = match.group(3); if (paramNum != null) { try { int num = Integer.parseInt(paramNum); if (num < 0 || num >= params.length) { throw new BadFormatString("index " + num + " from " + format + " is outside of the valid range 0 to " + (params.length - 1)); } result.append(params[num]); } catch (NumberFormatException nfe) { throw new BadFormatString("bad format in username mapping in " + paramNum, nfe); } } start = match.end(); } return result.toString(); }
static String replaceParameters(String format, String[] params) throws BadFormatString { Matcher match = parameterPattern.matcher(format); int start = 0; StringBuilder result = new StringBuilder(); while (start < format.length() && match.find(start)) { result.append(match.group(1)); String paramNum = match.group(3); if (paramNum != null) { try { int num = Integer.parseInt(paramNum); if (num < 0 num >= params.length) { throw new BadFormatString(STR + num + STR + format + STR + (params.length - 1)); } result.append(params[num]); } catch (NumberFormatException nfe) { throw new BadFormatString(STR + paramNum, nfe); } } start = match.end(); } return result.toString(); }
/** * Replace the numbered parameters of the form $n where n is from 1 to * the length of params. Normal text is copied directly and $n is replaced * by the corresponding parameter. * @param format the string to replace parameters again * @param params the list of parameters * @return the generated string with the parameter references replaced. * @throws BadFormatString */
Replace the numbered parameters of the form $n where n is from 1 to the length of params. Normal text is copied directly and $n is replaced by the corresponding parameter
replaceParameters
{ "repo_name": "nandakumar131/hadoop", "path": "hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosName.java", "license": "apache-2.0", "size": 15453 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,907,157
@Test @SuppressWarnings("unused") public void GetTeam() throws Exception { MockHttpServletRequest request = getMockHttpServletRequest(); request.setRequestURI("/Team"); MockHttpServletResponse response = getMockHttpServletResponse(); // Get the singleton controller instance TeamRestController controller = (TeamRestController) context.getBean("TeamRestController"); // TODO Invoke method and Assert return values }
@SuppressWarnings(STR) void function() throws Exception { MockHttpServletRequest request = getMockHttpServletRequest(); request.setRequestURI("/Team"); MockHttpServletResponse response = getMockHttpServletResponse(); TeamRestController controller = (TeamRestController) context.getBean(STR); }
/** * Test <code>Team()</code>. */
Test <code>Team()</code>
GetTeam
{ "repo_name": "didoux/Spring-BowlingDB", "path": "generated/bowling/web/rest/TeamRestControllerTest.java", "license": "gpl-2.0", "size": 4862 }
[ "org.springframework.mock.web.MockHttpServletRequest", "org.springframework.mock.web.MockHttpServletResponse" ]
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.*;
[ "org.springframework.mock" ]
org.springframework.mock;
589,732
private void withdrawIntercepts() { TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); selector.matchEthType(Ethernet.TYPE_IPV4); packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId); selector.matchEthType(Ethernet.TYPE_ARP); packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId); selector.matchEthType(Ethernet.TYPE_IPV6); packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId); }
void function() { TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); selector.matchEthType(Ethernet.TYPE_IPV4); packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId); selector.matchEthType(Ethernet.TYPE_ARP); packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId); selector.matchEthType(Ethernet.TYPE_IPV6); packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId); }
/** * Request packet in via PacketService. */
Request packet in via PacketService
withdrawIntercepts
{ "repo_name": "CNlukai/onos-gerrit-test", "path": "apps/fwd/src/main/java/org/onosproject/fwd/ReactiveForwarding.java", "license": "apache-2.0", "size": 26382 }
[ "org.onlab.packet.Ethernet", "org.onosproject.net.flow.DefaultTrafficSelector", "org.onosproject.net.flow.TrafficSelector", "org.onosproject.net.packet.PacketPriority" ]
import org.onlab.packet.Ethernet; import org.onosproject.net.flow.DefaultTrafficSelector; import org.onosproject.net.flow.TrafficSelector; import org.onosproject.net.packet.PacketPriority;
import org.onlab.packet.*; import org.onosproject.net.flow.*; import org.onosproject.net.packet.*;
[ "org.onlab.packet", "org.onosproject.net" ]
org.onlab.packet; org.onosproject.net;
2,397,852
BulkWriteResult bulkWrite(List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options);
BulkWriteResult bulkWrite(List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options);
/** * Executes a mix of inserts, updates, replaces, and deletes. * * @param requests the writes to execute * @param options the options to apply to the bulk write operation * @return the result of the bulk write * @throws com.mongodb.MongoBulkWriteException if there's an exception in the bulk write operation * @throws com.mongodb.MongoException if there's an exception running the operation */
Executes a mix of inserts, updates, replaces, and deletes
bulkWrite
{ "repo_name": "jsonking/mongo-java-driver", "path": "driver/src/main/com/mongodb/client/MongoCollection.java", "license": "apache-2.0", "size": 29839 }
[ "com.mongodb.bulk.BulkWriteResult", "com.mongodb.client.model.BulkWriteOptions", "com.mongodb.client.model.WriteModel", "java.util.List" ]
import com.mongodb.bulk.BulkWriteResult; import com.mongodb.client.model.BulkWriteOptions; import com.mongodb.client.model.WriteModel; import java.util.List;
import com.mongodb.bulk.*; import com.mongodb.client.model.*; import java.util.*;
[ "com.mongodb.bulk", "com.mongodb.client", "java.util" ]
com.mongodb.bulk; com.mongodb.client; java.util;
851,005
public void changeForumOrder(Forum forum) { Forum current = this.getForum(forum.getId()); Forum currentAtOrder = this.findByOrder(forum.getOrder()); Set<Forum> tmpSet = new TreeSet<Forum>(new ForumOrderComparator()); tmpSet.addAll(this.forums); // Remove the forum in the current order // where the changed forum will need to be if (currentAtOrder != null) { tmpSet.remove(currentAtOrder); } tmpSet.add(forum); this.forumsIdMap.put(Integer.valueOf(forum.getId()), forum); // Remove the forum in the position occupied // by the changed forum before its modification, // so then we can add the another forum into // its position if (currentAtOrder != null) { tmpSet.remove(current); currentAtOrder.setOrder(current.getOrder()); tmpSet.add(currentAtOrder); this.forumsIdMap.put(Integer.valueOf(currentAtOrder.getId()), currentAtOrder); } this.forums = tmpSet; }
void function(Forum forum) { Forum current = this.getForum(forum.getId()); Forum currentAtOrder = this.findByOrder(forum.getOrder()); Set<Forum> tmpSet = new TreeSet<Forum>(new ForumOrderComparator()); tmpSet.addAll(this.forums); if (currentAtOrder != null) { tmpSet.remove(currentAtOrder); } tmpSet.add(forum); this.forumsIdMap.put(Integer.valueOf(forum.getId()), forum); if (currentAtOrder != null) { tmpSet.remove(current); currentAtOrder.setOrder(current.getOrder()); tmpSet.add(currentAtOrder); this.forumsIdMap.put(Integer.valueOf(currentAtOrder.getId()), currentAtOrder); } this.forums = tmpSet; }
/** * Changes a forum's display order. * This method changes the position of the * forum in the current display order of the * forum instance passed as argument, if applicable. * * @param forum The forum to change */
Changes a forum's display order. This method changes the position of the forum in the current display order of the forum instance passed as argument, if applicable
changeForumOrder
{ "repo_name": "3mtee/jforum", "path": "target/jforum/src/main/java/net/jforum/entities/Category.java", "license": "bsd-3-clause", "size": 9391 }
[ "java.util.Set", "java.util.TreeSet", "net.jforum.util.ForumOrderComparator" ]
import java.util.Set; import java.util.TreeSet; import net.jforum.util.ForumOrderComparator;
import java.util.*; import net.jforum.util.*;
[ "java.util", "net.jforum.util" ]
java.util; net.jforum.util;
1,719,053
public static AccessorProperty create(final String key, final int propertyFlags, final MethodHandle getter, final MethodHandle setter) { return new AccessorProperty(key, propertyFlags, -1, getter, setter); } protected final MethodHandle primitiveGetter; protected final MethodHandle primitiveSetter; protected final MethodHandle objectGetter; protected final MethodHandle objectSetter; private Class<?> currentType; AccessorProperty(final AccessorProperty property, final Object delegate) { super(property, property.getFlags() | IS_BOUND); this.primitiveGetter = bindTo(property.primitiveGetter, delegate); this.primitiveSetter = bindTo(property.primitiveSetter, delegate); this.objectGetter = bindTo(property.objectGetter, delegate); this.objectSetter = bindTo(property.objectSetter, delegate); property.GETTER_CACHE = new MethodHandle[NOOF_TYPES]; // Properties created this way are bound to a delegate setCurrentType(property.getCurrentType()); } protected AccessorProperty( final String key, final int flags, final int slot, final MethodHandle primitiveGetter, final MethodHandle primitiveSetter, final MethodHandle objectGetter, final MethodHandle objectSetter) { super(key, flags, slot); assert getClass() != AccessorProperty.class; this.primitiveGetter = primitiveGetter; this.primitiveSetter = primitiveSetter; this.objectGetter = objectGetter; this.objectSetter = objectSetter; initializeType(); } private AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) { super(key, flags | (getter.type().returnType().isPrimitive() ? IS_NASGEN_PRIMITIVE : 0), slot); assert !isSpill(); // we don't need to prep the setters these will never be invalidated as this is a nasgen // or known type getter/setter. No invalidations will take place final Class<?> getterType = getter.type().returnType(); final Class<?> setterType = setter == null ? null : setter.type().parameterType(1); assert setterType == null || setterType == getterType; if (OBJECT_FIELDS_ONLY) { primitiveGetter = primitiveSetter = null; } else { if (getterType == int.class || getterType == long.class) { primitiveGetter = MH.asType(getter, Lookup.GET_PRIMITIVE_TYPE); primitiveSetter = setter == null ? null : MH.asType(setter, Lookup.SET_PRIMITIVE_TYPE); } else if (getterType == double.class) { primitiveGetter = MH.asType(MH.filterReturnValue(getter, ObjectClassGenerator.PACK_DOUBLE), Lookup.GET_PRIMITIVE_TYPE); primitiveSetter = setter == null ? null : MH.asType(MH.filterArguments(setter, 1, ObjectClassGenerator.UNPACK_DOUBLE), Lookup.SET_PRIMITIVE_TYPE); } else { primitiveGetter = primitiveSetter = null; } } assert primitiveGetter == null || primitiveGetter.type() == Lookup.GET_PRIMITIVE_TYPE : primitiveGetter + "!=" + Lookup.GET_PRIMITIVE_TYPE; assert primitiveSetter == null || primitiveSetter.type() == Lookup.SET_PRIMITIVE_TYPE : primitiveSetter; objectGetter = getter.type() != Lookup.GET_OBJECT_TYPE ? MH.asType(getter, Lookup.GET_OBJECT_TYPE) : getter; objectSetter = setter != null && setter.type() != Lookup.SET_OBJECT_TYPE ? MH.asType(setter, Lookup.SET_OBJECT_TYPE) : setter; setCurrentType(OBJECT_FIELDS_ONLY ? Object.class : getterType); } public AccessorProperty(final String key, final int flags, final Class<?> structure, final int slot) { super(key, flags, slot); if (isParameter() && hasArguments()) { //parameters are always stored in an object array, which may or may not be a good idea final MethodHandle arguments = MH.getter(LOOKUP, structure, "arguments", ScriptObject.class); objectGetter = MH.asType(MH.insertArguments(MH.filterArguments(ScriptObject.GET_ARGUMENT.methodHandle(), 0, arguments), 1, slot), Lookup.GET_OBJECT_TYPE); objectSetter = MH.asType(MH.insertArguments(MH.filterArguments(ScriptObject.SET_ARGUMENT.methodHandle(), 0, arguments), 1, slot), Lookup.SET_OBJECT_TYPE); primitiveGetter = null; primitiveSetter = null; } else { final Accessors gs = GETTERS_SETTERS.get(structure); objectGetter = gs.objectGetters[slot]; primitiveGetter = gs.primitiveGetters[slot]; objectSetter = gs.objectSetters[slot]; primitiveSetter = gs.primitiveSetters[slot]; } initializeType(); } protected AccessorProperty(final String key, final int flags, final int slot, final ScriptObject owner, final Object initialValue) { this(key, flags, owner.getClass(), slot); setInitialValue(owner, initialValue); } public AccessorProperty(final String key, final int flags, final Class<?> structure, final int slot, final Class<?> initialType) { this(key, flags, structure, slot); setCurrentType(OBJECT_FIELDS_ONLY ? Object.class : initialType); } protected AccessorProperty(final AccessorProperty property, final Class<?> newType) { super(property, property.getFlags()); this.GETTER_CACHE = newType != property.getCurrentType() ? new MethodHandle[NOOF_TYPES] : property.GETTER_CACHE; this.primitiveGetter = property.primitiveGetter; this.primitiveSetter = property.primitiveSetter; this.objectGetter = property.objectGetter; this.objectSetter = property.objectSetter; setCurrentType(newType); } protected AccessorProperty(final AccessorProperty property) { this(property, property.getCurrentType()); }
static AccessorProperty function(final String key, final int propertyFlags, final MethodHandle getter, final MethodHandle setter) { return new AccessorProperty(key, propertyFlags, -1, getter, setter); } protected final MethodHandle primitiveGetter; protected final MethodHandle primitiveSetter; protected final MethodHandle objectGetter; protected final MethodHandle objectSetter; private Class<?> currentType; AccessorProperty(final AccessorProperty property, final Object delegate) { super(property, property.getFlags() IS_BOUND); this.primitiveGetter = bindTo(property.primitiveGetter, delegate); this.primitiveSetter = bindTo(property.primitiveSetter, delegate); this.objectGetter = bindTo(property.objectGetter, delegate); this.objectSetter = bindTo(property.objectSetter, delegate); property.GETTER_CACHE = new MethodHandle[NOOF_TYPES]; setCurrentType(property.getCurrentType()); } protected AccessorProperty( final String key, final int flags, final int slot, final MethodHandle primitiveGetter, final MethodHandle primitiveSetter, final MethodHandle objectGetter, final MethodHandle objectSetter) { super(key, flags, slot); assert getClass() != AccessorProperty.class; this.primitiveGetter = primitiveGetter; this.primitiveSetter = primitiveSetter; this.objectGetter = objectGetter; this.objectSetter = objectSetter; initializeType(); } private AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) { super(key, flags (getter.type().returnType().isPrimitive() ? IS_NASGEN_PRIMITIVE : 0), slot); assert !isSpill(); final Class<?> getterType = getter.type().returnType(); final Class<?> setterType = setter == null ? null : setter.type().parameterType(1); assert setterType == null setterType == getterType; if (OBJECT_FIELDS_ONLY) { primitiveGetter = primitiveSetter = null; } else { if (getterType == int.class getterType == long.class) { primitiveGetter = MH.asType(getter, Lookup.GET_PRIMITIVE_TYPE); primitiveSetter = setter == null ? null : MH.asType(setter, Lookup.SET_PRIMITIVE_TYPE); } else if (getterType == double.class) { primitiveGetter = MH.asType(MH.filterReturnValue(getter, ObjectClassGenerator.PACK_DOUBLE), Lookup.GET_PRIMITIVE_TYPE); primitiveSetter = setter == null ? null : MH.asType(MH.filterArguments(setter, 1, ObjectClassGenerator.UNPACK_DOUBLE), Lookup.SET_PRIMITIVE_TYPE); } else { primitiveGetter = primitiveSetter = null; } } assert primitiveGetter == null primitiveGetter.type() == Lookup.GET_PRIMITIVE_TYPE : primitiveGetter + "!=" + Lookup.GET_PRIMITIVE_TYPE; assert primitiveSetter == null primitiveSetter.type() == Lookup.SET_PRIMITIVE_TYPE : primitiveSetter; objectGetter = getter.type() != Lookup.GET_OBJECT_TYPE ? MH.asType(getter, Lookup.GET_OBJECT_TYPE) : getter; objectSetter = setter != null && setter.type() != Lookup.SET_OBJECT_TYPE ? MH.asType(setter, Lookup.SET_OBJECT_TYPE) : setter; setCurrentType(OBJECT_FIELDS_ONLY ? Object.class : getterType); } public AccessorProperty(final String key, final int flags, final Class<?> structure, final int slot) { super(key, flags, slot); if (isParameter() && hasArguments()) { final MethodHandle arguments = MH.getter(LOOKUP, structure, STR, ScriptObject.class); objectGetter = MH.asType(MH.insertArguments(MH.filterArguments(ScriptObject.GET_ARGUMENT.methodHandle(), 0, arguments), 1, slot), Lookup.GET_OBJECT_TYPE); objectSetter = MH.asType(MH.insertArguments(MH.filterArguments(ScriptObject.SET_ARGUMENT.methodHandle(), 0, arguments), 1, slot), Lookup.SET_OBJECT_TYPE); primitiveGetter = null; primitiveSetter = null; } else { final Accessors gs = GETTERS_SETTERS.get(structure); objectGetter = gs.objectGetters[slot]; primitiveGetter = gs.primitiveGetters[slot]; objectSetter = gs.objectSetters[slot]; primitiveSetter = gs.primitiveSetters[slot]; } initializeType(); } protected AccessorProperty(final String key, final int flags, final int slot, final ScriptObject owner, final Object initialValue) { this(key, flags, owner.getClass(), slot); setInitialValue(owner, initialValue); } public AccessorProperty(final String key, final int flags, final Class<?> structure, final int slot, final Class<?> initialType) { this(key, flags, structure, slot); setCurrentType(OBJECT_FIELDS_ONLY ? Object.class : initialType); } protected AccessorProperty(final AccessorProperty property, final Class<?> newType) { super(property, property.getFlags()); this.GETTER_CACHE = newType != property.getCurrentType() ? new MethodHandle[NOOF_TYPES] : property.GETTER_CACHE; this.primitiveGetter = property.primitiveGetter; this.primitiveSetter = property.primitiveSetter; this.objectGetter = property.objectGetter; this.objectSetter = property.objectSetter; setCurrentType(newType); } protected AccessorProperty(final AccessorProperty property) { this(property, property.getCurrentType()); }
/** * Create a new accessor property. Factory method used by nasgen generated code. * * @param key {@link Property} key. * @param propertyFlags {@link Property} flags. * @param getter {@link Property} get accessor method. * @param setter {@link Property} set accessor method. * * @return New {@link AccessorProperty} created. */
Create a new accessor property. Factory method used by nasgen generated code
create
{ "repo_name": "hazzik/nashorn", "path": "src/jdk/nashorn/internal/runtime/AccessorProperty.java", "license": "gpl-2.0", "size": 30979 }
[ "java.lang.invoke.MethodHandle" ]
import java.lang.invoke.MethodHandle;
import java.lang.invoke.*;
[ "java.lang" ]
java.lang;
1,220,635
public static FeedStatus feedStatus(List<FeedHealth> feedHealth) { DefaultFeedStatus status = new DefaultFeedStatus(feedHealth); return status; }
static FeedStatus function(List<FeedHealth> feedHealth) { DefaultFeedStatus status = new DefaultFeedStatus(feedHealth); return status; }
/** * Transform the list of FeedHealth objects to a FeedStatus object summarizing the feeds. * * @return the FeedStatus summarizing the Feeds for the list of FeedHealth objects */
Transform the list of FeedHealth objects to a FeedStatus object summarizing the feeds
feedStatus
{ "repo_name": "peter-gergely-horvath/kylo", "path": "core/job-repository/job-repository-core/src/main/java/com/thinkbiganalytics/jobrepo/query/model/transform/FeedModelTransform.java", "license": "apache-2.0", "size": 8337 }
[ "com.thinkbiganalytics.jobrepo.query.model.DefaultFeedStatus", "com.thinkbiganalytics.jobrepo.query.model.FeedHealth", "com.thinkbiganalytics.jobrepo.query.model.FeedStatus", "java.util.List" ]
import com.thinkbiganalytics.jobrepo.query.model.DefaultFeedStatus; import com.thinkbiganalytics.jobrepo.query.model.FeedHealth; import com.thinkbiganalytics.jobrepo.query.model.FeedStatus; import java.util.List;
import com.thinkbiganalytics.jobrepo.query.model.*; import java.util.*;
[ "com.thinkbiganalytics.jobrepo", "java.util" ]
com.thinkbiganalytics.jobrepo; java.util;
1,226,473
public static final ArtifactOrigin unknown(Artifact artifact) { return new ArtifactOrigin(artifact, false, UNKNOWN); }
static final ArtifactOrigin function(Artifact artifact) { return new ArtifactOrigin(artifact, false, UNKNOWN); }
/** * ArtifactOrigin instance used when the origin is unknown. * * @param artifact ditto * @return ArtifactOrigin */
ArtifactOrigin instance used when the origin is unknown
unknown
{ "repo_name": "jaikiran/ant-ivy", "path": "src/java/org/apache/ivy/core/cache/ArtifactOrigin.java", "license": "apache-2.0", "size": 5367 }
[ "org.apache.ivy.core.module.descriptor.Artifact" ]
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.*;
[ "org.apache.ivy" ]
org.apache.ivy;
1,638,958
@Override protected void initialize() { super.initialize(); m_LastPath = new String[0]; m_RendererCache = new HashMap<>(); }
void function() { super.initialize(); m_LastPath = new String[0]; m_RendererCache = new HashMap<>(); }
/** * Initializes the members. */
Initializes the members
initialize
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-core/src/main/java/adams/gui/visualization/debug/InspectionPanel.java", "license": "gpl-3.0", "size": 6881 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,677,500
final RosterItem item = new RosterItem(uri(packet.getAttribute("jid")), parseSubscriptionState(packet.getAttribute("subscription")), packet.getAttribute("name"), parseAsk(packet.getAttribute("ask"))); for (final XMLPacket group : packet.getChildren("group")) { item.addToGroup(group.getText()); } return item; }
final RosterItem item = new RosterItem(uri(packet.getAttribute("jid")), parseSubscriptionState(packet.getAttribute(STR)), packet.getAttribute("name"), parseAsk(packet.getAttribute("ask"))); for (final XMLPacket group : packet.getChildren("group")) { item.addToGroup(group.getText()); } return item; }
/** * Create a new RosterItem based on given a <item> stanza * * @param packet * the stanza * @return a new roster item instance */
Create a new RosterItem based on given a stanza
parse
{ "repo_name": "EmiteGWT/emite", "path": "src/main/java/com/calclab/emite/im/roster/RosterItem.java", "license": "lgpl-3.0", "size": 8625 }
[ "com.calclab.emite.base.xml.XMLPacket" ]
import com.calclab.emite.base.xml.XMLPacket;
import com.calclab.emite.base.xml.*;
[ "com.calclab.emite" ]
com.calclab.emite;
879,114
public void deleteApplication(String clientId) throws DCRMException { OAuthConsumerAppDTO appDTO = getApplicationById(clientId); String applicationOwner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String spName; try { spName = DCRDataHolder.getInstance().getApplicationManagementService() .getServiceProviderNameByClientId(appDTO.getOauthConsumerKey(), DCRMConstants.OAUTH2, tenantDomain); } catch (IdentityApplicationManagementException e) { throw new DCRMException("Error while retrieving the service provider.", e); } // If a SP name returned for the client ID then the application has an associated service provider. if (!StringUtils.equals(spName, IdentityApplicationConstants.DEFAULT_SP_CONFIG)) { if (log.isDebugEnabled()) { log.debug("The application with consumer key: " + appDTO.getOauthConsumerKey() + " has an association with the service provider: " + spName); } deleteServiceProvider(spName, tenantDomain, applicationOwner); } else { if (log.isDebugEnabled()) { log.debug("The application with consumer key: " + appDTO.getOauthConsumerKey() + " doesn't have an associated service provider."); } deleteOAuthApplicationWithoutAssociatedSP(appDTO, tenantDomain, applicationOwner); } }
void function(String clientId) throws DCRMException { OAuthConsumerAppDTO appDTO = getApplicationById(clientId); String applicationOwner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String spName; try { spName = DCRDataHolder.getInstance().getApplicationManagementService() .getServiceProviderNameByClientId(appDTO.getOauthConsumerKey(), DCRMConstants.OAUTH2, tenantDomain); } catch (IdentityApplicationManagementException e) { throw new DCRMException(STR, e); } if (!StringUtils.equals(spName, IdentityApplicationConstants.DEFAULT_SP_CONFIG)) { if (log.isDebugEnabled()) { log.debug(STR + appDTO.getOauthConsumerKey() + STR + spName); } deleteServiceProvider(spName, tenantDomain, applicationOwner); } else { if (log.isDebugEnabled()) { log.debug(STR + appDTO.getOauthConsumerKey() + STR); } deleteOAuthApplicationWithoutAssociatedSP(appDTO, tenantDomain, applicationOwner); } }
/** * Delete OAuth2/OIDC application with client_id. * * @param clientId * @throws DCRMException */
Delete OAuth2/OIDC application with client_id
deleteApplication
{ "repo_name": "IsuraD/identity-inbound-auth-oauth", "path": "components/org.wso2.carbon.identity.oauth.dcr/src/main/java/org/wso2/carbon/identity/oauth/dcr/service/DCRMService.java", "license": "apache-2.0", "size": 31159 }
[ "org.apache.commons.lang.StringUtils", "org.wso2.carbon.context.PrivilegedCarbonContext", "org.wso2.carbon.identity.application.common.IdentityApplicationManagementException", "org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants", "org.wso2.carbon.identity.oauth.dcr.DCRMConstants", "org.wso2.carbon.identity.oauth.dcr.exception.DCRMException", "org.wso2.carbon.identity.oauth.dcr.internal.DCRDataHolder", "org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO" ]
import org.apache.commons.lang.StringUtils; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException; import org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants; import org.wso2.carbon.identity.oauth.dcr.DCRMConstants; import org.wso2.carbon.identity.oauth.dcr.exception.DCRMException; import org.wso2.carbon.identity.oauth.dcr.internal.DCRDataHolder; import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO;
import org.apache.commons.lang.*; import org.wso2.carbon.context.*; import org.wso2.carbon.identity.application.common.*; import org.wso2.carbon.identity.application.common.util.*; import org.wso2.carbon.identity.oauth.dcr.*; import org.wso2.carbon.identity.oauth.dcr.exception.*; import org.wso2.carbon.identity.oauth.dcr.internal.*; import org.wso2.carbon.identity.oauth.dto.*;
[ "org.apache.commons", "org.wso2.carbon" ]
org.apache.commons; org.wso2.carbon;
1,323,435
public JSONArray put(Map value) { put(new JSONObject(value)); return this; }
JSONArray function(Map value) { put(new JSONObject(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map. * @param value A Map value. * @return this. */
Put a value in the JSONArray, where the value will be a JSONObject which is produced from a Map
put
{ "repo_name": "Appverse/appverse-mobile", "path": "appverse-samples/Weather_WP/UnityRuntimeWindowsPhone/Html/app/plugins/appverse-widget/src/com/gft/appverse/widget/json/JSONArray.java", "license": "mpl-2.0", "size": 29947 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,372,280
public void assertPredecessorClosureSameContents( Artifact artifact, FileType fType, Iterable<String> common, String... expectedPredecessors) { assertSameContentsWithCommonElements( actionsTestUtil().predecessorClosureAsCollection(artifact, fType), expectedPredecessors, common); }
void function( Artifact artifact, FileType fType, Iterable<String> common, String... expectedPredecessors) { assertSameContentsWithCommonElements( actionsTestUtil().predecessorClosureAsCollection(artifact, fType), expectedPredecessors, common); }
/** * Asserts that the predecessor closure of the given Artifact contains the same elements as those * in expectedPredecessors, plus the given common predecessors. Only looks at predecessors of * the given file type. */
Asserts that the predecessor closure of the given Artifact contains the same elements as those in expectedPredecessors, plus the given common predecessors. Only looks at predecessors of the given file type
assertPredecessorClosureSameContents
{ "repo_name": "mrdomino/bazel", "path": "src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java", "license": "apache-2.0", "size": 77290 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.util.FileType" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.util.FileType;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.util.*;
[ "com.google.devtools" ]
com.google.devtools;
2,373,966
public T getValue(Tag<?> tag) throws IllegalArgumentException;
T function(Tag<?> tag) throws IllegalArgumentException;
/** * Get the value of this field from the given tag * * @param tag The tag to use * @return The value * @throws IllegalArgumentException when the tag is of the wrong type */
Get the value of this field from the given tag
getValue
{ "repo_name": "flow/nbt", "path": "src/main/java/com/flowpowered/nbt/holder/Field.java", "license": "mit", "size": 1887 }
[ "com.flowpowered.nbt.Tag" ]
import com.flowpowered.nbt.Tag;
import com.flowpowered.nbt.*;
[ "com.flowpowered.nbt" ]
com.flowpowered.nbt;
612,584
public String addDummyCreditCard(String billingAddressId) throws TimeoutException { return setCreditCard(createDummyCreditCard(billingAddressId)); }
String function(String billingAddressId) throws TimeoutException { return setCreditCard(createDummyCreditCard(billingAddressId)); }
/** * Add a credit card with dummy data to the PersonalDataManager. * * @param billingAddressId The billing address profile GUID. * @return the GUID of the created credit card */
Add a credit card with dummy data to the PersonalDataManager
addDummyCreditCard
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java", "license": "bsd-3-clause", "size": 17505 }
[ "java.util.concurrent.TimeoutException" ]
import java.util.concurrent.TimeoutException;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
941,074
public void getTwoPosts() { //mPostService = crowdmap.postService(); Posts posts = mPostService.offset(0).limit(1).getPosts(); System.out.println("Size " + posts.getPosts().size()); }
void function() { Posts posts = mPostService.offset(0).limit(1).getPosts(); System.out.println(STR + posts.getPosts().size()); }
/** * Example on how to make paginated queries */
Example on how to make paginated queries
getTwoPosts
{ "repo_name": "ushahidi/Crowdmap-Java", "path": "src/examples/java/com/crowdmap/java/sdk/examples/PostServiceExample.java", "license": "mit", "size": 4274 }
[ "com.crowdmap.java.sdk.json.Posts" ]
import com.crowdmap.java.sdk.json.Posts;
import com.crowdmap.java.sdk.json.*;
[ "com.crowdmap.java" ]
com.crowdmap.java;
733,070
public void testCertPathValidator12() throws CertificateException, NoSuchProviderException, NoSuchAlgorithmException, CertPathValidatorException, InvalidAlgorithmParameterException { if (!PKIXSupport) { fail(NotSupportMsg); return; } CertPathValidatorSpi spi = new MyCertPathValidatorSpi(); CertPathValidator certPV = new myCertPathValidator(spi, defaultProvider, defaultType); assertEquals("Incorrect algorithm", certPV.getAlgorithm(), defaultType); assertEquals("Incorrect provider", certPV.getProvider(), defaultProvider); certPV.validate(null, null); try { certPV.validate(null, null); fail("CertPathValidatorException must be thrown"); } catch (CertPathValidatorException e) { } certPV = new myCertPathValidator(null, null, null); assertNull("Incorrect algorithm", certPV.getAlgorithm()); assertNull("Incorrect provider", certPV.getProvider()); try { certPV.validate(null, null); fail("NullPointerException must be thrown"); } catch (NullPointerException e) { } } } class myCertPathValidator extends CertPathValidator { public myCertPathValidator(CertPathValidatorSpi spi, Provider prov, String type) { super(spi, prov, type); } }
void function() throws CertificateException, NoSuchProviderException, NoSuchAlgorithmException, CertPathValidatorException, InvalidAlgorithmParameterException { if (!PKIXSupport) { fail(NotSupportMsg); return; } CertPathValidatorSpi spi = new MyCertPathValidatorSpi(); CertPathValidator certPV = new myCertPathValidator(spi, defaultProvider, defaultType); assertEquals(STR, certPV.getAlgorithm(), defaultType); assertEquals(STR, certPV.getProvider(), defaultProvider); certPV.validate(null, null); try { certPV.validate(null, null); fail(STR); } catch (CertPathValidatorException e) { } certPV = new myCertPathValidator(null, null, null); assertNull(STR, certPV.getAlgorithm()); assertNull(STR, certPV.getProvider()); try { certPV.validate(null, null); fail(STR); } catch (NullPointerException e) { } } } class myCertPathValidator extends CertPathValidator { public myCertPathValidator(CertPathValidatorSpi spi, Provider prov, String type) { super(spi, prov, type); } }
/** * Test for * <code>CertPathValidator</code> constructor * Assertion: returns CertPathValidator object */
Test for <code>CertPathValidator</code> constructor Assertion: returns CertPathValidator object
testCertPathValidator12
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "external/apache-harmony/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertPathValidator1Test.java", "license": "gpl-3.0", "size": 14934 }
[ "java.security.InvalidAlgorithmParameterException", "java.security.NoSuchAlgorithmException", "java.security.NoSuchProviderException", "java.security.Provider", "java.security.cert.CertPathValidator", "java.security.cert.CertPathValidatorException", "java.security.cert.CertPathValidatorSpi", "java.security.cert.CertificateException", "org.apache.harmony.security.tests.support.cert.MyCertPathValidatorSpi" ]
import java.security.InvalidAlgorithmParameterException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.Provider; import java.security.cert.CertPathValidator; import java.security.cert.CertPathValidatorException; import java.security.cert.CertPathValidatorSpi; import java.security.cert.CertificateException; import org.apache.harmony.security.tests.support.cert.MyCertPathValidatorSpi;
import java.security.*; import java.security.cert.*; import org.apache.harmony.security.tests.support.cert.*;
[ "java.security", "org.apache.harmony" ]
java.security; org.apache.harmony;
2,134,053
public void setExpressionFunctions(List<String> expressionFunctions) { this.expressionFunctions = expressionFunctions; }
void function(List<String> expressionFunctions) { this.expressionFunctions = expressionFunctions; }
/** * Set list of import classes/method should should be made statically available to expression to use. * For ex. org.apache.apex.test1.Test would mean that "Test" method will be available in the expression to be * used directly. * This is an optional property. See constructor to see defaults that are included. * * @param expressionFunctions List of qualified class/method that needs to be imported to expression. */
Set list of import classes/method should should be made statically available to expression to use. For ex. org.apache.apex.test1.Test would mean that "Test" method will be available in the expression to be used directly. This is an optional property. See constructor to see defaults that are included
setExpressionFunctions
{ "repo_name": "ilganeli/incubator-apex-malhar", "path": "library/src/main/java/com/datatorrent/lib/transform/TransformOperator.java", "license": "apache-2.0", "size": 8140 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,522,681
public String getSourceIPAddress() { return (String) get(CloudTrailEventField.sourceIPAddress.name()); }
String function() { return (String) get(CloudTrailEventField.sourceIPAddress.name()); }
/** * Get the source IP address for this event. * <p> * For actions that originate from the service console, the address reported is for the underlying customer * resource, not the console web server. For services in AWS, only the DNS name is displayed. * </p> * @return The apparent IP address that the request was made from. */
Get the source IP address for this event. For actions that originate from the service console, the address reported is for the underlying customer resource, not the console web server. For services in AWS, only the DNS name is displayed.
getSourceIPAddress
{ "repo_name": "aws/aws-cloudtrail-processing-library", "path": "src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/model/CloudTrailEventData.java", "license": "apache-2.0", "size": 13243 }
[ "com.amazonaws.services.cloudtrail.processinglibrary.model.internal.CloudTrailEventField" ]
import com.amazonaws.services.cloudtrail.processinglibrary.model.internal.CloudTrailEventField;
import com.amazonaws.services.cloudtrail.processinglibrary.model.internal.*;
[ "com.amazonaws.services" ]
com.amazonaws.services;
2,097,310
public String encodeToString(byte[] pArray) { return StringUtils.newStringUtf8(encode(pArray)); }
String function(byte[] pArray) { return StringUtils.newStringUtf8(encode(pArray)); }
/** * Encodes a byte[] containing binary data, into a String containing characters in the Base64 alphabet. * * @param pArray * a byte array containing binary data * @return A String containing only Base64 character data * @since 1.4 */
Encodes a byte[] containing binary data, into a String containing characters in the Base64 alphabet
encodeToString
{ "repo_name": "Cantal0p3/Networking-Aircasting", "path": "src/main/java/pl/llp/aircasting/util/base64/Base64.java", "license": "gpl-3.0", "size": 40754 }
[ "org.apache.commons.codec.binary.StringUtils" ]
import org.apache.commons.codec.binary.StringUtils;
import org.apache.commons.codec.binary.*;
[ "org.apache.commons" ]
org.apache.commons;
415,495
public ListenerContainer<NodeCacheExtendedListener> getListenable() { Preconditions.checkState(state.get() != State.CLOSED, "Closed"); return listeners; }
ListenerContainer<NodeCacheExtendedListener> function() { Preconditions.checkState(state.get() != State.CLOSED, STR); return listeners; }
/** * Return the cache listenable * * @return listenable */
Return the cache listenable
getListenable
{ "repo_name": "jludvice/fabric8", "path": "fabric/fabric-zookeeper/src/main/java/org/apache/curator/framework/recipes/cache/NodeCacheExtended.java", "license": "apache-2.0", "size": 10616 }
[ "com.google.common.base.Preconditions", "org.apache.curator.framework.listen.ListenerContainer" ]
import com.google.common.base.Preconditions; import org.apache.curator.framework.listen.ListenerContainer;
import com.google.common.base.*; import org.apache.curator.framework.listen.*;
[ "com.google.common", "org.apache.curator" ]
com.google.common; org.apache.curator;
1,164,096
private void tryRemoveArgFromCallSites( Node function, int argIndex, boolean canModifyAllSites) { Definition definition = getFunctionDefinition(function); for (UseSite site : defFinder.getUseSites(definition)) { if (isModifiableCallSite(site)) { Node arg = getArgumentForCallOrNewOrDotCall(site, argIndex); if (arg != null) { // Even if we can't change the signature in general we can always // remove an unused value off the end of the parameter list. if (canModifyAllSites || (arg.getNext() == null && !NodeUtil.mayHaveSideEffects(arg, compiler))) { toRemove.add(arg); } else { // replace the node in the arg with 0 if (!NodeUtil.mayHaveSideEffects(arg, compiler) && (!arg.isNumber() || arg.getDouble() != 0)) { toReplaceWithZero.add(arg); } } } } } }
void function( Node function, int argIndex, boolean canModifyAllSites) { Definition definition = getFunctionDefinition(function); for (UseSite site : defFinder.getUseSites(definition)) { if (isModifiableCallSite(site)) { Node arg = getArgumentForCallOrNewOrDotCall(site, argIndex); if (arg != null) { if (canModifyAllSites (arg.getNext() == null && !NodeUtil.mayHaveSideEffects(arg, compiler))) { toRemove.add(arg); } else { if (!NodeUtil.mayHaveSideEffects(arg, compiler) && (!arg.isNumber() arg.getDouble() != 0)) { toReplaceWithZero.add(arg); } } } } } }
/** * Remove all references to a parameter if possible otherwise simplify the * side-effect free parameters. */
Remove all references to a parameter if possible otherwise simplify the side-effect free parameters
tryRemoveArgFromCallSites
{ "repo_name": "LorenzoDV/closure-compiler", "path": "src/com/google/javascript/jscomp/RemoveUnusedVars.java", "license": "apache-2.0", "size": 35450 }
[ "com.google.javascript.jscomp.DefinitionsRemover", "com.google.javascript.rhino.Node" ]
import com.google.javascript.jscomp.DefinitionsRemover; import com.google.javascript.rhino.Node;
import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
79,358
void setNextBitmap( Bitmap bitmap, boolean update, Matrix matrix ) { logger.log( "setNextBitmap", bitmap, update, matrix ); if ( null != mBitmapChangeListener ) mBitmapChangeListener.onBitmapChange( bitmap, update, matrix ); if ( !mBitmap.equals( bitmap ) && !mBitmap.isRecycled() ) { logger.warn( "[recycle] original Bitmap: " + mBitmap ); mBitmap.recycle(); mBitmap = null; } mBitmap = bitmap; }
void setNextBitmap( Bitmap bitmap, boolean update, Matrix matrix ) { logger.log( STR, bitmap, update, matrix ); if ( null != mBitmapChangeListener ) mBitmapChangeListener.onBitmapChange( bitmap, update, matrix ); if ( !mBitmap.equals( bitmap ) && !mBitmap.isRecycled() ) { logger.warn( STR + mBitmap ); mBitmap.recycle(); mBitmap = null; } mBitmap = bitmap; }
/** * Sets the next bitmap. * * @param bitmap * the bitmap * @param update * the update * @param matrix * the matrix */
Sets the next bitmap
setNextBitmap
{ "repo_name": "dacopan/PhotoWord", "path": "android/Aviary-SDK/src/com/aviary/android/feather/AviaryMainController.java", "license": "gpl-3.0", "size": 31319 }
[ "android.graphics.Bitmap", "android.graphics.Matrix" ]
import android.graphics.Bitmap; import android.graphics.Matrix;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,902,742
public static BitSet complement(BitSet bits, DAlphabet alphabet, int seq_length){ int encoding_size = getRequiredEncodingBits(alphabet); BitSet new_seq = new BitSet(seq_length * encoding_size + 1); int code; char ch; for(int i=0;i<seq_length;i++){ code = decode(bits, encoding_size, i); ch = alphabet.getSymbol(code).getChar(); ch = DAlphabetUtils.complement(ch); code = alphabet.getSymbol(ch).getCode(); encode(new_seq, code, encoding_size, i); } return new_seq; }
static BitSet function(BitSet bits, DAlphabet alphabet, int seq_length){ int encoding_size = getRequiredEncodingBits(alphabet); BitSet new_seq = new BitSet(seq_length * encoding_size + 1); int code; char ch; for(int i=0;i<seq_length;i++){ code = decode(bits, encoding_size, i); ch = alphabet.getSymbol(code).getChar(); ch = DAlphabetUtils.complement(ch); code = alphabet.getSymbol(ch).getCode(); encode(new_seq, code, encoding_size, i); } return new_seq; }
/** * Complement a BitSet while respecting its binary encoding. * * @param bits the binary representation of a sequence * @param alphabet the alphabet. * @param seq_length size of the sequence * * @return the complement representation of a sequence * */
Complement a BitSet while respecting its binary encoding
complement
{ "repo_name": "pgdurand/Bioinformatics-Core-API", "path": "src/bzh/plealog/bioinfo/util/BinCodec.java", "license": "agpl-3.0", "size": 7662 }
[ "java.util.BitSet" ]
import java.util.BitSet;
import java.util.*;
[ "java.util" ]
java.util;
466,760
public void releaseSmileyPanel() { setPanelGone(); mFlipper.setOnFlipperListner(null); mFlipper.setOnCCPFlipperMeasureListener(null); if(mArrayList != null && mArrayList.size() > 0) { Iterator<EmojiGrid> iterator = mArrayList.iterator(); while (iterator.hasNext()) { EmojiGrid emojiGrid = iterator.next(); if(emojiGrid != null) emojiGrid.releaseEmojiView(); } mArrayList.clear(); } mFlipper = null; mDotView = null; }
void function() { setPanelGone(); mFlipper.setOnFlipperListner(null); mFlipper.setOnCCPFlipperMeasureListener(null); if(mArrayList != null && mArrayList.size() > 0) { Iterator<EmojiGrid> iterator = mArrayList.iterator(); while (iterator.hasNext()) { EmojiGrid emojiGrid = iterator.next(); if(emojiGrid != null) emojiGrid.releaseEmojiView(); } mArrayList.clear(); } mFlipper = null; mDotView = null; }
/** * release SmileyPanel view. */
release SmileyPanel view
releaseSmileyPanel
{ "repo_name": "darlyhellen/oto", "path": "DLClent_A/src/com/darly/im/ui/chatting/view/SmileyPanel.java", "license": "apache-2.0", "size": 8134 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,366,973
@Test public void testThreadExecutionTimeoutWithNoFallback() { testExecutionTimeoutWithNoFallback(ExecutionIsolationStrategy.THREAD); }
void function() { testExecutionTimeoutWithNoFallback(ExecutionIsolationStrategy.THREAD); }
/** * Test a thread command execution timeout where the command didn't implement getFallback. */
Test a thread command execution timeout where the command didn't implement getFallback
testThreadExecutionTimeoutWithNoFallback
{ "repo_name": "sasrin/Hystrix", "path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java", "license": "apache-2.0", "size": 272384 }
[ "com.netflix.hystrix.HystrixCommandProperties" ]
import com.netflix.hystrix.HystrixCommandProperties;
import com.netflix.hystrix.*;
[ "com.netflix.hystrix" ]
com.netflix.hystrix;
2,069,754
File get(String imageUri);
File get(String imageUri);
/** * Returns file of cached image * * @param imageUri Original image URI * @return File of cached image or <b>null</b> if image wasn't cached */
Returns file of cached image
get
{ "repo_name": "haodynasty/BasePlusubLib", "path": "PlusubBaseLib/src/main/java/com/nostra13/universalimageloader/cache/disc/DiskCache.java", "license": "apache-2.0", "size": 2928 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
160,422
public void setChart(JFreeChart chart) { this.chart = chart; }
void function(JFreeChart chart) { this.chart = chart; }
/** * Sets the chart that generated the change event. * * @param chart the chart that generated the event. */
Sets the chart that generated the change event
setChart
{ "repo_name": "SpoonLabs/astor", "path": "examples/chart_11/source/org/jfree/chart/event/ChartChangeEvent.java", "license": "gpl-2.0", "size": 4206 }
[ "org.jfree.chart.JFreeChart" ]
import org.jfree.chart.JFreeChart;
import org.jfree.chart.*;
[ "org.jfree.chart" ]
org.jfree.chart;
424,672
public static void main(String[] args) throws Exception { DataHandlerParameter parameter = new DataHandlerParameter(); parameter.setProperty(ParametersEnum.BUFFERSIZE, 4); // optional parameter.setProperty(ParametersEnum.DELIMITER, Constants.DELIMETER); // optional List<Object> values = new ArrayList<Object>(); values.add("aaaaa"); values.add(1); values.add(5L); values.add(new NameValueBean("name", "value")); values.add("eeeee"); values.add("fffff"); AbstractDataHandler handler = DataHandlerFactory.getDataHandler(HandlerTypeEnum.CSV, parameter, "F:/Export_Home/abc.csv"); handler.openFile(); handler.appendData(values); handler.appendData(values); handler.appendData(values); handler.appendData(values); handler.appendData(values); handler.appendData(values); handler.closeFile(); //System.out.println("DONE........."); }
static void function(String[] args) throws Exception { DataHandlerParameter parameter = new DataHandlerParameter(); parameter.setProperty(ParametersEnum.BUFFERSIZE, 4); parameter.setProperty(ParametersEnum.DELIMITER, Constants.DELIMETER); List<Object> values = new ArrayList<Object>(); values.add("aaaaa"); values.add(1); values.add(5L); values.add(new NameValueBean("name", "value")); values.add("eeeee"); values.add("fffff"); AbstractDataHandler handler = DataHandlerFactory.getDataHandler(HandlerTypeEnum.CSV, parameter, STR); handler.openFile(); handler.appendData(values); handler.appendData(values); handler.appendData(values); handler.appendData(values); handler.appendData(values); handler.appendData(values); handler.closeFile(); }
/** * This is the main method. * @param args Arguments pass to the main. * @throws Exception throw Exception */
This is the main method
main
{ "repo_name": "NCIP/commons-module", "path": "software/washu-commons/src/test/java/edu/wustl/common/datahandler/TestDataHandler.java", "license": "bsd-3-clause", "size": 1557 }
[ "edu.wustl.common.beans.NameValueBean", "edu.wustl.common.util.global.Constants", "java.util.ArrayList", "java.util.List" ]
import edu.wustl.common.beans.NameValueBean; import edu.wustl.common.util.global.Constants; import java.util.ArrayList; import java.util.List;
import edu.wustl.common.beans.*; import edu.wustl.common.util.global.*; import java.util.*;
[ "edu.wustl.common", "java.util" ]
edu.wustl.common; java.util;
1,760,995
public void init() throws SQLException { synchronized (this) { if (_isInit) return; try { _database.init(); } finally { _isInit = true; } } }
void function() throws SQLException { synchronized (this) { if (_isInit) return; try { _database.init(); } finally { _isInit = true; } } }
/** * Initialize the data source. */
Initialize the data source
init
{ "repo_name": "mdaniel/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/db/jdbc/ConnectionPoolDataSourceImpl.java", "license": "gpl-2.0", "size": 3811 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,628,378
return format(new Date(millis), pattern, DateUtils.UTC_TIME_ZONE, null); }
return format(new Date(millis), pattern, DateUtils.UTC_TIME_ZONE, null); }
/** * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> * * @param millis the date to format expressed in milliseconds * @param pattern the pattern to use to format the date * @return the formatted date */
Formats a date/time into a specific pattern using the UTC time zone
formatUTC
{ "repo_name": "SpoonLabs/astor", "path": "examples/lang_39/src/java/org/apache/commons/lang3/time/DateFormatUtils.java", "license": "gpl-2.0", "size": 12141 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,517,555
@ApiModelProperty(example = "1", value = "Number of Documents returned. ") public Integer getCount() { return count; }
@ApiModelProperty(example = "1", value = STR) Integer function() { return count; }
/** * Number of Documents returned. * @return count **/
Number of Documents returned
getCount
{ "repo_name": "jaadds/product-apim", "path": "modules/integration/tests-common/clients/store/src/gen/java/org/wso2/am/integration/clients/store/api/v1/dto/DocumentListDTO.java", "license": "apache-2.0", "size": 3754 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,121,590
public void setList(ArrayList<Song> theSongs) { songs = theSongs; }
void function(ArrayList<Song> theSongs) { songs = theSongs; }
/** * Sets the "Now Playing List" * * @param theSongs Songs list that will play from now on. * * @note Make sure to call {@link #playSong()} after this. */
Sets the "Now Playing List"
setList
{ "repo_name": "alexdantas/kure-music-player", "path": "app/src/main/java/com/kure/musicplayer/services/ServicePlayMusic.java", "license": "gpl-3.0", "size": 34886 }
[ "com.kure.musicplayer.model.Song", "java.util.ArrayList" ]
import com.kure.musicplayer.model.Song; import java.util.ArrayList;
import com.kure.musicplayer.model.*; import java.util.*;
[ "com.kure.musicplayer", "java.util" ]
com.kure.musicplayer; java.util;
2,878,792
if (name == null) { throw new NullPointerException("name"); } try { return new URI(name); } catch (final URISyntaxException e) { throw new IllegalArgumentException("Invalid name: " + name, e); } }
if (name == null) { throw new NullPointerException("name"); } try { return new URI(name); } catch (final URISyntaxException e) { throw new IllegalArgumentException(STR + name, e); } }
/** * Creates a URI from a source file name. * @param name the source file name. * @return the URI. * @throws NullPointerException if <code>name</code> * is null. * @throws IllegalArgumentException if <code>name</code> * is invalid. */
Creates a URI from a source file name
createUriFromName
{ "repo_name": "formeppe/NewAge-JGrass", "path": "oms3/src/main/java/oms3/compiler/MemorySourceJavaFileObject.java", "license": "gpl-2.0", "size": 1613 }
[ "java.net.URISyntaxException" ]
import java.net.URISyntaxException;
import java.net.*;
[ "java.net" ]
java.net;
2,474,625
public Command addCommandToOverflowMenu(String name, Image icon, final ActionListener ev) { Command cmd = Command.create(name, icon, ev); addCommandToOverflowMenu(cmd); return cmd; } public static enum BackCommandPolicy { ALWAYS, AS_REGULAR_COMMAND, AS_ARROW, ONLY_WHEN_USES_TITLE, WHEN_USES_TITLE_OTHERWISE_ARROW, NEVER } /** * Sets the back command in the title bar to an arrow type and maps the back command hardware key * if applicable. This is functionally identical to {@code setBackCommand(title, Toolbar.BackCommandPolicy.AS_ARROW, listener); }
Command function(String name, Image icon, final ActionListener ev) { Command cmd = Command.create(name, icon, ev); addCommandToOverflowMenu(cmd); return cmd; } public static enum BackCommandPolicy { ALWAYS, AS_REGULAR_COMMAND, AS_ARROW, ONLY_WHEN_USES_TITLE, WHEN_USES_TITLE_OTHERWISE_ARROW, NEVER } /** * Sets the back command in the title bar to an arrow type and maps the back command hardware key * if applicable. This is functionally identical to {@code setBackCommand(title, Toolbar.BackCommandPolicy.AS_ARROW, listener); }
/** * Adds a Command to the overflow menu * * @param name the name/title of the command * @param icon the icon for the command * @param ev the even handler * @return a newly created Command instance */
Adds a Command to the overflow menu
addCommandToOverflowMenu
{ "repo_name": "shannah/CodenameOne", "path": "CodenameOne/src/com/codename1/ui/Toolbar.java", "license": "gpl-2.0", "size": 67773 }
[ "com.codename1.ui.events.ActionListener" ]
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.events.*;
[ "com.codename1.ui" ]
com.codename1.ui;
1,537,828
@CheckReturnValue public static DoublePredicateAssert assertThat(DoublePredicate actual) { return new DoublePredicateAssert(actual); }
static DoublePredicateAssert function(DoublePredicate actual) { return new DoublePredicateAssert(actual); }
/** * Create assertion for {@link DoublePredicate}. * * @param actual the actual value. * @return the created assertion object. * @since 3.5.0 */
Create assertion for <code>DoublePredicate</code>
assertThat
{ "repo_name": "ChrisCanCompute/assertj-core", "path": "src/main/java/org/assertj/core/api/AssertionsForInterfaceTypes.java", "license": "apache-2.0", "size": 15270 }
[ "java.util.function.DoublePredicate" ]
import java.util.function.DoublePredicate;
import java.util.function.*;
[ "java.util" ]
java.util;
1,017,200
public int saveChunks(final int chunkSize) throws IOException { if (outputStream != null) { throw new MongoException("Cannot mix OutputStream and regular save()"); } if (savedChunks) { throw new MongoException("Chunks already saved!"); } if (chunkSize <= 0) { throw new MongoException("chunkSize must be greater than zero"); } if (this.chunkSize != chunkSize) { this.chunkSize = chunkSize; } // new stuff this.outputStream = generateOutputStream(fs.getChunksCollection()); try { new BytesCopier(inputStream, this.outputStream, this.closeStreamOnPersist).transfer(false); } finally { this.outputStream.close(); } // only write data, do not write file, in case one wants to change metadata return (int) this.getAsLong(MongoFileConstants.chunkCount.name()); }
int function(final int chunkSize) throws IOException { if (outputStream != null) { throw new MongoException(STR); } if (savedChunks) { throw new MongoException(STR); } if (chunkSize <= 0) { throw new MongoException(STR); } if (this.chunkSize != chunkSize) { this.chunkSize = chunkSize; } this.outputStream = generateOutputStream(fs.getChunksCollection()); try { new BytesCopier(inputStream, this.outputStream, this.closeStreamOnPersist).transfer(false); } finally { this.outputStream.close(); } return (int) this.getAsLong(MongoFileConstants.chunkCount.name()); }
/** * Saves all data into chunks from configured {@link java.io.InputStream} input stream to GridFS. A non-default chunk size can be * specified. This method does NOT save the file object itself, one must call save() to do so. * * @param chunkSize * Size of chunks for file in bytes. * @return Number of the next chunk. * @throws IOException * on problems reading the new entry's {@link java.io.InputStream}. * @throws MongoException */
Saves all data into chunks from configured <code>java.io.InputStream</code> input stream to GridFS. A non-default chunk size can be specified. This method does NOT save the file object itself, one must call save() to do so
saveChunks
{ "repo_name": "dbuschman7/mongoFS", "path": "src/main/java/me/lightspeed7/mongofs/gridfs/GridFSInputFile.java", "license": "apache-2.0", "size": 8531 }
[ "com.mongodb.MongoException", "java.io.IOException", "me.lightspeed7.mongofs.MongoFileConstants", "me.lightspeed7.mongofs.util.BytesCopier" ]
import com.mongodb.MongoException; import java.io.IOException; import me.lightspeed7.mongofs.MongoFileConstants; import me.lightspeed7.mongofs.util.BytesCopier;
import com.mongodb.*; import java.io.*; import me.lightspeed7.mongofs.*; import me.lightspeed7.mongofs.util.*;
[ "com.mongodb", "java.io", "me.lightspeed7.mongofs" ]
com.mongodb; java.io; me.lightspeed7.mongofs;
1,321,079
public static void writeToPath(BitMatrix matrix, String format, Path file) throws IOException { writeToPath(matrix, format, file, DEFAULT_CONFIG); } /** * @deprecated use {@link #writeToPath(BitMatrix, String, Path, MatrixToImageConfig)}
static void function(BitMatrix matrix, String format, Path file) throws IOException { writeToPath(matrix, format, file, DEFAULT_CONFIG); } /** * @deprecated use {@link #writeToPath(BitMatrix, String, Path, MatrixToImageConfig)}
/** * Writes a {@link BitMatrix} to a file. * * @see #toBufferedImage(BitMatrix) */
Writes a <code>BitMatrix</code> to a file
writeToPath
{ "repo_name": "Matrix44/zxing", "path": "javase/src/main/java/com/google/zxing/client/j2se/MatrixToImageWriter.java", "license": "apache-2.0", "size": 4101 }
[ "com.google.zxing.common.BitMatrix", "java.io.IOException", "java.nio.file.Path" ]
import com.google.zxing.common.BitMatrix; import java.io.IOException; import java.nio.file.Path;
import com.google.zxing.common.*; import java.io.*; import java.nio.file.*;
[ "com.google.zxing", "java.io", "java.nio" ]
com.google.zxing; java.io; java.nio;
2,062,291
@Test public void testNoActionDate() { new TemplateRuleTest<ProtocolApproveEvent, ProtocolApproveRule>() {
void function() { new TemplateRuleTest<ProtocolApproveEvent, ProtocolApproveRule>() {
/** * Tests an invalid Response Approval with no action date. * @throws Exception */
Tests an invalid Response Approval with no action date
testNoActionDate
{ "repo_name": "kuali/kc", "path": "coeus-it/src/test/java/org/kuali/kra/irb/actions/approve/ProtocolApproveRuleTest.java", "license": "agpl-3.0", "size": 6206 }
[ "org.kuali.kra.rules.TemplateRuleTest" ]
import org.kuali.kra.rules.TemplateRuleTest;
import org.kuali.kra.rules.*;
[ "org.kuali.kra" ]
org.kuali.kra;
2,344,073
private void setDescription(final String description, final boolean saveToDatabase) throws CouldntSaveDataException { Preconditions.checkNotNull(description, "IE00080: New comment can not be null"); if (description.equals(this.description)) { return; } if (saveToDatabase) { provider.setDescription(this, description); } this.description = description; for (final IFunctionListener<IComment> listener : functionListeners) { listener.changedDescription(this, description); } }
void function(final String description, final boolean saveToDatabase) throws CouldntSaveDataException { Preconditions.checkNotNull(description, STR); if (description.equals(this.description)) { return; } if (saveToDatabase) { provider.setDescription(this, description); } this.description = description; for (final IFunctionListener<IComment> listener : functionListeners) { listener.changedDescription(this, description); } }
/** * Set the description of a function. * * @param description The description of the {@link INaviFunction function} to be set. * @param saveToDatabase If true save the description to the database. * @throws CouldntSaveDataException if the persistence layer could not store the the description. */
Set the description of a function
setDescription
{ "repo_name": "dgrif/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/CFunction.java", "license": "apache-2.0", "size": 22454 }
[ "com.google.common.base.Preconditions", "com.google.security.zynamics.binnavi.Database", "com.google.security.zynamics.binnavi.Gui", "com.google.security.zynamics.zylib.disassembly.IFunctionListener" ]
import com.google.common.base.Preconditions; import com.google.security.zynamics.binnavi.Database; import com.google.security.zynamics.binnavi.Gui; import com.google.security.zynamics.zylib.disassembly.IFunctionListener;
import com.google.common.base.*; import com.google.security.zynamics.binnavi.*; import com.google.security.zynamics.zylib.disassembly.*;
[ "com.google.common", "com.google.security" ]
com.google.common; com.google.security;
614,838
public List<com.mozu.api.contracts.commerceruntime.fulfillment.ShippingRate> getAvailableShipmentMethods(String orderId, Boolean draft) throws Exception { MozuClient<List<com.mozu.api.contracts.commerceruntime.fulfillment.ShippingRate>> client = com.mozu.api.clients.commerce.orders.ShipmentClient.getAvailableShipmentMethodsClient( orderId, draft); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); }
List<com.mozu.api.contracts.commerceruntime.fulfillment.ShippingRate> function(String orderId, Boolean draft) throws Exception { MozuClient<List<com.mozu.api.contracts.commerceruntime.fulfillment.ShippingRate>> client = com.mozu.api.clients.commerce.orders.ShipmentClient.getAvailableShipmentMethodsClient( orderId, draft); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); }
/** * * <p><pre><code> * Shipment shipment = new Shipment(); * ShippingRate shippingRate = shipment.getAvailableShipmentMethods( orderId, draft); * </code></pre></p> * @param draft If true, retrieve the draft version of the order, which might include uncommitted changes to the order or its components. * @param orderId Unique identifier of the order. * @return List<com.mozu.api.contracts.commerceruntime.fulfillment.ShippingRate> * @see com.mozu.api.contracts.commerceruntime.fulfillment.ShippingRate */
<code><code> Shipment shipment = new Shipment(); ShippingRate shippingRate = shipment.getAvailableShipmentMethods( orderId, draft); </code></code>
getAvailableShipmentMethods
{ "repo_name": "Mozu/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/orders/ShipmentResource.java", "license": "mit", "size": 11097 }
[ "com.mozu.api.MozuClient", "java.util.List" ]
import com.mozu.api.MozuClient; import java.util.List;
import com.mozu.api.*; import java.util.*;
[ "com.mozu.api", "java.util" ]
com.mozu.api; java.util;
357,214
public void registerAuxWriter (Class<?> aclass, NestableWriter writer) { _auxers.put(aclass, writer); }
void function (Class<?> aclass, NestableWriter writer) { _auxers.put(aclass, writer); }
/** * Registers a writer for writing auxiliary scene models of the * supplied class. */
Registers a writer for writing auxiliary scene models of the supplied class
registerAuxWriter
{ "repo_name": "threerings/vilya", "path": "core/src/main/java/com/threerings/whirled/tools/xml/SceneWriter.java", "license": "lgpl-2.1", "size": 4154 }
[ "com.threerings.tools.xml.NestableWriter" ]
import com.threerings.tools.xml.NestableWriter;
import com.threerings.tools.xml.*;
[ "com.threerings.tools" ]
com.threerings.tools;
2,807,865
private void initViews() { mTodoTitle = (TodoEditText) findViewById(R.id.title); mTodoTitle.setOnClickListener(mListeners); mTodoDescription = (TodoEditText) findViewById(R.id.details); mTodoDescription.setOnClickListener(mListeners); mSetDueDate = (LinearLayout) findViewById(R.id.set_due_date); mDateIcon = (ImageView) findViewById(R.id.date_icon); mDateText = (TextView) findViewById(R.id.date_text); mImgBtnDueDateRemove = (ImageButton) findViewById(R.id.btn_due_date_remove); mSetDueDate.setOnClickListener(mListeners); mImgBtnDueDateRemove.setOnClickListener(mListeners); final int titleMaxLength = getResources().getInteger(R.integer.ToDoTitleMaxLength); final int descMaxLength = getResources().getInteger(R.integer.ToDoDescriptionMaxLength); /// M: integrate "vibration" to "toast" mTodoTitle.setMaxLength(titleMaxLength); mTodoDescription.setMaxLength(descMaxLength); }
void function() { mTodoTitle = (TodoEditText) findViewById(R.id.title); mTodoTitle.setOnClickListener(mListeners); mTodoDescription = (TodoEditText) findViewById(R.id.details); mTodoDescription.setOnClickListener(mListeners); mSetDueDate = (LinearLayout) findViewById(R.id.set_due_date); mDateIcon = (ImageView) findViewById(R.id.date_icon); mDateText = (TextView) findViewById(R.id.date_text); mImgBtnDueDateRemove = (ImageButton) findViewById(R.id.btn_due_date_remove); mSetDueDate.setOnClickListener(mListeners); mImgBtnDueDateRemove.setOnClickListener(mListeners); final int titleMaxLength = getResources().getInteger(R.integer.ToDoTitleMaxLength); final int descMaxLength = getResources().getInteger(R.integer.ToDoDescriptionMaxLength); mTodoTitle.setMaxLength(titleMaxLength); mTodoDescription.setMaxLength(descMaxLength); }
/** * init all components used in this activity */
init all components used in this activity
initViews
{ "repo_name": "rex-xxx/mt6572_x201", "path": "mediatek/packages/apps/Todos/src/com/mediatek/todos/EditTodoActivity.java", "license": "gpl-2.0", "size": 35905 }
[ "android.widget.ImageButton", "android.widget.ImageView", "android.widget.LinearLayout", "android.widget.TextView" ]
import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView;
import android.widget.*;
[ "android.widget" ]
android.widget;
2,591,419
public void request(int seg) throws IOException { Packet packet = new Packet(Packet.Type.RequestAgain); packet.putProperty("Id", new Integer(owner.getID())); packet.putProperty("ShareName", filename); packet.putProperty("Segment", new Integer(seg)); owner.sendPacket(packet); }
void function(int seg) throws IOException { Packet packet = new Packet(Packet.Type.RequestAgain); packet.putProperty("Id", new Integer(owner.getID())); packet.putProperty(STR, filename); packet.putProperty(STR, new Integer(seg)); owner.sendPacket(packet); }
/** * Requests that a specific file segment be re-sent. This is used if the * packet carrying a segment was dropped. * * @param seg * The file segment ID. * @throws IOException * If the request cannot be sent due to a network error. * @see #getFilename */
Requests that a specific file segment be re-sent. This is used if the packet carrying a segment was dropped
request
{ "repo_name": "sourcewarehouse/snodes", "path": "src/snodes/net/FileTransfer.java", "license": "gpl-2.0", "size": 7570 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,068,637
@Test() public void testInsertByteStringIntoEmpty() throws Exception { ByteStringBuffer buffer = new ByteStringBuffer(); assertEquals(buffer.length(), 0); assertEquals(buffer.toString(), ""); buffer.insert(0, ByteStringFactory.create("foo")); assertEquals(buffer.length(), 3); assertEquals(buffer.toString(), "foo"); buffer.hashCode(); }
@Test() void function() throws Exception { ByteStringBuffer buffer = new ByteStringBuffer(); assertEquals(buffer.length(), 0); assertEquals(buffer.toString(), STRfooSTRfoo"); buffer.hashCode(); }
/** * Provides test coverage for the {@code insert} method variant that takes a * byte string into an empty buffer. * * @throws Exception If an unexpected problem occurs. */
Provides test coverage for the insert method variant that takes a byte string into an empty buffer
testInsertByteStringIntoEmpty
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/util/ByteStringBufferTestCase.java", "license": "gpl-2.0", "size": 141047 }
[ "org.testng.annotations.Test" ]
import org.testng.annotations.Test;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
2,813,162