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
@SuppressWarnings("unused") private int readFileContents (ByteBuffer buffer) { try { buffer.rewind(); return fileChannel.read(buffer); } catch (IOException e) { e.printStackTrace(); } return 0; }
@SuppressWarnings(STR) int function (ByteBuffer buffer) { try { buffer.rewind(); return fileChannel.read(buffer); } catch (IOException e) { e.printStackTrace(); } return 0; }
/** * Called by jni to fill in the file buffer. * * @param buffer The buffer that needs to be filled * @return The amount that has been filled into the buffer. */
Called by jni to fill in the file buffer
readFileContents
{ "repo_name": "codepoke/gdx-video", "path": "gdx-video-desktop/src/com/badlogic/gdx/video/VideoPlayerDesktop.java", "license": "apache-2.0", "size": 9283 }
[ "java.io.IOException", "java.nio.ByteBuffer" ]
import java.io.IOException; import java.nio.ByteBuffer;
import java.io.*; import java.nio.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
1,885,888
public Response deleteFolder(String folderId) { return given() // .urlEncodingEnabled(false) // in case of OS call .when() // .delete("/api/folders/{folderId}", folderId); }
Response function(String folderId) { return given() .when() }
/** * Delete a new folder. * * @param folderId the folder id to delete. * @return the response. */
Delete a new folder
deleteFolder
{ "repo_name": "Talend/data-prep", "path": "dataprep-api/src/test/java/org/talend/dataprep/helper/OSDataPrepAPIHelper.java", "license": "apache-2.0", "size": 23380 }
[ "com.jayway.restassured.response.Response" ]
import com.jayway.restassured.response.Response;
import com.jayway.restassured.response.*;
[ "com.jayway.restassured" ]
com.jayway.restassured;
1,346,984
private static String[] splitComponents(String str) { List<String> l = new ArrayList<>(); int last = 0; int depth = 0; char[] chars = str.toCharArray(); for (int i = 0; i < chars.length; i++) { switch (chars[i]) { case '(': depth++; break; case ')': depth--; break; case ',': if (depth == 0) { String s = str.substring(last, i); l.add(s); last = i + 1; } break; default: } } String s = str.substring(last); if (s.length() != 0) { l.add(s); } String[] rc = new String[l.size()]; l.toArray(rc); return rc; }
static String[] function(String str) { List<String> l = new ArrayList<>(); int last = 0; int depth = 0; char[] chars = str.toCharArray(); for (int i = 0; i < chars.length; i++) { switch (chars[i]) { case '(': depth++; break; case ')': depth--; break; case ',': if (depth == 0) { String s = str.substring(last, i); l.add(s); last = i + 1; } break; default: } } String s = str.substring(last); if (s.length() != 0) { l.add(s); } String[] rc = new String[l.size()]; l.toArray(rc); return rc; }
/** * Given the inner portion of a composite URI, split and return each inner URI as a string * element in a new String array. * * @param str The inner URI elements of a composite URI string. * @return an array containing each inner URI from the composite one. */
Given the inner portion of a composite URI, split and return each inner URI as a string element in a new String array
splitComponents
{ "repo_name": "lburgazzoli/apache-activemq-artemis", "path": "artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java", "license": "apache-2.0", "size": 20311 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,354,060
private void parseFnt(InputStream fntFile) throws SlickException { if (displayListCaching) { int dlBase = GL.glGenLists(LINE_CACHE_SIZE); for (int i=0;i<LINE_CACHE_SIZE;i++) { cache.add(new CachedString(dlBase+i)); } } try { // now parse the font file BufferedReader in = new BufferedReader(new InputStreamReader(fntFile)); String info = in.readLine(); String common = in.readLine(); String page = in.readLine(); boolean done = false; while (!done) { String line = in.readLine(); if (line == null) { done = true; } else { if (line.startsWith("chars c")) { // ignore } else if (line.startsWith("char")) { CharDef def = parseChar(line); chars[def.id] = def; } if (line.startsWith("kernings c")) { // ignore } else if (line.startsWith("kerning")) { StringTokenizer tokens = new StringTokenizer(line," ="); tokens.nextToken(); // kerning tokens.nextToken(); // first int first = Integer.parseInt(tokens.nextToken()); // first value tokens.nextToken(); // second int second = Integer.parseInt(tokens.nextToken()); // second value tokens.nextToken(); // offset int offset = Integer.parseInt(tokens.nextToken()); // offset value setKerning(first, second, offset); } } } } catch (IOException e) { Log.error(e); throw new SlickException("Failed to parse font file: "+fntFile); } }
void function(InputStream fntFile) throws SlickException { if (displayListCaching) { int dlBase = GL.glGenLists(LINE_CACHE_SIZE); for (int i=0;i<LINE_CACHE_SIZE;i++) { cache.add(new CachedString(dlBase+i)); } } try { BufferedReader in = new BufferedReader(new InputStreamReader(fntFile)); String info = in.readLine(); String common = in.readLine(); String page = in.readLine(); boolean done = false; while (!done) { String line = in.readLine(); if (line == null) { done = true; } else { if (line.startsWith(STR)) { } else if (line.startsWith("char")) { CharDef def = parseChar(line); chars[def.id] = def; } if (line.startsWith(STR)) { } else if (line.startsWith(STR)) { StringTokenizer tokens = new StringTokenizer(line,STR); tokens.nextToken(); tokens.nextToken(); int first = Integer.parseInt(tokens.nextToken()); tokens.nextToken(); int second = Integer.parseInt(tokens.nextToken()); tokens.nextToken(); int offset = Integer.parseInt(tokens.nextToken()); setKerning(first, second, offset); } } } } catch (IOException e) { Log.error(e); throw new SlickException(STR+fntFile); } }
/** * Parse the font definition file * * @param fntFile The stream from which the font file can be read * @throws SlickException */
Parse the font definition file
parseFnt
{ "repo_name": "SenshiSentou/SourceFight", "path": "slick_dev/tags/Slick0.19/src/org/newdawn/slick/AngelCodeFont.java", "license": "bsd-2-clause", "size": 14702 }
[ "java.io.BufferedReader", "java.io.IOException", "java.io.InputStream", "java.io.InputStreamReader", "java.util.StringTokenizer", "org.newdawn.slick.util.Log" ]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; import org.newdawn.slick.util.Log;
import java.io.*; import java.util.*; import org.newdawn.slick.util.*;
[ "java.io", "java.util", "org.newdawn.slick" ]
java.io; java.util; org.newdawn.slick;
884,363
public List<BigDecimal> setsAggregated(WellSetBigInteger set, MathContext mc) { Preconditions.checkNotNull(set, "The well set cannot be null."); List<BigDecimal> aggregated = new ArrayList<BigDecimal>(); for (WellBigInteger well : set) { aggregated.addAll(well.toBigDecimal()); } return calculate(aggregated, mc); }
List<BigDecimal> function(WellSetBigInteger set, MathContext mc) { Preconditions.checkNotNull(set, STR); List<BigDecimal> aggregated = new ArrayList<BigDecimal>(); for (WellBigInteger well : set) { aggregated.addAll(well.toBigDecimal()); } return calculate(aggregated, mc); }
/** * Returns the aggregated statistic for the well set. * @param WellSetBigInteger the well set * @param MathContext the math context * @return the aggregated result */
Returns the aggregated statistic for the well set
setsAggregated
{ "repo_name": "jessemull/MicroFlex", "path": "src/main/java/com/github/jessemull/microflex/bigintegerflex/stat/DescriptiveStatisticListBigIntegerContext.java", "license": "apache-2.0", "size": 24705 }
[ "com.github.jessemull.microflex.bigintegerflex.plate.WellBigInteger", "com.github.jessemull.microflex.bigintegerflex.plate.WellSetBigInteger", "com.google.common.base.Preconditions", "java.math.BigDecimal", "java.math.MathContext", "java.util.ArrayList", "java.util.List" ]
import com.github.jessemull.microflex.bigintegerflex.plate.WellBigInteger; import com.github.jessemull.microflex.bigintegerflex.plate.WellSetBigInteger; import com.google.common.base.Preconditions; import java.math.BigDecimal; import java.math.MathContext; import java.util.ArrayList; import java.util.List;
import com.github.jessemull.microflex.bigintegerflex.plate.*; import com.google.common.base.*; import java.math.*; import java.util.*;
[ "com.github.jessemull", "com.google.common", "java.math", "java.util" ]
com.github.jessemull; com.google.common; java.math; java.util;
2,539,359
public static MixtureMultivariateGaussianDistribution create(double[] weights, double[][] means, double[][][] covariances) { // Validate inputs double sum = 0; final int numComp = weights.length; final int dim = means[0].length; final MultivariateGaussianDistribution[] distributions = new MultivariateGaussianDistribution[numComp]; for (int i = 0; i < numComp; i++) { final double w = weights[i]; ValidationUtils.checkPositive(w, "weight"); sum += w; final int dim2 = means[i].length; ValidationUtils.checkArgument(dim == dim2, "Incorrect size mean on component %d: ", i, dim); distributions[i] = new MultivariateGaussianDistribution(means[i], covariances[i]); } // Check for overflow. ValidationUtils.checkArgument(Double.isFinite(sum), "sum of weights is infinite"); // Store normalised weights. final double[] normWeights = new double[numComp]; for (int i = 0; i < numComp; i++) { normWeights[i] = weights[i] / sum; } return new MixtureMultivariateGaussianDistribution(normWeights, distributions); }
static MixtureMultivariateGaussianDistribution function(double[] weights, double[][] means, double[][][] covariances) { double sum = 0; final int numComp = weights.length; final int dim = means[0].length; final MultivariateGaussianDistribution[] distributions = new MultivariateGaussianDistribution[numComp]; for (int i = 0; i < numComp; i++) { final double w = weights[i]; ValidationUtils.checkPositive(w, STR); sum += w; final int dim2 = means[i].length; ValidationUtils.checkArgument(dim == dim2, STR, i, dim); distributions[i] = new MultivariateGaussianDistribution(means[i], covariances[i]); } ValidationUtils.checkArgument(Double.isFinite(sum), STR); final double[] normWeights = new double[numComp]; for (int i = 0; i < numComp; i++) { normWeights[i] = weights[i] / sum; } return new MixtureMultivariateGaussianDistribution(normWeights, distributions); }
/** * Creates a multivariate Gaussian mixture distribution. * * @param weights weights of each component * @param means means for each component * @param covariances covariance matrix for each component * @return the mixture multivariate gaussian distribution * @throws IllegalArgumentException if the arrays length are inconsistent, if the sum of the * weights is infinite, or if the inverse cannot be performed on the provided covariance * matrix (the matrix is singular). */
Creates a multivariate Gaussian mixture distribution
create
{ "repo_name": "aherbert/GDSC-SMLM", "path": "src/main/java/uk/ac/sussex/gdsc/smlm/math3/distribution/fitting/MultivariateGaussianMixtureExpectationMaximization.java", "license": "gpl-3.0", "size": 37987 }
[ "uk.ac.sussex.gdsc.core.utils.ValidationUtils", "uk.ac.sussex.gdsc.smlm.math3.distribution.fitting.MultivariateGaussianMixtureExpectationMaximization" ]
import uk.ac.sussex.gdsc.core.utils.ValidationUtils; import uk.ac.sussex.gdsc.smlm.math3.distribution.fitting.MultivariateGaussianMixtureExpectationMaximization;
import uk.ac.sussex.gdsc.core.utils.*; import uk.ac.sussex.gdsc.smlm.math3.distribution.fitting.*;
[ "uk.ac.sussex" ]
uk.ac.sussex;
1,308,793
public void checkDrawOverlayPermission() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (!Settings.canDrawOverlays(this)) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())); startActivityForResult(intent, OVERLAY_REQUEST_CODE); } else { goToNextActivity(2000L); } } else { goToNextActivity(2000L); } }
void function() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (!Settings.canDrawOverlays(this)) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse(STR + getPackageName())); startActivityForResult(intent, OVERLAY_REQUEST_CODE); } else { goToNextActivity(2000L); } } else { goToNextActivity(2000L); } }
/** * Checks for draw overlay permissions. Required on higher levels of Android. */
Checks for draw overlay permissions. Required on higher levels of Android
checkDrawOverlayPermission
{ "repo_name": "NEU-TEAM/JARVIS", "path": "src/android_foo/control_app/src/main/java/com/robotca/ControlApp/SplashActivity.java", "license": "mit", "size": 2754 }
[ "android.content.Intent", "android.net.Uri", "android.os.Build", "android.provider.Settings" ]
import android.content.Intent; import android.net.Uri; import android.os.Build; import android.provider.Settings;
import android.content.*; import android.net.*; import android.os.*; import android.provider.*;
[ "android.content", "android.net", "android.os", "android.provider" ]
android.content; android.net; android.os; android.provider;
1,375,505
@Override public String toString() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.DEFAULT_STYLE); }
String function() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.DEFAULT_STYLE); }
/** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * */
Generates a String representation of the contents of this type. This is an extension method, produced by the 'ts' xjc plugin
toString
{ "repo_name": "fpompermaier/onvif", "path": "onvif-ws-client/src/main/java/org/onvif/ver10/schema/TrackInformation.java", "license": "apache-2.0", "size": 6894 }
[ "org.apache.commons.lang3.builder.ToStringBuilder", "org.apache.cxf.xjc.runtime.JAXBToStringStyle" ]
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.cxf.xjc.runtime.JAXBToStringStyle;
import org.apache.commons.lang3.builder.*; import org.apache.cxf.xjc.runtime.*;
[ "org.apache.commons", "org.apache.cxf" ]
org.apache.commons; org.apache.cxf;
567,138
public static RequestManager with(Fragment fragment) { return getRetriever(fragment.getActivity()).get(fragment); }
static RequestManager function(Fragment fragment) { return getRetriever(fragment.getActivity()).get(fragment); }
/** * Begin a load with Glide that will be tied to the given * {@link android.support.v4.app.Fragment}'s lifecycle and that uses the given * {@link android.support.v4.app.Fragment}'s default options. * * @param fragment The fragment to use. * @return A RequestManager for the given Fragment that can be used to start a load. */
Begin a load with Glide that will be tied to the given <code>android.support.v4.app.Fragment</code>'s lifecycle and that uses the given <code>android.support.v4.app.Fragment</code>'s default options
with
{ "repo_name": "weiwenqiang/GitHub", "path": "expert/glide/library/src/main/java/com/bumptech/glide/Glide.java", "license": "apache-2.0", "size": 33216 }
[ "android.support.v4.app.Fragment" ]
import android.support.v4.app.Fragment;
import android.support.v4.app.*;
[ "android.support" ]
android.support;
1,879,043
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix) { int matrixWidgth = matrix.getWidth(); int matrixHeight = matrix.getHeight(); BitMatrix output = new BitMatrix(matrixWidgth, matrixHeight); output.clear(); for (int i = 0; i < matrixWidgth; i++) { for (int j = 0; j < matrixHeight; j++) { // Zero is white in the bytematrix if (matrix.get(i, j) == 1) { output.set(i, j); } } } return output; }
static BitMatrix function(ByteMatrix matrix) { int matrixWidgth = matrix.getWidth(); int matrixHeight = matrix.getHeight(); BitMatrix output = new BitMatrix(matrixWidgth, matrixHeight); output.clear(); for (int i = 0; i < matrixWidgth; i++) { for (int j = 0; j < matrixHeight; j++) { if (matrix.get(i, j) == 1) { output.set(i, j); } } } return output; }
/** * Convert the ByteMatrix to BitMatrix. * * @param matrix The input matrix. * @return The output matrix. */
Convert the ByteMatrix to BitMatrix
convertByteMatrixToBitMatrix
{ "repo_name": "china-zhuangxuxin/LKFramework", "path": "lichkin-framework-android/google-zxing-20170626/src/com/google/zxing/datamatrix/DataMatrixWriter.java", "license": "mit", "size": 5984 }
[ "com.google.zxing.common.BitMatrix", "com.google.zxing.qrcode.encoder.ByteMatrix" ]
import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.encoder.ByteMatrix;
import com.google.zxing.common.*; import com.google.zxing.qrcode.encoder.*;
[ "com.google.zxing" ]
com.google.zxing;
1,090,260
public static File getRunnerJar( String baseDir, String user, String groupId, String artifactId, String version, String commitId ) { File runnerJar = new File( baseDir ); runnerJar = new File( runnerJar, user ); runnerJar = new File( runnerJar, groupId ); runnerJar = new File( runnerJar, artifactId ); runnerJar = new File( runnerJar, version ); runnerJar = new File( runnerJar, commitId ); runnerJar = new File( runnerJar, Constants.RUNNER_JAR ); return runnerJar; }
static File function( String baseDir, String user, String groupId, String artifactId, String version, String commitId ) { File runnerJar = new File( baseDir ); runnerJar = new File( runnerJar, user ); runnerJar = new File( runnerJar, groupId ); runnerJar = new File( runnerJar, artifactId ); runnerJar = new File( runnerJar, version ); runnerJar = new File( runnerJar, commitId ); runnerJar = new File( runnerJar, Constants.RUNNER_JAR ); return runnerJar; }
/** * File storage scheme: * * ${base_for_files}/${user}/${groupId}/${artifactId}/${version}/${commitId}/runner.jar * * @param baseDir base directory that contains all runner.jar files in above structure * @param user * @param groupId * @param artifactId * @param version * @param commitId * @return runner.jar related to the given parameters */
File storage scheme: ${base_for_files}/${user}/${groupId}/${artifactId}/${version}/${commitId}/runner.jar
getRunnerJar
{ "repo_name": "mdunker/usergrid", "path": "chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/CoordinatorUtils.java", "license": "apache-2.0", "size": 17020 }
[ "java.io.File", "org.apache.usergrid.chop.api.Constants" ]
import java.io.File; import org.apache.usergrid.chop.api.Constants;
import java.io.*; import org.apache.usergrid.chop.api.*;
[ "java.io", "org.apache.usergrid" ]
java.io; org.apache.usergrid;
214,408
return RandomStringUtils.randomAlphanumeric(DEF_COUNT); }
return RandomStringUtils.randomAlphanumeric(DEF_COUNT); }
/** * Generates a password. * * @return the generated password */
Generates a password
generatePassword
{ "repo_name": "swainsoftware/salvo", "path": "src/main/java/com/notman/service/util/RandomUtil.java", "license": "gpl-3.0", "size": 882 }
[ "org.apache.commons.lang.RandomStringUtils" ]
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
1,119,364
public void getCustomMonitoringData(io.grpc.instrumentation.v1alpha.MonitoringDataGroup request, io.grpc.stub.StreamObserver<io.grpc.instrumentation.v1alpha.CustomMonitoringData> responseObserver) { asyncUnaryCall( getChannel().newCall(getGetCustomMonitoringDataMethod(), getCallOptions()), request, responseObserver); } } public static final class MonitoringBlockingStub extends io.grpc.stub.AbstractStub<MonitoringBlockingStub> { private MonitoringBlockingStub(io.grpc.Channel channel) { super(channel); } private MonitoringBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); }
void function(io.grpc.instrumentation.v1alpha.MonitoringDataGroup request, io.grpc.stub.StreamObserver<io.grpc.instrumentation.v1alpha.CustomMonitoringData> responseObserver) { asyncUnaryCall( getChannel().newCall(getGetCustomMonitoringDataMethod(), getCallOptions()), request, responseObserver); } } public static final class MonitoringBlockingStub extends io.grpc.stub.AbstractStub<MonitoringBlockingStub> { private MonitoringBlockingStub(io.grpc.Channel channel) { super(channel); } private MonitoringBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); }
/** * <pre> * Return application-defined groups of monitoring data. * This is a low level facility to allow extension of the monitoring API to * application-specific monitoring data. Frameworks may use this to define * additional groups of monitoring data made available by servers. * </pre> */
<code> Return application-defined groups of monitoring data. This is a low level facility to allow extension of the monitoring API to application-specific monitoring data. Frameworks may use this to define additional groups of monitoring data made available by servers. </code>
getCustomMonitoringData
{ "repo_name": "rmichela/grpc-java", "path": "services/src/generated/main/grpc/io/grpc/instrumentation/v1alpha/MonitoringGrpc.java", "license": "apache-2.0", "size": 29215 }
[ "io.grpc.stub.ClientCalls", "io.grpc.stub.ServerCalls" ]
import io.grpc.stub.ClientCalls; import io.grpc.stub.ServerCalls;
import io.grpc.stub.*;
[ "io.grpc.stub" ]
io.grpc.stub;
699,413
public void verticalBlurTransp(int[] originalPixels, int[] blurredPixels, Dimension dim) { int width = dim.width; int height = dim.height; int sourcePosition, destPosition, rgb1, rgb2, tr, tg, tb, pixelCount, alpha; for (int i = 0; i < width; i++) { sourcePosition = i * height; destPosition = (width - 1) - i; tr = 0; tg = 0; tb = 0; alpha = 0; for (int j = 0; j <= radius; j++) { rgb1 = originalPixels[sourcePosition + j]; tr += ((rgb1 & 0xff0000) >> 16); tg += ((rgb1 & 0x00ff00) >> 8); tb += (rgb1 & 0xff); alpha += ((rgb1 & 0xff000000) >> 24); } pixelCount = radius + 1; blurredPixels[destPosition] = ((alpha / pixelCount) << 24) | ((tr / pixelCount) << 16) | ((tg / pixelCount) << 8) | (tb / pixelCount); sourcePosition++; destPosition += width; pixelCount++; for (int j = 1; j <= radius; j++, sourcePosition++, destPosition += width, pixelCount++) { rgb1 = originalPixels[sourcePosition + radius]; tr += ((rgb1 & 0xff0000) >> 16); tg += ((rgb1 & 0x00ff00) >> 8); tb += (rgb1 & 0xff); alpha += ((rgb1 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) | ((tr / pixelCount) << 16) | ((tg / pixelCount) << 8) | (tb / pixelCount); } pixelCount--; for (int j = radius + 1; j < height - radius; j++, sourcePosition++, destPosition += width) { rgb1 = originalPixels[sourcePosition + radius]; rgb2 = originalPixels[sourcePosition - radius - 1]; tr += (((rgb1 & 0xff0000) - (rgb2 & 0xff0000)) >> 16); tg += (((rgb1 & 0x00ff00) - (rgb2 & 0x00ff00)) >> 8); tb += ((rgb1 & 0xff) - (rgb2 & 0xff)); alpha += ((rgb1 & 0xff000000) >> 24) - ((rgb2 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) | ((tr / pixelCount) << 16) | ((tg / pixelCount) << 8) | (tb / pixelCount); } pixelCount--; for (int j = height - radius; j < height; j++, sourcePosition++, destPosition += width, pixelCount--) { rgb2 = originalPixels[sourcePosition - radius - 1]; tr -= ((rgb2 & 0xff0000) >> 16); tg -= ((rgb2 & 0x00ff00) >> 8); tb -= (rgb2 & 0xff); alpha -= ((rgb2 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) | ((tr / pixelCount) << 16) | ((tg / pixelCount) << 8) | (tb / pixelCount); } } }
void function(int[] originalPixels, int[] blurredPixels, Dimension dim) { int width = dim.width; int height = dim.height; int sourcePosition, destPosition, rgb1, rgb2, tr, tg, tb, pixelCount, alpha; for (int i = 0; i < width; i++) { sourcePosition = i * height; destPosition = (width - 1) - i; tr = 0; tg = 0; tb = 0; alpha = 0; for (int j = 0; j <= radius; j++) { rgb1 = originalPixels[sourcePosition + j]; tr += ((rgb1 & 0xff0000) >> 16); tg += ((rgb1 & 0x00ff00) >> 8); tb += (rgb1 & 0xff); alpha += ((rgb1 & 0xff000000) >> 24); } pixelCount = radius + 1; blurredPixels[destPosition] = ((alpha / pixelCount) << 24) ((tr / pixelCount) << 16) ((tg / pixelCount) << 8) (tb / pixelCount); sourcePosition++; destPosition += width; pixelCount++; for (int j = 1; j <= radius; j++, sourcePosition++, destPosition += width, pixelCount++) { rgb1 = originalPixels[sourcePosition + radius]; tr += ((rgb1 & 0xff0000) >> 16); tg += ((rgb1 & 0x00ff00) >> 8); tb += (rgb1 & 0xff); alpha += ((rgb1 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) ((tr / pixelCount) << 16) ((tg / pixelCount) << 8) (tb / pixelCount); } pixelCount--; for (int j = radius + 1; j < height - radius; j++, sourcePosition++, destPosition += width) { rgb1 = originalPixels[sourcePosition + radius]; rgb2 = originalPixels[sourcePosition - radius - 1]; tr += (((rgb1 & 0xff0000) - (rgb2 & 0xff0000)) >> 16); tg += (((rgb1 & 0x00ff00) - (rgb2 & 0x00ff00)) >> 8); tb += ((rgb1 & 0xff) - (rgb2 & 0xff)); alpha += ((rgb1 & 0xff000000) >> 24) - ((rgb2 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) ((tr / pixelCount) << 16) ((tg / pixelCount) << 8) (tb / pixelCount); } pixelCount--; for (int j = height - radius; j < height; j++, sourcePosition++, destPosition += width, pixelCount--) { rgb2 = originalPixels[sourcePosition - radius - 1]; tr -= ((rgb2 & 0xff0000) >> 16); tg -= ((rgb2 & 0x00ff00) >> 8); tb -= (rgb2 & 0xff); alpha -= ((rgb2 & 0xff000000) >> 24); blurredPixels[destPosition] = ((alpha / pixelCount) << 24) ((tr / pixelCount) << 16) ((tg / pixelCount) << 8) (tb / pixelCount); } } }
/** * Perform the vertical blur while handling transparency and the alpha * channel. * * @param originalPixels Original image raster. * @param blurredPixels Blurred image raster. * @param dim Dimension object. */
Perform the vertical blur while handling transparency and the alpha channel
verticalBlurTransp
{ "repo_name": "datapoet/hubminer", "path": "src/main/java/draw/basic/BoxBlur.java", "license": "gpl-3.0", "size": 15056 }
[ "java.awt.Dimension" ]
import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
72,050
List<ContentResultVO> result = new ArrayList<ContentResultVO>(); for (SearchResultEntry searchResultEntry : searchResultEntries) { ContentResultVO contentResultVO = new ContentResultVO(); contentResultVO.setLink(urlUtils.toURL(searchResultEntry.urlEntity)); // TODO Future - Not just first description contentResultVO.setDescription(searchResultEntry.description.get(0)); result.add(contentResultVO); } return result; }
List<ContentResultVO> result = new ArrayList<ContentResultVO>(); for (SearchResultEntry searchResultEntry : searchResultEntries) { ContentResultVO contentResultVO = new ContentResultVO(); contentResultVO.setLink(urlUtils.toURL(searchResultEntry.urlEntity)); contentResultVO.setDescription(searchResultEntry.description.get(0)); result.add(contentResultVO); } return result; }
/** * Populate a list of content result. * * @param searchResultEntries * @return the list of results */
Populate a list of content result
populate
{ "repo_name": "provirus/tinyapps", "path": "FreenetKnowledge/src/main/java/ca/pgon/freenetknowledge/web/knowledge/vo/populator/ContentResultVOPopulator.java", "license": "apache-2.0", "size": 1478 }
[ "ca.pgon.freenetknowledge.search.SearchResultEntry", "ca.pgon.freenetknowledge.web.knowledge.vo.ContentResultVO", "java.util.ArrayList", "java.util.List" ]
import ca.pgon.freenetknowledge.search.SearchResultEntry; import ca.pgon.freenetknowledge.web.knowledge.vo.ContentResultVO; import java.util.ArrayList; import java.util.List;
import ca.pgon.freenetknowledge.search.*; import ca.pgon.freenetknowledge.web.knowledge.vo.*; import java.util.*;
[ "ca.pgon.freenetknowledge", "java.util" ]
ca.pgon.freenetknowledge; java.util;
2,334,922
public Set<String> getTableNames() { return Collections.unmodifiableSet(tableMap.keySet()); }
Set<String> function() { return Collections.unmodifiableSet(tableMap.keySet()); }
/** * Returns an unmodifiable {@link Set} of table names. * * @return a {@link Set} of <code>Table</code> names. */
Returns an unmodifiable <code>Set</code> of table names
getTableNames
{ "repo_name": "DANS-KNAW/dans-dbf-lib", "path": "src/main/java/nl/knaw/dans/common/dbflib/Database.java", "license": "apache-2.0", "size": 7985 }
[ "java.util.Collections", "java.util.Set" ]
import java.util.Collections; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,852,385
public void writeToParcel(Parcel dest, int flags) { dest.writeString(activity); dest.writeString(cause); dest.writeString(info); }
void function(Parcel dest, int flags) { dest.writeString(activity); dest.writeString(cause); dest.writeString(info); }
/** * Save an AnrInfo instance to a parcel. */
Save an AnrInfo instance to a parcel
writeToParcel
{ "repo_name": "haikuowuya/android_system_code", "path": "src/android/app/ApplicationErrorReport.java", "license": "apache-2.0", "size": 18893 }
[ "android.os.Parcel" ]
import android.os.Parcel;
import android.os.*;
[ "android.os" ]
android.os;
240,146
public void setActionCommand(String command) { this.command = command; } private Action action; private PropertyChangeListener actionPropertyChangeListener;
void function(String command) { this.command = command; } private Action action; private PropertyChangeListener actionPropertyChangeListener;
/** * Sets the command string used for action events. * * @param command the command string */
Sets the command string used for action events
setActionCommand
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/javax/swing/JTextField.java", "license": "apache-2.0", "size": 36053 }
[ "java.beans.PropertyChangeListener" ]
import java.beans.PropertyChangeListener;
import java.beans.*;
[ "java.beans" ]
java.beans;
1,617,459
public Path getFilename() { return filename; } /** * Returns the source root (a directory) beneath which this package's BUILD file was found. * * <p> Assumes invariant: * {@code getSourceRoot().getRelative(packageId.getSourceRoot()).equals(getPackageDirectory())}
Path function() { return filename; } /** * Returns the source root (a directory) beneath which this package's BUILD file was found. * * <p> Assumes invariant: * {@code getSourceRoot().getRelative(packageId.getSourceRoot()).equals(getPackageDirectory())}
/** * Returns the filename of the BUILD file which defines this package. The * parent directory of the BUILD file is the package directory. */
Returns the filename of the BUILD file which defines this package. The parent directory of the BUILD file is the package directory
getFilename
{ "repo_name": "Asana/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/Package.java", "license": "apache-2.0", "size": 53148 }
[ "com.google.devtools.build.lib.vfs.Path" ]
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.*;
[ "com.google.devtools" ]
com.google.devtools;
2,673,628
public static Object getStateToBind (Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws NamingException { StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES, environment, nameCtx); while (tokens.hasMoreTokens ()) { String klassName = tokens.nextToken (); try { Class k = Class.forName (klassName, true, Thread.currentThread().getContextClassLoader()); StateFactory factory = (StateFactory) k.newInstance (); Object o = factory.getStateToBind (obj, name, nameCtx, environment); if (o != null) return o; } catch (ClassNotFoundException _1) { // Ignore it. } catch (ClassCastException _2) { // This means that the class we found was not an // ObjectFactory or that the factory returned something // which was not a Context. } catch (InstantiationException _3) { // If we couldn't instantiate the factory we might get // this. } catch (IllegalAccessException _4) { // Another possibility when instantiating. } } return obj; }
static Object function (Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws NamingException { StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES, environment, nameCtx); while (tokens.hasMoreTokens ()) { String klassName = tokens.nextToken (); try { Class k = Class.forName (klassName, true, Thread.currentThread().getContextClassLoader()); StateFactory factory = (StateFactory) k.newInstance (); Object o = factory.getStateToBind (obj, name, nameCtx, environment); if (o != null) return o; } catch (ClassNotFoundException _1) { } catch (ClassCastException _2) { } catch (InstantiationException _3) { } catch (IllegalAccessException _4) { } } return obj; }
/** * Get the object state for binding. * * @param obj the object, for that the binding state must be retrieved. Cannot * be null. * @param name the name of this object, related to the nameCtx. Can be null if * not specified. * @param nameCtx the naming context, to that the object name is related. Can * be null if the name is related to the initial default context. * @param environment the properties for creating the object state. Can be * null if no properties are provided. * @return the object state for binding, may be null if no changes are * returned by the factory * @throws NamingException */
Get the object state for binding
getStateToBind
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/naming/spi/NamingManager.java", "license": "gpl-2.0", "size": 25307 }
[ "java.util.Hashtable", "java.util.StringTokenizer", "javax.naming.Context", "javax.naming.Name", "javax.naming.NamingException" ]
import java.util.Hashtable; import java.util.StringTokenizer; import javax.naming.Context; import javax.naming.Name; import javax.naming.NamingException;
import java.util.*; import javax.naming.*;
[ "java.util", "javax.naming" ]
java.util; javax.naming;
1,327,525
public PropertyEditor getFieldEditor(String propertyName) { if (LOG.isDebugEnabled()) { LOG.debug("Attempting to find property editor for property '" + propertyName + "'"); } PropertyEditor propertyEditor = null; boolean requiresEncryption = false; if (fieldPropertyEditors != null && fieldPropertyEditors.containsKey(propertyName)) { propertyEditor = fieldPropertyEditors.get(propertyName); } else if (secureFieldPropertyEditors != null && secureFieldPropertyEditors.containsKey(propertyName)) { propertyEditor = secureFieldPropertyEditors.get(propertyName); requiresEncryption = true; } if (propertyEditor != null) { if (LOG.isDebugEnabled()) { LOG.debug( "Registering custom editor for property path '" + propertyName + "' and property editor class '" + propertyEditor.getClass().getName() + "'"); } if (requiresEncryption) { if (LOG.isDebugEnabled()) { LOG.debug("Enabling encryption for custom editor '" + propertyName + "' and property editor class '" + propertyEditor.getClass().getName() + "'"); } return new UifEncryptionPropertyEditorWrapper(propertyEditor); } } return propertyEditor; }
PropertyEditor function(String propertyName) { if (LOG.isDebugEnabled()) { LOG.debug(STR + propertyName + "'"); } PropertyEditor propertyEditor = null; boolean requiresEncryption = false; if (fieldPropertyEditors != null && fieldPropertyEditors.containsKey(propertyName)) { propertyEditor = fieldPropertyEditors.get(propertyName); } else if (secureFieldPropertyEditors != null && secureFieldPropertyEditors.containsKey(propertyName)) { propertyEditor = secureFieldPropertyEditors.get(propertyName); requiresEncryption = true; } if (propertyEditor != null) { if (LOG.isDebugEnabled()) { LOG.debug( STR + propertyName + STR + propertyEditor.getClass().getName() + "'"); } if (requiresEncryption) { if (LOG.isDebugEnabled()) { LOG.debug(STR + propertyName + STR + propertyEditor.getClass().getName() + "'"); } return new UifEncryptionPropertyEditorWrapper(propertyEditor); } } return propertyEditor; }
/** * Look up a field editor. * * @param propertyName name of the property to find field and editor for */
Look up a field editor
getFieldEditor
{ "repo_name": "ricepanda/rice", "path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/uif/lifecycle/ViewPostMetadata.java", "license": "apache-2.0", "size": 21036 }
[ "java.beans.PropertyEditor", "org.kuali.rice.krad.web.bind.UifEncryptionPropertyEditorWrapper" ]
import java.beans.PropertyEditor; import org.kuali.rice.krad.web.bind.UifEncryptionPropertyEditorWrapper;
import java.beans.*; import org.kuali.rice.krad.web.bind.*;
[ "java.beans", "org.kuali.rice" ]
java.beans; org.kuali.rice;
1,859,241
@Test(expected = ValidationException.class) public void failsValidationOnIncorrectlyFormattedFile() throws Exception { final Environment env = new Environment.Mock() .withFile( "src/main/resources/almost-valid.xml", // @checkstyle LineLength (1 line) "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document xmlns=\"http://maven.apache.org/changes/1.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd\"><body/></document>" ); final Validator validator = new XmlValidator(true); validator.validate(env); }
@Test(expected = ValidationException.class) void function() throws Exception { final Environment env = new Environment.Mock() .withFile( STR, STR1.0\STRUTF-8\STRhttp: ); final Validator validator = new XmlValidator(true); validator.validate(env); }
/** * Should fail validation on incorrectly formatted file. * @throws Exception If something wrong happens inside. */
Should fail validation on incorrectly formatted file
failsValidationOnIncorrectlyFormattedFile
{ "repo_name": "vkuchyn/qulice", "path": "qulice-xml/src/test/java/com/qulice/xml/XmlValidatorTest.java", "license": "bsd-3-clause", "size": 13925 }
[ "com.qulice.spi.Environment", "com.qulice.spi.ValidationException", "com.qulice.spi.Validator", "org.junit.Test" ]
import com.qulice.spi.Environment; import com.qulice.spi.ValidationException; import com.qulice.spi.Validator; import org.junit.Test;
import com.qulice.spi.*; import org.junit.*;
[ "com.qulice.spi", "org.junit" ]
com.qulice.spi; org.junit;
1,964,184
Properties props = new Properties(); // Adjust sort buffer size to trigger the bug situation with less data. props.setProperty("derby.storage.sortBufferMax", "4"); BaseTestSuite suite = new BaseTestSuite(LobSortTest.class, "LobSortTestEmbedded"); return new CleanDatabaseTestSetup( new SystemPropertyTestSetup(suite, props, true)) { protected void decorateSQL(Statement s) throws SQLException { Random rnd = new Random(SEED); Connection con = s.getConnection(); con.setAutoCommit(false); s.executeUpdate("create table MIXED_LOBS (" + "c clob, clen int, b blob, blen int, rnd int)"); PreparedStatement ps = con.prepareStatement( "insert into MIXED_LOBS values (?,?,?,?,?)"); // Make sure we get at least one zero-length CLOB and BLOB. ps.setString(1, ""); ps.setInt(2, 0); ps.setBytes(3, new byte[0]); ps.setInt(4, 0); ps.setInt(5, rnd.nextInt()); ps.executeUpdate(); for (int i=0; i < 100; i++) { CharAlphabet ca = getCharAlphabet(1 + rnd.nextInt(3)); int length = (int)(rnd.nextDouble() * 64.0 * 1024.0); if (rnd.nextInt(1000) < 500) { // Specify the length. ps.setCharacterStream( 1, new LoopingAlphabetReader(length, ca), length); } else { // Don't specify the length. ps.setCharacterStream(1, new LoopingAlphabetReader(length, ca)); } ps.setInt(2, length); length = (int)(rnd.nextDouble() * 64.0 * 1024.0); if (rnd.nextInt(1000) < 500) { // Specify the length. ps.setBinaryStream(3, new LoopingAlphabetStream(length), length); } else { // Don't specify the length. ps.setBinaryStream(3, new LoopingAlphabetStream(length)); } ps.setInt(4, length); ps.setInt(5, rnd.nextInt()); ps.executeUpdate(); } con.commit(); ps.close(); }
Properties props = new Properties(); props.setProperty(STR, "4"); BaseTestSuite suite = new BaseTestSuite(LobSortTest.class, STR); return new CleanDatabaseTestSetup( new SystemPropertyTestSetup(suite, props, true)) { void function(Statement s) throws SQLException { Random rnd = new Random(SEED); Connection con = s.getConnection(); con.setAutoCommit(false); s.executeUpdate(STR + STR); PreparedStatement ps = con.prepareStatement( STR); ps.setString(1, ""); ps.setInt(2, 0); ps.setBytes(3, new byte[0]); ps.setInt(4, 0); ps.setInt(5, rnd.nextInt()); ps.executeUpdate(); for (int i=0; i < 100; i++) { CharAlphabet ca = getCharAlphabet(1 + rnd.nextInt(3)); int length = (int)(rnd.nextDouble() * 64.0 * 1024.0); if (rnd.nextInt(1000) < 500) { ps.setCharacterStream( 1, new LoopingAlphabetReader(length, ca), length); } else { ps.setCharacterStream(1, new LoopingAlphabetReader(length, ca)); } ps.setInt(2, length); length = (int)(rnd.nextDouble() * 64.0 * 1024.0); if (rnd.nextInt(1000) < 500) { ps.setBinaryStream(3, new LoopingAlphabetStream(length), length); } else { ps.setBinaryStream(3, new LoopingAlphabetStream(length)); } ps.setInt(4, length); ps.setInt(5, rnd.nextInt()); ps.executeUpdate(); } con.commit(); ps.close(); }
/** * Generates a table with Blob and Clobs of mixed size. */
Generates a table with Blob and Clobs of mixed size
decorateSQL
{ "repo_name": "trejkaz/derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/LobSortTest.java", "license": "apache-2.0", "size": 10460 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException", "java.sql.Statement", "java.util.Properties", "java.util.Random", "org.apache.derbyTesting.functionTests.util.streams.CharAlphabet", "org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader", "org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetStream", "org.apache.derbyTesting.junit.BaseTestSuite", "org.apache.derbyTesting.junit.CleanDatabaseTestSetup", "org.apache.derbyTesting.junit.SystemPropertyTestSetup" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import java.util.Random; import org.apache.derbyTesting.functionTests.util.streams.CharAlphabet; import org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader; import org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetStream; import org.apache.derbyTesting.junit.BaseTestSuite; import org.apache.derbyTesting.junit.CleanDatabaseTestSetup; import org.apache.derbyTesting.junit.SystemPropertyTestSetup;
import java.sql.*; import java.util.*; import org.apache.*;
[ "java.sql", "java.util", "org.apache" ]
java.sql; java.util; org.apache;
385,356
public static void assertWindowIds(Timeline timeline, Object... expectedWindowIds) { Window window = new Window(); assertEquals(expectedWindowIds.length, timeline.getWindowCount()); for (int i = 0; i < timeline.getWindowCount(); i++) { timeline.getWindow(i, window, true); if (expectedWindowIds[i] != null) { assertEquals(expectedWindowIds[i], window.id); } } }
static void function(Timeline timeline, Object... expectedWindowIds) { Window window = new Window(); assertEquals(expectedWindowIds.length, timeline.getWindowCount()); for (int i = 0; i < timeline.getWindowCount(); i++) { timeline.getWindow(i, window, true); if (expectedWindowIds[i] != null) { assertEquals(expectedWindowIds[i], window.id); } } }
/** * Asserts that window IDs are set correctly. * * @param expectedWindowIds A list of expected window IDs. If an ID is unknown or not important * {@code null} can be passed to skip this window. */
Asserts that window IDs are set correctly
assertWindowIds
{ "repo_name": "antoniodiraff/ExoPlayer_Library_0.1", "path": "testutils/src/main/java/com/google/android/exoplayer2/testutil/TimelineAsserts.java", "license": "apache-2.0", "size": 6076 }
[ "com.google.android.exoplayer2.Timeline", "junit.framework.Assert" ]
import com.google.android.exoplayer2.Timeline; import junit.framework.Assert;
import com.google.android.exoplayer2.*; import junit.framework.*;
[ "com.google.android", "junit.framework" ]
com.google.android; junit.framework;
2,733,895
protected void createCircuits(boolean isForGarbling) throws IOException { for (int i = 0; i < ccs.length; i++) { ccs[i].build(isForGarbling); } }
void function(boolean isForGarbling) throws IOException { for (int i = 0; i < ccs.length; i++) { ccs[i].build(isForGarbling); } }
/** * Recursively create the circuits and sub-circuits implementing the AES op. * @param isForGarbling * - True for a server instance (servers create the garbled circuits, clients evaluate them) * @throws IOException */
Recursively create the circuits and sub-circuits implementing the AES op
createCircuits
{ "repo_name": "factcenter/inchworm", "path": "src/main/java/org/factcenter/fastgc/inchworm/AesOpCommon.java", "license": "mit", "size": 15497 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,932,883
void receiveMessage(Protos.TwoWayChannelMessage msg) throws InsufficientMoneyException;
void receiveMessage(Protos.TwoWayChannelMessage msg) throws InsufficientMoneyException;
/** * Called when a message is received from the server. Processes the given message and generates events based on its * content. */
Called when a message is received from the server. Processes the given message and generates events based on its content
receiveMessage
{ "repo_name": "machado-rev/kobocoinj", "path": "core/src/main/java/com/bushstar/kobocoinj/protocols/channels/IPaymentChannelClient.java", "license": "apache-2.0", "size": 8007 }
[ "com.bushstar.kobocoinj.core.InsufficientMoneyException", "org.kobocoin.paymentchannel.Protos" ]
import com.bushstar.kobocoinj.core.InsufficientMoneyException; import org.kobocoin.paymentchannel.Protos;
import com.bushstar.kobocoinj.core.*; import org.kobocoin.paymentchannel.*;
[ "com.bushstar.kobocoinj", "org.kobocoin.paymentchannel" ]
com.bushstar.kobocoinj; org.kobocoin.paymentchannel;
2,525,632
protected boolean isPortletRequest(FacesContext context) { Object request = context.getExternalContext().getRequest(); Class clazz = request.getClass(); while (clazz != null) { // Does this class implement PortletRequest? Class interfaces[] = clazz.getInterfaces(); if (interfaces == null) { interfaces = new Class[0]; } for (int i = 0; i < interfaces.length; i++) { if ("javax.portlet.PortletRequest".equals (interfaces[i].getName())) { return (true); } } // Try our superclass (if any) clazz = clazz.getSuperclass(); } return (false); }
boolean function(FacesContext context) { Object request = context.getExternalContext().getRequest(); Class clazz = request.getClass(); while (clazz != null) { Class interfaces[] = clazz.getInterfaces(); if (interfaces == null) { interfaces = new Class[0]; } for (int i = 0; i < interfaces.length; i++) { if (STR.equals (interfaces[i].getName())) { return (true); } } clazz = clazz.getSuperclass(); } return (false); }
/** * <p>Return <code>true</code> if this is a portlet request instance. * NOTE: Implementation must not require portlet API classes to be * present.</p> * * @param context <code>FacesContext</code> for the current request */
Return <code>true</code> if this is a portlet request instance. present
isPortletRequest
{ "repo_name": "davcamer/clients", "path": "projects-for-testing/struts/faces/src/main/java/org/apache/struts/faces/renderer/BaseRenderer.java", "license": "apache-2.0", "size": 7680 }
[ "javax.faces.context.FacesContext" ]
import javax.faces.context.FacesContext;
import javax.faces.context.*;
[ "javax.faces" ]
javax.faces;
1,540,837
public static NodeProto findNodeProto(String line) { Technology tech = Technology.getCurrent(); Library lib = Library.getCurrent(); boolean saidtech = false; boolean saidlib = false; int colon = line.indexOf(':'); String withoutPrefix; if (colon == -1) { withoutPrefix = line; } else { String prefix = line.substring(0, colon); Technology t = Technology.findTechnology(prefix); if (t != null) { tech = t; saidtech = true; } Library l = Library.findLibrary(prefix); if (l != null) { lib = l; saidlib = true; } withoutPrefix = line.substring(colon + 1); } if (!saidlib) { PrimitiveNode np = tech.findNodeProto(withoutPrefix); if (np != null) { return np; } } if (!saidtech && lib != null) { Cell np = lib.findNodeProto(withoutPrefix); if (np != null) { return np; } } return null; }
static NodeProto function(String line) { Technology tech = Technology.getCurrent(); Library lib = Library.getCurrent(); boolean saidtech = false; boolean saidlib = false; int colon = line.indexOf(':'); String withoutPrefix; if (colon == -1) { withoutPrefix = line; } else { String prefix = line.substring(0, colon); Technology t = Technology.findTechnology(prefix); if (t != null) { tech = t; saidtech = true; } Library l = Library.findLibrary(prefix); if (l != null) { lib = l; saidlib = true; } withoutPrefix = line.substring(colon + 1); } if (!saidlib) { PrimitiveNode np = tech.findNodeProto(withoutPrefix); if (np != null) { return np; } } if (!saidtech && lib != null) { Cell np = lib.findNodeProto(withoutPrefix); if (np != null) { return np; } } return null; }
/** * Method to find the NodeProto with the given name. * This can be a PrimitiveNode (and can be prefixed by a Technology name), * or it can be a Cell (and be prefixed by a Library name). * @param line the name of the NodeProto. * @return the specified NodeProto, or null if none can be found. */
Method to find the NodeProto with the given name. This can be a PrimitiveNode (and can be prefixed by a Technology name), or it can be a Cell (and be prefixed by a Library name)
findNodeProto
{ "repo_name": "imr/Electric8", "path": "com/sun/electric/database/hierarchy/Cell.java", "license": "gpl-3.0", "size": 185659 }
[ "com.sun.electric.database.prototype.NodeProto", "com.sun.electric.technology.PrimitiveNode", "com.sun.electric.technology.Technology" ]
import com.sun.electric.database.prototype.NodeProto; import com.sun.electric.technology.PrimitiveNode; import com.sun.electric.technology.Technology;
import com.sun.electric.database.prototype.*; import com.sun.electric.technology.*;
[ "com.sun.electric" ]
com.sun.electric;
476,030
public Element pull(Document document, boolean normalize) { if (normalize) { document.normalizeDocument(); } return pull(document.getDocumentElement(), normalize); }
Element function(Document document, boolean normalize) { if (normalize) { document.normalizeDocument(); } return pull(document.getDocumentElement(), normalize); }
/** * Pulls the root element of a DOM document. * @param document the document * @param normalize whether or not to normalize the document * @return the element */
Pulls the root element of a DOM document
pull
{ "repo_name": "cunningt/switchyard", "path": "core/common/core/src/main/java/org/switchyard/common/io/pull/ElementPuller.java", "license": "apache-2.0", "size": 5299 }
[ "org.w3c.dom.Document", "org.w3c.dom.Element" ]
import org.w3c.dom.Document; import org.w3c.dom.Element;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
501,796
private void createIfNotExists(String tableName, String createTableStatement) throws SQLException { logger.entering(CLASSNAME, "createIfNotExists", new Object[] {tableName, createTableStatement}); Connection conn = getConnection(); DatabaseMetaData dbmd = conn.getMetaData(); ResultSet rs = dbmd.getTables(null, schema, tableName, null); PreparedStatement ps = null; if(!rs.next()) { logger.log(Level.INFO, tableName + " table does not exists. Trying to create it."); ps = conn.prepareStatement(createTableStatement); ps.executeUpdate(); } cleanupConnection(conn, rs, ps); logger.exiting(CLASSNAME, "createIfNotExists"); }
void function(String tableName, String createTableStatement) throws SQLException { logger.entering(CLASSNAME, STR, new Object[] {tableName, createTableStatement}); Connection conn = getConnection(); DatabaseMetaData dbmd = conn.getMetaData(); ResultSet rs = dbmd.getTables(null, schema, tableName, null); PreparedStatement ps = null; if(!rs.next()) { logger.log(Level.INFO, tableName + STR); ps = conn.prepareStatement(createTableStatement); ps.executeUpdate(); } cleanupConnection(conn, rs, ps); logger.exiting(CLASSNAME, STR); }
/** * Creates tableName using the createTableStatement DDL. * * @param tableName * @param createTableStatement * @throws SQLException */
Creates tableName using the createTableStatement DDL
createIfNotExists
{ "repo_name": "sidgoyal/standards.jsr352.jbatch", "path": "com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/services/impl/JDBCPersistenceManagerImpl.java", "license": "apache-2.0", "size": 76161 }
[ "java.sql.Connection", "java.sql.DatabaseMetaData", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.util.logging.Level" ]
import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level;
import java.sql.*; import java.util.logging.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
813,122
public void addPropertyChangeListener( PropertyChangeListener listener ) { this.pcs.addPropertyChangeListener( listener ); }
void function( PropertyChangeListener listener ) { this.pcs.addPropertyChangeListener( listener ); }
/** * Add a listener to all events * * @param listener * listener to add */
Add a listener to all events
addPropertyChangeListener
{ "repo_name": "Rubbiroid/VVIDE", "path": "src/vvide/project/Project.java", "license": "gpl-3.0", "size": 12475 }
[ "java.beans.PropertyChangeListener" ]
import java.beans.PropertyChangeListener;
import java.beans.*;
[ "java.beans" ]
java.beans;
2,376,086
public void setTotalAmountReleased(ScaleTwoDecimal totalAmountReleased) { this.totalAmountReleased = totalAmountReleased; }
void function(ScaleTwoDecimal totalAmountReleased) { this.totalAmountReleased = totalAmountReleased; }
/**. * This is the Setter Method for totalAmountReleased * @param totalAmountReleased The totalAmountReleased to set. */
. This is the Setter Method for totalAmountReleased
setTotalAmountReleased
{ "repo_name": "blackcathacker/kc.preclean", "path": "coeus-code/src/main/java/org/kuali/kra/subaward/bo/SubAward.java", "license": "apache-2.0", "size": 44135 }
[ "org.kuali.coeus.sys.api.model.ScaleTwoDecimal" ]
import org.kuali.coeus.sys.api.model.ScaleTwoDecimal;
import org.kuali.coeus.sys.api.model.*;
[ "org.kuali.coeus" ]
org.kuali.coeus;
2,781,040
Date value = (Date) getValue(); return value != null ? new LocalDateTime(value).toString(formatter) : ""; }
Date value = (Date) getValue(); return value != null ? new LocalDateTime(value).toString(formatter) : ""; }
/** * Format the YearMonthDay as String, using the specified format. * * @return DateTime formatted string */
Format the YearMonthDay as String, using the specified format
getAsText
{ "repo_name": "SemanticCloud/SemanticCloud", "path": "Dashboard/src/main/java/org/semanticcloud/web/propertyeditors/LocaleDateTimeEditor.java", "license": "apache-2.0", "size": 2023 }
[ "java.util.Date", "org.joda.time.LocalDateTime" ]
import java.util.Date; import org.joda.time.LocalDateTime;
import java.util.*; import org.joda.time.*;
[ "java.util", "org.joda.time" ]
java.util; org.joda.time;
2,221,534
@Test public void testSTOCFOR1() { CuteNetlibCase.doTest("STOCFOR1.SIF", "-41131.97621943626", null, NumberContext.of(7, 4)); }
void function() { CuteNetlibCase.doTest(STR, STR, null, NumberContext.of(7, 4)); }
/** * <pre> * 2019-02-13: Objective obtained/verified by CPLEX * </pre> */
<code> 2019-02-13: Objective obtained/verified by CPLEX </code>
testSTOCFOR1
{ "repo_name": "optimatika/ojAlgo", "path": "src/test/java/org/ojalgo/optimisation/linear/CuteNetlibCase.java", "license": "mit", "size": 42381 }
[ "org.ojalgo.type.context.NumberContext" ]
import org.ojalgo.type.context.NumberContext;
import org.ojalgo.type.context.*;
[ "org.ojalgo.type" ]
org.ojalgo.type;
1,383,554
private SerialMessage setValueMessage(String str, int command) { byte[] nameBuffer = null; try { nameBuffer = str.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } int len = nameBuffer.length; if (len > 16) { len = 16; } SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set); byte[] newPayload = { (byte) this.getNode().getNodeId(), (byte) ((byte) len + 3), (byte) getCommandClass().getKey(), (byte) command, (byte) ENCODING_UTF16 }; byte[] msg = new byte[newPayload.length + len]; System.arraycopy(newPayload, 0, msg, 0, newPayload.length); System.arraycopy(nameBuffer, 0, msg, newPayload.length, len); result.setMessagePayload(msg); return result; }
SerialMessage function(String str, int command) { byte[] nameBuffer = null; try { nameBuffer = str.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } int len = nameBuffer.length; if (len > 16) { len = 16; } SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set); byte[] newPayload = { (byte) this.getNode().getNodeId(), (byte) ((byte) len + 3), (byte) getCommandClass().getKey(), (byte) command, (byte) ENCODING_UTF16 }; byte[] msg = new byte[newPayload.length + len]; System.arraycopy(newPayload, 0, msg, 0, newPayload.length); System.arraycopy(nameBuffer, 0, msg, newPayload.length, len); result.setMessagePayload(msg); return result; }
/** * Gets a SerialMessage with the Name or Location SET command * * @param the level to set. * @return the serial message */
Gets a SerialMessage with the Name or Location SET command
setValueMessage
{ "repo_name": "vgoldman/openhab", "path": "bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveNodeNamingCommandClass.java", "license": "epl-1.0", "size": 15728 }
[ "java.io.UnsupportedEncodingException", "org.openhab.binding.zwave.internal.protocol.SerialMessage" ]
import java.io.UnsupportedEncodingException; import org.openhab.binding.zwave.internal.protocol.SerialMessage;
import java.io.*; import org.openhab.binding.zwave.internal.protocol.*;
[ "java.io", "org.openhab.binding" ]
java.io; org.openhab.binding;
415,565
public static boolean validateSimpleDate(String dateText) { SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); formatter.setLenient(false); Date date; try { date = formatter.parse(dateText); } catch (ParseException pe) { return false; } return true; }
static boolean function(String dateText) { SimpleDateFormat formatter = new SimpleDateFormat(STR); formatter.setLenient(false); Date date; try { date = formatter.parse(dateText); } catch (ParseException pe) { return false; } return true; }
/** * Validate if the given Date string is in the format dd/mm/yyyy and if it * can be converted to java.util.Date in dd/mm/yyyy format * */
Validate if the given Date string is in the format dd/mm/yyyy and if it can be converted to java.util.Date in dd/mm/yyyy format
validateSimpleDate
{ "repo_name": "dhananjayhegde/fertilizersShop", "path": "src/fertilizers/DateUtil.java", "license": "mit", "size": 3929 }
[ "java.text.ParseException", "java.text.SimpleDateFormat", "java.util.Date" ]
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
2,436,543
@Test public void testMethods() { final PiPacketOperation piPacketOperation = PiPacketOperation.builder() .forDevice(deviceId) .withData(ImmutableByteSequence.ofOnes(512)) .withType(PACKET_OUT) .withMetadata(PiControlMetadata.builder() .withId(PiControlMetadataId.of(EGRESS_PORT)) .withValue(copyFrom((short) 10)) .build()) .build(); assertThat(piPacketOperation, is(notNullValue())); assertThat(piPacketOperation.deviceId(), is(deviceId)); assertThat(piPacketOperation.type(), is(PACKET_OUT)); assertThat(piPacketOperation.data(), is(ImmutableByteSequence.ofOnes(512))); assertThat("Incorrect metadatas value", CollectionUtils.isEqualCollection(piPacketOperation.metadatas(), ImmutableList.of(PiControlMetadata.builder() .withId(PiControlMetadataId .of(EGRESS_PORT)) .withValue(copyFrom((short) 10)) .build()))); }
void function() { final PiPacketOperation piPacketOperation = PiPacketOperation.builder() .forDevice(deviceId) .withData(ImmutableByteSequence.ofOnes(512)) .withType(PACKET_OUT) .withMetadata(PiControlMetadata.builder() .withId(PiControlMetadataId.of(EGRESS_PORT)) .withValue(copyFrom((short) 10)) .build()) .build(); assertThat(piPacketOperation, is(notNullValue())); assertThat(piPacketOperation.deviceId(), is(deviceId)); assertThat(piPacketOperation.type(), is(PACKET_OUT)); assertThat(piPacketOperation.data(), is(ImmutableByteSequence.ofOnes(512))); assertThat(STR, CollectionUtils.isEqualCollection(piPacketOperation.metadatas(), ImmutableList.of(PiControlMetadata.builder() .withId(PiControlMetadataId .of(EGRESS_PORT)) .withValue(copyFrom((short) 10)) .build()))); }
/** * Checks the methods of PiPacketOperation. */
Checks the methods of PiPacketOperation
testMethods
{ "repo_name": "osinstom/onos", "path": "core/api/src/test/java/org/onosproject/net/pi/runtime/PiPacketOperationTest.java", "license": "apache-2.0", "size": 5066 }
[ "com.google.common.collect.ImmutableList", "org.apache.commons.collections.CollectionUtils", "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.onlab.util.ImmutableByteSequence", "org.onosproject.net.pi.model.PiControlMetadataId" ]
import com.google.common.collect.ImmutableList; import org.apache.commons.collections.CollectionUtils; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.onlab.util.ImmutableByteSequence; import org.onosproject.net.pi.model.PiControlMetadataId;
import com.google.common.collect.*; import org.apache.commons.collections.*; import org.hamcrest.*; import org.onlab.util.*; import org.onosproject.net.pi.model.*;
[ "com.google.common", "org.apache.commons", "org.hamcrest", "org.onlab.util", "org.onosproject.net" ]
com.google.common; org.apache.commons; org.hamcrest; org.onlab.util; org.onosproject.net;
330,363
@Test public void testCreateFileMonitorService() { WatchServiceFileMonitorServiceFactory instance = new WatchServiceFileMonitorServiceFactory(); instance.setExecutorService(executorService); instance.setWatchService(watchService); WatchServiceFileMonitorServiceImpl service = instance.createFileMonitorService(); assertNotNull(service); assertEquals(executorService, service.getExecutorService()); assertEquals(watchService, service.getWatchService()); }
void function() { WatchServiceFileMonitorServiceFactory instance = new WatchServiceFileMonitorServiceFactory(); instance.setExecutorService(executorService); instance.setWatchService(watchService); WatchServiceFileMonitorServiceImpl service = instance.createFileMonitorService(); assertNotNull(service); assertEquals(executorService, service.getExecutorService()); assertEquals(watchService, service.getWatchService()); }
/** * Tests * {@link WatchServiceFileMonitorServiceFactory#createFileMonitorService()}. */
Tests <code>WatchServiceFileMonitorServiceFactory#createFileMonitorService()</code>
testCreateFileMonitorService
{ "repo_name": "sworisbreathing/sfmf4j", "path": "sfmf4j-nio2/src/test/java/com/github/sworisbreathing/sfmf4j/nio2/WatchServiceFileMonitorServiceFactoryTest.java", "license": "apache-2.0", "size": 3353 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
805,073
private String getClientVersion() { String result = UNKNOWN; String version = getString(R.string.rcs_core_release_number); if (version != null && version.length() > 0) { String[] values = version.split("."); if (values.length > 2) { result = values[0] + "." + values[1]; } else { result = version; } } return StringUtils.truncate(result, 15); }
String function() { String result = UNKNOWN; String version = getString(R.string.rcs_core_release_number); if (version != null && version.length() > 0) { String[] values = version.split("."); if (values.length > 2) { result = values[0] + "." + values[1]; } else { result = version; } } return StringUtils.truncate(result, 15); }
/** * Returns the client version * * @return String(15) */
Returns the client version
getClientVersion
{ "repo_name": "rex-xxx/mt6572_x201", "path": "mediatek/packages/apps/RCSe/core/src/com/orangelabs/rcs/provisioning/https/HttpsProvisioningService.java", "license": "gpl-2.0", "size": 43329 }
[ "com.orangelabs.rcs.utils.StringUtils" ]
import com.orangelabs.rcs.utils.StringUtils;
import com.orangelabs.rcs.utils.*;
[ "com.orangelabs.rcs" ]
com.orangelabs.rcs;
2,397,482
private void setSignupBeginDeadlineData(SignupMeeting meeting, int signupBegin, String signupBeginType, int signupDeadline, String signupDeadlineType) throws Exception { Date sBegin = Utilities.subTractTimeToDate(meeting.getStartTime(), signupBegin, signupBeginType); Date sDeadline = Utilities.subTractTimeToDate(meeting.getEndTime(), signupDeadline, signupDeadlineType); boolean origSignupStarted = originalMeetingCopy.getSignupBegins().before(new Date());// ???? if (!START_NOW.equals(signupBeginType) && sBegin.before(new Date()) && !origSignupStarted) { // a warning for user Utilities.addErrorMessage(Utilities.rb.getString("warning.your.event.singup.begin.time.passed.today.time")); } if(!isSignupBeginModifiedByUser() && this.isStartNowTypeForRecurEvents){ }else { meeting.setSignupBegins(sBegin); } if (sBegin.after(sDeadline)) throw new SignupUserActionException(Utilities.rb.getString("signup.deadline.is.before.signup.begin")); meeting.setSignupDeadline(sDeadline); }
void function(SignupMeeting meeting, int signupBegin, String signupBeginType, int signupDeadline, String signupDeadlineType) throws Exception { Date sBegin = Utilities.subTractTimeToDate(meeting.getStartTime(), signupBegin, signupBeginType); Date sDeadline = Utilities.subTractTimeToDate(meeting.getEndTime(), signupDeadline, signupDeadlineType); boolean origSignupStarted = originalMeetingCopy.getSignupBegins().before(new Date()); if (!START_NOW.equals(signupBeginType) && sBegin.before(new Date()) && !origSignupStarted) { Utilities.addErrorMessage(Utilities.rb.getString(STR)); } if(!isSignupBeginModifiedByUser() && this.isStartNowTypeForRecurEvents){ }else { meeting.setSignupBegins(sBegin); } if (sBegin.after(sDeadline)) throw new SignupUserActionException(Utilities.rb.getString(STR)); meeting.setSignupDeadline(sDeadline); }
/** * setup the event/meeting's signup begin and deadline time and validate it * too */
setup the event/meeting's signup begin and deadline time and validate it too
setSignupBeginDeadlineData
{ "repo_name": "sakai-mirror/signup", "path": "tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/EditMeeting.java", "license": "apache-2.0", "size": 34723 }
[ "java.util.Date", "org.sakaiproject.signup.logic.SignupUserActionException", "org.sakaiproject.signup.model.SignupMeeting", "org.sakaiproject.signup.tool.util.Utilities" ]
import java.util.Date; import org.sakaiproject.signup.logic.SignupUserActionException; import org.sakaiproject.signup.model.SignupMeeting; import org.sakaiproject.signup.tool.util.Utilities;
import java.util.*; import org.sakaiproject.signup.logic.*; import org.sakaiproject.signup.model.*; import org.sakaiproject.signup.tool.util.*;
[ "java.util", "org.sakaiproject.signup" ]
java.util; org.sakaiproject.signup;
1,632,978
public void generateInsertSet(JavaWriter out, String pstmt, String index, String obj) throws IOException { if (_isInsert) generateStatementSet(out, pstmt, index, obj); else if (getLoadGroupIndex() != 0) { int groupIndex = getLoadGroupIndex(); int group = groupIndex / 64; long groupMask = 1L << (groupIndex % 64); out.println("__caucho_loadMask_" + group + " &= ~" + groupMask + "L;"); } }
void function(JavaWriter out, String pstmt, String index, String obj) throws IOException { if (_isInsert) generateStatementSet(out, pstmt, index, obj); else if (getLoadGroupIndex() != 0) { int groupIndex = getLoadGroupIndex(); int group = groupIndex / 64; long groupMask = 1L << (groupIndex % 64); out.println(STR + group + STR + groupMask + "L;"); } }
/** * Generates the set clause for the insert clause. */
Generates the set clause for the insert clause
generateInsertSet
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/amber/field/EntityEmbeddedField.java", "license": "gpl-2.0", "size": 11858 }
[ "com.caucho.java.JavaWriter", "java.io.IOException" ]
import com.caucho.java.JavaWriter; import java.io.IOException;
import com.caucho.java.*; import java.io.*;
[ "com.caucho.java", "java.io" ]
com.caucho.java; java.io;
585,211
boolean isSpecializedHandlerAvailable(List<ResolveInfo> intent);
boolean isSpecializedHandlerAvailable(List<ResolveInfo> intent);
/** * Search for intent handlers that are specific to this URL aka, specialized apps like * google maps or youtube */
Search for intent handlers that are specific to this URL aka, specialized apps like google maps or youtube
isSpecializedHandlerAvailable
{ "repo_name": "axinging/chromium-crosswalk", "path": "chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java", "license": "bsd-3-clause", "size": 3952 }
[ "android.content.pm.ResolveInfo", "java.util.List" ]
import android.content.pm.ResolveInfo; import java.util.List;
import android.content.pm.*; import java.util.*;
[ "android.content", "java.util" ]
android.content; java.util;
1,745,723
public LabelsResponse getWithParam(Map<String, String> map, Config config) throws IOException { PostmenUrl url = getUrl(config).addQueries(map); LabelsResponse labelsResponse = get(new Handler(config), url, LabelsResponse.class); return labelsResponse; }
LabelsResponse function(Map<String, String> map, Config config) throws IOException { PostmenUrl url = getUrl(config).addQueries(map); LabelsResponse labelsResponse = get(new Handler(config), url, LabelsResponse.class); return labelsResponse; }
/** * Get request with query parameters and custom configuration * @param map query parameters in a Map * @param config custom configuration for this request * @return Label Response Object * @throws IOException Signals that an I/O exception of some sort has occurred */
Get request with query parameters and custom configuration
getWithParam
{ "repo_name": "heinrich10/java", "path": "src/main/java/com/postmen/javasdk/service/LabelService.java", "license": "mit", "size": 5253 }
[ "com.postmen.javasdk.config.Config", "com.postmen.javasdk.handler.Handler", "com.postmen.javasdk.model.LabelsResponse", "com.postmen.javasdk.util.PostmenUrl", "java.io.IOException", "java.util.Map" ]
import com.postmen.javasdk.config.Config; import com.postmen.javasdk.handler.Handler; import com.postmen.javasdk.model.LabelsResponse; import com.postmen.javasdk.util.PostmenUrl; import java.io.IOException; import java.util.Map;
import com.postmen.javasdk.config.*; import com.postmen.javasdk.handler.*; import com.postmen.javasdk.model.*; import com.postmen.javasdk.util.*; import java.io.*; import java.util.*;
[ "com.postmen.javasdk", "java.io", "java.util" ]
com.postmen.javasdk; java.io; java.util;
2,268,051
public void setImperfectMatch(boolean imperfect) { imperfectMatch = imperfect; } private Map<ThermoGAValue, Integer> corrections; private boolean imperfectMatch;
void function(boolean imperfect) { imperfectMatch = imperfect; } private Map<ThermoGAValue, Integer> corrections; private boolean imperfectMatch;
/** * Set the flag indicating whether or not the corrections are approximate. */
Set the flag indicating whether or not the corrections are approximate
setImperfectMatch
{ "repo_name": "enochd/RMG-Java", "path": "source/RMG/jing/chem/BensonRingCorrections.java", "license": "mit", "size": 3633 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
425,419
public int getInt(String key) { String value = getString(key); if (StringUtils.isNotEmpty(value)) { return Integer.parseInt(value); } return 0; } /** * Effective value as {@code long}. * @return the value as {@code long}. If the property does not have value nor default value, then {@code 0L} is returned. * @throws NumberFormatException if value is not empty and is not a parsable {@code long}
int function(String key) { String value = getString(key); if (StringUtils.isNotEmpty(value)) { return Integer.parseInt(value); } return 0; } /** * Effective value as {@code long}. * @return the value as {@code long}. If the property does not have value nor default value, then {@code 0L} is returned. * @throws NumberFormatException if value is not empty and is not a parsable {@code long}
/** * Effective value as {@code int}. * @return the value as {@code int}. If the property does not have value nor default value, then {@code 0} is returned. * @throws NumberFormatException if value is not empty and is not a parsable integer */
Effective value as int
getInt
{ "repo_name": "Builders-SonarSource/sonarqube-bis", "path": "sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java", "license": "lgpl-3.0", "size": 15682 }
[ "org.apache.commons.lang.StringUtils" ]
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
1,983,483
public final static RTMPMessage build(IRTMPEvent body, int eventTime) { RTMPMessage msg = new RTMPMessage(body, eventTime); msg.body.setSourceType(body.getSourceType()); return msg; }
final static RTMPMessage function(IRTMPEvent body, int eventTime) { RTMPMessage msg = new RTMPMessage(body, eventTime); msg.body.setSourceType(body.getSourceType()); return msg; }
/** * Builder for RTMPMessage. * * @param body * event data * @param eventTime * time value to set on the event body * @return Immutable RTMPMessage */
Builder for RTMPMessage
build
{ "repo_name": "maritelle/red5-server-common", "path": "src/main/java/org/red5/server/stream/message/RTMPMessage.java", "license": "apache-2.0", "size": 3098 }
[ "org.red5.server.net.rtmp.event.IRTMPEvent" ]
import org.red5.server.net.rtmp.event.IRTMPEvent;
import org.red5.server.net.rtmp.event.*;
[ "org.red5.server" ]
org.red5.server;
1,130,690
public int timeUntilExecution() { DateTime today = new DateTime(); DateTime tommorrow = today.plusDays(1).withTimeAtStartOfDay().plusMinutes(15); //00:15 Duration duration = new Duration(today, tommorrow); int diffMinutes = (int) duration.getStandardMinutes(); System.out.println("Sleeping for: " + diffMinutes + " minutes..."); return diffMinutes; }
int function() { DateTime today = new DateTime(); DateTime tommorrow = today.plusDays(1).withTimeAtStartOfDay().plusMinutes(15); Duration duration = new Duration(today, tommorrow); int diffMinutes = (int) duration.getStandardMinutes(); System.out.println(STR + diffMinutes + STR); return diffMinutes; }
/** * Calculate the suspension time until the execution time * (daily at 00:15 local time). * * @return int the suspension time until the execution time */
Calculate the suspension time until the execution time (daily at 00:15 local time)
timeUntilExecution
{ "repo_name": "YourDataStories/harvesters", "path": "DiavgeiaGeneralHarvester/src/utils/HelperMethods.java", "license": "gpl-3.0", "size": 62298 }
[ "org.joda.time.DateTime", "org.joda.time.Duration" ]
import org.joda.time.DateTime; import org.joda.time.Duration;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
1,778,506
public TargetPatternEvaluator getTargetPatternEvaluator() { return loadingPhaseRunner.getTargetPatternEvaluator(); }
TargetPatternEvaluator function() { return loadingPhaseRunner.getTargetPatternEvaluator(); }
/** * Returns the target pattern parser. */
Returns the target pattern parser
getTargetPatternEvaluator
{ "repo_name": "joshua0pang/bazel", "path": "src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java", "license": "apache-2.0", "size": 63737 }
[ "com.google.devtools.build.lib.pkgcache.TargetPatternEvaluator" ]
import com.google.devtools.build.lib.pkgcache.TargetPatternEvaluator;
import com.google.devtools.build.lib.pkgcache.*;
[ "com.google.devtools" ]
com.google.devtools;
1,140,343
List<TreeNode> t1Path = t1.getPathFromRoot(); List<TreeNode> t2Path = t2.getPathFromRoot(); if (t1Path.isEmpty() || t2Path.isEmpty()) { return null; } int min = Math.min(t1Path.size(), t2Path.size()); TreeNode commonAncestor = null; for (int i = 0; i < min && t1Path.get(i).equals(t2Path.get(i)); ++i) { commonAncestor = t1Path.get(i); } return commonAncestor; }
List<TreeNode> t1Path = t1.getPathFromRoot(); List<TreeNode> t2Path = t2.getPathFromRoot(); if (t1Path.isEmpty() t2Path.isEmpty()) { return null; } int min = Math.min(t1Path.size(), t2Path.size()); TreeNode commonAncestor = null; for (int i = 0; i < min && t1Path.get(i).equals(t2Path.get(i)); ++i) { commonAncestor = t1Path.get(i); } return commonAncestor; }
/** * returns the node of a tree which represents the lowest common ancestor of * nodes t1 and t2 dominated by root. If either t1 or t2 is not dominated by * root, returns null. * * @param t1 * @param t2 * @param root * @return */
returns the node of a tree which represents the lowest common ancestor of nodes t1 and t2 dominated by root. If either t1 or t2 is not dominated by root, returns null
getLowestCommonAncestor
{ "repo_name": "goncalvesl/lvsg-utils", "path": "src/main/java/lvsg/utils/tree/TreeUtils.java", "license": "apache-2.0", "size": 2528 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,099,494
public void setSession(CqlSession session) { this.session = session; }
void function(CqlSession session) { this.session = session; }
/** * To use the Session instance (you would normally not use this option) */
To use the Session instance (you would normally not use this option)
setSession
{ "repo_name": "pax95/camel", "path": "components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java", "license": "apache-2.0", "size": 10584 }
[ "com.datastax.oss.driver.api.core.CqlSession" ]
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.*;
[ "com.datastax.oss" ]
com.datastax.oss;
2,112,147
private void updateAccountsLocally(Map<String, String> idToNamesLocallyUpdated) throws JSONException { for (Entry<String, String> idAndName : idToNamesLocallyUpdated.entrySet()) { String id = idAndName.getKey(); String updatedName = idAndName.getValue(); JSONObject account = smartStore.retrieve(ACCOUNTS_SOUP, smartStore.lookupSoupEntryId(ACCOUNTS_SOUP, Constants.ID, id)).getJSONObject(0); account.put(Constants.NAME, updatedName); account.put(SyncManager.LOCAL, true); account.put(SyncManager.LOCALLY_CREATED, false); account.put(SyncManager.LOCALLY_DELETED, false); account.put(SyncManager.LOCALLY_UPDATED, true); smartStore.upsert(ACCOUNTS_SOUP, account); } }
void function(Map<String, String> idToNamesLocallyUpdated) throws JSONException { for (Entry<String, String> idAndName : idToNamesLocallyUpdated.entrySet()) { String id = idAndName.getKey(); String updatedName = idAndName.getValue(); JSONObject account = smartStore.retrieve(ACCOUNTS_SOUP, smartStore.lookupSoupEntryId(ACCOUNTS_SOUP, Constants.ID, id)).getJSONObject(0); account.put(Constants.NAME, updatedName); account.put(SyncManager.LOCAL, true); account.put(SyncManager.LOCALLY_CREATED, false); account.put(SyncManager.LOCALLY_DELETED, false); account.put(SyncManager.LOCALLY_UPDATED, true); smartStore.upsert(ACCOUNTS_SOUP, account); } }
/** * Update accounts locally * @param idToNamesLocallyUpdated * @throws JSONException */
Update accounts locally
updateAccountsLocally
{ "repo_name": "huminzhi/SalesforceMobileSDK-Android", "path": "libs/test/SmartSyncTest/src/com/salesforce/androidsdk/smartsync/manager/SyncManagerTest.java", "license": "apache-2.0", "size": 57743 }
[ "com.salesforce.androidsdk.smartsync.util.Constants", "java.util.Map", "org.json.JSONException", "org.json.JSONObject" ]
import com.salesforce.androidsdk.smartsync.util.Constants; import java.util.Map; import org.json.JSONException; import org.json.JSONObject;
import com.salesforce.androidsdk.smartsync.util.*; import java.util.*; import org.json.*;
[ "com.salesforce.androidsdk", "java.util", "org.json" ]
com.salesforce.androidsdk; java.util; org.json;
2,502,208
CookieHandler handler = CookieHandler.getDefault(); CookieManager manager; if (handler == null || !(handler instanceof CookieManager)) { manager = new CookieManager(); CookieHandler.setDefault(manager); // Sync cookies from ExoConnectionUtils only // when the Cookies Manager is created syncCookies(manager); } else { manager = (CookieManager) handler; } return manager; }
CookieHandler handler = CookieHandler.getDefault(); CookieManager manager; if (handler == null !(handler instanceof CookieManager)) { manager = new CookieManager(); CookieHandler.setDefault(manager); syncCookies(manager); } else { manager = (CookieManager) handler; } return manager; }
/** * Creates a new CookieManager if none already exists and sets it as the * default CookieHandler * * @return the CookieManager newly created, or the existing one if it's * already the default CookieHandler */
Creates a new CookieManager if none already exists and sets it as the default CookieHandler
initCookieManager
{ "repo_name": "rdenarie/mobile-android", "path": "src/org/exoplatform/utils/image/ExoPicassoDownloader.java", "license": "lgpl-3.0", "size": 5682 }
[ "java.net.CookieHandler", "java.net.CookieManager" ]
import java.net.CookieHandler; import java.net.CookieManager;
import java.net.*;
[ "java.net" ]
java.net;
981,174
public void run(final Task<?> task, final String planClass) { State currState, newState; do { currState = _stateRef.get(); if (currState._stateName != StateName.RUN) { task.cancel(new EngineShutdownException("Task submitted after engine shutdown")); return; } newState = new State(StateName.RUN, currState._pendingCount + 1); } while (!_stateRef.compareAndSet(currState, newState)); final Executor taskExecutor = new SerialExecutor(_taskExecutor, new CancelPlanRejectionHandler(task)); PlanContext planContext = new PlanContext(this, taskExecutor, _timerExecutor, _loggerFactory, _allLogger, _rootLogger, planClass, task.getId(), _maxRelationshipsPerTrace); new ContextImpl(planContext, task).runTask(); InternalUtil.unwildcardTask(task).addListener(_taskDoneListener); } /** * If the engine is currently running, this method will initiate an orderly * shutdown. No new tasks will be accepted, but already running tasks will be * allowed to finish. Use {@link #awaitTermination(int, java.util.concurrent.TimeUnit)}
void function(final Task<?> task, final String planClass) { State currState, newState; do { currState = _stateRef.get(); if (currState._stateName != StateName.RUN) { task.cancel(new EngineShutdownException(STR)); return; } newState = new State(StateName.RUN, currState._pendingCount + 1); } while (!_stateRef.compareAndSet(currState, newState)); final Executor taskExecutor = new SerialExecutor(_taskExecutor, new CancelPlanRejectionHandler(task)); PlanContext planContext = new PlanContext(this, taskExecutor, _timerExecutor, _loggerFactory, _allLogger, _rootLogger, planClass, task.getId(), _maxRelationshipsPerTrace); new ContextImpl(planContext, task).runTask(); InternalUtil.unwildcardTask(task).addListener(_taskDoneListener); } /** * If the engine is currently running, this method will initiate an orderly * shutdown. No new tasks will be accepted, but already running tasks will be * allowed to finish. Use {@link #awaitTermination(int, java.util.concurrent.TimeUnit)}
/** * Runs the given task with its own context. Use {@code Tasks.seq} and * {@code Tasks.par} to create and run composite tasks. * * @param task the task to run */
Runs the given task with its own context. Use Tasks.seq and Tasks.par to create and run composite tasks
run
{ "repo_name": "jasonchaffee/parseq", "path": "src/com/linkedin/parseq/Engine.java", "license": "apache-2.0", "size": 8938 }
[ "com.linkedin.parseq.internal.ContextImpl", "com.linkedin.parseq.internal.InternalUtil", "com.linkedin.parseq.internal.PlanContext", "com.linkedin.parseq.internal.SerialExecutor", "java.util.concurrent.Executor", "java.util.concurrent.TimeUnit" ]
import com.linkedin.parseq.internal.ContextImpl; import com.linkedin.parseq.internal.InternalUtil; import com.linkedin.parseq.internal.PlanContext; import com.linkedin.parseq.internal.SerialExecutor; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit;
import com.linkedin.parseq.internal.*; import java.util.concurrent.*;
[ "com.linkedin.parseq", "java.util" ]
com.linkedin.parseq; java.util;
1,858,927
public void setCoupledResources(final Collection<? extends CoupledResource> newValues) { coupledResources = writeCollection(newValues, coupledResources, CoupledResource.class); }
void function(final Collection<? extends CoupledResource> newValues) { coupledResources = writeCollection(newValues, coupledResources, CoupledResource.class); }
/** * Sets further description(s) of the data coupling in the case of tightly coupled services. * * @param newValues the new further description(s) of the data coupling. */
Sets further description(s) of the data coupling in the case of tightly coupled services
setCoupledResources
{ "repo_name": "Geomatys/sis", "path": "core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java", "license": "apache-2.0", "size": 19876 }
[ "java.util.Collection", "org.opengis.metadata.identification.CoupledResource" ]
import java.util.Collection; import org.opengis.metadata.identification.CoupledResource;
import java.util.*; import org.opengis.metadata.identification.*;
[ "java.util", "org.opengis.metadata" ]
java.util; org.opengis.metadata;
781,765
public static FileFilter getFSGFileFilter() { return new FreeColFileFilter( ".fsg", "filter.savedGames" ); }
static FileFilter function() { return new FreeColFileFilter( ".fsg", STR ); }
/** * Returns a filter accepting "*.fsg". * @return The filter. */
Returns a filter accepting "*.fsg"
getFSGFileFilter
{ "repo_name": "tectronics/reformationofeurope", "path": "src/net/sf/freecol/client/gui/panel/FreeColDialog.java", "license": "gpl-2.0", "size": 22528 }
[ "javax.swing.filechooser.FileFilter" ]
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.*;
[ "javax.swing" ]
javax.swing;
1,119,260
public void writeAttribute(String attributeName, String attributeValue) throws JspException { if (currentState().isBlockTag()) { throw new IllegalStateException("Cannot write attributes after opening tag is closed."); } this.writer.append(" ").append(attributeName).append("=\"") .append(attributeValue).append("\""); } /** * Write an HTML attribute if the supplied value is not {@code null}
void function(String attributeName, String attributeValue) throws JspException { if (currentState().isBlockTag()) { throw new IllegalStateException(STR); } this.writer.append(" ").append(attributeName).append("=\"STR\""); } /** * Write an HTML attribute if the supplied value is not {@code null}
/** * Write an HTML attribute with the specified name and value. * <p>Be sure to write all attributes <strong>before</strong> writing * any inner text or nested tags. * @throws IllegalStateException if the opening tag is closed */
Write an HTML attribute with the specified name and value. Be sure to write all attributes before writing any inner text or nested tags
writeAttribute
{ "repo_name": "QBNemo/spring-mvc-showcase", "path": "src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java", "license": "apache-2.0", "size": 6956 }
[ "javax.servlet.jsp.JspException" ]
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.*;
[ "javax.servlet" ]
javax.servlet;
344,438
public void onBeforeCommandLineProcessing(String process_type, CefCommandLine command_line);
void function(String process_type, CefCommandLine command_line);
/** * Provides an opportunity to view and/or modify command-line arguments before * processing by CEF and Chromium. The |process_type| value will be empty for * the browser process. Be cautious when using this method to modify * command-line arguments for non-browser processes as this may result in * undefined behavior including crashes. * @param process_type type of process (empty for browser process). * @param command_line values of the command line. */
Provides an opportunity to view and/or modify command-line arguments before processing by CEF and Chromium. The |process_type| value will be empty for the browser process. Be cautious when using this method to modify command-line arguments for non-browser processes as this may result in undefined behavior including crashes
onBeforeCommandLineProcessing
{ "repo_name": "apicloudcom/APICloud-Studio", "path": "org.cef/src/org/cef/handler/CefAppHandler.java", "license": "gpl-3.0", "size": 1599 }
[ "org.cef.callback.CefCommandLine" ]
import org.cef.callback.CefCommandLine;
import org.cef.callback.*;
[ "org.cef.callback" ]
org.cef.callback;
2,073,618
public InputStream get(URI uri, Map<String, ? extends Credentials> credentials, HttpTransferListener listener) throws IOException, HttpError { final Response response = executeWithAuthRetry(uri, credentials, listener, Collections.<ContentRange>emptyList()); final int code = response.code(); if (code != HTTP_OK) { throw new HttpError(response.message(), code); } return inputStream(response, listener); }
InputStream function(URI uri, Map<String, ? extends Credentials> credentials, HttpTransferListener listener) throws IOException, HttpError { final Response response = executeWithAuthRetry(uri, credentials, listener, Collections.<ContentRange>emptyList()); final int code = response.code(); if (code != HTTP_OK) { throw new HttpError(response.message(), code); } return inputStream(response, listener); }
/** * Opens a connection to the remote resource referred to by the given uri. The returned stream is * decorated with to report download progress to the given listener. * * @param uri The URI of the resource to retrieve * @param credentials The credentials for authenticating with remote hosts * @param listener Listener to monitor long running transfers * @return * @throws IOException * @throws HttpError */
Opens a connection to the remote resource referred to by the given uri. The returned stream is decorated with to report download progress to the given listener
get
{ "repo_name": "SalesforceEng/zsync4j", "path": "zsync-core/src/main/java/com/salesforce/zsync/internal/util/HttpClient.java", "license": "bsd-3-clause", "size": 18362 }
[ "com.salesforce.zsync.http.ContentRange", "com.salesforce.zsync.http.Credentials", "com.squareup.okhttp.Response", "java.io.IOException", "java.io.InputStream", "java.util.Collections", "java.util.Map" ]
import com.salesforce.zsync.http.ContentRange; import com.salesforce.zsync.http.Credentials; import com.squareup.okhttp.Response; import java.io.IOException; import java.io.InputStream; import java.util.Collections; import java.util.Map;
import com.salesforce.zsync.http.*; import com.squareup.okhttp.*; import java.io.*; import java.util.*;
[ "com.salesforce.zsync", "com.squareup.okhttp", "java.io", "java.util" ]
com.salesforce.zsync; com.squareup.okhttp; java.io; java.util;
725,312
DescribeSensorDocument xbDescribeSensorDoc = DescribeSensorDocument.Factory.newInstance( XmlOptionsHelper.getInstance().getXmlOptions()); DescribeSensor xbDescribeSensor = xbDescribeSensorDoc.addNewDescribeSensor(); xbDescribeSensor.setService(SosInjectorConstants.SOS_SERVICE); xbDescribeSensor.setVersion(SosInjectorConstants.SOS_V100); xbDescribeSensor.setOutputFormat(IoosSosConstants.SML_PROFILE_M10); xbDescribeSensor.setProcedure(asset.getId()); return xbDescribeSensorDoc; }
DescribeSensorDocument xbDescribeSensorDoc = DescribeSensorDocument.Factory.newInstance( XmlOptionsHelper.getInstance().getXmlOptions()); DescribeSensor xbDescribeSensor = xbDescribeSensorDoc.addNewDescribeSensor(); xbDescribeSensor.setService(SosInjectorConstants.SOS_SERVICE); xbDescribeSensor.setVersion(SosInjectorConstants.SOS_V100); xbDescribeSensor.setOutputFormat(IoosSosConstants.SML_PROFILE_M10); xbDescribeSensor.setProcedure(asset.getId()); return xbDescribeSensorDoc; }
/** * Build the XML String * <DescribeSensor version="1.0.0" service="SOS" xmlns="http://www.opengis.net/sos/1.0" outputFormat="text/xml;subtype=&quot;sensorML/1.0.1&quot;"> <procedure>urn:ogc:object:feature:Sensor:IFGI:ifgi-sensor-1</procedure> </DescribeSensor> * */
Build the XML String
build
{ "repo_name": "ioos/sos-injector", "path": "src/main/java/com/axiomalaska/sos/xmlbuilder/DescribeSensorBuilder.java", "license": "unlicense", "size": 2034 }
[ "com.axiomalaska.ioos.sos.IoosSosConstants", "com.axiomalaska.sos.SosInjectorConstants", "com.axiomalaska.sos.tools.XmlOptionsHelper", "net.opengis.sos.x10.DescribeSensorDocument" ]
import com.axiomalaska.ioos.sos.IoosSosConstants; import com.axiomalaska.sos.SosInjectorConstants; import com.axiomalaska.sos.tools.XmlOptionsHelper; import net.opengis.sos.x10.DescribeSensorDocument;
import com.axiomalaska.ioos.sos.*; import com.axiomalaska.sos.*; import com.axiomalaska.sos.tools.*; import net.opengis.sos.x10.*;
[ "com.axiomalaska.ioos", "com.axiomalaska.sos", "net.opengis.sos" ]
com.axiomalaska.ioos; com.axiomalaska.sos; net.opengis.sos;
419,118
public static JobProgressTrackerService createJobProgressServer( GiraphConfiguration conf) { if (!conf.trackJobProgressOnClient()) { return null; } try { JobProgressTrackerService service = new JobProgressTrackerService(conf); ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), new ArrayList<ThriftEventHandler>(), service); service.server = new ThriftServer(processor, new ThriftServerConfig()); service.server.start(); JOB_PROGRESS_SERVICE_HOST.set(conf, InetAddress.getLocalHost().getHostName()); JOB_PROGRESS_SERVICE_PORT.set(conf, service.server.getPort()); return service; // CHECKSTYLE: stop IllegalCatch } catch (Exception e) { // CHECKSTYLE: resume IllegalCatch LOG.warn("Exception occurred while trying to create " + "JobProgressTrackerService - not using progress reporting", e); return null; } }
static JobProgressTrackerService function( GiraphConfiguration conf) { if (!conf.trackJobProgressOnClient()) { return null; } try { JobProgressTrackerService service = new JobProgressTrackerService(conf); ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), new ArrayList<ThriftEventHandler>(), service); service.server = new ThriftServer(processor, new ThriftServerConfig()); service.server.start(); JOB_PROGRESS_SERVICE_HOST.set(conf, InetAddress.getLocalHost().getHostName()); JOB_PROGRESS_SERVICE_PORT.set(conf, service.server.getPort()); return service; } catch (Exception e) { LOG.warn(STR + STR, e); return null; } }
/** * Create job progress server on job client, and update configuration with * its hostname and port so mappers would know what to connect to. Returns * null if progress shouldn't be tracked * * @param conf Configuration * @return JobProgressTrackerService */
Create job progress server on job client, and update configuration with its hostname and port so mappers would know what to connect to. Returns null if progress shouldn't be tracked
createJobProgressServer
{ "repo_name": "korsvanloon/giraph", "path": "giraph-core/src/main/java/org/apache/giraph/job/JobProgressTrackerService.java", "license": "apache-2.0", "size": 7647 }
[ "com.facebook.swift.codec.ThriftCodecManager", "com.facebook.swift.service.ThriftEventHandler", "com.facebook.swift.service.ThriftServer", "com.facebook.swift.service.ThriftServerConfig", "com.facebook.swift.service.ThriftServiceProcessor", "java.net.InetAddress", "java.util.ArrayList", "org.apache.giraph.conf.GiraphConfiguration" ]
import com.facebook.swift.codec.ThriftCodecManager; import com.facebook.swift.service.ThriftEventHandler; import com.facebook.swift.service.ThriftServer; import com.facebook.swift.service.ThriftServerConfig; import com.facebook.swift.service.ThriftServiceProcessor; import java.net.InetAddress; import java.util.ArrayList; import org.apache.giraph.conf.GiraphConfiguration;
import com.facebook.swift.codec.*; import com.facebook.swift.service.*; import java.net.*; import java.util.*; import org.apache.giraph.conf.*;
[ "com.facebook.swift", "java.net", "java.util", "org.apache.giraph" ]
com.facebook.swift; java.net; java.util; org.apache.giraph;
581,551
@ApiMethod(name = "saveProfile", path = "profile", httpMethod = HttpMethod.POST) public Profile saveProfile(final User user, final ProfileForm profileForm) throws UnauthorizedException { if (user == null) { throw new UnauthorizedException("Authorization required"); } String displayName = profileForm.getDisplayName(); TeeShirtSize teeShirtSize = profileForm.getTeeShirtSize(); Profile profile = ofy().load() .key(Key.create(Profile.class, getUserId(user))).now(); if (profile == null) { // Populate displayName and teeShirtSize with the default values if // null. if (displayName == null) { displayName = extractDefaultDisplayNameFromEmail(user .getEmail()); } if (teeShirtSize == null) { teeShirtSize = TeeShirtSize.NOT_SPECIFIED; } profile = new Profile(getUserId(user), displayName, user.getEmail(), teeShirtSize); } else { profile.update(displayName, teeShirtSize); } ofy().save().entity(profile).now(); return profile; }
@ApiMethod(name = STR, path = STR, httpMethod = HttpMethod.POST) Profile function(final User user, final ProfileForm profileForm) throws UnauthorizedException { if (user == null) { throw new UnauthorizedException(STR); } String displayName = profileForm.getDisplayName(); TeeShirtSize teeShirtSize = profileForm.getTeeShirtSize(); Profile profile = ofy().load() .key(Key.create(Profile.class, getUserId(user))).now(); if (profile == null) { if (displayName == null) { displayName = extractDefaultDisplayNameFromEmail(user .getEmail()); } if (teeShirtSize == null) { teeShirtSize = TeeShirtSize.NOT_SPECIFIED; } profile = new Profile(getUserId(user), displayName, user.getEmail(), teeShirtSize); } else { profile.update(displayName, teeShirtSize); } ofy().save().entity(profile).now(); return profile; }
/** * Creates or updates a Profile object associated with the given user * object. * * @param user * A User object injected by the cloud endpoints. * @param profileForm * A ProfileForm object sent from the client form. * @return Profile object just created. * @throws UnauthorizedException * when the User object is null. */
Creates or updates a Profile object associated with the given user object
saveProfile
{ "repo_name": "gitkarthik/homefood", "path": "src/main/java/com/google/devrel/training/conference/spi/HomeFoodApi.java", "license": "apache-2.0", "size": 23408 }
[ "com.google.api.server.spi.config.ApiMethod", "com.google.api.server.spi.response.UnauthorizedException", "com.google.appengine.api.users.User", "com.google.devrel.training.conference.domain.Profile", "com.google.devrel.training.conference.form.ProfileForm", "com.google.devrel.training.conference.service.OfyService", "com.googlecode.objectify.Key" ]
import com.google.api.server.spi.config.ApiMethod; import com.google.api.server.spi.response.UnauthorizedException; import com.google.appengine.api.users.User; import com.google.devrel.training.conference.domain.Profile; import com.google.devrel.training.conference.form.ProfileForm; import com.google.devrel.training.conference.service.OfyService; import com.googlecode.objectify.Key;
import com.google.api.server.spi.config.*; import com.google.api.server.spi.response.*; import com.google.appengine.api.users.*; import com.google.devrel.training.conference.domain.*; import com.google.devrel.training.conference.form.*; import com.google.devrel.training.conference.service.*; import com.googlecode.objectify.*;
[ "com.google.api", "com.google.appengine", "com.google.devrel", "com.googlecode.objectify" ]
com.google.api; com.google.appengine; com.google.devrel; com.googlecode.objectify;
1,470,828
public static void limitNumReduceTasks(String table, Job job) throws IOException { int regions = MetaTableAccessor.getRegionCount(job.getConfiguration(), TableName.valueOf(table)); if (job.getNumReduceTasks() > regions) job.setNumReduceTasks(regions); }
static void function(String table, Job job) throws IOException { int regions = MetaTableAccessor.getRegionCount(job.getConfiguration(), TableName.valueOf(table)); if (job.getNumReduceTasks() > regions) job.setNumReduceTasks(regions); }
/** * Ensures that the given number of reduce tasks for the given job * configuration does not exceed the number of regions for the given table. * * @param table The table to get the region count for. * @param job The current job to adjust. * @throws IOException When retrieving the table details fails. */
Ensures that the given number of reduce tasks for the given job configuration does not exceed the number of regions for the given table
limitNumReduceTasks
{ "repo_name": "gustavoanatoly/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java", "license": "apache-2.0", "size": 43465 }
[ "java.io.IOException", "org.apache.hadoop.hbase.MetaTableAccessor", "org.apache.hadoop.hbase.TableName", "org.apache.hadoop.mapreduce.Job" ]
import java.io.IOException; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.mapreduce.Job;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.mapreduce.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,457,931
public PathFragment getToolPathFragment( CppConfiguration.Tool tool, RuleErrorConsumer ruleErrorConsumer) throws RuleErrorException { PathFragment toolPathFragment = getToolPathFragmentOrNull(tool); if (toolPathFragment == null) { throw ruleErrorConsumer.throwWithRuleError( String.format( "cc_toolchain '%s' with identifier '%s' doesn't define a tool path for '%s'", getCcToolchainLabel(), getToolchainIdentifier(), tool.getNamePart())); } return toolPathFragment; }
PathFragment function( CppConfiguration.Tool tool, RuleErrorConsumer ruleErrorConsumer) throws RuleErrorException { PathFragment toolPathFragment = getToolPathFragmentOrNull(tool); if (toolPathFragment == null) { throw ruleErrorConsumer.throwWithRuleError( String.format( STR, getCcToolchainLabel(), getToolchainIdentifier(), tool.getNamePart())); } return toolPathFragment; }
/** * Returns the path fragment that is either absolute or relative to the execution root that can be * used to execute the given tool. * * @throws RuleErrorException when the tool is not specified by the toolchain. */
Returns the path fragment that is either absolute or relative to the execution root that can be used to execute the given tool
getToolPathFragment
{ "repo_name": "akira-baruah/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java", "license": "apache-2.0", "size": 35939 }
[ "com.google.devtools.build.lib.packages.RuleClass", "com.google.devtools.build.lib.packages.RuleErrorConsumer", "com.google.devtools.build.lib.rules.cpp.CppConfiguration", "com.google.devtools.build.lib.vfs.PathFragment" ]
import com.google.devtools.build.lib.packages.RuleClass; import com.google.devtools.build.lib.packages.RuleErrorConsumer; import com.google.devtools.build.lib.rules.cpp.CppConfiguration; import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.packages.*; import com.google.devtools.build.lib.rules.cpp.*; import com.google.devtools.build.lib.vfs.*;
[ "com.google.devtools" ]
com.google.devtools;
2,541,386
static Paragraph constructTitle(final Paragraph title, final ArrayList numbers, final int numberDepth, final int numberStyle) { if (title == null) { return null; } final int depth = Math.min(numbers.size(), numberDepth); if (depth < 1) { return title; } final StringBuffer buf = new StringBuffer(" "); for (int i = 0; i < depth; i++) { buf.insert(0, "."); buf.insert(0, ((Integer) numbers.get(i)).intValue()); } if (numberStyle == NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT) { buf.deleteCharAt(buf.length() - 2); } final Paragraph result = new Paragraph(title); result.add(0, new Chunk(buf.toString(), title.getFont())); return result; }
static Paragraph constructTitle(final Paragraph title, final ArrayList numbers, final int numberDepth, final int numberStyle) { if (title == null) { return null; } final int depth = Math.min(numbers.size(), numberDepth); if (depth < 1) { return title; } final StringBuffer buf = new StringBuffer(" "); for (int i = 0; i < depth; i++) { buf.insert(0, "."); buf.insert(0, ((Integer) numbers.get(i)).intValue()); } if (numberStyle == NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT) { buf.deleteCharAt(buf.length() - 2); } final Paragraph result = new Paragraph(title); result.add(0, new Chunk(buf.toString(), title.getFont())); return result; }
/** * Constructs a Paragraph that will be used as title for a Section or Chapter. * @param title the title of the section * @param numbers a list of sectionnumbers * @param numberDepth how many numbers have to be shown * @param numberStyle the numbering style * @return a Paragraph object * @since iText 2.0.8 */
Constructs a Paragraph that will be used as title for a Section or Chapter
constructTitle
{ "repo_name": "venanciolm/afirma-ui-miniapplet_x_x", "path": "afirma_ui_miniapplet/src/main/java/com/lowagie/text/Section.java", "license": "mit", "size": 22036 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,299,310
public IHideRule createHideRule( ) { HideRule r = new HideRule( ); IHideRule rule = new HideRuleImpl( r ); return rule; }
IHideRule function( ) { HideRule r = new HideRule( ); IHideRule rule = new HideRuleImpl( r ); return rule; }
/** * Create <code>IHideRule</code> instance * * @return IHideRule */
Create <code>IHideRule</code> instance
createHideRule
{ "repo_name": "Charling-Huang/birt", "path": "engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/element/ScriptAPIBaseFactory.java", "license": "epl-1.0", "size": 2723 }
[ "org.eclipse.birt.report.engine.api.script.element.IHideRule", "org.eclipse.birt.report.model.api.elements.structures.HideRule" ]
import org.eclipse.birt.report.engine.api.script.element.IHideRule; import org.eclipse.birt.report.model.api.elements.structures.HideRule;
import org.eclipse.birt.report.engine.api.script.element.*; import org.eclipse.birt.report.model.api.elements.structures.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
1,147,063
@Override public FileInfoDto getFileInfo(String dname, String name) throws WsSrvException { // Check if file extension supported String ext = GenericUtils.getFileExt(name); if (!getWsCfg().hasExt(ext)) //-- 258 throw new WsSrvException(258, "File extension '" + ext + "' is not supported"); File f = checkExFile(dname, name, true); return new FileInfoDto(f.length(), f.canRead(), f.canWrite(), Instant.ofEpochMilli(f.lastModified()).atZone(ZoneId.systemDefault()) .toLocalDateTime()); }
FileInfoDto function(String dname, String name) throws WsSrvException { String ext = GenericUtils.getFileExt(name); if (!getWsCfg().hasExt(ext)) throw new WsSrvException(258, STR + ext + STR); File f = checkExFile(dname, name, true); return new FileInfoDto(f.length(), f.canRead(), f.canWrite(), Instant.ofEpochMilli(f.lastModified()).atZone(ZoneId.systemDefault()) .toLocalDateTime()); }
/** * Get File Info * * @param dname Resource Directory * @param name File Name * @param ext File Extension * @param params Set of input parameters * @return String with File Info * * @throws WsSrvException */
Get File Info
getFileInfo
{ "repo_name": "osbitools/OsBiToolsSpringWs", "path": "OsBiWsPrjSharedBase/src/main/java/com/osbitools/ws/rest/prj/shared/service/impl/AbstractExFileServiceImpl.java", "license": "lgpl-3.0", "size": 4373 }
[ "com.osbitools.ws.rest.prj.shared.dto.FileInfoDto", "com.osbitools.ws.shared.GenericUtils", "com.osbitools.ws.shared.WsSrvException", "java.io.File", "java.time.Instant", "java.time.ZoneId" ]
import com.osbitools.ws.rest.prj.shared.dto.FileInfoDto; import com.osbitools.ws.shared.GenericUtils; import com.osbitools.ws.shared.WsSrvException; import java.io.File; import java.time.Instant; import java.time.ZoneId;
import com.osbitools.ws.rest.prj.shared.dto.*; import com.osbitools.ws.shared.*; import java.io.*; import java.time.*;
[ "com.osbitools.ws", "java.io", "java.time" ]
com.osbitools.ws; java.io; java.time;
978,964
public RenderingHints getRenderingHints() { return new RenderingHints(null); }
RenderingHints function() { return new RenderingHints(null); }
/** * Returns the preferences for the rendering algorithms. */
Returns the preferences for the rendering algorithms
getRenderingHints
{ "repo_name": "OpenSourcePhysics/osp", "path": "src/org/jibble/epsgraphics/EpsGraphics2D.java", "license": "gpl-3.0", "size": 40716 }
[ "java.awt.RenderingHints" ]
import java.awt.RenderingHints;
import java.awt.*;
[ "java.awt" ]
java.awt;
117,309
@Override protected boolean isDmcEnabled(Connection conn, Host host) throws XenAPIException, XmlRpcException { Map<String, String> hostParams = new HashMap<String, String>(); hostParams = host.getLicenseParams(conn); Boolean isDmcEnabled = hostParams.get("restrict_dmc").equalsIgnoreCase("false"); return isDmcEnabled; }
boolean function(Connection conn, Host host) throws XenAPIException, XmlRpcException { Map<String, String> hostParams = new HashMap<String, String>(); hostParams = host.getLicenseParams(conn); Boolean isDmcEnabled = hostParams.get(STR).equalsIgnoreCase("false"); return isDmcEnabled; }
/** * When Dynamic Memory Control (DMC) is enabled - * xen allows scaling the guest memory while the guest is running * * This is determined by the 'restrict_dmc' option on the host. * When false, scaling is allowed hence DMC is enabled */
When Dynamic Memory Control (DMC) is enabled - xen allows scaling the guest memory while the guest is running This is determined by the 'restrict_dmc' option on the host. When false, scaling is allowed hence DMC is enabled
isDmcEnabled
{ "repo_name": "mufaddalq/cloudstack-datera-driver", "path": "plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java", "license": "apache-2.0", "size": 6912 }
[ "com.xensource.xenapi.Connection", "com.xensource.xenapi.Host", "com.xensource.xenapi.Types", "java.util.HashMap", "java.util.Map", "org.apache.xmlrpc.XmlRpcException" ]
import com.xensource.xenapi.Connection; import com.xensource.xenapi.Host; import com.xensource.xenapi.Types; import java.util.HashMap; import java.util.Map; import org.apache.xmlrpc.XmlRpcException;
import com.xensource.xenapi.*; import java.util.*; import org.apache.xmlrpc.*;
[ "com.xensource.xenapi", "java.util", "org.apache.xmlrpc" ]
com.xensource.xenapi; java.util; org.apache.xmlrpc;
895,972
public void setCategories(List categories) { _categories = categories; }
void function(List categories) { _categories = categories; }
/** * Set the categories * <p> * @param categories The categories to set. * @since Atom 1.0 */
Set the categories
setCategories
{ "repo_name": "simeshev/parabuild-ci", "path": "3rdparty/rome08/src/java/com/sun/syndication/feed/atom/Entry.java", "license": "lgpl-3.0", "size": 11607 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
611,801
public void setIndex( int n ) { if ((n < 0) || (n > Constants.MAX_SHORT)) { throw new ClassGenException("Illegal value: " + n); } this.n = n; if (n >= 0 && n <= 3) { // Use more compact instruction xLOAD_n opcode = (short) (c_tag + n); length = 1; } else { opcode = canon_tag; if (wide()) { length = 4; } else { length = 2; } } }
void function( int n ) { if ((n < 0) (n > Constants.MAX_SHORT)) { throw new ClassGenException(STR + n); } this.n = n; if (n >= 0 && n <= 3) { opcode = (short) (c_tag + n); length = 1; } else { opcode = canon_tag; if (wide()) { length = 4; } else { length = 2; } } }
/** * Set the local variable index */
Set the local variable index
setIndex
{ "repo_name": "Maccimo/commons-bcel", "path": "src/main/java/org/apache/bcel/generic/LocalVariableInstruction.java", "license": "apache-2.0", "size": 6548 }
[ "org.apache.bcel.Constants" ]
import org.apache.bcel.Constants;
import org.apache.bcel.*;
[ "org.apache.bcel" ]
org.apache.bcel;
340,922
public MapAssert assertMap(int index) { Object value = value(index); return Assertions.assertMap(value); }
MapAssert function(int index) { Object value = value(index); return Assertions.assertMap(value); }
/** * Asserts that there is a {@link java.util.Map} at the given index returning the * {@link MapAssert} object so that further assertions can be chained */
Asserts that there is a <code>java.util.Map</code> at the given index returning the <code>MapAssert</code> object so that further assertions can be chained
assertMap
{ "repo_name": "mwringe/fabric8", "path": "components/jolokia-assertions/src/main/java/io/fabric8/jolokia/assertions/JSONArrayAssert.java", "license": "apache-2.0", "size": 6834 }
[ "org.assertj.core.api.MapAssert" ]
import org.assertj.core.api.MapAssert;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
134,932
public void attemptLogin() { mValidLoginButton.setEnabled(false); // Reset errors. mEmailView.setError(null); mPasswordView.setError(null); // Store values at the time of the login attempt. String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; // Check for a valid password, if the user entered one. if (TextUtils.isEmpty(password)) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } // Check for a valid email address. if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; } if (cancel) { // There was an error; don't attempt login and focus the first // form field with an error. focusView.requestFocus(); } else { // Launches the sign in. mUserManager.login(this, email, password); } }
void function() { mValidLoginButton.setEnabled(false); mEmailView.setError(null); mPasswordView.setError(null); String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; if (TextUtils.isEmpty(password)) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; } if (cancel) { focusView.requestFocus(); } else { mUserManager.login(this, email, password); } }
/** * Attempts to sign in or register the account specified by the login form. * If there are form errors (invalid email, missing fields, etc.), the * errors are presented and no actual login attempt is made. */
Attempts to sign in or register the account specified by the login form. If there are form errors (invalid email, missing fields, etc.), the errors are presented and no actual login attempt is made
attemptLogin
{ "repo_name": "Mist-apps/mist-android", "path": "app/src/main/java/com/mist/android/login/LoginActivity.java", "license": "gpl-2.0", "size": 3813 }
[ "android.text.TextUtils", "android.view.View" ]
import android.text.TextUtils; import android.view.View;
import android.text.*; import android.view.*;
[ "android.text", "android.view" ]
android.text; android.view;
1,098,068
private OvsdbTableStore getTableStore(String dbName) { if (ovsdbStore == null) { return null; } return ovsdbStore.getOvsdbTableStore(dbName); }
OvsdbTableStore function(String dbName) { if (ovsdbStore == null) { return null; } return ovsdbStore.getOvsdbTableStore(dbName); }
/** * Gets the ovsdb table store. * * @param dbName the ovsdb database name * @return ovsTableStore, empty if table store is find */
Gets the ovsdb table store
getTableStore
{ "repo_name": "rvhub/onos", "path": "ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java", "license": "apache-2.0", "size": 40468 }
[ "org.onosproject.ovsdb.controller.OvsdbTableStore" ]
import org.onosproject.ovsdb.controller.OvsdbTableStore;
import org.onosproject.ovsdb.controller.*;
[ "org.onosproject.ovsdb" ]
org.onosproject.ovsdb;
1,893,455
private ExpandoTable getExpandoTable(long companyId, String className, String tableName) { if (tableName == null) tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME; ExpandoTable table = null; try { table = ExpandoTableLocalServiceUtil.addTable(companyId, className, tableName); } catch (DuplicateTableNameException duplicateTableNameException) { try { table = ExpandoTableLocalServiceUtil.getTable(companyId, className, tableName); } catch (PortalException ex) { // If we're here something is really wrong and table will be // null // logger.error("Exception when getting table", ex); } catch (SystemException ex) { ex.printStackTrace(); } } catch (PortalException ex) { // If we're here something is really wrong and table will be null // logger.error("Exception when creating table", ex); } catch (SystemException ex) { ex.printStackTrace(); } return table; }
ExpandoTable function(long companyId, String className, String tableName) { if (tableName == null) tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME; ExpandoTable table = null; try { table = ExpandoTableLocalServiceUtil.addTable(companyId, className, tableName); } catch (DuplicateTableNameException duplicateTableNameException) { try { table = ExpandoTableLocalServiceUtil.getTable(companyId, className, tableName); } catch (PortalException ex) { } catch (SystemException ex) { ex.printStackTrace(); } } catch (PortalException ex) { } catch (SystemException ex) { ex.printStackTrace(); } return table; }
/** * Create the expando table given the Company ID, class and table name. If * the table already exists it gets it. If the table name is null the * default table name is used. * * @param companyId * Company Id for the portal instance * @param className * Class to attach the expando attribute to * @param tableName * Table name for the expando attribute. * @return The created or retreived table. If something goes wrong null is * returned. */
Create the expando table given the Company ID, class and table name. If the table already exists it gets it. If the table name is null the default table name is used
getExpandoTable
{ "repo_name": "TelefonicaED/liferaylms-portlet", "path": "docroot/WEB-INF/src/com/liferay/lms/hook/events/StartupAction.java", "license": "agpl-3.0", "size": 15917 }
[ "com.liferay.portal.kernel.exception.PortalException", "com.liferay.portal.kernel.exception.SystemException", "com.liferay.portlet.expando.DuplicateTableNameException", "com.liferay.portlet.expando.model.ExpandoTable", "com.liferay.portlet.expando.model.ExpandoTableConstants", "com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil" ]
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portlet.expando.DuplicateTableNameException; import com.liferay.portlet.expando.model.ExpandoTable; import com.liferay.portlet.expando.model.ExpandoTableConstants; import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil;
import com.liferay.portal.kernel.exception.*; import com.liferay.portlet.expando.*; import com.liferay.portlet.expando.model.*; import com.liferay.portlet.expando.service.*;
[ "com.liferay.portal", "com.liferay.portlet" ]
com.liferay.portal; com.liferay.portlet;
763,908
public static List<BgpValueType> parsePrefixDescriptors(ChannelBuffer cb) throws BgpParseException { LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>(); BgpValueType tlv = null; boolean isIpReachInfo = false; ChannelBuffer tempCb; int count = 0; while (cb.readableBytes() > 0) { ChannelBuffer tempBuf = cb.copy(); short type = cb.readShort(); short length = cb.readShort(); if (cb.readableBytes() < length) { //length + 4 implies data contains type, length and value throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN)); } tempCb = cb.readBytes(length); switch (type) { case OspfRouteTypeTlv.TYPE: tlv = OspfRouteTypeTlv.read(tempCb); break; case IPReachabilityInformationTlv.TYPE: tlv = IPReachabilityInformationTlv.read(tempCb, length); isIpReachInfo = true; break; case BgpAttrNodeMultiTopologyId.ATTRNODE_MULTITOPOLOGY: tlv = BgpAttrNodeMultiTopologyId.read(tempCb); count = count + 1; if (count > 1) { //length + 4 implies data contains type, length and value throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length + TYPE_AND_LEN)); } break; default: UnSupportedAttribute.skipBytes(tempCb, length); } prefixDescriptor.add(tlv); } if (!isIpReachInfo) { throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, null); } return prefixDescriptor; }
static List<BgpValueType> function(ChannelBuffer cb) throws BgpParseException { LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>(); BgpValueType tlv = null; boolean isIpReachInfo = false; ChannelBuffer tempCb; int count = 0; while (cb.readableBytes() > 0) { ChannelBuffer tempBuf = cb.copy(); short type = cb.readShort(); short length = cb.readShort(); if (cb.readableBytes() < length) { throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN)); } tempCb = cb.readBytes(length); switch (type) { case OspfRouteTypeTlv.TYPE: tlv = OspfRouteTypeTlv.read(tempCb); break; case IPReachabilityInformationTlv.TYPE: tlv = IPReachabilityInformationTlv.read(tempCb, length); isIpReachInfo = true; break; case BgpAttrNodeMultiTopologyId.ATTRNODE_MULTITOPOLOGY: tlv = BgpAttrNodeMultiTopologyId.read(tempCb); count = count + 1; if (count > 1) { throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length + TYPE_AND_LEN)); } break; default: UnSupportedAttribute.skipBytes(tempCb, length); } prefixDescriptor.add(tlv); } if (!isIpReachInfo) { throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, null); } return prefixDescriptor; }
/** * Parse list of prefix descriptors. * * @param cb ChannelBuffer * @return list of prefix descriptors * @throws BgpParseException while parsing list of prefix descriptors */
Parse list of prefix descriptors
parsePrefixDescriptors
{ "repo_name": "sdnwiselab/onos", "path": "protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpPrefixLSIdentifier.java", "license": "apache-2.0", "size": 10731 }
[ "java.util.LinkedList", "java.util.List", "org.jboss.netty.buffer.ChannelBuffer", "org.onosproject.bgpio.exceptions.BgpParseException", "org.onosproject.bgpio.types.BgpErrorType", "org.onosproject.bgpio.types.BgpValueType", "org.onosproject.bgpio.types.IPReachabilityInformationTlv", "org.onosproject.bgpio.types.OspfRouteTypeTlv", "org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId", "org.onosproject.bgpio.util.UnSupportedAttribute" ]
import java.util.LinkedList; import java.util.List; import org.jboss.netty.buffer.ChannelBuffer; import org.onosproject.bgpio.exceptions.BgpParseException; import org.onosproject.bgpio.types.BgpErrorType; import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.types.IPReachabilityInformationTlv; import org.onosproject.bgpio.types.OspfRouteTypeTlv; import org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId; import org.onosproject.bgpio.util.UnSupportedAttribute;
import java.util.*; import org.jboss.netty.buffer.*; import org.onosproject.bgpio.exceptions.*; import org.onosproject.bgpio.types.*; import org.onosproject.bgpio.types.attr.*; import org.onosproject.bgpio.util.*;
[ "java.util", "org.jboss.netty", "org.onosproject.bgpio" ]
java.util; org.jboss.netty; org.onosproject.bgpio;
1,797,791
@Update public void update() { if (failOnUpdate) { throw new ConfigurationException("fail_on_update"); } }
void function() { if (failOnUpdate) { throw new ConfigurationException(STR); } }
/** * An update method that fails if {@link #failOnUpdate} is set to true. */
An update method that fails if <code>#failOnUpdate</code> is set to true
update
{ "repo_name": "zsigmond-czine-everit/ecm-component", "path": "tests/src/main/java/org/everit/osgi/ecm/component/tests/FailingComponent.java", "license": "apache-2.0", "size": 4087 }
[ "org.everit.osgi.ecm.component.ConfigurationException" ]
import org.everit.osgi.ecm.component.ConfigurationException;
import org.everit.osgi.ecm.component.*;
[ "org.everit.osgi" ]
org.everit.osgi;
28,728
public static YieldCurveBundle createCurvesBond1() { final String CREDIT_CURVE_NAME = "Credit"; final String DISCOUNTING_CURVE_NAME = "Repo"; final String FORWARD_CURVE_NAME = "Forward"; final YieldAndDiscountCurve CURVE_5 = YieldCurve.from(ConstantDoublesCurve.from(0.05)); final YieldAndDiscountCurve CURVE_4 = YieldCurve.from(ConstantDoublesCurve.from(0.04)); final YieldAndDiscountCurve CURVE_45 = YieldCurve.from(ConstantDoublesCurve.from(0.045)); final YieldCurveBundle curves = new YieldCurveBundle(); curves.setCurve(CREDIT_CURVE_NAME, CURVE_5); curves.setCurve(DISCOUNTING_CURVE_NAME, CURVE_4); curves.setCurve(FORWARD_CURVE_NAME, CURVE_45); return curves; }
static YieldCurveBundle function() { final String CREDIT_CURVE_NAME = STR; final String DISCOUNTING_CURVE_NAME = "Repo"; final String FORWARD_CURVE_NAME = STR; final YieldAndDiscountCurve CURVE_5 = YieldCurve.from(ConstantDoublesCurve.from(0.05)); final YieldAndDiscountCurve CURVE_4 = YieldCurve.from(ConstantDoublesCurve.from(0.04)); final YieldAndDiscountCurve CURVE_45 = YieldCurve.from(ConstantDoublesCurve.from(0.045)); final YieldCurveBundle curves = new YieldCurveBundle(); curves.setCurve(CREDIT_CURVE_NAME, CURVE_5); curves.setCurve(DISCOUNTING_CURVE_NAME, CURVE_4); curves.setCurve(FORWARD_CURVE_NAME, CURVE_45); return curves; }
/** * Create a yield curve bundle with three curves. One called "Credit" with a constant rate of 5%, one called "Discounting" with a constant rate of 4%, * and one called "Forward" with a constant rate of 4.5%. * @return The yield curve bundle. */
Create a yield curve bundle with three curves. One called "Credit" with a constant rate of 5%, one called "Discounting" with a constant rate of 4%, and one called "Forward" with a constant rate of 4.5%
createCurvesBond1
{ "repo_name": "DevStreet/FinanceAnalytics", "path": "projects/OG-Analytics/src/test/java/com/opengamma/analytics/financial/interestrate/TestsDataSetsSABR.java", "license": "apache-2.0", "size": 31233 }
[ "com.opengamma.analytics.financial.model.interestrate.curve.YieldAndDiscountCurve", "com.opengamma.analytics.financial.model.interestrate.curve.YieldCurve", "com.opengamma.analytics.math.curve.ConstantDoublesCurve" ]
import com.opengamma.analytics.financial.model.interestrate.curve.YieldAndDiscountCurve; import com.opengamma.analytics.financial.model.interestrate.curve.YieldCurve; import com.opengamma.analytics.math.curve.ConstantDoublesCurve;
import com.opengamma.analytics.financial.model.interestrate.curve.*; import com.opengamma.analytics.math.curve.*;
[ "com.opengamma.analytics" ]
com.opengamma.analytics;
2,761,181
public Git getOrCreateGitRepo() throws DeploymentException { String gitUrl = applicationInstance.getGitUrl(); Files.createDirectories(appTmpDir); File gitDir = new File(appTmpDir, ".git"); if (gitRepo != null || gitDir.exists() && gitDir.isDirectory()) { try { Git git = gitRepo != null ? gitRepo : Git.open(appTmpDir); // stash to get to a clean state of git dir so that we can pull without conflicts git.stashCreate(); git.stashDrop(); PullCommand pullCommand = git.pull(); if (gitCredentialsProvider != null) pullCommand.setCredentialsProvider(gitCredentialsProvider); PullResult result = pullCommand.call(); if (!result.isSuccessful()) throw new DeploymentException("Git pull was not successful: " + result.toString()); setGitRepo(git); return git; } catch (IOException | GitAPIException e) { log.error("Error opening existing cached git repo", e); throw new DeploymentException("Error opening existing cached git repo: " + e.getMessage()); } } else { try { log.info("Cloning to " + appTmpDir.toString()); CloneCommand cloneCommand = Git.cloneRepository() .setURI(gitUrl) .setTimeout(10000) .setDirectory(appTmpDir); if (gitCredentialsProvider != null) cloneCommand.setCredentialsProvider(gitCredentialsProvider); gitRepo = cloneCommand.call(); log.info("Cloned to directory: " + gitRepo.getRepository().getDirectory().getParentFile().getAbsolutePath()); return gitRepo; } catch (GitAPIException | JGitInternalException e) { log.error("Error cloning repository from OpenShift", e); throw new DeploymentException("Error cloning repository from OpenShift: " + e.getMessage()); } } }
Git function() throws DeploymentException { String gitUrl = applicationInstance.getGitUrl(); Files.createDirectories(appTmpDir); File gitDir = new File(appTmpDir, ".git"); if (gitRepo != null gitDir.exists() && gitDir.isDirectory()) { try { Git git = gitRepo != null ? gitRepo : Git.open(appTmpDir); git.stashCreate(); git.stashDrop(); PullCommand pullCommand = git.pull(); if (gitCredentialsProvider != null) pullCommand.setCredentialsProvider(gitCredentialsProvider); PullResult result = pullCommand.call(); if (!result.isSuccessful()) throw new DeploymentException(STR + result.toString()); setGitRepo(git); return git; } catch (IOException GitAPIException e) { log.error(STR, e); throw new DeploymentException(STR + e.getMessage()); } } else { try { log.info(STR + appTmpDir.toString()); CloneCommand cloneCommand = Git.cloneRepository() .setURI(gitUrl) .setTimeout(10000) .setDirectory(appTmpDir); if (gitCredentialsProvider != null) cloneCommand.setCredentialsProvider(gitCredentialsProvider); gitRepo = cloneCommand.call(); log.info(STR + gitRepo.getRepository().getDirectory().getParentFile().getAbsolutePath()); return gitRepo; } catch (GitAPIException JGitInternalException e) { log.error(STR, e); throw new DeploymentException(STR + e.getMessage()); } } }
/** * This will make sure that a directory is on disk for the git repository. It will clone the git repo to the directory * if needed, or git pull the new contents if required. * * @return git repository created/retrieved from OpenShift with the remote pointing to OpenShift * @throws DeploymentException - on any exception getting it from git */
This will make sure that a directory is on disk for the git repository. It will clone the git repo to the directory if needed, or git pull the new contents if required
getOrCreateGitRepo
{ "repo_name": "infochimps-forks/ezbake-platform-services", "path": "deployer/service/src/main/java/ezbake/deployer/publishers/openShift/RhcApplication.java", "license": "apache-2.0", "size": 21242 }
[ "java.io.File", "java.io.IOException", "org.eclipse.jgit.api.CloneCommand", "org.eclipse.jgit.api.Git", "org.eclipse.jgit.api.PullCommand", "org.eclipse.jgit.api.PullResult", "org.eclipse.jgit.api.errors.GitAPIException", "org.eclipse.jgit.api.errors.JGitInternalException" ]
import java.io.File; import java.io.IOException; import org.eclipse.jgit.api.CloneCommand; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.PullCommand; import org.eclipse.jgit.api.PullResult; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.JGitInternalException;
import java.io.*; import org.eclipse.jgit.api.*; import org.eclipse.jgit.api.errors.*;
[ "java.io", "org.eclipse.jgit" ]
java.io; org.eclipse.jgit;
1,530,720
private Scene getScene(final StageWaveBean swb, final Region region) { Scene scene = swb.scene(); if (scene == null) { scene = new Scene(region); } else { scene.setRoot(region); } return scene; }
Scene function(final StageWaveBean swb, final Region region) { Scene scene = swb.scene(); if (scene == null) { scene = new Scene(region); } else { scene.setRoot(region); } return scene; }
/** * Gets the scene. * * @param swb the waveBean holding defaut values * @param region the region * * @return the scene */
Gets the scene
getScene
{ "repo_name": "JRebirth/JRebirth", "path": "org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/basic/impl/StageServiceImpl.java", "license": "apache-2.0", "size": 4980 }
[ "org.jrebirth.af.core.command.basic.stage.StageWaveBean" ]
import org.jrebirth.af.core.command.basic.stage.StageWaveBean;
import org.jrebirth.af.core.command.basic.stage.*;
[ "org.jrebirth.af" ]
org.jrebirth.af;
1,845,691
@LocalData @Issue("JENKINS-5265") @Test public void testItemReadPermission() throws Exception { // Rebuild dependency graph as anonymous user: j.jenkins.rebuildDependencyGraph(); try { // Switch to full access to check results: ACL.impersonate2(ACL.SYSTEM2); // @LocalData for this test has jobs w/o anonymous Item.READ AbstractProject up = (AbstractProject) j.jenkins.getItem("hiddenUpstream"); assertNotNull("hiddenUpstream project not found", up); List<AbstractProject> down = j.jenkins.getDependencyGraph().getDownstream(up); assertEquals("Should have one downstream project", 1, down.size()); } finally { SecurityContextHolder.clearContext(); } }
@LocalData @Issue(STR) void function() throws Exception { j.jenkins.rebuildDependencyGraph(); try { ACL.impersonate2(ACL.SYSTEM2); AbstractProject up = (AbstractProject) j.jenkins.getItem(STR); assertNotNull(STR, up); List<AbstractProject> down = j.jenkins.getDependencyGraph().getDownstream(up); assertEquals(STR, 1, down.size()); } finally { SecurityContextHolder.clearContext(); } }
/** * Tests that all dependencies are found even when some projects have restricted visibility. */
Tests that all dependencies are found even when some projects have restricted visibility
testItemReadPermission
{ "repo_name": "rsandell/jenkins", "path": "test/src/test/java/hudson/model/DependencyGraphTest.java", "license": "mit", "size": 7719 }
[ "hudson.security.ACL", "java.util.List", "org.junit.Assert", "org.jvnet.hudson.test.Issue", "org.jvnet.hudson.test.recipes.LocalData", "org.springframework.security.core.context.SecurityContextHolder" ]
import hudson.security.ACL; import java.util.List; import org.junit.Assert; import org.jvnet.hudson.test.Issue; import org.jvnet.hudson.test.recipes.LocalData; import org.springframework.security.core.context.SecurityContextHolder;
import hudson.security.*; import java.util.*; import org.junit.*; import org.jvnet.hudson.test.*; import org.jvnet.hudson.test.recipes.*; import org.springframework.security.core.context.*;
[ "hudson.security", "java.util", "org.junit", "org.jvnet.hudson", "org.springframework.security" ]
hudson.security; java.util; org.junit; org.jvnet.hudson; org.springframework.security;
2,417,975
private final void addUser(String channel, User user) { channel = channel.toLowerCase(); synchronized (_channels) { Hashtable<User, User> users = _channels.get(channel); if (users == null) { users = new Hashtable<User, User>(); _channels.put(channel, users); } users.put(user, user); } }
final void function(String channel, User user) { channel = channel.toLowerCase(); synchronized (_channels) { Hashtable<User, User> users = _channels.get(channel); if (users == null) { users = new Hashtable<User, User>(); _channels.put(channel, users); } users.put(user, user); } }
/** * Add a user to the specified channel in our memory. * Overwrite the existing entry if it exists. */
Add a user to the specified channel in our memory. Overwrite the existing entry if it exists
addUser
{ "repo_name": "Acidburn0zzz/org.numixproject.hermes", "path": "hermes/src/main/java/org/jibble/pircbot/PircBot.java", "license": "gpl-2.0", "size": 124230 }
[ "java.util.Hashtable" ]
import java.util.Hashtable;
import java.util.*;
[ "java.util" ]
java.util;
2,082,691
@Test public void presentValueMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = METHOD_NDF.presentValue(NDF, MULTICURVES); final MultipleCurrencyAmount pvCalculator = NDF.accept(PVDC, MULTICURVES); assertEquals("Present value - non-deliverable forward", pvMethod, pvCalculator); }
void function() { final MultipleCurrencyAmount pvMethod = METHOD_NDF.presentValue(NDF, MULTICURVES); final MultipleCurrencyAmount pvCalculator = NDF.accept(PVDC, MULTICURVES); assertEquals(STR, pvMethod, pvCalculator); }
/** * Checks that the NDF present value calculator is coherent with present value method. */
Checks that the NDF present value calculator is coherent with present value method
presentValueMethodVsCalculator
{ "repo_name": "McLeodMoores/starling", "path": "projects/analytics/src/test/java/com/opengamma/analytics/financial/forex/provider/ForexNonDeliverableForwardDiscountingMethodTest.java", "license": "apache-2.0", "size": 7341 }
[ "com.opengamma.util.money.MultipleCurrencyAmount", "org.testng.AssertJUnit" ]
import com.opengamma.util.money.MultipleCurrencyAmount; import org.testng.AssertJUnit;
import com.opengamma.util.money.*; import org.testng.*;
[ "com.opengamma.util", "org.testng" ]
com.opengamma.util; org.testng;
1,812,661
public synchronized List<IComment> getComments(final TypeInstance instance) { return backend.getComments(instance); }
synchronized List<IComment> function(final TypeInstance instance) { return backend.getComments(instance); }
/** * Returns all comments for the given type instance. * * @param instance The type instance to retrieve comments for. * @return Returns all comments for the given type instance. */
Returns all comments for the given type instance
getComments
{ "repo_name": "chubbymaggie/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/types/TypeInstanceContainer.java", "license": "apache-2.0", "size": 27250 }
[ "com.google.security.zynamics.binnavi.Gui", "java.util.List" ]
import com.google.security.zynamics.binnavi.Gui; import java.util.List;
import com.google.security.zynamics.binnavi.*; import java.util.*;
[ "com.google.security", "java.util" ]
com.google.security; java.util;
2,603,696
@Test public void testServerFailureSerialization() throws Exception { IllegalStateException cause = new IllegalStateException("Expected test"); ByteBuf buf = MessageSerializer.serializeServerFailure(alloc, cause); int frameLength = buf.readInt(); assertEquals(MessageType.SERVER_FAILURE, MessageSerializer.deserializeHeader(buf)); Throwable request = MessageSerializer.deserializeServerFailure(buf); assertEquals(buf.readerIndex(), frameLength + 4); assertEquals(cause.getClass(), request.getClass()); assertEquals(cause.getMessage(), request.getMessage()); }
void function() throws Exception { IllegalStateException cause = new IllegalStateException(STR); ByteBuf buf = MessageSerializer.serializeServerFailure(alloc, cause); int frameLength = buf.readInt(); assertEquals(MessageType.SERVER_FAILURE, MessageSerializer.deserializeHeader(buf)); Throwable request = MessageSerializer.deserializeServerFailure(buf); assertEquals(buf.readerIndex(), frameLength + 4); assertEquals(cause.getClass(), request.getClass()); assertEquals(cause.getMessage(), request.getMessage()); }
/** * Tests server failure serialization. */
Tests server failure serialization
testServerFailureSerialization
{ "repo_name": "bowenli86/flink", "path": "flink-queryable-state/flink-queryable-state-runtime/src/test/java/org/apache/flink/queryablestate/network/MessageSerializerTest.java", "license": "apache-2.0", "size": 8630 }
[ "org.apache.flink.queryablestate.network.messages.MessageSerializer", "org.apache.flink.queryablestate.network.messages.MessageType", "org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf", "org.junit.Assert" ]
import org.apache.flink.queryablestate.network.messages.MessageSerializer; import org.apache.flink.queryablestate.network.messages.MessageType; import org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf; import org.junit.Assert;
import org.apache.flink.queryablestate.network.messages.*; import org.apache.flink.shaded.netty4.io.netty.buffer.*; import org.junit.*;
[ "org.apache.flink", "org.junit" ]
org.apache.flink; org.junit;
87,192
@ExceptionHandler(ProxyAuthenticationRequiredException.class) public ResponseEntity<?> proxyAuthenticationRequired(Exception ex, WebRequest webRequest) { return handleExceptionInternal(ex, ex.getLocalizedMessage(), new HttpHeaders(), HttpStatus.PROXY_AUTHENTICATION_REQUIRED, webRequest); }
@ExceptionHandler(ProxyAuthenticationRequiredException.class) ResponseEntity<?> function(Exception ex, WebRequest webRequest) { return handleExceptionInternal(ex, ex.getLocalizedMessage(), new HttpHeaders(), HttpStatus.PROXY_AUTHENTICATION_REQUIRED, webRequest); }
/** * 407 Proxy Authentication Required. */
407 Proxy Authentication Required
proxyAuthenticationRequired
{ "repo_name": "raulcsj/CPF", "path": "plugin/src/main/java/core/plugin/spring/GlobalExceptionHandler.java", "license": "apache-2.0", "size": 9428 }
[ "org.springframework.http.HttpHeaders", "org.springframework.http.HttpStatus", "org.springframework.http.ResponseEntity", "org.springframework.web.bind.annotation.ExceptionHandler", "org.springframework.web.context.request.WebRequest" ]
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest;
import org.springframework.http.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.*;
[ "org.springframework.http", "org.springframework.web" ]
org.springframework.http; org.springframework.web;
1,654,597
@Override public void onValueChange(ValueChangeEvent<SSDate> event) { resetListBox(); } }); fromDateBox.addValueChangeHandler(new ValueChangeHandler<SSDate>() {
void function(ValueChangeEvent<SSDate> event) { resetListBox(); } }); fromDateBox.addValueChangeHandler(new ValueChangeHandler<SSDate>() {
/** * The function that will be called if the user changes the date in the to box * * @param even The vent that should be handled. */
The function that will be called if the user changes the date in the to box
onValueChange
{ "repo_name": "A24Group/ssGWT-lib", "path": "src/org/ssgwt/client/ui/datagrid/filter/DateFilter.java", "license": "apache-2.0", "size": 32220 }
[ "com.google.gwt.event.logical.shared.ValueChangeEvent", "com.google.gwt.event.logical.shared.ValueChangeHandler", "org.ssgwt.client.i18n.SSDate" ]
import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import org.ssgwt.client.i18n.SSDate;
import com.google.gwt.event.logical.shared.*; import org.ssgwt.client.i18n.*;
[ "com.google.gwt", "org.ssgwt.client" ]
com.google.gwt; org.ssgwt.client;
1,792,567
public List<ConfigRevision> lookupFileInfo(String sessionKey, Integer sid, List<String> paths, boolean searchLocal) { User loggedInUser = getLoggedInUser(sessionKey); XmlRpcSystemHelper sysHelper = XmlRpcSystemHelper.getInstance(); Server server = sysHelper.lookupServer(loggedInUser, sid); ConfigurationManager cm = ConfigurationManager.getInstance(); List <ConfigRevision> revisions = new LinkedList<ConfigRevision>(); for (String path : paths) { ConfigFile cf; if (searchLocal) { cf = cm.lookupConfigFile(loggedInUser, server.getLocalOverride().getId(), path); if (cf == null) { for (ConfigChannel cn : server.getConfigChannels()) { cf = cm.lookupConfigFile(loggedInUser, cn.getId(), path); if (cf != null) { revisions.add(cf.getLatestConfigRevision()); break; } } } } else { cf = cm.lookupConfigFile(loggedInUser, server.getSandboxOverride().getId(), path); } if (cf != null) { revisions.add(cf.getLatestConfigRevision()); } } return revisions; }
List<ConfigRevision> function(String sessionKey, Integer sid, List<String> paths, boolean searchLocal) { User loggedInUser = getLoggedInUser(sessionKey); XmlRpcSystemHelper sysHelper = XmlRpcSystemHelper.getInstance(); Server server = sysHelper.lookupServer(loggedInUser, sid); ConfigurationManager cm = ConfigurationManager.getInstance(); List <ConfigRevision> revisions = new LinkedList<ConfigRevision>(); for (String path : paths) { ConfigFile cf; if (searchLocal) { cf = cm.lookupConfigFile(loggedInUser, server.getLocalOverride().getId(), path); if (cf == null) { for (ConfigChannel cn : server.getConfigChannels()) { cf = cm.lookupConfigFile(loggedInUser, cn.getId(), path); if (cf != null) { revisions.add(cf.getLatestConfigRevision()); break; } } } } else { cf = cm.lookupConfigFile(loggedInUser, server.getSandboxOverride().getId(), path); } if (cf != null) { revisions.add(cf.getLatestConfigRevision()); } } return revisions; }
/** * Given a list of paths and a server the method returns details about the latest * revisions of the paths. * @param sessionKey the session key * @param sid the server id * @param paths a list of paths to examine. * @param searchLocal true look at local overrides, false * to look at sandbox overrides * @return a list containing the latest config revisions of the requested paths. * @since 10.2 * * @xmlrpc.doc Given a list of paths and a server, returns details about * the latest revisions of the paths. * @xmlrpc.param #session_key() * @xmlrpc.param #param("int","serverId") * @xmlrpc.param #array_single("string","paths to lookup on.") * @xmlrpc.param #param("int","searchLocal") * #options() * #item_desc ("1", "to search configuration file paths * in the system's local override configuration or * systems subscribed central channels") * #item_desc ("0", "to search configuration file paths * in the system's sandbox configuration channel") * #options_end() * @xmlrpc.returntype * #array() * $ConfigRevisionSerializer * #array_end() */
Given a list of paths and a server the method returns details about the latest revisions of the paths
lookupFileInfo
{ "repo_name": "colloquium/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/system/config/ServerConfigHandler.java", "license": "gpl-2.0", "size": 26608 }
[ "com.redhat.rhn.domain.config.ConfigChannel", "com.redhat.rhn.domain.config.ConfigFile", "com.redhat.rhn.domain.config.ConfigRevision", "com.redhat.rhn.domain.server.Server", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.xmlrpc.system.XmlRpcSystemHelper", "com.redhat.rhn.manager.configuration.ConfigurationManager", "java.util.LinkedList", "java.util.List" ]
import com.redhat.rhn.domain.config.ConfigChannel; import com.redhat.rhn.domain.config.ConfigFile; import com.redhat.rhn.domain.config.ConfigRevision; import com.redhat.rhn.domain.server.Server; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.xmlrpc.system.XmlRpcSystemHelper; import com.redhat.rhn.manager.configuration.ConfigurationManager; import java.util.LinkedList; import java.util.List;
import com.redhat.rhn.domain.config.*; import com.redhat.rhn.domain.server.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.xmlrpc.system.*; import com.redhat.rhn.manager.configuration.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
2,826,734
private void refreshActivityClient(int id) { clients.get(id).lastActiveTime = Calendar.getInstance().getTime(); }
void function(int id) { clients.get(id).lastActiveTime = Calendar.getInstance().getTime(); }
/** * refresh the client activity date (can be used to detect afk or disconnected players) * @param id */
refresh the client activity date (can be used to detect afk or disconnected players)
refreshActivityClient
{ "repo_name": "hendrikp/GameFindRefuge", "path": "src/rmi/RMIServer.java", "license": "bsd-2-clause", "size": 4374 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
1,239,045
public Object put(String key, Object value) { // handle properties as if they were map elements // due to an inconsistency in the BeanUtils 1.5 through 1.7.0 // versions. Version 1.7.1 will fix this again, though ... if (FIELD_PROPERTIES.equals(key)) { Object old = getProperties(); setProperties((ManageableMap) value); return old; } return super.put(key, value); }
Object function(String key, Object value) { if (FIELD_PROPERTIES.equals(key)) { Object old = getProperties(); setProperties((ManageableMap) value); return old; } return super.put(key, value); }
/** * Sets the value of the indexed property. * <p> * For the special property <code>properties</code> the * {@link #setProperties(ManagedHashMap)} method is called to insert all * elements of the <code>value</code> which must be a <code>Map</code> * into this map. * * @param key The index of the property to set * @param value The value of the property to set. * @return The former value of the property or <code>null</code> if the * property is new. * @throws ClassCastException If the type of the <code>value</code> is * <code>ManagedHashMap</code> for the <code>properties</code> * property. */
Sets the value of the indexed property. For the special property <code>properties</code> the <code>#setProperties(ManagedHashMap)</code> method is called to insert all elements of the <code>value</code> which must be a <code>Map</code> into this map
put
{ "repo_name": "codders/k2-sling-fork", "path": "bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/DefaultMappedObject.java", "license": "apache-2.0", "size": 12280 }
[ "org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableMap" ]
import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableMap;
import org.apache.jackrabbit.ocm.manager.collectionconverter.*;
[ "org.apache.jackrabbit" ]
org.apache.jackrabbit;
2,499,758
Flow item = null; String sql; ArrayList values; sql = "select id, name, flow_order AS flowOrder from admin.flow where id=?"; values = new ArrayList(); values.add(id); item = (Flow) DatabaseUtils.getBean(conn, Flow.class, sql, values); return item; }
Flow item = null; String sql; ArrayList values; sql = STR; values = new ArrayList(); values.add(id); item = (Flow) DatabaseUtils.getBean(conn, Flow.class, sql, values); return item; }
/** * Returns one record * * @param conn * @param id * @return * @throws java.sql.SQLException * @throws javax.servlet.ServletException */
Returns one record
getOne
{ "repo_name": "chrisekelley/zeprs", "path": "src/zeprs/org/cidrz/webapp/dynasite/dao/FlowDAO.java", "license": "apache-2.0", "size": 3646 }
[ "java.util.ArrayList", "org.cidrz.webapp.dynasite.utils.DatabaseUtils", "org.cidrz.webapp.dynasite.valueobject.Flow" ]
import java.util.ArrayList; import org.cidrz.webapp.dynasite.utils.DatabaseUtils; import org.cidrz.webapp.dynasite.valueobject.Flow;
import java.util.*; import org.cidrz.webapp.dynasite.utils.*; import org.cidrz.webapp.dynasite.valueobject.*;
[ "java.util", "org.cidrz.webapp" ]
java.util; org.cidrz.webapp;
72,872
// COMPLETED (21) Refactor onCreateLoader to return a Loader<Cursor>, not Loader<String[]> @Override public Loader<Cursor> onCreateLoader(int loaderId, Bundle bundle) { // COMPLETED (23) Remove the onStartLoading method declaration // COMPLETED (24) Remove the loadInBackground method declaration // COMPLETED (25) Remove the deliverResult method declaration switch (loaderId) { // COMPLETED (22) If the loader requested is our forecast loader, return the appropriate CursorLoader case ID_FORECAST_LOADER: Uri forecastQueryUri = WeatherContract.WeatherEntry.CONTENT_URI; String sortOrder = WeatherContract.WeatherEntry.COLUMN_DATE + " ASC"; String selection = WeatherContract.WeatherEntry.getSqlSelectForTodayOnwards(); return new CursorLoader(this, forecastQueryUri, MAIN_FORECAST_PROJECTION, selection, null, sortOrder); default: throw new RuntimeException("Loader Not Implemented: " + loaderId); } }
Loader<Cursor> function(int loaderId, Bundle bundle) { switch (loaderId) { case ID_FORECAST_LOADER: Uri forecastQueryUri = WeatherContract.WeatherEntry.CONTENT_URI; String sortOrder = WeatherContract.WeatherEntry.COLUMN_DATE + STR; String selection = WeatherContract.WeatherEntry.getSqlSelectForTodayOnwards(); return new CursorLoader(this, forecastQueryUri, MAIN_FORECAST_PROJECTION, selection, null, sortOrder); default: throw new RuntimeException(STR + loaderId); } }
/** * Called by the {@link android.support.v4.app.LoaderManagerImpl} when a new Loader needs to be * created. This Activity only uses one loader, so we don't necessarily NEED to check the * loaderId, but this is certainly best practice. * * @param loaderId The loader ID for which we need to create a loader * @param bundle Any arguments supplied by the caller * @return A new Loader instance that is ready to start loading. */
Called by the <code>android.support.v4.app.LoaderManagerImpl</code> when a new Loader needs to be created. This Activity only uses one loader, so we don't necessarily NEED to check the loaderId, but this is certainly best practice
onCreateLoader
{ "repo_name": "3Heads6Arms/Sunshine", "path": "S09.04-Solution-UsingCursorLoader/app/src/main/java/com/example/android/sunshine/MainActivity.java", "license": "apache-2.0", "size": 16139 }
[ "android.database.Cursor", "android.net.Uri", "android.os.Bundle", "android.support.v4.content.CursorLoader", "android.support.v4.content.Loader", "com.example.android.sunshine.data.WeatherContract" ]
import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import com.example.android.sunshine.data.WeatherContract;
import android.database.*; import android.net.*; import android.os.*; import android.support.v4.content.*; import com.example.android.sunshine.data.*;
[ "android.database", "android.net", "android.os", "android.support", "com.example.android" ]
android.database; android.net; android.os; android.support; com.example.android;
2,232,501
public static void removeTheme(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, org.ontoware.rdf2go.model.node.Node value) { Base.remove(model, instanceResource, THEME, value); }
static void function(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, org.ontoware.rdf2go.model.node.Node value) { Base.remove(model, instanceResource, THEME, value); }
/** * Removes a value of property Theme as an RDF2Go node * * @param model an RDF2Go model * @param resource an RDF2Go resource * @param value the value to be removed [Generated from RDFReactor template * rule #remove1static] */
Removes a value of property Theme as an RDF2Go node
removeTheme
{ "repo_name": "m0ep/master-thesis", "path": "source/apis/rdf2go/rdf2go-foaf/src/main/java/com/xmlns/foaf/Thing.java", "license": "mit", "size": 274766 }
[ "org.ontoware.rdf2go.model.Model", "org.ontoware.rdfreactor.runtime.Base" ]
import org.ontoware.rdf2go.model.Model; import org.ontoware.rdfreactor.runtime.Base;
import org.ontoware.rdf2go.model.*; import org.ontoware.rdfreactor.runtime.*;
[ "org.ontoware.rdf2go", "org.ontoware.rdfreactor" ]
org.ontoware.rdf2go; org.ontoware.rdfreactor;
2,810,108
public void paintSliderTrackBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintBackground(context, g, x, y, w, h, null); }
void function(SynthContext context, Graphics g, int x, int y, int w, int h) { paintBackground(context, g, x, y, w, h, null); }
/** * Paints the background of the track of a slider. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */
Paints the background of the track of a slider
paintSliderTrackBackground
{ "repo_name": "anhtu1995ok/seaglass", "path": "src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java", "license": "apache-2.0", "size": 119406 }
[ "java.awt.Graphics", "javax.swing.plaf.synth.SynthContext" ]
import java.awt.Graphics; import javax.swing.plaf.synth.SynthContext;
import java.awt.*; import javax.swing.plaf.synth.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,401,413
protected void grow(int minCapacity) { // overflow-conscious code int oldCapacity = buf.length; int newCapacity = oldCapacity << 1; if (newCapacity - minCapacity < 0) newCapacity = minCapacity; if (newCapacity < 0) { if (minCapacity < 0) // overflow throw new OutOfMemoryError(); newCapacity = Integer.MAX_VALUE; } buf = Arrays.copyOf(buf, newCapacity); }
void function(int minCapacity) { int oldCapacity = buf.length; int newCapacity = oldCapacity << 1; if (newCapacity - minCapacity < 0) newCapacity = minCapacity; if (newCapacity < 0) { if (minCapacity < 0) throw new OutOfMemoryError(); newCapacity = Integer.MAX_VALUE; } buf = Arrays.copyOf(buf, newCapacity); }
/** * Increases the capacity to ensure that it can hold at least the number of * elements specified by the minimum capacity argument. * * @param minCapacity * the desired minimum capacity */
Increases the capacity to ensure that it can hold at least the number of elements specified by the minimum capacity argument
grow
{ "repo_name": "ExpediaDotCom/tesla", "path": "java/core/src/main/java/com/expedia/tesla/utils/LockFreeMemoryOutputStream.java", "license": "apache-2.0", "size": 4623 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
537,982
public static void assertEquals(String message, NominalMapping expected, NominalMapping actual, boolean ignoreOrder) { if (expected == actual) { return; } Assert.assertTrue(expected == null && actual == null || expected != null && actual != null); if (expected == null || actual == null) { return; } Assert.assertEquals(message + " (nominal mapping size)", expected.size(), actual.size()); List<String> expectedValues = expected.getValues(); List<String> actualValues = actual.getValues(); // check that we have the same values in both mappings: Set<String> expectedValuesSet = new HashSet<String>(expectedValues); Set<String> actualValuesSet = new HashSet<String>(actualValues); Assert.assertEquals(message + " (different nominal values)", expectedValuesSet, actualValuesSet); if (!ignoreOrder) { // check order Iterator<String> expectedIt = expectedValues.iterator(); while (expectedIt.hasNext()) { String expectedValue = expectedIt.next(); Assert.assertEquals(message + " (index of nominal value '" + expectedValue + "')", expected.mapString(expectedValue), actual.mapString(expectedValue)); } } }
static void function(String message, NominalMapping expected, NominalMapping actual, boolean ignoreOrder) { if (expected == actual) { return; } Assert.assertTrue(expected == null && actual == null expected != null && actual != null); if (expected == null actual == null) { return; } Assert.assertEquals(message + STR, expected.size(), actual.size()); List<String> expectedValues = expected.getValues(); List<String> actualValues = actual.getValues(); Set<String> expectedValuesSet = new HashSet<String>(expectedValues); Set<String> actualValuesSet = new HashSet<String>(actualValues); Assert.assertEquals(message + STR, expectedValuesSet, actualValuesSet); if (!ignoreOrder) { Iterator<String> expectedIt = expectedValues.iterator(); while (expectedIt.hasNext()) { String expectedValue = expectedIt.next(); Assert.assertEquals(message + STR + expectedValue + "')", expected.mapString(expectedValue), actual.mapString(expectedValue)); } } }
/** * Tests two nominal mappings for its size and values. * * @param message * message to display if an error occurs * @param expected * expected value * @param actual * actual value * @param ignoreOrder * if <code>true</code> the order of the mappings is not checked, but only the size * of the mapping and that all values of <code>expected</code> are present in * <code>actual</code>. */
Tests two nominal mappings for its size and values
assertEquals
{ "repo_name": "boob-sbcm/3838438", "path": "src/main/java/com/rapidminer/test_utils/RapidAssert.java", "license": "agpl-3.0", "size": 22122 }
[ "com.rapidminer.example.table.NominalMapping", "java.util.HashSet", "java.util.Iterator", "java.util.List", "java.util.Set", "org.junit.Assert" ]
import com.rapidminer.example.table.NominalMapping; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.junit.Assert;
import com.rapidminer.example.table.*; import java.util.*; import org.junit.*;
[ "com.rapidminer.example", "java.util", "org.junit" ]
com.rapidminer.example; java.util; org.junit;
2,385,976
@Column(name="USE_PER_DIEM",nullable=false,length=1) public boolean getUsePerDiem() { return usePerDiem; }
@Column(name=STR,nullable=false,length=1) boolean function() { return usePerDiem; }
/** * Gets the usePerDiem attribute. * @return Returns the usePerDiem. */
Gets the usePerDiem attribute
getUsePerDiem
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/tem/businessobject/TripType.java", "license": "agpl-3.0", "size": 6229 }
[ "javax.persistence.Column" ]
import javax.persistence.Column;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
351,288
public Writable call(Writable param, InetSocketAddress addr, Class<? extends VersionedProtocol> protocol, User ticket, int rpcTimeout) throws InterruptedException, IOException { Call call = new Call(param); Connection connection = getConnection(addr, protocol, ticket, rpcTimeout, call); connection.sendParam(call); // send the parameter boolean interrupted = false; //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (call) { while (!call.done) { try { call.wait(); // wait for the result } catch (InterruptedException ignored) { // save the fact that we were interrupted interrupted = true; } } if (interrupted) { // set the interrupt flag now that we are done waiting Thread.currentThread().interrupt(); } if (call.error != null) { if (call.error instanceof RemoteException) { call.error.fillInStackTrace(); throw call.error; } // local exception throw wrapException(addr, call.error); } return call.value; } }
Writable function(Writable param, InetSocketAddress addr, Class<? extends VersionedProtocol> protocol, User ticket, int rpcTimeout) throws InterruptedException, IOException { Call call = new Call(param); Connection connection = getConnection(addr, protocol, ticket, rpcTimeout, call); connection.sendParam(call); boolean interrupted = false; synchronized (call) { while (!call.done) { try { call.wait(); } catch (InterruptedException ignored) { interrupted = true; } } if (interrupted) { Thread.currentThread().interrupt(); } if (call.error != null) { if (call.error instanceof RemoteException) { call.error.fillInStackTrace(); throw call.error; } throw wrapException(addr, call.error); } return call.value; } }
/** Make a call, passing <code>param</code>, to the IPC server running at * <code>address</code> which is servicing the <code>protocol</code> protocol, * with the <code>ticket</code> credentials, returning the value. * Throws exceptions if there are network problems or if the remote code * threw an exception. */
Make a call, passing <code>param</code>, to the IPC server running at <code>address</code> which is servicing the <code>protocol</code> protocol, with the <code>ticket</code> credentials, returning the value. Throws exceptions if there are network problems or if the remote code
call
{ "repo_name": "Shmuma/hbase-trunk", "path": "src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java", "license": "apache-2.0", "size": 37596 }
[ "java.io.IOException", "java.net.InetSocketAddress", "org.apache.hadoop.hbase.security.User", "org.apache.hadoop.io.Writable", "org.apache.hadoop.ipc.RemoteException" ]
import java.io.IOException; import java.net.InetSocketAddress; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.io.Writable; import org.apache.hadoop.ipc.RemoteException;
import java.io.*; import java.net.*; import org.apache.hadoop.hbase.security.*; import org.apache.hadoop.io.*; import org.apache.hadoop.ipc.*;
[ "java.io", "java.net", "org.apache.hadoop" ]
java.io; java.net; org.apache.hadoop;
288,803
void add(AbstractState state);
void add(AbstractState state);
/** * Add an abstract state to the waitlist. */
Add an abstract state to the waitlist
add
{ "repo_name": "TommesDee/cpachecker", "path": "src/org/sosy_lab/cpachecker/core/waitlist/Waitlist.java", "license": "apache-2.0", "size": 3561 }
[ "org.sosy_lab.cpachecker.core.interfaces.AbstractState" ]
import org.sosy_lab.cpachecker.core.interfaces.AbstractState;
import org.sosy_lab.cpachecker.core.interfaces.*;
[ "org.sosy_lab.cpachecker" ]
org.sosy_lab.cpachecker;
224,328
public void fillEncryptionData(ParsableByteArray source) { source.readBytes(sampleEncryptionData.data, 0, sampleEncryptionDataLength); sampleEncryptionData.setPosition(0); sampleEncryptionDataNeedsFill = false; }
void function(ParsableByteArray source) { source.readBytes(sampleEncryptionData.data, 0, sampleEncryptionDataLength); sampleEncryptionData.setPosition(0); sampleEncryptionDataNeedsFill = false; }
/** * Fills {@link #sampleEncryptionData} from the provided source. * * @param source A source from which to read the encryption data. */
Fills <code>#sampleEncryptionData</code> from the provided source
fillEncryptionData
{ "repo_name": "gysgogo/levetube", "path": "lib/src/main/java/com/google/android/exoplayer2/extractor/mp4/TrackFragment.java", "license": "gpl-3.0", "size": 6649 }
[ "com.google.android.exoplayer2.util.ParsableByteArray" ]
import com.google.android.exoplayer2.util.ParsableByteArray;
import com.google.android.exoplayer2.util.*;
[ "com.google.android" ]
com.google.android;
2,514,053
public Paint getBaseSectionPaint() { return this.baseSectionPaint; }
Paint function() { return this.baseSectionPaint; }
/** * Returns the base section paint. This is used when no other paint is * defined, which is rare. The default value is <code>Color.gray</code>. * * @return The paint (never <code>null</code>). * * @see #setBaseSectionPaint(Paint) */
Returns the base section paint. This is used when no other paint is defined, which is rare. The default value is <code>Color.gray</code>
getBaseSectionPaint
{ "repo_name": "ibestvina/multithread-centiscape", "path": "CentiScaPe2.1/src/main/java/org/jfree/chart/plot/PiePlot.java", "license": "mit", "size": 116475 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
982,036