method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
protected @Nullable PropertyInterceptor getPropertyInterceptor() { return PropertyInterceptor.NULL; }
@Nullable PropertyInterceptor function() { return PropertyInterceptor.NULL; }
/** * get the property interceptor which is used to data-binding. * * @return the property interceptor. can be null. * @see PropertyInterceptor * @see DataBinding#bind(Object, int, DataBinding.ParameterSupplier, PropertyInterceptor) */
get the property interceptor which is used to data-binding
getPropertyInterceptor
{ "repo_name": "LightSun/data-mediator", "path": "Data-mediator-demo/data-mediator-android/src/main/java/com/heaven7/android/data/mediator/adapter/DataBindingRecyclerAdapter.java", "license": "apache-2.0", "size": 20379 }
[ "android.support.annotation.Nullable", "com.heaven7.java.data.mediator.PropertyInterceptor" ]
import android.support.annotation.Nullable; import com.heaven7.java.data.mediator.PropertyInterceptor;
import android.support.annotation.*; import com.heaven7.java.data.mediator.*;
[ "android.support", "com.heaven7.java" ]
android.support; com.heaven7.java;
1,650,175
public Builder extrapolatorRight(CurveExtrapolator extrapolatorRight) { JodaBeanUtils.notNull(extrapolatorRight, "extrapolatorRight"); this.extrapolatorRight = extrapolatorRight; return this; }
Builder function(CurveExtrapolator extrapolatorRight) { JodaBeanUtils.notNull(extrapolatorRight, STR); this.extrapolatorRight = extrapolatorRight; return this; }
/** * Sets the extrapolator for x-values on the right, defaulted to 'Flat". * This is used for x-values larger than the largest known x-value. * @param extrapolatorRight the new value, not null * @return this, for chaining, not null */
Sets the extrapolator for x-values on the right, defaulted to 'Flat". This is used for x-values larger than the largest known x-value
extrapolatorRight
{ "repo_name": "jmptrader/Strata", "path": "modules/market/src/main/java/com/opengamma/strata/market/curve/InterpolatedNodalCurve.java", "license": "apache-2.0", "size": 31200 }
[ "com.opengamma.strata.market.curve.interpolator.CurveExtrapolator", "org.joda.beans.JodaBeanUtils" ]
import com.opengamma.strata.market.curve.interpolator.CurveExtrapolator; import org.joda.beans.JodaBeanUtils;
import com.opengamma.strata.market.curve.interpolator.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
787,467
public void setSheetOrder(String sheetname, int pos ) { int sheetNumber = getSheetIndex(sheetname); //remove the sheet that needs to be reordered and place it in the spot we want boundsheets.add(pos, boundsheets.remove(sheetNumber)); // also adjust order of Records, calculate the position of the Boundsheets via getBspos()... int initialBspos = records.getBspos(); int pos0 = initialBspos - (boundsheets.size() - 1); Record removed = records.get(pos0 + sheetNumber); records.remove(pos0 + sheetNumber); records.add(pos0 + pos, removed); records.setBspos(initialBspos); }
void function(String sheetname, int pos ) { int sheetNumber = getSheetIndex(sheetname); boundsheets.add(pos, boundsheets.remove(sheetNumber)); int initialBspos = records.getBspos(); int pos0 = initialBspos - (boundsheets.size() - 1); Record removed = records.get(pos0 + sheetNumber); records.remove(pos0 + sheetNumber); records.add(pos0 + pos, removed); records.setBspos(initialBspos); }
/** * sets the order of appearance for a given sheet. * * @param sheetname the name of the sheet to reorder * @param pos the position that we want to insert the sheet into (0 based) */
sets the order of appearance for a given sheet
setSheetOrder
{ "repo_name": "lvweiwolf/poi-3.16", "path": "src/java/org/apache/poi/hssf/model/InternalWorkbook.java", "license": "apache-2.0", "size": 82933 }
[ "org.apache.poi.hssf.record.Record" ]
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.*;
[ "org.apache.poi" ]
org.apache.poi;
2,139,224
public Builder useIncludingRegexPatterns(String regexList) { Preconditions.checkNotNull(regexList); this.includingRegexPatterns = DatasetFilterUtils.getPatternsFromStrings(COMMA_SPLITTER.splitToList(regexList)); return this; }
Builder function(String regexList) { Preconditions.checkNotNull(regexList); this.includingRegexPatterns = DatasetFilterUtils.getPatternsFromStrings(COMMA_SPLITTER.splitToList(regexList)); return this; }
/** * Set the regex patterns used to filter logs that should be copied. * * @param regexList a comma-separated list of regex patterns * @return this {@link LogCopier.Builder} instance */
Set the regex patterns used to filter logs that should be copied
useIncludingRegexPatterns
{ "repo_name": "shirshanka/gobblin", "path": "gobblin-utility/src/main/java/org/apache/gobblin/util/logs/LogCopier.java", "license": "apache-2.0", "size": 22910 }
[ "com.google.common.base.Preconditions", "org.apache.gobblin.util.DatasetFilterUtils" ]
import com.google.common.base.Preconditions; import org.apache.gobblin.util.DatasetFilterUtils;
import com.google.common.base.*; import org.apache.gobblin.util.*;
[ "com.google.common", "org.apache.gobblin" ]
com.google.common; org.apache.gobblin;
2,029,869
public static boolean contains(List<BlockVector2D> points, int minY, int maxY, Vector pt) { if (points.size() < 3) { return false; } int targetX = pt.getBlockX(); //wide int targetY = pt.getBlockY(); //height int targetZ = pt.getBlockZ(); //depth if (targetY < minY || targetY > maxY) { return false; } boolean inside = false; int npoints = points.size(); int xNew, zNew; int xOld, zOld; int x1, z1; int x2, z2; long crossproduct; int i; xOld = points.get(npoints - 1).getBlockX(); zOld = points.get(npoints - 1).getBlockZ(); for (i = 0; i < npoints; ++i) { xNew = points.get(i).getBlockX(); zNew = points.get(i).getBlockZ(); //Check for corner if (xNew == targetX && zNew == targetZ) { return true; } if (xNew > xOld) { x1 = xOld; x2 = xNew; z1 = zOld; z2 = zNew; } else { x1 = xNew; x2 = xOld; z1 = zNew; z2 = zOld; } if (x1 <= targetX && targetX <= x2) { crossproduct = ((long) targetZ - (long) z1) * (long) (x2 - x1) - ((long) z2 - (long) z1) * (long) (targetX - x1); if (crossproduct == 0) { if ((z1 <= targetZ) == (targetZ <= z2)) return true; //on edge } else if (crossproduct < 0 && (x1 != targetX)) { inside = !inside; } } xOld = xNew; zOld = zNew; } return inside; }
static boolean function(List<BlockVector2D> points, int minY, int maxY, Vector pt) { if (points.size() < 3) { return false; } int targetX = pt.getBlockX(); int targetY = pt.getBlockY(); int targetZ = pt.getBlockZ(); if (targetY < minY targetY > maxY) { return false; } boolean inside = false; int npoints = points.size(); int xNew, zNew; int xOld, zOld; int x1, z1; int x2, z2; long crossproduct; int i; xOld = points.get(npoints - 1).getBlockX(); zOld = points.get(npoints - 1).getBlockZ(); for (i = 0; i < npoints; ++i) { xNew = points.get(i).getBlockX(); zNew = points.get(i).getBlockZ(); if (xNew == targetX && zNew == targetZ) { return true; } if (xNew > xOld) { x1 = xOld; x2 = xNew; z1 = zOld; z2 = zNew; } else { x1 = xNew; x2 = xOld; z1 = zNew; z2 = zOld; } if (x1 <= targetX && targetX <= x2) { crossproduct = ((long) targetZ - (long) z1) * (long) (x2 - x1) - ((long) z2 - (long) z1) * (long) (targetX - x1); if (crossproduct == 0) { if ((z1 <= targetZ) == (targetZ <= z2)) return true; } else if (crossproduct < 0 && (x1 != targetX)) { inside = !inside; } } xOld = xNew; zOld = zNew; } return inside; }
/** * Checks to see if a point is inside a region. * * @param points * @param minY * @param maxY * @param pt * @return */
Checks to see if a point is inside a region
contains
{ "repo_name": "dumptruckman/Chunky", "path": "api/src/main/java/com/dumptruckman/minecraft/chunky/object/region/Polygonal2DRegion.java", "license": "bsd-3-clause", "size": 11816 }
[ "com.sk89q.worldedit.BlockVector2D", "com.sk89q.worldedit.Vector", "java.util.List" ]
import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.Vector; import java.util.List;
import com.sk89q.worldedit.*; import java.util.*;
[ "com.sk89q.worldedit", "java.util" ]
com.sk89q.worldedit; java.util;
2,646,743
public static void prepareForTransientQuery( DataSessionContext dContext, DataEngineImpl dataEngine, DataSetHandle handle, IQueryDefinition queryDefn, IDataQueryDefinition[] registedQueries, IDataSetInterceptorContext interceptorContext ) throws BirtException { if (interceptorContext == null) return; IBaseDataSetDesign design = null; if( handle == null ) { if( queryDefn.getDataSetName( ) == null ) { if( queryDefn.getSourceQuery( )!= null&& queryDefn.getSourceQuery( ) instanceof IQueryDefinition ) design = dataEngine.getDataSetDesign( ((IQueryDefinition)queryDefn.getSourceQuery( )).getDataSetName( ) ); } else design = dataEngine.getDataSetDesign( queryDefn.getDataSetName( ) ); } else { design = dataEngine.getDataSetDesign( handle.getQualifiedName( ) ); } final IDataSetInterceptor dataSetInterceptor = DataSetInterceptorFinder.find( design ); if ( dataSetInterceptor != null ) { dataSetInterceptor.preDefineDataSet( dataEngine.getDataSourceDesign( design.getDataSourceName( ) ), design, queryDefn, registedQueries, dContext, dataEngine.getSession( ).getTempDir( ), interceptorContext ); dataEngine.addShutdownListener( new IShutdownListener( ) {
static void function( DataSessionContext dContext, DataEngineImpl dataEngine, DataSetHandle handle, IQueryDefinition queryDefn, IDataQueryDefinition[] registedQueries, IDataSetInterceptorContext interceptorContext ) throws BirtException { if (interceptorContext == null) return; IBaseDataSetDesign design = null; if( handle == null ) { if( queryDefn.getDataSetName( ) == null ) { if( queryDefn.getSourceQuery( )!= null&& queryDefn.getSourceQuery( ) instanceof IQueryDefinition ) design = dataEngine.getDataSetDesign( ((IQueryDefinition)queryDefn.getSourceQuery( )).getDataSetName( ) ); } else design = dataEngine.getDataSetDesign( queryDefn.getDataSetName( ) ); } else { design = dataEngine.getDataSetDesign( handle.getQualifiedName( ) ); } final IDataSetInterceptor dataSetInterceptor = DataSetInterceptorFinder.find( design ); if ( dataSetInterceptor != null ) { dataSetInterceptor.preDefineDataSet( dataEngine.getDataSourceDesign( design.getDataSourceName( ) ), design, queryDefn, registedQueries, dContext, dataEngine.getSession( ).getTempDir( ), interceptorContext ); dataEngine.addShutdownListener( new IShutdownListener( ) {
/** * prepare for transient query * @param sessionContext * @param dataEngine * @param handle * @param queryDefn * @throws BirtException */
prepare for transient query
prepareForTransientQuery
{ "repo_name": "sguan-actuate/birt", "path": "data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/impl/DefineDataSourceSetUtil.java", "license": "epl-1.0", "size": 7168 }
[ "org.eclipse.birt.core.exception.BirtException", "org.eclipse.birt.data.engine.api.IBaseDataSetDesign", "org.eclipse.birt.data.engine.api.IDataQueryDefinition", "org.eclipse.birt.data.engine.api.IQueryDefinition", "org.eclipse.birt.data.engine.api.IShutdownListener", "org.eclipse.birt.data.engine.impl.DataEngineImpl", "org.eclipse.birt.report.data.adapter.api.DataSessionContext", "org.eclipse.birt.report.data.adapter.api.IDataSetInterceptor", "org.eclipse.birt.report.data.adapter.api.IDataSetInterceptorContext", "org.eclipse.birt.report.model.api.DataSetHandle" ]
import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.data.engine.api.IBaseDataSetDesign; import org.eclipse.birt.data.engine.api.IDataQueryDefinition; import org.eclipse.birt.data.engine.api.IQueryDefinition; import org.eclipse.birt.data.engine.api.IShutdownListener; import org.eclipse.birt.data.engine.impl.DataEngineImpl; import org.eclipse.birt.report.data.adapter.api.DataSessionContext; import org.eclipse.birt.report.data.adapter.api.IDataSetInterceptor; import org.eclipse.birt.report.data.adapter.api.IDataSetInterceptorContext; import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.core.exception.*; import org.eclipse.birt.data.engine.api.*; import org.eclipse.birt.data.engine.impl.*; import org.eclipse.birt.report.data.adapter.api.*; import org.eclipse.birt.report.model.api.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
2,190,804
private String normalizeUrl(String url) { if (!normalize) { return url; } String normalized = null; if (urlNormalizers != null) { try { // normalize and trim the url normalized = urlNormalizers .normalize(url, URLNormalizers.SCOPE_INDEXER); normalized = normalized.trim(); } catch (Exception e) { LOG.warn("Skipping " + url + ":" + e); normalized = null; } } return normalized; }
String function(String url) { if (!normalize) { return url; } String normalized = null; if (urlNormalizers != null) { try { normalized = urlNormalizers .normalize(url, URLNormalizers.SCOPE_INDEXER); normalized = normalized.trim(); } catch (Exception e) { LOG.warn(STR + url + ":" + e); normalized = null; } } return normalized; }
/** * Normalizes and trims extra whitespace from the given url. * * @param url * The url to normalize. * * @return The normalized url. */
Normalizes and trims extra whitespace from the given url
normalizeUrl
{ "repo_name": "code4wt/nutch-learning", "path": "src/java/org/apache/nutch/indexer/IndexerMapReduce.java", "license": "apache-2.0", "size": 14909 }
[ "org.apache.nutch.net.URLNormalizers" ]
import org.apache.nutch.net.URLNormalizers;
import org.apache.nutch.net.*;
[ "org.apache.nutch" ]
org.apache.nutch;
1,255,327
public static GenericObjectPoolConfig standardConfig() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setTestOnBorrow(true); config.setMinIdle(0); config.setMaxIdle(8); config.setMaxTotal(8); config.setMinEvictableIdleTimeMillis(TimeUnit.MINUTES.toMillis(5)); config.setTimeBetweenEvictionRunsMillis(10000); config.setMaxWaitMillis(10000); return config; }
static GenericObjectPoolConfig function() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setTestOnBorrow(true); config.setMinIdle(0); config.setMaxIdle(8); config.setMaxTotal(8); config.setMinEvictableIdleTimeMillis(TimeUnit.MINUTES.toMillis(5)); config.setTimeBetweenEvictionRunsMillis(10000); config.setMaxWaitMillis(10000); return config; }
/** * Default {@link GenericObjectPoolConfig} config * {@link GenericObjectPoolConfig#getTestOnBorrow} : true * minIdle: 0 * maxIdle: 8 * maxTotal: 8 * maxWaitMillis: 10000 * minEvictableIdleTimeMillis: 5 minutes * timeBetweenEvictionRunsMillis: 10 seconds * * @return */
Default <code>GenericObjectPoolConfig</code> config <code>GenericObjectPoolConfig#getTestOnBorrow</code> : true minIdle: 0 maxIdle: 8 maxTotal: 8 maxWaitMillis: 10000 minEvictableIdleTimeMillis: 5 minutes timeBetweenEvictionRunsMillis: 10 seconds
standardConfig
{ "repo_name": "nithril/smtp-connection-pool", "path": "src/main/java/org/nlab/smtp/pool/PoolConfigs.java", "license": "apache-2.0", "size": 2186 }
[ "java.util.concurrent.TimeUnit", "org.apache.commons.pool2.impl.GenericObjectPoolConfig" ]
import java.util.concurrent.TimeUnit; import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import java.util.concurrent.*; import org.apache.commons.pool2.impl.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
1,933,419
public PipeAdvertisement getAdvertisement() { return pipeAdv; }
PipeAdvertisement function() { return pipeAdv; }
/** * Gets the pipe advertisement * * @return The advertisement **/
Gets the pipe advertisement
getAdvertisement
{ "repo_name": "idega/net.jxta", "path": "src/java/net/jxta/impl/pipe/InputPipeImpl.java", "license": "gpl-3.0", "size": 9154 }
[ "net.jxta.protocol.PipeAdvertisement" ]
import net.jxta.protocol.PipeAdvertisement;
import net.jxta.protocol.*;
[ "net.jxta.protocol" ]
net.jxta.protocol;
1,431,731
Module internalGetModuleByName(final String name, final boolean uptodateOnly) { if (moduleMap.containsKey(name)) { return moduleMap.get(name); } if (!uptodateOnly && outdatedModuleMap.containsKey(name)) { return outdatedModuleMap.get(name); } return null; }
Module internalGetModuleByName(final String name, final boolean uptodateOnly) { if (moduleMap.containsKey(name)) { return moduleMap.get(name); } if (!uptodateOnly && outdatedModuleMap.containsKey(name)) { return outdatedModuleMap.get(name); } return null; }
/** * Returns the module with the provided name, or null. * * @param name * the name of the module to return. * @param uptodateOnly * allow finding only the up-to-date modules. * * @return the module having the provided name * */
Returns the module with the provided name, or null
internalGetModuleByName
{ "repo_name": "alovassy/titan.EclipsePlug-ins", "path": "org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ProjectSourceSemanticAnalyzer.java", "license": "epl-1.0", "size": 16775 }
[ "org.eclipse.titan.designer.AST" ]
import org.eclipse.titan.designer.AST;
import org.eclipse.titan.designer.*;
[ "org.eclipse.titan" ]
org.eclipse.titan;
1,800,663
public static ServerSocket createServerSocket(int port, boolean ssl) throws SQLException { try { return createServerSocketTry(port, ssl); } catch (SQLException e) { // try again return createServerSocketTry(port, ssl); } }
static ServerSocket function(int port, boolean ssl) throws SQLException { try { return createServerSocketTry(port, ssl); } catch (SQLException e) { return createServerSocketTry(port, ssl); } }
/** * Create a server socket. The system property h2.bindAddress is used if * set. * * @param port the port to listen on * @param ssl if SSL should be used * @return the server socket */
Create a server socket. The system property h2.bindAddress is used if set
createServerSocket
{ "repo_name": "LucidDB/luciddb", "path": "extensions/services/pg2luciddb/src/org/h2/util/NetUtils.java", "license": "apache-2.0", "size": 7922 }
[ "java.net.ServerSocket", "java.sql.SQLException" ]
import java.net.ServerSocket; import java.sql.SQLException;
import java.net.*; import java.sql.*;
[ "java.net", "java.sql" ]
java.net; java.sql;
86,594
ServiceResponse<BigDecimal> getSmallDecimal() throws ErrorException, IOException;
ServiceResponse<BigDecimal> getSmallDecimal() throws ErrorException, IOException;
/** * Get small decimal value 2.5976931e-101. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the BigDecimal object wrapped in {@link ServiceResponse} if successful. */
Get small decimal value 2.5976931e-101
getSmallDecimal
{ "repo_name": "yaqiyang/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodynumber/Numbers.java", "license": "mit", "size": 20998 }
[ "com.microsoft.rest.ServiceResponse", "java.io.IOException", "java.math.BigDecimal" ]
import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.math.BigDecimal;
import com.microsoft.rest.*; import java.io.*; import java.math.*;
[ "com.microsoft.rest", "java.io", "java.math" ]
com.microsoft.rest; java.io; java.math;
139,074
synchronized void dumpWatches(PrintWriter pwriter, boolean byPath) { if (byPath) { for (Entry<String, HashSet<Watcher>> e : watchTable.entrySet()) { pwriter.println(e.getKey()); for (Watcher w : e.getValue()) { pwriter.print("\t0x"); pwriter.print(Long.toHexString(((ServerCnxn)w).getSessionId())); pwriter.print("\n"); } } } else { for (Entry<Watcher, HashSet<String>> e : watch2Paths.entrySet()) { pwriter.print("0x"); pwriter.println(Long.toHexString(((ServerCnxn)e.getKey()).getSessionId())); for (String path : e.getValue()) { pwriter.print("\t"); pwriter.println(path); } } } }
synchronized void dumpWatches(PrintWriter pwriter, boolean byPath) { if (byPath) { for (Entry<String, HashSet<Watcher>> e : watchTable.entrySet()) { pwriter.println(e.getKey()); for (Watcher w : e.getValue()) { pwriter.print("\t0x"); pwriter.print(Long.toHexString(((ServerCnxn)w).getSessionId())); pwriter.print("\n"); } } } else { for (Entry<Watcher, HashSet<String>> e : watch2Paths.entrySet()) { pwriter.print("0x"); pwriter.println(Long.toHexString(((ServerCnxn)e.getKey()).getSessionId())); for (String path : e.getValue()) { pwriter.print("\t"); pwriter.println(path); } } } }
/** * String representation of watches. Warning, may be large! * @param byPath iff true output watches by paths, otw output * watches by connection * @return string representation of watches */
String representation of watches. Warning, may be large
dumpWatches
{ "repo_name": "ehomeshasha/zookeeper", "path": "src/java/main/org/apache/zookeeper/server/WatchManager.java", "license": "apache-2.0", "size": 6371 }
[ "java.io.PrintWriter", "java.util.HashSet", "java.util.Map", "org.apache.zookeeper.Watcher" ]
import java.io.PrintWriter; import java.util.HashSet; import java.util.Map; import org.apache.zookeeper.Watcher;
import java.io.*; import java.util.*; import org.apache.zookeeper.*;
[ "java.io", "java.util", "org.apache.zookeeper" ]
java.io; java.util; org.apache.zookeeper;
317,611
@Types.Counter long received();
@Types.Counter long received();
/** * How many incoming messages were received * * Used in billing * * @return number of received messages in account */
How many incoming messages were received Used in billing
received
{ "repo_name": "mailrest/maildal", "path": "src/main/java/com/mailrest/maildal/model/MessageStatsDaily.java", "license": "apache-2.0", "size": 3071 }
[ "com.noorq.casser.mapping.annotation.Types" ]
import com.noorq.casser.mapping.annotation.Types;
import com.noorq.casser.mapping.annotation.*;
[ "com.noorq.casser" ]
com.noorq.casser;
454,956
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<RuleSetInner>> getWithResponseAsync( String resourceGroupName, String profileName, String ruleSetName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (profileName == null) { return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); } if (ruleSetName == null) { return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), resourceGroupName, profileName, ruleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<RuleSetInner>> function( String resourceGroupName, String profileName, String ruleSetName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (profileName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (ruleSetName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), resourceGroupName, profileName, ruleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context); }
/** * Gets an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, * resource group and profile. * * @param resourceGroupName Name of the Resource group within the Azure subscription. * @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique * within the resource group. * @param ruleSetName Name of the rule set under the profile which is unique globally. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, * resource group and profile along with {@link Response} on successful completion of {@link Mono}. */
Gets an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, resource group and profile
getWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cdn/src/main/java/com/azure/resourcemanager/cdn/implementation/RuleSetsClientImpl.java", "license": "mit", "size": 69261 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.cdn.fluent.models.RuleSetInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.cdn.fluent.models.RuleSetInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.cdn.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,319,882
@Override protected void onStart() { super.onStart(); CastDevice selectedDevice = TicTacToeApplication.getInstance().getDevice(); CastContext castContext = TicTacToeApplication.getInstance().getCastContext(); mSession = new ApplicationSession(castContext, selectedDevice); mSession.setListener(mSessionListener); try { mSession.startSession("TicTacToe"); } catch (IOException e) { Log.e(TAG, "Failed to open a session", e); } }
void function() { super.onStart(); CastDevice selectedDevice = TicTacToeApplication.getInstance().getDevice(); CastContext castContext = TicTacToeApplication.getInstance().getCastContext(); mSession = new ApplicationSession(castContext, selectedDevice); mSession.setListener(mSessionListener); try { mSession.startSession(STR); } catch (IOException e) { Log.e(TAG, STR, e); } }
/** * Called on application start. Using the previously selected Cast device, attempts to begin a * session using the application name TicTacToe. */
Called on application start. Using the previously selected Cast device, attempts to begin a session using the application name TicTacToe
onStart
{ "repo_name": "nicolasjafelle/AndroidCastDemo", "path": "AndroidCastDemoProject/AndroidCastDemo/src/main/java/com/android/cast/demo/GameActivity.java", "license": "apache-2.0", "size": 12993 }
[ "android.util.Log", "com.google.cast.ApplicationSession", "com.google.cast.CastContext", "com.google.cast.CastDevice", "java.io.IOException" ]
import android.util.Log; import com.google.cast.ApplicationSession; import com.google.cast.CastContext; import com.google.cast.CastDevice; import java.io.IOException;
import android.util.*; import com.google.cast.*; import java.io.*;
[ "android.util", "com.google.cast", "java.io" ]
android.util; com.google.cast; java.io;
339,003
AccountType acctType1 = (AccountType) o1; AccountType acctType2 = (AccountType) o2; int acctTypeComp = acctType1.getAccountTypeCode().compareTo(acctType2.getAccountTypeCode()); return acctTypeComp; }
AccountType acctType1 = (AccountType) o1; AccountType acctType2 = (AccountType) o2; int acctTypeComp = acctType1.getAccountTypeCode().compareTo(acctType2.getAccountTypeCode()); return acctTypeComp; }
/** * If these two account type codes are the same codes * * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */
If these two account type codes are the same codes
compare
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/coa/businessobject/options/AccountTypeCodeComparator.java", "license": "agpl-3.0", "size": 1651 }
[ "org.kuali.kfs.coa.businessobject.AccountType" ]
import org.kuali.kfs.coa.businessobject.AccountType;
import org.kuali.kfs.coa.businessobject.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
1,037,285
@RequestMapping("topics/{id}/unsubscribe") @ResponseBody public ModelAndView unsubscribeFromTopic(@PathVariable Long id, @RequestHeader(value = "X-Requested-With", defaultValue = "NotAjax") String header ) throws NotFoundException { Topic topic = topicFetchService.get(id); subscriptionService.toggleTopicSubscription(topic); if (header.equals("NotAjax")) { //redirect to new page return new ModelAndView("redirect:/topics/" + id); } else { //no redirecting, perform AJAX request return null; } }
@RequestMapping(STR) ModelAndView function(@PathVariable Long id, @RequestHeader(value = STR, defaultValue = STR) String header ) throws NotFoundException { Topic topic = topicFetchService.get(id); subscriptionService.toggleTopicSubscription(topic); if (header.equals(STR)) { return new ModelAndView(STR + id); } else { return null; } }
/** * Deactivates branch updates subscription for the current user * * @param id identifies topic to unsubscribe from * @throws NotFoundException if no object is found for id given */
Deactivates branch updates subscription for the current user
unsubscribeFromTopic
{ "repo_name": "NCNecros/jcommune", "path": "jcommune-view/jcommune-web-controller/src/main/java/org/jtalks/jcommune/web/controller/SubscriptionController.java", "license": "lgpl-2.1", "size": 5900 }
[ "org.jtalks.jcommune.model.entity.Topic", "org.jtalks.jcommune.plugin.api.exceptions.NotFoundException", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestHeader", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.servlet.ModelAndView" ]
import org.jtalks.jcommune.model.entity.Topic; import org.jtalks.jcommune.plugin.api.exceptions.NotFoundException; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView;
import org.jtalks.jcommune.model.entity.*; import org.jtalks.jcommune.plugin.api.exceptions.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*;
[ "org.jtalks.jcommune", "org.springframework.web" ]
org.jtalks.jcommune; org.springframework.web;
508,685
@Override public void run(final TaskMonitor taskMonitor) throws Exception { final CyNetworkManager netManager = serviceRegistrar.getService(CyNetworkManager.class); final CyTableManager tableManager = serviceRegistrar.getService(CyTableManager.class); if (netManager.getNetworkSet().isEmpty() && tableManager.getAllTables(false).isEmpty()) loadSession(this); else insertTasksAfterCurrentTask(new OpenSessionWithWarningTask()); }
void function(final TaskMonitor taskMonitor) throws Exception { final CyNetworkManager netManager = serviceRegistrar.getService(CyNetworkManager.class); final CyTableManager tableManager = serviceRegistrar.getService(CyTableManager.class); if (netManager.getNetworkSet().isEmpty() && tableManager.getAllTables(false).isEmpty()) loadSession(this); else insertTasksAfterCurrentTask(new OpenSessionWithWarningTask()); }
/** * Clear current session and open the cys file. */
Clear current session and open the cys file
run
{ "repo_name": "cytoscape/cytoscape-impl", "path": "core-task-impl/src/main/java/org/cytoscape/task/internal/session/OpenSessionTask.java", "license": "lgpl-2.1", "size": 6084 }
[ "org.cytoscape.model.CyNetworkManager", "org.cytoscape.model.CyTableManager", "org.cytoscape.work.TaskMonitor" ]
import org.cytoscape.model.CyNetworkManager; import org.cytoscape.model.CyTableManager; import org.cytoscape.work.TaskMonitor;
import org.cytoscape.model.*; import org.cytoscape.work.*;
[ "org.cytoscape.model", "org.cytoscape.work" ]
org.cytoscape.model; org.cytoscape.work;
1,774,166
public boolean interactWithEntitySendPacket(EntityPlayer p_78768_1_, Entity p_78768_2_) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_78768_2_, C02PacketUseEntity.Action.INTERACT)); return p_78768_1_.interactWith(p_78768_2_); }
boolean function(EntityPlayer p_78768_1_, Entity p_78768_2_) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_78768_2_, C02PacketUseEntity.Action.INTERACT)); return p_78768_1_.interactWith(p_78768_2_); }
/** * Send packet to server - player is interacting with another entity (left click) */
Send packet to server - player is interacting with another entity (left click)
interactWithEntitySendPacket
{ "repo_name": "mviitanen/marsmod", "path": "mcp/src/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java", "license": "gpl-2.0", "size": 20783 }
[ "net.minecraft.entity.Entity", "net.minecraft.entity.player.EntityPlayer", "net.minecraft.network.play.client.C02PacketUseEntity" ]
import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.entity.*; import net.minecraft.entity.player.*; import net.minecraft.network.play.client.*;
[ "net.minecraft.entity", "net.minecraft.network" ]
net.minecraft.entity; net.minecraft.network;
1,624,664
return getLines(dbSession, fileUuid, from, toInclusive, Functions.<DbFileSources.Line>identity()); }
return getLines(dbSession, fileUuid, from, toInclusive, Functions.<DbFileSources.Line>identity()); }
/** * Returns a range of lines as raw db data. User permission is not verified. * @param from starts from 1 * @param toInclusive starts from 1, must be greater than or equal param {@code from} */
Returns a range of lines as raw db data. User permission is not verified
getLines
{ "repo_name": "vamsirajendra/sonarqube", "path": "server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java", "license": "lgpl-3.0", "size": 4946 }
[ "com.google.common.base.Functions", "org.sonar.db.protobuf.DbFileSources" ]
import com.google.common.base.Functions; import org.sonar.db.protobuf.DbFileSources;
import com.google.common.base.*; import org.sonar.db.protobuf.*;
[ "com.google.common", "org.sonar.db" ]
com.google.common; org.sonar.db;
1,667,524
public Query getCurrentQuery() { return currentQuery; }
Query function() { return currentQuery; }
/** * Exposed for unit testing purposes only */
Exposed for unit testing purposes only
getCurrentQuery
{ "repo_name": "Sage-Bionetworks/SynapseWebClient", "path": "src/main/java/org/sagebionetworks/web/client/widget/table/explore/TableEntityPlotsWidget.java", "license": "apache-2.0", "size": 25038 }
[ "org.sagebionetworks.repo.model.table.Query" ]
import org.sagebionetworks.repo.model.table.Query;
import org.sagebionetworks.repo.model.table.*;
[ "org.sagebionetworks.repo" ]
org.sagebionetworks.repo;
2,570,865
@Override public Object[] getSelectedObjects(Container parent) { BaseRegExp[] result; MultiLineValueDialog dialog; List<String> lines; int i; if (GUIHelper.getParentDialog(parent) != null) dialog = new MultiLineValueDialog(GUIHelper.getParentDialog(parent)); else dialog = new MultiLineValueDialog(GUIHelper.getParentFrame(parent)); dialog.setInfoText("Enter the regular expressions, one per line:"); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); lines = dialog.getValues(); result = new BaseRegExp[lines.size()]; for (i = 0; i < lines.size(); i++) result[i] = (BaseRegExp) parse(lines.get(i)); return result; }
Object[] function(Container parent) { BaseRegExp[] result; MultiLineValueDialog dialog; List<String> lines; int i; if (GUIHelper.getParentDialog(parent) != null) dialog = new MultiLineValueDialog(GUIHelper.getParentDialog(parent)); else dialog = new MultiLineValueDialog(GUIHelper.getParentFrame(parent)); dialog.setInfoText(STR); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); lines = dialog.getValues(); result = new BaseRegExp[lines.size()]; for (i = 0; i < lines.size(); i++) result[i] = (BaseRegExp) parse(lines.get(i)); return result; }
/** * Returns the selected objects. * * @param parent the parent container * @return the objects */
Returns the selected objects
getSelectedObjects
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-core/src/main/java/adams/gui/goe/BaseRegExpEditor.java", "license": "gpl-3.0", "size": 8555 }
[ "java.awt.Container", "java.util.List" ]
import java.awt.Container; import java.util.List;
import java.awt.*; import java.util.*;
[ "java.awt", "java.util" ]
java.awt; java.util;
580,618
public String getProperty(String property) throws XMLDBException { return null; }
String function(String property) throws XMLDBException { return null; }
/** * Gets the property attribute of the UserManagementServiceImpl object * *@param property Description of the Parameter *@return The property value *@exception XMLDBException Description of the Exception */
Gets the property attribute of the UserManagementServiceImpl object
getProperty
{ "repo_name": "NCIP/cadsr-cgmdr-nci-uk", "path": "src/org/exist/xmldb/RemoteUserManagementService.java", "license": "bsd-3-clause", "size": 21780 }
[ "org.xmldb.api.base.XMLDBException" ]
import org.xmldb.api.base.XMLDBException;
import org.xmldb.api.base.*;
[ "org.xmldb.api" ]
org.xmldb.api;
125,033
public void clearAllFilters() { for (Entry<Object, CellFilterComponent<?>> entry : this.cellFilters.entrySet()) { entry.getValue() .clearFilter(); removeFilter(entry.getKey(), false); } notifyCellFilterChanged(); }
void function() { for (Entry<Object, CellFilterComponent<?>> entry : this.cellFilters.entrySet()) { entry.getValue() .clearFilter(); removeFilter(entry.getKey(), false); } notifyCellFilterChanged(); }
/** * removes all filters and clear all inputs */
removes all filters and clear all inputs
clearAllFilters
{ "repo_name": "gpedro/vaadin-grid-util", "path": "vaadin-grid-util/src/main/java/org/vaadin/gridutil/cell/GridCellFilter.java", "license": "mit", "size": 23325 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,187,198
public static void assertNegativeOrZero(float actual) { if (actual > 0f) { fail("Expecting a negative or zero number, actual: " + actual); //$NON-NLS-1$ } }
static void function(float actual) { if (actual > 0f) { fail(STR + actual); } }
/** Assert that the given value is negative or zero. * * @param actual - the value to test. */
Assert that the given value is negative or zero
assertNegativeOrZero
{ "repo_name": "jgfoster/sarl", "path": "tests/io.sarl.tests.api/src/main/java/io/sarl/tests/api/AbstractSarlTest.java", "license": "apache-2.0", "size": 70743 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
282,324
List<WeekDO> findWeeksByStartDayAndFinalDay( Date startDay, Date finalDay );
List<WeekDO> findWeeksByStartDayAndFinalDay( Date startDay, Date finalDay );
/** * Find Weeks between startDay and FinalDay */
Find Weeks between startDay and FinalDay
findWeeksByStartDayAndFinalDay
{ "repo_name": "sidlors/digital-booking", "path": "digital-booking-persistence/src/main/java/mx/com/cinepolis/digital/booking/persistence/dao/WeekDAO.java", "license": "epl-1.0", "size": 2602 }
[ "java.util.Date", "java.util.List", "mx.com.cinepolis.digital.booking.model.WeekDO" ]
import java.util.Date; import java.util.List; import mx.com.cinepolis.digital.booking.model.WeekDO;
import java.util.*; import mx.com.cinepolis.digital.booking.model.*;
[ "java.util", "mx.com.cinepolis" ]
java.util; mx.com.cinepolis;
2,675,085
public Group getGroup() { return group; }
Group function() { return group; }
/** * Methode zum Erhalten der Group * * @return Group, die die einzelnen graphischen Komponenten enthält */
Methode zum Erhalten der Group
getGroup
{ "repo_name": "kevinott/crypto", "path": "org.jcryptool.visual.zeroknowledge/src/org/jcryptool/visual/zeroknowledge/ui/ParamsPerson.java", "license": "epl-1.0", "size": 2486 }
[ "org.eclipse.swt.widgets.Group" ]
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
276,406
public final void xtestmakeInitials() throws ConstraintException { final WritableVersion version = this.model.getTestVersion(); try { final Experiment experiment = POJOFactory.createExperiment(version); //System.out.println("the owner is: " + StockUtility.makeInitials(experiment)); //Assert.assertTrue("reference".equals(StockUtility.makeInitials(experiment))); final Person pers = POJOFactory.createPerson(version); pers.setGivenName("Fred"); pers.setFamilyName("Flintstone"); final List<String> initList = new java.util.ArrayList(); initList.add("A"); initList.add("b"); initList.add("C"); pers.setMiddleInitials(initList); final User user = POJOFactory.createUser(version); pers.addUser(user); //experiment.setCreator(user); //Assert.assertTrue("FABCF".equals(StockUtility.makeInitials(experiment))); } finally { version.abort(); } }
final void function() throws ConstraintException { final WritableVersion version = this.model.getTestVersion(); try { final Experiment experiment = POJOFactory.createExperiment(version); final Person pers = POJOFactory.createPerson(version); pers.setGivenName("Fred"); pers.setFamilyName(STR); final List<String> initList = new java.util.ArrayList(); initList.add("A"); initList.add("b"); initList.add("C"); pers.setMiddleInitials(initList); final User user = POJOFactory.createUser(version); pers.addUser(user); } finally { version.abort(); } }
/** * Test method for * {@link org.pimslims.presentation.StockUtility#makeInitials(org.pimslims.model.experiment.Experiment)}. */
Test method for <code>org.pimslims.presentation.StockUtility#makeInitials(org.pimslims.model.experiment.Experiment)</code>
xtestmakeInitials
{ "repo_name": "homiak/pims-lims", "path": "TestSource/org/pimslims/presentation/StockUtilityTest.java", "license": "bsd-2-clause", "size": 23977 }
[ "java.util.List", "org.pimslims.dao.WritableVersion", "org.pimslims.exception.ConstraintException", "org.pimslims.model.accessControl.User", "org.pimslims.model.experiment.Experiment", "org.pimslims.model.people.Person", "org.pimslims.test.POJOFactory" ]
import java.util.List; import org.pimslims.dao.WritableVersion; import org.pimslims.exception.ConstraintException; import org.pimslims.model.accessControl.User; import org.pimslims.model.experiment.Experiment; import org.pimslims.model.people.Person; import org.pimslims.test.POJOFactory;
import java.util.*; import org.pimslims.dao.*; import org.pimslims.exception.*; import org.pimslims.model.*; import org.pimslims.model.experiment.*; import org.pimslims.model.people.*; import org.pimslims.test.*;
[ "java.util", "org.pimslims.dao", "org.pimslims.exception", "org.pimslims.model", "org.pimslims.test" ]
java.util; org.pimslims.dao; org.pimslims.exception; org.pimslims.model; org.pimslims.test;
1,082,779
public void resetRenderingEngine() { if (hasProgrammingRights()) { try { this.xwiki.resetRenderingEngine(getXWikiContext()); } catch (XWikiException e) { } } }
void function() { if (hasProgrammingRights()) { try { this.xwiki.resetRenderingEngine(getXWikiContext()); } catch (XWikiException e) { } } }
/** * Priviledged API to reset the rendenring engine This would restore the rendering engine evaluation loop and take * into account new configuration parameters */
Priviledged API to reset the rendenring engine This would restore the rendering engine evaluation loop and take into account new configuration parameters
resetRenderingEngine
{ "repo_name": "xwiki-labs/sankoreorg", "path": "xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/XWiki.java", "license": "lgpl-2.1", "size": 124899 }
[ "com.xpn.xwiki.XWikiException" ]
import com.xpn.xwiki.XWikiException;
import com.xpn.xwiki.*;
[ "com.xpn.xwiki" ]
com.xpn.xwiki;
1,650,822
public static DataSource resolveDataSource(DataSourceConfig config) { DataSource dataSource = null; if (config == null) { throw new RuntimeException("Device Management Repository data source configuration " + "is null and thus, is not initialized"); } JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); if (jndiConfig != null) { if (log.isDebugEnabled()) { log.debug("Initializing Device Management Repository data source using the JNDI " + "Lookup Definition"); } List<JNDILookupDefinition.JNDIProperty> jndiPropertyList = jndiConfig.getJndiProperties(); if (jndiPropertyList != null) { Hashtable<Object, Object> jndiProperties = new Hashtable<Object, Object>(); for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { jndiProperties.put(prop.getName(), prop.getValue()); } dataSource = PolicyManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties); } else { dataSource = PolicyManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null); } } return dataSource; }
static DataSource function(DataSourceConfig config) { DataSource dataSource = null; if (config == null) { throw new RuntimeException(STR + STR); } JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); if (jndiConfig != null) { if (log.isDebugEnabled()) { log.debug(STR + STR); } List<JNDILookupDefinition.JNDIProperty> jndiPropertyList = jndiConfig.getJndiProperties(); if (jndiPropertyList != null) { Hashtable<Object, Object> jndiProperties = new Hashtable<Object, Object>(); for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { jndiProperties.put(prop.getName(), prop.getValue()); } dataSource = PolicyManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties); } else { dataSource = PolicyManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null); } } return dataSource; }
/** * Resolve data source from the data source definition * * @param config data source configuration * @return data source resolved from the data source definition */
Resolve data source from the data source definition
resolveDataSource
{ "repo_name": "ayyoob/carbon-device-mgt", "path": "components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java", "license": "apache-2.0", "size": 7600 }
[ "java.util.Hashtable", "java.util.List", "javax.sql.DataSource", "org.wso2.carbon.policy.mgt.core.config.datasource.DataSourceConfig", "org.wso2.carbon.policy.mgt.core.config.datasource.JNDILookupDefinition", "org.wso2.carbon.policy.mgt.core.dao.util.PolicyManagementDAOUtil" ]
import java.util.Hashtable; import java.util.List; import javax.sql.DataSource; import org.wso2.carbon.policy.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.policy.mgt.core.config.datasource.JNDILookupDefinition; import org.wso2.carbon.policy.mgt.core.dao.util.PolicyManagementDAOUtil;
import java.util.*; import javax.sql.*; import org.wso2.carbon.policy.mgt.core.config.datasource.*; import org.wso2.carbon.policy.mgt.core.dao.util.*;
[ "java.util", "javax.sql", "org.wso2.carbon" ]
java.util; javax.sql; org.wso2.carbon;
1,523,277
protected static List<AvaticaParameter> parameters(ParameterMetaData metaData) throws SQLException { if (metaData == null) { return Collections.emptyList(); } final List<AvaticaParameter> params = new ArrayList<>(); for (int i = 1; i <= metaData.getParameterCount(); i++) { params.add( new AvaticaParameter(metaData.isSigned(i), metaData.getPrecision(i), metaData.getScale(i), metaData.getParameterType(i), metaData.getParameterTypeName(i), metaData.getParameterClassName(i), "?" + i)); } return params; }
static List<AvaticaParameter> function(ParameterMetaData metaData) throws SQLException { if (metaData == null) { return Collections.emptyList(); } final List<AvaticaParameter> params = new ArrayList<>(); for (int i = 1; i <= metaData.getParameterCount(); i++) { params.add( new AvaticaParameter(metaData.isSigned(i), metaData.getPrecision(i), metaData.getScale(i), metaData.getParameterType(i), metaData.getParameterTypeName(i), metaData.getParameterClassName(i), "?" + i)); } return params; }
/** * Converts from JDBC metadata to Avatica parameters */
Converts from JDBC metadata to Avatica parameters
parameters
{ "repo_name": "wanglan/calcite", "path": "avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java", "license": "apache-2.0", "size": 35802 }
[ "java.sql.ParameterMetaData", "java.sql.SQLException", "java.util.ArrayList", "java.util.Collections", "java.util.List", "org.apache.calcite.avatica.AvaticaParameter" ]
import java.sql.ParameterMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.calcite.avatica.AvaticaParameter;
import java.sql.*; import java.util.*; import org.apache.calcite.avatica.*;
[ "java.sql", "java.util", "org.apache.calcite" ]
java.sql; java.util; org.apache.calcite;
2,856,878
protected void checkArguments(Graph<V, E> graph, V src, V dst) { checkNotNull(graph, "Graph cannot be null"); checkNotNull(src, "Source cannot be null"); Set<V> vertices = graph.getVertexes(); checkArgument(vertices.contains(src), "Source not in the graph"); checkArgument(dst == null || vertices.contains(dst), "Destination not in graph"); }
void function(Graph<V, E> graph, V src, V dst) { checkNotNull(graph, STR); checkNotNull(src, STR); Set<V> vertices = graph.getVertexes(); checkArgument(vertices.contains(src), STR); checkArgument(dst == null vertices.contains(dst), STR); }
/** * Checks the specified path search arguments for validity. * * @param graph graph; must not be null * @param src source vertex; must not be null and belong to graph * @param dst optional target vertex; must belong to graph */
Checks the specified path search arguments for validity
checkArguments
{ "repo_name": "Shashikanth-Huawei/bmp", "path": "utils/misc/src/main/java/org/onlab/graph/AbstractGraphPathSearch.java", "license": "apache-2.0", "size": 11386 }
[ "com.google.common.base.Preconditions", "java.util.Set" ]
import com.google.common.base.Preconditions; import java.util.Set;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
799,843
public void addCacheParticipants(Map<UUID, IgniteUuid> allParticipants, Map<UUID, IgniteUuid> addedParticipants) { verStore.addParticipants(allParticipants, addedParticipants); }
void function(Map<UUID, IgniteUuid> allParticipants, Map<UUID, IgniteUuid> addedParticipants) { verStore.addParticipants(allParticipants, addedParticipants); }
/** * Adds participants to all SHARED deployments. * * @param allParticipants All participants. * @param addedParticipants Added participants. */
Adds participants to all SHARED deployments
addCacheParticipants
{ "repo_name": "NSAmelchev/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentManager.java", "license": "apache-2.0", "size": 23057 }
[ "java.util.Map", "org.apache.ignite.lang.IgniteUuid" ]
import java.util.Map; import org.apache.ignite.lang.IgniteUuid;
import java.util.*; import org.apache.ignite.lang.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
484,324
private static boolean sync(FileOutputStream stream) { //noinspection EmptyCatchBlock try { if (stream != null) { stream.getFD().sync(); } return true; } catch (IOException e) { } return false; }
static boolean function(FileOutputStream stream) { try { if (stream != null) { stream.getFD().sync(); } return true; } catch (IOException e) { } return false; }
/** * Perform an fsync on the given FileOutputStream. The stream at this * point must be flushed but not yet closed. */
Perform an fsync on the given FileOutputStream. The stream at this point must be flushed but not yet closed
sync
{ "repo_name": "libraua/Paper", "path": "paperdb/src/main/java/io/paperdb/DbStoragePlainFile.java", "license": "apache-2.0", "size": 9431 }
[ "java.io.FileOutputStream", "java.io.IOException" ]
import java.io.FileOutputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
537,912
public EnvironmentConfigurations getEnvironmentConfigurations() { try { if (configProvider != null) { environmentConfigurations = configProvider.getConfigurationObject(EnvironmentConfigurations.class); } else { log.error("Configuration provider is null"); } } catch (ConfigurationException e) { log.error("error getting config : org.wso2.carbon.apimgt.core.internal.EnvironmentConfigurations", e); } if (environmentConfigurations == null) { environmentConfigurations = new EnvironmentConfigurations(); log.info("EnvironmentConfigurations: Setting default configurations..."); } return environmentConfigurations; }
EnvironmentConfigurations function() { try { if (configProvider != null) { environmentConfigurations = configProvider.getConfigurationObject(EnvironmentConfigurations.class); } else { log.error(STR); } } catch (ConfigurationException e) { log.error(STR, e); } if (environmentConfigurations == null) { environmentConfigurations = new EnvironmentConfigurations(); log.info(STR); } return environmentConfigurations; }
/** * Gives the EnvironmentConfigurations explicitly set in the deployment yaml or the default configurations * * @return EnvironmentConfigurations */
Gives the EnvironmentConfigurations explicitly set in the deployment yaml or the default configurations
getEnvironmentConfigurations
{ "repo_name": "Minoli/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.core/src/main/java/org/wso2/carbon/apimgt/core/internal/ServiceReferenceHolder.java", "license": "apache-2.0", "size": 4947 }
[ "org.wso2.carbon.apimgt.core.configuration.models.EnvironmentConfigurations", "org.wso2.carbon.config.ConfigurationException" ]
import org.wso2.carbon.apimgt.core.configuration.models.EnvironmentConfigurations; import org.wso2.carbon.config.ConfigurationException;
import org.wso2.carbon.apimgt.core.configuration.models.*; import org.wso2.carbon.config.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,899,202
private Builder delete(Node n, boolean deleteWhitespaceBefore) { int startPosition = n.getSourceOffset(); int length = n.getLength(); JSDocInfo jsDoc = NodeUtil.getBestJSDocInfo(n); if (jsDoc != null) { length += (startPosition - jsDoc.getOriginalCommentPosition()); startPosition = jsDoc.getOriginalCommentPosition(); } // Variable declarations require special handling since the NAME node doesn't contain enough // information if the variable is declared in a multi-variable declaration. The NAME node // in a VAR declaration doesn't include its child in its length if there is an inline // assignment, and the code needs to know how to delete the commas. See SuggestedFixTest for // more information. // TODO(mknichel): Move this logic and the start position logic to a helper function // so that it can be reused in other methods. if (n.isName() && n.getParent().isVar()) { if (n.getNext() != null) { length = n.getNext().getSourceOffset() - startPosition; } else if (n.hasChildren()) { Node child = n.getFirstChild(); length = (child.getSourceOffset() + child.getLength()) - startPosition; } if (n.getParent().getLastChild() == n && n != n.getParent().getFirstChild()) { Node previousSibling = n.getParent().getChildBefore(n); if (previousSibling.hasChildren()) { Node child = previousSibling.getFirstChild(); int startPositionDiff = startPosition - (child.getSourceOffset() + child.getLength()); startPosition -= startPositionDiff; length += startPositionDiff; } else { int startPositionDiff = startPosition - ( previousSibling.getSourceOffset() + previousSibling.getLength()); startPosition -= startPositionDiff; length += startPositionDiff; } } } Node parent = n.getParent(); if (deleteWhitespaceBefore && parent != null && (parent.isScript() || parent.isBlock())) { Node previousSibling = parent.getChildBefore(n); if (previousSibling != null) { int previousSiblingEndPosition = previousSibling.getSourceOffset() + previousSibling.getLength(); length += (startPosition - previousSiblingEndPosition); startPosition = previousSiblingEndPosition; } } replacements.put(n.getSourceFileName(), new CodeReplacement(startPosition, length, "")); return this; }
Builder function(Node n, boolean deleteWhitespaceBefore) { int startPosition = n.getSourceOffset(); int length = n.getLength(); JSDocInfo jsDoc = NodeUtil.getBestJSDocInfo(n); if (jsDoc != null) { length += (startPosition - jsDoc.getOriginalCommentPosition()); startPosition = jsDoc.getOriginalCommentPosition(); } if (n.isName() && n.getParent().isVar()) { if (n.getNext() != null) { length = n.getNext().getSourceOffset() - startPosition; } else if (n.hasChildren()) { Node child = n.getFirstChild(); length = (child.getSourceOffset() + child.getLength()) - startPosition; } if (n.getParent().getLastChild() == n && n != n.getParent().getFirstChild()) { Node previousSibling = n.getParent().getChildBefore(n); if (previousSibling.hasChildren()) { Node child = previousSibling.getFirstChild(); int startPositionDiff = startPosition - (child.getSourceOffset() + child.getLength()); startPosition -= startPositionDiff; length += startPositionDiff; } else { int startPositionDiff = startPosition - ( previousSibling.getSourceOffset() + previousSibling.getLength()); startPosition -= startPositionDiff; length += startPositionDiff; } } } Node parent = n.getParent(); if (deleteWhitespaceBefore && parent != null && (parent.isScript() parent.isBlock())) { Node previousSibling = parent.getChildBefore(n); if (previousSibling != null) { int previousSiblingEndPosition = previousSibling.getSourceOffset() + previousSibling.getLength(); length += (startPosition - previousSiblingEndPosition); startPosition = previousSiblingEndPosition; } } replacements.put(n.getSourceFileName(), new CodeReplacement(startPosition, length, "")); return this; }
/** * Deletes a node and its contents from the source file. */
Deletes a node and its contents from the source file
delete
{ "repo_name": "mneise/closure-compiler", "path": "src/com/google/javascript/refactoring/SuggestedFix.java", "license": "apache-2.0", "size": 25097 }
[ "com.google.javascript.jscomp.NodeUtil", "com.google.javascript.rhino.JSDocInfo", "com.google.javascript.rhino.Node" ]
import com.google.javascript.jscomp.NodeUtil; import com.google.javascript.rhino.JSDocInfo; import com.google.javascript.rhino.Node;
import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,711,091
public Result makeNewResult(SqlNode node, Collection<Clause> clauses, String neededAlias, RelDataType neededType, Map<String, RelDataType> aliases) { return new Result(node, clauses, neededAlias, neededType, aliases); }
Result function(SqlNode node, Collection<Clause> clauses, String neededAlias, RelDataType neededType, Map<String, RelDataType> aliases) { return new Result(node, clauses, neededAlias, neededType, aliases); }
/** * Factory method for Result */
Factory method for Result
makeNewResult
{ "repo_name": "dremio/dremio-oss", "path": "sabot/kernel/src/main/java/com/dremio/common/rel2sql/SqlImplementor.java", "license": "apache-2.0", "size": 46183 }
[ "java.util.Collection", "java.util.Map", "org.apache.calcite.rel.type.RelDataType", "org.apache.calcite.sql.SqlNode" ]
import java.util.Collection; import java.util.Map; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.sql.SqlNode;
import java.util.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.sql.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
932,976
public ASN1Primitive getLoadedObject() throws IOException { return _parser.readTaggedObject(_constructed, _tagNumber); }
ASN1Primitive function() throws IOException { return _parser.readTaggedObject(_constructed, _tagNumber); }
/** * Return an in-memory, encodable, representation of the tagged object. * * @return an ASN1TaggedObject. * @throws IOException if there is an issue loading the data. */
Return an in-memory, encodable, representation of the tagged object
getLoadedObject
{ "repo_name": "thedrummeraki/Aki-SSL", "path": "src/org/bouncycastle/asn1/BERTaggedObjectParser.java", "license": "apache-2.0", "size": 2502 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
7,442
public final void xdrEncodeIntFixedVector(int [] value, int length) throws OncRpcException, IOException { if ( value.length != length ) { throw(new IllegalArgumentException("array size does not match protocol specification")); } for ( int i = 0; i < length; i++ ) { xdrEncodeInt(value[i]); } }
final void function(int [] value, int length) throws OncRpcException, IOException { if ( value.length != length ) { throw(new IllegalArgumentException(STR)); } for ( int i = 0; i < length; i++ ) { xdrEncodeInt(value[i]); } }
/** * Encodes (aka "serializes") a vector of ints and writes it down * this XDR stream. * * @param value int vector to be encoded. * @param length of vector to write. This parameter is used as a sanity * check. * * @throws OncRpcException if an ONC/RPC error occurs. * @throws IOException if an I/O error occurs. * @throws IllegalArgumentException if the length of the vector does not * match the specified length. */
Encodes (aka "serializes") a vector of ints and writes it down this XDR stream
xdrEncodeIntFixedVector
{ "repo_name": "kragniz/java-player", "path": "src/xdr/XdrEncodingStream.java", "license": "gpl-2.0", "size": 25737 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
667,379
@Deprecated public static int parsePAT(ByteBuffer data) { PATSection pat = PATSection.parse(data); if (pat.getPrograms().size() > 0) return pat.getPrograms().values()[0]; else return -1; }
static int function(ByteBuffer data) { PATSection pat = PATSection.parse(data); if (pat.getPrograms().size() > 0) return pat.getPrograms().values()[0]; else return -1; }
/** * Parses PAT ( Program Association Table ) * * @param data * @deprecated Use org.jcodec.containers.mps.psi.PAT.parse method instead, * this method will not work correctly for streams with multiple * programs * @return Pid of the first PMT found in the PAT */
Parses PAT ( Program Association Table )
parsePAT
{ "repo_name": "minseonahn/jcodec", "path": "src/main/java/org/jcodec/containers/mps/MTSUtils.java", "license": "bsd-2-clause", "size": 8891 }
[ "java.nio.ByteBuffer", "org.jcodec.containers.mps.psi.PATSection" ]
import java.nio.ByteBuffer; import org.jcodec.containers.mps.psi.PATSection;
import java.nio.*; import org.jcodec.containers.mps.psi.*;
[ "java.nio", "org.jcodec.containers" ]
java.nio; org.jcodec.containers;
1,441,991
private AggregateByTimePeriod generateAggregateByTime(TimePeriod timePeriod) throws DesignGenerationException { preserveCodeSegment(timePeriod); if (("INTERVAL").equalsIgnoreCase(timePeriod.getOperator().toString())) { return generateAggregateByTimeInterval(timePeriod.getDurations()); } else if (("RANGE").equalsIgnoreCase(timePeriod.getOperator().toString())) { return generateAggregateByTimeRange(timePeriod.getDurations()); } throw new DesignGenerationException("Unable to generate AggregateByTime for TimePeriod of type unknown"); }
AggregateByTimePeriod function(TimePeriod timePeriod) throws DesignGenerationException { preserveCodeSegment(timePeriod); if ((STR).equalsIgnoreCase(timePeriod.getOperator().toString())) { return generateAggregateByTimeInterval(timePeriod.getDurations()); } else if (("RANGE").equalsIgnoreCase(timePeriod.getOperator().toString())) { return generateAggregateByTimeRange(timePeriod.getDurations()); } throw new DesignGenerationException(STR); }
/** * Generates AggregateByTimePeriod object with the given Siddhi TimePeriod * @param timePeriod Siddhi TimePeriod object * @return AggregateByTimePeriod object * @throws DesignGenerationException Unknown type of TimePeriod operator */
Generates AggregateByTimePeriod object with the given Siddhi TimePeriod
generateAggregateByTime
{ "repo_name": "minudika/carbon-analytics", "path": "components/org.wso2.carbon.siddhi.editor.core/src/main/java/org/wso2/carbon/siddhi/editor/core/util/designview/designgenerator/generators/AggregationConfigGenerator.java", "license": "apache-2.0", "size": 8831 }
[ "org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.siddhielements.aggregation.aggregationbytimeperiod.AggregateByTimePeriod", "org.wso2.carbon.siddhi.editor.core.util.designview.exceptions.DesignGenerationException", "org.wso2.siddhi.query.api.aggregation.TimePeriod" ]
import org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.siddhielements.aggregation.aggregationbytimeperiod.AggregateByTimePeriod; import org.wso2.carbon.siddhi.editor.core.util.designview.exceptions.DesignGenerationException; import org.wso2.siddhi.query.api.aggregation.TimePeriod;
import org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.siddhielements.aggregation.aggregationbytimeperiod.*; import org.wso2.carbon.siddhi.editor.core.util.designview.exceptions.*; import org.wso2.siddhi.query.api.aggregation.*;
[ "org.wso2.carbon", "org.wso2.siddhi" ]
org.wso2.carbon; org.wso2.siddhi;
2,227,583
protected void addUserAgentRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException { LOG.trace("enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, " + "HttpConnection)"); if (getRequestHeader("User-Agent") == null) { String agent = (String)getParams().getParameter(HttpMethodParams.USER_AGENT); if (agent == null) { agent = "Jakarta Commons-HttpClient"; } setRequestHeader("User-Agent", agent); } }
void function(HttpState state, HttpConnection conn) throws IOException, HttpException { LOG.trace(STR + STR); if (getRequestHeader(STR) == null) { String agent = (String)getParams().getParameter(HttpMethodParams.USER_AGENT); if (agent == null) { agent = STR; } setRequestHeader(STR, agent); } }
/** * Generates default <tt>User-Agent</tt> request header, as long as no * <tt>User-Agent</tt> request header already exists. * * @param state the {@link HttpState state} information associated with this method * @param conn the {@link HttpConnection connection} used to execute * this HTTP method * * @throws IOException if an I/O (transport) error occurs. Some transport exceptions * can be recovered from. * @throws HttpException if a protocol exception occurs. Usually protocol exceptions * cannot be recovered from. */
Generates default User-Agent request header, as long as no User-Agent request header already exists
addUserAgentRequestHeader
{ "repo_name": "j4nnis/bproxy", "path": "src/org/apache/commons/httpclient/HttpMethodBase.java", "license": "apache-2.0", "size": 98546 }
[ "java.io.IOException", "org.apache.commons.httpclient.params.HttpMethodParams" ]
import java.io.IOException; import org.apache.commons.httpclient.params.HttpMethodParams;
import java.io.*; import org.apache.commons.httpclient.params.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
650,898
public PointSensitivityBuilder presentValueSensitivityModelParamsSabr( OvernightInArrearsCapletFloorletPeriod period, RatesProvider ratesProvider, SabrParametersIborCapletFloorletVolatilities sabrVolatilities) { Currency currency = period.getCurrency(); if (!ratesProvider.getValuationDate().isBefore(period.getEndDate())) { return PointSensitivityBuilder.none(); } OvernightCompoundedRateComputation onComputation = period.getOvernightRate(); LocalDate startDate = onComputation.getStartDate(); LocalDate endDate = onComputation.getEndDate(); double startTime = sabrVolatilities.relativeTime(startDate.atStartOfDay(ZoneOffset.UTC)); double endTime = sabrVolatilities.relativeTime(endDate.atStartOfDay(ZoneOffset.UTC)); double df = ratesProvider.discountFactor(currency, period.getPaymentDate()); PutCall putCall = period.getPutCall(); double strike = period.getStrike(); double forward = ON_FUNCT .rate(onComputation, onComputation.getStartDate(), onComputation.getEndDate(), ratesProvider); double alpha = sabrVolatilities.alpha(startTime); double beta = sabrVolatilities.beta(startTime); double rho = sabrVolatilities.rho(startTime); double nu = sabrVolatilities.nu(startTime); double shift = sabrVolatilities.shift(startTime); SabrFormulaData sabr = SabrFormulaData.of(alpha, beta, rho, nu); List<ValueDerivatives> sabrAdjusted = sabrInArrearsFunction.effectiveSabrAd(sabr, startTime, endTime); ValueDerivatives volatility = sabrVolatilities.getParameters().getSabrVolatilityFormula() .volatilityAdjoint(forward + shift, strike + shift, endTime, sabrAdjusted.get(0).getValue(), sabrAdjusted.get(1).getValue(), sabrAdjusted.get(2).getValue(), sabrAdjusted.get(3).getValue()); ValueDerivatives price = BlackFormulaRepository .priceAdjoint(forward + shift, strike + shift, endTime, volatility.getValue(), putCall.isCall()); // Backward sweep double pvBar = 1.0; double priceBar = df * period.getYearFraction() * period.getNotional() * pvBar; double volatilityBar = price.getDerivative(3) * priceBar; double alphaHatBar = volatility.getDerivative(2) * volatilityBar; double betaHatBar = volatility.getDerivative(3) * volatilityBar; double rhoHatBar = volatility.getDerivative(4) * volatilityBar; double nuHatBar = volatility.getDerivative(5) * volatilityBar; DoubleArray paramHat = sabrAdjusted.get(0).getDerivatives().multipliedBy(alphaHatBar); paramHat = paramHat.plus(sabrAdjusted.get(1).getDerivatives().multipliedBy(betaHatBar)); paramHat = paramHat.plus(sabrAdjusted.get(2).getDerivatives().multipliedBy(rhoHatBar)); paramHat = paramHat.plus(sabrAdjusted.get(3).getDerivatives().multipliedBy(nuHatBar)); IborCapletFloorletVolatilitiesName name = sabrVolatilities.getName(); return PointSensitivityBuilder.of( IborCapletFloorletSabrSensitivity.of(name, startTime, ALPHA, currency, paramHat.get(0)), IborCapletFloorletSabrSensitivity.of(name, startTime, BETA, currency, paramHat.get(1)), IborCapletFloorletSabrSensitivity.of(name, startTime, RHO, currency, paramHat.get(2)), IborCapletFloorletSabrSensitivity.of(name, startTime, NU, currency, paramHat.get(3))); }
PointSensitivityBuilder function( OvernightInArrearsCapletFloorletPeriod period, RatesProvider ratesProvider, SabrParametersIborCapletFloorletVolatilities sabrVolatilities) { Currency currency = period.getCurrency(); if (!ratesProvider.getValuationDate().isBefore(period.getEndDate())) { return PointSensitivityBuilder.none(); } OvernightCompoundedRateComputation onComputation = period.getOvernightRate(); LocalDate startDate = onComputation.getStartDate(); LocalDate endDate = onComputation.getEndDate(); double startTime = sabrVolatilities.relativeTime(startDate.atStartOfDay(ZoneOffset.UTC)); double endTime = sabrVolatilities.relativeTime(endDate.atStartOfDay(ZoneOffset.UTC)); double df = ratesProvider.discountFactor(currency, period.getPaymentDate()); PutCall putCall = period.getPutCall(); double strike = period.getStrike(); double forward = ON_FUNCT .rate(onComputation, onComputation.getStartDate(), onComputation.getEndDate(), ratesProvider); double alpha = sabrVolatilities.alpha(startTime); double beta = sabrVolatilities.beta(startTime); double rho = sabrVolatilities.rho(startTime); double nu = sabrVolatilities.nu(startTime); double shift = sabrVolatilities.shift(startTime); SabrFormulaData sabr = SabrFormulaData.of(alpha, beta, rho, nu); List<ValueDerivatives> sabrAdjusted = sabrInArrearsFunction.effectiveSabrAd(sabr, startTime, endTime); ValueDerivatives volatility = sabrVolatilities.getParameters().getSabrVolatilityFormula() .volatilityAdjoint(forward + shift, strike + shift, endTime, sabrAdjusted.get(0).getValue(), sabrAdjusted.get(1).getValue(), sabrAdjusted.get(2).getValue(), sabrAdjusted.get(3).getValue()); ValueDerivatives price = BlackFormulaRepository .priceAdjoint(forward + shift, strike + shift, endTime, volatility.getValue(), putCall.isCall()); double pvBar = 1.0; double priceBar = df * period.getYearFraction() * period.getNotional() * pvBar; double volatilityBar = price.getDerivative(3) * priceBar; double alphaHatBar = volatility.getDerivative(2) * volatilityBar; double betaHatBar = volatility.getDerivative(3) * volatilityBar; double rhoHatBar = volatility.getDerivative(4) * volatilityBar; double nuHatBar = volatility.getDerivative(5) * volatilityBar; DoubleArray paramHat = sabrAdjusted.get(0).getDerivatives().multipliedBy(alphaHatBar); paramHat = paramHat.plus(sabrAdjusted.get(1).getDerivatives().multipliedBy(betaHatBar)); paramHat = paramHat.plus(sabrAdjusted.get(2).getDerivatives().multipliedBy(rhoHatBar)); paramHat = paramHat.plus(sabrAdjusted.get(3).getDerivatives().multipliedBy(nuHatBar)); IborCapletFloorletVolatilitiesName name = sabrVolatilities.getName(); return PointSensitivityBuilder.of( IborCapletFloorletSabrSensitivity.of(name, startTime, ALPHA, currency, paramHat.get(0)), IborCapletFloorletSabrSensitivity.of(name, startTime, BETA, currency, paramHat.get(1)), IborCapletFloorletSabrSensitivity.of(name, startTime, RHO, currency, paramHat.get(2)), IborCapletFloorletSabrSensitivity.of(name, startTime, NU, currency, paramHat.get(3))); }
/** * Computes the present value sensitivity to the SABR model parameters. * * @param period the caplet/floorlet period * @param ratesProvider the rates provider * @param sabrVolatilities the SABR volatilities * @return the present value model parameters sensitivity */
Computes the present value sensitivity to the SABR model parameters
presentValueSensitivityModelParamsSabr
{ "repo_name": "OpenGamma/Strata", "path": "modules/pricer/src/main/java/com/opengamma/strata/pricer/capfloor/SabrOvernightInArrearsCapletFloorletPeriodPricer.java", "license": "apache-2.0", "size": 12834 }
[ "com.opengamma.strata.basics.currency.Currency", "com.opengamma.strata.basics.value.ValueDerivatives", "com.opengamma.strata.collect.array.DoubleArray", "com.opengamma.strata.market.sensitivity.PointSensitivityBuilder", "com.opengamma.strata.pricer.impl.option.BlackFormulaRepository", "com.opengamma.strata.pricer.impl.volatility.smile.SabrFormulaData", "com.opengamma.strata.pricer.rate.RatesProvider", "com.opengamma.strata.product.capfloor.OvernightInArrearsCapletFloorletPeriod", "com.opengamma.strata.product.common.PutCall", "com.opengamma.strata.product.rate.OvernightCompoundedRateComputation", "java.time.LocalDate", "java.time.ZoneOffset", "java.util.List" ]
import com.opengamma.strata.basics.currency.Currency; import com.opengamma.strata.basics.value.ValueDerivatives; import com.opengamma.strata.collect.array.DoubleArray; import com.opengamma.strata.market.sensitivity.PointSensitivityBuilder; import com.opengamma.strata.pricer.impl.option.BlackFormulaRepository; import com.opengamma.strata.pricer.impl.volatility.smile.SabrFormulaData; import com.opengamma.strata.pricer.rate.RatesProvider; import com.opengamma.strata.product.capfloor.OvernightInArrearsCapletFloorletPeriod; import com.opengamma.strata.product.common.PutCall; import com.opengamma.strata.product.rate.OvernightCompoundedRateComputation; import java.time.LocalDate; import java.time.ZoneOffset; import java.util.List;
import com.opengamma.strata.basics.currency.*; import com.opengamma.strata.basics.value.*; import com.opengamma.strata.collect.array.*; import com.opengamma.strata.market.sensitivity.*; import com.opengamma.strata.pricer.impl.option.*; import com.opengamma.strata.pricer.impl.volatility.smile.*; import com.opengamma.strata.pricer.rate.*; import com.opengamma.strata.product.capfloor.*; import com.opengamma.strata.product.common.*; import com.opengamma.strata.product.rate.*; import java.time.*; import java.util.*;
[ "com.opengamma.strata", "java.time", "java.util" ]
com.opengamma.strata; java.time; java.util;
2,516,849
@Override public void close() throws IOException { disconnect(); }
void function() throws IOException { disconnect(); }
/** * Same as {@link #disconnect()}. * * @throws IOException */
Same as <code>#disconnect()</code>
close
{ "repo_name": "juddgaddie/sshj", "path": "src/main/java/net/schmizz/sshj/SSHClient.java", "license": "apache-2.0", "size": 31324 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,539,919
public NameValueList getViaParms() { return parameters; }
NameValueList function() { return parameters; }
/** * Accessor for the parameters field * @return parameters field */
Accessor for the parameters field
getViaParms
{ "repo_name": "fhg-fokus-nubomedia/signaling-plane", "path": "modules/lib-sip/src/main/java/gov/nist/javax/sip/header/Via.java", "license": "apache-2.0", "size": 16557 }
[ "gov.nist.core.NameValueList" ]
import gov.nist.core.NameValueList;
import gov.nist.core.*;
[ "gov.nist.core" ]
gov.nist.core;
1,388,481
public Map<String, Object> getMapFromXml(String xmlText) throws FeedServerClientException { try { Map<String, Object> rawEntryMap = xmlUtil.convertXmlToProperties(xmlText); return rawEntryMap; } catch (SAXException e) { throw new FeedServerClientException(e); } catch (IOException e) { throw new FeedServerClientException(e); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } }
Map<String, Object> function(String xmlText) throws FeedServerClientException { try { Map<String, Object> rawEntryMap = xmlUtil.convertXmlToProperties(xmlText); return rawEntryMap; } catch (SAXException e) { throw new FeedServerClientException(e); } catch (IOException e) { throw new FeedServerClientException(e); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } }
/** * Converts raw XML representation of a feed entry into a "typeless" map. * * @param xmlText raw XML entry. * @return a "typeless" map representing an entry. * @throws FeedServerClientException if the Xml cannot be parsed. */
Converts raw XML representation of a feed entry into a "typeless" map
getMapFromXml
{ "repo_name": "jyang/google-feedserver", "path": "src/java/com/google/feedserver/client/TypelessFeedServerClient.java", "license": "apache-2.0", "size": 15704 }
[ "com.google.feedserver.util.FeedServerClientException", "java.io.IOException", "java.util.Map", "javax.xml.parsers.ParserConfigurationException", "org.xml.sax.SAXException" ]
import com.google.feedserver.util.FeedServerClientException; import java.io.IOException; import java.util.Map; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException;
import com.google.feedserver.util.*; import java.io.*; import java.util.*; import javax.xml.parsers.*; import org.xml.sax.*;
[ "com.google.feedserver", "java.io", "java.util", "javax.xml", "org.xml.sax" ]
com.google.feedserver; java.io; java.util; javax.xml; org.xml.sax;
640,018
protected EObject createInitialModel() { EClass eClass = (EClass)productionschemaPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); EObject rootObject = productionschemaFactory.create(eClass); return rootObject; }
EObject function() { EClass eClass = (EClass)productionschemaPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); EObject rootObject = productionschemaFactory.create(eClass); return rootObject; }
/** * Create a new model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Create a new model.
createInitialModel
{ "repo_name": "Somae/mdsd-factory-project", "path": "factory/de.mdelab.languages.factory.editor/src/productionschema/presentation/ProductionschemaModelWizard.java", "license": "gpl-3.0", "size": 17998 }
[ "org.eclipse.emf.ecore.EClass", "org.eclipse.emf.ecore.EObject" ]
import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,203,039
public String getCreationDate() { NodeProperty creationDate = getProperty(CREATION_DATE); if (creationDate == null) { return null; } else { if (creationDate.getValue() instanceof Date) { return creationDateFormat.format ((Date) creationDate.getValue()); } return creationDate.getValue().toString(); } }
String function() { NodeProperty creationDate = getProperty(CREATION_DATE); if (creationDate == null) { return null; } else { if (creationDate.getValue() instanceof Date) { return creationDateFormat.format ((Date) creationDate.getValue()); } return creationDate.getValue().toString(); } }
/** * Creation date accessor. * * @return String creation date */
Creation date accessor
getCreationDate
{ "repo_name": "integrated/jakarta-slide-server", "path": "src/share/org/apache/slide/content/NodeRevisionDescriptor.java", "license": "apache-2.0", "size": 31558 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,760,618
public Set<String> getNamespaces(Settings settings) { return settings.keySet().stream().filter(this::match).map(key::getNamespace).collect(Collectors.toSet()); }
Set<String> function(Settings settings) { return settings.keySet().stream().filter(this::match).map(key::getNamespace).collect(Collectors.toSet()); }
/** * Returns distinct namespaces for the given settings */
Returns distinct namespaces for the given settings
getNamespaces
{ "repo_name": "gfyoung/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/settings/Setting.java", "license": "apache-2.0", "size": 68349 }
[ "java.util.Set", "java.util.stream.Collectors" ]
import java.util.Set; import java.util.stream.Collectors;
import java.util.*; import java.util.stream.*;
[ "java.util" ]
java.util;
2,109,626
public static void systemCallLabelSetVerticalAlignment( int labelID, VerticalAlignment verticalAlignment, Wrapper<ReturnCode> outReturnCode, Wrapper<GuiReturnCode> outGuiReturnCode ){ List<Parameter> params = new ArrayList<>(); params.add(Parameter.createInt(labelID)); params.add(Parameter.createInt(verticalAlignment.getValue())); QAMessage response = Kernel.systemCall("de.silveryard.basesystem.systemcall.gui.label.setverticalalignment", params); outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt()); outGuiReturnCode.value = GuiReturnCode.getEnumValue(response.getParameters().get(1).getInt()); }
static void function( int labelID, VerticalAlignment verticalAlignment, Wrapper<ReturnCode> outReturnCode, Wrapper<GuiReturnCode> outGuiReturnCode ){ List<Parameter> params = new ArrayList<>(); params.add(Parameter.createInt(labelID)); params.add(Parameter.createInt(verticalAlignment.getValue())); QAMessage response = Kernel.systemCall(STR, params); outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt()); outGuiReturnCode.value = GuiReturnCode.getEnumValue(response.getParameters().get(1).getInt()); }
/** * Sets the vertical alignment of a given label * @param labelID ID of the label * @param verticalAlignment Vertical Alignment Value * @param outReturnCode General Return Code * @param outGuiReturnCode Gui Return Code */
Sets the vertical alignment of a given label
systemCallLabelSetVerticalAlignment
{ "repo_name": "Silveryard/BaseSystem", "path": "Libraries/App/Java/AppSDK/src/main/java/de/silveryard/basesystem/sdk/kernel/gui/Label.java", "license": "mit", "size": 20098 }
[ "de.silveryard.basesystem.sdk.kernel.Kernel", "de.silveryard.basesystem.sdk.kernel.ReturnCode", "de.silveryard.basesystem.sdk.kernel.Wrapper", "de.silveryard.transport.Parameter", "de.silveryard.transport.highlevelprotocols.qa.QAMessage", "java.util.ArrayList", "java.util.List" ]
import de.silveryard.basesystem.sdk.kernel.Kernel; import de.silveryard.basesystem.sdk.kernel.ReturnCode; import de.silveryard.basesystem.sdk.kernel.Wrapper; import de.silveryard.transport.Parameter; import de.silveryard.transport.highlevelprotocols.qa.QAMessage; import java.util.ArrayList; import java.util.List;
import de.silveryard.basesystem.sdk.kernel.*; import de.silveryard.transport.*; import de.silveryard.transport.highlevelprotocols.qa.*; import java.util.*;
[ "de.silveryard.basesystem", "de.silveryard.transport", "java.util" ]
de.silveryard.basesystem; de.silveryard.transport; java.util;
2,270,080
public synchronized List<String> goal(String out) { List<String> taskIds = new ArrayList<String>(); // Find dependencies Set<Task> tasks = taskDependecies.goal(this, out); // No update needed? if (tasks == null) { if (isDebug()) Gpr.debug("Goal '" + out + "' has no dependent tasks. Nothing to do."); return taskIds; } // Convert to task IDs for (Task t : tasks) taskIds.add(t.getId()); return taskIds; }
synchronized List<String> function(String out) { List<String> taskIds = new ArrayList<String>(); Set<Task> tasks = taskDependecies.goal(this, out); if (tasks == null) { if (isDebug()) Gpr.debug(STR + out + STR); return taskIds; } for (Task t : tasks) taskIds.add(t.getId()); return taskIds; }
/** * Execute dependency tasks to achieve goal 'out' */
Execute dependency tasks to achieve goal 'out'
goal
{ "repo_name": "leepc12/BigDataScript", "path": "src/org/bds/run/BdsThread.java", "license": "apache-2.0", "size": 38184 }
[ "java.util.ArrayList", "java.util.List", "java.util.Set", "org.bds.task.Task", "org.bds.util.Gpr" ]
import java.util.ArrayList; import java.util.List; import java.util.Set; import org.bds.task.Task; import org.bds.util.Gpr;
import java.util.*; import org.bds.task.*; import org.bds.util.*;
[ "java.util", "org.bds.task", "org.bds.util" ]
java.util; org.bds.task; org.bds.util;
2,907,860
public RMIServiceId getTarget() { return target; }
RMIServiceId function() { return target; }
/** * Returns the target of this message (may be null, if request does not have a target). * @return the target of this message (may be null, if request does not have a target). */
Returns the target of this message (may be null, if request does not have a target)
getTarget
{ "repo_name": "Devexperts/QD", "path": "qd-rmi/src/main/java/com/devexperts/rmi/message/RMIRequestMessage.java", "license": "mpl-2.0", "size": 6204 }
[ "com.devexperts.rmi.task.RMIServiceId" ]
import com.devexperts.rmi.task.RMIServiceId;
import com.devexperts.rmi.task.*;
[ "com.devexperts.rmi" ]
com.devexperts.rmi;
353,274
void broadcastMessage(@Nonnull Component message);
void broadcastMessage(@Nonnull Component message);
/** * Sends a message to every {@link User} that is related to this game. This could be a participant in the game or a * spectator. * * @param message the message to be send */
Sends a message to every <code>User</code> that is related to this game. This could be a participant in the game or a spectator
broadcastMessage
{ "repo_name": "VoxelGamesLib/VoxelGamesLibv2", "path": "VoxelGamesLib/src/main/java/com/voxelgameslib/voxelgameslib/api/game/Game.java", "license": "mit", "size": 6812 }
[ "javax.annotation.Nonnull", "net.kyori.text.Component" ]
import javax.annotation.Nonnull; import net.kyori.text.Component;
import javax.annotation.*; import net.kyori.text.*;
[ "javax.annotation", "net.kyori.text" ]
javax.annotation; net.kyori.text;
603,214
@Override public void setElems(Object data) { Guardian.assertNotNull("data", data); if (data instanceof String && ((String) data).length() > 0) { _array = ((String) data).getBytes(); } else if (data instanceof char[] && ((char[]) data).length > 0) { _array = String.valueOf((char[]) data).getBytes(); } else if (data instanceof byte[] && ((byte[]) data).length > 0) { _array = (byte[]) data; } else { throw new IllegalArgumentException("data is not an instance of String, char[] or byte[]" + "or the length is less than one"); } }
void function(Object data) { Guardian.assertNotNull("data", data); if (data instanceof String && ((String) data).length() > 0) { _array = ((String) data).getBytes(); } else if (data instanceof char[] && ((char[]) data).length > 0) { _array = String.valueOf((char[]) data).getBytes(); } else if (data instanceof byte[] && ((byte[]) data).length > 0) { _array = (byte[]) data; } else { throw new IllegalArgumentException(STR + STR); } }
/** * Sets the data of this value. The data must be a string, an byte or an char array. * Each has to have at least a length of one. * * @param data the data array * * @throws IllegalArgumentException if data is <code>null</code> or it is not an array of the required type or * does the array length is less than one. */
Sets the data of this value. The data must be a string, an byte or an char array. Each has to have at least a length of one
setElems
{ "repo_name": "seadas/beam", "path": "beam-core/src/main/java/org/esa/beam/framework/datamodel/ProductData.java", "license": "gpl-3.0", "size": 100346 }
[ "org.esa.beam.util.Guardian" ]
import org.esa.beam.util.Guardian;
import org.esa.beam.util.*;
[ "org.esa.beam" ]
org.esa.beam;
2,682,746
public List<Subject> getResultSubjects() { return resultSubjects; }
List<Subject> function() { return resultSubjects; }
/** * Getter for the list of results * * @return List<Subject> */
Getter for the list of results
getResultSubjects
{ "repo_name": "ddRPB/rpb", "path": "radplanbio-core/src/main/java/de/dktk/dd/rpb/core/builder/pacs/StagedSubjectPacsResultBuilder.java", "license": "gpl-3.0", "size": 11733 }
[ "de.dktk.dd.rpb.core.domain.edc.Subject", "java.util.List" ]
import de.dktk.dd.rpb.core.domain.edc.Subject; import java.util.List;
import de.dktk.dd.rpb.core.domain.edc.*; import java.util.*;
[ "de.dktk.dd", "java.util" ]
de.dktk.dd; java.util;
478,326
@Override public void actionPerformed(final ActionEvent e) { LOG.info("Wizard actionPerformed: " + e.getActionCommand()); final MetaClass swmmModelClass = ClassCacheMultiple.getMetaClass( SessionManager.getSession().getUser().getDomain(), TABLENAME_SWMM_PROJECT); final CidsBean newSwmmBean = swmmModelClass.getEmptyInstance().getBean(); wizardDescriptor = new WizardDescriptor(this.getPanels()); wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N wizardDescriptor.setTitle(NbBundle.getMessage( UploadWizardAction.class, "UploadWizardAction.actionPerformed(ActionEvent).wizard.title")); // NOI18N if (this.getCidsBean() != null) { wizardDescriptor.putProperty(PROP_SELECTED_SWMM_PROJECT_ID, this.getCidsBean().getProperty("id")); } else { wizardDescriptor.putProperty(PROP_SELECTED_SWMM_PROJECT_ID, "-1"); } wizardDescriptor.putProperty(PROP_NEW_SWMM_PROJECT_BEAN, newSwmmBean); wizardDescriptor.putProperty(PROP_SWMM_INP_FILE, ""); wizardDescriptor.putProperty(PROP_UPLOAD_COMPLETE, false); wizardDescriptor.putProperty(PROP_UPLOAD_ERRORNEOUS, false); wizardDescriptor.putProperty(PROP_UPLOAD_IN_PROGRESS, false); wizardDescriptor.putProperty(PROP_COPY_CSOS_COMPLETE, false); wizardDescriptor.putProperty(PROP_COPY_CSOS_ERRORNEOUS, false); wizardDescriptor.putProperty(PROP_COPY_CSOS_IN_PROGRESS, false); final Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); dialog.pack(); dialog.setLocationRelativeTo(ComponentRegistry.getRegistry().getMainWindow()); dialog.setVisible(true); dialog.toFront(); final boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; if (!cancelled) { if (LOG.isDebugEnabled()) { LOG.info("wizard closed (not cancelled), new SWMM Model saved"); } ComponentRegistry.getRegistry().getCatalogueTree().requestRefreshNode("local.linz.projects"); } else { final boolean uploadComplete = (Boolean)wizardDescriptor.getProperty(PROP_UPLOAD_COMPLETE); final boolean copyCSOsComplete = (Boolean)wizardDescriptor.getProperty(PROP_COPY_CSOS_COMPLETE); if (uploadComplete || copyCSOsComplete) { LOG.warn("Wizard cancelled :o(! Trying to remove created meta objects"); final CleanUpThread cleanUpThread = new CleanUpThread(uploadComplete, copyCSOsComplete); SudplanConcurrency.getSudplanGeneralPurposePool().execute(cleanUpThread); } else { if (LOG.isDebugEnabled()) { LOG.debug("Wizard cancelled: nothing to remove :o)"); } } } } //~ Inner Classes ---------------------------------------------------------- private final class CleanUpThread implements Runnable { //~ Instance fields ---------------------------------------------------- final boolean uploadComplete; final boolean copyCSOsComplete; private final transient Logger LOG = Logger.getLogger(CleanUpThread.class); //~ Constructors ------------------------------------------------------- private CleanUpThread(final boolean uploadComplete, final boolean copyCSOsComplete) { this.uploadComplete = uploadComplete; this.copyCSOsComplete = copyCSOsComplete; } //~ Methods ------------------------------------------------------------
void function(final ActionEvent e) { LOG.info(STR + e.getActionCommand()); final MetaClass swmmModelClass = ClassCacheMultiple.getMetaClass( SessionManager.getSession().getUser().getDomain(), TABLENAME_SWMM_PROJECT); final CidsBean newSwmmBean = swmmModelClass.getEmptyInstance().getBean(); wizardDescriptor = new WizardDescriptor(this.getPanels()); wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); wizardDescriptor.setTitle(NbBundle.getMessage( UploadWizardAction.class, STR)); if (this.getCidsBean() != null) { wizardDescriptor.putProperty(PROP_SELECTED_SWMM_PROJECT_ID, this.getCidsBean().getProperty("id")); } else { wizardDescriptor.putProperty(PROP_SELECTED_SWMM_PROJECT_ID, "-1"); } wizardDescriptor.putProperty(PROP_NEW_SWMM_PROJECT_BEAN, newSwmmBean); wizardDescriptor.putProperty(PROP_SWMM_INP_FILE, STRwizard closed (not cancelled), new SWMM Model savedSTRlocal.linz.projectsSTRWizard cancelled :o(! Trying to remove created meta objectsSTRWizard cancelled: nothing to remove :o)"); } } } } private final class CleanUpThread implements Runnable { final boolean uploadComplete; final boolean copyCSOsComplete; private final transient Logger LOG = Logger.getLogger(CleanUpThread.class); private CleanUpThread(final boolean uploadComplete, final boolean copyCSOsComplete) { this.uploadComplete = uploadComplete; this.copyCSOsComplete = copyCSOsComplete; }
/** * DOCUMENT ME! * * @param e DOCUMENT ME! */
DOCUMENT ME
actionPerformed
{ "repo_name": "cismet/cids-custom-sudplan-linz", "path": "src/main/java/de/cismet/cids/custom/sudplan/linz/wizard/UploadWizardAction.java", "license": "lgpl-3.0", "size": 18462 }
[ "de.cismet.cids.dynamics.CidsBean", "de.cismet.cids.navigator.utils.ClassCacheMultiple", "java.awt.event.ActionEvent", "java.text.MessageFormat", "org.apache.log4j.Logger", "org.openide.WizardDescriptor", "org.openide.util.NbBundle" ]
import de.cismet.cids.dynamics.CidsBean; import de.cismet.cids.navigator.utils.ClassCacheMultiple; import java.awt.event.ActionEvent; import java.text.MessageFormat; import org.apache.log4j.Logger; import org.openide.WizardDescriptor; import org.openide.util.NbBundle;
import de.cismet.cids.dynamics.*; import de.cismet.cids.navigator.utils.*; import java.awt.event.*; import java.text.*; import org.apache.log4j.*; import org.openide.*; import org.openide.util.*;
[ "de.cismet.cids", "java.awt", "java.text", "org.apache.log4j", "org.openide", "org.openide.util" ]
de.cismet.cids; java.awt; java.text; org.apache.log4j; org.openide; org.openide.util;
1,431,991
public String toString() { // empty list case if (isEmptyList()) return "[]"; // list case if (name.equals(".") && arity == 2) { return ("[" + toString0() + "]"); } else if (name.equals("{}")) { return ("{" + toString0_bracket() + "}"); } else { String s = (Parser.isAtom(name) ? name : "'" + name + "'"); if (arity > 0) { s = s + "("; for (int c = 1; c < arity; c++) { if (!(arg[c - 1] instanceof Var)) { s = s + arg[c - 1].toString() + ","; } else { s = s + ((Var) arg[c - 1]).toStringFlattened() + ","; } } if (!(arg[arity - 1] instanceof Var)) { s = s + arg[arity - 1].toString() + ")"; } else { s = s + ((Var) arg[arity - 1]).toStringFlattened() + ")"; } } return s; } }
String function() { if (isEmptyList()) return "[]"; if (name.equals(".") && arity == 2) { return ("[" + toString0() + "]"); } else if (name.equals("{}")) { return ("{" + toString0_bracket() + "}"); } else { String s = (Parser.isAtom(name) ? name : "'" + name + "'"); if (arity > 0) { s = s + "("; for (int c = 1; c < arity; c++) { if (!(arg[c - 1] instanceof Var)) { s = s + arg[c - 1].toString() + ","; } else { s = s + ((Var) arg[c - 1]).toStringFlattened() + ","; } } if (!(arg[arity - 1] instanceof Var)) { s = s + arg[arity - 1].toString() + ")"; } else { s = s + ((Var) arg[arity - 1]).toStringFlattened() + ")"; } } return s; } }
/** * Gets the string representation of this structure * <p> * Specific representations are provided for lists and atoms. * Names starting with upper case letter are enclosed in apices. */
Gets the string representation of this structure Specific representations are provided for lists and atoms. Names starting with upper case letter are enclosed in apices
toString
{ "repo_name": "zakski/project-soisceal", "path": "gospel-core/src/main/scala/com/szadowsz/gospel/core/data/Struct.java", "license": "lgpl-3.0", "size": 27261 }
[ "com.szadowsz.gospel.core.parser.Parser" ]
import com.szadowsz.gospel.core.parser.Parser;
import com.szadowsz.gospel.core.parser.*;
[ "com.szadowsz.gospel" ]
com.szadowsz.gospel;
744,837
@Override public View onCreateCandidatesView() { mCandidateView = new CandidateView(this); mCandidateView.setService(this); return mCandidateView; }
@Override View function() { mCandidateView = new CandidateView(this); mCandidateView.setService(this); return mCandidateView; }
/** * Called by the framework when your view for showing candidates needs to * be generated, like {@link #onCreateInputView}. */
Called by the framework when your view for showing candidates needs to be generated, like <code>#onCreateInputView</code>
onCreateCandidatesView
{ "repo_name": "hfavisado/DeleteAsBackspace", "path": "app/src/main/java/com/hfavisado/android/deleteasbackspace/SoftKeyboard.java", "license": "apache-2.0", "size": 27684 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
398,364
private void drawRightPart(final Point buttonSize) { this.gc.setForeground(this.selectedBackgroundColor); this.gc.setBackground(this.selectedBackgroundColor); if (this.round) { this.gc.fillRoundRectangle(2, 2, buttonSize.x, buttonSize.y, 5, 5); } else { this.gc.fillRectangle(2, 2, buttonSize.x, buttonSize.y); } this.gc.setForeground(GamaColors.getTextColorForBackground(selectedBackgroundColor).color()); final Point textSize = this.gc.textExtent(this.textForSelect); this.gc.drawString(this.textForSelect, (buttonSize.x / 2 - textSize.x) / 2 + 3, (buttonSize.y - textSize.y) / 2 + 3); }
void function(final Point buttonSize) { this.gc.setForeground(this.selectedBackgroundColor); this.gc.setBackground(this.selectedBackgroundColor); if (this.round) { this.gc.fillRoundRectangle(2, 2, buttonSize.x, buttonSize.y, 5, 5); } else { this.gc.fillRectangle(2, 2, buttonSize.x, buttonSize.y); } this.gc.setForeground(GamaColors.getTextColorForBackground(selectedBackgroundColor).color()); final Point textSize = this.gc.textExtent(this.textForSelect); this.gc.drawString(this.textForSelect, (buttonSize.x / 2 - textSize.x) / 2 + 3, (buttonSize.y - textSize.y) / 2 + 3); }
/** * Draw the right part of the button * * @param buttonSize * size of the button */
Draw the right part of the button
drawRightPart
{ "repo_name": "gama-platform/gama.cloud", "path": "ummisco.gama.ui.shared_web/src/ummisco/gama/ui/controls/SwitchButton.java", "license": "agpl-3.0", "size": 21740 }
[ "org.eclipse.swt.graphics.Point" ]
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
2,764,789
private static JFrame getNewFrame( WindowType type) { JFrame new_frame; switch( type) { case TYPE_FORM: new_frame = new TypeForm(); break; case PROFILE_MANAGER: new_frame = new ProfileSelect(); break; case FONT_FORM: new_frame = new FontForm(); break; case CHARACTER_MAP: new_frame = new CharacterMap(); break; case CHARSTATS: new_frame = new CharStatsForm(); break; case WORDSTATS: new_frame = new WordStatsForm(); break; case WPMSTATS: new_frame = new WPMStatsForm(); break; default: return null; } return frames[type.ordinal()] = new_frame; }
static JFrame function( WindowType type) { JFrame new_frame; switch( type) { case TYPE_FORM: new_frame = new TypeForm(); break; case PROFILE_MANAGER: new_frame = new ProfileSelect(); break; case FONT_FORM: new_frame = new FontForm(); break; case CHARACTER_MAP: new_frame = new CharacterMap(); break; case CHARSTATS: new_frame = new CharStatsForm(); break; case WORDSTATS: new_frame = new WordStatsForm(); break; case WPMSTATS: new_frame = new WPMStatsForm(); break; default: return null; } return frames[type.ordinal()] = new_frame; }
/** * Note: Assumes the variable associated with the WindowType is null, * otherwise the current-loaded Window will slip management. */
Note: Assumes the variable associated with the WindowType is null, otherwise the current-loaded Window will slip management
getNewFrame
{ "repo_name": "roryburks/typestats", "path": "src/typestats/global/WindowManager.java", "license": "mit", "size": 7986 }
[ "javax.swing.JFrame" ]
import javax.swing.JFrame;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
1,563,761
V prevDup() throws DatabaseException;
V prevDup() throws DatabaseException;
/** * Moves the cursor to the previous value with the same key (duplicate) and * returns it, or returns null if no preceding values are present for the * key at the current position. * * <p>{@link LockMode#DEFAULT} is used implicitly.</p> * * @return the previous value with the same key, or null if no preceding * values are present for the key at the current position. * * @throws IllegalStateException if the cursor is uninitialized. * * * @throws DatabaseException the base class for all BDB exceptions. */
Moves the cursor to the previous value with the same key (duplicate) and returns it, or returns null if no preceding values are present for the key at the current position. <code>LockMode#DEFAULT</code> is used implicitly
prevDup
{ "repo_name": "EvilMcJerkface/jessy", "path": "lib/berkeleydb_core/src/com/sleepycat/persist/EntityCursor.java", "license": "mit", "size": 24414 }
[ "com.sleepycat.db.DatabaseException" ]
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.*;
[ "com.sleepycat.db" ]
com.sleepycat.db;
1,561,149
public static NetworkLink yangLinkEvent2NetworkLink(TeLinkEvent yangLinkEvent, TeTopologyService teTopologyService) { KeyId linkId = yangLinkEvent2NetworkLinkKey(yangLinkEvent).linkId(); org.onosproject.tetopology.management.api. Network network = teTopologyService.network( yangLinkEvent2NetworkLinkKey(yangLinkEvent).networkId()); if (network == null) { return null; } NetworkLink networkLink = network.link(linkId); if (networkLink == null) { return null; } NodeTpKey sourceTp = networkLink.source(); if (sourceTp == null) { return null; } NodeTpKey destTp = networkLink.destination(); List<NetworkLinkKey> supportingLinkIds = networkLink.supportingLinkIds(); TeLink teLink = networkLink.teLink(); if (teLink == null) { return null; } TeOperStatus opState = yangLinkEvent.operStatus(); org.onosproject.tetopology.management.api. TeStatus opStatus = EnumConverter.yang2TeSubsystemOpStatus(opState); TeLink updatedTeLink = yangLinkEvent2TeLinkAttributes(yangLinkEvent, teLink, opStatus, teTopologyService); NetworkLink updatedNetworkLink = new DefaultNetworkLink(linkId, sourceTp, destTp, supportingLinkIds, updatedTeLink); return updatedNetworkLink; }
static NetworkLink function(TeLinkEvent yangLinkEvent, TeTopologyService teTopologyService) { KeyId linkId = yangLinkEvent2NetworkLinkKey(yangLinkEvent).linkId(); org.onosproject.tetopology.management.api. Network network = teTopologyService.network( yangLinkEvent2NetworkLinkKey(yangLinkEvent).networkId()); if (network == null) { return null; } NetworkLink networkLink = network.link(linkId); if (networkLink == null) { return null; } NodeTpKey sourceTp = networkLink.source(); if (sourceTp == null) { return null; } NodeTpKey destTp = networkLink.destination(); List<NetworkLinkKey> supportingLinkIds = networkLink.supportingLinkIds(); TeLink teLink = networkLink.teLink(); if (teLink == null) { return null; } TeOperStatus opState = yangLinkEvent.operStatus(); org.onosproject.tetopology.management.api. TeStatus opStatus = EnumConverter.yang2TeSubsystemOpStatus(opState); TeLink updatedTeLink = yangLinkEvent2TeLinkAttributes(yangLinkEvent, teLink, opStatus, teTopologyService); NetworkLink updatedNetworkLink = new DefaultNetworkLink(linkId, sourceTp, destTp, supportingLinkIds, updatedTeLink); return updatedNetworkLink; }
/** * Converts a YANG network link notification event into a TE network link. * * @param yangLinkEvent YANG network link notification * @param teTopologyService TE Topology service used to help the conversion * @return TE network link */
Converts a YANG network link notification event into a TE network link
yangLinkEvent2NetworkLink
{ "repo_name": "LorenzReinhart/ONOSnew", "path": "apps/tenbi/utils/src/main/java/org/onosproject/teyang/utils/topology/LinkConverter.java", "license": "apache-2.0", "size": 63389 }
[ "java.util.List", "org.onosproject.tetopology.management.api.KeyId", "org.onosproject.tetopology.management.api.TeStatus", "org.onosproject.tetopology.management.api.TeTopologyService", "org.onosproject.tetopology.management.api.link.DefaultNetworkLink", "org.onosproject.tetopology.management.api.link.NetworkLink", "org.onosproject.tetopology.management.api.link.NetworkLinkKey", "org.onosproject.tetopology.management.api.link.TeLink", "org.onosproject.tetopology.management.api.node.NodeTpKey", "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.networks.Network", "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20170110.ietftetopology.TeLinkEvent", "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.TeOperStatus" ]
import java.util.List; import org.onosproject.tetopology.management.api.KeyId; import org.onosproject.tetopology.management.api.TeStatus; import org.onosproject.tetopology.management.api.TeTopologyService; import org.onosproject.tetopology.management.api.link.DefaultNetworkLink; import org.onosproject.tetopology.management.api.link.NetworkLink; import org.onosproject.tetopology.management.api.link.NetworkLinkKey; import org.onosproject.tetopology.management.api.link.TeLink; import org.onosproject.tetopology.management.api.node.NodeTpKey; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.networks.Network; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20170110.ietftetopology.TeLinkEvent; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.TeOperStatus;
import java.util.*; import org.onosproject.tetopology.management.api.*; import org.onosproject.tetopology.management.api.link.*; import org.onosproject.tetopology.management.api.node.*; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.networks.*; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20170110.ietftetopology.*; import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.*;
[ "java.util", "org.onosproject.tetopology", "org.onosproject.yang" ]
java.util; org.onosproject.tetopology; org.onosproject.yang;
423,903
public void step(IFrameTupleReference tuple, byte[] data, int start, int len) throws AlgebricksException;
void function(IFrameTupleReference tuple, byte[] data, int start, int len) throws AlgebricksException;
/** * update the internal state * * @param tuple * @param state * @throws AlgebricksException */
update the internal state
step
{ "repo_name": "kisskys/incubator-asterixdb", "path": "hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/base/ISerializedAggregateEvaluator.java", "license": "apache-2.0", "size": 2049 }
[ "org.apache.hyracks.algebricks.common.exceptions.AlgebricksException", "org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference" ]
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
import org.apache.hyracks.algebricks.common.exceptions.*; import org.apache.hyracks.dataflow.common.data.accessors.*;
[ "org.apache.hyracks" ]
org.apache.hyracks;
1,338,278
private static String getStringExpr(DetailAST ast) { final DetailAST firstChild = ast.getFirstChild(); String expr = ""; switch (firstChild.getType()) { case TokenTypes.STRING_LITERAL: // NOTE: escaped characters are not unescaped final String quotedText = firstChild.getText(); expr = quotedText.substring(1, quotedText.length() - 1); break; case TokenTypes.IDENT: expr = firstChild.getText(); break; case TokenTypes.DOT: expr = firstChild.getLastChild().getText(); break; default: // annotations with complex expressions cannot suppress warnings } return expr; }
static String function(DetailAST ast) { final DetailAST firstChild = ast.getFirstChild(); String expr = ""; switch (firstChild.getType()) { case TokenTypes.STRING_LITERAL: final String quotedText = firstChild.getText(); expr = quotedText.substring(1, quotedText.length() - 1); break; case TokenTypes.IDENT: expr = firstChild.getText(); break; case TokenTypes.DOT: expr = firstChild.getLastChild().getText(); break; default: } return expr; }
/** * Returns the literal string expression represented by an AST. * @param ast an AST node for an EXPR * @return the Java string represented by the given AST expression * or empty string if expression is too complex * @throws IllegalArgumentException if the AST is invalid */
Returns the literal string expression represented by an AST
getStringExpr
{ "repo_name": "Bhavik3/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java", "license": "lgpl-2.1", "size": 20109 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST", "com.puppycrawl.tools.checkstyle.api.TokenTypes" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
1,990,119
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<PathItem> listPaths(ListPathsOptions options, Duration timeout) { return new PagedIterable<>(dataLakeFileSystemAsyncClient.listPathsWithOptionalTimeout(options, timeout)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<PathItem> function(ListPathsOptions options, Duration timeout) { return new PagedIterable<>(dataLakeFileSystemAsyncClient.listPathsWithOptionalTimeout(options, timeout)); }
/** * Returns a lazy loaded list of files/directories in this account. The returned {@link PagedIterable} can be * consumed while new items are automatically retrieved as needed. For more information, see the * <a href="https://docs.microsoft.com/rest/api/storageservices/datalakestoragegen2/filesystem/list#filesystem">Azure Docs</a>. * * <p><strong>Code Samples</strong></p> * * <!-- src_embed com.azure.storage.file.datalake.DataLakeFileSystemClient.listPaths#ListPathsOptions-Duration --> * <pre> * ListPathsOptions options = new ListPathsOptions&#40;&#41; * .setPath&#40;&quot;pathPrefixToMatch&quot;&#41; * .setMaxResults&#40;10&#41;; * * client.listPaths&#40;options, timeout&#41;.forEach&#40;path -&gt; System.out.printf&#40;&quot;Name: %s%n&quot;, path.getName&#40;&#41;&#41;&#41;; * </pre> * <!-- end com.azure.storage.file.datalake.DataLakeFileSystemClient.listPaths#ListPathsOptions-Duration --> * * @param options A {@link ListPathsOptions} which specifies what data should be returned by the service. If * iterating by page, the page size passed to byPage methods such as * {@link PagedIterable#iterableByPage(int)} will be preferred over the value set on these options. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The list of files/directories. */
Returns a lazy loaded list of files/directories in this account. The returned <code>PagedIterable</code> can be consumed while new items are automatically retrieved as needed. For more information, see the Azure Docs. Code Samples <code> ListPathsOptions options = new ListPathsOptions&#40;&#41; .setPath&#40;&quot;pathPrefixToMatch&quot;&#41; .setMaxResults&#40;10&#41;; client.listPaths&#40;options, timeout&#41;.forEach&#40;path -&gt; System.out.printf&#40;&quot;Name: %s%n&quot;, path.getName&#40;&#41;&#41;&#41;; </code>
listPaths
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java", "license": "mit", "size": 69128 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.storage.file.datalake.models.ListPathsOptions", "com.azure.storage.file.datalake.models.PathItem", "java.time.Duration" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.storage.file.datalake.models.ListPathsOptions; import com.azure.storage.file.datalake.models.PathItem; import java.time.Duration;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.storage.file.datalake.models.*; import java.time.*;
[ "com.azure.core", "com.azure.storage", "java.time" ]
com.azure.core; com.azure.storage; java.time;
475,598
public static final int getNumberOfCameraChip() { int n; if (firstTimeReadHWInterface==true){ NUM_CAMERAS=HardwareInterfaceFactory.instance().getNumInterfacesAvailable(); n=NUM_CAMERAS; firstTimeReadHWInterface=false; log.info("Number of cameras: "+ NUM_CAMERAS); return n; } else{ log.warning("Number of cameras found: 0"); return 2; } }
static final int function() { int n; if (firstTimeReadHWInterface==true){ NUM_CAMERAS=HardwareInterfaceFactory.instance().getNumInterfacesAvailable(); n=NUM_CAMERAS; firstTimeReadHWInterface=false; log.info(STR+ NUM_CAMERAS); return n; } else{ log.warning(STR); return 2; } }
/**Return the number of HardwareInterface. * @return the number of hardware interface (number of cameras) */
Return the number of HardwareInterface
getNumberOfCameraChip
{ "repo_name": "SensorsINI/jaer", "path": "src/net/sf/jaer/stereopsis/MultiCameraHardwareInterface.java", "license": "lgpl-2.1", "size": 22350 }
[ "net.sf.jaer.hardwareinterface.HardwareInterfaceFactory" ]
import net.sf.jaer.hardwareinterface.HardwareInterfaceFactory;
import net.sf.jaer.hardwareinterface.*;
[ "net.sf.jaer" ]
net.sf.jaer;
798,200
public static String guessFileExtension(String contentType){ String result = "text/plain"; HashMap<String, String> map = new HashMap<String, String>(); map.put("application/json", "json"); map.put("text/html,xhtml+xml", "html"); map.put("atom,xml", "xml"); map.put("javascript,", "js"); map.put("css", "css"); map.put("application/java,text/x-java-source", "class"); map.put("application/x-gzip", "gz"); map.put("text/x-h", "h"); map.put("image/jpeg,image/pjpeg", "jpg"); map.put("audio/x-mpequrl", "m3u"); map.put("image/png", "png"); map.put("application/x-tar", "tar"); map.put("image/tiff,image/x-tiff", ""); map.put("application/x-zip-compressed,application/zip,multipart/x-zip", ""); map.put("application/pdf", "pdf"); map.put("image/gif", "gif"); map.put("image/svg+xml", "svg"); map.put("image/vnd.microsoft.icon", "icon"); map.put("text/csv", "csv"); Set<String> set = map.keySet(); Iterator<String> it = set.iterator(); while(it.hasNext()){ String key = it.next(); if(contentType.contains(key) || key.contains(contentType)){ result = map.get(key); break; } } return result; }
static String function(String contentType){ String result = STR; HashMap<String, String> map = new HashMap<String, String>(); map.put(STR, "json"); map.put(STR, "html"); map.put(STR, "xml"); map.put(STR, "jsSTRcssSTRcss"); map.put(STR, "class"); map.put(STR, "gz"); map.put(STR, "h"); map.put(STR, "jpg"); map.put(STR, "m3u"); map.put(STR, "png"); map.put(STR, "tar"); map.put(STR, STRapplication/x-zip-compressed,application/zip,multipart/x-zip", STRapplication/pdfSTRpdfSTRimage/gifSTRgifSTRimage/svg+xmlSTRsvgSTRimage/vnd.microsoft.iconSTRiconSTRtext/csvSTRcsv"); Set<String> set = map.keySet(); Iterator<String> it = set.iterator(); while(it.hasNext()){ String key = it.next(); if(contentType.contains(key) key.contains(contentType)){ result = map.get(key); break; } } return result; }
/** * Try to guess file extension from content type value. * @param contentType Response content type header * @return If recognized - file extension. Default return: <b>text/plain</b> */
Try to guess file extension from content type value
guessFileExtension
{ "repo_name": "bredy/ChromeRestClient", "path": "RestClient/src/org/rest/client/util/Utils.java", "license": "apache-2.0", "size": 4123 }
[ "java.util.HashMap", "java.util.Iterator", "java.util.Set" ]
import java.util.HashMap; import java.util.Iterator; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,605,271
Expression get(Memory memory);
Expression get(Memory memory);
/** Get the value of a given memory location. * @param memory the memory location to be inspected * @return the value of that location */
Get the value of a given memory location
get
{ "repo_name": "gdshaw1/codemancer", "path": "src/org/codemancer/cpudl/State.java", "license": "gpl-3.0", "size": 1913 }
[ "org.codemancer.cpudl.expr.Expression", "org.codemancer.cpudl.expr.Memory" ]
import org.codemancer.cpudl.expr.Expression; import org.codemancer.cpudl.expr.Memory;
import org.codemancer.cpudl.expr.*;
[ "org.codemancer.cpudl" ]
org.codemancer.cpudl;
2,363,746
public static Object decrypt(String source) { try { byte[] data = Base64.decode(source); Cipher c = Cipher.getInstance("AES"); c.init(Cipher.DECRYPT_MODE, SECRET_KEY); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data)); SealedObject so = (SealedObject) in.readObject(); return so.getObject(c); } catch (Exception e) { log.error("Unable to decrypt", e); return null; } }
static Object function(String source) { try { byte[] data = Base64.decode(source); Cipher c = Cipher.getInstance("AES"); c.init(Cipher.DECRYPT_MODE, SECRET_KEY); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data)); SealedObject so = (SealedObject) in.readObject(); return so.getObject(c); } catch (Exception e) { log.error(STR, e); return null; } }
/** * Given a String which is the Base64-encoded encrypted data, retrieve * the original Object. */
Given a String which is the Base64-encoded encrypted data, retrieve the original Object
decrypt
{ "repo_name": "meetdestiny/geronimo-trader", "path": "modules/util/src/java/org/apache/geronimo/util/SimpleEncryption.java", "license": "apache-2.0", "size": 3481 }
[ "java.io.ByteArrayInputStream", "java.io.ObjectInputStream", "javax.crypto.Cipher", "javax.crypto.SealedObject", "org.apache.geronimo.util.encoders.Base64" ]
import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; import javax.crypto.Cipher; import javax.crypto.SealedObject; import org.apache.geronimo.util.encoders.Base64;
import java.io.*; import javax.crypto.*; import org.apache.geronimo.util.encoders.*;
[ "java.io", "javax.crypto", "org.apache.geronimo" ]
java.io; javax.crypto; org.apache.geronimo;
2,058,467
public Map toMap() { return delegate; }
Map function() { return delegate; }
/** * optional operation */
optional operation
toMap
{ "repo_name": "cacheonix/cacheonix-core", "path": "src/org/cacheonix/plugin/hibernate/v32/HibernateCacheonixCache.java", "license": "lgpl-2.1", "size": 5903 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,767,302
public static void e(String tag, String s, Throwable e) { if (LOG.ERROR >= LOGLEVEL) Log.e(tag, s, e); }
static void function(String tag, String s, Throwable e) { if (LOG.ERROR >= LOGLEVEL) Log.e(tag, s, e); }
/** * Error log message. * * @param tag * @param s * @param e */
Error log message
e
{ "repo_name": "soulfly/guinea-pig-smart-bot", "path": "node_modules/quickblox/samples/cordova/video_chat/platforms/android/CordovaLib/src/org/apache/cordova/LOG.java", "license": "apache-2.0", "size": 6320 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,125,336
public static TargetContainerEvent createTargetContainerEvent(Game game, Container targetContainer) { Map<String, Object> values = Maps.newHashMap(); values.put("game", game); values.put("targetContainer", targetContainer); return SpongeEventFactoryUtils.createEventImpl(TargetContainerEvent.class, values); }
static TargetContainerEvent function(Game game, Container targetContainer) { Map<String, Object> values = Maps.newHashMap(); values.put("game", game); values.put(STR, targetContainer); return SpongeEventFactoryUtils.createEventImpl(TargetContainerEvent.class, values); }
/** * AUTOMATICALLY GENERATED, DO NOT EDIT. * Creates a new instance of * {@link org.spongepowered.api.event.inventory.TargetContainerEvent}. * * @param game The game * @param targetContainer The target container * @return A new target container event */
AUTOMATICALLY GENERATED, DO NOT EDIT. Creates a new instance of <code>org.spongepowered.api.event.inventory.TargetContainerEvent</code>
createTargetContainerEvent
{ "repo_name": "jamierocks/SpongeAPI", "path": "src/main/java/org/spongepowered/api/event/SpongeEventFactory.java", "license": "mit", "size": 196993 }
[ "com.google.common.collect.Maps", "java.util.Map", "org.spongepowered.api.Game", "org.spongepowered.api.event.inventory.TargetContainerEvent", "org.spongepowered.api.item.inventory.Container" ]
import com.google.common.collect.Maps; import java.util.Map; import org.spongepowered.api.Game; import org.spongepowered.api.event.inventory.TargetContainerEvent; import org.spongepowered.api.item.inventory.Container;
import com.google.common.collect.*; import java.util.*; import org.spongepowered.api.*; import org.spongepowered.api.event.inventory.*; import org.spongepowered.api.item.inventory.*;
[ "com.google.common", "java.util", "org.spongepowered.api" ]
com.google.common; java.util; org.spongepowered.api;
2,173,283
public List<ParsedFeature> getFeatures() { return _features; } //--------------------------------------------
List<ParsedFeature> function() { return _features; }
/** * Return all the features defined for this entity * (without including the inherited features). * * @return Features. The list should not be changed. */
Return all the features defined for this entity (without including the inherited features)
getFeatures
{ "repo_name": "lucasdavid/Dust-cleaner", "path": "projects/assignment-player-2/src/gatech/mmpm/tools/parseddomain/ParsedEntity.java", "license": "mit", "size": 14540 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
310,174
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) { return this.func_82429_a((EntityZombie)par1EntityLivingBase, par2, par3); }
int function(EntityLivingBase par1EntityLivingBase, int par2, float par3) { return this.func_82429_a((EntityZombie)par1EntityLivingBase, par2, par3); }
/** * Queries whether should render the specified pass or not. */
Queries whether should render the specified pass or not
shouldRenderPass
{ "repo_name": "HATB0T/RuneCraftery", "path": "forge/mcp/src/minecraft/net/minecraft/client/renderer/entity/RenderZombie.java", "license": "lgpl-3.0", "size": 6612 }
[ "net.minecraft.entity.EntityLivingBase", "net.minecraft.entity.monster.EntityZombie" ]
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.*; import net.minecraft.entity.monster.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
1,577,373
public void modifyColumn(final String tableName, HColumnDescriptor descriptor) throws IOException { modifyColumn(TableName.valueOf(tableName), descriptor); }
void function(final String tableName, HColumnDescriptor descriptor) throws IOException { modifyColumn(TableName.valueOf(tableName), descriptor); }
/** * Modify an existing column family on a table. * Asynchronous operation. * * @param tableName name of table * @param descriptor new column descriptor to use * @throws IOException if a remote or network exception occurs */
Modify an existing column family on a table. Asynchronous operation
modifyColumn
{ "repo_name": "cloud-software-foundation/c5", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java", "license": "apache-2.0", "size": 128826 }
[ "java.io.IOException", "org.apache.hadoop.hbase.HColumnDescriptor", "org.apache.hadoop.hbase.TableName" ]
import java.io.IOException; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.TableName;
import java.io.*; import org.apache.hadoop.hbase.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
364,804
@SimpleFunction( description = "Load the page at the given URL.") public void GoToUrl(String url) { webview.loadUrl(url); }
@SimpleFunction( description = STR) void function(String url) { webview.loadUrl(url); }
/** * Load the given URL */
Load the given URL
GoToUrl
{ "repo_name": "cs6510/CS6510-Compiler-John", "path": "appinventor/components/src/com/google/appinventor/components/runtime/WebViewer.java", "license": "apache-2.0", "size": 15232 }
[ "com.google.appinventor.components.annotations.SimpleFunction" ]
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.*;
[ "com.google.appinventor" ]
com.google.appinventor;
699,552
public File tofile(HSSFWorkbook wb, String[] generalTitle) { // Goodwill String path = System.getProperty("java.io.tmpdir"); if ( !(path.endsWith("/") || path.endsWith("\\")) ) path = path + System.getProperty("file.separator"); String prefix = StringUtils.makePrefix(generalTitle[0]); if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Path="+path + " Prefix="+prefix); } File file = new File(path+prefix+".xls"); try { if (file.exists()) file.delete(); } catch (Exception e) { log.log(Level.SEVERE, "file", e); return null; } // FileOutputStream fos; try { fos = new FileOutputStream(file); // fos.write(bytes); wb.write(fos); fos.flush(); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return file; }// tofile
File function(HSSFWorkbook wb, String[] generalTitle) { String path = System.getProperty(STR); if ( !(path.endsWith("/") path.endsWith("\\")) ) path = path + System.getProperty(STR); String prefix = StringUtils.makePrefix(generalTitle[0]); if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Path="+path + STR+prefix); } File file = new File(path+prefix+".xls"); try { if (file.exists()) file.delete(); } catch (Exception e) { log.log(Level.SEVERE, "file", e); return null; } FileOutputStream fos; try { fos = new FileOutputStream(file); wb.write(fos); fos.flush(); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return file; }
/** * Crea el archivo PDF a partir de un Byte[] ** Create PDF File from a Byte[] * @param wb * @param generalTitle * @return File */
Crea el archivo PDF a partir de un Byte[] ** Create PDF File from a Byte[]
tofile
{ "repo_name": "erpcya/adempierePOS", "path": "base/src/org/adempiere/excel/SmjXlsReport.java", "license": "gpl-2.0", "size": 19459 }
[ "java.io.File", "java.io.FileNotFoundException", "java.io.FileOutputStream", "java.io.IOException", "java.util.logging.Level", "org.adempiere.util.StringUtils", "org.apache.poi.hssf.usermodel.HSSFWorkbook" ]
import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.logging.Level; import org.adempiere.util.StringUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import java.io.*; import java.util.logging.*; import org.adempiere.util.*; import org.apache.poi.hssf.usermodel.*;
[ "java.io", "java.util", "org.adempiere.util", "org.apache.poi" ]
java.io; java.util; org.adempiere.util; org.apache.poi;
699,863
public void testScanPositions() throws Exception { Statement s = createStatement(); // Try several different syntaxes of index scans, to see what we get: String []searches = { "select * from flights where dest_airport = 'ABQ'", "select * from flights where dest_airport > 'HNL'", "select * from flights where dest_airport < 'HNL'", "select * from flights where dest_airport between 'H' and 'J'", "select * from flights where dest_airport like 'AB%'", }; String []startPrefixes = { ">= on first 1 column(s).", "> on first 1 column(s).", "None", ">= on first 1 column(s).", ">= on first 1 column(s).", }; String []stopPrefixes = { "> on first 1 column(s).", "None", ">= on first 1 column(s).", "> on first 1 column(s).", ">= on first 1 column(s).", }; enableXplainStyle(s); for (int i = 0; i < searches.length; i++) s.executeQuery(searches[i]).close(); disableXplainStyle(s, true); ResultSet rs = s.executeQuery( "select s.stmt_text, sp.start_position, sp.stop_position " + " from xpltest.sysxplain_statements s, " + " xpltest.sysxplain_resultsets rs, " + " xpltest.sysxplain_scan_props sp " + " where s.stmt_id = rs.stmt_id and " + " rs.scan_rs_id = sp.scan_rs_id"); int matchedStatements = 0; while (rs.next()) { String sText = rs.getString("stmt_text"); String startPos = rs.getString("start_position").trim(); String stopPos = rs.getString("stop_position").trim(); boolean foundStmt = false; for (int i = 0; i < searches.length; i++) { if (searches[i].equals(sText)) { matchedStatements++; foundStmt = true; if (! startPos.startsWith(startPrefixes[i])) fail("Expected start_position for statement '" + searches[i] + "' to start with '" + startPrefixes[i] + "', but it actually was " + startPos); if (! stopPos.startsWith(stopPrefixes[i])) fail("Expected stop_position for statement '" + searches[i] + "' to start with '" + stopPrefixes[i] + "', but it actually was " + stopPos); break; } } assertTrue("Found unexpected statement " + sText, foundStmt); } assertEquals("Captured wrong number of statements?", searches.length, matchedStatements); if(XML.classpathMeetsXMLReqs()){ //getting the stmt_ids, because files are generated using //stmt_id as their name. String[] stmt_id = getStmtIDArray(s, searches.length); for(int i=0;i<stmt_id.length;i++){ //testing the <statement> element Assert.assertEquals( searches[i], readStatement(stmt_id[i])); } } }
void function() throws Exception { Statement s = createStatement(); String []searches = { STR, STR, STR, STR, STR, }; String []startPrefixes = { STR, STR, "None", STR, STR, }; String []stopPrefixes = { STR, "None", STR, STR, STR, }; enableXplainStyle(s); for (int i = 0; i < searches.length; i++) s.executeQuery(searches[i]).close(); disableXplainStyle(s, true); ResultSet rs = s.executeQuery( STR + STR + STR + STR + STR + STR); int matchedStatements = 0; while (rs.next()) { String sText = rs.getString(STR); String startPos = rs.getString(STR).trim(); String stopPos = rs.getString(STR).trim(); boolean foundStmt = false; for (int i = 0; i < searches.length; i++) { if (searches[i].equals(sText)) { matchedStatements++; foundStmt = true; if (! startPos.startsWith(startPrefixes[i])) fail(STR + searches[i] + STR + startPrefixes[i] + STR + startPos); if (! stopPos.startsWith(stopPrefixes[i])) fail(STR + searches[i] + STR + stopPrefixes[i] + STR + stopPos); break; } } assertTrue(STR + sText, foundStmt); } assertEquals(STR, searches.length, matchedStatements); if(XML.classpathMeetsXMLReqs()){ String[] stmt_id = getStmtIDArray(s, searches.length); for(int i=0;i<stmt_id.length;i++){ Assert.assertEquals( searches[i], readStatement(stmt_id[i])); } } }
/** * A simple test to verify that startPosition and stopPosition work. */
A simple test to verify that startPosition and stopPosition work
testScanPositions
{ "repo_name": "trejkaz/derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/XplainStatisticsTest.java", "license": "apache-2.0", "size": 128562 }
[ "java.sql.ResultSet", "java.sql.Statement", "junit.framework.Assert", "org.apache.derbyTesting.junit.XML" ]
import java.sql.ResultSet; import java.sql.Statement; import junit.framework.Assert; import org.apache.derbyTesting.junit.XML;
import java.sql.*; import junit.framework.*; import org.apache.*;
[ "java.sql", "junit.framework", "org.apache" ]
java.sql; junit.framework; org.apache;
1,989,145
public void setForeground(Drawable drawable) { if (mForeground != drawable) { if (mForeground != null) { mForeground.setCallback(null); unscheduleDrawable(mForeground); } mForeground = drawable; if (drawable != null) { setWillNotDraw(false); drawable.setCallback(this); if (drawable.isStateful()) { drawable.setState(getDrawableState()); } if (mForegroundGravity == Gravity.FILL) { Rect padding = new Rect(); drawable.getPadding(padding); } } else { setWillNotDraw(true); } requestLayout(); invalidate(); } }
void function(Drawable drawable) { if (mForeground != drawable) { if (mForeground != null) { mForeground.setCallback(null); unscheduleDrawable(mForeground); } mForeground = drawable; if (drawable != null) { setWillNotDraw(false); drawable.setCallback(this); if (drawable.isStateful()) { drawable.setState(getDrawableState()); } if (mForegroundGravity == Gravity.FILL) { Rect padding = new Rect(); drawable.getPadding(padding); } } else { setWillNotDraw(true); } requestLayout(); invalidate(); } }
/** * Supply a Drawable that is to be rendered on top of all of the child * views in the frame layout. Any padding in the Drawable will be taken * into account by ensuring that the children are inset to be placed * inside of the padding area. * * @param drawable The Drawable to be drawn on top of the children. */
Supply a Drawable that is to be rendered on top of all of the child views in the frame layout. Any padding in the Drawable will be taken into account by ensuring that the children are inset to be placed inside of the padding area
setForeground
{ "repo_name": "mcginty/TextSecure", "path": "src/org/thoughtcrime/securesms/components/ForegroundImageView.java", "license": "gpl-3.0", "size": 7978 }
[ "android.graphics.Rect", "android.graphics.drawable.Drawable", "android.view.Gravity" ]
import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.view.Gravity;
import android.graphics.*; import android.graphics.drawable.*; import android.view.*;
[ "android.graphics", "android.view" ]
android.graphics; android.view;
2,484,271
public void setNavBarColor(String Color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setNavigationBarColor(android.graphics.Color.parseColor(Color)); } }
void function(String Color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setNavigationBarColor(android.graphics.Color.parseColor(Color)); } }
/** * Allows the user to set the nav bar color of their app intro * * @param Color string form of color in 3 or 6 digit hex form (#ffffff) */
Allows the user to set the nav bar color of their app intro
setNavBarColor
{ "repo_name": "PaoloRotolo/AppIntro", "path": "appintro/src/main/java/com/github/paolorotolo/appintro/AppIntroBase.java", "license": "apache-2.0", "size": 41293 }
[ "android.os.Build" ]
import android.os.Build;
import android.os.*;
[ "android.os" ]
android.os;
1,860,508
//------------------------------------------------------------------------- public static IborCapletFloorletPeriodCurrencyAmounts of( Map<IborCapletFloorletPeriod, CurrencyAmount> currencyAmountMap) { return new IborCapletFloorletPeriodCurrencyAmounts(currencyAmountMap); }
static IborCapletFloorletPeriodCurrencyAmounts function( Map<IborCapletFloorletPeriod, CurrencyAmount> currencyAmountMap) { return new IborCapletFloorletPeriodCurrencyAmounts(currencyAmountMap); }
/** * Obtains an instance of currency amounts. * * @param currencyAmountMap the map of currency amounts * @return the instance */
Obtains an instance of currency amounts
of
{ "repo_name": "OpenGamma/Strata", "path": "modules/pricer/src/main/java/com/opengamma/strata/pricer/capfloor/IborCapletFloorletPeriodCurrencyAmounts.java", "license": "apache-2.0", "size": 10460 }
[ "com.opengamma.strata.basics.currency.CurrencyAmount", "com.opengamma.strata.product.capfloor.IborCapletFloorletPeriod", "java.util.Map" ]
import com.opengamma.strata.basics.currency.CurrencyAmount; import com.opengamma.strata.product.capfloor.IborCapletFloorletPeriod; import java.util.Map;
import com.opengamma.strata.basics.currency.*; import com.opengamma.strata.product.capfloor.*; import java.util.*;
[ "com.opengamma.strata", "java.util" ]
com.opengamma.strata; java.util;
1,641,251
@Test public void testEquals2() { TestRenderer r1 = new TestRenderer(); TestRenderer r2 = new TestRenderer(); assertEquals(r1, r2); r1.setTreatLegendShapeAsLine(true); assertFalse(r1.equals(r2)); r2.setTreatLegendShapeAsLine(true); assertEquals(r1, r2); }
void function() { TestRenderer r1 = new TestRenderer(); TestRenderer r2 = new TestRenderer(); assertEquals(r1, r2); r1.setTreatLegendShapeAsLine(true); assertFalse(r1.equals(r2)); r2.setTreatLegendShapeAsLine(true); assertEquals(r1, r2); }
/** * Check that the treatLegendShapeAsLine flag is included in the equals() * comparison. */
Check that the treatLegendShapeAsLine flag is included in the equals() comparison
testEquals2
{ "repo_name": "greearb/jfreechart-fse-ct", "path": "src/test/java/org/jfree/chart/renderer/AbstractRendererTest.java", "license": "lgpl-2.1", "size": 27742 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
395,919
public LoanAccountPage applyChargeUsingFeeLabel(String loanId, ChargeParameters params) { LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage(loanId); ApplyChargePage applyChargePage = loanAccountPage.navigateToApplyCharge(); loanAccountPage = applyChargePage.submitUsingLabelAndNavigateToApplyChargeConfirmationPage(params); return loanAccountPage; }
LoanAccountPage function(String loanId, ChargeParameters params) { LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage(loanId); ApplyChargePage applyChargePage = loanAccountPage.navigateToApplyCharge(); loanAccountPage = applyChargePage.submitUsingLabelAndNavigateToApplyChargeConfirmationPage(params); return loanAccountPage; }
/** * Applies a charge to the loan account with id <tt>loanId</tt>. Uses the fee label * rather than type value to select the fee. * @param loanId The account id. * @param params The charge parameters (amount and type). * @return The loan account page for the loan account. */
Applies a charge to the loan account with id loanId. Uses the fee label rather than type value to select the fee
applyChargeUsingFeeLabel
{ "repo_name": "madhav123/gkmaster", "path": "acceptanceTests/src/test/java/org/mifos/test/acceptance/framework/testhelpers/LoanTestHelper.java", "license": "apache-2.0", "size": 58502 }
[ "org.mifos.test.acceptance.framework.loan.ApplyChargePage", "org.mifos.test.acceptance.framework.loan.ChargeParameters", "org.mifos.test.acceptance.framework.loan.LoanAccountPage" ]
import org.mifos.test.acceptance.framework.loan.ApplyChargePage; import org.mifos.test.acceptance.framework.loan.ChargeParameters; import org.mifos.test.acceptance.framework.loan.LoanAccountPage;
import org.mifos.test.acceptance.framework.loan.*;
[ "org.mifos.test" ]
org.mifos.test;
839,912
public static byte[] replaceVariables(InputStream docxInputStream, Map<String, String> mappings) throws JAXBException, Docx4JException, IOException{ if (docxInputStream == null || mappings == null){ throw new NullPointerException(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage .load(docxInputStream); MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart(); documentPart.variableReplace(mappings); SaveToZipFile saver = new SaveToZipFile(wordMLPackage); saver.save(baos); return baos.toByteArray(); }
static byte[] function(InputStream docxInputStream, Map<String, String> mappings) throws JAXBException, Docx4JException, IOException{ if (docxInputStream == null mappings == null){ throw new NullPointerException(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage .load(docxInputStream); MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart(); documentPart.variableReplace(mappings); SaveToZipFile saver = new SaveToZipFile(wordMLPackage); saver.save(baos); return baos.toByteArray(); }
/** * Replaces variables represented as ${variable-name} inside an input stream * on a .docx file to the corresponding values specified by the variables * names as the key in the input map and returns the result as a byte array. * * @param docxInputStream * - input stream on a .docx file * @param mappings * - the variable - value mappings * @return - the result as a byte array * @throws JAXBException * - when errors are encountered while replacing variables in * the input file * @throws Docx4JException * - when errors are encountered while reading the input .docx * file */
Replaces variables represented as ${variable-name} inside an input stream on a .docx file to the corresponding values specified by the variables names as the key in the input map and returns the result as a byte array
replaceVariables
{ "repo_name": "Vizabyte/vizabyte-utils", "path": "src/main/java/com/vizabyte/utils/DocxUtils.java", "license": "apache-2.0", "size": 7686 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.io.InputStream", "java.util.Map", "javax.xml.bind.JAXBException", "org.docx4j.openpackaging.exceptions.Docx4JException", "org.docx4j.openpackaging.io.SaveToZipFile", "org.docx4j.openpackaging.packages.WordprocessingMLPackage", "org.docx4j.openpackaging.parts.WordprocessingML" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Map; import javax.xml.bind.JAXBException; import org.docx4j.openpackaging.exceptions.Docx4JException; import org.docx4j.openpackaging.io.SaveToZipFile; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.docx4j.openpackaging.parts.WordprocessingML;
import java.io.*; import java.util.*; import javax.xml.bind.*; import org.docx4j.openpackaging.exceptions.*; import org.docx4j.openpackaging.io.*; import org.docx4j.openpackaging.packages.*; import org.docx4j.openpackaging.parts.*;
[ "java.io", "java.util", "javax.xml", "org.docx4j.openpackaging" ]
java.io; java.util; javax.xml; org.docx4j.openpackaging;
768,793
public CmsContainerPageBean getContainerPage(CmsObject cms, Locale locale) { Locale theLocale = locale; if (!m_cntPages.containsKey(theLocale)) { LOG.warn(Messages.get().container( Messages.LOG_CONTAINER_PAGE_LOCALE_NOT_FOUND_2, cms.getSitePath(getFile()), theLocale.toString()).key()); return null; } return m_cntPages.get(theLocale); }
CmsContainerPageBean function(CmsObject cms, Locale locale) { Locale theLocale = locale; if (!m_cntPages.containsKey(theLocale)) { LOG.warn(Messages.get().container( Messages.LOG_CONTAINER_PAGE_LOCALE_NOT_FOUND_2, cms.getSitePath(getFile()), theLocale.toString()).key()); return null; } return m_cntPages.get(theLocale); }
/** * Returns the container page bean for the given locale.<p> * * @param cms the cms context * @param locale the locale to use * * @return the container page bean */
Returns the container page bean for the given locale
getContainerPage
{ "repo_name": "serrapos/opencms-core", "path": "src/org/opencms/xml/containerpage/CmsXmlContainerPage.java", "license": "lgpl-2.1", "size": 22066 }
[ "java.util.Locale", "org.opencms.file.CmsObject" ]
import java.util.Locale; import org.opencms.file.CmsObject;
import java.util.*; import org.opencms.file.*;
[ "java.util", "org.opencms.file" ]
java.util; org.opencms.file;
868,293
@Override public boolean encrypt(Activity activity, String data, PgpData pgpData) { android.content.Intent intent = new android.content.Intent(Intent.ENCRYPT_AND_RETURN); intent.putExtra(EXTRA_INTENT_VERSION, INTENT_VERSION); intent.setType("text/plain"); intent.putExtra(Apg.EXTRA_TEXT, data); intent.putExtra(Apg.EXTRA_ENCRYPTION_KEY_IDS, pgpData.getEncryptionKeys()); intent.putExtra(Apg.EXTRA_SIGNATURE_KEY_ID, pgpData.getSignatureKeyId()); try { activity.startActivityForResult(intent, Apg.ENCRYPT_MESSAGE); return true; } catch (ActivityNotFoundException e) { Toast.makeText(activity, R.string.error_activity_not_found, Toast.LENGTH_SHORT).show(); return false; } }
boolean function(Activity activity, String data, PgpData pgpData) { android.content.Intent intent = new android.content.Intent(Intent.ENCRYPT_AND_RETURN); intent.putExtra(EXTRA_INTENT_VERSION, INTENT_VERSION); intent.setType(STR); intent.putExtra(Apg.EXTRA_TEXT, data); intent.putExtra(Apg.EXTRA_ENCRYPTION_KEY_IDS, pgpData.getEncryptionKeys()); intent.putExtra(Apg.EXTRA_SIGNATURE_KEY_ID, pgpData.getSignatureKeyId()); try { activity.startActivityForResult(intent, Apg.ENCRYPT_MESSAGE); return true; } catch (ActivityNotFoundException e) { Toast.makeText(activity, R.string.error_activity_not_found, Toast.LENGTH_SHORT).show(); return false; } }
/** * Start the encrypt activity. * * @param activity * @param data * @param pgpData * @return success or failure */
Start the encrypt activity
encrypt
{ "repo_name": "imaeses/k-9", "path": "src/com/fsck/k9/crypto/Apg.java", "license": "bsd-3-clause", "size": 22086 }
[ "android.app.Activity", "android.content.ActivityNotFoundException", "android.widget.Toast" ]
import android.app.Activity; import android.content.ActivityNotFoundException; import android.widget.Toast;
import android.app.*; import android.content.*; import android.widget.*;
[ "android.app", "android.content", "android.widget" ]
android.app; android.content; android.widget;
1,725,261
public List<Link> getLinks() { return _links; }
List<Link> function() { return _links; }
/** * Return the links to external information about the route. * * @return the links to external information about the route */
Return the links to external information about the route
getLinks
{ "repo_name": "jenetics/jpx", "path": "jpx/src/main/java/io/jenetics/jpx/Route.java", "license": "apache-2.0", "size": 24219 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
946,964
protected void prepareCacheConfigurations(CacheConfiguration dataCacheCfg, CacheConfiguration metaCacheCfg) { // Noop }
void function(CacheConfiguration dataCacheCfg, CacheConfiguration metaCacheCfg) { }
/** * Prepare cache configuration. * * @param dataCacheCfg Data cache configuration. * @param metaCacheCfg Meta cache configuration. */
Prepare cache configuration
prepareCacheConfigurations
{ "repo_name": "agura/incubator-ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java", "license": "apache-2.0", "size": 103094 }
[ "org.apache.ignite.configuration.CacheConfiguration" ]
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,594,080
public void paint(Graphics g, float scale) { g.setColor(Color.black); int n = x.length; for (short i = 0; i < n - 1; i++) { g.drawLine((int) (x[i] * scale), (int) (y[i] * scale), (int) (x[i + 1] * scale), (int) (y[i + 1] * scale)); } }
void function(Graphics g, float scale) { g.setColor(Color.black); int n = x.length; for (short i = 0; i < n - 1; i++) { g.drawLine((int) (x[i] * scale), (int) (y[i] * scale), (int) (x[i + 1] * scale), (int) (y[i + 1] * scale)); } }
/** * paint this random walk on a graphics with the given scale. The origin and initial step are not drawn. */
paint this random walk on a graphics with the given scale. The origin and initial step are not drawn
paint
{ "repo_name": "concord-consortium/mw", "path": "src/org/concord/mw2d/models/Walk.java", "license": "gpl-2.0", "size": 8231 }
[ "java.awt.Color", "java.awt.Graphics" ]
import java.awt.Color; import java.awt.Graphics;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,668,149
private String parseString(XmlPullParser parser, String tag) throws IOException, XmlPullParserException { parser.require(XmlPullParser.START_TAG, null, tag); String title = parseText(parser); parser.require(XmlPullParser.END_TAG, null, tag); return title; }
String function(XmlPullParser parser, String tag) throws IOException, XmlPullParserException { parser.require(XmlPullParser.START_TAG, null, tag); String title = parseText(parser); parser.require(XmlPullParser.END_TAG, null, tag); return title; }
/** * Returns the title of a card * * @param parser * @return * @throws java.io.IOException * @throws org.xmlpull.v1.XmlPullParserException */
Returns the title of a card
parseString
{ "repo_name": "interoberlin/sugarmonkey", "path": "lib/src/main/java/de/interoberlin/sauvignon/lib/controller/SvgParser.java", "license": "gpl-3.0", "size": 55508 }
[ "java.io.IOException", "org.xmlpull.v1.XmlPullParser", "org.xmlpull.v1.XmlPullParserException" ]
import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException;
import java.io.*; import org.xmlpull.v1.*;
[ "java.io", "org.xmlpull.v1" ]
java.io; org.xmlpull.v1;
878,929
@Test public void disableWhenEnabled() { assertThat(underTest.isEnabled(), is(false)); underTest.enable(); assertThat(underTest.isEnabled(), is(true)); underTest.disable(); assertThat(underTest.isEnabled(), is(false)); verify(activationCondition).release(); }
void function() { assertThat(underTest.isEnabled(), is(false)); underTest.enable(); assertThat(underTest.isEnabled(), is(true)); underTest.disable(); assertThat(underTest.isEnabled(), is(false)); verify(activationCondition).release(); }
/** * Capability is disabled and enable flag is set. */
Capability is disabled and enable flag is set
disableWhenEnabled
{ "repo_name": "scmod/nexus-public", "path": "plugins/capabilities/nexus-capabilities-plugin/src/test/java/org/sonatype/nexus/plugins/capabilities/internal/DefaultCapabilityReferenceTest.java", "license": "epl-1.0", "size": 16002 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.mockito.Mockito" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.mockito.Mockito;
import org.hamcrest.*; import org.mockito.*;
[ "org.hamcrest", "org.mockito" ]
org.hamcrest; org.mockito;
2,169,271
public static void v(String tag, String msg, Object... args) { if (sLevel > LEVEL_VERBOSE) { return; } if (args.length > 0) { msg = String.format(msg, args); } Log.v(tag, msg); }
static functionoid v(String tag, String msg, Object... args) { if (sLevel > LEVEL_VERBOSE) { return; } if (args.length > 0) { msg = String.format(msg, args); } Log.v(tag, msg); }
/** * Send a VERBOSE log message. * * @param tag * @param msg * @param args */
Send a VERBOSE log message
v
{ "repo_name": "xu6148152/binea_project_for_android", "path": "PullToRefresh/pulltorefreshlib/src/main/java/demo/binea/com/pulltorefreshlib/util/PtrCLog.java", "license": "mit", "size": 6150 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
2,586,087
public void test_04_undefinedAndIllegal() throws Exception { Connection conn = getConnection(); vet_getBooleanIsIllegal( conn, "BLOB_COL" ); vet_getBooleanIsIllegal( conn, "CHAR_FOR_BIT_DATA_COL" ); vet_getBooleanIsIllegal( conn, "CLOB_COL" ); vet_getBooleanIsIllegal( conn, "DATE_COL" ); vet_getBooleanIsIllegal( conn, "LONG_VARCHAR_FOR_BIT_DATA_COL" ); vet_getBooleanIsIllegal( conn, "TIME_COL" ); vet_getBooleanIsIllegal( conn, "TIMESTAMP_COL" ); vet_getBooleanIsIllegal( conn, "VARCHAR_FOR_BIT_DATA_COL" ); }
void function() throws Exception { Connection conn = getConnection(); vet_getBooleanIsIllegal( conn, STR ); vet_getBooleanIsIllegal( conn, STR ); vet_getBooleanIsIllegal( conn, STR ); vet_getBooleanIsIllegal( conn, STR ); vet_getBooleanIsIllegal( conn, STR ); vet_getBooleanIsIllegal( conn, STR ); vet_getBooleanIsIllegal( conn, STR ); vet_getBooleanIsIllegal( conn, STR ); }
/** * <p> * Verify Derby's behavior is the same for embedded and client * drivers on datatypes for which the JDBC spec does not define results * and which Derby does not handle. * </p> */
Verify Derby's behavior is the same for embedded and client drivers on datatypes for which the JDBC spec does not define results and which Derby does not handle.
test_04_undefinedAndIllegal
{ "repo_name": "kavin256/Derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java", "license": "apache-2.0", "size": 73417 }
[ "java.sql.Connection" ]
import java.sql.Connection;
import java.sql.*;
[ "java.sql" ]
java.sql;
680,639
private void handleModify(Intent data) { Product theProductToModify = (Product) data.getSerializableExtra(ProductDetailsActivity.EXTRA_PRODUCT); Intent i = new Intent(this, ModifyProductActivity.class); i.putExtra(PRODUCT_TO_MODIFY_EXTRA, theProductToModify); startActivityForResult(i, MODIFY_PRODUCT_REQUEST); }
void function(Intent data) { Product theProductToModify = (Product) data.getSerializableExtra(ProductDetailsActivity.EXTRA_PRODUCT); Intent i = new Intent(this, ModifyProductActivity.class); i.putExtra(PRODUCT_TO_MODIFY_EXTRA, theProductToModify); startActivityForResult(i, MODIFY_PRODUCT_REQUEST); }
/** * Do this when the user decides he should modify a product */
Do this when the user decides he should modify a product
handleModify
{ "repo_name": "noob1211/demo", "path": "src/main/java/com/mobileappscompany/application/productapp/android/views/impl/MainActivity.java", "license": "gpl-2.0", "size": 10701 }
[ "android.content.Intent", "com.mobileappscompany.application.productapp.domain.model.product.Product" ]
import android.content.Intent; import com.mobileappscompany.application.productapp.domain.model.product.Product;
import android.content.*; import com.mobileappscompany.application.productapp.domain.model.product.*;
[ "android.content", "com.mobileappscompany.application" ]
android.content; com.mobileappscompany.application;
2,503,923
public void sendTo (AbstractPacket message, EntityPlayerMP player) { this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); this.channels.get(Side.SERVER).writeAndFlush(message); } /** * Send this message to everyone within a certain range of a point. * <p/> * Adapted from CPW's code in * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper * * @param message * The message to send * @param point * The * {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint}
void function (AbstractPacket message, EntityPlayerMP player) { this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); this.channels.get(Side.SERVER).writeAndFlush(message); } /** * Send this message to everyone within a certain range of a point. * <p/> * Adapted from CPW's code in * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper * * @param message * The message to send * @param point * The * {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint}
/** * Send this message to the specified player. * <p/> * Adapted from CPW's code in * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper * * @param message * The message to send * @param player * The player to send it to */
Send this message to the specified player. Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
sendTo
{ "repo_name": "lipki/TFCNT", "path": "src/Common/com/bioxx/tfc/Handlers/Network/PacketPipeline.java", "license": "gpl-3.0", "size": 8696 }
[ "net.minecraft.entity.player.EntityPlayerMP" ]
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
1,679,773
public void setCircleOval(RectF orginCircleOval) { pieChartRenderer.setCircleOval(orginCircleOval); ViewCompat.postInvalidateOnAnimation(this); }
void function(RectF orginCircleOval) { pieChartRenderer.setCircleOval(orginCircleOval); ViewCompat.postInvalidateOnAnimation(this); }
/** * Use this to change pie chart area. Because by default CircleOval is calculated onSizeChanged() you must call this * method after size of PieChartView is calculated. In most cases it will probably be easier to use * {@link #setCircleFillRatio(float)} to change chart area or just use view padding. */
Use this to change pie chart area. Because by default CircleOval is calculated onSizeChanged() you must call this method after size of PieChartView is calculated. In most cases it will probably be easier to use <code>#setCircleFillRatio(float)</code> to change chart area or just use view padding
setCircleOval
{ "repo_name": "Thought-Technology-Ltd/hellocharts-android", "path": "hellocharts-library/src/lecho/lib/hellocharts/view/PieChartView.java", "license": "apache-2.0", "size": 6319 }
[ "android.graphics.RectF", "android.support.v4.view.ViewCompat" ]
import android.graphics.RectF; import android.support.v4.view.ViewCompat;
import android.graphics.*; import android.support.v4.view.*;
[ "android.graphics", "android.support" ]
android.graphics; android.support;
2,578,866
public void addPlayerHandler(PlayerHandler handler) { playerHandlers.add(handler); }
void function(PlayerHandler handler) { playerHandlers.add(handler); }
/** * Adds an player handler to the list of handlers. * * @param handler The handler to add. */
Adds an player handler to the list of handlers
addPlayerHandler
{ "repo_name": "davidi2/mopar", "path": "src/net/scapeemulator/game/plugin/ScriptContext.java", "license": "isc", "size": 7626 }
[ "net.scapeemulator.game.dispatcher.player.PlayerHandler" ]
import net.scapeemulator.game.dispatcher.player.PlayerHandler;
import net.scapeemulator.game.dispatcher.player.*;
[ "net.scapeemulator.game" ]
net.scapeemulator.game;
2,002,431
public List<Player> getWinners() { return winners; } }
List<Player> function() { return winners; } }
/** * Returns the list players that won this round * * @return the list of players that won this round */
Returns the list players that won this round
getWinners
{ "repo_name": "stieglma/sphereMiners", "path": "src/main/java/me/stieglmaier/sphereMiners/model/util/Tick.java", "license": "mit", "size": 1862 }
[ "java.util.List", "me.stieglmaier.sphereMiners.model.ai.Player" ]
import java.util.List; import me.stieglmaier.sphereMiners.model.ai.Player;
import java.util.*; import me.stieglmaier.*;
[ "java.util", "me.stieglmaier" ]
java.util; me.stieglmaier;
2,318,071
public static ims.clinical.configuration.domain.objects.CancerImagingHotlist extractCancerImagingHotlist(ims.domain.ILightweightDomainFactory domainFactory, ims.clinicaladmin.vo.CancerImagingHotlistShortVo valueObject) { return extractCancerImagingHotlist(domainFactory, valueObject, new HashMap()); }
static ims.clinical.configuration.domain.objects.CancerImagingHotlist function(ims.domain.ILightweightDomainFactory domainFactory, ims.clinicaladmin.vo.CancerImagingHotlistShortVo valueObject) { return extractCancerImagingHotlist(domainFactory, valueObject, new HashMap()); }
/** * Create the domain object from the value object. * @param domainFactory - used to create existing (persistent) domain objects. * @param valueObject - extract the domain object fields from this. */
Create the domain object from the value object
extractCancerImagingHotlist
{ "repo_name": "open-health-hub/openmaxims-linux", "path": "openmaxims_workspace/ValueObjects/src/ims/clinicaladmin/vo/domain/CancerImagingHotlistShortVoAssembler.java", "license": "agpl-3.0", "size": 20250 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
542,951