method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public boolean exists( LanguageFile langFile )
{
return new File( root, langFile.getFilename() ).exists();
} | boolean function( LanguageFile langFile ) { return new File( root, langFile.getFilename() ).exists(); } | /**
* Returns true if the specified LanguageFile exists in the source tree,
* that is, if it has a file with the same name as this one, not
* necessarily an identical file.
*/ | Returns true if the specified LanguageFile exists in the source tree, that is, if it has a file with the same name as this one, not necessarily an identical file | exists | {
"repo_name": "marcokrikke/excelbundle",
"path": "src/main/java/senselogic/excelbundle/LanguageTreeIO.java",
"license": "apache-2.0",
"size": 11956
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,482,282 |
private static void d_uacmean( double[] a, double[] c, int m, int n, KahanObject kbuff, Mean kmean, int rl, int ru )
{
//init output (base for incremental agg)
Arrays.fill(c, 0); //including counts
//execute builtin aggregate
for( int i=rl, aix=rl*n; i<ru; i++, aix+=n )
meanAgg( a, c, aix, 0, n, kbuff, kmean );
}
| static void function( double[] a, double[] c, int m, int n, KahanObject kbuff, Mean kmean, int rl, int ru ) { Arrays.fill(c, 0); for( int i=rl, aix=rl*n; i<ru; i++, aix+=n ) meanAgg( a, c, aix, 0, n, kbuff, kmean ); } | /**
* COLMEAN, opcode: uacmean, dense input.
*
* @param a
* @param c
* @param m
* @param n
* @param builtin
*/ | COLMEAN, opcode: uacmean, dense input | d_uacmean | {
"repo_name": "Myasuka/systemml",
"path": "system-ml/src/main/java/com/ibm/bi/dml/runtime/matrix/data/LibMatrixAgg.java",
"license": "apache-2.0",
"size": 77315
} | [
"com.ibm.bi.dml.runtime.functionobjects.Mean",
"com.ibm.bi.dml.runtime.instructions.cp.KahanObject",
"java.util.Arrays"
] | import com.ibm.bi.dml.runtime.functionobjects.Mean; import com.ibm.bi.dml.runtime.instructions.cp.KahanObject; import java.util.Arrays; | import com.ibm.bi.dml.runtime.functionobjects.*; import com.ibm.bi.dml.runtime.instructions.cp.*; import java.util.*; | [
"com.ibm.bi",
"java.util"
] | com.ibm.bi; java.util; | 947,163 |
Program proggie = null;
if (dirOrFile.isFile()) {
String ext = UtilFile.getFileExtension(dirOrFile.getName());
proggie = Program.findProgram(ext);
}
if (proggie != null) {
proggie.execute(dirOrFile.getAbsolutePath());
} else {
if (Program.launch(dirOrFile.getAbsolutePath()) == false) {
Runtime.getRuntime().exec(dirOrFile.getAbsolutePath());
}
}
}
| Program proggie = null; if (dirOrFile.isFile()) { String ext = UtilFile.getFileExtension(dirOrFile.getName()); proggie = Program.findProgram(ext); } if (proggie != null) { proggie.execute(dirOrFile.getAbsolutePath()); } else { if (Program.launch(dirOrFile.getAbsolutePath()) == false) { Runtime.getRuntime().exec(dirOrFile.getAbsolutePath()); } } } | /**
* Opens a directory or file. JDK 1.6: Desktop.getDesktop().open(directory);
*/ | Opens a directory or file. JDK 1.6: Desktop.getDesktop().open(directory) | open | {
"repo_name": "DavidGutknecht/elexis-3-base",
"path": "bundles/ch.medshare.mediport/src/ch/medshare/awt/Desktop.java",
"license": "epl-1.0",
"size": 711
} | [
"ch.medshare.util.UtilFile",
"org.eclipse.swt.program.Program"
] | import ch.medshare.util.UtilFile; import org.eclipse.swt.program.Program; | import ch.medshare.util.*; import org.eclipse.swt.program.*; | [
"ch.medshare.util",
"org.eclipse.swt"
] | ch.medshare.util; org.eclipse.swt; | 1,188,694 |
static String createFailureLog(String user, String operation, String perm,
String target, String description, ApplicationId appId,
ApplicationAttemptId attemptId, ContainerId containerId) {
StringBuilder b = new StringBuilder();
start(Keys.USER, user, b);
addRemoteIP(b);
add(Keys.OPERATION, operation, b);
add(Keys.TARGET, target, b);
add(Keys.RESULT, AuditConstants.FAILURE, b);
add(Keys.DESCRIPTION, description, b);
add(Keys.PERMISSIONS, perm, b);
if (appId != null) {
add(Keys.APPID, appId.toString(), b);
}
if (attemptId != null) {
add(Keys.APPATTEMPTID, attemptId.toString(), b);
}
if (containerId != null) {
add(Keys.CONTAINERID, containerId.toString(), b);
}
return b.toString();
} | static String createFailureLog(String user, String operation, String perm, String target, String description, ApplicationId appId, ApplicationAttemptId attemptId, ContainerId containerId) { StringBuilder b = new StringBuilder(); start(Keys.USER, user, b); addRemoteIP(b); add(Keys.OPERATION, operation, b); add(Keys.TARGET, target, b); add(Keys.RESULT, AuditConstants.FAILURE, b); add(Keys.DESCRIPTION, description, b); add(Keys.PERMISSIONS, perm, b); if (appId != null) { add(Keys.APPID, appId.toString(), b); } if (attemptId != null) { add(Keys.APPATTEMPTID, attemptId.toString(), b); } if (containerId != null) { add(Keys.CONTAINERID, containerId.toString(), b); } return b.toString(); } | /**
* A helper api for creating an audit log for a failure event.
*/ | A helper api for creating an audit log for a failure event | createFailureLog | {
"repo_name": "srijeyanthan/hops",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAuditLogger.java",
"license": "apache-2.0",
"size": 12752
} | [
"org.apache.hadoop.yarn.api.records.ApplicationAttemptId",
"org.apache.hadoop.yarn.api.records.ApplicationId",
"org.apache.hadoop.yarn.api.records.ContainerId"
] | import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ContainerId; | import org.apache.hadoop.yarn.api.records.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,086,496 |
StringBuilder jsonString = new StringBuilder("{");
for (VariableMetadata variableMetadata : variableMetadataList) {
jsonString.append("\"").append(variableMetadata.getMetadataKey()).append("\":\"")
.append(variableMetadata.getMetadataValue()).append("\",");
}
jsonString = new StringBuilder(jsonString.substring(0, jsonString.length() - 1));
jsonString.append("}");
return jsonString.toString();
} | StringBuilder jsonString = new StringBuilder("{"); for (VariableMetadata variableMetadata : variableMetadataList) { jsonString.append("\"STR\":\"STR\","); } jsonString = new StringBuilder(jsonString.substring(0, jsonString.length() - 1)); jsonString.append("}"); return jsonString.toString(); } | /**
* Converts the data held in a list of VariableMetadata objects into a string of JSON data.
*
* @param variableMetadataList The list of VariableMetadata objects to convert.
* @return A string of JSON data gleaned from the list of VariableMetadata objects.
*/ | Converts the data held in a list of VariableMetadata objects into a string of JSON data | convertComplianceLevelDataToJson | {
"repo_name": "Unidata/rosetta",
"path": "src/main/java/edu/ucar/unidata/rosetta/util/JsonUtils.java",
"license": "bsd-3-clause",
"size": 20590
} | [
"edu.ucar.unidata.rosetta.domain.VariableMetadata"
] | import edu.ucar.unidata.rosetta.domain.VariableMetadata; | import edu.ucar.unidata.rosetta.domain.*; | [
"edu.ucar.unidata"
] | edu.ucar.unidata; | 419,802 |
protected int getHorizontalScrollbarHeight() {
ScrollabilityCache cache = mScrollCache;
if (cache != null) {
ScrollBarDrawable scrollBar = cache.scrollBar;
if (scrollBar != null) {
int size = scrollBar.getSize(false);
if (size <= 0) {
size = cache.scrollBarSize;
}
return size;
}
return 0;
}
return 0;
} | int function() { ScrollabilityCache cache = mScrollCache; if (cache != null) { ScrollBarDrawable scrollBar = cache.scrollBar; if (scrollBar != null) { int size = scrollBar.getSize(false); if (size <= 0) { size = cache.scrollBarSize; } return size; } return 0; } return 0; } | /**
* Returns the height of the horizontal scrollbar.
*
* @return The height in pixels of the horizontal scrollbar or 0 if
* there is no horizontal scrollbar.
*/ | Returns the height of the horizontal scrollbar | getHorizontalScrollbarHeight | {
"repo_name": "mateor/PDroidHistory",
"path": "frameworks/base/core/java/android/view/View.java",
"license": "gpl-3.0",
"size": 347830
} | [
"android.widget.ScrollBarDrawable"
] | import android.widget.ScrollBarDrawable; | import android.widget.*; | [
"android.widget"
] | android.widget; | 251,932 |
@ApiModelProperty(value = "The DNS Host Name of this manager, without any domain information")
@JsonProperty("HostName")
public String getHostName() {
return hostName;
} | @ApiModelProperty(value = STR) @JsonProperty(STR) String function() { return hostName; } | /**
* The DNS Host Name of this manager, without any domain information
**/ | The DNS Host Name of this manager, without any domain information | getHostName | {
"repo_name": "jlongever/redfish-client-java",
"path": "src/main/java/io/swagger/client/model/ManagerNetworkProtocol100ManagerNetworkProtocol.java",
"license": "apache-2.0",
"size": 12331
} | [
"com.fasterxml.jackson.annotation.JsonProperty",
"io.swagger.annotations.ApiModelProperty"
] | import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; | import com.fasterxml.jackson.annotation.*; import io.swagger.annotations.*; | [
"com.fasterxml.jackson",
"io.swagger.annotations"
] | com.fasterxml.jackson; io.swagger.annotations; | 2,388,739 |
private void appendAccess(final int access) {
if ((access & Opcodes.ACC_PUBLIC) != 0) {
buf.append("public ");
}
if ((access & Opcodes.ACC_PRIVATE) != 0) {
buf.append("private ");
}
if ((access & Opcodes.ACC_PROTECTED) != 0) {
buf.append("protected ");
}
if ((access & Opcodes.ACC_FINAL) != 0) {
buf.append("final ");
}
if ((access & Opcodes.ACC_STATIC) != 0) {
buf.append("static ");
}
if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
buf.append("synchronized ");
}
if ((access & Opcodes.ACC_VOLATILE) != 0) {
buf.append("volatile ");
}
if ((access & Opcodes.ACC_TRANSIENT) != 0) {
buf.append("transient ");
}
if ((access & Opcodes.ACC_ABSTRACT) != 0) {
buf.append("abstract ");
}
if ((access & Opcodes.ACC_STRICT) != 0) {
buf.append("strictfp ");
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
buf.append("synthetic ");
}
if ((access & Opcodes.ACC_MANDATED) != 0) {
buf.append("mandated ");
}
if ((access & Opcodes.ACC_ENUM) != 0) {
buf.append("enum ");
}
} | void function(final int access) { if ((access & Opcodes.ACC_PUBLIC) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_PRIVATE) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_PROTECTED) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_FINAL) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_STATIC) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_VOLATILE) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_TRANSIENT) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_ABSTRACT) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_STRICT) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_SYNTHETIC) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_MANDATED) != 0) { buf.append(STR); } if ((access & Opcodes.ACC_ENUM) != 0) { buf.append(STR); } } | /**
* Appends a string representation of the given access modifiers to
* {@link #buf buf}.
*
* @param access
* some access modifiers.
*/ | Appends a string representation of the given access modifiers to <code>#buf buf</code> | appendAccess | {
"repo_name": "Programming-Systems-Lab/knarr",
"path": "Phosphor/src/edu/columbia/cs/psl/phosphor/org/objectweb/asm/util/Textifier.java",
"license": "mit",
"size": 48837
} | [
"edu.columbia.cs.psl.phosphor.org.objectweb.asm.Opcodes"
] | import edu.columbia.cs.psl.phosphor.org.objectweb.asm.Opcodes; | import edu.columbia.cs.psl.phosphor.org.objectweb.asm.*; | [
"edu.columbia.cs"
] | edu.columbia.cs; | 326,307 |
private boolean contains(ScrollableWidgetFigure scrollableFigure, Rectangle r, Point p) {
Rectangle sb = r.getCopy();
Point sp = translatePointToAbsolute(scrollableFigure);
sb.x = sb.x + sp.x;
sb.y = sb.y + sp.y;
if (sb.contains(p)) {
return true;
}
return false;
}
| boolean function(ScrollableWidgetFigure scrollableFigure, Rectangle r, Point p) { Rectangle sb = r.getCopy(); Point sp = translatePointToAbsolute(scrollableFigure); sb.x = sb.x + sp.x; sb.y = sb.y + sp.y; if (sb.contains(p)) { return true; } return false; } | /**
* Returns true if the Rectanglwe contains the Point. This test
* is relative to the figure passed as an argument. The Rectangle
* is displaced relative to the absolute position of the Figure
* before performing the test.
*
* @param scrollableFigure The figure
* @param r The Rectangle
* @param p The Point to test
* @return boolean True if the Rectangle contains the Point
*/ | Returns true if the Rectanglwe contains the Point. This test is relative to the figure passed as an argument. The Rectangle is displaced relative to the absolute position of the Figure before performing the test | contains | {
"repo_name": "debabratahazra/DS",
"path": "designstudio/components/page/ui/com.odcgroup.page.ui/src/main/java/com/odcgroup/page/ui/edit/ScrollableWidgetEditPart.java",
"license": "epl-1.0",
"size": 3822
} | [
"com.odcgroup.page.ui.figure.scroll.ScrollableWidgetFigure",
"org.eclipse.draw2d.geometry.Point",
"org.eclipse.draw2d.geometry.Rectangle"
] | import com.odcgroup.page.ui.figure.scroll.ScrollableWidgetFigure; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; | import com.odcgroup.page.ui.figure.scroll.*; import org.eclipse.draw2d.geometry.*; | [
"com.odcgroup.page",
"org.eclipse.draw2d"
] | com.odcgroup.page; org.eclipse.draw2d; | 1,288,140 |
public Expression locationPathPattern(int opPos)
throws TransformerException
{
opPos = getFirstChildPos(opPos);
return stepPattern(opPos, 0, null);
} | Expression function(int opPos) throws TransformerException { opPos = getFirstChildPos(opPos); return stepPattern(opPos, 0, null); } | /**
* Compile a location match pattern unit expression.
*
* @param opPos The current position in the m_opMap array.
*
* @return reference to {@link com.sun.org.apache.xpath.internal.patterns.StepPattern} instance.
*
* @throws TransformerException if a error occurs creating the Expression.
*/ | Compile a location match pattern unit expression | locationPathPattern | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xpath/internal/compiler/Compiler.java",
"license": "apache-2.0",
"size": 39045
} | [
"com.sun.org.apache.xpath.internal.Expression",
"javax.xml.transform.TransformerException"
] | import com.sun.org.apache.xpath.internal.Expression; import javax.xml.transform.TransformerException; | import com.sun.org.apache.xpath.internal.*; import javax.xml.transform.*; | [
"com.sun.org",
"javax.xml"
] | com.sun.org; javax.xml; | 710,096 |
CompiledComparison[] getExpandedOperandsWithIndexInfoSetIfAny(
ExecutionContext context) throws AmbiguousNameException,
TypeMismatchException, NameResolutionException, FunctionDomainException,
QueryInvocationTargetException {
String pattern = (String) this.bindArg.evaluate(context);
// check if it is filter evaluatable
CompiledComparison[] cvs = getRangeIfSargable(this.var, pattern);
for (CompiledComparison cc : cvs) {
// negation supported only for trailing %
if ((getOperator() == OQLLexerTokenTypes.TOK_NE)
&& (wildcardPosition == patternLength - 1)
&& (wildcardType == WILDCARD_PERCENT)) {
cc.negate();
}
cc.computeDependencies(context);
// Set the indexinfo for the newly created CCs with the indexinfo of this
// CompiledLike object
IndexInfo[] thisIndexInfo = ((IndexInfo[]) context.cacheGet(this));
if (thisIndexInfo != null && thisIndexInfo.length > 0) {
// set the index key in the indexinfo of the CC since the index key
// in the indexinfo of this object might have been modified in the
// checkIfSargableAndRemoveEscapeChars method
IndexInfo indexInfo = new IndexInfo(cc.getKey(context),
thisIndexInfo[0]._path, thisIndexInfo[0]._index,
thisIndexInfo[0]._matchLevel, thisIndexInfo[0].mapping,
cc.getOperator());
context.cachePut(cc, new IndexInfo[] { indexInfo });
}
}
if (IndexManager.testHook != null) {
if (GemFireCacheImpl.getInstance().getLogger().fineEnabled()) {
GemFireCacheImpl.getInstance().getLogger()
.fine("IndexManager TestHook is set in getExpandedOperandsWithIndexInfoSetIfAny.");
}
IndexManager.testHook.hook(12);
}
return cvs;
} | CompiledComparison[] getExpandedOperandsWithIndexInfoSetIfAny( ExecutionContext context) throws AmbiguousNameException, TypeMismatchException, NameResolutionException, FunctionDomainException, QueryInvocationTargetException { String pattern = (String) this.bindArg.evaluate(context); CompiledComparison[] cvs = getRangeIfSargable(this.var, pattern); for (CompiledComparison cc : cvs) { if ((getOperator() == OQLLexerTokenTypes.TOK_NE) && (wildcardPosition == patternLength - 1) && (wildcardType == WILDCARD_PERCENT)) { cc.negate(); } cc.computeDependencies(context); IndexInfo[] thisIndexInfo = ((IndexInfo[]) context.cacheGet(this)); if (thisIndexInfo != null && thisIndexInfo.length > 0) { IndexInfo indexInfo = new IndexInfo(cc.getKey(context), thisIndexInfo[0]._path, thisIndexInfo[0]._index, thisIndexInfo[0]._matchLevel, thisIndexInfo[0].mapping, cc.getOperator()); context.cachePut(cc, new IndexInfo[] { indexInfo }); } } if (IndexManager.testHook != null) { if (GemFireCacheImpl.getInstance().getLogger().fineEnabled()) { GemFireCacheImpl.getInstance().getLogger() .fine(STR); } IndexManager.testHook.hook(12); } return cvs; } | /**
* Expands the CompiledLike operands based on sargability into
* multiple CompiledComparisons
* @param context
* @return The generated CompiledComparisons
* @throws AmbiguousNameException
* @throws TypeMismatchException
* @throws NameResolutionException
* @throws FunctionDomainException
* @throws QueryInvocationTargetException
*/ | Expands the CompiledLike operands based on sargability into multiple CompiledComparisons | getExpandedOperandsWithIndexInfoSetIfAny | {
"repo_name": "fengshao0907/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledLike.java",
"license": "apache-2.0",
"size": 18900
} | [
"com.gemstone.gemfire.cache.query.AmbiguousNameException",
"com.gemstone.gemfire.cache.query.FunctionDomainException",
"com.gemstone.gemfire.cache.query.NameResolutionException",
"com.gemstone.gemfire.cache.query.QueryInvocationTargetException",
"com.gemstone.gemfire.cache.query.TypeMismatchException",
"c... | import com.gemstone.gemfire.cache.query.AmbiguousNameException; import com.gemstone.gemfire.cache.query.FunctionDomainException; import com.gemstone.gemfire.cache.query.NameResolutionException; import com.gemstone.gemfire.cache.query.QueryInvocationTargetException; import com.gemstone.gemfire.cache.query.TypeMismatchException; import com.gemstone.gemfire.cache.query.internal.index.IndexManager; import com.gemstone.gemfire.cache.query.internal.parse.OQLLexerTokenTypes; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; | import com.gemstone.gemfire.cache.query.*; import com.gemstone.gemfire.cache.query.internal.index.*; import com.gemstone.gemfire.cache.query.internal.parse.*; import com.gemstone.gemfire.internal.cache.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 2,679,140 |
public int countOnDisk() {
int size = 0;
Iterator<File> it = iterate();
while (it.hasNext()) {
File f = it.next();
if (f.canRead() && f.isFile() && !f.isHidden()) {
size++;
}
}
return size;
} | int function() { int size = 0; Iterator<File> it = iterate(); while (it.hasNext()) { File f = it.next(); if (f.canRead() && f.isFile() && !f.isHidden()) { size++; } } return size; } | /**
* Returns the number of files which match {@link #scriptFilter} in
* {@link #dir}. Uses {@link #iterate()} internally.
*/ | Returns the number of files which match <code>#scriptFilter</code> in <code>#dir</code>. Uses <code>#iterate()</code> internally | countOnDisk | {
"repo_name": "stelfrich/openmicroscopy",
"path": "components/server/src/ome/services/scripts/ScriptRepoHelper.java",
"license": "gpl-2.0",
"size": 24908
} | [
"java.io.File",
"java.util.Iterator"
] | import java.io.File; import java.util.Iterator; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,487,600 |
Connection borrowConnection(ServerLocation server, long aquireTimeout,boolean onlyUseExistingCnx)
throws AllConnectionsInUseException, NoAvailableServersException; | Connection borrowConnection(ServerLocation server, long aquireTimeout,boolean onlyUseExistingCnx) throws AllConnectionsInUseException, NoAvailableServersException; | /**
* Borrow an existing idle connection or create a new one to a specific server.
*
* @param server The server the connection needs to be to.
* @param aquireTimeout
* The amount of time to wait for a connection to become
* available.
* @return A connection to use.
* @throws AllConnectionsInUseException
* If the maximum number of connections are already in use and
* no connection becomes free within the aquireTimeout.
* @throws NoAvailableServersException
* if we can't connect to any server
*
*/ | Borrow an existing idle connection or create a new one to a specific server | borrowConnection | {
"repo_name": "sshcherbakov/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManager.java",
"license": "apache-2.0",
"size": 4845
} | [
"com.gemstone.gemfire.cache.client.AllConnectionsInUseException",
"com.gemstone.gemfire.cache.client.NoAvailableServersException",
"com.gemstone.gemfire.cache.client.internal.Connection",
"com.gemstone.gemfire.distributed.internal.ServerLocation"
] | import com.gemstone.gemfire.cache.client.AllConnectionsInUseException; import com.gemstone.gemfire.cache.client.NoAvailableServersException; import com.gemstone.gemfire.cache.client.internal.Connection; import com.gemstone.gemfire.distributed.internal.ServerLocation; | import com.gemstone.gemfire.cache.client.*; import com.gemstone.gemfire.cache.client.internal.*; import com.gemstone.gemfire.distributed.internal.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 2,649,483 |
public Double lookupCityRate(Map<String,Double> cityTaxRateMap, String city) {
if (cityTaxRateMap != null && city != null) {
city = city.toUpperCase();
return cityTaxRateMap.get(city);
}
return null;
} | Double function(Map<String,Double> cityTaxRateMap, String city) { if (cityTaxRateMap != null && city != null) { city = city.toUpperCase(); return cityTaxRateMap.get(city); } return null; } | /**
* Changes the city to upper case before checking the
* configuration.
*
* Return null if no match is found.
*
* @param cityTaxRateMap, city
* @return
*/ | Changes the city to upper case before checking the configuration. Return null if no match is found | lookupCityRate | {
"repo_name": "akdasari/SparkCore",
"path": "spark-framework/src/main/java/org/sparkcommerce/core/pricing/service/tax/provider/SimpleTaxProvider.java",
"license": "apache-2.0",
"size": 16101
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,450,030 |
private static boolean codecNeedsEosOutputExceptionWorkaround(String name) {
return Util.SDK_INT == 21 && "OMX.google.aac.decoder".equals(name);
} | static boolean function(String name) { return Util.SDK_INT == 21 && STR.equals(name); } | /**
* Returns whether the decoder may throw an {@link IllegalStateException} from
* {@link MediaCodec#dequeueOutputBuffer(MediaCodec.BufferInfo, long)} or
* {@link MediaCodec#releaseOutputBuffer(int, boolean)} after receiving an input
* buffer with {@link MediaCodec#BUFFER_FLAG_END_OF_STREAM} set.
* <p>
* See [Internal: b/17933838].
*
* @param name The name of the decoder.
* @return True if the decoder may throw an exception after receiving an end-of-stream buffer.
*/ | Returns whether the decoder may throw an <code>IllegalStateException</code> from <code>MediaCodec#dequeueOutputBuffer(MediaCodec.BufferInfo, long)</code> or <code>MediaCodec#releaseOutputBuffer(int, boolean)</code> after receiving an input buffer with <code>MediaCodec#BUFFER_FLAG_END_OF_STREAM</code> set. See [Internal: b/17933838] | codecNeedsEosOutputExceptionWorkaround | {
"repo_name": "stari4ek/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java",
"license": "apache-2.0",
"size": 92573
} | [
"com.google.android.exoplayer2.util.Util"
] | import com.google.android.exoplayer2.util.Util; | import com.google.android.exoplayer2.util.*; | [
"com.google.android"
] | com.google.android; | 1,051,507 |
ServicesPackage sp = new JSONObject().getJavaScriptObject().cast();
sp.setId(id);
sp.setName(name);
sp.setDescription(description);
sp.setObjectType("ServicesPackage");
return sp;
} | ServicesPackage sp = new JSONObject().getJavaScriptObject().cast(); sp.setId(id); sp.setName(name); sp.setDescription(description); sp.setObjectType(STR); return sp; } | /**
* Return new instance of ServicesPackage with basic properties set.
*
* @param id ID of ServicesPackage
* @param name name of ServicesPackage
* @param description description of ServicesPackage
* @return ServicesPackage object
*/ | Return new instance of ServicesPackage with basic properties set | createNew | {
"repo_name": "zlamalp/perun-wui",
"path": "perun-wui-core/src/main/java/cz/metacentrum/perun/wui/model/beans/ServicesPackage.java",
"license": "bsd-2-clause",
"size": 1635
} | [
"com.google.gwt.json.client.JSONObject"
] | import com.google.gwt.json.client.JSONObject; | import com.google.gwt.json.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,540,039 |
public void basicBridgeClientClear(Object callbackArgument, boolean processedMarker) {
checkReadiness();
checkForNoAccess();
RegionEventImpl event = new RegionEventImpl(this, Operation.REGION_LOCAL_CLEAR,
callbackArgument, true, getMyId(), generateEventID());
// If the marker has been processed, process this clear event normally;
// otherwise, this event occurred in the past and has been stored for a
// durable client. In this case, just invoke the clear callbacks.
if (processedMarker) {
basicLocalClear(event);
} else {
if (isInitialized()) {
dispatchListenerEvent(EnumListenerEvent.AFTER_REGION_CLEAR, event);
}
}
} | void function(Object callbackArgument, boolean processedMarker) { checkReadiness(); checkForNoAccess(); RegionEventImpl event = new RegionEventImpl(this, Operation.REGION_LOCAL_CLEAR, callbackArgument, true, getMyId(), generateEventID()); if (processedMarker) { basicLocalClear(event); } else { if (isInitialized()) { dispatchListenerEvent(EnumListenerEvent.AFTER_REGION_CLEAR, event); } } } | /**
* Clear the region from a server request.
*
* @param callbackArgument The callback argument. This is currently null since
* {@link java.util.Map#clear} supports no parameters.
* @param processedMarker Whether the marker has been processed (for durable clients)
*/ | Clear the region from a server request | basicBridgeClientClear | {
"repo_name": "shankarh/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java",
"license": "apache-2.0",
"size": 428183
} | [
"org.apache.geode.cache.Operation"
] | import org.apache.geode.cache.Operation; | import org.apache.geode.cache.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,553,029 |
public void logoutUser(){
// Clearing all user data from Shared Preferences
editor.clear();
editor.commit();
// After logout redirect user to Login Activity
Intent i = new Intent(_context, MainActivity.class);
// Closing all the Activities
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Add new Flag to start new Activity
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Staring Login Activity
_context.startActivity(i);
} | void function(){ editor.clear(); editor.commit(); Intent i = new Intent(_context, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); _context.startActivity(i); } | /**
* Clear session details
* */ | Clear session details | logoutUser | {
"repo_name": "chacaldev/provadevida",
"path": "ProvaDeVidaAndroidApp/app/src/main/java/entidades/UserSessionManager.java",
"license": "apache-2.0",
"size": 3460
} | [
"android.content.Intent",
"br.dataprev.gov.provadevidaandroidapp.MainActivity"
] | import android.content.Intent; import br.dataprev.gov.provadevidaandroidapp.MainActivity; | import android.content.*; import br.dataprev.gov.provadevidaandroidapp.*; | [
"android.content",
"br.dataprev.gov"
] | android.content; br.dataprev.gov; | 1,388,143 |
public static void initEventManager(EventManager eventManager) {
currentEventManager = eventManager;
}
| static void function(EventManager eventManager) { currentEventManager = eventManager; } | /**
* Initialize the current {@link EventManager}.
*
* @param eventManager
*/ | Initialize the current <code>EventManager</code> | initEventManager | {
"repo_name": "sideshowcecil/myx-monitor",
"path": "myx-monitor/src/main/java/at/ac/tuwien/dsg/myx/util/MyxUtils.java",
"license": "mit",
"size": 4478
} | [
"at.ac.tuwien.dsg.myx.monitor.em.EventManager"
] | import at.ac.tuwien.dsg.myx.monitor.em.EventManager; | import at.ac.tuwien.dsg.myx.monitor.em.*; | [
"at.ac.tuwien"
] | at.ac.tuwien; | 1,601,332 |
@Override
public ResourceLocator getResourceLocator() {
return DimensiontypesEditPlugin.INSTANCE;
} | ResourceLocator function() { return DimensiontypesEditPlugin.INSTANCE; } | /**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Return the resource locator for this item provider's resources. | getResourceLocator | {
"repo_name": "KAMP-Research/KAMP",
"path": "bundles/Toometa/de.uka.ipd.sdq.dsexplore.qml.dimensiontypes.edit/src/de/uka/ipd/sdq/dsexplore/qml/dimensiontypes/provider/ElementItemProvider.java",
"license": "apache-2.0",
"size": 4235
} | [
"org.eclipse.emf.common.util.ResourceLocator"
] | import org.eclipse.emf.common.util.ResourceLocator; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 654,699 |
@Override public void exitClassExtraction(@NotNull BindingExpressionParser.ClassExtractionContext ctx) { } | @Override public void exitClassExtraction(@NotNull BindingExpressionParser.ClassExtractionContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterClassExtraction | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/databinding/parser/BindingExpressionBaseListener.java",
"license": "gpl-3.0",
"size": 14237
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 486,105 |
public void add(GradoopId id, PropertyValue... properties) {
add(id);
addPropertyValues(properties);
} | void function(GradoopId id, PropertyValue... properties) { add(id); addPropertyValues(properties); } | /**
* Appends a GradoopId as well as the specified properties to the embedding.
* Both the id and the properties will be added to the end of the corresponding Lists
* @param id that will be added to the embedding
* @param properties list of property values
*/ | Appends a GradoopId as well as the specified properties to the embedding. Both the id and the properties will be added to the end of the corresponding Lists | add | {
"repo_name": "galpha/gradoop",
"path": "gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/matching/single/cypher/pojos/Embedding.java",
"license": "apache-2.0",
"size": 21630
} | [
"org.gradoop.common.model.impl.id.GradoopId",
"org.gradoop.common.model.impl.properties.PropertyValue"
] | import org.gradoop.common.model.impl.id.GradoopId; import org.gradoop.common.model.impl.properties.PropertyValue; | import org.gradoop.common.model.impl.id.*; import org.gradoop.common.model.impl.properties.*; | [
"org.gradoop.common"
] | org.gradoop.common; | 842,015 |
@Test
public void testWrongValues() {
SearchQueryPart sqp = new SearchQueryPart();
sqp.setSearchableField(TestSearchableFieldBuilder.buildWithinRadiusSearchableField());
sqp.setOp(QueryOperatorEnum.IN);
sqp.addValue("a,b");
sqp.addValue("250");
sqp.addParsedValue("a,b", "the_geom", Pair.of("a", "b"));
sqp.addParsedValue("250", "the_geom", 250);
WithinRadiusFieldInterpreter withinRadiusInterpreter = new WithinRadiusFieldInterpreter();
assertFalse(withinRadiusInterpreter.canHandleSearchQueryPart(sqp));
} | void function() { SearchQueryPart sqp = new SearchQueryPart(); sqp.setSearchableField(TestSearchableFieldBuilder.buildWithinRadiusSearchableField()); sqp.setOp(QueryOperatorEnum.IN); sqp.addValue("a,b"); sqp.addValue("250"); sqp.addParsedValue("a,b", STR, Pair.of("a", "b")); sqp.addParsedValue("250", STR, 250); WithinRadiusFieldInterpreter withinRadiusInterpreter = new WithinRadiusFieldInterpreter(); assertFalse(withinRadiusInterpreter.canHandleSearchQueryPart(sqp)); } | /**
* Test that non-number values are flag as "can't be handled"
*/ | Test that non-number values are flag as "can't be handled" | testWrongValues | {
"repo_name": "WingLongitude/liger-data-access",
"path": "src/test/java/net/canadensys/query/interpreter/WithinRadiusFieldInterpreterTest.java",
"license": "mit",
"size": 1824
} | [
"net.canadensys.query.QueryOperatorEnum",
"net.canadensys.query.SearchQueryPart",
"net.canadensys.query.TestSearchableFieldBuilder",
"org.apache.commons.lang3.tuple.Pair",
"org.junit.Assert"
] | import net.canadensys.query.QueryOperatorEnum; import net.canadensys.query.SearchQueryPart; import net.canadensys.query.TestSearchableFieldBuilder; import org.apache.commons.lang3.tuple.Pair; import org.junit.Assert; | import net.canadensys.query.*; import org.apache.commons.lang3.tuple.*; import org.junit.*; | [
"net.canadensys.query",
"org.apache.commons",
"org.junit"
] | net.canadensys.query; org.apache.commons; org.junit; | 2,536,009 |
public void loadAndShow() {
CmsRpcAction<CmsAvailabilityInfoBean> availabilityCallback = new CmsRpcAction<CmsAvailabilityInfoBean>() { | void function() { CmsRpcAction<CmsAvailabilityInfoBean> availabilityCallback = new CmsRpcAction<CmsAvailabilityInfoBean>() { | /**
* Executes the RPC action to retrieve the bean that stores the information for this dialog.<p>
*
* After the information has been retrieved the dialog will be opened.<p>
*/ | Executes the RPC action to retrieve the bean that stores the information for this dialog. After the information has been retrieved the dialog will be opened | loadAndShow | {
"repo_name": "victos/opencms-core",
"path": "src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsAvailabilityDialog.java",
"license": "lgpl-2.1",
"size": 26774
} | [
"org.opencms.gwt.client.rpc.CmsRpcAction",
"org.opencms.gwt.shared.CmsAvailabilityInfoBean"
] | import org.opencms.gwt.client.rpc.CmsRpcAction; import org.opencms.gwt.shared.CmsAvailabilityInfoBean; | import org.opencms.gwt.client.rpc.*; import org.opencms.gwt.shared.*; | [
"org.opencms.gwt"
] | org.opencms.gwt; | 2,085,133 |
public void setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKey(apiKey);
return;
}
}
throw new RuntimeException("No API key authentication configured!");
} | void function(String apiKey) { for (Authentication auth : authentications.values()) { if (auth instanceof ApiKeyAuth) { ((ApiKeyAuth) auth).setApiKey(apiKey); return; } } throw new RuntimeException(STR); } | /**
* Helper method to set API key value for the first API key authentication.
*
* @param apiKey API key
*/ | Helper method to set API key value for the first API key authentication | setApiKey | {
"repo_name": "slonikmak/ariADDna",
"path": "rest-api-client/src/main/java/com/stnetix/ariaddna/client/ApiClient.java",
"license": "apache-2.0",
"size": 45749
} | [
"com.stnetix.ariaddna.client.auth.ApiKeyAuth",
"com.stnetix.ariaddna.client.auth.Authentication"
] | import com.stnetix.ariaddna.client.auth.ApiKeyAuth; import com.stnetix.ariaddna.client.auth.Authentication; | import com.stnetix.ariaddna.client.auth.*; | [
"com.stnetix.ariaddna"
] | com.stnetix.ariaddna; | 2,734,177 |
String[][] data = new String[][] {
{ },
{ "var=value", },
{ "var1=val1", "var2=val2", "var3=val3", },
{ "var1=val1", " ", "var3=val3", },
};
String[] solutions = new String[] {
"",
"?var=value",
"?var1=val1&var2=val2&var3=val3",
"?var1=val1&var3=val3",
};
assertEquals(data.length, solutions.length);
WoWAPI api = new WoWAPI(null, null);
for (int i = 0, len = data.length; i < len; i++) {
String[] queries = data[i];
String solution = solutions[i];
String answer = api.assembleQueryString(queries);
assertEquals(solution, answer);
}
}
| String[][] data = new String[][] { { }, { STR, }, { STR, STR, STR, }, { STR, " ", STR, }, }; String[] solutions = new String[] { STR?var=valueSTR?var1=val1&var2=val2&var3=val3STR?var1=val1&var3=val3", }; assertEquals(data.length, solutions.length); WoWAPI api = new WoWAPI(null, null); for (int i = 0, len = data.length; i < len; i++) { String[] queries = data[i]; String solution = solutions[i]; String answer = api.assembleQueryString(queries); assertEquals(solution, answer); } } | /**
* Tests the assembly of queries into the query string.
*/ | Tests the assembly of queries into the query string | testAssembleQueryString | {
"repo_name": "tectronics/forklabs-bnetconnector",
"path": "src/test/java/ca/forklabs/wow/net/WoWAPITest.java",
"license": "apache-2.0",
"size": 24436
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,543,089 |
Format getFormat(); | Format getFormat(); | /**
* Returns a format whose information should be displayed, or null.
*/ | Returns a format whose information should be displayed, or null | getFormat | {
"repo_name": "Puja-Mishra/Android_FreeChat",
"path": "Telegram-master/TMessagesProj/src/main/java/org/telegram/messenger/exoplayer/util/DebugTextViewHelper.java",
"license": "gpl-2.0",
"size": 3640
} | [
"org.telegram.messenger.exoplayer.chunk.Format"
] | import org.telegram.messenger.exoplayer.chunk.Format; | import org.telegram.messenger.exoplayer.chunk.*; | [
"org.telegram.messenger"
] | org.telegram.messenger; | 2,703,033 |
private SecurityContext authenticate(GridRestRequest req) throws IgniteCheckedException {
assert req.clientId() != null;
AuthenticationContext authCtx = new AuthenticationContext();
authCtx.subjectType(REMOTE_CLIENT);
authCtx.subjectId(req.clientId());
authCtx.nodeAttributes(Collections.<String, Object>emptyMap());
SecurityCredentials cred;
if (req.credentials() instanceof SecurityCredentials)
cred = (SecurityCredentials)req.credentials();
else if (req.credentials() instanceof String) {
String credStr = (String)req.credentials();
int idx = credStr.indexOf(':');
cred = idx >= 0 && idx < credStr.length() ?
new SecurityCredentials(credStr.substring(0, idx), credStr.substring(idx + 1)) :
new SecurityCredentials(credStr, null);
}
else {
cred = new SecurityCredentials();
cred.setUserObject(req.credentials());
}
authCtx.address(req.address());
authCtx.credentials(cred);
SecurityContext subjCtx = ctx.security().authenticate(authCtx);
if (subjCtx == null) {
if (req.credentials() == null)
throw new IgniteCheckedException("Failed to authenticate remote client (secure session SPI not set?): " + req);
else
throw new IgniteCheckedException("Failed to authenticate remote client (invalid credentials?): " + req);
}
return subjCtx;
} | SecurityContext function(GridRestRequest req) throws IgniteCheckedException { assert req.clientId() != null; AuthenticationContext authCtx = new AuthenticationContext(); authCtx.subjectType(REMOTE_CLIENT); authCtx.subjectId(req.clientId()); authCtx.nodeAttributes(Collections.<String, Object>emptyMap()); SecurityCredentials cred; if (req.credentials() instanceof SecurityCredentials) cred = (SecurityCredentials)req.credentials(); else if (req.credentials() instanceof String) { String credStr = (String)req.credentials(); int idx = credStr.indexOf(':'); cred = idx >= 0 && idx < credStr.length() ? new SecurityCredentials(credStr.substring(0, idx), credStr.substring(idx + 1)) : new SecurityCredentials(credStr, null); } else { cred = new SecurityCredentials(); cred.setUserObject(req.credentials()); } authCtx.address(req.address()); authCtx.credentials(cred); SecurityContext subjCtx = ctx.security().authenticate(authCtx); if (subjCtx == null) { if (req.credentials() == null) throw new IgniteCheckedException(STR + req); else throw new IgniteCheckedException(STR + req); } return subjCtx; } | /**
* Authenticates remote client.
*
* @param req Request to authenticate.
* @return Authentication subject context.
* @throws IgniteCheckedException If authentication failed.
*/ | Authenticates remote client | authenticate | {
"repo_name": "agura/incubator-ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java",
"license": "apache-2.0",
"size": 35193
} | [
"java.util.Collections",
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.processors.rest.request.GridRestRequest",
"org.apache.ignite.internal.processors.security.SecurityContext",
"org.apache.ignite.plugin.security.AuthenticationContext",
"org.apache.ignite.plugin.security.Securit... | import java.util.Collections; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.rest.request.GridRestRequest; import org.apache.ignite.internal.processors.security.SecurityContext; import org.apache.ignite.plugin.security.AuthenticationContext; import org.apache.ignite.plugin.security.SecurityCredentials; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.internal.processors.rest.request.*; import org.apache.ignite.internal.processors.security.*; import org.apache.ignite.plugin.security.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 2,707,387 |
public HttpClient createInstance() {
LOGGER.debug("Creating a new instance of DefaultHttpClient with configuration -> {}", toString());
// Create the connection manager which will be default create the necessary schema registry stuff...
final PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager();
connectionManager.setMaxTotal(maxTotalConnections);
connectionManager.setDefaultMaxPerRoute(maxConnectionsPerRoute);
// Set the HTTP connection parameters (These are in the HttpCore JavaDocs, NOT the HttpClient ones)...
final HttpParams params = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(params, connectionTimeout);
HttpConnectionParams.setLinger(params, linger);
HttpConnectionParams.setSocketBufferSize(params, socketBufferSize);
HttpConnectionParams.setSoKeepalive(params, soKeepAlive);
HttpConnectionParams.setSoReuseaddr(params, soReuseAddr);
HttpConnectionParams.setSoTimeout(params, soTimeout);
HttpConnectionParams.setStaleCheckingEnabled(params, staleCheckingEnabled);
HttpConnectionParams.setTcpNoDelay(params, tcpNoDelay);
// Create the HttpClient and configure the compression interceptors if required...
final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, params);
if (useCompression) {
httpClient.addRequestInterceptor(new RequestAcceptEncoding());
httpClient.addResponseInterceptor(new DeflateContentEncoding());
}
return httpClient;
} | HttpClient function() { LOGGER.debug(STR, toString()); final PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(); connectionManager.setMaxTotal(maxTotalConnections); connectionManager.setDefaultMaxPerRoute(maxConnectionsPerRoute); final HttpParams params = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, connectionTimeout); HttpConnectionParams.setLinger(params, linger); HttpConnectionParams.setSocketBufferSize(params, socketBufferSize); HttpConnectionParams.setSoKeepalive(params, soKeepAlive); HttpConnectionParams.setSoReuseaddr(params, soReuseAddr); HttpConnectionParams.setSoTimeout(params, soTimeout); HttpConnectionParams.setStaleCheckingEnabled(params, staleCheckingEnabled); HttpConnectionParams.setTcpNoDelay(params, tcpNoDelay); final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, params); if (useCompression) { httpClient.addRequestInterceptor(new RequestAcceptEncoding()); httpClient.addResponseInterceptor(new DeflateContentEncoding()); } return httpClient; } | /**
* Creates an instance of <tt>DefaultHttpClient</tt> with a <tt>ThreadSafeClientConnManager</tt>.
* @return an implementation of the <tt>HttpClient</tt> interface.
*/ | Creates an instance of DefaultHttpClient with a ThreadSafeClientConnManager | createInstance | {
"repo_name": "hpe-idol/java-aci-api-ng",
"path": "src/main/java/com/autonomy/aci/client/transport/impl/HttpClientFactory.java",
"license": "mit",
"size": 12297
} | [
"org.apache.http.client.HttpClient",
"org.apache.http.client.protocol.RequestAcceptEncoding",
"org.apache.http.impl.client.DefaultHttpClient",
"org.apache.http.impl.conn.PoolingClientConnectionManager",
"org.apache.http.params.BasicHttpParams",
"org.apache.http.params.HttpConnectionParams",
"org.apache.... | import org.apache.http.client.HttpClient; import org.apache.http.client.protocol.RequestAcceptEncoding; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; | import org.apache.http.client.*; import org.apache.http.client.protocol.*; import org.apache.http.impl.client.*; import org.apache.http.impl.conn.*; import org.apache.http.params.*; | [
"org.apache.http"
] | org.apache.http; | 1,865,307 |
private void insertContained(Node tree, Interval itemInterval, Object item)
{
Assert.isTrue(tree.getInterval().contains(itemInterval));
boolean isZeroArea = IntervalSize.isZeroWidth(itemInterval.getMin(), itemInterval.getMax());
NodeBase node;
if (isZeroArea)
node = tree.find(itemInterval);
else
node = tree.getNode(itemInterval);
node.add(item);
}
| void function(Node tree, Interval itemInterval, Object item) { Assert.isTrue(tree.getInterval().contains(itemInterval)); boolean isZeroArea = IntervalSize.isZeroWidth(itemInterval.getMin(), itemInterval.getMax()); NodeBase node; if (isZeroArea) node = tree.find(itemInterval); else node = tree.getNode(itemInterval); node.add(item); } | /**
* insert an item which is known to be contained in the tree rooted at
* the given Node. Lower levels of the tree will be created
* if necessary to hold the item.
*/ | insert an item which is known to be contained in the tree rooted at the given Node. Lower levels of the tree will be created if necessary to hold the item | insertContained | {
"repo_name": "yidongwork/maggie",
"path": "workspace/杨懿帮忙改code/jts-1.8.0/src/com/vividsolutions/jts/index/bintree/Root.java",
"license": "apache-2.0",
"size": 3793
} | [
"com.vividsolutions.jts.index.quadtree.IntervalSize",
"com.vividsolutions.jts.util.Assert"
] | import com.vividsolutions.jts.index.quadtree.IntervalSize; import com.vividsolutions.jts.util.Assert; | import com.vividsolutions.jts.index.quadtree.*; import com.vividsolutions.jts.util.*; | [
"com.vividsolutions.jts"
] | com.vividsolutions.jts; | 2,739,698 |
public void initializeDataSet(@NonNull Context context, UpdateHandler updateHandler, Runnable onSuccess, Runnable onFailure)
{
preCacheDataSet(context,updateHandler,onSuccess,onFailure);
downloadMetaDataFromServer(context,updateHandler,onSuccess,onFailure);
} | void function(@NonNull Context context, UpdateHandler updateHandler, Runnable onSuccess, Runnable onFailure) { preCacheDataSet(context,updateHandler,onSuccess,onFailure); downloadMetaDataFromServer(context,updateHandler,onSuccess,onFailure); } | /**
* initialize the data set from cache on startup of the application
* (not used until keyboard update is implemented)
* @param context the main activity of the application
* @param updateHandler An object that can handle update notification if desired.
* @param onSuccess A callback to be triggered on completion of all queries and operations.
* @param onFailure A callback to be triggered upon failure of a query.
*/ | initialize the data set from cache on startup of the application (not used until keyboard update is implemented) | initializeDataSet | {
"repo_name": "tavultesoft/keymanweb",
"path": "android/KMEA/app/src/main/java/com/tavultesoft/kmea/data/CloudRepository.java",
"license": "apache-2.0",
"size": 16361
} | [
"android.content.Context",
"androidx.annotation.NonNull"
] | import android.content.Context; import androidx.annotation.NonNull; | import android.content.*; import androidx.annotation.*; | [
"android.content",
"androidx.annotation"
] | android.content; androidx.annotation; | 2,006,271 |
return WebDavStore.decodeUri(uri);
} | return WebDavStore.decodeUri(uri); } | /**
* Decodes a WebDavTransport URI.
*
* <p>
* <b>Note:</b> Everything related to sending messages via WebDAV is handled by
* {@link WebDavStore}. So the transport URI is the same as the store URI.
* </p>
*/ | Decodes a WebDavTransport URI. Note: Everything related to sending messages via WebDAV is handled by <code>WebDavStore</code>. So the transport URI is the same as the store URI. | decodeUri | {
"repo_name": "imaeses/k-9",
"path": "src/com/fsck/k9/mail/transport/WebDavTransport.java",
"license": "bsd-3-clause",
"size": 1955
} | [
"com.fsck.k9.mail.store.WebDavStore"
] | import com.fsck.k9.mail.store.WebDavStore; | import com.fsck.k9.mail.store.*; | [
"com.fsck.k9"
] | com.fsck.k9; | 2,857,365 |
public void put(K key, V value)
{
putToMap(key, value, Constants.EXPIRY_NOCHANGE, cacheTimeSpread(), false, false);
} | void function(K key, V value) { putToMap(key, value, Constants.EXPIRY_NOCHANGE, cacheTimeSpread(), false, false); } | /**
* Add an object to the cache under the given key, using the default idle time and default cache time.
* @param key The key
* @param value The value
*/ | Add an object to the cache under the given key, using the default idle time and default cache time | put | {
"repo_name": "trivago/triava",
"path": "src/main/java/com/trivago/triava/tcache/Cache.java",
"license": "apache-2.0",
"size": 54279
} | [
"com.trivago.triava.tcache.expiry.Constants"
] | import com.trivago.triava.tcache.expiry.Constants; | import com.trivago.triava.tcache.expiry.*; | [
"com.trivago.triava"
] | com.trivago.triava; | 1,732,214 |
public boolean getBoolean(final String name, final String category, final boolean defaultValue, final String comment, final String langKey)
{
final Property prop = this.get(category, name, defaultValue);
prop.setLanguageKey(langKey);
prop.comment = comment + " [default: " + defaultValue + "]";
return prop.getBoolean(defaultValue);
} | boolean function(final String name, final String category, final boolean defaultValue, final String comment, final String langKey) { final Property prop = this.get(category, name, defaultValue); prop.setLanguageKey(langKey); prop.comment = comment + STR + defaultValue + "]"; return prop.getBoolean(defaultValue); } | /**
* Creates a boolean property.
*
* @param name Name of the property.
* @param category Category of the property.
* @param defaultValue Default value of the property.
* @param comment A brief description what the property does.
* @param langKey A language key used for localization of GUIs
* @return The value of the new boolean property.
*/ | Creates a boolean property | getBoolean | {
"repo_name": "OreCruncher/Restructured",
"path": "src/main/java/org/blockartistry/mod/Restructured/util/JarConfiguration.java",
"license": "mit",
"size": 61536
} | [
"net.minecraftforge.common.config.Property"
] | import net.minecraftforge.common.config.Property; | import net.minecraftforge.common.config.*; | [
"net.minecraftforge.common"
] | net.minecraftforge.common; | 254,456 |
public List getInsertObjects(int bid) {
int numBrokers = BrokerPrms.getNumBrokers();
if (bid >= numBrokers) {
String s = "Attempt to get insert object with bid=" + bid + " when "
+ BasePrms.nameForKey(BrokerPrms.numBrokers) + "=" + numBrokers;
throw new QueryObjectException(s);
}
List objs = new ArrayList();
Broker obj = new Broker();
obj.init(bid);
objs.add(obj);
objs.add(brokerTicketQueryFactory.getInsertObjects(bid));
return objs;
} | List function(int bid) { int numBrokers = BrokerPrms.getNumBrokers(); if (bid >= numBrokers) { String s = STR + bid + STR + BasePrms.nameForKey(BrokerPrms.numBrokers) + "=" + numBrokers; throw new QueryObjectException(s); } List objs = new ArrayList(); Broker obj = new Broker(); obj.init(bid); objs.add(obj); objs.add(brokerTicketQueryFactory.getInsertObjects(bid)); return objs; } | /**
* Generates the list of insert objects required to create a broker with the
* given broker id.
*
* @param bid the unique broker id
* @throw QueryObjectException if bid exceeds {@link BrokerPrms#numBrokers}.
*/ | Generates the list of insert objects required to create a broker with the given broker id | getInsertObjects | {
"repo_name": "papicella/snappy-store",
"path": "tests/core/src/main/java/objects/query/broker/OQLBrokerQueryFactory.java",
"license": "apache-2.0",
"size": 8781
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,875,064 |
public int compareForCQL(ByteBuffer v1, ByteBuffer v2)
{
return compare(v1, v2);
} | int function(ByteBuffer v1, ByteBuffer v2) { return compare(v1, v2); } | /**
* Same as compare except that this ignore ReversedType. This is to be use when
* comparing 2 values to decide for a CQL condition (see Operator.isSatisfiedBy) as
* for CQL, ReversedType is simply an "hint" to the storage engine but it does not
* change the meaning of queries per-se.
*/ | Same as compare except that this ignore ReversedType. This is to be use when comparing 2 values to decide for a CQL condition (see Operator.isSatisfiedBy) as for CQL, ReversedType is simply an "hint" to the storage engine but it does not change the meaning of queries per-se | compareForCQL | {
"repo_name": "chaordic/cassandra",
"path": "src/java/org/apache/cassandra/db/marshal/AbstractType.java",
"license": "apache-2.0",
"size": 12069
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,488,142 |
private boolean processGetInkey(CommandDetails cmdDet,
List<ComprehensionTlv> ctlvs) throws ResultException {
CatLog.d(this, "process GetInkey");
Input input = new Input();
IconId iconId = null;
ComprehensionTlv ctlv = searchForTag(ComprehensionTlvTag.TEXT_STRING,
ctlvs);
if (ctlv != null) {
input.text = ValueParser.retrieveTextString(ctlv);
} else {
throw new ResultException(ResultCode.REQUIRED_VALUES_MISSING);
}
// parse icon identifier
ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs);
if (ctlv != null) {
iconId = ValueParser.retrieveIconId(ctlv);
}
// parse duration
ctlv = searchForTag(ComprehensionTlvTag.DURATION, ctlvs);
if (ctlv != null) {
input.duration = ValueParser.retrieveDuration(ctlv);
}
input.minLen = 1;
input.maxLen = 1;
input.digitOnly = (cmdDet.commandQualifier & 0x01) == 0;
input.ucs2 = (cmdDet.commandQualifier & 0x02) != 0;
input.yesNo = (cmdDet.commandQualifier & 0x04) != 0;
input.helpAvailable = (cmdDet.commandQualifier & 0x80) != 0;
input.echo = true;
mCmdParams = new GetInputParams(cmdDet, input);
if (iconId != null) {
mIconLoadState = LOAD_SINGLE_ICON;
mIconLoader.loadIcon(iconId.recordNumber, this
.obtainMessage(MSG_ID_LOAD_ICON_DONE));
return true;
}
return false;
} | boolean function(CommandDetails cmdDet, List<ComprehensionTlv> ctlvs) throws ResultException { CatLog.d(this, STR); Input input = new Input(); IconId iconId = null; ComprehensionTlv ctlv = searchForTag(ComprehensionTlvTag.TEXT_STRING, ctlvs); if (ctlv != null) { input.text = ValueParser.retrieveTextString(ctlv); } else { throw new ResultException(ResultCode.REQUIRED_VALUES_MISSING); } ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs); if (ctlv != null) { iconId = ValueParser.retrieveIconId(ctlv); } ctlv = searchForTag(ComprehensionTlvTag.DURATION, ctlvs); if (ctlv != null) { input.duration = ValueParser.retrieveDuration(ctlv); } input.minLen = 1; input.maxLen = 1; input.digitOnly = (cmdDet.commandQualifier & 0x01) == 0; input.ucs2 = (cmdDet.commandQualifier & 0x02) != 0; input.yesNo = (cmdDet.commandQualifier & 0x04) != 0; input.helpAvailable = (cmdDet.commandQualifier & 0x80) != 0; input.echo = true; mCmdParams = new GetInputParams(cmdDet, input); if (iconId != null) { mIconLoadState = LOAD_SINGLE_ICON; mIconLoader.loadIcon(iconId.recordNumber, this .obtainMessage(MSG_ID_LOAD_ICON_DONE)); return true; } return false; } | /**
* Processes GET_INKEY proactive command from the SIM card.
*
* @param cmdDet Command Details container object.
* @param ctlvs List of ComprehensionTlv objects following Command Details
* object and Device Identities object within the proactive command
* @return true if the command is processing is pending and additional
* asynchronous processing is required.
* @throws ResultException
*/ | Processes GET_INKEY proactive command from the SIM card | processGetInkey | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/internal/telephony/cat/CommandParamsFactory.java",
"license": "apache-2.0",
"size": 34331
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,413,601 |
Query query = getSession().getNamedQuery("CustomerDTO.findCustomersByPlan");
query.setParameter("plan_id", planId);
return query.list();
} | Query query = getSession().getNamedQuery(STR); query.setParameter(STR, planId); return query.list(); } | /**
* Fetch a list of all customers that have subscribed to the given plan
* by adding the "plan subscription" item to a recurring order.
*
* @param planId id of plan
* @return list of customers subscribed to the plan, empty if none
*/ | Fetch a list of all customers that have subscribed to the given plan by adding the "plan subscription" item to a recurring order | findCustomersByPlan | {
"repo_name": "liquidJbilling/LT-Jbilling-MsgQ-3.1",
"path": "src/java/com/sapienter/jbilling/server/item/db/PlanDAS.java",
"license": "agpl-3.0",
"size": 3313
} | [
"org.hibernate.Query"
] | import org.hibernate.Query; | import org.hibernate.*; | [
"org.hibernate"
] | org.hibernate; | 1,922,165 |
void writeToXml(ComponentKey componentKey, Component component,
JRXmlWriter reportWriter) throws IOException; | void writeToXml(ComponentKey componentKey, Component component, JRXmlWriter reportWriter) throws IOException; | /**
* Outputs the XML representation of a component.
*
* @param componentKey the component type key
* @param component the component instance
* @param reportWriter the report writer to which output is to be written
* @throws IOException exceptions produced while writing to the
* output stream
* @see ComponentKey#getNamespacePrefix()
* @see JRXmlWriter#getXmlWriteHelper()
*/ | Outputs the XML representation of a component | writeToXml | {
"repo_name": "delafer/j7project",
"path": "jasper352/csb-jasperreport-dep/src/net/sf/jasperreports/engine/component/ComponentXmlWriter.java",
"license": "gpl-2.0",
"size": 2272
} | [
"java.io.IOException",
"net.sf.jasperreports.engine.xml.JRXmlWriter"
] | import java.io.IOException; import net.sf.jasperreports.engine.xml.JRXmlWriter; | import java.io.*; import net.sf.jasperreports.engine.xml.*; | [
"java.io",
"net.sf.jasperreports"
] | java.io; net.sf.jasperreports; | 1,582,928 |
protected void dataReady(FrameHeaderData headerData, PooledByteBuffer frameData) {
if(anyAreSet(state, STATE_STREAM_BROKEN | STATE_CLOSED)) {
frameData.close();
return;
}
synchronized (lock) {
boolean newData = pendingFrameData.isEmpty();
this.pendingFrameData.add(new FrameData(headerData, frameData));
if (newData) {
if (waiters > 0) {
lock.notifyAll();
}
}
waitingForFrame = false;
}
if (anyAreSet(state, STATE_READS_RESUMED)) {
resumeReadsInternal(true);
}
if(headerData != null) {
currentStreamSize += headerData.getFrameLength();
if(maxStreamSize > 0 && currentStreamSize > maxStreamSize) {
handleStreamTooLarge();
}
}
} | void function(FrameHeaderData headerData, PooledByteBuffer frameData) { if(anyAreSet(state, STATE_STREAM_BROKEN STATE_CLOSED)) { frameData.close(); return; } synchronized (lock) { boolean newData = pendingFrameData.isEmpty(); this.pendingFrameData.add(new FrameData(headerData, frameData)); if (newData) { if (waiters > 0) { lock.notifyAll(); } } waitingForFrame = false; } if (anyAreSet(state, STATE_READS_RESUMED)) { resumeReadsInternal(true); } if(headerData != null) { currentStreamSize += headerData.getFrameLength(); if(maxStreamSize > 0 && currentStreamSize > maxStreamSize) { handleStreamTooLarge(); } } } | /**
* Called when data has been read from the underlying channel.
*
* @param headerData The frame header data. This may be null if the data is part of a an existing frame
* @param frameData The frame data
*/ | Called when data has been read from the underlying channel | dataReady | {
"repo_name": "Karm/undertow",
"path": "core/src/main/java/io/undertow/server/protocol/framed/AbstractFramedStreamSourceChannel.java",
"license": "apache-2.0",
"size": 23679
} | [
"io.undertow.connector.PooledByteBuffer"
] | import io.undertow.connector.PooledByteBuffer; | import io.undertow.connector.*; | [
"io.undertow.connector"
] | io.undertow.connector; | 1,506,301 |
public void testAllType() throws Exception {
// isXxx
assertFalse(ALL_TYPE.isArrayType());
assertFalse(ALL_TYPE.isBooleanValueType());
assertFalse(ALL_TYPE.isDateType());
assertFalse(ALL_TYPE.isEnumElementType());
assertFalse(ALL_TYPE.isNamedType());
assertFalse(ALL_TYPE.isNullType());
assertFalse(ALL_TYPE.isNumber());
assertFalse(ALL_TYPE.isNumberObjectType());
assertFalse(ALL_TYPE.isNumberValueType());
assertFalse(ALL_TYPE.isObject());
assertFalse(ALL_TYPE.isFunctionPrototypeType());
assertFalse(ALL_TYPE.isRegexpType());
assertFalse(ALL_TYPE.isString());
assertFalse(ALL_TYPE.isStringObjectType());
assertFalse(ALL_TYPE.isStringValueType());
assertFalse(ALL_TYPE.isEnumType());
assertFalse(ALL_TYPE.isUnionType());
assertFalse(ALL_TYPE.isStruct());
assertFalse(ALL_TYPE.isDict());
assertTrue(ALL_TYPE.isAllType());
assertFalse(ALL_TYPE.isVoidType());
assertFalse(ALL_TYPE.isConstructor());
assertFalse(ALL_TYPE.isInstanceType());
// isSubtype
assertFalse(ALL_TYPE.isSubtype(NO_TYPE));
assertFalse(ALL_TYPE.isSubtype(NO_OBJECT_TYPE));
assertTrue(ALL_TYPE.isSubtype(ALL_TYPE));
assertFalse(ALL_TYPE.isSubtype(STRING_OBJECT_TYPE));
assertFalse(ALL_TYPE.isSubtype(NUMBER_TYPE));
assertFalse(ALL_TYPE.isSubtype(functionType));
assertFalse(ALL_TYPE.isSubtype(recordType));
assertFalse(ALL_TYPE.isSubtype(NULL_TYPE));
assertFalse(ALL_TYPE.isSubtype(OBJECT_TYPE));
assertFalse(ALL_TYPE.isSubtype(DATE_TYPE));
assertTrue(ALL_TYPE.isSubtype(unresolvedNamedType));
assertFalse(ALL_TYPE.isSubtype(namedGoogBar));
assertFalse(ALL_TYPE.isSubtype(REGEXP_TYPE));
assertFalse(ALL_TYPE.isSubtype(VOID_TYPE));
assertTrue(ALL_TYPE.isSubtype(UNKNOWN_TYPE));
// canBeCalled
assertFalse(ALL_TYPE.canBeCalled());
// canTestForEqualityWith
assertCanTestForEqualityWith(ALL_TYPE, ALL_TYPE);
assertCanTestForEqualityWith(ALL_TYPE, STRING_OBJECT_TYPE);
assertCanTestForEqualityWith(ALL_TYPE, NUMBER_TYPE);
assertCanTestForEqualityWith(ALL_TYPE, functionType);
assertCanTestForEqualityWith(ALL_TYPE, recordType);
assertCanTestForEqualityWith(ALL_TYPE, VOID_TYPE);
assertCanTestForEqualityWith(ALL_TYPE, OBJECT_TYPE);
assertCanTestForEqualityWith(ALL_TYPE, DATE_TYPE);
assertCanTestForEqualityWith(ALL_TYPE, REGEXP_TYPE);
// canTestForShallowEqualityWith
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NO_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(DATE_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(ERROR_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(EVAL_ERROR_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(functionType));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(recordType));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NULL_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(URI_ERROR_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(RANGE_ERROR_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(REFERENCE_ERROR_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(STRING_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(SYNTAX_ERROR_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(TYPE_ERROR_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(ALL_TYPE));
assertTrue(ALL_TYPE.canTestForShallowEqualityWith(VOID_TYPE));
// isNullable
assertFalse(ALL_TYPE.isNullable());
assertFalse(ALL_TYPE.isVoidable());
// getLeastSupertype
assertTypeEquals(ALL_TYPE,
ALL_TYPE.getLeastSupertype(ALL_TYPE));
assertTypeEquals(ALL_TYPE,
ALL_TYPE.getLeastSupertype(UNKNOWN_TYPE));
assertTypeEquals(ALL_TYPE,
ALL_TYPE.getLeastSupertype(STRING_OBJECT_TYPE));
assertTypeEquals(ALL_TYPE,
ALL_TYPE.getLeastSupertype(NUMBER_TYPE));
assertTypeEquals(ALL_TYPE,
ALL_TYPE.getLeastSupertype(functionType));
assertTypeEquals(ALL_TYPE,
ALL_TYPE.getLeastSupertype(OBJECT_TYPE));
assertTypeEquals(ALL_TYPE,
ALL_TYPE.getLeastSupertype(DATE_TYPE));
assertTypeEquals(ALL_TYPE,
ALL_TYPE.getLeastSupertype(REGEXP_TYPE));
// matchesXxx
assertFalse(ALL_TYPE.matchesInt32Context());
assertFalse(ALL_TYPE.matchesNumberContext());
assertTrue(ALL_TYPE.matchesObjectContext());
assertTrue(ALL_TYPE.matchesStringContext());
assertFalse(ALL_TYPE.matchesUint32Context());
// toString
assertEquals("*", ALL_TYPE.toString());
assertTrue(ALL_TYPE.hasDisplayName());
assertEquals("<Any Type>", ALL_TYPE.getDisplayName());
Asserts.assertResolvesToSame(ALL_TYPE);
assertFalse(ALL_TYPE.isNominalConstructor());
} | void function() throws Exception { assertFalse(ALL_TYPE.isArrayType()); assertFalse(ALL_TYPE.isBooleanValueType()); assertFalse(ALL_TYPE.isDateType()); assertFalse(ALL_TYPE.isEnumElementType()); assertFalse(ALL_TYPE.isNamedType()); assertFalse(ALL_TYPE.isNullType()); assertFalse(ALL_TYPE.isNumber()); assertFalse(ALL_TYPE.isNumberObjectType()); assertFalse(ALL_TYPE.isNumberValueType()); assertFalse(ALL_TYPE.isObject()); assertFalse(ALL_TYPE.isFunctionPrototypeType()); assertFalse(ALL_TYPE.isRegexpType()); assertFalse(ALL_TYPE.isString()); assertFalse(ALL_TYPE.isStringObjectType()); assertFalse(ALL_TYPE.isStringValueType()); assertFalse(ALL_TYPE.isEnumType()); assertFalse(ALL_TYPE.isUnionType()); assertFalse(ALL_TYPE.isStruct()); assertFalse(ALL_TYPE.isDict()); assertTrue(ALL_TYPE.isAllType()); assertFalse(ALL_TYPE.isVoidType()); assertFalse(ALL_TYPE.isConstructor()); assertFalse(ALL_TYPE.isInstanceType()); assertFalse(ALL_TYPE.isSubtype(NO_TYPE)); assertFalse(ALL_TYPE.isSubtype(NO_OBJECT_TYPE)); assertTrue(ALL_TYPE.isSubtype(ALL_TYPE)); assertFalse(ALL_TYPE.isSubtype(STRING_OBJECT_TYPE)); assertFalse(ALL_TYPE.isSubtype(NUMBER_TYPE)); assertFalse(ALL_TYPE.isSubtype(functionType)); assertFalse(ALL_TYPE.isSubtype(recordType)); assertFalse(ALL_TYPE.isSubtype(NULL_TYPE)); assertFalse(ALL_TYPE.isSubtype(OBJECT_TYPE)); assertFalse(ALL_TYPE.isSubtype(DATE_TYPE)); assertTrue(ALL_TYPE.isSubtype(unresolvedNamedType)); assertFalse(ALL_TYPE.isSubtype(namedGoogBar)); assertFalse(ALL_TYPE.isSubtype(REGEXP_TYPE)); assertFalse(ALL_TYPE.isSubtype(VOID_TYPE)); assertTrue(ALL_TYPE.isSubtype(UNKNOWN_TYPE)); assertFalse(ALL_TYPE.canBeCalled()); assertCanTestForEqualityWith(ALL_TYPE, ALL_TYPE); assertCanTestForEqualityWith(ALL_TYPE, STRING_OBJECT_TYPE); assertCanTestForEqualityWith(ALL_TYPE, NUMBER_TYPE); assertCanTestForEqualityWith(ALL_TYPE, functionType); assertCanTestForEqualityWith(ALL_TYPE, recordType); assertCanTestForEqualityWith(ALL_TYPE, VOID_TYPE); assertCanTestForEqualityWith(ALL_TYPE, OBJECT_TYPE); assertCanTestForEqualityWith(ALL_TYPE, DATE_TYPE); assertCanTestForEqualityWith(ALL_TYPE, REGEXP_TYPE); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NO_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(DATE_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(ERROR_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(EVAL_ERROR_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(functionType)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(recordType)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NULL_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(URI_ERROR_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(RANGE_ERROR_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(REFERENCE_ERROR_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(STRING_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(SYNTAX_ERROR_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(TYPE_ERROR_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(ALL_TYPE)); assertTrue(ALL_TYPE.canTestForShallowEqualityWith(VOID_TYPE)); assertFalse(ALL_TYPE.isNullable()); assertFalse(ALL_TYPE.isVoidable()); assertTypeEquals(ALL_TYPE, ALL_TYPE.getLeastSupertype(ALL_TYPE)); assertTypeEquals(ALL_TYPE, ALL_TYPE.getLeastSupertype(UNKNOWN_TYPE)); assertTypeEquals(ALL_TYPE, ALL_TYPE.getLeastSupertype(STRING_OBJECT_TYPE)); assertTypeEquals(ALL_TYPE, ALL_TYPE.getLeastSupertype(NUMBER_TYPE)); assertTypeEquals(ALL_TYPE, ALL_TYPE.getLeastSupertype(functionType)); assertTypeEquals(ALL_TYPE, ALL_TYPE.getLeastSupertype(OBJECT_TYPE)); assertTypeEquals(ALL_TYPE, ALL_TYPE.getLeastSupertype(DATE_TYPE)); assertTypeEquals(ALL_TYPE, ALL_TYPE.getLeastSupertype(REGEXP_TYPE)); assertFalse(ALL_TYPE.matchesInt32Context()); assertFalse(ALL_TYPE.matchesNumberContext()); assertTrue(ALL_TYPE.matchesObjectContext()); assertTrue(ALL_TYPE.matchesStringContext()); assertFalse(ALL_TYPE.matchesUint32Context()); assertEquals("*", ALL_TYPE.toString()); assertTrue(ALL_TYPE.hasDisplayName()); assertEquals(STR, ALL_TYPE.getDisplayName()); Asserts.assertResolvesToSame(ALL_TYPE); assertFalse(ALL_TYPE.isNominalConstructor()); } | /**
* Tests the behavior of the unknown type.
*/ | Tests the behavior of the unknown type | testAllType | {
"repo_name": "lgeorgieff/closure-compiler",
"path": "test/com/google/javascript/rhino/jstype/JSTypeTest.java",
"license": "apache-2.0",
"size": 273346
} | [
"com.google.javascript.rhino.testing.Asserts"
] | import com.google.javascript.rhino.testing.Asserts; | import com.google.javascript.rhino.testing.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,165,621 |
public synchronized void setThing(Object thing) {
flush();
soft = new SoftReference(thing);
} | synchronized void function(Object thing) { flush(); soft = new SoftReference(thing); } | /**
* Sets the thing to the specified object.
* @param thing the specified object
*/ | Sets the thing to the specified object | setThing | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jdk/src/share/classes/sun/misc/Ref.java",
"license": "gpl-2.0",
"size": 4302
} | [
"java.lang.ref.SoftReference"
] | import java.lang.ref.SoftReference; | import java.lang.ref.*; | [
"java.lang"
] | java.lang; | 2,422,057 |
public void setSource(org.hl7.rim.Role source) {
_source = source;
} | void function(org.hl7.rim.Role source) { _source = source; } | /** Sets the property source.
@see org.hl7.rim.RoleLink#setSource
*/ | Sets the property source | setSource | {
"repo_name": "markusgumbel/dshl7",
"path": "hl7-javasig/gencode/org/hl7/rim/impl/RoleLinkImpl.java",
"license": "apache-2.0",
"size": 3944
} | [
"org.hl7.rim.Role"
] | import org.hl7.rim.Role; | import org.hl7.rim.*; | [
"org.hl7.rim"
] | org.hl7.rim; | 1,687,340 |
protected boolean suppressedwarning(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, String msg, String html) {
if (!thePass) {
errors.add(new ValidationMessage(source, type, -1, -1, path, msg, html, IssueSeverity.INFORMATION));
}
return thePass;
}
| boolean function(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, String msg, String html) { if (!thePass) { errors.add(new ValidationMessage(source, type, -1, -1, path, msg, html, IssueSeverity.INFORMATION)); } return thePass; } | /**
* Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
*
* @param thePass
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/ | Test a rule and add a <code>IssueSeverity#WARNING</code> validation message if the validation fails | suppressedwarning | {
"repo_name": "eug48/hapi-fhir",
"path": "hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/validation/BaseValidator.java",
"license": "apache-2.0",
"size": 20569
} | [
"java.util.List",
"org.hl7.fhir.utilities.validation.ValidationMessage"
] | import java.util.List; import org.hl7.fhir.utilities.validation.ValidationMessage; | import java.util.*; import org.hl7.fhir.utilities.validation.*; | [
"java.util",
"org.hl7.fhir"
] | java.util; org.hl7.fhir; | 2,449,809 |
@ServiceMethod(returns = ReturnType.SINGLE)
SyncPoller<PollResult<VirtualMachineInner>, VirtualMachineInner> beginCreateOrUpdate(
String resourceGroupName, String vmName, VirtualMachineInner parameters); | @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<VirtualMachineInner>, VirtualMachineInner> beginCreateOrUpdate( String resourceGroupName, String vmName, VirtualMachineInner parameters); | /**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/ | The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation | beginCreateOrUpdate | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachinesClient.java",
"license": "mit",
"size": 106942
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.polling.SyncPoller",
"com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.compute.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,054,055 |
public FontPeer
getPeer()
{
if (peer != null)
return(peer);
peer = Toolkit.getDefaultToolkit().getFontPeer(name, style);
return(peer);
} | FontPeer function() { if (peer != null) return(peer); peer = Toolkit.getDefaultToolkit().getFontPeer(name, style); return(peer); } | /**
* Returns a native peer object for this font.
*
* @return A native peer object for this font.
*/ | Returns a native peer object for this font | getPeer | {
"repo_name": "unofficial-opensource-apple/gccfast",
"path": "libjava/java/awt/Font.java",
"license": "gpl-2.0",
"size": 11292
} | [
"java.awt.peer.FontPeer"
] | import java.awt.peer.FontPeer; | import java.awt.peer.*; | [
"java.awt"
] | java.awt; | 1,081,217 |
public static String readString(int hkey, String key, String valueName) throws IllegalAccessException, InvocationTargetException {
if (hkey == HKEY_LOCAL_MACHINE) {
return readString(systemRoot, hkey, key, valueName);
}
else if (hkey == HKEY_CURRENT_USER) {
return readString(userRoot, hkey, key, valueName);
}
else {
throw new IllegalArgumentException("hkey=" + hkey);
}
} | static String function(int hkey, String key, String valueName) throws IllegalAccessException, InvocationTargetException { if (hkey == HKEY_LOCAL_MACHINE) { return readString(systemRoot, hkey, key, valueName); } else if (hkey == HKEY_CURRENT_USER) { return readString(userRoot, hkey, key, valueName); } else { throw new IllegalArgumentException("hkey=" + hkey); } } | /**
* Read a value from key and value name
*
* @param hkey
* HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE
* @param key
* key name
* @param valueName
* value name
* @return the value
* @throws IllegalArgumentException
* if hkey not HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE
* @throws IllegalAccessException
* if Java language access control is enforced and the underlying method is inaccessible
* @throws InvocationTargetException
* if the underlying method throws an exception
*/ | Read a value from key and value name | readString | {
"repo_name": "openflexo-team/openflexo-utils",
"path": "flexo-utils/src/main/java/org/openflexo/toolbox/WinRegistry.java",
"license": "gpl-3.0",
"size": 9250
} | [
"java.lang.reflect.InvocationTargetException"
] | import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,438,518 |
public void assignBuffer(ByteBuffer buffer) {
if (buffer == null) {
if (current == assignedBuffer) {
current = null;
}
assignedBuffer = null;
return;
}
assignedBuffer = buffer;
// Move any overflow to the new buffer
while (!overflows.isEmpty()) {
ByteBuffer head = overflows.peek();
// Do a "flip with position to mark"
int writePos = head.position(); // Save position
head.reset();
head.limit(writePos);
if (!ByteBufferUtils.putAsMuchAsPossible(assignedBuffer, head)) {
// Cannot transfer everything, done what's possible
head.mark(); // new position for next put
head.limit(head.capacity());
head.position(writePos);
return;
}
overflows.remove();
}
current = assignedBuffer;
} | void function(ByteBuffer buffer) { if (buffer == null) { if (current == assignedBuffer) { current = null; } assignedBuffer = null; return; } assignedBuffer = buffer; while (!overflows.isEmpty()) { ByteBuffer head = overflows.peek(); int writePos = head.position(); head.reset(); head.limit(writePos); if (!ByteBufferUtils.putAsMuchAsPossible(assignedBuffer, head)) { head.mark(); head.limit(head.capacity()); head.position(writePos); return; } overflows.remove(); } current = assignedBuffer; } | /**
* Assign a new buffer to this output stream. If the previously used buffer
* had become full and intermediate storage was allocated, the data from the
* intermediate storage is copied to the new buffer first. Then, the new
* buffer is used for all subsequent write operations.
*
* @param buffer
* the buffer to use
*/ | Assign a new buffer to this output stream. If the previously used buffer had become full and intermediate storage was allocated, the data from the intermediate storage is copied to the new buffer first. Then, the new buffer is used for all subsequent write operations | assignBuffer | {
"repo_name": "mnlipp/org.jdrupes.httpcodec",
"path": "src/org/jdrupes/httpcodec/util/ByteBufferOutputStream.java",
"license": "lgpl-3.0",
"size": 7109
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 730,075 |
LOGGER.debug("Start deploying single process.");
// deploy processes as one deployment
DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment();
deploymentBuilder.addClasspathResource(resourceName);
// deploy the processes
Deployment deployment = deploymentBuilder.deploy();
LOGGER.debug("Process deployed");
// retrieve the processDefinitionId for this process
return processEngine.getRepositoryService().createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult().getId();
} | LOGGER.debug(STR); DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment(); deploymentBuilder.addClasspathResource(resourceName); Deployment deployment = deploymentBuilder.deploy(); LOGGER.debug(STR); return processEngine.getRepositoryService().createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult().getId(); } | /**
* Deploys a single process
*
* @return the processDefinitionId of the deployed process as returned by {@link ProcessDefinition#getId()}
*/ | Deploys a single process | deployProcess | {
"repo_name": "stephraleigh/flowable-engine",
"path": "modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/ProcessDeployer.java",
"license": "apache-2.0",
"size": 4778
} | [
"org.flowable.engine.repository.Deployment",
"org.flowable.engine.repository.DeploymentBuilder"
] | import org.flowable.engine.repository.Deployment; import org.flowable.engine.repository.DeploymentBuilder; | import org.flowable.engine.repository.*; | [
"org.flowable.engine"
] | org.flowable.engine; | 119,169 |
private OWLClassExpression parseNonNaryClassExpression() {
String tok = peekToken();
if (matches(NOT, tok)) {
consumeToken();
OWLClassExpression complemented = parseNestedClassExpression(false);
return dataFactory.getOWLObjectComplementOf(complemented);
} else if (isObjectPropertyName(tok) || matches(INVERSE, tok)) {
return parseObjectRestriction();
} else if (isDataPropertyName(tok)) {
// Data restriction
return parseDataRestriction();
} else if (matches(OPENBRACE, tok)) {
return parseObjectOneOf();
} else if (matches(OPEN, tok)) {
return parseNestedClassExpression(false);
} else if (isClassName(tok)) {
consumeToken();
return getOWLClass(tok);
}
// Add option for strict class name checking
else {
consumeToken();
throw new ExceptionBuilder().withClass().withObject().withData()
.withKeyword(OPEN, OPENBRACE, NOT, INVERSE).build();
}
} | OWLClassExpression function() { String tok = peekToken(); if (matches(NOT, tok)) { consumeToken(); OWLClassExpression complemented = parseNestedClassExpression(false); return dataFactory.getOWLObjectComplementOf(complemented); } else if (isObjectPropertyName(tok) matches(INVERSE, tok)) { return parseObjectRestriction(); } else if (isDataPropertyName(tok)) { return parseDataRestriction(); } else if (matches(OPENBRACE, tok)) { return parseObjectOneOf(); } else if (matches(OPEN, tok)) { return parseNestedClassExpression(false); } else if (isClassName(tok)) { consumeToken(); return getOWLClass(tok); } else { consumeToken(); throw new ExceptionBuilder().withClass().withObject().withData() .withKeyword(OPEN, OPENBRACE, NOT, INVERSE).build(); } } | /**
* Parses all class expressions except ObjectIntersectionOf and
* ObjectUnionOf.
*
* @return The class expression which was parsed @ * if a non-nary class
* expression could not be parsed
*/ | Parses all class expressions except ObjectIntersectionOf and ObjectUnionOf | parseNonNaryClassExpression | {
"repo_name": "liveontologies/protege-proof-explanation",
"path": "src/main/java/org/liveontologies/protege/explanation/proof/editing/ManchesterOWLSyntaxParserPatched.java",
"license": "apache-2.0",
"size": 120442
} | [
"org.semanticweb.owlapi.model.OWLClassExpression"
] | import org.semanticweb.owlapi.model.OWLClassExpression; | import org.semanticweb.owlapi.model.*; | [
"org.semanticweb.owlapi"
] | org.semanticweb.owlapi; | 1,576,767 |
@Override public int hashCode() {
if (null != xxHash32) {
return xxHash32.hash(data, 0, data.length, 0);
}
int result = Arrays.hashCode(data);
result = 31 * result;
return result;
} | @Override int function() { if (null != xxHash32) { return xxHash32.hash(data, 0, data.length, 0); } int result = Arrays.hashCode(data); result = 31 * result; return result; } | /**
* This method will calculate the hash code for given data
*
* @return
*/ | This method will calculate the hash code for given data | hashCode | {
"repo_name": "sgururajshetty/carbondata",
"path": "core/src/main/java/org/apache/carbondata/core/cache/dictionary/DictionaryByteArrayWrapper.java",
"license": "apache-2.0",
"size": 2501
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,265,745 |
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
assertEquals(transformer.getParameter(LONG_PARAM_NAME).toString(), PARAM_VALUE);
} | Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE); assertEquals(transformer.getParameter(LONG_PARAM_NAME).toString(), PARAM_VALUE); } | /**
* Obtains transformer's parameter with the same name that set before. Value
* should be same as set one.
* @throws TransformerConfigurationException If for some reason the
* TransformerHandler can not be created.
*/ | Obtains transformer's parameter with the same name that set before. Value should be same as set one | clear01 | {
"repo_name": "lostdj/Jaklin-OpenJDK-JAXP",
"path": "test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java",
"license": "gpl-2.0",
"size": 9504
} | [
"javax.xml.transform.Transformer",
"javax.xml.transform.TransformerFactory",
"org.testng.Assert"
] | import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import org.testng.Assert; | import javax.xml.transform.*; import org.testng.*; | [
"javax.xml",
"org.testng"
] | javax.xml; org.testng; | 2,558,620 |
NanomaterialForm form = new NanomaterialForm();
form.setLocationIds(IDS);
form.setOrganizationIds(IDS);
form.setSpecimenId(1L);
form.setChemicalCompoundId(1L);
form.setContainerId(1L);
form.setPersonId(1L);
CRUDFormTestHelper.setNotes(form);
Nanomaterial entity = form.getSubmittedEntity();
assertNotNull("No submitted Entity", entity);
CRUDFormAssert.assertEntities(Location.class, entity.getSamplingLocationCollection(), IDS);
CRUDFormAssert.assertEntities(Organization.class, entity.getOrganizationCollection(), IDS);
CRUDFormAssert.assertEntity(Person.class, entity.getContactPerson(), 1L);
CRUDFormAssert.assertEntity(Specimen.class, entity.getParentSpecimen(), 1L);
CRUDFormAssert.assertEntity(Container.class, entity.getContainer(), 1L);
CRUDFormAssert.assertEntity(ChemicalCompound.class, entity.getChemicalCompound(), 1L);
CRUDFormTestHelper.assertNotes(entity);
} | NanomaterialForm form = new NanomaterialForm(); form.setLocationIds(IDS); form.setOrganizationIds(IDS); form.setSpecimenId(1L); form.setChemicalCompoundId(1L); form.setContainerId(1L); form.setPersonId(1L); CRUDFormTestHelper.setNotes(form); Nanomaterial entity = form.getSubmittedEntity(); assertNotNull(STR, entity); CRUDFormAssert.assertEntities(Location.class, entity.getSamplingLocationCollection(), IDS); CRUDFormAssert.assertEntities(Organization.class, entity.getOrganizationCollection(), IDS); CRUDFormAssert.assertEntity(Person.class, entity.getContactPerson(), 1L); CRUDFormAssert.assertEntity(Specimen.class, entity.getParentSpecimen(), 1L); CRUDFormAssert.assertEntity(Container.class, entity.getContainer(), 1L); CRUDFormAssert.assertEntity(ChemicalCompound.class, entity.getChemicalCompound(), 1L); CRUDFormTestHelper.assertNotes(entity); } | /**
* Test the controller getSubmittedEntity method.
*/ | Test the controller getSubmittedEntity method | testGetSubmittedEntity | {
"repo_name": "NCIP/calims",
"path": "calims2-webapp/test/unit/java/gov/nih/nci/calims2/ui/inventory/nanomaterial/NanomaterialFormTest.java",
"license": "bsd-3-clause",
"size": 2023
} | [
"gov.nih.nci.calims2.domain.administration.Location",
"gov.nih.nci.calims2.domain.administration.Organization",
"gov.nih.nci.calims2.domain.administration.Person",
"gov.nih.nci.calims2.domain.inventory.ChemicalCompound",
"gov.nih.nci.calims2.domain.inventory.Container",
"gov.nih.nci.calims2.domain.invento... | import gov.nih.nci.calims2.domain.administration.Location; import gov.nih.nci.calims2.domain.administration.Organization; import gov.nih.nci.calims2.domain.administration.Person; import gov.nih.nci.calims2.domain.inventory.ChemicalCompound; import gov.nih.nci.calims2.domain.inventory.Container; import gov.nih.nci.calims2.domain.inventory.Nanomaterial; import gov.nih.nci.calims2.domain.inventory.Specimen; import gov.nih.nci.calims2.ui.generic.crud.CRUDFormAssert; import gov.nih.nci.calims2.ui.generic.crud.CRUDFormTestHelper; import org.junit.Assert; | import gov.nih.nci.calims2.domain.administration.*; import gov.nih.nci.calims2.domain.inventory.*; import gov.nih.nci.calims2.ui.generic.crud.*; import org.junit.*; | [
"gov.nih.nci",
"org.junit"
] | gov.nih.nci; org.junit; | 325,347 |
public synchronized void updateNString(int columnIndex, String x) throws SQLException {
String fieldEncoding = this.fields[columnIndex - 1].getEncoding();
if (fieldEncoding == null || !fieldEncoding.equals("UTF-8")) {
throw new SQLException("Can not call updateNString() when field's character set isn't UTF-8");
}
if (!this.onInsertRow) {
if (!this.doingUpdates) {
this.doingUpdates = true;
syncUpdate();
}
((com.mysql.jdbc.JDBC4PreparedStatement) this.updater).setNString(columnIndex, x);
} else {
((com.mysql.jdbc.JDBC4PreparedStatement) this.inserter).setNString(columnIndex, x);
if (x == null) {
this.thisRow.setColumnValue(columnIndex - 1, null);
} else {
this.thisRow.setColumnValue(columnIndex - 1, StringUtils.getBytes(x, this.charConverter, fieldEncoding, this.connection.getServerCharset(),
this.connection.parserKnowsUnicode(), getExceptionInterceptor()));
}
}
} | synchronized void function(int columnIndex, String x) throws SQLException { String fieldEncoding = this.fields[columnIndex - 1].getEncoding(); if (fieldEncoding == null !fieldEncoding.equals("UTF-8")) { throw new SQLException(STR); } if (!this.onInsertRow) { if (!this.doingUpdates) { this.doingUpdates = true; syncUpdate(); } ((com.mysql.jdbc.JDBC4PreparedStatement) this.updater).setNString(columnIndex, x); } else { ((com.mysql.jdbc.JDBC4PreparedStatement) this.inserter).setNString(columnIndex, x); if (x == null) { this.thisRow.setColumnValue(columnIndex - 1, null); } else { this.thisRow.setColumnValue(columnIndex - 1, StringUtils.getBytes(x, this.charConverter, fieldEncoding, this.connection.getServerCharset(), this.connection.parserKnowsUnicode(), getExceptionInterceptor())); } } } | /**
* JDBC 4.0 Update a column with NATIONAL CHARACTER. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the database.
*
* @param columnIndex
* the first column is 1, the second is 2, ...
* @param x
* the new column value
*
* @exception SQLException
* if a database-access error occurs
*/ | JDBC 4.0 Update a column with NATIONAL CHARACTER. The updateXXX() methods are used to update column values in the current row, or the insert row. The updateXXX() methods do not update the underlying database, instead the updateRow() or insertRow() methods are called to update the database | updateNString | {
"repo_name": "richardgutkowski/ansible-roles",
"path": "stash/files/mysql-connector-java-5.1.35/src/com/mysql/jdbc/JDBC4UpdatableResultSet.java",
"license": "mit",
"size": 21150
} | [
"com.mysql.jdbc.StringUtils",
"java.sql.SQLException"
] | import com.mysql.jdbc.StringUtils; import java.sql.SQLException; | import com.mysql.jdbc.*; import java.sql.*; | [
"com.mysql.jdbc",
"java.sql"
] | com.mysql.jdbc; java.sql; | 2,214,452 |
public void populateCgIcrAccount(A21SubAccount a21SubAccount, String chartOfAccountsCode, String accountNumber);
| void function(A21SubAccount a21SubAccount, String chartOfAccountsCode, String accountNumber); | /**
* populate the a21 sub account with the given account
*
* @param a21SubAccount the a21 sub account needed to be populated
* @param chartOfAccountsCode the given chart of account
* @param accountNumber the given account number
*/ | populate the a21 sub account with the given account | populateCgIcrAccount | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/coa/service/A21SubAccountService.java",
"license": "agpl-3.0",
"size": 2444
} | [
"org.kuali.kfs.coa.businessobject.A21SubAccount"
] | import org.kuali.kfs.coa.businessobject.A21SubAccount; | import org.kuali.kfs.coa.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,458,293 |
private static Response createResponse(Object object, AlluxioConfiguration alluxioConf,
@Nullable Map<String, Object> headers) {
if (object instanceof Void) {
return Response.ok().build();
}
if (object instanceof String) {
// Need to explicitly encode the string as JSON because Jackson will not do it automatically.
ObjectMapper mapper = new ObjectMapper();
try {
return Response.ok(mapper.writeValueAsString(object)).build();
} catch (JsonProcessingException e) {
return createErrorResponse(e, alluxioConf);
}
}
Response.ResponseBuilder rb = Response.ok(object);
if (headers != null) {
headers.forEach(rb::header);
}
if (alluxioConf.getBoolean(PropertyKey.WEB_CORS_ENABLED)) {
return makeCORS(rb).build();
}
return rb.build();
}
public static class ErrorResponse {
private final Status.Code mStatusCode;
private final String mMessage;
public ErrorResponse(Status.Code statusCode, String message) {
mStatusCode = statusCode;
mMessage = message;
} | static Response function(Object object, AlluxioConfiguration alluxioConf, @Nullable Map<String, Object> headers) { if (object instanceof Void) { return Response.ok().build(); } if (object instanceof String) { ObjectMapper mapper = new ObjectMapper(); try { return Response.ok(mapper.writeValueAsString(object)).build(); } catch (JsonProcessingException e) { return createErrorResponse(e, alluxioConf); } } Response.ResponseBuilder rb = Response.ok(object); if (headers != null) { headers.forEach(rb::header); } if (alluxioConf.getBoolean(PropertyKey.WEB_CORS_ENABLED)) { return makeCORS(rb).build(); } return rb.build(); } public static class ErrorResponse { private final Status.Code mStatusCode; private final String mMessage; public ErrorResponse(Status.Code statusCode, String message) { mStatusCode = statusCode; mMessage = message; } | /**
* Creates a response using the given object.
*
* @param object the object to respond with
* @return the response
*/ | Creates a response using the given object | createResponse | {
"repo_name": "EvilMcJerkface/alluxio",
"path": "core/server/common/src/main/java/alluxio/RestUtils.java",
"license": "apache-2.0",
"size": 6713
} | [
"com.fasterxml.jackson.core.JsonProcessingException",
"com.fasterxml.jackson.databind.ObjectMapper",
"io.grpc.Status",
"java.util.Map",
"javax.annotation.Nullable",
"javax.ws.rs.core.Response"
] | import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import io.grpc.Status; import java.util.Map; import javax.annotation.Nullable; import javax.ws.rs.core.Response; | import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import io.grpc.*; import java.util.*; import javax.annotation.*; import javax.ws.rs.core.*; | [
"com.fasterxml.jackson",
"io.grpc",
"java.util",
"javax.annotation",
"javax.ws"
] | com.fasterxml.jackson; io.grpc; java.util; javax.annotation; javax.ws; | 356,850 |
EAttribute getMoDiscoDataItem_Name(); | EAttribute getMoDiscoDataItem_Name(); | /**
* Returns the meta object for the attribute '{@link de.hub.visualemf.modiscodata.MoDiscoDataItem#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Name</em>'.
* @see de.hub.visualemf.modiscodata.MoDiscoDataItem#getName()
* @see #getMoDiscoDataItem()
* @generated
*/ | Returns the meta object for the attribute '<code>de.hub.visualemf.modiscodata.MoDiscoDataItem#getName Name</code>'. | getMoDiscoDataItem_Name | {
"repo_name": "markus1978/visualemf",
"path": "plugins/de.hub.visualemf.modisco/emf-gen/de/hub/visualemf/modiscodata/ModiscoDataPackage.java",
"license": "apache-2.0",
"size": 30531
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 211,671 |
void closeRegionOperation() throws IOException;
/**
* Closes the region operation lock. This needs to be called in the finally block corresponding
* to the try block of {@link #startRegionOperation(Operation)} | void closeRegionOperation() throws IOException; /** * Closes the region operation lock. This needs to be called in the finally block corresponding * to the try block of {@link #startRegionOperation(Operation)} | /**
* Closes the region operation lock.
* @throws IOException
*/ | Closes the region operation lock | closeRegionOperation | {
"repo_name": "francisliu/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java",
"license": "apache-2.0",
"size": 23185
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 725,034 |
private void readOutputFiles(StringTokenizer line){
String new_line = line.nextToken(); //We read the input data line
StringTokenizer data = new StringTokenizer(new_line, " = \" ");
data.nextToken(); //inputFile
outputTrFile = data.nextToken();
outputTstFile = data.nextToken();
while(data.hasMoreTokens()){
outputFiles.add(data.nextToken());
}
}
| void function(StringTokenizer line){ String new_line = line.nextToken(); StringTokenizer data = new StringTokenizer(new_line, STR "); data.nextToken(); outputTrFile = data.nextToken(); outputTstFile = data.nextToken(); while(data.hasMoreTokens()){ outputFiles.add(data.nextToken()); } } | /**
* We read the output files for training and test and all the possible remaining output files
* @param line StringTokenizer It is the line containing the output files.
*/ | We read the output files for training and test and all the possible remaining output files | readOutputFiles | {
"repo_name": "TheMurderer/keel",
"path": "src/keel/Algorithms/RE_SL_Postprocess/Post_G_T_LatAmp_FRBSs/parseParameters.java",
"license": "gpl-3.0",
"size": 7092
} | [
"java.util.StringTokenizer"
] | import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 618,345 |
private void transferFile(final String source, final String target, final Map<String, Object> headers) {
final Map<String, String> inputParamsMap = new HashMap<>();
inputParamsMap.put(Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_PARAMETER_TARGETABSOLUTPATH, target);
inputParamsMap.put(Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_PARAMETER_SOURCEURLORLOCALPATH, source);
LOG.debug("Uploading file. Source: {} Target: {} ", source, target);
headers.put(MBHeader.OPERATIONNAME_STRING.toString(), Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_TRANSFERFILE);
LOG.debug("Invoking ManagementBus for transferFile with the following headers:");
for (final String key : headers.keySet()) {
if (headers.get(key) != null && headers.get(key) instanceof String) {
LOG.debug("Header: " + key + " Value: " + headers.get(key));
}
}
invokeManagementBusEngine(inputParamsMap, headers);
} | void function(final String source, final String target, final Map<String, Object> headers) { final Map<String, String> inputParamsMap = new HashMap<>(); inputParamsMap.put(Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_PARAMETER_TARGETABSOLUTPATH, target); inputParamsMap.put(Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_PARAMETER_SOURCEURLORLOCALPATH, source); LOG.debug(STR, source, target); headers.put(MBHeader.OPERATIONNAME_STRING.toString(), Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_TRANSFERFILE); LOG.debug(STR); for (final String key : headers.keySet()) { if (headers.get(key) != null && headers.get(key) instanceof String) { LOG.debug(STR + key + STR + headers.get(key)); } } invokeManagementBusEngine(inputParamsMap, headers); } | /**
* For transferring files to the target machine.
*/ | For transferring files to the target machine | transferFile | {
"repo_name": "OpenTOSCA/container",
"path": "org.opentosca.bus/org.opentosca.bus.management.invocation.plugin.script/src/main/java/org/opentosca/bus/management/invocation/plugin/script/ManagementBusInvocationPluginScript.java",
"license": "apache-2.0",
"size": 30464
} | [
"java.util.HashMap",
"java.util.Map",
"org.opentosca.bus.management.header.MBHeader",
"org.opentosca.container.core.convention.Interfaces"
] | import java.util.HashMap; import java.util.Map; import org.opentosca.bus.management.header.MBHeader; import org.opentosca.container.core.convention.Interfaces; | import java.util.*; import org.opentosca.bus.management.header.*; import org.opentosca.container.core.convention.*; | [
"java.util",
"org.opentosca.bus",
"org.opentosca.container"
] | java.util; org.opentosca.bus; org.opentosca.container; | 2,247,849 |
protected final void scanElementDecl() throws IOException, XNIException {
// spaces
fReportEntity = false;
if (!skipSeparator(true, !scanningInternalSubset())) {
reportFatalError("MSG_SPACE_REQUIRED_BEFORE_ELEMENT_TYPE_IN_ELEMENTDECL",
null);
}
// element name
String name = fEntityScanner.scanName();
if (name == null) {
reportFatalError("MSG_ELEMENT_TYPE_REQUIRED_IN_ELEMENTDECL",
null);
}
// spaces
if (!skipSeparator(true, !scanningInternalSubset())) {
reportFatalError("MSG_SPACE_REQUIRED_BEFORE_CONTENTSPEC_IN_ELEMENTDECL",
new Object[]{name});
}
// content model
if (fDTDContentModelHandler != null) {
fDTDContentModelHandler.startContentModel(name, null);
}
String contentModel = null;
fReportEntity = true;
if (fEntityScanner.skipString("EMPTY")) {
contentModel = "EMPTY";
// call handler
if (fDTDContentModelHandler != null) {
fDTDContentModelHandler.empty(null);
}
}
else if (fEntityScanner.skipString("ANY")) {
contentModel = "ANY";
// call handler
if (fDTDContentModelHandler != null) {
fDTDContentModelHandler.any(null);
}
}
else {
if (!fEntityScanner.skipChar('(')) {
reportFatalError("MSG_OPEN_PAREN_OR_ELEMENT_TYPE_REQUIRED_IN_CHILDREN",
new Object[]{name});
}
if (fDTDContentModelHandler != null) {
fDTDContentModelHandler.startGroup(null);
}
fStringBuffer.clear();
fStringBuffer.append('(');
fMarkUpDepth++;
skipSeparator(false, !scanningInternalSubset());
// Mixed content model
if (fEntityScanner.skipString("#PCDATA")) {
scanMixed(name);
}
else { // children content
scanChildren(name);
}
contentModel = fStringBuffer.toString();
}
// call handler
if (fDTDContentModelHandler != null) {
fDTDContentModelHandler.endContentModel(null);
}
fReportEntity = false;
skipSeparator(false, !scanningInternalSubset());
// end
if (!fEntityScanner.skipChar('>')) {
reportFatalError("ElementDeclUnterminated", new Object[]{name});
}
fReportEntity = true;
fMarkUpDepth--;
// call handler
if (fDTDHandler != null) {
fDTDHandler.elementDecl(name, contentModel, null);
}
} // scanElementDecl()
| final void function() throws IOException, XNIException { fReportEntity = false; if (!skipSeparator(true, !scanningInternalSubset())) { reportFatalError(STR, null); } String name = fEntityScanner.scanName(); if (name == null) { reportFatalError(STR, null); } if (!skipSeparator(true, !scanningInternalSubset())) { reportFatalError(STR, new Object[]{name}); } if (fDTDContentModelHandler != null) { fDTDContentModelHandler.startContentModel(name, null); } String contentModel = null; fReportEntity = true; if (fEntityScanner.skipString("EMPTY")) { contentModel = "EMPTY"; if (fDTDContentModelHandler != null) { fDTDContentModelHandler.empty(null); } } else if (fEntityScanner.skipString("ANY")) { contentModel = "ANY"; if (fDTDContentModelHandler != null) { fDTDContentModelHandler.any(null); } } else { if (!fEntityScanner.skipChar('(')) { reportFatalError(STR, new Object[]{name}); } if (fDTDContentModelHandler != null) { fDTDContentModelHandler.startGroup(null); } fStringBuffer.clear(); fStringBuffer.append('('); fMarkUpDepth++; skipSeparator(false, !scanningInternalSubset()); if (fEntityScanner.skipString(STR)) { scanMixed(name); } else { scanChildren(name); } contentModel = fStringBuffer.toString(); } if (fDTDContentModelHandler != null) { fDTDContentModelHandler.endContentModel(null); } fReportEntity = false; skipSeparator(false, !scanningInternalSubset()); if (!fEntityScanner.skipChar('>')) { reportFatalError(STR, new Object[]{name}); } fReportEntity = true; fMarkUpDepth--; if (fDTDHandler != null) { fDTDHandler.elementDecl(name, contentModel, null); } } | /**
* Scans an element declaration
* <p>
* <pre>
* [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'
* [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children
* </pre>
* <p>
* <strong>Note:</strong> Called after scanning past '<!ELEMENT'
*/ | Scans an element declaration <code> [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>' [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children </code> Note: Called after scanning past '<!ELEMENT' | scanElementDecl | {
"repo_name": "machine16/xerces-for-android",
"path": "src/mf/org/apache/xerces/impl/XMLDTDScannerImpl.java",
"license": "apache-2.0",
"size": 81473
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,558,928 |
public static EnumSet<GVRImportSettings> getRecommendedBumpmapSettings() {
EnumSet<GVRImportSettings> bumpmapSettings = EnumSet.of(CALCULATE_SMOOTH_NORMALS, CALCULATE_TANGENTS);
return bumpmapSettings;
} | static EnumSet<GVRImportSettings> function() { EnumSet<GVRImportSettings> bumpmapSettings = EnumSet.of(CALCULATE_SMOOTH_NORMALS, CALCULATE_TANGENTS); return bumpmapSettings; } | /**
* Get Recommended settings for simple bumpmap meshes.
* @return EnumSet recommended for bumpmapped meshes.
*/ | Get Recommended settings for simple bumpmap meshes | getRecommendedBumpmapSettings | {
"repo_name": "roshanch/GearVRf",
"path": "GVRf/Framework/framework/src/main/java/org/gearvrf/GVRImportSettings.java",
"license": "apache-2.0",
"size": 5862
} | [
"java.util.EnumSet"
] | import java.util.EnumSet; | import java.util.*; | [
"java.util"
] | java.util; | 398,618 |
Manifest getManifest() throws IOException; | Manifest getManifest() throws IOException; | /**
* Returns the manifest of the archive.
* @return the manifest
* @throws IOException if the manifest cannot be read
*/ | Returns the manifest of the archive | getManifest | {
"repo_name": "joansmith/spring-boot",
"path": "spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/Archive.java",
"license": "apache-2.0",
"size": 2306
} | [
"java.io.IOException",
"java.util.jar.Manifest"
] | import java.io.IOException; import java.util.jar.Manifest; | import java.io.*; import java.util.jar.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,274,060 |
@SuppressWarnings("unchecked")
void offset(int modelOffset, int atomOffset) {
if (modelOffset > 0) {
if (modelIndex != Integer.MIN_VALUE)
modelIndex += modelOffset;
switch (id) {
case T.display:
case T.hide:
return;
case T.frame:
int i = ((Integer) info).intValue();
if (i >= 0)
info = Integer.valueOf(modelOffset + i);
return;
case T.movie:
Map<String, Object> movie = (Map<String, Object>) info;
// switch now to simple array
int[] frames = (int[]) movie.get("frames");
for (int j = frames.length; --j >= 0;)
frames[j] += modelOffset;
return;
}
}
if (atomOffset <= 0)
return;
if (id == T.define) {
Collection<Object> map = ((Map<String, Object>) info).values();
for (Object o : map)
BSUtil.offset((BS) o, 0, atomOffset);
return;
}
if (bsAtoms != null)
BSUtil.offset(bsAtoms, 0, atomOffset);
if (colors != null) {
short[] colixes = (short[]) colors[0];
short[] c = new short[colixes.length + atomOffset];
System.arraycopy(colixes, 0, c, atomOffset, colixes.length);
colors[0] = c;
}
} | @SuppressWarnings(STR) void offset(int modelOffset, int atomOffset) { if (modelOffset > 0) { if (modelIndex != Integer.MIN_VALUE) modelIndex += modelOffset; switch (id) { case T.display: case T.hide: return; case T.frame: int i = ((Integer) info).intValue(); if (i >= 0) info = Integer.valueOf(modelOffset + i); return; case T.movie: Map<String, Object> movie = (Map<String, Object>) info; int[] frames = (int[]) movie.get(STR); for (int j = frames.length; --j >= 0;) frames[j] += modelOffset; return; } } if (atomOffset <= 0) return; if (id == T.define) { Collection<Object> map = ((Map<String, Object>) info).values(); for (Object o : map) BSUtil.offset((BS) o, 0, atomOffset); return; } if (bsAtoms != null) BSUtil.offset(bsAtoms, 0, atomOffset); if (colors != null) { short[] colixes = (short[]) colors[0]; short[] c = new short[colixes.length + atomOffset]; System.arraycopy(colixes, 0, c, atomOffset, colixes.length); colors[0] = c; } } | /**
* offset is carried out in ModelLoader when the "script" is processed to move
* the bits to skip the base atom index.
*
* @param modelOffset
* @param atomOffset
*/ | offset is carried out in ModelLoader when the "script" is processed to move the bits to skip the base atom index | offset | {
"repo_name": "drdrsh/JmolOVR",
"path": "src/org/jmol/adapter/readers/pymol/JmolObject.java",
"license": "lgpl-2.1",
"size": 13242
} | [
"java.util.Collection",
"java.util.Map",
"org.jmol.util.BSUtil"
] | import java.util.Collection; import java.util.Map; import org.jmol.util.BSUtil; | import java.util.*; import org.jmol.util.*; | [
"java.util",
"org.jmol.util"
] | java.util; org.jmol.util; | 2,499,238 |
private ConsistentHashRing getHashResolver(final Set<String> namespaces) {
int hash = namespaces.hashCode();
ConsistentHashRing resolver = this.hashResolverMap.get(hash);
if (resolver == null) {
resolver = new ConsistentHashRing(namespaces);
this.hashResolverMap.put(hash, resolver);
}
return resolver;
} | ConsistentHashRing function(final Set<String> namespaces) { int hash = namespaces.hashCode(); ConsistentHashRing resolver = this.hashResolverMap.get(hash); if (resolver == null) { resolver = new ConsistentHashRing(namespaces); this.hashResolverMap.put(hash, resolver); } return resolver; } | /**
* Get the cached (if available) or generate a new hash resolver for this
* particular set of unique namespace identifiers.
*
* @param namespaces A set of unique namespace identifiers.
* @return A hash resolver configured to consistently resolve paths to
* namespaces using the provided set of namespace identifiers.
*/ | Get the cached (if available) or generate a new hash resolver for this particular set of unique namespace identifiers | getHashResolver | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/HashResolver.java",
"license": "apache-2.0",
"size": 4925
} | [
"java.util.Set",
"org.apache.hadoop.hdfs.server.federation.utils.ConsistentHashRing"
] | import java.util.Set; import org.apache.hadoop.hdfs.server.federation.utils.ConsistentHashRing; | import java.util.*; import org.apache.hadoop.hdfs.server.federation.utils.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,109,779 |
public String getBizContent() {
return this.bizContent;
}
private String terminalType;
private String terminalInfo;
private String prodCode;
private String notifyUrl;
private String returnUrl;
private boolean needEncrypt=false;
private AlipayObject bizModel=null; | String function() { return this.bizContent; } private String terminalType; private String terminalInfo; private String prodCode; private String notifyUrl; private String returnUrl; private boolean needEncrypt=false; private AlipayObject bizModel=null; | /**
* <p>Getter for the field <code>bizContent</code>.</p>
*
* @return a {@link java.lang.String} object.
*/ | Getter for the field <code>bizContent</code> | getBizContent | {
"repo_name": "NotFound403/WePay",
"path": "src/main/java/cn/felord/wepay/ali/sdk/api/request/AlipayMarketingCardTemplateCreateRequest.java",
"license": "apache-2.0",
"size": 4819
} | [
"cn.felord.wepay.ali.sdk.api.AlipayObject"
] | import cn.felord.wepay.ali.sdk.api.AlipayObject; | import cn.felord.wepay.ali.sdk.api.*; | [
"cn.felord.wepay"
] | cn.felord.wepay; | 1,747,075 |
Collection<StepExecution> getStepExecutions(Long jobExecutionId) throws NoSuchJobExecutionException;
/**
* List the {@link StepExecution step executions} for a step in descending order of
* creation (usually close to execution order).
* @param jobName the name of the job associated with the step (or a pattern with
* wildcards)
* @param stepName the step name (or a pattern with wildcards)
* @param start the start index of the first execution
* @param count the maximum number of executions to return
*
* @return a collection of {@link StepExecution} | Collection<StepExecution> getStepExecutions(Long jobExecutionId) throws NoSuchJobExecutionException; /** * List the {@link StepExecution step executions} for a step in descending order of * creation (usually close to execution order). * @param jobName the name of the job associated with the step (or a pattern with * wildcards) * @param stepName the step name (or a pattern with wildcards) * @param start the start index of the first execution * @param count the maximum number of executions to return * * @return a collection of {@link StepExecution} | /**
* Get the {@link StepExecution step executions} for a given job execution (by id).
*
* @param jobExecutionId the parent job execution id
* @return the step executions for the job execution
*
* @throws NoSuchJobExecutionException thrown if job execution specified does not exist
*/ | Get the <code>StepExecution step executions</code> for a given job execution (by id) | getStepExecutions | {
"repo_name": "ghillert/spring-cloud-dataflow",
"path": "spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/batch/JobService.java",
"license": "apache-2.0",
"size": 14921
} | [
"java.util.Collection",
"org.springframework.batch.core.StepExecution",
"org.springframework.batch.core.launch.NoSuchJobExecutionException"
] | import java.util.Collection; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.launch.NoSuchJobExecutionException; | import java.util.*; import org.springframework.batch.core.*; import org.springframework.batch.core.launch.*; | [
"java.util",
"org.springframework.batch"
] | java.util; org.springframework.batch; | 1,036,304 |
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String toLowerCase(final Object self) {
return checkObjectToString(self).toLowerCase(Locale.ROOT);
} | @Function(attributes = Attribute.NOT_ENUMERABLE) static String function(final Object self) { return checkObjectToString(self).toLowerCase(Locale.ROOT); } | /**
* ECMA 15.5.4.16 String.prototype.toLowerCase ( )
* @param self self reference
* @return string to lower case
*/ | ECMA 15.5.4.16 String.prototype.toLowerCase ( ) | toLowerCase | {
"repo_name": "lizhekang/TCJDK",
"path": "sources/openjdk8/nashorn/src/jdk/nashorn/internal/objects/NativeString.java",
"license": "gpl-2.0",
"size": 48360
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,243,854 |
public Properties getProperties() {
return createProperties(null);
} | Properties function() { return createProperties(null); } | /**
* Gets properties.
*
* @return the properties
*/ | Gets properties | getProperties | {
"repo_name": "bamh/hpe-application-automation-tools-plugin",
"path": "src/main/java/com/hpe/application/automation/tools/model/RunFromFileSystemModel.java",
"license": "mit",
"size": 19633
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 181,015 |
public Pair<EventStream, StatementAgentInstanceLock> createStream(final String statementId, final FilterSpecCompiled filterSpec, FilterService filterService,
EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
boolean isJoin,
final boolean isSubSelect,
final ExprEvaluatorContext exprEvaluatorContext,
boolean isNamedWindowTrigger,
boolean filterWithSameTypeSubselect,
Annotation[] annotations,
boolean stateless
)
{
if (log.isDebugEnabled())
{
log.debug(".createStream hashCode=" + filterSpec.hashCode() + " filter=" + filterSpec);
}
// Check if a stream for this filter already exists
Pair<EventStream, EPStatementHandleCallback> pair;
boolean forceNewStream = isJoin || (!isReuseViews) || isSubSelect || isNamedWindowTrigger || filterWithSameTypeSubselect || stateless;
if (forceNewStream)
{
pair = eventStreamsIdentity.get(filterSpec);
}
else
{
pair = eventStreamsRefCounted.get(filterSpec);
}
// If pair exists, either reference count or illegal state
if (pair != null)
{
if (forceNewStream)
{
throw new IllegalStateException("Filter spec object already found in collection");
}
else
{
log.debug(".createStream filter already found");
eventStreamsRefCounted.reference(filterSpec);
// audit proxy
EventStream eventStream = EventStreamProxy.getAuditProxy(engineURI, epStatementAgentInstanceHandle.getStatementHandle().getStatementName(), annotations, filterSpec, pair.getFirst());
// We return the lock of the statement first establishing the stream to use that as the new statement's lock
return new Pair<EventStream, StatementAgentInstanceLock>(eventStream, pair.getSecond().getAgentInstanceHandle().getStatementAgentInstanceLock());
}
}
// New event stream
EventType resultEventType = filterSpec.getResultEventType();
EventStream zeroDepthStream = new ZeroDepthStream(resultEventType);
// audit proxy
EventStream inputStream = EventStreamProxy.getAuditProxy(engineURI, epStatementAgentInstanceHandle.getStatementHandle().getStatementName(), annotations, filterSpec, zeroDepthStream);
| Pair<EventStream, StatementAgentInstanceLock> function(final String statementId, final FilterSpecCompiled filterSpec, FilterService filterService, EPStatementAgentInstanceHandle epStatementAgentInstanceHandle, boolean isJoin, final boolean isSubSelect, final ExprEvaluatorContext exprEvaluatorContext, boolean isNamedWindowTrigger, boolean filterWithSameTypeSubselect, Annotation[] annotations, boolean stateless ) { if (log.isDebugEnabled()) { log.debug(STR + filterSpec.hashCode() + STR + filterSpec); } Pair<EventStream, EPStatementHandleCallback> pair; boolean forceNewStream = isJoin (!isReuseViews) isSubSelect isNamedWindowTrigger filterWithSameTypeSubselect stateless; if (forceNewStream) { pair = eventStreamsIdentity.get(filterSpec); } else { pair = eventStreamsRefCounted.get(filterSpec); } if (pair != null) { if (forceNewStream) { throw new IllegalStateException(STR); } else { log.debug(STR); eventStreamsRefCounted.reference(filterSpec); EventStream eventStream = EventStreamProxy.getAuditProxy(engineURI, epStatementAgentInstanceHandle.getStatementHandle().getStatementName(), annotations, filterSpec, pair.getFirst()); return new Pair<EventStream, StatementAgentInstanceLock>(eventStream, pair.getSecond().getAgentInstanceHandle().getStatementAgentInstanceLock()); } } EventType resultEventType = filterSpec.getResultEventType(); EventStream zeroDepthStream = new ZeroDepthStream(resultEventType); EventStream inputStream = EventStreamProxy.getAuditProxy(engineURI, epStatementAgentInstanceHandle.getStatementHandle().getStatementName(), annotations, filterSpec, zeroDepthStream); | /**
* See the method of the same name in {@link com.espertech.esper.view.stream.StreamFactoryService}. Always attempts to reuse an existing event stream.
* May thus return a new event stream or an existing event stream depending on whether filter criteria match.
*
* @param filterSpec is the filter definition
* @param epStatementAgentInstanceHandle is the statement resource lock
* @return newly createdStatement event stream, not reusing existing instances
*/ | See the method of the same name in <code>com.espertech.esper.view.stream.StreamFactoryService</code>. Always attempts to reuse an existing event stream. May thus return a new event stream or an existing event stream depending on whether filter criteria match | createStream | {
"repo_name": "mobile-event-processing/Asper",
"path": "source/src/com/espertech/esper/view/stream/StreamFactorySvcImpl.java",
"license": "gpl-2.0",
"size": 11411
} | [
"com.espertech.esper.client.EventType",
"com.espertech.esper.collection.Pair",
"com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle",
"com.espertech.esper.core.service.EPStatementHandleCallback",
"com.espertech.esper.core.service.StatementAgentInstanceLock",
"com.espertech.esper.epl.expre... | import com.espertech.esper.client.EventType; import com.espertech.esper.collection.Pair; import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; import com.espertech.esper.core.service.EPStatementHandleCallback; import com.espertech.esper.core.service.StatementAgentInstanceLock; import com.espertech.esper.epl.expression.ExprEvaluatorContext; import com.espertech.esper.filter.FilterService; import com.espertech.esper.filter.FilterSpecCompiled; import com.espertech.esper.view.EventStream; import com.espertech.esper.view.ZeroDepthStream; import java.lang.annotation.Annotation; | import com.espertech.esper.client.*; import com.espertech.esper.collection.*; import com.espertech.esper.core.context.util.*; import com.espertech.esper.core.service.*; import com.espertech.esper.epl.expression.*; import com.espertech.esper.filter.*; import com.espertech.esper.view.*; import java.lang.annotation.*; | [
"com.espertech.esper",
"java.lang"
] | com.espertech.esper; java.lang; | 2,199,695 |
public static Boolean isTheFirstRun(Context context) {
return getPreferences(context).getBoolean(PREFS_FIRST_RUN, true);
} | static Boolean function(Context context) { return getPreferences(context).getBoolean(PREFS_FIRST_RUN, true); } | /**
* FIRST RUN ENABLE AND DISABLE
*
* @param context
* @return
*/ | FIRST RUN ENABLE AND DISABLE | isTheFirstRun | {
"repo_name": "simone98dm/TheBusAppFinal",
"path": "app/src/main/java/com/android/projectz/teamrocket/thebusapp/util/SharedPreferencesUtils.java",
"license": "apache-2.0",
"size": 3732
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 173,642 |
@Test
public void testTC12() throws Exception {
final Path p = new Path("/TC12/foo");
System.out.println("p=" + p);
//a. Create file with a block size of 64KB
// and a default io.bytes.per.checksum of 512 bytes.
// Write 25687 bytes of data. Close file.
final int len1 = 25687;
{
FSDataOutputStream out = fs.create(p, false, buffersize, REPLICATION, BLOCK_SIZE);
AppendTestUtil.write(out, 0, len1);
out.close();
}
//b. Reopen file in "append" mode. Append another 5877 bytes of data. Close file.
final int len2 = 5877;
{
FSDataOutputStream out = fs.append(p);
AppendTestUtil.write(out, len1, len2);
out.close();
}
//c. Reopen file and read 25687+5877 bytes of data from file. Close file.
AppendTestUtil.check(fs, p, len1 + len2);
} | void function() throws Exception { final Path p = new Path(STR); System.out.println("p=" + p); final int len1 = 25687; { FSDataOutputStream out = fs.create(p, false, buffersize, REPLICATION, BLOCK_SIZE); AppendTestUtil.write(out, 0, len1); out.close(); } final int len2 = 5877; { FSDataOutputStream out = fs.append(p); AppendTestUtil.write(out, len1, len2); out.close(); } AppendTestUtil.check(fs, p, len1 + len2); } | /**
* TC12: Append to partial CRC chunk
* @throws IOException an exception might be thrown
*/ | TC12: Append to partial CRC chunk | testTC12 | {
"repo_name": "ZhangXFeng/hadoop",
"path": "src/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileAppend3.java",
"license": "apache-2.0",
"size": 14601
} | [
"org.apache.hadoop.fs.FSDataOutputStream",
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 596,164 |
public void getCert(TrustStoreCertificate trustStoreCertificate) {
this.issuer = new HashMap<String, String>();
this.subject = new HashMap<String, String>();
if (trustStoreCertificate != null) {
X509Certificate cert = sslService
.getPEMCertificate(new ByteArrayInputStream(trustStoreCertificate.getCertificate().getBytes()));
loadCert(cert);
}
} | void function(TrustStoreCertificate trustStoreCertificate) { this.issuer = new HashMap<String, String>(); this.subject = new HashMap<String, String>(); if (trustStoreCertificate != null) { X509Certificate cert = sslService .getPEMCertificate(new ByteArrayInputStream(trustStoreCertificate.getCertificate().getBytes())); loadCert(cert); } } | /**
* Fills issuer and subject maps with data about currently selected
* certificate
*/ | Fills issuer and subject maps with data about currently selected certificate | getCert | {
"repo_name": "madumlao/oxTrust",
"path": "server/src/main/java/org/gluu/oxtrust/action/ManageCertificateAction.java",
"license": "mit",
"size": 19134
} | [
"java.io.ByteArrayInputStream",
"java.security.cert.X509Certificate",
"java.util.HashMap",
"org.gluu.oxtrust.model.cert.TrustStoreCertificate"
] | import java.io.ByteArrayInputStream; import java.security.cert.X509Certificate; import java.util.HashMap; import org.gluu.oxtrust.model.cert.TrustStoreCertificate; | import java.io.*; import java.security.cert.*; import java.util.*; import org.gluu.oxtrust.model.cert.*; | [
"java.io",
"java.security",
"java.util",
"org.gluu.oxtrust"
] | java.io; java.security; java.util; org.gluu.oxtrust; | 2,244,679 |
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String circuitName, String peeringName) {
Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, circuitName, peeringName);
return this
.client
.<Void, Void>getLroResult(
mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
} | @ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<Void>, Void> function( String resourceGroupName, String circuitName, String peeringName) { Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, circuitName, peeringName); return this .client .<Void, Void>getLroResult( mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } | /**
* Deletes the specified peering from the specified express route circuit.
*
* @param resourceGroupName The name of the resource group.
* @param circuitName The name of the express route circuit.
* @param peeringName The name of the peering.
* @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 the completion.
*/ | Deletes the specified peering from the specified express route circuit | beginDeleteAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/ExpressRouteCircuitPeeringsClientImpl.java",
"license": "mit",
"size": 56050
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.polling.PollerFlux",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.PollerFlux; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import java.nio.*; | [
"com.azure.core",
"java.nio"
] | com.azure.core; java.nio; | 272,629 |
public static Connection getConnectionHSQLDB() throws Exception {
Class.forName("org.hsqldb.jdbcDriver");
return DriverManager.getConnection("jdbc:hsqldb:mem:Log4j", "sa", "");
} | static Connection function() throws Exception { Class.forName(STR); return DriverManager.getConnection(STR, "sa", ""); } | /**
* Referred from log4j2-jdbc-appender.xml.
*/ | Referred from log4j2-jdbc-appender.xml | getConnectionHSQLDB | {
"repo_name": "xnslong/logging-log4j2",
"path": "log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/JdbcAppenderBenchmark.java",
"license": "apache-2.0",
"size": 7608
} | [
"java.sql.Connection",
"java.sql.DriverManager"
] | import java.sql.Connection; import java.sql.DriverManager; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,476,403 |
@Test
public void testAssignTheatersUser_Ok()
{
UserTO userTO = generateUserTO( true );
userTO.setRegionSelected( 1L );
Assert.assertNotNull( userTO.getTheaters() );
CatalogTO theaters = userTO.getTheaters().get( 0 );
Assert.assertNotNull( theaters );
assignUserServiceEJB.assignTheatersUser( userTO );
UserDO userDO = userDAO.find( userTO.getId().intValue() );
Assert.assertNotNull( userDO );
Assert.assertNotNull( userDO.getTheaterDOList() );
for( TheaterDO theaterDO : userDO.getTheaterDOList() )
{
Assert.assertNotNull( theaterDO );
Assert.assertEquals( 1L, theaterDO.getIdTheater().longValue() );
}
TheaterDO theaterDO2 = theaterDAO.find( theaters.getId().intValue() );
for( UserDO userDO2 : theaterDO2.getUserDOList() )
{
Assert.assertNotNull( userDO2 );
System.out.println( "User ID: " + userDO2.getIdUser() );
}
} | void function() { UserTO userTO = generateUserTO( true ); userTO.setRegionSelected( 1L ); Assert.assertNotNull( userTO.getTheaters() ); CatalogTO theaters = userTO.getTheaters().get( 0 ); Assert.assertNotNull( theaters ); assignUserServiceEJB.assignTheatersUser( userTO ); UserDO userDO = userDAO.find( userTO.getId().intValue() ); Assert.assertNotNull( userDO ); Assert.assertNotNull( userDO.getTheaterDOList() ); for( TheaterDO theaterDO : userDO.getTheaterDOList() ) { Assert.assertNotNull( theaterDO ); Assert.assertEquals( 1L, theaterDO.getIdTheater().longValue() ); } TheaterDO theaterDO2 = theaterDAO.find( theaters.getId().intValue() ); for( UserDO userDO2 : theaterDO2.getUserDOList() ) { Assert.assertNotNull( userDO2 ); System.out.println( STR + userDO2.getIdUser() ); } } | /**
* Tests testAssignTheatersUser_Ok
*/ | Tests testAssignTheatersUser_Ok | testAssignTheatersUser_Ok | {
"repo_name": "sidlors/digital-booking",
"path": "digital-booking-services/src/test/java/mx/com/cinepolis/digital/booking/service/configuration/impl/AssignUserServiceEJBTest.java",
"license": "epl-1.0",
"size": 7978
} | [
"mx.com.cinepolis.digital.booking.commons.to.CatalogTO",
"mx.com.cinepolis.digital.booking.commons.to.UserTO",
"mx.com.cinepolis.digital.booking.model.TheaterDO",
"mx.com.cinepolis.digital.booking.model.UserDO",
"org.junit.Assert"
] | import mx.com.cinepolis.digital.booking.commons.to.CatalogTO; import mx.com.cinepolis.digital.booking.commons.to.UserTO; import mx.com.cinepolis.digital.booking.model.TheaterDO; import mx.com.cinepolis.digital.booking.model.UserDO; import org.junit.Assert; | import mx.com.cinepolis.digital.booking.commons.to.*; import mx.com.cinepolis.digital.booking.model.*; import org.junit.*; | [
"mx.com.cinepolis",
"org.junit"
] | mx.com.cinepolis; org.junit; | 1,058,181 |
private final Connection getConnectionUsingDS(String userN, String password, final WSConnectionRequestInfoImpl cri,
KerbUsage useKerb, Object gssCredential) throws ResourceException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "getConnectionUsingDS", AdapterUtil.toString(dataSourceOrDriver), userN);
final String user = userN == null ? null : userN.trim();
final String pwd = password == null ? null : password.trim(); | final Connection function(String userN, String password, final WSConnectionRequestInfoImpl cri, KerbUsage useKerb, Object gssCredential) throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, STR, AdapterUtil.toString(dataSourceOrDriver), userN); final String user = userN == null ? null : userN.trim(); final String pwd = password == null ? null : password.trim(); | /**
* Get a Connection from a DataSource based on what is in the cri. A null userName
* indicates that no user name or password should be provided.
*
* @param userN the user name for obtaining a Connection, or null if none.
* @param password the password for obtaining a Connection.
* @param cri optional information for the connection request
*
* @return a Connection.
* @throws ResourceException
*/ | Get a Connection from a DataSource based on what is in the cri. A null userName indicates that no user name or password should be provided | getConnectionUsingDS | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSManagedConnectionFactoryImpl.java",
"license": "epl-1.0",
"size": 79767
} | [
"com.ibm.websphere.ras.Tr",
"com.ibm.websphere.ras.TraceComponent",
"com.ibm.ws.rsadapter.AdapterUtil",
"java.sql.Connection",
"javax.resource.ResourceException"
] | import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent; import com.ibm.ws.rsadapter.AdapterUtil; import java.sql.Connection; import javax.resource.ResourceException; | import com.ibm.websphere.ras.*; import com.ibm.ws.rsadapter.*; import java.sql.*; import javax.resource.*; | [
"com.ibm.websphere",
"com.ibm.ws",
"java.sql",
"javax.resource"
] | com.ibm.websphere; com.ibm.ws; java.sql; javax.resource; | 333,974 |
public static AudioInputStream getAudioInputStream(File f)
throws UnsupportedAudioFileException, IOException
{
Iterator i = lookupAudioFileReaderProviders();
while (i.hasNext())
{
AudioFileReader reader = (AudioFileReader) i.next();
try
{
return reader.getAudioInputStream(f);
}
catch (UnsupportedAudioFileException _)
{
// Try the next provider.
}
}
throw new UnsupportedAudioFileException("file type not recognized");
} | static AudioInputStream function(File f) throws UnsupportedAudioFileException, IOException { Iterator i = lookupAudioFileReaderProviders(); while (i.hasNext()) { AudioFileReader reader = (AudioFileReader) i.next(); try { return reader.getAudioInputStream(f); } catch (UnsupportedAudioFileException _) { } } throw new UnsupportedAudioFileException(STR); } | /**
* Return an audio input stream for the file.
* @param f the file to read
* @return an audio input stream for the file
* @throws UnsupportedAudioFileException if the file's audio format is not
* recognized
* @throws IOException if there is an error while reading the file
*/ | Return an audio input stream for the file | getAudioInputStream | {
"repo_name": "ivmai/JCGO",
"path": "goclsp/clsp_fix/javax/sound/sampled/AudioSystem.java",
"license": "gpl-2.0",
"size": 26363
} | [
"java.io.File",
"java.io.IOException",
"java.util.Iterator",
"javax.sound.sampled.spi.AudioFileReader"
] | import java.io.File; import java.io.IOException; import java.util.Iterator; import javax.sound.sampled.spi.AudioFileReader; | import java.io.*; import java.util.*; import javax.sound.sampled.spi.*; | [
"java.io",
"java.util",
"javax.sound"
] | java.io; java.util; javax.sound; | 301,783 |
ClassPathXmlApplicationContext context = null;
try {
context = new ClassPathXmlApplicationContext(APPLICATION_CONTEXT_LOCATION);
runMain(context, args);
} catch (Throwable e) {
try {
// Ensure that top-level exceptions are logged
LOGGER.fatal(e.getMessage(), e);
} catch (Throwable e2) {
// But if the logging fails, throw the original exception
throw e;
}
throw e;
} finally {
if (context != null) {
context.close();
}
}
} | ClassPathXmlApplicationContext context = null; try { context = new ClassPathXmlApplicationContext(APPLICATION_CONTEXT_LOCATION); runMain(context, args); } catch (Throwable e) { try { LOGGER.fatal(e.getMessage(), e); } catch (Throwable e2) { throw e; } throw e; } finally { if (context != null) { context.close(); } } } | /**
* Entry method for the DataAcquisition module.
* @param args Command line arguments. If specified, these are interpreted as a list of file names containing
* HealthMap JSON data to acquire.
*/ | Entry method for the DataAcquisition module | main | {
"repo_name": "SEEG-Oxford/ABRAID-MP",
"path": "src/DataManager/src/uk/ac/ox/zoo/seeg/abraid/mp/datamanager/Main.java",
"license": "apache-2.0",
"size": 9154
} | [
"org.springframework.context.support.ClassPathXmlApplicationContext"
] | import org.springframework.context.support.ClassPathXmlApplicationContext; | import org.springframework.context.support.*; | [
"org.springframework.context"
] | org.springframework.context; | 734,322 |
public String exportToYaml() {
final Map<String, Object> data = getPropertyMap();
final Yaml yaml = new Yaml();
return yaml.dump(data);
}
| String function() { final Map<String, Object> data = getPropertyMap(); final Yaml yaml = new Yaml(); return yaml.dump(data); } | /**
* Export the data to YAML
* @return
*/ | Export the data to YAML | exportToYaml | {
"repo_name": "jnidzwetzki/bboxdb",
"path": "bboxdb-server/src/main/java/org/bboxdb/storage/entity/TupleStoreMetaData.java",
"license": "apache-2.0",
"size": 8270
} | [
"java.util.Map",
"org.yaml.snakeyaml.Yaml"
] | import java.util.Map; import org.yaml.snakeyaml.Yaml; | import java.util.*; import org.yaml.snakeyaml.*; | [
"java.util",
"org.yaml.snakeyaml"
] | java.util; org.yaml.snakeyaml; | 2,586,981 |
public synchronized void close () throws HibernateException {
if (session != null) {
session.close ();
session = null;
}
} | synchronized void function () throws HibernateException { if (session != null) { session.close (); session = null; } } | /**
* close hibernate session
* @throws HibernateException
*/ | close hibernate session | close | {
"repo_name": "Koulio/jposee",
"path": "opt/eecore3/src/org/jpos/ee/DB.java",
"license": "agpl-3.0",
"size": 6007
} | [
"org.hibernate.HibernateException"
] | import org.hibernate.HibernateException; | import org.hibernate.*; | [
"org.hibernate"
] | org.hibernate; | 1,870,804 |
public Element getXmlElement() {
return xmlElement;
} | Element function() { return xmlElement; } | /**
* The root element of {@link #getXmlDocument()}. Returns <code>null</code>
* until the snapshot has actually been built.
*/ | The root element of <code>#getXmlDocument()</code>. Returns <code>null</code> until the snapshot has actually been built | getXmlElement | {
"repo_name": "peridotperiod/isis",
"path": "core/metamodel/src/main/java/org/apache/isis/core/runtime/snapshot/XmlSnapshot.java",
"license": "apache-2.0",
"size": 37047
} | [
"org.w3c.dom.Element"
] | import org.w3c.dom.Element; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,583,990 |
public void removeTags(Id.Stream streamId)
throws IOException, UnauthenticatedException, NotFoundException, BadRequestException, UnauthorizedException {
removeTags(streamId, constructPath(streamId));
} | void function(Id.Stream streamId) throws IOException, UnauthenticatedException, NotFoundException, BadRequestException, UnauthorizedException { removeTags(streamId, constructPath(streamId)); } | /**
* Removes all tags from a stream.
*
* @param streamId stream to remove tags from
*/ | Removes all tags from a stream | removeTags | {
"repo_name": "caskdata/cdap",
"path": "cdap-common/src/main/java/co/cask/cdap/common/metadata/AbstractMetadataClient.java",
"license": "apache-2.0",
"size": 48748
} | [
"co.cask.cdap.common.BadRequestException",
"co.cask.cdap.common.NotFoundException",
"co.cask.cdap.common.UnauthenticatedException",
"co.cask.cdap.proto.Id",
"co.cask.cdap.security.spi.authorization.UnauthorizedException",
"java.io.IOException"
] | import co.cask.cdap.common.BadRequestException; import co.cask.cdap.common.NotFoundException; import co.cask.cdap.common.UnauthenticatedException; import co.cask.cdap.proto.Id; import co.cask.cdap.security.spi.authorization.UnauthorizedException; import java.io.IOException; | import co.cask.cdap.common.*; import co.cask.cdap.proto.*; import co.cask.cdap.security.spi.authorization.*; import java.io.*; | [
"co.cask.cdap",
"java.io"
] | co.cask.cdap; java.io; | 1,381,895 |
public static void drawHorizontalMarginString(Graphics2D g,
Color stringColor,
String string,
boolean isReference,
int x1,
int x2,
int y) {
if (stringColor != null) {
g.setColor(stringColor);
}
if (string != null) {
Font previousFont = g.getFont();
g.setFont(sFont);
FontMetrics metrics = g.getFontMetrics();
Rectangle2D rect = metrics.getStringBounds(string, g);
float sx = (float)((x1 + x2) / 2 - rect.getWidth() / 2);
float sy = (float)(y - MARGIN_SPACING - metrics.getDescent());
if (isReference) {
g.setFont(sFontReference);
}
g.drawString(string, sx, sy);
g.setFont(previousFont);
}
} | static void function(Graphics2D g, Color stringColor, String string, boolean isReference, int x1, int x2, int y) { if (stringColor != null) { g.setColor(stringColor); } if (string != null) { Font previousFont = g.getFont(); g.setFont(sFont); FontMetrics metrics = g.getFontMetrics(); Rectangle2D rect = metrics.getStringBounds(string, g); float sx = (float)((x1 + x2) / 2 - rect.getWidth() / 2); float sy = (float)(y - MARGIN_SPACING - metrics.getDescent()); if (isReference) { g.setFont(sFontReference); } g.drawString(string, sx, sy); g.setFont(previousFont); } } | /**
* Draw the text of an horizontal margin line.
*
* @param stringColor The color of the text, may be null and use current color.
* @param string The margin value to display. May be null.
*/ | Draw the text of an horizontal margin line | drawHorizontalMarginString | {
"repo_name": "AndroidX/constraintlayout",
"path": "desktop/ConstraintLayoutInspector/app/src/androidx/constraintLayout/desktop/constraintRendering/DrawConnectionUtils.java",
"license": "apache-2.0",
"size": 40239
} | [
"java.awt.Color",
"java.awt.Font",
"java.awt.FontMetrics",
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D"
] | import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 620,590 |
public int globalMethodInvocations() {
int count = 0;
for (int i = 0; i < NUM_INSTR; i++) {
if (OpcodeInfo.isInvoke(i)) {
count += mCounts[i];
}
}
return count;
}
}
private static final TypedProperties debugProperties;
static {
if (false) {
final String TAG = "DebugProperties";
final String[] files = { "/system/debug.prop", "/debug.prop", "/data/debug.prop" };
final TypedProperties tp = new TypedProperties();
// Read the properties from each of the files, if present.
for (String file : files) {
Reader r;
try {
r = new FileReader(file);
} catch (FileNotFoundException ex) {
// It's ok if a file is missing.
continue;
}
try {
tp.load(r);
} catch (Exception ex) {
throw new RuntimeException("Problem loading " + file, ex);
} finally {
try {
r.close();
} catch (IOException ex) {
// Ignore this error.
}
}
}
debugProperties = tp.isEmpty() ? null : tp;
} else {
debugProperties = null;
}
} | int function() { int count = 0; for (int i = 0; i < NUM_INSTR; i++) { if (OpcodeInfo.isInvoke(i)) { count += mCounts[i]; } } return count; } } private static final TypedProperties debugProperties; static { if (false) { final String TAG = STR; final String[] files = { STR, STR, STR }; final TypedProperties tp = new TypedProperties(); for (String file : files) { Reader r; try { r = new FileReader(file); } catch (FileNotFoundException ex) { continue; } try { tp.load(r); } catch (Exception ex) { throw new RuntimeException(STR + file, ex); } finally { try { r.close(); } catch (IOException ex) { } } } debugProperties = tp.isEmpty() ? null : tp; } else { debugProperties = null; } } | /**
* Return the total number of method-invocation instructions
* executed globally.
*/ | Return the total number of method-invocation instructions executed globally | globalMethodInvocations | {
"repo_name": "indashnet/InDashNet.Open.UN2000",
"path": "android/frameworks/base/core/java/android/os/Debug.java",
"license": "apache-2.0",
"size": 58887
} | [
"com.android.internal.util.TypedProperties",
"java.io.FileNotFoundException",
"java.io.FileReader",
"java.io.IOException",
"java.io.Reader"
] | import com.android.internal.util.TypedProperties; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; | import com.android.internal.util.*; import java.io.*; | [
"com.android.internal",
"java.io"
] | com.android.internal; java.io; | 2,883,558 |
public static String getDetails(Throwable t) {
assert t != null;
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
return t.getMessage() + "\n" + sw.toString();
} | static String function(Throwable t) { assert t != null; StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); return t.getMessage() + "\n" + sw.toString(); } | /**
* Returns a detailed message of the t, including the stack trace.
*/ | Returns a detailed message of the t, including the stack trace | getDetails | {
"repo_name": "CS2103JAN2017-F11-B3/main",
"path": "src/main/java/seedu/task/commons/util/StringUtil.java",
"license": "mit",
"size": 3609
} | [
"java.io.PrintWriter",
"java.io.StringWriter"
] | import java.io.PrintWriter; import java.io.StringWriter; | import java.io.*; | [
"java.io"
] | java.io; | 1,841,561 |
public void run() {
while (!_done) {
_lock.lock();
try {
boolean wait = false;
long nextjob;
while ((nextjob = nextJobTime()) > 0 && !_done)
wait = _activity.await(nextjob, TimeUnit.MILLISECONDS);
if (__log.isDebugEnabled()) {
__log.debug("waiting for next job : " + wait);
}
if (!_done && nextjob == 0) {
ScheduledTask task = _todo.take();
_taskrunner.runTask(task);
}
} catch (InterruptedException ex) {
; // ignore
} finally {
_lock.unlock();
}
}
} | void function() { while (!_done) { _lock.lock(); try { boolean wait = false; long nextjob; while ((nextjob = nextJobTime()) > 0 && !_done) wait = _activity.await(nextjob, TimeUnit.MILLISECONDS); if (__log.isDebugEnabled()) { __log.debug(STR + wait); } if (!_done && nextjob == 0) { ScheduledTask task = _todo.take(); _taskrunner.runTask(task); } } catch (InterruptedException ex) { ; } finally { _lock.unlock(); } } } | /**
* Pop items off the todo queue, and send them to the task runner for processing.
*/ | Pop items off the todo queue, and send them to the task runner for processing | run | {
"repo_name": "himasha/carbon-business-process",
"path": "components/bpmn/org.wso2.carbon.bpmn/src/main/java/org/wso2/carbon/bpmn/people/substitution/scheduler/SchedulerThread.java",
"license": "apache-2.0",
"size": 5015
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 541,202 |
Iterator<Entry<String, Long>> getTextIterator(TextStyle style) {
List<Entry<String, Long>> list = parsable.get(style);
return list != null ? list.iterator() : null;
}
} | Iterator<Entry<String, Long>> getTextIterator(TextStyle style) { List<Entry<String, Long>> list = parsable.get(style); return list != null ? list.iterator() : null; } } | /**
* Gets an iterator of text to field for the specified style for the purpose of parsing.
* <p>
* The iterator must be returned in order from the longest text to the shortest.
*
* @param style the style to get text for, null for all parsable text
* @return the iterator of text to field pairs, in order from longest text to shortest text,
* null if the style is not parsable
*/ | Gets an iterator of text to field for the specified style for the purpose of parsing. The iterator must be returned in order from the longest text to the shortest | getTextIterator | {
"repo_name": "google/desugar_jdk_libs",
"path": "jdk11/src/java.base/share/classes/java/time/format/DateTimeTextProvider.java",
"license": "gpl-2.0",
"size": 30111
} | [
"java.util.Iterator",
"java.util.List",
"java.util.Map"
] | import java.util.Iterator; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 23,190 |
private int getCauseFeedId(int res_id) {
switch(res_id) {
case R.id.animals_btn:
return DSConstants.CAUSE_TAG.ANIMALS.getValue();
case R.id.bullying_violence_btn:
return DSConstants.CAUSE_TAG.BULLYING.getValue();
case R.id.disasters_btn:
return DSConstants.CAUSE_TAG.DISASTERS.getValue();
case R.id.discrimination_btn:
return DSConstants.CAUSE_TAG.DISCRIMINATION.getValue();
case R.id.education_btn:
return DSConstants.CAUSE_TAG.EDUCATION.getValue();
case R.id.environment_btn:
return DSConstants.CAUSE_TAG.ENVIRONMENT.getValue();
case R.id.homelessness_poverty_btn:
return DSConstants.CAUSE_TAG.POVERTY.getValue();
case R.id.human_rights_btn:
return DSConstants.CAUSE_TAG.HUMAN_RIGHTS.getValue();
case R.id.our_troops_btn:
return DSConstants.CAUSE_TAG.TROOPS.getValue();
case R.id.health_btn:
return DSConstants.CAUSE_TAG.HEALTH.getValue();
case R.id.sex_relationships_btn:
return DSConstants.CAUSE_TAG.RELATIONSHIPS.getValue();
default:
return -1;
}
} | int function(int res_id) { switch(res_id) { case R.id.animals_btn: return DSConstants.CAUSE_TAG.ANIMALS.getValue(); case R.id.bullying_violence_btn: return DSConstants.CAUSE_TAG.BULLYING.getValue(); case R.id.disasters_btn: return DSConstants.CAUSE_TAG.DISASTERS.getValue(); case R.id.discrimination_btn: return DSConstants.CAUSE_TAG.DISCRIMINATION.getValue(); case R.id.education_btn: return DSConstants.CAUSE_TAG.EDUCATION.getValue(); case R.id.environment_btn: return DSConstants.CAUSE_TAG.ENVIRONMENT.getValue(); case R.id.homelessness_poverty_btn: return DSConstants.CAUSE_TAG.POVERTY.getValue(); case R.id.human_rights_btn: return DSConstants.CAUSE_TAG.HUMAN_RIGHTS.getValue(); case R.id.our_troops_btn: return DSConstants.CAUSE_TAG.TROOPS.getValue(); case R.id.health_btn: return DSConstants.CAUSE_TAG.HEALTH.getValue(); case R.id.sex_relationships_btn: return DSConstants.CAUSE_TAG.RELATIONSHIPS.getValue(); default: return -1; } } | /**
* Translates a cause's internal resource id to its corresponding value from
* the Campaigns or Action Finder feed.
*/ | Translates a cause's internal resource id to its corresponding value from the Campaigns or Action Finder feed | getCauseFeedId | {
"repo_name": "DoSomething/ds-android",
"path": "dosomething/src/org/dosomething/android/cache/DSPreferences.java",
"license": "mit",
"size": 16124
} | [
"org.dosomething.android.DSConstants"
] | import org.dosomething.android.DSConstants; | import org.dosomething.android.*; | [
"org.dosomething.android"
] | org.dosomething.android; | 653,748 |
public void testCorrectRebalancingCurrentlyRentingPartitions() throws Exception {
IgniteEx ignite = (IgniteEx) startGrids(3);
ignite.cluster().active(true);
// High number of keys triggers long partition eviction.
final int keysCount = 500_000;
try (IgniteDataStreamer ds = ignite.dataStreamer(CACHE_NAME)) {
log.info("Writing initial data...");
ds.allowOverwrite(true);
for (int k = 1; k <= keysCount; k++) {
ds.addData(k, k);
if (k % 50_000 == 0)
log.info("Written " + k + " entities.");
}
log.info("Writing initial data finished.");
}
startGrid(3);
// Trigger partition eviction from other nodes.
resetBaselineTopology();
stopGrid(3);
// Trigger evicting partitions rebalancing.
resetBaselineTopology();
// Emulate stopping grid during partition eviction.
stopGrid(1);
// Started node should have partition in RENTING or EVICTED state.
startGrid(1);
awaitPartitionMapExchange();
// Check no data loss.
for (int k = 1; k <= keysCount; k++) {
Integer value = (Integer) ignite.cache(CACHE_NAME).get(k);
Assert.assertNotNull("Value for " + k + " is null", value);
Assert.assertEquals("Check failed for " + k + " = " + value, k, (int) value);
}
} | void function() throws Exception { IgniteEx ignite = (IgniteEx) startGrids(3); ignite.cluster().active(true); final int keysCount = 500_000; try (IgniteDataStreamer ds = ignite.dataStreamer(CACHE_NAME)) { log.info(STR); ds.allowOverwrite(true); for (int k = 1; k <= keysCount; k++) { ds.addData(k, k); if (k % 50_000 == 0) log.info(STR + k + STR); } log.info(STR); } startGrid(3); resetBaselineTopology(); stopGrid(3); resetBaselineTopology(); stopGrid(1); startGrid(1); awaitPartitionMapExchange(); for (int k = 1; k <= keysCount; k++) { Integer value = (Integer) ignite.cache(CACHE_NAME).get(k); Assert.assertNotNull(STR + k + STR, value); Assert.assertEquals(STR + k + STR + value, k, (int) value); } } | /**
* Test that partitions belong to affinity in state RENTING or EVICTED are correctly rebalanced.
*
* @throws Exception If failed.
*/ | Test that partitions belong to affinity in state RENTING or EVICTED are correctly rebalanced | testCorrectRebalancingCurrentlyRentingPartitions | {
"repo_name": "irudyak/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java",
"license": "apache-2.0",
"size": 8951
} | [
"org.apache.ignite.IgniteDataStreamer",
"org.apache.ignite.internal.IgniteEx",
"org.junit.Assert"
] | import org.apache.ignite.IgniteDataStreamer; import org.apache.ignite.internal.IgniteEx; import org.junit.Assert; | import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.junit.*; | [
"org.apache.ignite",
"org.junit"
] | org.apache.ignite; org.junit; | 1,088,516 |
private ContractManagerAssignmentDocument buildSimpleDocument() throws Exception {
List<ContractManagerAssignmentDetail> details = ContractManagerAssignmentDocumentFixture.ACM_DOCUMENT_VALID.getContractManagerAssignmentDetails();
for (ContractManagerAssignmentDetail detail : details) {
detail.getRequisition().setAccountDistributionMethod("S");
RequisitionDocument routedReq = routeRequisitionUntilAwaitingContractManager(detail.getRequisition());
detail.setRequisitionIdentifier(routedReq.getPurapDocumentIdentifier());
detail.refreshNonUpdateableReferences();
}
acmDocument = ContractManagerAssignmentDocumentFixture.ACM_DOCUMENT_VALID.createContractManagerAssignmentDocument();
for (ContractManagerAssignmentDetail detail : details) {
detail.getRequisition().setAccountDistributionMethod("S");
detail.setContractManagerAssignmentDocument(acmDocument);
}
acmDocument.setContractManagerAssignmentDetailss(details);
return acmDocument;
} | ContractManagerAssignmentDocument function() throws Exception { List<ContractManagerAssignmentDetail> details = ContractManagerAssignmentDocumentFixture.ACM_DOCUMENT_VALID.getContractManagerAssignmentDetails(); for (ContractManagerAssignmentDetail detail : details) { detail.getRequisition().setAccountDistributionMethod("S"); RequisitionDocument routedReq = routeRequisitionUntilAwaitingContractManager(detail.getRequisition()); detail.setRequisitionIdentifier(routedReq.getPurapDocumentIdentifier()); detail.refreshNonUpdateableReferences(); } acmDocument = ContractManagerAssignmentDocumentFixture.ACM_DOCUMENT_VALID.createContractManagerAssignmentDocument(); for (ContractManagerAssignmentDetail detail : details) { detail.getRequisition().setAccountDistributionMethod("S"); detail.setContractManagerAssignmentDocument(acmDocument); } acmDocument.setContractManagerAssignmentDetailss(details); return acmDocument; } | /**
* Helper method to create a new valid ContractManagerAssignmentDocument.
*
* @return The ContractManagerAssignmentDocument created by this method.
* @throws Exception
*/ | Helper method to create a new valid ContractManagerAssignmentDocument | buildSimpleDocument | {
"repo_name": "bhutchinson/kfs",
"path": "kfs-purap/src/test/java/org/kuali/kfs/module/purap/document/ContractManagerAssignmentDocumentTest.java",
"license": "agpl-3.0",
"size": 12602
} | [
"java.util.List",
"org.kuali.kfs.module.purap.businessobject.ContractManagerAssignmentDetail",
"org.kuali.kfs.module.purap.fixture.ContractManagerAssignmentDocumentFixture"
] | import java.util.List; import org.kuali.kfs.module.purap.businessobject.ContractManagerAssignmentDetail; import org.kuali.kfs.module.purap.fixture.ContractManagerAssignmentDocumentFixture; | import java.util.*; import org.kuali.kfs.module.purap.businessobject.*; import org.kuali.kfs.module.purap.fixture.*; | [
"java.util",
"org.kuali.kfs"
] | java.util; org.kuali.kfs; | 1,263,880 |
public DialogBox createNoProjectsDialog(boolean showDialog) {
final NoProjectDialogBox dialogBox = new NoProjectDialogBox();
if (showDialog) {
dialogBox.show();
}
return dialogBox;
} | DialogBox function(boolean showDialog) { final NoProjectDialogBox dialogBox = new NoProjectDialogBox(); if (showDialog) { dialogBox.show(); } return dialogBox; } | /**
* Creates, visually centers, and optionally displays the dialog box
* that informs the user how to start learning about using App Inventor
* or create a new project.
* @param showDialog Convenience variable to show the created DialogBox.
* @return The created and optionally displayed Dialog box.
*/ | Creates, visually centers, and optionally displays the dialog box that informs the user how to start learning about using App Inventor or create a new project | createNoProjectsDialog | {
"repo_name": "kkashi01/appinventor-sources",
"path": "appinventor/appengine/src/com/google/appinventor/client/Ode.java",
"license": "apache-2.0",
"size": 99174
} | [
"com.google.appinventor.client.explorer.dialogs.NoProjectDialogBox",
"com.google.gwt.user.client.ui.DialogBox"
] | import com.google.appinventor.client.explorer.dialogs.NoProjectDialogBox; import com.google.gwt.user.client.ui.DialogBox; | import com.google.appinventor.client.explorer.dialogs.*; import com.google.gwt.user.client.ui.*; | [
"com.google.appinventor",
"com.google.gwt"
] | com.google.appinventor; com.google.gwt; | 1,342,769 |
private PropertyValues getPropertyValueSubElements(Element beanEle) {
NodeList nl = beanEle.getElementsByTagName(PROPERTY_ELEMENT);
MutablePropertyValues pvs = new MutablePropertyValues();
for (int i = 0; i < nl.getLength(); i++) {
Element propEle = (Element) nl.item(i);
parsePropertyElement(pvs, propEle);
}
return pvs;
}
| PropertyValues function(Element beanEle) { NodeList nl = beanEle.getElementsByTagName(PROPERTY_ELEMENT); MutablePropertyValues pvs = new MutablePropertyValues(); for (int i = 0; i < nl.getLength(); i++) { Element propEle = (Element) nl.item(i); parsePropertyElement(pvs, propEle); } return pvs; } | /**
* Parse property value subelements of this bean element.
*/ | Parse property value subelements of this bean element | getPropertyValueSubElements | {
"repo_name": "Will1229/LearnSpring",
"path": "spring-framework-0.9.1/src/com/interface21/beans/factory/xml/XmlBeanFactory.java",
"license": "apache-2.0",
"size": 16505
} | [
"com.interface21.beans.MutablePropertyValues",
"com.interface21.beans.PropertyValues",
"org.w3c.dom.Element",
"org.w3c.dom.NodeList"
] | import com.interface21.beans.MutablePropertyValues; import com.interface21.beans.PropertyValues; import org.w3c.dom.Element; import org.w3c.dom.NodeList; | import com.interface21.beans.*; import org.w3c.dom.*; | [
"com.interface21.beans",
"org.w3c.dom"
] | com.interface21.beans; org.w3c.dom; | 2,852,618 |
public ModelCheckerResult computeBoundedUntilProbs(SMG smg, BitSet remain, BitSet target, int k, boolean min1, boolean min2, Coalition coalition) throws PrismException
{
// Temporarily make SMG into an STPG by setting coalition and do computation on STPG
smg.setCoalition(coalition);
ModelCheckerResult res = createSTPGModelChecker().computeBoundedUntilProbs(smg, remain, target, k, min1, min2);
smg.setCoalition(null);
return res;
} | ModelCheckerResult function(SMG smg, BitSet remain, BitSet target, int k, boolean min1, boolean min2, Coalition coalition) throws PrismException { smg.setCoalition(coalition); ModelCheckerResult res = createSTPGModelChecker().computeBoundedUntilProbs(smg, remain, target, k, min1, min2); smg.setCoalition(null); return res; } | /**
* Compute bounded reachability/until probabilities.
* i.e. compute the min/max probability of reaching a state in {@code target},
* within k steps, and while remaining in states in @{code remain}.
* @param smg The SMG
* @param remain Remain in these states (optional: null means "all")
* @param target Target states
* @param k Bound
* @param min1 Min or max probabilities for player 1 (true=min, false=max)
* @param min2 Min or max probabilities for player 2 (true=min, false=max)
* @param coalition The coalition of players which define player 1
*/ | Compute bounded reachability/until probabilities. i.e. compute the min/max probability of reaching a state in target, within k steps, and while remaining in states in @{code remain} | computeBoundedUntilProbs | {
"repo_name": "azlanismail/prismgames",
"path": "src/explicit/SMGModelChecker.java",
"license": "gpl-2.0",
"size": 111183
} | [
"java.util.BitSet"
] | import java.util.BitSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,924,191 |
public boolean getBool(String key, boolean defaultValue)
{
return NumberTools.toBool(getProperty(key), defaultValue);
} | boolean function(String key, boolean defaultValue) { return NumberTools.toBool(getProperty(key), defaultValue); } | /**
* Retrieve a boolean value.
*
* @param key The key of the property to retrieve
* @param defaultValue A default value in case the property wasn't found.
* @return The value of the property.
*/ | Retrieve a boolean value | getBool | {
"repo_name": "iritgo/iritgo-aktario",
"path": "aktario-framework/src/main/java/de/iritgo/aktario/core/base/SystemProperties.java",
"license": "apache-2.0",
"size": 4496
} | [
"de.iritgo.simplelife.math.NumberTools"
] | import de.iritgo.simplelife.math.NumberTools; | import de.iritgo.simplelife.math.*; | [
"de.iritgo.simplelife"
] | de.iritgo.simplelife; | 1,897,288 |
public void someOutput(){
// get some information of current wallet
ECKey first_key = this.wallet.getKeys().get(0);
System.out.println("First key in the wallet:\n" + first_key);
System.out.println("Complete content of the wallet:\n" + this.wallet);
if (this.wallet.isPubKeyHashMine(first_key.getPubKeyHash())) {
System.out.println("Yep, that's my key.");
} else {
System.out.println("Nope, that key didn't come from this wallet.");
}
} | void function(){ ECKey first_key = this.wallet.getKeys().get(0); System.out.println(STR + first_key); System.out.println(STR + this.wallet); if (this.wallet.isPubKeyHashMine(first_key.getPubKeyHash())) { System.out.println(STR); } else { System.out.println(STR); } } | /**
* Returns some information about wallet.
*/ | Returns some information about wallet | someOutput | {
"repo_name": "kiebitz/KeyBits",
"path": "src/MyWallet.java",
"license": "gpl-3.0",
"size": 29471
} | [
"com.google.bitcoin.core.ECKey"
] | import com.google.bitcoin.core.ECKey; | import com.google.bitcoin.core.*; | [
"com.google.bitcoin"
] | com.google.bitcoin; | 1,157,346 |
void onStateUpdateFromItem(State state); | void onStateUpdateFromItem(State state); | /**
* Will be called if an item has changed its state and this information should be forwarded to the binding.
*
* @param state the new state
*/ | Will be called if an item has changed its state and this information should be forwarded to the binding | onStateUpdateFromItem | {
"repo_name": "Snickermicker/smarthome",
"path": "bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/profiles/Profile.java",
"license": "epl-1.0",
"size": 1519
} | [
"org.eclipse.smarthome.core.types.State"
] | import org.eclipse.smarthome.core.types.State; | import org.eclipse.smarthome.core.types.*; | [
"org.eclipse.smarthome"
] | org.eclipse.smarthome; | 2,545,045 |
protected void onFilterValueChange() {
WorkflowQueriesFilterBean newState = new WorkflowQueriesFilterBean();
newState.setWorkflow(_workflow.getValue()).setName(_name.getValue());
WorkflowQueriesFilterBean oldState = this._currentState;
this._currentState = newState;
// Only fire a change event if something actually changed.
ValueChangeEvent.fireIfNotEqual(this, oldState, _currentState);
} | void function() { WorkflowQueriesFilterBean newState = new WorkflowQueriesFilterBean(); newState.setWorkflow(_workflow.getValue()).setName(_name.getValue()); WorkflowQueriesFilterBean oldState = this._currentState; this._currentState = newState; ValueChangeEvent.fireIfNotEqual(this, oldState, _currentState); } | /**
* Called whenever any filter value changes.
*/ | Called whenever any filter value changes | onFilterValueChange | {
"repo_name": "Governance/dtgov",
"path": "dtgov-ui-war/src/main/java/org/overlord/dtgov/ui/client/local/pages/workflowQuery/WorkflowQueriesFilter.java",
"license": "apache-2.0",
"size": 8922
} | [
"com.google.gwt.event.logical.shared.ValueChangeEvent",
"org.overlord.dtgov.ui.client.shared.beans.WorkflowQueriesFilterBean"
] | import com.google.gwt.event.logical.shared.ValueChangeEvent; import org.overlord.dtgov.ui.client.shared.beans.WorkflowQueriesFilterBean; | import com.google.gwt.event.logical.shared.*; import org.overlord.dtgov.ui.client.shared.beans.*; | [
"com.google.gwt",
"org.overlord.dtgov"
] | com.google.gwt; org.overlord.dtgov; | 2,189,994 |
public void updateDouble(String columnName, double x) throws SQLException {
updateDouble(findColumn(columnName), x);
} | void function(String columnName, double x) throws SQLException { updateDouble(findColumn(columnName), x); } | /**
* JDBC 2.0 Update a column with a double value. The updateXXX() methods are
* used to update column values in the current row, or the insert row. The
* updateXXX() methods do not update the underlying database, instead the
* updateRow() or insertRow() methods are called to update the database.
*
* @param columnName
* the name of the column
* @param x
* the new column value
*
* @exception SQLException
* if a database-access error occurs
*/ | JDBC 2.0 Update a column with a double value. The updateXXX() methods are used to update column values in the current row, or the insert row. The updateXXX() methods do not update the underlying database, instead the updateRow() or insertRow() methods are called to update the database | updateDouble | {
"repo_name": "mwaylabs/mysql-connector-j",
"path": "src/com/mysql/jdbc/ResultSetImpl.java",
"license": "gpl-2.0",
"size": 288724
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,180,257 |
protected Map<String, Object> searchAPIsByURLPattern(Registry registry, String searchTerm, int start, int end)
throws APIManagementException {
return APIUtil.searchAPIsByURLPattern(registry, searchTerm, start, end);
} | Map<String, Object> function(Registry registry, String searchTerm, int start, int end) throws APIManagementException { return APIUtil.searchAPIsByURLPattern(registry, searchTerm, start, end); } | /**
* To search API With URL pattern
* @param registry Registry to search.
* @param searchTerm Term to be searched.
* @param start Start index
* @param end End index.
* @return All the APIs, that matches given criteria
* @throws APIManagementException API Management Exception.
*/ | To search API With URL pattern | searchAPIsByURLPattern | {
"repo_name": "pubudu538/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AbstractAPIManager.java",
"license": "apache-2.0",
"size": 165292
} | [
"java.util.Map",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.impl.utils.APIUtil",
"org.wso2.carbon.registry.core.Registry"
] | import java.util.Map; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.impl.utils.APIUtil; import org.wso2.carbon.registry.core.Registry; | import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.impl.utils.*; import org.wso2.carbon.registry.core.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 223,686 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.