method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public void forceConsistent() {
synchronized (actions) {
final List<BlobStoreAction> consistentActions = consistentView(actions);
actions.clear();
actions.addAll(consistentActions);
consistent = true;
}
}
}
private enum Operation {
PUT, GET, DELETE
}
private static final class BlobStoreAction {
private final Operation operation;
@Nullable
private final byte[] data;
private final String path;
private BlobStoreAction(Operation operation, String path, byte[] data) {
this.operation = operation;
this.path = path;
this.data = data;
}
private BlobStoreAction(Operation operation, String path) {
this(operation, path, null);
}
}
private class MockBlobStore implements BlobStore {
private AtomicBoolean closed = new AtomicBoolean(false); | void function() { synchronized (actions) { final List<BlobStoreAction> consistentActions = consistentView(actions); actions.clear(); actions.addAll(consistentActions); consistent = true; } } } private enum Operation { PUT, GET, DELETE } private static final class BlobStoreAction { private final Operation operation; private final byte[] data; private final String path; private BlobStoreAction(Operation operation, String path, byte[] data) { this.operation = operation; this.path = path; this.data = data; } private BlobStoreAction(Operation operation, String path) { this(operation, path, null); } } private class MockBlobStore implements BlobStore { private AtomicBoolean closed = new AtomicBoolean(false); | /**
* Force the repository into a consistent end state so that its eventual state can be examined.
*/ | Force the repository into a consistent end state so that its eventual state can be examined | forceConsistent | {
"repo_name": "HonzaKral/elasticsearch",
"path": "server/src/test/java/org/elasticsearch/snapshots/mockstore/MockEventuallyConsistentRepository.java",
"license": "apache-2.0",
"size": 18214
} | [
"java.util.List",
"java.util.concurrent.atomic.AtomicBoolean",
"org.elasticsearch.common.blobstore.BlobStore"
] | import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import org.elasticsearch.common.blobstore.BlobStore; | import java.util.*; import java.util.concurrent.atomic.*; import org.elasticsearch.common.blobstore.*; | [
"java.util",
"org.elasticsearch.common"
] | java.util; org.elasticsearch.common; | 1,761,427 |
private List<ConstraintDescriptorImpl<?>> findConstraints(Member member, ElementType type) {
List<ConstraintDescriptorImpl<?>> metaData = newArrayList();
for ( Annotation annotation : ( (AccessibleObject) member ).getDeclaredAnnotations() ) {
metaData.addAll( findConstraintAnnotations( member, annotation, type ) );
}
return metaData;
} | List<ConstraintDescriptorImpl<?>> function(Member member, ElementType type) { List<ConstraintDescriptorImpl<?>> metaData = newArrayList(); for ( Annotation annotation : ( (AccessibleObject) member ).getDeclaredAnnotations() ) { metaData.addAll( findConstraintAnnotations( member, annotation, type ) ); } return metaData; } | /**
* Finds all constraint annotations defined for the given member and returns them in a list of
* constraint descriptors.
*
* @param member The member to check for constraints annotations.
* @param type The element type the constraint/annotation is placed on.
*
* @return A list of constraint descriptors for all constraint specified for the given member.
*/ | Finds all constraint annotations defined for the given member and returns them in a list of constraint descriptors | findConstraints | {
"repo_name": "flibbertigibbet/hibernate-validator-android",
"path": "engine/src/main/java/org/hibernate/validator/internal/metadata/provider/AnnotationMetaDataProvider.java",
"license": "apache-2.0",
"size": 23843
} | [
"java.lang.annotation.Annotation",
"java.lang.annotation.ElementType",
"java.lang.reflect.AccessibleObject",
"java.lang.reflect.Member",
"java.util.List",
"org.hibernate.validator.internal.metadata.descriptor.ConstraintDescriptorImpl",
"org.hibernate.validator.internal.util.CollectionHelper"
] | import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Member; import java.util.List; import org.hibernate.validator.internal.metadata.descriptor.ConstraintDescriptorImpl; import org.hibernate.validator.internal.util.CollectionHelper; | import java.lang.annotation.*; import java.lang.reflect.*; import java.util.*; import org.hibernate.validator.internal.metadata.descriptor.*; import org.hibernate.validator.internal.util.*; | [
"java.lang",
"java.util",
"org.hibernate.validator"
] | java.lang; java.util; org.hibernate.validator; | 2,345,781 |
@VisibleForTesting
boolean tryCreatingHistoryDirs(boolean logWait) throws IOException {
boolean succeeded = true;
String doneDirPrefix = JobHistoryUtils.
getConfiguredHistoryServerDoneDirPrefix(conf);
try {
doneDirPrefixPath = FileContext.getFileContext(conf).makeQualified(
new Path(doneDirPrefix));
doneDirFc = FileContext.getFileContext(doneDirPrefixPath.toUri(), conf);
doneDirFc.setUMask(JobHistoryUtils.HISTORY_DONE_DIR_UMASK);
mkdir(doneDirFc, doneDirPrefixPath, new FsPermission(
JobHistoryUtils.HISTORY_DONE_DIR_PERMISSION));
} catch (ConnectException ex) {
if (logWait) {
LOG.info("Waiting for FileSystem at " +
doneDirPrefixPath.toUri().getAuthority() + "to be available");
}
succeeded = false;
} catch (IOException e) {
if (isBecauseSafeMode(e)) {
succeeded = false;
if (logWait) {
LOG.info("Waiting for FileSystem at " +
doneDirPrefixPath.toUri().getAuthority() +
"to be out of safe mode");
}
} else {
throw new YarnRuntimeException("Error creating done directory: ["
+ doneDirPrefixPath + "]", e);
}
}
if (succeeded) {
String intermediateDoneDirPrefix = JobHistoryUtils.
getConfiguredHistoryIntermediateDoneDirPrefix(conf);
try {
intermediateDoneDirPath = FileContext.getFileContext(conf).makeQualified(
new Path(intermediateDoneDirPrefix));
intermediateDoneDirFc = FileContext.getFileContext(
intermediateDoneDirPath.toUri(), conf);
mkdir(intermediateDoneDirFc, intermediateDoneDirPath, new FsPermission(
JobHistoryUtils.HISTORY_INTERMEDIATE_DONE_DIR_PERMISSIONS.toShort()));
} catch (ConnectException ex) {
succeeded = false;
if (logWait) {
LOG.info("Waiting for FileSystem at " +
intermediateDoneDirPath.toUri().getAuthority() +
"to be available");
}
} catch (IOException e) {
if (isBecauseSafeMode(e)) {
succeeded = false;
if (logWait) {
LOG.info("Waiting for FileSystem at " +
intermediateDoneDirPath.toUri().getAuthority() +
"to be out of safe mode");
}
} else {
throw new YarnRuntimeException(
"Error creating intermediate done directory: ["
+ intermediateDoneDirPath + "]", e);
}
}
}
return succeeded;
} | boolean tryCreatingHistoryDirs(boolean logWait) throws IOException { boolean succeeded = true; String doneDirPrefix = JobHistoryUtils. getConfiguredHistoryServerDoneDirPrefix(conf); try { doneDirPrefixPath = FileContext.getFileContext(conf).makeQualified( new Path(doneDirPrefix)); doneDirFc = FileContext.getFileContext(doneDirPrefixPath.toUri(), conf); doneDirFc.setUMask(JobHistoryUtils.HISTORY_DONE_DIR_UMASK); mkdir(doneDirFc, doneDirPrefixPath, new FsPermission( JobHistoryUtils.HISTORY_DONE_DIR_PERMISSION)); } catch (ConnectException ex) { if (logWait) { LOG.info(STR + doneDirPrefixPath.toUri().getAuthority() + STR); } succeeded = false; } catch (IOException e) { if (isBecauseSafeMode(e)) { succeeded = false; if (logWait) { LOG.info(STR + doneDirPrefixPath.toUri().getAuthority() + STR); } } else { throw new YarnRuntimeException(STR + doneDirPrefixPath + "]", e); } } if (succeeded) { String intermediateDoneDirPrefix = JobHistoryUtils. getConfiguredHistoryIntermediateDoneDirPrefix(conf); try { intermediateDoneDirPath = FileContext.getFileContext(conf).makeQualified( new Path(intermediateDoneDirPrefix)); intermediateDoneDirFc = FileContext.getFileContext( intermediateDoneDirPath.toUri(), conf); mkdir(intermediateDoneDirFc, intermediateDoneDirPath, new FsPermission( JobHistoryUtils.HISTORY_INTERMEDIATE_DONE_DIR_PERMISSIONS.toShort())); } catch (ConnectException ex) { succeeded = false; if (logWait) { LOG.info(STR + intermediateDoneDirPath.toUri().getAuthority() + STR); } } catch (IOException e) { if (isBecauseSafeMode(e)) { succeeded = false; if (logWait) { LOG.info(STR + intermediateDoneDirPath.toUri().getAuthority() + STR); } } else { throw new YarnRuntimeException( STR + intermediateDoneDirPath + "]", e); } } } return succeeded; } | /**
* Returns TRUE if the history dirs were created, FALSE if they could not
* be created because the FileSystem is not reachable or in safe mode and
* throws and exception otherwise.
*/ | Returns TRUE if the history dirs were created, FALSE if they could not be created because the FileSystem is not reachable or in safe mode and throws and exception otherwise | tryCreatingHistoryDirs | {
"repo_name": "robzor92/hops",
"path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/HistoryFileManager.java",
"license": "apache-2.0",
"size": 40859
} | [
"java.io.IOException",
"java.net.ConnectException",
"org.apache.hadoop.fs.FileContext",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.fs.permission.FsPermission",
"org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils",
"org.apache.hadoop.yarn.exceptions.YarnRuntimeException"
] | import java.io.IOException; import java.net.ConnectException; import org.apache.hadoop.fs.FileContext; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; | import java.io.*; import java.net.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.mapreduce.v2.jobhistory.*; import org.apache.hadoop.yarn.exceptions.*; | [
"java.io",
"java.net",
"org.apache.hadoop"
] | java.io; java.net; org.apache.hadoop; | 536,555 |
private boolean hasNextImage() throws IOException {
if (debug) {
System.out.print("hasNextImage called; returning ");
}
iis.mark();
boolean foundFF = false;
for (int byteval = iis.read();
byteval != -1;
byteval = iis.read()) {
if (foundFF == true) {
if (byteval == JPEG.SOI) {
iis.reset();
if (debug) {
System.out.println("true");
}
return true;
}
}
foundFF = (byteval == 0xff) ? true : false;
}
// We hit the end of the stream before we hit an SOI, so no image
iis.reset();
if (debug) {
System.out.println("false");
}
return false;
} | boolean function() throws IOException { if (debug) { System.out.print(STR); } iis.mark(); boolean foundFF = false; for (int byteval = iis.read(); byteval != -1; byteval = iis.read()) { if (foundFF == true) { if (byteval == JPEG.SOI) { iis.reset(); if (debug) { System.out.println("true"); } return true; } } foundFF = (byteval == 0xff) ? true : false; } iis.reset(); if (debug) { System.out.println("false"); } return false; } | /**
* Returns {@code true} if there is an image beyond
* the current stream position. Does not disturb the
* stream position.
*/ | Returns true if there is an image beyond the current stream position. Does not disturb the stream position | hasNextImage | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java",
"license": "gpl-2.0",
"size": 68633
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,206,599 |
public Date getLastArrivalDate() throws ParseException {
if (lastArrivalTime == 0L) return null;
return getLastArrivalDate(Locale.US);
} | Date function() throws ParseException { if (lastArrivalTime == 0L) return null; return getLastArrivalDate(Locale.US); } | /**
* Returns the last arrival time as a {@link java.util.Date date} in the
* {@code US} locale, which may be null.
*
* @return Date of last arrival time or null if no events have been received
* @throws ParseException Thrown if the errors occur processing the arrival
* time
*/ | Returns the last arrival time as a <code>java.util.Date date</code> in the US locale, which may be null | getLastArrivalDate | {
"repo_name": "glassbeam/watcher",
"path": "src/java/classes/com/den_4/inotify_java/MonitorService.java",
"license": "gpl-3.0",
"size": 25230
} | [
"java.text.ParseException",
"java.util.Date",
"java.util.Locale"
] | import java.text.ParseException; import java.util.Date; import java.util.Locale; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 1,837,006 |
public void passthroughAll() throws Exception {
// Copy previous objects
packetValues.addAll(readableObjects);
readableObjects.clear();
// If the buffer has readable bytes, copy them.
if (inputBuffer.readableBytes() > 0) {
passthrough(Type.REMAINING_BYTES);
}
} | void function() throws Exception { packetValues.addAll(readableObjects); readableObjects.clear(); if (inputBuffer.readableBytes() > 0) { passthrough(Type.REMAINING_BYTES); } } | /**
* Take all the inputs and write them to the output.
*
* @throws Exception If it failed to read or write
*/ | Take all the inputs and write them to the output | passthroughAll | {
"repo_name": "Matsv/ViaVersion",
"path": "common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java",
"license": "mit",
"size": 17795
} | [
"us.myles.ViaVersion"
] | import us.myles.ViaVersion; | import us.myles.*; | [
"us.myles"
] | us.myles; | 2,595,692 |
public List<String> get(String name) {
List<Object> values = properties.get(name);
if (values == null) return null;
if (values.isEmpty()) return Collections.<String>emptyList();
// Compatibility ...
List<String> stringValues = new ArrayList<>(values.size());
for (Object value : values)
stringValues.add(value.toString());
return Collections.unmodifiableList(stringValues);
} | List<String> function(String name) { List<Object> values = properties.get(name); if (values == null) return null; if (values.isEmpty()) return Collections.<String>emptyList(); List<String> stringValues = new ArrayList<>(values.size()); for (Object value : values) stringValues.add(value.toString()); return Collections.unmodifiableList(stringValues); } | /**
* Returns a read-only list of properties properties by full name.
* If this is not set, null is returned. If this is explicitly set to
* have no values, and empty list is returned.
*/ | Returns a read-only list of properties properties by full name. If this is not set, null is returned. If this is explicitly set to have no values, and empty list is returned | get | {
"repo_name": "vespa-engine/vespa",
"path": "container-search/src/main/java/com/yahoo/search/query/ranking/RankProperties.java",
"license": "apache-2.0",
"size": 3566
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 260,045 |
public void deleteComment(String commentId) throws IOException, FlickrException, JSONException {
List<Parameter> parameters = new ArrayList<Parameter>();
parameters.add(new Parameter("method", METHOD_DELETE_COMMENT));
parameters.add(new Parameter(OAuthInterface.PARAM_OAUTH_CONSUMER_KEY, apiKey));
parameters.add(new Parameter("comment_id", commentId));
OAuthUtils.addOAuthToken(parameters);
//Note: This method requires an HTTP POST request.
Response response = transportAPI.postJSON(sharedSecret, parameters);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty
// sucess response if it completes without error.
} | void function(String commentId) throws IOException, FlickrException, JSONException { List<Parameter> parameters = new ArrayList<Parameter>(); parameters.add(new Parameter(STR, METHOD_DELETE_COMMENT)); parameters.add(new Parameter(OAuthInterface.PARAM_OAUTH_CONSUMER_KEY, apiKey)); parameters.add(new Parameter(STR, commentId)); OAuthUtils.addOAuthToken(parameters); Response response = transportAPI.postJSON(sharedSecret, parameters); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } } | /**
* Delete a comment as the currently authenticated user.
*
* This method requires authentication with 'write' permission.
*
* @param commentId The id of the comment to delete.
* @throws IOException
* @throws FlickrException
* @throws JSONException
*/ | Delete a comment as the currently authenticated user. This method requires authentication with 'write' permission | deleteComment | {
"repo_name": "0570dev/flickr-glass",
"path": "src/com/googlecode/flickrjandroid/photos/comments/CommentsInterface.java",
"license": "apache-2.0",
"size": 11281
} | [
"com.googlecode.flickrjandroid.FlickrException",
"com.googlecode.flickrjandroid.Parameter",
"com.googlecode.flickrjandroid.Response",
"com.googlecode.flickrjandroid.oauth.OAuthInterface",
"com.googlecode.flickrjandroid.oauth.OAuthUtils",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"org.json.JSONException"
] | import com.googlecode.flickrjandroid.FlickrException; import com.googlecode.flickrjandroid.Parameter; import com.googlecode.flickrjandroid.Response; import com.googlecode.flickrjandroid.oauth.OAuthInterface; import com.googlecode.flickrjandroid.oauth.OAuthUtils; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.json.JSONException; | import com.googlecode.flickrjandroid.*; import com.googlecode.flickrjandroid.oauth.*; import java.io.*; import java.util.*; import org.json.*; | [
"com.googlecode.flickrjandroid",
"java.io",
"java.util",
"org.json"
] | com.googlecode.flickrjandroid; java.io; java.util; org.json; | 829,813 |
private static byte[] streamToBytes(InputStream in, int length) throws IOException {
byte[] bytes = new byte[length];
int count;
int pos = 0;
while (pos < length && ((count = in.read(bytes, pos, length - pos)) != -1)) {
pos += count;
}
if (pos != length) {
throw new IOException("Expected " + length + " bytes, read " + pos + " bytes");
}
return bytes;
}
// Visible for testing.
static class CacheHeader {
public long size;
public String key;
public String etag;
public long serverDate;
public long ttl;
public long softTtl;
public Map<String, String> responseHeaders;
private CacheHeader() {}
public CacheHeader(String key, Entry entry) {
this.key = key;
this.size = entry.data.length;
this.etag = entry.etag;
this.serverDate = entry.serverDate;
this.ttl = entry.ttl;
this.softTtl = entry.softTtl;
this.responseHeaders = entry.responseHeaders;
} | static byte[] function(InputStream in, int length) throws IOException { byte[] bytes = new byte[length]; int count; int pos = 0; while (pos < length && ((count = in.read(bytes, pos, length - pos)) != -1)) { pos += count; } if (pos != length) { throw new IOException(STR + length + STR + pos + STR); } return bytes; } static class CacheHeader { public long size; public String key; public String etag; public long serverDate; public long ttl; public long softTtl; public Map<String, String> responseHeaders; private CacheHeader() {} public CacheHeader(String key, Entry entry) { this.key = key; this.size = entry.data.length; this.etag = entry.etag; this.serverDate = entry.serverDate; this.ttl = entry.ttl; this.softTtl = entry.softTtl; this.responseHeaders = entry.responseHeaders; } | /**
* Reads the contents of an InputStream into a byte[].
*/ | Reads the contents of an InputStream into a byte[] | streamToBytes | {
"repo_name": "thaidn/securegram",
"path": "android/src/main/java/org/telegram/android/volley/toolbox/DiskBasedCache.java",
"license": "gpl-2.0",
"size": 16411
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.Map"
] | import java.io.IOException; import java.io.InputStream; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 324,245 |
public BondFixedSecurity[] getDeliveryBasketAtSpotDate() {
return _deliveryBasketAtSpotDate;
} | BondFixedSecurity[] function() { return _deliveryBasketAtSpotDate; } | /**
* Gets the basket of deliverable bonds with settlement at the bonds standard spot date.
* @return The basket.
*/ | Gets the basket of deliverable bonds with settlement at the bonds standard spot date | getDeliveryBasketAtSpotDate | {
"repo_name": "DevStreet/FinanceAnalytics",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/interestrate/future/derivative/BondFuturesYieldAverageSecurity.java",
"license": "apache-2.0",
"size": 6081
} | [
"com.opengamma.analytics.financial.interestrate.bond.definition.BondFixedSecurity"
] | import com.opengamma.analytics.financial.interestrate.bond.definition.BondFixedSecurity; | import com.opengamma.analytics.financial.interestrate.bond.definition.*; | [
"com.opengamma.analytics"
] | com.opengamma.analytics; | 1,258,757 |
public void relayoutToAlign() {
int childCount = this.getChildCount();
if (0 == childCount) {
//no need to sort if flowlayout has no child view
return;
}
int count = 0;
for (int i = 0; i < childCount; i++) {
View v = getChildAt(i);
if (v instanceof BlankView) {
//BlankView is just to make childs look in alignment, we should ignore them when we relayout
continue;
}
count++;
}
View[] childs = new View[count];
int[] spaces = new int[count];
int n = 0;
for (int i = 0; i < childCount; i++) {
View v = getChildAt(i);
if (v instanceof BlankView) {
//BlankView is just to make childs look in alignment, we should ignore them when we relayout
continue;
}
childs[n] = v;
LayoutParams childLp = v.getLayoutParams();
int childWidth = v.getMeasuredWidth();
if (childLp instanceof MarginLayoutParams) {
MarginLayoutParams mlp = (MarginLayoutParams) childLp;
spaces[n] = mlp.leftMargin + childWidth + mlp.rightMargin;
} else {
spaces[n] = childWidth;
}
n++;
}
int lineTotal = 0;
int start = 0;
this.removeAllViews();
for (int i = 0; i < count; i++) {
if (lineTotal + spaces[i] > usefulWidth) {
int blankWidth = usefulWidth - lineTotal;
int end = i - 1;
int blankCount = end - start;
if (blankCount >= 0) {
if (blankCount > 0) {
int eachBlankWidth = blankWidth / blankCount;
MarginLayoutParams lp = new MarginLayoutParams(eachBlankWidth, 0);
for (int j = start; j < end; j++) {
this.addView(childs[j]);
BlankView blank = new BlankView(mContext);
this.addView(blank, lp);
}
}
this.addView(childs[end]);
start = i;
i--;
lineTotal = 0;
} else {
this.addView(childs[i]);
start = i + 1;
lineTotal = 0;
}
} else {
lineTotal += spaces[i];
}
}
for (int i = start; i < count; i++) {
this.addView(childs[i]);
}
} | void function() { int childCount = this.getChildCount(); if (0 == childCount) { return; } int count = 0; for (int i = 0; i < childCount; i++) { View v = getChildAt(i); if (v instanceof BlankView) { continue; } count++; } View[] childs = new View[count]; int[] spaces = new int[count]; int n = 0; for (int i = 0; i < childCount; i++) { View v = getChildAt(i); if (v instanceof BlankView) { continue; } childs[n] = v; LayoutParams childLp = v.getLayoutParams(); int childWidth = v.getMeasuredWidth(); if (childLp instanceof MarginLayoutParams) { MarginLayoutParams mlp = (MarginLayoutParams) childLp; spaces[n] = mlp.leftMargin + childWidth + mlp.rightMargin; } else { spaces[n] = childWidth; } n++; } int lineTotal = 0; int start = 0; this.removeAllViews(); for (int i = 0; i < count; i++) { if (lineTotal + spaces[i] > usefulWidth) { int blankWidth = usefulWidth - lineTotal; int end = i - 1; int blankCount = end - start; if (blankCount >= 0) { if (blankCount > 0) { int eachBlankWidth = blankWidth / blankCount; MarginLayoutParams lp = new MarginLayoutParams(eachBlankWidth, 0); for (int j = start; j < end; j++) { this.addView(childs[j]); BlankView blank = new BlankView(mContext); this.addView(blank, lp); } } this.addView(childs[end]); start = i; i--; lineTotal = 0; } else { this.addView(childs[i]); start = i + 1; lineTotal = 0; } } else { lineTotal += spaces[i]; } } for (int i = start; i < count; i++) { this.addView(childs[i]); } } | /**
* add some blank view to make child elements look in alignment
*/ | add some blank view to make child elements look in alignment | relayoutToAlign | {
"repo_name": "junhaozhou/android-flow-layout",
"path": "flowlayout/src/main/java/com/littlechoc/flowlayout/FlowLayout.java",
"license": "mit",
"size": 17179
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 240,644 |
private JSType normalizeClassType(JSType type) {
if (type == null || type.isUnknownType()) {
return type;
} else if (type.isNominalConstructor()) {
return (type.toMaybeFunctionType()).getInstanceType();
} else if (type.isFunctionPrototypeType()) {
FunctionType owner = ((ObjectType) type).getOwnerFunction();
if (owner.isConstructor()) {
return owner.getInstanceType();
}
}
return type;
} | JSType function(JSType type) { if (type == null type.isUnknownType()) { return type; } else if (type.isNominalConstructor()) { return (type.toMaybeFunctionType()).getInstanceType(); } else if (type.isFunctionPrototypeType()) { FunctionType owner = ((ObjectType) type).getOwnerFunction(); if (owner.isConstructor()) { return owner.getInstanceType(); } } return type; } | /**
* Normalize the type of a constructor, its instance, and its prototype
* all down to the same type (the instance type).
*/ | Normalize the type of a constructor, its instance, and its prototype all down to the same type (the instance type) | normalizeClassType | {
"repo_name": "martingwhite/astor",
"path": "examples/closure_1/src/com/google/javascript/jscomp/CheckAccessControls.java",
"license": "gpl-2.0",
"size": 24711
} | [
"com.google.javascript.rhino.jstype.FunctionType",
"com.google.javascript.rhino.jstype.JSType",
"com.google.javascript.rhino.jstype.ObjectType"
] | import com.google.javascript.rhino.jstype.FunctionType; import com.google.javascript.rhino.jstype.JSType; import com.google.javascript.rhino.jstype.ObjectType; | import com.google.javascript.rhino.jstype.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,347,465 |
protected ShardGeneration snapshotShard(final IndexShard shard, final Snapshot snapshot, final Repository repository)
throws IOException {
final Index index = shard.shardId().getIndex();
final IndexId indexId = new IndexId(index.getName(), index.getUUID());
final IndexShardSnapshotStatus snapshotStatus = IndexShardSnapshotStatus.newInitializing(
ESBlobStoreRepositoryIntegTestCase.getRepositoryData(repository)
.shardGenerations()
.getShardGen(indexId, shard.shardId().getId())
);
final PlainActionFuture<ShardSnapshotResult> future = PlainActionFuture.newFuture();
final ShardGeneration shardGen;
try (Engine.IndexCommitRef indexCommitRef = shard.acquireLastIndexCommit(true)) {
repository.snapshotShard(
new SnapshotShardContext(
shard.store(),
shard.mapperService(),
snapshot.getSnapshotId(),
indexId,
indexCommitRef,
null,
snapshotStatus,
Version.CURRENT,
Collections.emptyMap(),
future
)
);
shardGen = future.actionGet().getGeneration();
}
final IndexShardSnapshotStatus.Copy lastSnapshotStatus = snapshotStatus.asCopy();
assertEquals(IndexShardSnapshotStatus.Stage.DONE, lastSnapshotStatus.getStage());
assertEquals(shard.snapshotStoreMetadata().size(), lastSnapshotStatus.getTotalFileCount());
assertNull(lastSnapshotStatus.getFailure());
return shardGen;
} | ShardGeneration function(final IndexShard shard, final Snapshot snapshot, final Repository repository) throws IOException { final Index index = shard.shardId().getIndex(); final IndexId indexId = new IndexId(index.getName(), index.getUUID()); final IndexShardSnapshotStatus snapshotStatus = IndexShardSnapshotStatus.newInitializing( ESBlobStoreRepositoryIntegTestCase.getRepositoryData(repository) .shardGenerations() .getShardGen(indexId, shard.shardId().getId()) ); final PlainActionFuture<ShardSnapshotResult> future = PlainActionFuture.newFuture(); final ShardGeneration shardGen; try (Engine.IndexCommitRef indexCommitRef = shard.acquireLastIndexCommit(true)) { repository.snapshotShard( new SnapshotShardContext( shard.store(), shard.mapperService(), snapshot.getSnapshotId(), indexId, indexCommitRef, null, snapshotStatus, Version.CURRENT, Collections.emptyMap(), future ) ); shardGen = future.actionGet().getGeneration(); } final IndexShardSnapshotStatus.Copy lastSnapshotStatus = snapshotStatus.asCopy(); assertEquals(IndexShardSnapshotStatus.Stage.DONE, lastSnapshotStatus.getStage()); assertEquals(shard.snapshotStoreMetadata().size(), lastSnapshotStatus.getTotalFileCount()); assertNull(lastSnapshotStatus.getFailure()); return shardGen; } | /**
* Snapshot a shard using a given repository.
*
* @return new shard generation
*/ | Snapshot a shard using a given repository | snapshotShard | {
"repo_name": "GlenRSmith/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java",
"license": "apache-2.0",
"size": 45800
} | [
"java.io.IOException",
"java.util.Collections",
"org.elasticsearch.Version",
"org.elasticsearch.action.support.PlainActionFuture",
"org.elasticsearch.index.Index",
"org.elasticsearch.index.engine.Engine",
"org.elasticsearch.index.snapshots.IndexShardSnapshotStatus",
"org.elasticsearch.repositories.IndexId",
"org.elasticsearch.repositories.Repository",
"org.elasticsearch.repositories.ShardGeneration",
"org.elasticsearch.repositories.ShardSnapshotResult",
"org.elasticsearch.repositories.SnapshotShardContext",
"org.elasticsearch.repositories.blobstore.ESBlobStoreRepositoryIntegTestCase",
"org.elasticsearch.snapshots.Snapshot"
] | import java.io.IOException; import java.util.Collections; import org.elasticsearch.Version; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.index.Index; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.repositories.Repository; import org.elasticsearch.repositories.ShardGeneration; import org.elasticsearch.repositories.ShardSnapshotResult; import org.elasticsearch.repositories.SnapshotShardContext; import org.elasticsearch.repositories.blobstore.ESBlobStoreRepositoryIntegTestCase; import org.elasticsearch.snapshots.Snapshot; | import java.io.*; import java.util.*; import org.elasticsearch.*; import org.elasticsearch.action.support.*; import org.elasticsearch.index.*; import org.elasticsearch.index.engine.*; import org.elasticsearch.index.snapshots.*; import org.elasticsearch.repositories.*; import org.elasticsearch.repositories.blobstore.*; import org.elasticsearch.snapshots.*; | [
"java.io",
"java.util",
"org.elasticsearch",
"org.elasticsearch.action",
"org.elasticsearch.index",
"org.elasticsearch.repositories",
"org.elasticsearch.snapshots"
] | java.io; java.util; org.elasticsearch; org.elasticsearch.action; org.elasticsearch.index; org.elasticsearch.repositories; org.elasticsearch.snapshots; | 52,696 |
public URL getHelpURL() {
try {
if (helpJarFile == null || helpJarFile.isEmpty()) {
return new URL("file:" + helpUrlFileBase + helpFileEntry);
} else {
return new URL("jar:file:" + File.separatorChar + helpUrlFileBase + helpJarFile + "!/" + helpFileEntry);
}
} catch (Exception ee) {
return null;
}
} | URL function() { try { if (helpJarFile == null helpJarFile.isEmpty()) { return new URL("file:" + helpUrlFileBase + helpFileEntry); } else { return new URL(STR + File.separatorChar + helpUrlFileBase + helpJarFile + "!/" + helpFileEntry); } } catch (Exception ee) { return null; } } | /**
* Get the location of the help docs
* @return a URL for the help docs
*/ | Get the location of the help docs | getHelpURL | {
"repo_name": "asaladino/foldermonitor",
"path": "src/Utilities/DocumentationHelper.java",
"license": "mit",
"size": 5864
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,603,736 |
public Node item(int index) {
if (hasStringValue()) {
if (index != 0 || value == null) {
return null;
}
else {
makeChildNode();
return (Node) value;
}
}
if (index < 0) {
return null;
}
ChildNode node = (ChildNode) value;
for (int i = 0; i < index && node != null; i++) {
node = node.nextSibling;
}
return node;
} // item(int):Node
//
// DOM3
// | Node function(int index) { if (hasStringValue()) { if (index != 0 value == null) { return null; } else { makeChildNode(); return (Node) value; } } if (index < 0) { return null; } ChildNode node = (ChildNode) value; for (int i = 0; i < index && node != null; i++) { node = node.nextSibling; } return node; } // | /**
* NodeList method: Return the Nth immediate child of this node, or
* null if the index is out of bounds.
* @return org.w3c.dom.Node
* @param Index int
*/ | NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds | item | {
"repo_name": "FauxFaux/jdk9-jaxp",
"path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/AttrImpl.java",
"license": "gpl-2.0",
"size": 42495
} | [
"org.w3c.dom.Node"
] | import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,560,747 |
public SortedSet<Anchor> getAnchorsOrderedByStructure() {
TreeSet<Anchor> sortedAnchors = new TreeSet<Anchor>(new AnchorComparatorWithStructure());
sortedAnchors.addAll(getAnchors().values());
return sortedAnchors;
} // end of getAnchorsOrderedByStructure() | SortedSet<Anchor> function() { TreeSet<Anchor> sortedAnchors = new TreeSet<Anchor>(new AnchorComparatorWithStructure()); sortedAnchors.addAll(getAnchors().values()); return sortedAnchors; } | /**
* Returns all anchors, in the best order given their offset and annotation links. This
* ordering requires much graph traversal to find the best comparison between anchors,
* so is computationally expensive and should be used sparingly.
* @return An ordered set of all anchors in the graph.
*/ | Returns all anchors, in the best order given their offset and annotation links. This ordering requires much graph traversal to find the best comparison between anchors, so is computationally expensive and should be used sparingly | getAnchorsOrderedByStructure | {
"repo_name": "nzilbb/ag",
"path": "ag/src/main/java/nzilbb/ag/Graph.java",
"license": "gpl-3.0",
"size": 84109
} | [
"java.util.SortedSet",
"java.util.TreeSet"
] | import java.util.SortedSet; import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 2,198,630 |
protected void writeNewInternMapping (short code, String value)
throws IOException
{
// writing a negative code indicates that the value will follow
writeInternMapping(-code, value);
} | void function (short code, String value) throws IOException { writeInternMapping(-code, value); } | /**
* Writes a new intern mapping to the stream.
*/ | Writes a new intern mapping to the stream | writeNewInternMapping | {
"repo_name": "threerings/narya",
"path": "core/src/main/java/com/threerings/io/ObjectOutputStream.java",
"license": "lgpl-2.1",
"size": 10886
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 275,628 |
public static Class<Object> getLocalClassType(Class<?> declaringClass, int occurrence, String name)
throws ClassNotFoundException {
return WhiteboxImpl.getLocalClassType(declaringClass, occurrence, name);
}
/**
* Get the type of an anonymous inner class.
*
* @param declaringClass
* The class in which the anonymous inner class is declared.
* @param occurrence
* The occurrence of the anonymous inner class. For example if
* you have two anonymous inner classes classes in the
* {@code declaringClass} you must pass in {@code 1} if
* you want to get the type for the first one or {@code 2} | static Class<Object> function(Class<?> declaringClass, int occurrence, String name) throws ClassNotFoundException { return WhiteboxImpl.getLocalClassType(declaringClass, occurrence, name); } /** * Get the type of an anonymous inner class. * * @param declaringClass * The class in which the anonymous inner class is declared. * @param occurrence * The occurrence of the anonymous inner class. For example if * you have two anonymous inner classes classes in the * {@code declaringClass} you must pass in {@code 1} if * you want to get the type for the first one or {@code 2} | /**
* Get the type of a local inner class.
*
* @param declaringClass
* The class in which the local inner class is declared.
* @param occurrence
* The occurrence of the local class. For example if you have two
* local classes in the {@code declaringClass} you must pass
* in {@code 1} if you want to get the type for the first
* one or {@code 2} if you want the second one.
* @param name
* The unqualified name (simple name) of the local class.
* @return The type.
*/ | Get the type of a local inner class | getLocalClassType | {
"repo_name": "hazendaz/powermock",
"path": "powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java",
"license": "apache-2.0",
"size": 31475
} | [
"org.powermock.reflect.internal.WhiteboxImpl"
] | import org.powermock.reflect.internal.WhiteboxImpl; | import org.powermock.reflect.internal.*; | [
"org.powermock.reflect"
] | org.powermock.reflect; | 1,328,709 |
public void setStatusOrder(List<String> statusOrder) {
Assert.notNull(statusOrder, "StatusOrder must not be null");
this.statusOrder = statusOrder;
} | void function(List<String> statusOrder) { Assert.notNull(statusOrder, STR); this.statusOrder = statusOrder; } | /**
* Set the ordering of the status.
* @param statusOrder an ordered list of the status codes
*/ | Set the ordering of the status | setStatusOrder | {
"repo_name": "kdvolder/spring-boot",
"path": "spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java",
"license": "apache-2.0",
"size": 3204
} | [
"java.util.List",
"org.springframework.util.Assert"
] | import java.util.List; import org.springframework.util.Assert; | import java.util.*; import org.springframework.util.*; | [
"java.util",
"org.springframework.util"
] | java.util; org.springframework.util; | 1,415,659 |
@InterfaceAudience.Private
boolean isOrderSize() {
return this.orderSize;
} | @InterfaceAudience.Private boolean isOrderSize() { return this.orderSize; } | /**
* Should directory contents be displayed in size order.
* @return true size order, false default order
*/ | Should directory contents be displayed in size order | isOrderSize | {
"repo_name": "MobinRanjbar/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java",
"license": "apache-2.0",
"size": 11713
} | [
"org.apache.hadoop.classification.InterfaceAudience"
] | import org.apache.hadoop.classification.InterfaceAudience; | import org.apache.hadoop.classification.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,199,500 |
ConfigProvider createServerConfig(String server); | ConfigProvider createServerConfig(String server); | /**
* Retrieves the config for the specified server. The config is created if it doesn't exist.
*
* @param server The name of the server
*
* @return A config provider for the server
*/ | Retrieves the config for the specified server. The config is created if it doesn't exist | createServerConfig | {
"repo_name": "DMDirc/DMDirc",
"path": "src/main/java/com/dmdirc/interfaces/config/IdentityFactory.java",
"license": "mit",
"size": 5586
} | [
"com.dmdirc.config.provider.ConfigProvider"
] | import com.dmdirc.config.provider.ConfigProvider; | import com.dmdirc.config.provider.*; | [
"com.dmdirc.config"
] | com.dmdirc.config; | 1,203,876 |
@Override
public ServicesBundle createServicesBundle() throws InvalidStateException, InvalidArgumentException {
return getServicesBundleManager().createServicesBundle();
} | ServicesBundle function() throws InvalidStateException, InvalidArgumentException { return getServicesBundleManager().createServicesBundle(); } | /**
* A factory method to create services bundles compatible with the configuration. Used to create the default
* services bundle but also for any code that needs to create private instances, predominantly required for
* anything that runs in a separate thread.
* @return a new instance of a a services bundle
* @throws com.moscona.exceptions.InvalidStateException if cannot construct the appropriate classes
*/ | A factory method to create services bundles compatible with the configuration. Used to create the default services bundle but also for any code that needs to create private instances, predominantly required for anything that runs in a separate thread | createServicesBundle | {
"repo_name": "arnonmoscona/iqfeed",
"path": "src/main/java/com/moscona/trading/adapters/iqfeed/IqFeedConfig.java",
"license": "apache-2.0",
"size": 13913
} | [
"com.moscona.exceptions.InvalidArgumentException",
"com.moscona.exceptions.InvalidStateException",
"com.moscona.trading.ServicesBundle"
] | import com.moscona.exceptions.InvalidArgumentException; import com.moscona.exceptions.InvalidStateException; import com.moscona.trading.ServicesBundle; | import com.moscona.exceptions.*; import com.moscona.trading.*; | [
"com.moscona.exceptions",
"com.moscona.trading"
] | com.moscona.exceptions; com.moscona.trading; | 2,519,659 |
@SuppressWarnings("unused")
public void basementChanged(AlbumLibrary collection) {
albumListDirty = true;
} | @SuppressWarnings(STR) void function(AlbumLibrary collection) { albumListDirty = true; } | /**
* mark local list as dirty
* @param collection
*
* @see org.jimcat.model.notification.CollectionListener#basementChanged(org.jimcat.model.notification.ObservableCollection)
*/ | mark local list as dirty | basementChanged | {
"repo_name": "HerbertJordan/JimCat",
"path": "src/org/jimcat/gui/smartlisteditor/editor/AlbumFilterEditor.java",
"license": "gpl-2.0",
"size": 6552
} | [
"org.jimcat.model.libraries.AlbumLibrary"
] | import org.jimcat.model.libraries.AlbumLibrary; | import org.jimcat.model.libraries.*; | [
"org.jimcat.model"
] | org.jimcat.model; | 1,365,212 |
private void sendMessageToHandler(Integer what, Bundle data) {
Message msg = Message.obtain();
msg.what = what;
if (data != null) {
msg.setData(data);
}
try {
mMessenger.send(msg);
} catch (RemoteException e) {
Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
} catch (NullPointerException e) {
Log.w(Constants.TAG, "Messenger is null!", e);
}
} | void function(Integer what, Bundle data) { Message msg = Message.obtain(); msg.what = what; if (data != null) { msg.setData(data); } try { mMessenger.send(msg); } catch (RemoteException e) { Log.w(Constants.TAG, STR, e); } catch (NullPointerException e) { Log.w(Constants.TAG, STR, e); } } | /**
* Send message back to handler which is initialized in a activity
*
* @param what Message integer you want to send
*/ | Send message back to handler which is initialized in a activity | sendMessageToHandler | {
"repo_name": "siddharths2710/open-keychain",
"path": "OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/FileDialogFragment.java",
"license": "gpl-3.0",
"size": 8374
} | [
"android.os.Bundle",
"android.os.Message",
"android.os.RemoteException",
"org.sufficientlysecure.keychain.Constants",
"org.sufficientlysecure.keychain.util.Log"
] | import android.os.Bundle; import android.os.Message; import android.os.RemoteException; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.util.Log; | import android.os.*; import org.sufficientlysecure.keychain.*; import org.sufficientlysecure.keychain.util.*; | [
"android.os",
"org.sufficientlysecure.keychain"
] | android.os; org.sufficientlysecure.keychain; | 1,042,236 |
public void onFragmentReady(Fragment fragment); | void function(Fragment fragment); | /**
* Is called from within an RSSFragment's onViewCreated method and notifies the hosting activity about its state
*
* @param fragment
* The calling fragment
*/ | Is called from within an RSSFragment's onViewCreated method and notifies the hosting activity about its state | onFragmentReady | {
"repo_name": "hdodenhof/holoreader",
"path": "src/de/hdodenhof/holoreader/misc/FragmentCallback.java",
"license": "gpl-3.0",
"size": 737
} | [
"android.support.v4.app.Fragment"
] | import android.support.v4.app.Fragment; | import android.support.v4.app.*; | [
"android.support"
] | android.support; | 1,266,705 |
@Bean
public DispatcherServletRegistrationBean dispatcherServletRegistration(
DispatcherServlet dispatcherServlet,
ObjectProvider<MultipartConfigElement> multipartConfig) {
DispatcherServletRegistrationBean registration = new DispatcherServletRegistrationBean(
dispatcherServlet, "/*");
registration.setName("springDispatcherServlet");
registration.setLoadOnStartup(1);
multipartConfig.ifAvailable(registration::setMultipartConfig);
return registration;
} | DispatcherServletRegistrationBean function( DispatcherServlet dispatcherServlet, ObjectProvider<MultipartConfigElement> multipartConfig) { DispatcherServletRegistrationBean registration = new DispatcherServletRegistrationBean( dispatcherServlet, "/*"); registration.setName(STR); registration.setLoadOnStartup(1); multipartConfig.ifAvailable(registration::setMultipartConfig); return registration; } | /**
* Special beans to make AP work in SpringBoot
* https://github.com/spring-projects/spring-boot/issues/15373
*/ | Special beans to make AP work in SpringBoot HREF | dispatcherServletRegistration | {
"repo_name": "activeviam/autopivot",
"path": "src/main/java/com/av/AutoPivotApplication.java",
"license": "apache-2.0",
"size": 2548
} | [
"javax.servlet.MultipartConfigElement",
"org.springframework.beans.factory.ObjectProvider",
"org.springframework.boot.autoconfigure.web.servlet.DispatcherServletRegistrationBean",
"org.springframework.web.servlet.DispatcherServlet"
] | import javax.servlet.MultipartConfigElement; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletRegistrationBean; import org.springframework.web.servlet.DispatcherServlet; | import javax.servlet.*; import org.springframework.beans.factory.*; import org.springframework.boot.autoconfigure.web.servlet.*; import org.springframework.web.servlet.*; | [
"javax.servlet",
"org.springframework.beans",
"org.springframework.boot",
"org.springframework.web"
] | javax.servlet; org.springframework.beans; org.springframework.boot; org.springframework.web; | 2,115,839 |
EAttribute getExpression_Body();
| EAttribute getExpression_Body(); | /**
* Returns the meta object for the attribute '{@link org.dresdenocl.pivotmodel.Expression#getBody <em>Body</em>}'.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Body</em>'.
* @see org.dresdenocl.pivotmodel.Expression#getBody()
* @see #getExpression()
* @generated
*/ | Returns the meta object for the attribute '<code>org.dresdenocl.pivotmodel.Expression#getBody Body</code>'. | getExpression_Body | {
"repo_name": "dresden-ocl/dresdenocl",
"path": "plugins/org.dresdenocl.pivotmodel/src/org/dresdenocl/pivotmodel/PivotModelPackage.java",
"license": "lgpl-3.0",
"size": 98285
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 672,065 |
@Test
public void testAddToListConsiderWMSSelectorsContainsRecordNameAllRecordsCheckOrder02()
throws PortalServiceException {
CSWRecord cswRecord1 = new CSWRecord("serviceName", "idA", "infoUrlA", "dataIdAbstractA", null, null, layerName1);
CSWRecord cswRecord2 = new CSWRecord("serviceName", "idA", "infoUrlA", "dataIdAbstractA", null, null, layerName2);
CSWRecord cswRecord3 = new CSWRecord("serviceName", "idA", "infoUrlA", "dataIdAbstractA", null, null, layerName3);
knownLayerService = buildKnownLayerServiceWithWMSSelectorsAndKnownLayerIdOf("someid");
knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord2, knownLayer);
knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord2, knownLayer);
knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord3, knownLayer);
knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord1, knownLayer);
knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord3, knownLayer);
Assert.assertEquals(3, cswRecordListToAddTo.size());
Assert.assertEquals(layerName1, cswRecordListToAddTo.get(0).getLayerName());
Assert.assertEquals(layerName2, cswRecordListToAddTo.get(1).getLayerName());
Assert.assertEquals(layerName3, cswRecordListToAddTo.get(2).getLayerName());
} | void function() throws PortalServiceException { CSWRecord cswRecord1 = new CSWRecord(STR, "idA", STR, STR, null, null, layerName1); CSWRecord cswRecord2 = new CSWRecord(STR, "idA", STR, STR, null, null, layerName2); CSWRecord cswRecord3 = new CSWRecord(STR, "idA", STR, STR, null, null, layerName3); knownLayerService = buildKnownLayerServiceWithWMSSelectorsAndKnownLayerIdOf(STR); knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord2, knownLayer); knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord2, knownLayer); knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord3, knownLayer); knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord1, knownLayer); knownLayerService.addToListConsiderWMSSelectors(cswRecordListToAddTo, cswRecord3, knownLayer); Assert.assertEquals(3, cswRecordListToAddTo.size()); Assert.assertEquals(layerName1, cswRecordListToAddTo.get(0).getLayerName()); Assert.assertEquals(layerName2, cswRecordListToAddTo.get(1).getLayerName()); Assert.assertEquals(layerName3, cswRecordListToAddTo.get(2).getLayerName()); } | /**
* Add all - NOT in order they are expected This will work as the knownLayer contains a WMSSelectors instanceof KnownLayer and the
* cswRecord.getServiceName (layerName1, layerName2, ..3) are the layerNames in the knownLayer. Two are sent twice but shouldn't be included the second
* time.
*/ | Add all - NOT in order they are expected This will work as the knownLayer contains a WMSSelectors instanceof KnownLayer and the cswRecord.getServiceName (layerName1, layerName2, ..3) are the layerNames in the knownLayer. Two are sent twice but shouldn't be included the second time | testAddToListConsiderWMSSelectorsContainsRecordNameAllRecordsCheckOrder02 | {
"repo_name": "jia020/portal-core",
"path": "src/test/java/org/auscope/portal/core/services/KnownLayerServiceTest.java",
"license": "lgpl-3.0",
"size": 14233
} | [
"org.auscope.portal.core.services.responses.csw.CSWRecord",
"org.junit.Assert"
] | import org.auscope.portal.core.services.responses.csw.CSWRecord; import org.junit.Assert; | import org.auscope.portal.core.services.responses.csw.*; import org.junit.*; | [
"org.auscope.portal",
"org.junit"
] | org.auscope.portal; org.junit; | 222,075 |
@Ignore
@Test
public void writeSnapshot() throws Exception {
final File outDir = tempFolder.newFolder();
BucketingSink<String> sink = new BucketingSink<String>(outDir.getAbsolutePath())
.setWriter(new StringWriter<String>())
.setBatchSize(5)
.setPartPrefix(PART_PREFIX)
.setInProgressPrefix("")
.setPendingPrefix("")
.setValidLengthPrefix("")
.setInProgressSuffix(IN_PROGRESS_SUFFIX)
.setPendingSuffix(PENDING_SUFFIX)
.setValidLengthSuffix(VALID_LENGTH_SUFFIX);
OneInputStreamOperatorTestHarness<String, Object> testHarness =
new OneInputStreamOperatorTestHarness<>(new StreamSink<>(sink));
testHarness.setup();
testHarness.open();
testHarness.processElement(new StreamRecord<>("test1", 0L));
testHarness.processElement(new StreamRecord<>("test2", 0L));
checkLocalFs(outDir, 1, 1, 0, 0);
testHarness.processElement(new StreamRecord<>("test3", 0L));
testHarness.processElement(new StreamRecord<>("test4", 0L));
testHarness.processElement(new StreamRecord<>("test5", 0L));
checkLocalFs(outDir, 1, 4, 0, 0);
OperatorSubtaskState snapshot = testHarness.snapshot(0L, 0L);
OperatorSnapshotUtil.writeStateHandle(snapshot, "src/test/resources/bucketing-sink-migration-test-flink" + flinkGenerateSavepointVersion + "-snapshot");
testHarness.close();
} | void function() throws Exception { final File outDir = tempFolder.newFolder(); BucketingSink<String> sink = new BucketingSink<String>(outDir.getAbsolutePath()) .setWriter(new StringWriter<String>()) .setBatchSize(5) .setPartPrefix(PART_PREFIX) .setInProgressPrefix(STRSTRSTRtest1STRtest2STRtest3STRtest4STRtest5STRsrc/test/resources/bucketing-sink-migration-test-flinkSTR-snapshot"); testHarness.close(); } | /**
* Manually run this to write binary snapshot data. Remove @Ignore to run.
*/ | Manually run this to write binary snapshot data. Remove @Ignore to run | writeSnapshot | {
"repo_name": "yew1eb/flink",
"path": "flink-connectors/flink-connector-filesystem/src/test/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSinkMigrationTest.java",
"license": "apache-2.0",
"size": 9670
} | [
"java.io.File",
"org.apache.flink.streaming.connectors.fs.StringWriter"
] | import java.io.File; import org.apache.flink.streaming.connectors.fs.StringWriter; | import java.io.*; import org.apache.flink.streaming.connectors.fs.*; | [
"java.io",
"org.apache.flink"
] | java.io; org.apache.flink; | 1,695,258 |
@Override
public CellNameType setSubtype(int position, AbstractType<?> newType); | CellNameType function(int position, AbstractType<?> newType); | /**
* Returns a new CellNameType that is equivalent to this one but with one
* of the subtype replaced by the provided new type.
*/ | Returns a new CellNameType that is equivalent to this one but with one of the subtype replaced by the provided new type | setSubtype | {
"repo_name": "lynchlee/play-jmx",
"path": "src/main/java/org/apache/cassandra/db/composites/CellNameType.java",
"license": "apache-2.0",
"size": 8400
} | [
"org.apache.cassandra.db.marshal.AbstractType"
] | import org.apache.cassandra.db.marshal.AbstractType; | import org.apache.cassandra.db.marshal.*; | [
"org.apache.cassandra"
] | org.apache.cassandra; | 654,787 |
@Override
public void bindStatement() throws StandardException
{
CompilerContext cc = getCompilerContext();
td = getTableDescriptor();
conglomerateNumber = td.getHeapConglomerateId();
ConglomerateDescriptor cd = td.getConglomerateDescriptor(conglomerateNumber);
cc.createDependency(td);
cc.createDependency(cd);
} | void function() throws StandardException { CompilerContext cc = getCompilerContext(); td = getTableDescriptor(); conglomerateNumber = td.getHeapConglomerateId(); ConglomerateDescriptor cd = td.getConglomerateDescriptor(conglomerateNumber); cc.createDependency(td); cc.createDependency(cd); } | /**
* Bind this LockTableNode. This means looking up the table,
* verifying it exists and getting the heap conglomerate number.
*
*
* @exception StandardException Thrown on error
*/ | Bind this LockTableNode. This means looking up the table, verifying it exists and getting the heap conglomerate number | bindStatement | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/DropTableNode.java",
"license": "apache-2.0",
"size": 4213
} | [
"org.apache.derby.iapi.sql.compile.CompilerContext",
"org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor",
"org.apache.derby.shared.common.error.StandardException"
] | import org.apache.derby.iapi.sql.compile.CompilerContext; import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor; import org.apache.derby.shared.common.error.StandardException; | import org.apache.derby.iapi.sql.compile.*; import org.apache.derby.iapi.sql.dictionary.*; import org.apache.derby.shared.common.error.*; | [
"org.apache.derby"
] | org.apache.derby; | 625,112 |
@Type(type = "com.servinglynk.hmis.warehouse.enums.YouthcriticalissuesSchooleducationalissuesyouthEnumType")
@Basic( optional = true )
@Column
public YouthcriticalissuesSchooleducationalissuesyouthEnum getSchooleducationalissuesyouth() {
return this.schooleducationalissuesyouth;
} | @Type(type = STR) @Basic( optional = true ) YouthcriticalissuesSchooleducationalissuesyouthEnum function() { return this.schooleducationalissuesyouth; } | /**
* Return the value associated with the column: schooleducationalissuesyouth.
* @return A YouthcriticalissuesSchooleducationalissuesyouthEnum object (this.schooleducationalissuesyouth)
*/ | Return the value associated with the column: schooleducationalissuesyouth | getSchooleducationalissuesyouth | {
"repo_name": "servinglynk/hmis-lynk-open-source",
"path": "hmis-model-v2014/src/main/java/com/servinglynk/hmis/warehouse/model/v2014/Youthcriticalissues.java",
"license": "mpl-2.0",
"size": 40748
} | [
"com.servinglynk.hmis.warehouse.enums.YouthcriticalissuesSchooleducationalissuesyouthEnum",
"javax.persistence.Basic",
"org.hibernate.annotations.Type"
] | import com.servinglynk.hmis.warehouse.enums.YouthcriticalissuesSchooleducationalissuesyouthEnum; import javax.persistence.Basic; import org.hibernate.annotations.Type; | import com.servinglynk.hmis.warehouse.enums.*; import javax.persistence.*; import org.hibernate.annotations.*; | [
"com.servinglynk.hmis",
"javax.persistence",
"org.hibernate.annotations"
] | com.servinglynk.hmis; javax.persistence; org.hibernate.annotations; | 2,226,117 |
public void updateSmallDateTime(String columnName,
java.sql.Timestamp x,
int scale,
boolean forceEncrypt) throws SQLServerException {
if (loggerExternal.isLoggable(java.util.logging.Level.FINER))
loggerExternal.entering(getClassNameLogging(), "updateSmallDateTime", new Object[] {columnName, x, scale, forceEncrypt});
checkClosed();
updateValue(findColumn(columnName), JDBCType.SMALLDATETIME, x, JavaType.TIMESTAMP, null, scale, forceEncrypt);
loggerExternal.exiting(getClassNameLogging(), "updateSmallDateTime");
} | void function(String columnName, java.sql.Timestamp x, int scale, boolean forceEncrypt) throws SQLServerException { if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) loggerExternal.entering(getClassNameLogging(), STR, new Object[] {columnName, x, scale, forceEncrypt}); checkClosed(); updateValue(findColumn(columnName), JDBCType.SMALLDATETIME, x, JavaType.TIMESTAMP, null, scale, forceEncrypt); loggerExternal.exiting(getClassNameLogging(), STR); } | /**
* Updates the designated column with a <code>java.sql.Timestamp</code> value. The updater methods are used to update column values in the current
* row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
* methods are called to update the database.
*
* @param columnName
* is the name of the column
* @param x
* the new column value
* @param scale
* the scale of the column
* @param forceEncrypt
* If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
* Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
* encryption on parameters.
* @throws SQLServerException
* If any errors occur.
*/ | Updates the designated column with a <code>java.sql.Timestamp</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database | updateSmallDateTime | {
"repo_name": "v-nisidh/mssql-jdbc",
"path": "src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSet.java",
"license": "mit",
"size": 288041
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 2,630,839 |
public void setGlobalPrefix(String globalName) throws MalformedContentNameStringException;
| void function(String globalName) throws MalformedContentNameStringException; | /**
* The globalPrefix is used to identify a path to repositories within an organization
* or entity. Several local repositories could be contained with an organizations global
* repository namespace.
*
* @param globalName the prefix as a string in the form xxx/yyy/zzz
* @throws MalformedContentNameStringException if the name is formatted incorrectly
*/ | The globalPrefix is used to identify a path to repositories within an organization or entity. Several local repositories could be contained with an organizations global repository namespace | setGlobalPrefix | {
"repo_name": "gujianxiao/gatewayForMulticom",
"path": "javasrc/src/main/org/ndnx/ndn/impl/repo/Policy.java",
"license": "lgpl-2.1",
"size": 3852
} | [
"org.ndnx.ndn.protocol.MalformedContentNameStringException"
] | import org.ndnx.ndn.protocol.MalformedContentNameStringException; | import org.ndnx.ndn.protocol.*; | [
"org.ndnx.ndn"
] | org.ndnx.ndn; | 2,278,158 |
public void testGrantRevokeStatements() throws SQLException
{
Statement s = createStatement();
switch(getPhase()) {
//
case PH_CREATE:
case PH_POST_SOFT_UPGRADE:
// was syntax error in 10.0,10.1
assertStatementError("42X01", s,
"GRANT SELECT ON TABLE1 TO USER1");
assertStatementError("42X01", s,
"REVOKE SELECT ON TABLE1 FROM USER1");
break;
case PH_SOFT_UPGRADE:
// require hard upgrade
assertStatementError(SQLSTATE_NEED_UPGRADE, s,
"GRANT SELECT ON TABLE1 TO USER1");
assertStatementError(SQLSTATE_NEED_UPGRADE, s,
"REVOKE SELECT ON TABLE1 FROM USER1");
break;
case PH_HARD_UPGRADE:
// not supported because SQL authorization not set
assertStatementError("42Z60", s,
"GRANT SELECT ON TABLE1 TO USER1");
assertStatementError("42Z60", s,
"REVOKE SELECT ON TABLE1 FROM USER1");
break;
}
s.close();
} | void function() throws SQLException { Statement s = createStatement(); switch(getPhase()) { case PH_CREATE: case PH_POST_SOFT_UPGRADE: assertStatementError("42X01", s, STR); assertStatementError("42X01", s, STR); break; case PH_SOFT_UPGRADE: assertStatementError(SQLSTATE_NEED_UPGRADE, s, STR); assertStatementError(SQLSTATE_NEED_UPGRADE, s, STR); break; case PH_HARD_UPGRADE: assertStatementError("42Z60", s, STR); assertStatementError("42Z60", s, STR); break; } s.close(); } | /**
* Simple test of if GRANT/REVOKE statements are handled
* correctly in terms of being allowed in soft upgrade.
* @throws SQLException
*
*/ | Simple test of if GRANT/REVOKE statements are handled correctly in terms of being allowed in soft upgrade | testGrantRevokeStatements | {
"repo_name": "scnakandala/derby",
"path": "java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_2.java",
"license": "apache-2.0",
"size": 17990
} | [
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 784,290 |
@RequestMapping("/branches/{id}/markread")
public String markAllTopicsAsRead(@PathVariable long id) throws NotFoundException {
Branch branch = branchService.get(id);
lastReadPostService.markAllTopicsAsRead(branch);
return "redirect:/branches/" + id;
} | @RequestMapping(STR) String function(@PathVariable long id) throws NotFoundException { Branch branch = branchService.get(id); lastReadPostService.markAllTopicsAsRead(branch); return STR + id; } | /**
* Marks all topics in branch as read regardless
* of pagination settings or whatever else.
*
* @param id branch id to find the appropriate topics
* @return redirect to the same branch page
* @throws NotFoundException if no branch matches id given
*/ | Marks all topics in branch as read regardless of pagination settings or whatever else | markAllTopicsAsRead | {
"repo_name": "Relvl/jcommune",
"path": "jcommune-view/jcommune-web-controller/src/main/java/org/jtalks/jcommune/web/controller/ReadPostsController.java",
"license": "lgpl-2.1",
"size": 3717
} | [
"org.jtalks.jcommune.model.entity.Branch",
"org.jtalks.jcommune.plugin.api.exceptions.NotFoundException",
"org.springframework.web.bind.annotation.PathVariable",
"org.springframework.web.bind.annotation.RequestMapping"
] | import org.jtalks.jcommune.model.entity.Branch; import org.jtalks.jcommune.plugin.api.exceptions.NotFoundException; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; | import org.jtalks.jcommune.model.entity.*; import org.jtalks.jcommune.plugin.api.exceptions.*; import org.springframework.web.bind.annotation.*; | [
"org.jtalks.jcommune",
"org.springframework.web"
] | org.jtalks.jcommune; org.springframework.web; | 2,195,506 |
public String[] getAllPolicyIds(String searchString) throws EntitlementException {
return EntitlementAdminEngine.getInstance().getPapPolicyStoreManager().getPolicyIds();
} | String[] function(String searchString) throws EntitlementException { return EntitlementAdminEngine.getInstance().getPapPolicyStoreManager().getPolicyIds(); } | /**
* This method returns the list of policy id available in PDP
*
* @param searchString search String
* @return list of ids
* @throws EntitlementException throws
*/ | This method returns the list of policy id available in PDP | getAllPolicyIds | {
"repo_name": "omindu/carbon-identity",
"path": "components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/EntitlementPolicyAdminService.java",
"license": "apache-2.0",
"size": 36810
} | [
"org.wso2.carbon.identity.entitlement.pap.EntitlementAdminEngine"
] | import org.wso2.carbon.identity.entitlement.pap.EntitlementAdminEngine; | import org.wso2.carbon.identity.entitlement.pap.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 2,428,813 |
private void runPluginOnClusters(String pluginName, JSONArray clusters) {
for (int i = 0; i < clusters.length(); ++i) {
try {
JSONObject object = clusters.getJSONObject(i);
if ("ObserverPlugin".equals(pluginName)) {
processPluginOnObserver(pluginName, object);
} else {
processPlugin(pluginName, object);
}
} catch (JSONException e) {
logger.error("Failed to process json string : "
+ pluginName + " " + i + "th line. " , e);
}
}
} | void function(String pluginName, JSONArray clusters) { for (int i = 0; i < clusters.length(); ++i) { try { JSONObject object = clusters.getJSONObject(i); if (STR.equals(pluginName)) { processPluginOnObserver(pluginName, object); } else { processPlugin(pluginName, object); } } catch (JSONException e) { logger.error(STR + pluginName + " " + i + STR , e); } } } | /**
* Run plugin on every cluster.
* @param pluginName
* @param clusters
*/ | Run plugin on every cluster | runPluginOnClusters | {
"repo_name": "ZheYuan/Mario",
"path": "Wario/src/main/java/com/renren/Wario/WarioMain.java",
"license": "apache-2.0",
"size": 10761
} | [
"org.json.JSONArray",
"org.json.JSONException",
"org.json.JSONObject"
] | import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 284,520 |
public List<String> getAllMembers(String groupName) throws AmbariException {
final List<String> members = new ArrayList<>();
final GroupEntity groupEntity = groupDAO.findGroupByName(groupName);
if (groupEntity == null) {
throw new AmbariException("Group " + groupName + " doesn't exist");
}
for (MemberEntity member : groupEntity.getMemberEntities()) {
members.add(member.getUser().getUserName());
}
return members;
} | List<String> function(String groupName) throws AmbariException { final List<String> members = new ArrayList<>(); final GroupEntity groupEntity = groupDAO.findGroupByName(groupName); if (groupEntity == null) { throw new AmbariException(STR + groupName + STR); } for (MemberEntity member : groupEntity.getMemberEntities()) { members.add(member.getUser().getUserName()); } return members; } | /**
* Gets all members of a group specified.
*
* @param groupName group name
* @return list of user names
*/ | Gets all members of a group specified | getAllMembers | {
"repo_name": "sekikn/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java",
"license": "apache-2.0",
"size": 69453
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.ambari.server.AmbariException",
"org.apache.ambari.server.orm.entities.GroupEntity",
"org.apache.ambari.server.orm.entities.MemberEntity"
] | import java.util.ArrayList; import java.util.List; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.orm.entities.GroupEntity; import org.apache.ambari.server.orm.entities.MemberEntity; | import java.util.*; import org.apache.ambari.server.*; import org.apache.ambari.server.orm.entities.*; | [
"java.util",
"org.apache.ambari"
] | java.util; org.apache.ambari; | 2,578,224 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> enableAsync(String resourceGroupName, String workspaceName, String intelligencePackName) {
return enableWithResponseAsync(resourceGroupName, workspaceName, intelligencePackName)
.flatMap((Response<Void> res) -> Mono.empty());
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> function(String resourceGroupName, String workspaceName, String intelligencePackName) { return enableWithResponseAsync(resourceGroupName, workspaceName, intelligencePackName) .flatMap((Response<Void> res) -> Mono.empty()); } | /**
* Enables an intelligence pack for a given workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param intelligencePackName The name of the intelligence pack to be enabled.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/ | Enables an intelligence pack for a given workspace | enableAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksClientImpl.java",
"license": "mit",
"size": 27637
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; | [
"com.azure.core"
] | com.azure.core; | 802,248 |
@ServiceMethod(returns = ReturnType.SINGLE)
public BuildDocumentModelResponse buildDocumentModelWithResponse(
BuildDocumentModelRequest buildRequest, Context context) {
return buildDocumentModelWithResponseAsync(buildRequest, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) BuildDocumentModelResponse function( BuildDocumentModelRequest buildRequest, Context context) { return buildDocumentModelWithResponseAsync(buildRequest, context).block(); } | /**
* Builds a custom document analysis model.
*
* @param buildRequest Building request parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/ | Builds a custom document analysis model | buildDocumentModelWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/implementation/FormRecognizerClientImpl.java",
"license": "mit",
"size": 91373
} | [
"com.azure.ai.formrecognizer.implementation.models.BuildDocumentModelRequest",
"com.azure.ai.formrecognizer.implementation.models.BuildDocumentModelResponse",
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.util.Context"
] | import com.azure.ai.formrecognizer.implementation.models.BuildDocumentModelRequest; import com.azure.ai.formrecognizer.implementation.models.BuildDocumentModelResponse; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; | import com.azure.ai.formrecognizer.implementation.models.*; import com.azure.core.annotation.*; import com.azure.core.util.*; | [
"com.azure.ai",
"com.azure.core"
] | com.azure.ai; com.azure.core; | 1,537,471 |
protected static void executeAndClose(final HttpUriRequest req) {
logger.debug("Executing: " + req.getMethod() + " to " + req.getURI());
try {
execute(req).close();
} catch (final IOException e) {
throw new RuntimeException(e);
}
} | static void function(final HttpUriRequest req) { logger.debug(STR + req.getMethod() + STR + req.getURI()); try { execute(req).close(); } catch (final IOException e) { throw new RuntimeException(e); } } | /**
* Execute an HTTP request and close the response.
*
* @param req the request to execute
*/ | Execute an HTTP request and close the response | executeAndClose | {
"repo_name": "whikloj/fcrepo4",
"path": "fcrepo-http-api/src/test/java/org/fcrepo/integration/http/api/AbstractResourceIT.java",
"license": "apache-2.0",
"size": 28411
} | [
"java.io.IOException",
"org.apache.http.client.methods.HttpUriRequest"
] | import java.io.IOException; import org.apache.http.client.methods.HttpUriRequest; | import java.io.*; import org.apache.http.client.methods.*; | [
"java.io",
"org.apache.http"
] | java.io; org.apache.http; | 2,765,403 |
public static List<ItemStack> swapInventory(EntityPlayerMP player, List<ItemStack> newItems) {
List<ItemStack> oldItems = new ArrayList<>();
for (int slotIdx = 0; slotIdx < player.inventory.getSizeInventory(); slotIdx++) {
oldItems.add(player.inventory.getStackInSlot(slotIdx));
if ((newItems != null) && (slotIdx < newItems.size())) {
player.inventory.setInventorySlotContents(slotIdx, newItems.get(slotIdx));
} else {
player.inventory.setInventorySlotContents(slotIdx, null);
}
}
return oldItems;
} | static List<ItemStack> function(EntityPlayerMP player, List<ItemStack> newItems) { List<ItemStack> oldItems = new ArrayList<>(); for (int slotIdx = 0; slotIdx < player.inventory.getSizeInventory(); slotIdx++) { oldItems.add(player.inventory.getStackInSlot(slotIdx)); if ((newItems != null) && (slotIdx < newItems.size())) { player.inventory.setInventorySlotContents(slotIdx, newItems.get(slotIdx)); } else { player.inventory.setInventorySlotContents(slotIdx, null); } } return oldItems; } | /**
* Swaps the player's inventory with the one provided and returns the old.
*
* @param player
* @param newItems
* @return
*/ | Swaps the player's inventory with the one provided and returns the old | swapInventory | {
"repo_name": "CityOfLearning/ForgeEssentials",
"path": "src/main/java/com/forgeessentials/util/PlayerUtil.java",
"license": "epl-1.0",
"size": 4533
} | [
"java.util.ArrayList",
"java.util.List",
"net.minecraft.entity.player.EntityPlayerMP",
"net.minecraft.item.ItemStack"
] | import java.util.ArrayList; import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; | import java.util.*; import net.minecraft.entity.player.*; import net.minecraft.item.*; | [
"java.util",
"net.minecraft.entity",
"net.minecraft.item"
] | java.util; net.minecraft.entity; net.minecraft.item; | 520,484 |
CmdLineArgs arg = new CmdLineArgs();
// if no args throw hissy fit
if (args.length > 0) {
try {
arg.processArgs(args);
String input_file = arg.getArg(FLAG_INPUT_FILE);
ValidateSearch vs = new ValidateSearch(input_file);
vs.performSearch();
vs.compareResults();
} catch (NumberFormatException nfe) {
logger
.error("Hamming Distance and Expected Results must be a number");
usage();
} catch (Exception e) {
logger.error("Error performing results");
usage();
}
} else {
logger.error("No Inputs");
usage();
}
} | CmdLineArgs arg = new CmdLineArgs(); if (args.length > 0) { try { arg.processArgs(args); String input_file = arg.getArg(FLAG_INPUT_FILE); ValidateSearch vs = new ValidateSearch(input_file); vs.performSearch(); vs.compareResults(); } catch (NumberFormatException nfe) { logger .error(STR); usage(); } catch (Exception e) { logger.error(STR); usage(); } } else { logger.error(STR); usage(); } } | /**
* Contains the user input checks and is the launch point of the project.
*
* @param args
* The command line arguments.
*/ | Contains the user input checks and is the launch point of the project | main | {
"repo_name": "jfdm/perma-search",
"path": "src/uk/ac/stand/cs/jfdm/cs4099/validate/Main.java",
"license": "gpl-3.0",
"size": 3039
} | [
"uk.ac.stand.cs.jfdm.cs4099.utils.CmdLineArgs"
] | import uk.ac.stand.cs.jfdm.cs4099.utils.CmdLineArgs; | import uk.ac.stand.cs.jfdm.cs4099.utils.*; | [
"uk.ac.stand"
] | uk.ac.stand; | 2,572,811 |
@Override
public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) {
return new PlainTextAuthenticator(username, password);
}
private static class PlainTextAuthenticator extends ProtocolV1Authenticator implements Authenticator {
private final byte[] username;
private final byte[] password;
public PlainTextAuthenticator(String username, String password) {
this.username = username.getBytes(Charsets.UTF_8);
this.password = password.getBytes(Charsets.UTF_8);
} | Authenticator function(InetSocketAddress host, String authenticator) { return new PlainTextAuthenticator(username, password); } private static class PlainTextAuthenticator extends ProtocolV1Authenticator implements Authenticator { private final byte[] username; private final byte[] password; public PlainTextAuthenticator(String username, String password) { this.username = username.getBytes(Charsets.UTF_8); this.password = password.getBytes(Charsets.UTF_8); } | /**
* Uses the supplied credentials and the SASL PLAIN mechanism to login
* to the server.
*
* @param host the Cassandra host with which we want to authenticate
* @param authenticator the configured authenticator on the host
* @return an Authenticator instance which can be used to perform
* authentication negotiations on behalf of the client
*/ | Uses the supplied credentials and the SASL PLAIN mechanism to login to the server | newAuthenticator | {
"repo_name": "mebigfatguy/java-driver",
"path": "driver-core/src/main/java/com/datastax/driver/core/PlainTextAuthProvider.java",
"license": "apache-2.0",
"size": 4360
} | [
"com.google.common.base.Charsets",
"java.net.InetSocketAddress"
] | import com.google.common.base.Charsets; import java.net.InetSocketAddress; | import com.google.common.base.*; import java.net.*; | [
"com.google.common",
"java.net"
] | com.google.common; java.net; | 743,078 |
protected void detectHandlers() throws BeansException {
ApplicationContext context = getApplicationContext();
String[] beanNames = context.getBeanNamesForType(Object.class);
for (String beanName : beanNames) {
Class<?> handlerType = context.getType(beanName);
ListableBeanFactory bf = (context instanceof ConfigurableApplicationContext ?
((ConfigurableApplicationContext) context).getBeanFactory() : context);
GenericBeanFactoryAccessor bfa = new GenericBeanFactoryAccessor(bf);
RequestMapping mapping = bfa.findAnnotationOnBean(beanName, RequestMapping.class);
if (mapping != null) {
String[] modeKeys = mapping.value();
String[] params = mapping.params();
boolean registerHandlerType = true;
if (modeKeys.length == 0 || params.length == 0) {
registerHandlerType = !detectHandlerMethods(handlerType, beanName, mapping);
}
if (registerHandlerType) {
ParameterMappingPredicate predicate = new ParameterMappingPredicate(params);
for (String modeKey : modeKeys) {
registerHandler(new PortletMode(modeKey), beanName, predicate);
}
}
}
else if (AnnotationUtils.findAnnotation(handlerType, Controller.class) != null) {
detectHandlerMethods(handlerType, beanName, mapping);
}
}
} | void function() throws BeansException { ApplicationContext context = getApplicationContext(); String[] beanNames = context.getBeanNamesForType(Object.class); for (String beanName : beanNames) { Class<?> handlerType = context.getType(beanName); ListableBeanFactory bf = (context instanceof ConfigurableApplicationContext ? ((ConfigurableApplicationContext) context).getBeanFactory() : context); GenericBeanFactoryAccessor bfa = new GenericBeanFactoryAccessor(bf); RequestMapping mapping = bfa.findAnnotationOnBean(beanName, RequestMapping.class); if (mapping != null) { String[] modeKeys = mapping.value(); String[] params = mapping.params(); boolean registerHandlerType = true; if (modeKeys.length == 0 params.length == 0) { registerHandlerType = !detectHandlerMethods(handlerType, beanName, mapping); } if (registerHandlerType) { ParameterMappingPredicate predicate = new ParameterMappingPredicate(params); for (String modeKey : modeKeys) { registerHandler(new PortletMode(modeKey), beanName, predicate); } } } else if (AnnotationUtils.findAnnotation(handlerType, Controller.class) != null) { detectHandlerMethods(handlerType, beanName, mapping); } } } | /**
* Register all handlers specified in the Portlet mode map for the corresponding modes.
* @throws org.springframework.beans.BeansException if the handler couldn't be registered
*/ | Register all handlers specified in the Portlet mode map for the corresponding modes | detectHandlers | {
"repo_name": "cbeams-archive/spring-framework-2.5.x",
"path": "tiger/src/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java",
"license": "apache-2.0",
"size": 8006
} | [
"javax.portlet.PortletMode",
"org.springframework.beans.BeansException",
"org.springframework.beans.factory.ListableBeanFactory",
"org.springframework.beans.factory.generic.GenericBeanFactoryAccessor",
"org.springframework.context.ApplicationContext",
"org.springframework.context.ConfigurableApplicationContext",
"org.springframework.core.annotation.AnnotationUtils",
"org.springframework.stereotype.Controller",
"org.springframework.web.bind.annotation.RequestMapping"
] | import javax.portlet.PortletMode; import org.springframework.beans.BeansException; import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; | import javax.portlet.*; import org.springframework.beans.*; import org.springframework.beans.factory.*; import org.springframework.beans.factory.generic.*; import org.springframework.context.*; import org.springframework.core.annotation.*; import org.springframework.stereotype.*; import org.springframework.web.bind.annotation.*; | [
"javax.portlet",
"org.springframework.beans",
"org.springframework.context",
"org.springframework.core",
"org.springframework.stereotype",
"org.springframework.web"
] | javax.portlet; org.springframework.beans; org.springframework.context; org.springframework.core; org.springframework.stereotype; org.springframework.web; | 530,873 |
protected String deserializeSessionId(byte[] data) throws IOException {
ReplicationStream ois = getReplicationStream(data);
String sessionId = ois.readUTF();
ois.close();
return sessionId;
} | String function(byte[] data) throws IOException { ReplicationStream ois = getReplicationStream(data); String sessionId = ois.readUTF(); ois.close(); return sessionId; } | /**
* Load sessionID
* @throws IOException if an input/output error occurs
*/ | Load sessionID | deserializeSessionId | {
"repo_name": "plumer/codana",
"path": "tomcat_files/8.0.22/DeltaManager.java",
"license": "mit",
"size": 56341
} | [
"java.io.IOException",
"org.apache.catalina.tribes.io.ReplicationStream"
] | import java.io.IOException; import org.apache.catalina.tribes.io.ReplicationStream; | import java.io.*; import org.apache.catalina.tribes.io.*; | [
"java.io",
"org.apache.catalina"
] | java.io; org.apache.catalina; | 2,006,986 |
public static Set makeStopSet(String stopWords)
{
// Break the list of stop words into a set. Be sure to convert the words
// to lower-case, because the set of incoming tokens is assumed to already
// be lower-case.
//
HashSet set = new HashSet();
StringTokenizer stok = new StringTokenizer(stopWords, " \r\n\t\f\b,;");
while (stok.hasMoreTokens())
set.add(stok.nextToken().toLowerCase());
return set;
} // makeStopSet() | static Set function(String stopWords) { StringTokenizer stok = new StringTokenizer(stopWords, STR); while (stok.hasMoreTokens()) set.add(stok.nextToken().toLowerCase()); return set; } | /**
* Make a stop set given a space, comma, or semicolon delimited list of
* stop words.
*
* @param stopWords String of words to make into a set
*
* @return A stop word set suitable for use when constructing an
* {@link BigramStopFilter}.
*/ | Make a stop set given a space, comma, or semicolon delimited list of stop words | makeStopSet | {
"repo_name": "CDLUC3/dash-xtf",
"path": "xtf/WEB-INF/contrib/xtf-lucene/src/java/org/apache/lucene/bigram/BigramStopFilter.java",
"license": "mit",
"size": 11425
} | [
"java.util.Set",
"java.util.StringTokenizer"
] | import java.util.Set; import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 886,720 |
EList<InputElement> getElement(); | EList<InputElement> getElement(); | /**
* Returns the value of the '<em><b>Element</b></em>' containment reference list.
* The list contents are of type {@link ccmm.InputElement}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Element</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Element</em>' containment reference list.
* @see ccmm.CcmmPackage#getInput_Element()
* @model containment="true"
* @generated
*/ | Returns the value of the 'Element' containment reference list. The list contents are of type <code>ccmm.InputElement</code>. If the meaning of the 'Element' containment reference list isn't clear, there really should be more of a description here... | getElement | {
"repo_name": "acgtic211/COScore-Community",
"path": "cos/src/main/java/ccmm/Input.java",
"license": "gpl-3.0",
"size": 2711
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,369,554 |
@DoesServiceRequest
public void addMessage(final CloudQueueMessage message) throws StorageException {
this.addMessage(message, 0, 0, null , null );
} | void function(final CloudQueueMessage message) throws StorageException { this.addMessage(message, 0, 0, null , null ); } | /**
* Adds a message to the back of the queue.
*
* @param message
* A {@link CloudQueueMessage} object that specifies the message to add.
*
* @throws StorageException
* If a storage service error occurred during the operation.
*/ | Adds a message to the back of the queue | addMessage | {
"repo_name": "peterhoeltschi/AzureStorage",
"path": "microsoft-azure-storage/src/com/microsoft/azure/storage/queue/CloudQueue.java",
"license": "apache-2.0",
"size": 84043
} | [
"com.microsoft.azure.storage.StorageException"
] | import com.microsoft.azure.storage.StorageException; | import com.microsoft.azure.storage.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 138,841 |
void configure(Action<? super T> action); | void configure(Action<? super T> action); | /**
* Registers an action to execute to configure the binary. The action is executed only when the element is required.
*/ | Registers an action to execute to configure the binary. The action is executed only when the element is required | configure | {
"repo_name": "lsmaira/gradle",
"path": "subprojects/language-native/src/main/java/org/gradle/language/BinaryProvider.java",
"license": "apache-2.0",
"size": 1358
} | [
"org.gradle.api.Action"
] | import org.gradle.api.Action; | import org.gradle.api.*; | [
"org.gradle.api"
] | org.gradle.api; | 2,412,855 |
@Test
public void test_makeReload() {
final TabMessage reload = TabMessage.makeReload();
assertEquals(Command.RELOAD, reload.getCommand());
} | void function() { final TabMessage reload = TabMessage.makeReload(); assertEquals(Command.RELOAD, reload.getCommand()); } | /**
* Check {@link TabMessage#makeReload()}.
*/ | Check <code>TabMessage#makeReload()</code> | test_makeReload | {
"repo_name": "toastkidjp/Yobidashi",
"path": "src/test/java/jp/toastkid/yobidashi/message/TabMessageTest.java",
"license": "epl-1.0",
"size": 2277
} | [
"jp.toastkid.yobidashi.message.TabMessage",
"org.junit.Assert"
] | import jp.toastkid.yobidashi.message.TabMessage; import org.junit.Assert; | import jp.toastkid.yobidashi.message.*; import org.junit.*; | [
"jp.toastkid.yobidashi",
"org.junit"
] | jp.toastkid.yobidashi; org.junit; | 1,592,401 |
boolean isValid(Properties configuration);
| boolean isValid(Properties configuration); | /**
* Checks if the Task configuration is valid
* and all the files are existing and valid
* @param configuration the Task configuration
* @return true if the configuration is valid, false otherwise
*/ | Checks if the Task configuration is valid and all the files are existing and valid | isValid | {
"repo_name": "AKSW/IGUANA",
"path": "iguana.taskprocessor/src/main/java/org/aksw/iguana/tp/tasks/Task.java",
"license": "agpl-3.0",
"size": 1781
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 2,076,359 |
public void setSizeWH(Vector3f v3f) { //TODO is this usable in any way?
Vector3f v3fCurrentSize = getSize(); //to do not mess with z!!!
super.setSize(new Vector3f(v3f.x,v3f.y,v3fCurrentSize.z));
}
| void function(Vector3f v3f) { Vector3f v3fCurrentSize = getSize(); super.setSize(new Vector3f(v3f.x,v3f.y,v3fCurrentSize.z)); } | /**
* ignores z
* @param v3f
*/ | ignores z | setSizeWH | {
"repo_name": "AquariusPower/DevConsLeJME",
"path": "Misc/src/main/java/com/github/devconslejme/misc/lemur/PanelBase.java",
"license": "bsd-3-clause",
"size": 4053
} | [
"com.jme3.math.Vector3f"
] | import com.jme3.math.Vector3f; | import com.jme3.math.*; | [
"com.jme3.math"
] | com.jme3.math; | 1,897,605 |
@Exported(name="property",inline=true)
public List<JobProperty<? super JobT>> getAllProperties() {
return properties.getView();
} | @Exported(name=STR,inline=true) List<JobProperty<? super JobT>> function() { return properties.getView(); } | /**
* List of all {@link JobProperty} exposed primarily for the remoting API.
* @since 1.282
*/ | List of all <code>JobProperty</code> exposed primarily for the remoting API | getAllProperties | {
"repo_name": "fujibee/hudson",
"path": "core/src/main/java/hudson/model/Job.java",
"license": "mit",
"size": 41857
} | [
"java.util.List",
"org.kohsuke.stapler.export.Exported"
] | import java.util.List; import org.kohsuke.stapler.export.Exported; | import java.util.*; import org.kohsuke.stapler.export.*; | [
"java.util",
"org.kohsuke.stapler"
] | java.util; org.kohsuke.stapler; | 778,316 |
private String readLineTrimComments(BufferedReader br) throws IOException {
String line = br.readLine();
if (line != null) {
line = line.trim();
if (line.indexOf('#') == 0) {
line = "";
}
}
return line;
} | String function(BufferedReader br) throws IOException { String line = br.readLine(); if (line != null) { line = line.trim(); if (line.indexOf('#') == 0) { line = ""; } } return line; } | /**
* Reads the next line from the specified BufferedReader, removing
* leading and trailing whitespace and comments. Null is returned
* on EOF.
**/ | Reads the next line from the specified BufferedReader, removing leading and trailing whitespace and comments. Null is returned on EOF | readLineTrimComments | {
"repo_name": "cdegroot/river",
"path": "src/com/sun/jini/loader/pref/internal/PreferredResources.java",
"license": "apache-2.0",
"size": 15195
} | [
"java.io.BufferedReader",
"java.io.IOException"
] | import java.io.BufferedReader; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 507,591 |
@Test
public void testLang916() throws Exception {
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris"));
cal.clear();
cal.set(2009, 9, 16, 8, 42, 16);
// calendar fast.
{
String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Europe/Paris")).format(cal);
assertEquals("calendar", "2009-10-16T08:42:16 +0200", value);
}
{
String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Asia/Kolkata")).format(cal);
assertEquals("calendar", "2009-10-16T12:12:16 +0530", value);
}
{
String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Europe/London")).format(cal);
assertEquals("calendar", "2009-10-16T07:42:16 +0100", value);
}
} | void function() throws Exception { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(STR)); cal.clear(); cal.set(2009, 9, 16, 8, 42, 16); { String value = FastDateFormat.getInstance(STR, TimeZone.getTimeZone(STR)).format(cal); assertEquals(STR, STR, value); } { String value = FastDateFormat.getInstance(STR, TimeZone.getTimeZone(STR)).format(cal); assertEquals(STR, STR, value); } { String value = FastDateFormat.getInstance(STR, TimeZone.getTimeZone(STR)).format(cal); assertEquals(STR, STR, value); } } | /**
* According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),
* the format method did contain a bug: it did not use the TimeZone data.
*
* This method test that the bug is fixed.
*/ | According to LANG-916 (HREF), the format method did contain a bug: it did not use the TimeZone data. This method test that the bug is fixed | testLang916 | {
"repo_name": "lovecindy/commons-lang",
"path": "src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java",
"license": "apache-2.0",
"size": 16067
} | [
"java.util.Calendar",
"java.util.TimeZone",
"org.junit.Assert"
] | import java.util.Calendar; import java.util.TimeZone; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 904,983 |
public void test_copyOfRange_$CII() throws Exception {
char[] result = Arrays.copyOfRange(charArray, 0, arraySize * 2);
int i = 0;
for (; i < arraySize; i++) {
assertEquals(i + 1, result[i]);
}
for (; i < result.length; i++) {
assertEquals(0, result[i]);
}
result = Arrays.copyOfRange(charArray, 0, arraySize / 2);
i = 0;
for (; i < result.length; i++) {
assertEquals(i + 1, result[i]);
}
result = Arrays.copyOfRange(charArray, 0, 0);
assertEquals(0, result.length);
try {
Arrays.copyOfRange((char[]) null, 0, arraySize);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// expected
}
try {
Arrays.copyOfRange((char[]) null, -1, arraySize);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// expected
}
try {
Arrays.copyOfRange((char[]) null, 0, -1);
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// expected
}
try {
Arrays.copyOfRange(charArray, -1, arraySize);
fail("should throw ArrayIndexOutOfBoundsException");
} catch (ArrayIndexOutOfBoundsException e) {
// expected
}
try {
Arrays.copyOfRange(charArray, 0, -1);
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// expected
}
assertEquals(charArray.length + 1, Arrays.copyOfRange(charArray, 0,
charArray.length + 1).length);
} | public void test_copyOfRange_$CII() throws Exception { char[] result = Arrays.copyOfRange(charArray, 0, arraySize * 2); int i = 0; for (; i < arraySize; i++) { assertEquals(i + 1, result[i]); } for (; i < result.length; i++) { assertEquals(0, result[i]); } result = Arrays.copyOfRange(charArray, 0, arraySize / 2); i = 0; for (; i < result.length; i++) { assertEquals(i + 1, result[i]); } result = Arrays.copyOfRange(charArray, 0, 0); assertEquals(0, result.length); try { Arrays.copyOfRange((char[]) null, 0, arraySize); fail(STR); } catch (NullPointerException e) { } try { Arrays.copyOfRange((char[]) null, -1, arraySize); fail(STR); } catch (NullPointerException e) { } try { Arrays.copyOfRange((char[]) null, 0, -1); fail(STR); } catch (IllegalArgumentException e) { } try { Arrays.copyOfRange(charArray, -1, arraySize); fail(STR); } catch (ArrayIndexOutOfBoundsException e) { } try { Arrays.copyOfRange(charArray, 0, -1); fail(STR); } catch (IllegalArgumentException e) { } assertEquals(charArray.length + 1, Arrays.copyOfRange(charArray, 0, charArray.length + 1).length); } | /**
* {@link java.util.Arrays#copyOfRange(char[], int, int)
*/ | {@link java.util.Arrays#copyOfRange(char[], int, int) | test_copyOfRange_$CII | {
"repo_name": "debian-pkg-android-tools/android-platform-libcore",
"path": "harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ArraysTest.java",
"license": "gpl-2.0",
"size": 207677
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 656,342 |
public void tryOnLoaded() {
PlaygroundDocumentActivity activity = (PlaygroundDocumentActivity) getActivity();
if (activity == null) {
return;
}
RealtimeDocument document = activity.getRealtimeDocument();
if (mOnLoadedRequired && document != null) {
onLoaded(document);
mOnLoadedRequired = false;
for (Entry<View, Boolean> viewEntry : mViewEnabledState.entrySet()) {
viewEntry.getKey().setEnabled(viewEntry.getValue());
}
saveDisabledState = true;
}
} | void function() { PlaygroundDocumentActivity activity = (PlaygroundDocumentActivity) getActivity(); if (activity == null) { return; } RealtimeDocument document = activity.getRealtimeDocument(); if (mOnLoadedRequired && document != null) { onLoaded(document); mOnLoadedRequired = false; for (Entry<View, Boolean> viewEntry : mViewEnabledState.entrySet()) { viewEntry.getKey().setEnabled(viewEntry.getValue()); } saveDisabledState = true; } } | /**
* Calls {@link #onLoaded} if it can be called and it has not already been called.
*/ | Calls <code>#onLoaded</code> if it can be called and it has not already been called | tryOnLoaded | {
"repo_name": "nendu/Heritage-Ireland",
"path": "samples/drive/playground/src/com/google/android/gms/drive/sample/realtimeplayground/PlaygroundFragment.java",
"license": "mit",
"size": 2695
} | [
"android.view.View",
"com.google.android.gms.drive.realtime.RealtimeDocument",
"java.util.Map"
] | import android.view.View; import com.google.android.gms.drive.realtime.RealtimeDocument; import java.util.Map; | import android.view.*; import com.google.android.gms.drive.realtime.*; import java.util.*; | [
"android.view",
"com.google.android",
"java.util"
] | android.view; com.google.android; java.util; | 460,602 |
protected Map<String, String> initialParam(final String key) {
return new HashMap<>();
}
| Map<String, String> function(final String key) { return new HashMap<>(); } | /**
* propagation parameter for first time.
* @param key identification for the session
* @return propagation parameter
*/ | propagation parameter for first time | initialParam | {
"repo_name": "Global-Solutions/web_notifications",
"path": "src/main/java/jp/co/gsol/oss/notifications/impl/AbstractWebSocketTask.java",
"license": "gpl-3.0",
"size": 7445
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 523,071 |
public UUID getPlayerFromIslandLocation(Location loc) {
if (loc == null)
return null;
// Look in the grid
Island island = plugin.getGrid().getIslandAt(loc);
if (island != null) {
return island.getOwner();
}
return null;
} | UUID function(Location loc) { if (loc == null) return null; Island island = plugin.getGrid().getIslandAt(loc); if (island != null) { return island.getOwner(); } return null; } | /**
* Reverse lookup - returns the owner of an island from the location
*
* @param loc
* @return UUID of owner of island
*/ | Reverse lookup - returns the owner of an island from the location | getPlayerFromIslandLocation | {
"repo_name": "Pokechu22/askyblock",
"path": "src/com/wasteofplastic/askyblock/PlayerCache.java",
"license": "gpl-2.0",
"size": 27561
} | [
"org.bukkit.Location"
] | import org.bukkit.Location; | import org.bukkit.*; | [
"org.bukkit"
] | org.bukkit; | 2,223,199 |
private boolean isNeedtoGiveACopy(Cursor cursor, String tableName) {
return !isValueExists(cursor, tableName) && !isSpecialTable(tableName);
} | boolean function(Cursor cursor, String tableName) { return !isValueExists(cursor, tableName) && !isSpecialTable(tableName); } | /**
* Save the name of a created table into table_schema, but there're some
* extra rules. Each table name should be only saved once, and special
* tables will not be saved.
*
* @param cursor
* The cursor used to iterator values in the table.
* @param tableName
* The table name.
* @return If all rules are passed return true, any of them failed return
* false.
*/ | Save the name of a created table into table_schema, but there're some extra rules. Each table name should be only saved once, and special tables will not be saved | isNeedtoGiveACopy | {
"repo_name": "luinnx/LitePal",
"path": "litepal/src/main/java/org/litepal/tablemanager/AssociationCreator.java",
"license": "apache-2.0",
"size": 12697
} | [
"android.database.Cursor"
] | import android.database.Cursor; | import android.database.*; | [
"android.database"
] | android.database; | 1,131,866 |
void writeTo(String writer, OutputStream out, WriterOptions options) throws IOException; | void writeTo(String writer, OutputStream out, WriterOptions options) throws IOException; | /**
* Serializes the model component out to the specified stream using the given abdera writer
*
* @param writer The name of the Abdera writer to use
* @param out The target output stream
* @param options The WriterOptions to use
*/ | Serializes the model component out to the specified stream using the given abdera writer | writeTo | {
"repo_name": "mfranklin/abdera",
"path": "core/src/main/java/org/apache/abdera/model/Base.java",
"license": "apache-2.0",
"size": 5912
} | [
"java.io.IOException",
"java.io.OutputStream",
"org.apache.abdera.writer.WriterOptions"
] | import java.io.IOException; import java.io.OutputStream; import org.apache.abdera.writer.WriterOptions; | import java.io.*; import org.apache.abdera.writer.*; | [
"java.io",
"org.apache.abdera"
] | java.io; org.apache.abdera; | 1,350,169 |
Observable<ServiceResponseWithHeaders<Void, LROSADsPostNonRetry400Headers>> beginPostNonRetry400WithServiceResponseAsync(Product product); | Observable<ServiceResponseWithHeaders<Void, LROSADsPostNonRetry400Headers>> beginPostNonRetry400WithServiceResponseAsync(Product product); | /**
* Long running post request, service returns a 400 with no error body.
*
* @param product Product to put
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/ | Long running post request, service returns a 400 with no error body | beginPostNonRetry400WithServiceResponseAsync | {
"repo_name": "sergey-shandar/autorest",
"path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/lro/LROSADs.java",
"license": "mit",
"size": 173405
} | [
"com.microsoft.rest.ServiceResponseWithHeaders"
] | import com.microsoft.rest.ServiceResponseWithHeaders; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,685,724 |
@SuppressWarnings("unchecked")
public Transcoder getTranscoder();
| @SuppressWarnings(STR) Transcoder function(); | /**
* Set xmemcached's transcoder,it is used for seriailizing
*
* @return
*/ | Set xmemcached's transcoder,it is used for seriailizing | getTranscoder | {
"repo_name": "slimina/xmemcached",
"path": "src/main/java/net/rubyeye/xmemcached/MemcachedClientBuilder.java",
"license": "apache-2.0",
"size": 5484
} | [
"net.rubyeye.xmemcached.transcoders.Transcoder"
] | import net.rubyeye.xmemcached.transcoders.Transcoder; | import net.rubyeye.xmemcached.transcoders.*; | [
"net.rubyeye.xmemcached"
] | net.rubyeye.xmemcached; | 2,766,266 |
public Analyser(SecurityContext ctx, PixelsData pixels, Collection channels,
List shapes)
{
if (pixels == null)
throw new IllegalArgumentException("No Pixels specified.");
if (channels == null || channels.size() == 0)
throw new IllegalArgumentException("No channels specified.");
if (shapes == null || shapes.size() == 0)
throw new IllegalArgumentException("No shapes specified.");
this.pixels = pixels;
this.channels = channels;
Iterator i = shapes.iterator();
ROIShape[] data = new ROIShape[shapes.size()];
int index = 0;
while (i.hasNext()) {
data[index] = (ROIShape) i.next();
index++;
}
loadCall = analyseShapes(ctx, data);
} | public Analyser(SecurityContext ctx, PixelsData pixels, Collection channels, List shapes) { if (pixels == null) throw new IllegalArgumentException(STR); if (channels == null channels.size() == 0) throw new IllegalArgumentException(STR); if (shapes == null shapes.size() == 0) throw new IllegalArgumentException(STR); this.pixels = pixels; this.channels = channels; Iterator i = shapes.iterator(); ROIShape[] data = new ROIShape[shapes.size()]; int index = 0; while (i.hasNext()) { data[index] = (ROIShape) i.next(); index++; } loadCall = analyseShapes(ctx, data); } | /**
* Returns, in a <code>Map</code>.
*
* @see BatchCallTree#getResult()
*/ | Returns, in a <code>Map</code> | getResult | {
"repo_name": "rleigh-dundee/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/views/calls/Analyser.java",
"license": "gpl-2.0",
"size": 4746
} | [
"java.util.Collection",
"java.util.Iterator",
"java.util.List",
"org.openmicroscopy.shoola.env.data.util.SecurityContext",
"org.openmicroscopy.shoola.util.roi.model.ROIShape"
] | import java.util.Collection; import java.util.Iterator; import java.util.List; import org.openmicroscopy.shoola.env.data.util.SecurityContext; import org.openmicroscopy.shoola.util.roi.model.ROIShape; | import java.util.*; import org.openmicroscopy.shoola.env.data.util.*; import org.openmicroscopy.shoola.util.roi.model.*; | [
"java.util",
"org.openmicroscopy.shoola"
] | java.util; org.openmicroscopy.shoola; | 167,733 |
public HealthCheck.Result runHealthCheck(String name) throws NoSuchElementException {
final HealthCheck healthCheck = healthChecks.get(name);
if (healthCheck == null) {
throw new NoSuchElementException("No health check named " + name + " exists");
}
return healthCheck.execute();
} | HealthCheck.Result function(String name) throws NoSuchElementException { final HealthCheck healthCheck = healthChecks.get(name); if (healthCheck == null) { throw new NoSuchElementException(STR + name + STR); } return healthCheck.execute(); } | /**
* Runs the health check with the given name.
*
* @param name the health check's name
* @return the result of the health check
* @throws NoSuchElementException if there is no health check with the given name
*/ | Runs the health check with the given name | runHealthCheck | {
"repo_name": "mveitas/metrics",
"path": "metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheckRegistry.java",
"license": "apache-2.0",
"size": 10770
} | [
"com.codahale.metrics.health.HealthCheck",
"java.util.NoSuchElementException"
] | import com.codahale.metrics.health.HealthCheck; import java.util.NoSuchElementException; | import com.codahale.metrics.health.*; import java.util.*; | [
"com.codahale.metrics",
"java.util"
] | com.codahale.metrics; java.util; | 599,958 |
public ServiceCall<Error> head429Async(final ServiceCallback<Error> serviceCallback) {
return ServiceCall.create(head429Async(), serviceCallback);
} | ServiceCall<Error> function(final ServiceCallback<Error> serviceCallback) { return ServiceCall.create(head429Async(), serviceCallback); } | /**
* Return 429 status code - should be represented in the client as an error.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/ | Return 429 status code - should be represented in the client as an error | head429Async | {
"repo_name": "haocs/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/http/implementation/HttpClientFailuresImpl.java",
"license": "mit",
"size": 78284
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,421,755 |
public static void fullScanTables(Connection connection,
final Visitor visitor)
throws IOException {
scanMeta(connection, null, null, QueryType.TABLE, visitor);
}
/**
* Performs a full scan of <code>hbase:meta</code>.
* @param connection connection we're using
* @param type scanned part of meta
* @return List of {@link Result} | static void function(Connection connection, final Visitor visitor) throws IOException { scanMeta(connection, null, null, QueryType.TABLE, visitor); } /** * Performs a full scan of <code>hbase:meta</code>. * @param connection connection we're using * @param type scanned part of meta * @return List of {@link Result} | /**
* Performs a full scan of <code>hbase:meta</code> for tables.
* @param connection connection we're using
* @param visitor Visitor invoked against each row in tables family.
* @throws IOException
*/ | Performs a full scan of <code>hbase:meta</code> for tables | fullScanTables | {
"repo_name": "juwi/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java",
"license": "apache-2.0",
"size": 74846
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.hbase.client.Connection",
"org.apache.hadoop.hbase.client.Result"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.Result; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.client.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 968,281 |
@Generated
@Selector("setDelaysTouchesEnded:")
public native void setDelaysTouchesEnded(boolean value); | @Selector(STR) native void function(boolean value); | /**
* default is YES. causes touchesEnded or pressesEnded events to be delivered to the target view only after this gesture has failed recognition. this ensures that a touch or press that is part of the gesture can be cancelled if the gesture is recognized
*/ | default is YES. causes touchesEnded or pressesEnded events to be delivered to the target view only after this gesture has failed recognition. this ensures that a touch or press that is part of the gesture can be cancelled if the gesture is recognized | setDelaysTouchesEnded | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UIGestureRecognizer.java",
"license": "apache-2.0",
"size": 17111
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,591,153 |
@SuppressWarnings("unchecked")
public static Map<String,? extends Serializable> deserializeFromBase64( String rawString ) throws IOException
{
// Decode from Base64-encoded String to byte array
byte[] decodedBytes = Base64.decodeBase64( rawString.getBytes("UTF-8") );
// Deserialize from the input stream to the Map
InputStream bytesIn = new ByteArrayInputStream( decodedBytes );
ObjectInputStream in = new ObjectInputStream( bytesIn );
HashMap<String,Serializable> attributes;
try
{
attributes = (HashMap<String,Serializable>)in.readObject();
}
catch ( ClassNotFoundException e )
{
throw new IOException( "Could not deserialiaze user profile attributes. Reason: " + e.getMessage() );
}
finally
{
in.close();
}
return attributes;
} | @SuppressWarnings(STR) static Map<String,? extends Serializable> function( String rawString ) throws IOException { byte[] decodedBytes = Base64.decodeBase64( rawString.getBytes("UTF-8") ); InputStream bytesIn = new ByteArrayInputStream( decodedBytes ); ObjectInputStream in = new ObjectInputStream( bytesIn ); HashMap<String,Serializable> attributes; try { attributes = (HashMap<String,Serializable>)in.readObject(); } catch ( ClassNotFoundException e ) { throw new IOException( STR + e.getMessage() ); } finally { in.close(); } return attributes; } | /**
* Deserializes a Base64-encoded String into a HashMap. Both the keys and values
* must implement {@link java.io.Serializable}.
* @param rawString the String contents containing the map to be deserialized
* @return the attributes, parsed into a Map
* @throws IOException if the contents cannot be parsed for any reason
*/ | Deserializes a Base64-encoded String into a HashMap. Both the keys and values must implement <code>java.io.Serializable</code> | deserializeFromBase64 | {
"repo_name": "tateshitah/jspwiki",
"path": "jspwiki-war/src/main/java/org/apache/wiki/util/Serializer.java",
"license": "apache-2.0",
"size": 3944
} | [
"java.io.ByteArrayInputStream",
"java.io.IOException",
"java.io.InputStream",
"java.io.ObjectInputStream",
"java.io.Serializable",
"java.util.HashMap",
"java.util.Map",
"org.apache.commons.codec.binary.Base64"
] | import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import org.apache.commons.codec.binary.Base64; | import java.io.*; import java.util.*; import org.apache.commons.codec.binary.*; | [
"java.io",
"java.util",
"org.apache.commons"
] | java.io; java.util; org.apache.commons; | 566,908 |
public boolean isAdapted() {
return false;
}
/**
* Sets the value without adapting the value.
*
* This ugly entry point is only used by JAX-WS.
* See {@link JAXBRIContext#getElementPropertyAccessor} | boolean function() { return false; } /** * Sets the value without adapting the value. * * This ugly entry point is only used by JAX-WS. * See {@link JAXBRIContext#getElementPropertyAccessor} | /**
* Returns true if this accessor wraps an adapter.
*
* This method needs to be used with care, but it helps some optimization.
*/ | Returns true if this accessor wraps an adapter. This method needs to be used with care, but it helps some optimization | isAdapted | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jaxws/drop_included/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java",
"license": "gpl-2.0",
"size": 16135
} | [
"com.sun.xml.internal.bind.api.JAXBRIContext"
] | import com.sun.xml.internal.bind.api.JAXBRIContext; | import com.sun.xml.internal.bind.api.*; | [
"com.sun.xml"
] | com.sun.xml; | 706,145 |
private void addQueryParameterCondition(QueryParameterCondition queryParameterCondition, int pipelineId,
Connection conn) throws SQLException {
PreparedStatement psQueryParameterCondition = null;
try {
String sqlQuery = SQLConstants.ThrottleSQLConstants.INSERT_QUERY_PARAMETER_CONDITION_SQL;
psQueryParameterCondition = conn.prepareStatement(sqlQuery);
psQueryParameterCondition.setInt(1, pipelineId);
psQueryParameterCondition.setString(2, queryParameterCondition.getParameter());
psQueryParameterCondition.setString(3, queryParameterCondition.getValue());
psQueryParameterCondition.setBoolean(4, queryParameterCondition.isInvertCondition());
psQueryParameterCondition.executeUpdate();
} finally {
APIMgtDBUtil.closeAllConnections(psQueryParameterCondition, null, null);
}
} | void function(QueryParameterCondition queryParameterCondition, int pipelineId, Connection conn) throws SQLException { PreparedStatement psQueryParameterCondition = null; try { String sqlQuery = SQLConstants.ThrottleSQLConstants.INSERT_QUERY_PARAMETER_CONDITION_SQL; psQueryParameterCondition = conn.prepareStatement(sqlQuery); psQueryParameterCondition.setInt(1, pipelineId); psQueryParameterCondition.setString(2, queryParameterCondition.getParameter()); psQueryParameterCondition.setString(3, queryParameterCondition.getValue()); psQueryParameterCondition.setBoolean(4, queryParameterCondition.isInvertCondition()); psQueryParameterCondition.executeUpdate(); } finally { APIMgtDBUtil.closeAllConnections(psQueryParameterCondition, null, null); } } | /**
* Add QUERY throttling condition to AM_QUERY_PARAMETER_CONDITION table
*
* @param queryParameterCondition {@link QueryParameterCondition} with parameter name and value
* @param pipelineId id of the pipeline which this condition belongs to
* @param conn database connection. This should be provided inorder to rollback transaction
* @throws SQLException
*/ | Add QUERY throttling condition to AM_QUERY_PARAMETER_CONDITION table | addQueryParameterCondition | {
"repo_name": "tharikaGitHub/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java",
"license": "apache-2.0",
"size": 805423
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException",
"org.wso2.carbon.apimgt.api.model.policy.QueryParameterCondition",
"org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants",
"org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import org.wso2.carbon.apimgt.api.model.policy.QueryParameterCondition; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil; | import java.sql.*; import org.wso2.carbon.apimgt.api.model.policy.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*; | [
"java.sql",
"org.wso2.carbon"
] | java.sql; org.wso2.carbon; | 1,410,314 |
public void setStrokingColor(PDColor color)
{
strokingColor = color;
}
| void function(PDColor color) { strokingColor = color; } | /**
* Sets the stroking color.
*
* @param color The new stroking color
*/ | Sets the stroking color | setStrokingColor | {
"repo_name": "mdamt/PdfBox-Android",
"path": "library/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDGraphicsState.java",
"license": "apache-2.0",
"size": 14763
} | [
"org.apache.pdfbox.pdmodel.graphics.color.PDColor"
] | import org.apache.pdfbox.pdmodel.graphics.color.PDColor; | import org.apache.pdfbox.pdmodel.graphics.color.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 1,426,174 |
static DisplayedGemShape.InnerComponentInfo getNameTapeLabelInfo(final DisplayedGem displayedGem) {
return new DisplayedGemShape.InnerComponentInfo() {
Font font = GemCutterPaintHelper.getTitleFont();
| static DisplayedGemShape.InnerComponentInfo getNameTapeLabelInfo(final DisplayedGem displayedGem) { return new DisplayedGemShape.InnerComponentInfo() { Font font = GemCutterPaintHelper.getTitleFont(); | /**
* Get an InnerComponentInfo representing the painting of a tape label.
* @param displayedGem the displayed gem into which to paint.
* @return the corresponding InnerComponentInfo.
*/ | Get an InnerComponentInfo representing the painting of a tape label | getNameTapeLabelInfo | {
"repo_name": "levans/Open-Quark",
"path": "src/Quark_Gems/src/org/openquark/gems/client/TableTopGemPainter.java",
"license": "bsd-3-clause",
"size": 54877
} | [
"java.awt.Font"
] | import java.awt.Font; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,704,390 |
@SuppressWarnings("UnnecessaryFullyQualifiedName")
public static String getTimestamp(Context context) {
String timestamp = "unknown";
Date now = new Date();
java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(context);
java.text.DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(context);
if (dateFormat != null && timeFormat != null) {
timestamp = dateFormat.format(now) + ' ' + timeFormat.format(now);
}
return timestamp;
} | @SuppressWarnings(STR) static String function(Context context) { String timestamp = STR; Date now = new Date(); java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(context); java.text.DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(context); if (dateFormat != null && timeFormat != null) { timestamp = dateFormat.format(now) + ' ' + timeFormat.format(now); } return timestamp; } | /**
* Return a timestamp
*
* @param context Application Context
*/ | Return a timestamp | getTimestamp | {
"repo_name": "manuelmagix/android_packages_apps_Settings",
"path": "src/com/android/settings/util/Helpers.java",
"license": "apache-2.0",
"size": 11092
} | [
"android.content.Context",
"java.util.Date"
] | import android.content.Context; import java.util.Date; | import android.content.*; import java.util.*; | [
"android.content",
"java.util"
] | android.content; java.util; | 2,113,609 |
@ApiModelProperty(value = "The strategy for calculating the leaderboard. Defaults to highest score. Value MUST come from the list of available strategies from the Leaderboard Service")
public String getLeaderboardStrategy() {
return leaderboardStrategy;
} | @ApiModelProperty(value = STR) String function() { return leaderboardStrategy; } | /**
* The strategy for calculating the leaderboard. Defaults to highest score. Value MUST come from the list of available strategies from the Leaderboard Service
* @return leaderboardStrategy
**/ | The strategy for calculating the leaderboard. Defaults to highest score. Value MUST come from the list of available strategies from the Leaderboard Service | getLeaderboardStrategy | {
"repo_name": "knetikmedia/knetikcloud-java-client",
"path": "src/main/java/com/knetikcloud/model/CampaignResource.java",
"license": "apache-2.0",
"size": 12392
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,417,416 |
private void deleteSnapshot(SnapshotInfo snapshotInfo, long storagePoolId) throws UnsupportedEncodingException, DateraObject.DateraError {
long csSnapshotId = snapshotInfo.getId();
try {
DateraObject.DateraConnection conn = DateraUtil.getDateraConnection(storagePoolId, _storagePoolDetailsDao);
SnapshotDetailsVO snapshotDetails = snapshotDetailsDao.findDetail(csSnapshotId, DateraUtil.SNAPSHOT_ID);
if (snapshotDetails != null && snapshotDetails.getValue() != null) {
// Native snapshot being used, delete that
String snapshotName = snapshotDetails.getValue();
DateraUtil.deleteVolumeSnapshot(conn, snapshotName);
//check if the underlying volume needs to be deleted
SnapshotVO snapshot = _snapshotDao.findById(csSnapshotId);
VolumeVO volume = _volumeDao.findById(snapshot.getVolumeId());
if (volume == null) {
//deleted from Cloudstack. Check if other snapshots are using this volume
volume = _volumeDao.findByIdIncludingRemoved(snapshot.getVolumeId());
if(shouldDeleteVolume(snapshot.getVolumeId(), snapshot.getId())) {
DateraUtil.deleteAppInstance(conn, volume.getFolder());
}
}
} else {
// An App Instance is being used to support the CloudStack volume snapshot.
snapshotDetails = snapshotDetailsDao.findDetail(csSnapshotId, DateraUtil.VOLUME_ID);
String appInstanceName = snapshotDetails.getValue();
DateraUtil.deleteAppInstance(conn, appInstanceName);
}
snapshotDetailsDao.removeDetails(csSnapshotId);
StoragePoolVO storagePool = storagePoolDao.findById(storagePoolId);
// getUsedBytes(StoragePool) will not include the snapshot to delete because it has already been deleted by this point
long usedBytes = getUsedBytes(storagePool);
storagePool.setUsedBytes(usedBytes < 0 ? 0 : usedBytes);
storagePoolDao.update(storagePoolId, storagePool);
}
catch (Exception ex) {
s_logger.debug("Error in 'deleteSnapshot(SnapshotInfo, long)'. CloudStack snapshot ID: " + csSnapshotId, ex);
throw ex;
}
} | void function(SnapshotInfo snapshotInfo, long storagePoolId) throws UnsupportedEncodingException, DateraObject.DateraError { long csSnapshotId = snapshotInfo.getId(); try { DateraObject.DateraConnection conn = DateraUtil.getDateraConnection(storagePoolId, _storagePoolDetailsDao); SnapshotDetailsVO snapshotDetails = snapshotDetailsDao.findDetail(csSnapshotId, DateraUtil.SNAPSHOT_ID); if (snapshotDetails != null && snapshotDetails.getValue() != null) { String snapshotName = snapshotDetails.getValue(); DateraUtil.deleteVolumeSnapshot(conn, snapshotName); SnapshotVO snapshot = _snapshotDao.findById(csSnapshotId); VolumeVO volume = _volumeDao.findById(snapshot.getVolumeId()); if (volume == null) { volume = _volumeDao.findByIdIncludingRemoved(snapshot.getVolumeId()); if(shouldDeleteVolume(snapshot.getVolumeId(), snapshot.getId())) { DateraUtil.deleteAppInstance(conn, volume.getFolder()); } } } else { snapshotDetails = snapshotDetailsDao.findDetail(csSnapshotId, DateraUtil.VOLUME_ID); String appInstanceName = snapshotDetails.getValue(); DateraUtil.deleteAppInstance(conn, appInstanceName); } snapshotDetailsDao.removeDetails(csSnapshotId); StoragePoolVO storagePool = storagePoolDao.findById(storagePoolId); long usedBytes = getUsedBytes(storagePool); storagePool.setUsedBytes(usedBytes < 0 ? 0 : usedBytes); storagePoolDao.update(storagePoolId, storagePool); } catch (Exception ex) { s_logger.debug(STR + csSnapshotId, ex); throw ex; } } | /**
* Deletes snapshot on Datera
* @param snapshotInfo snapshot information
* @param storagePoolId primary storage
* @throws UnsupportedEncodingException
* @throws DateraObject.DateraError
*/ | Deletes snapshot on Datera | deleteSnapshot | {
"repo_name": "jcshen007/cloudstack",
"path": "plugins/storage/volume/datera/src/org/apache/cloudstack/storage/datastore/driver/DateraPrimaryDataStoreDriver.java",
"license": "apache-2.0",
"size": 66700
} | [
"com.cloud.storage.SnapshotVO",
"com.cloud.storage.VolumeVO",
"com.cloud.storage.dao.SnapshotDetailsVO",
"java.io.UnsupportedEncodingException",
"org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo",
"org.apache.cloudstack.storage.datastore.db.StoragePoolVO",
"org.apache.cloudstack.storage.datastore.util.DateraObject",
"org.apache.cloudstack.storage.datastore.util.DateraUtil"
] | import com.cloud.storage.SnapshotVO; import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.SnapshotDetailsVO; import java.io.UnsupportedEncodingException; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.datastore.util.DateraObject; import org.apache.cloudstack.storage.datastore.util.DateraUtil; | import com.cloud.storage.*; import com.cloud.storage.dao.*; import java.io.*; import org.apache.cloudstack.engine.subsystem.api.storage.*; import org.apache.cloudstack.storage.datastore.db.*; import org.apache.cloudstack.storage.datastore.util.*; | [
"com.cloud.storage",
"java.io",
"org.apache.cloudstack"
] | com.cloud.storage; java.io; org.apache.cloudstack; | 1,753,057 |
void createSystemUnderTest(SystemUnderTest systemUnderTest, Repository repository, String identifier) throws GreenPepperServerException; | void createSystemUnderTest(SystemUnderTest systemUnderTest, Repository repository, String identifier) throws GreenPepperServerException; | /**
* Creates a new SystemUnderTest.
* </p>
*
* @param systemUnderTest a {@link com.greenpepper.server.domain.SystemUnderTest} object.
* @param repository a {@link com.greenpepper.server.domain.Repository} object.
* @param identifier a {@link java.lang.String} object.
* @throws com.greenpepper.server.GreenPepperServerException if any.
*/ | Creates a new SystemUnderTest. | createSystemUnderTest | {
"repo_name": "strator-dev/greenpepper",
"path": "greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/RpcClientService.java",
"license": "apache-2.0",
"size": 23525
} | [
"com.greenpepper.server.GreenPepperServerException",
"com.greenpepper.server.domain.Repository",
"com.greenpepper.server.domain.SystemUnderTest"
] | import com.greenpepper.server.GreenPepperServerException; import com.greenpepper.server.domain.Repository; import com.greenpepper.server.domain.SystemUnderTest; | import com.greenpepper.server.*; import com.greenpepper.server.domain.*; | [
"com.greenpepper.server"
] | com.greenpepper.server; | 215,756 |
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {
if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {
schemaDOM.startElement(element, attributes,
fLocator.getLineNumber(),
fLocator.getColumnNumber(),
fLocator.getCharacterOffset());
attributes.removeAllAttributes();
String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
schemaDOM.startAnnotationElement(elemRawName, attributes);
schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
schemaDOM.endSyntheticAnnotationElement(annRawName, true);
schemaDOM.endElement();
return;
}
// the order of events that occurs here is:
// schemaDOM.startAnnotation/startAnnotationElement (if applicable)
// schemaDOM.emptyElement (basically the same as startElement then endElement)
// schemaDOM.endAnnotationElement (if applicable)
// the order of events that would occur if this was <element></element>:
// schemaDOM.startAnnotation/startAnnotationElement (if applicable)
// schemaDOM.startElement
// schemaDOM.endAnnotationElement (if applicable)
// schemaDOM.endElementElement
// Thus, we can see that the order of events isn't the same. However, it doesn't
// seem to matter. -- PJM
if (fAnnotationDepth == -1) {
// this is messed up, but a case to consider:
if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
element.localpart == SchemaSymbols.ELT_ANNOTATION) {
schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
}
}
else {
schemaDOM.startAnnotationElement(element, attributes);
}
ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
fLocator.getLineNumber(),
fLocator.getColumnNumber(),
fLocator.getCharacterOffset());
if (fAnnotationDepth == -1) {
// this is messed up, but a case to consider:
if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
element.localpart == SchemaSymbols.ELT_ANNOTATION) {
schemaDOM.endAnnotation(element, newElem);
}
}
else {
schemaDOM.endAnnotationElement(element);
}
}
| void function(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 && element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) { schemaDOM.startElement(element, attributes, fLocator.getLineNumber(), fLocator.getColumnNumber(), fLocator.getCharacterOffset()); attributes.removeAllAttributes(); String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA); final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION); schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext); final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION); schemaDOM.startAnnotationElement(elemRawName, attributes); schemaDOM.charactersRaw(STR); schemaDOM.endSyntheticAnnotationElement(elemRawName, false); schemaDOM.endSyntheticAnnotationElement(annRawName, true); schemaDOM.endElement(); return; } if (fAnnotationDepth == -1) { if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart == SchemaSymbols.ELT_ANNOTATION) { schemaDOM.startAnnotation(element, attributes, fNamespaceContext); } } else { schemaDOM.startAnnotationElement(element, attributes); } ElementImpl newElem = schemaDOM.emptyElement(element, attributes, fLocator.getLineNumber(), fLocator.getColumnNumber(), fLocator.getCharacterOffset()); if (fAnnotationDepth == -1) { if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart == SchemaSymbols.ELT_ANNOTATION) { schemaDOM.endAnnotation(element, newElem); } } else { schemaDOM.endAnnotationElement(element); } } | /**
* An empty element.
*
* @param element The name of the element.
* @param attributes The element attributes.
* @param augs Additional information that may include infoset augmentations
*
* @exception XNIException
* Thrown by handler to signal an error.
*/ | An empty element | emptyElement | {
"repo_name": "jimma/xerces",
"path": "src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java",
"license": "apache-2.0",
"size": 22414
} | [
"org.apache.xerces.impl.xs.SchemaSymbols",
"org.apache.xerces.xni.Augmentations",
"org.apache.xerces.xni.QName",
"org.apache.xerces.xni.XMLAttributes",
"org.apache.xerces.xni.XNIException"
] | import org.apache.xerces.impl.xs.SchemaSymbols; import org.apache.xerces.xni.Augmentations; import org.apache.xerces.xni.QName; import org.apache.xerces.xni.XMLAttributes; import org.apache.xerces.xni.XNIException; | import org.apache.xerces.impl.xs.*; import org.apache.xerces.xni.*; | [
"org.apache.xerces"
] | org.apache.xerces; | 1,779,992 |
return ServiceManager.getService(EditorFactory.class);
} | return ServiceManager.getService(EditorFactory.class); } | /**
* Returns the editor factory instance.
*
* @return the editor factory instance.
*/ | Returns the editor factory instance | getInstance | {
"repo_name": "consulo/consulo",
"path": "modules/base/editor-ui-api/src/main/java/com/intellij/openapi/editor/EditorFactory.java",
"license": "apache-2.0",
"size": 7036
} | [
"com.intellij.openapi.components.ServiceManager"
] | import com.intellij.openapi.components.ServiceManager; | import com.intellij.openapi.components.*; | [
"com.intellij.openapi"
] | com.intellij.openapi; | 1,420,452 |
Rectangle getBounds(); | Rectangle getBounds(); | /**
* Get the bounds of this component relative to its parent - it's width,
* height, and relative location to its parent.
*
* @return the bounds of this component, or null if not on screen
* @see #contains(Point)
*/ | Get the bounds of this component relative to its parent - it's width, height, and relative location to its parent | getBounds | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/accessibility/AccessibleComponent.java",
"license": "gpl-2.0",
"size": 10072
} | [
"java.awt.Rectangle"
] | import java.awt.Rectangle; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,871,190 |
public static String intern(String s) {
return s == null ? s : s.intern();
}
/**
* Loads a key/value pair string as {@link Properties} | static String function(String s) { return s == null ? s : s.intern(); } /** * Loads a key/value pair string as {@link Properties} | /**
* Null-safe String intern method.
*/ | Null-safe String intern method | intern | {
"repo_name": "eclipse/hudson.core",
"path": "hudson-core/src/main/java/hudson/Util.java",
"license": "apache-2.0",
"size": 44657
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 500,965 |
public static String randImage() {
try {
final long min = DateUtils.parseDate("20171104", new String[]{"yyyyMMdd"}).getTime();
final long max = System.currentTimeMillis();
final long delta = max - min;
final long time = ThreadLocalRandom.current().nextLong(0, delta) + min;
return "https://img.hacpai.com/bing/" + DateFormatUtils.format(time, "yyyyMMdd") + ".jpg";
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Generates random image URL failed", e);
return "https://img.hacpai.com/bing/20171104.jpg";
}
} | static String function() { try { final long min = DateUtils.parseDate(STR, new String[]{STR}).getTime(); final long max = System.currentTimeMillis(); final long delta = max - min; final long time = ThreadLocalRandom.current().nextLong(0, delta) + min; return STRGenerates random image URL failedSTRhttps: } } | /**
* Gets an image URL randomly. Sees https://github.com/b3log/bing for more details.
*
* @return an image URL
*/ | Gets an image URL randomly. Sees HREF for more details | randImage | {
"repo_name": "b3log/b3log-solo",
"path": "src/main/java/org/b3log/solo/util/Images.java",
"license": "apache-2.0",
"size": 4297
} | [
"java.util.concurrent.ThreadLocalRandom",
"org.apache.commons.lang.time.DateUtils"
] | import java.util.concurrent.ThreadLocalRandom; import org.apache.commons.lang.time.DateUtils; | import java.util.concurrent.*; import org.apache.commons.lang.time.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 295,402 |
int getNext() {
int index = text.getIndex();
int endIndex = text.getEndIndex();
if (index == endIndex ||
(index = index + getCurrentCodePointCount()) >= endIndex) {
return CharacterIterator.DONE;
}
text.setIndex(index);
return getCurrent();
} | int getNext() { int index = text.getIndex(); int endIndex = text.getEndIndex(); if (index == endIndex (index = index + getCurrentCodePointCount()) >= endIndex) { return CharacterIterator.DONE; } text.setIndex(index); return getCurrent(); } | /**
* Returns next character
*/ | Returns next character | getNext | {
"repo_name": "andreagenso/java2scala",
"path": "test/J2s/java/openjdk-6-src-b27/jdk/src/share/classes/java/text/RuleBasedBreakIterator.java",
"license": "apache-2.0",
"size": 42459
} | [
"java.text.CharacterIterator"
] | import java.text.CharacterIterator; | import java.text.*; | [
"java.text"
] | java.text; | 22,751 |
public static <R> R withPrepare(PrepareAction<R> action) {
try {
Class.forName("net.hydromatic.optiq.jdbc.Driver");
Connection connection =
DriverManager.getConnection("jdbc:optiq:");
OptiqConnection optiqConnection =
connection.unwrap(OptiqConnection.class);
final OptiqServerStatement statement =
optiqConnection.createStatement().unwrap(OptiqServerStatement.class);
//noinspection deprecation
return new OptiqPrepareImpl().perform(statement, action);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | static <R> R function(PrepareAction<R> action) { try { Class.forName(STR); Connection connection = DriverManager.getConnection(STR); OptiqConnection optiqConnection = connection.unwrap(OptiqConnection.class); final OptiqServerStatement statement = optiqConnection.createStatement().unwrap(OptiqServerStatement.class); return new OptiqPrepareImpl().perform(statement, action); } catch (Exception e) { throw new RuntimeException(e); } } | /**
* Initializes a container then calls user-specified code with a planner
* and statement.
*
* @param action Callback containing user-specified code
* @return Return value from action
*/ | Initializes a container then calls user-specified code with a planner and statement | withPrepare | {
"repo_name": "amansinha100/incubator-calcite",
"path": "core/src/main/java/net/hydromatic/optiq/tools/Frameworks.java",
"license": "apache-2.0",
"size": 7658
} | [
"java.sql.Connection",
"java.sql.DriverManager",
"net.hydromatic.optiq.jdbc.OptiqConnection",
"net.hydromatic.optiq.prepare.OptiqPrepareImpl",
"net.hydromatic.optiq.server.OptiqServerStatement"
] | import java.sql.Connection; import java.sql.DriverManager; import net.hydromatic.optiq.jdbc.OptiqConnection; import net.hydromatic.optiq.prepare.OptiqPrepareImpl; import net.hydromatic.optiq.server.OptiqServerStatement; | import java.sql.*; import net.hydromatic.optiq.jdbc.*; import net.hydromatic.optiq.prepare.*; import net.hydromatic.optiq.server.*; | [
"java.sql",
"net.hydromatic.optiq"
] | java.sql; net.hydromatic.optiq; | 2,174,821 |
public com.mozu.api.contracts.productadmin.PriceListEntry getPriceListEntry(String priceListCode, String productCode, String currencyCode, DateTime startDate, String responseFields) throws Exception
{
MozuClient<com.mozu.api.contracts.productadmin.PriceListEntry> client = com.mozu.api.clients.commerce.catalog.admin.pricelists.PriceListEntryClient.getPriceListEntryClient( priceListCode, productCode, currencyCode, startDate, responseFields);
client.setContext(_apiContext);
client.executeRequest();
return client.getResult();
} | com.mozu.api.contracts.productadmin.PriceListEntry function(String priceListCode, String productCode, String currencyCode, DateTime startDate, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.PriceListEntry> client = com.mozu.api.clients.commerce.catalog.admin.pricelists.PriceListEntryClient.getPriceListEntryClient( priceListCode, productCode, currencyCode, startDate, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } | /**
* Retrieves the details of a price list entry.
* <p><pre><code>
* PriceListEntry pricelistentry = new PriceListEntry();
* PriceListEntry priceListEntry = pricelistentry.getPriceListEntry( priceListCode, productCode, currencyCode, startDate, responseFields);
* </code></pre></p>
* @param currencyCode The three character ISO currency code, such as USD for US Dollars.
* @param priceListCode The unique code of the price list associated with the price list entry.
* @param productCode The unique, user-defined product code of a product, used throughout Mozu to reference and associate to a product.
* @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
* @param startDate The start date of the price list entry.
* @return com.mozu.api.contracts.productadmin.PriceListEntry
* @see com.mozu.api.contracts.productadmin.PriceListEntry
*/ | Retrieves the details of a price list entry. <code><code> PriceListEntry pricelistentry = new PriceListEntry(); PriceListEntry priceListEntry = pricelistentry.getPriceListEntry( priceListCode, productCode, currencyCode, startDate, responseFields); </code></code> | getPriceListEntry | {
"repo_name": "lakshmi-nair/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/resources/commerce/catalog/admin/pricelists/PriceListEntryResource.java",
"license": "mit",
"size": 14482
} | [
"com.mozu.api.MozuClient",
"org.joda.time.DateTime"
] | import com.mozu.api.MozuClient; import org.joda.time.DateTime; | import com.mozu.api.*; import org.joda.time.*; | [
"com.mozu.api",
"org.joda.time"
] | com.mozu.api; org.joda.time; | 1,127,886 |
public String array() {
return java.util.Arrays.toString(tokens);
} | String function() { return java.util.Arrays.toString(tokens); } | /**
* Return the TokenArray as array
*
* @return the array of tokens
*/ | Return the TokenArray as array | array | {
"repo_name": "impactcentre/ocrevalUAtion",
"path": "src/main/java/eu/digitisation/document/TokenArray.java",
"license": "apache-2.0",
"size": 4348
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 134,388 |
public static boolean existsTargets(World w, String targetGroup) {
return w.getManager(GroupManager.class).getEntities(targetGroup).size > 0;
}
| static boolean function(World w, String targetGroup) { return w.getManager(GroupManager.class).getEntities(targetGroup).size > 0; } | /**
* Method to check whether there exists a target in the given group
* @param w
* @param targetGroup
* @return
*/ | Method to check whether there exists a target in the given group | existsTargets | {
"repo_name": "bmaxwell921/SwapShip",
"path": "core/src/main/swapship/util/GameUtil.java",
"license": "mit",
"size": 4773
} | [
"com.artemis.World",
"com.artemis.managers.GroupManager"
] | import com.artemis.World; import com.artemis.managers.GroupManager; | import com.artemis.*; import com.artemis.managers.*; | [
"com.artemis",
"com.artemis.managers"
] | com.artemis; com.artemis.managers; | 25,621 |
private Expression getParsedOrderByColumn(final Expression column) {
if (column instanceof Name) {
final Name columnName = (Name) column;
final String environment = columnName.getEnvironment();
if (environment != null && !environment.isEmpty()) {
final Expression parsedColumn = column(columnName.getName());
inject(parsedColumn);
switch (column.getOrdering()) {
case "DESC":
parsedColumn.desc();
break;
default:
parsedColumn.asc();
break;
}
return parsedColumn;
}
}
return column;
} | Expression function(final Expression column) { if (column instanceof Name) { final Name columnName = (Name) column; final String environment = columnName.getEnvironment(); if (environment != null && !environment.isEmpty()) { final Expression parsedColumn = column(columnName.getName()); inject(parsedColumn); switch (column.getOrdering()) { case "DESC": parsedColumn.desc(); break; default: parsedColumn.asc(); break; } return parsedColumn; } } return column; } | /**
* Helper method which removes the environment parameter from a column when it is used inside an order by statement
* and in a paginated query. This is needed in order to avoid "The multi-part identifier could not be bound" error
* which only happens in SQL Server.
*
* @param column The column that will be parsed.
* @return The new column which does not contain any environment value.
* @since 2.1.13
*/ | Helper method which removes the environment parameter from a column when it is used inside an order by statement and in a paginated query. This is needed in order to avoid "The multi-part identifier could not be bound" error which only happens in SQL Server | getParsedOrderByColumn | {
"repo_name": "feedzai/pdb",
"path": "src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/SqlServerTranslator.java",
"license": "apache-2.0",
"size": 17978
} | [
"com.feedzai.commons.sql.abstraction.dml.Expression",
"com.feedzai.commons.sql.abstraction.dml.Name",
"com.feedzai.commons.sql.abstraction.dml.dialect.SqlBuilder"
] | import com.feedzai.commons.sql.abstraction.dml.Expression; import com.feedzai.commons.sql.abstraction.dml.Name; import com.feedzai.commons.sql.abstraction.dml.dialect.SqlBuilder; | import com.feedzai.commons.sql.abstraction.dml.*; import com.feedzai.commons.sql.abstraction.dml.dialect.*; | [
"com.feedzai.commons"
] | com.feedzai.commons; | 2,731,891 |
private UploadJob getNewUploadJob() throws ServerError {
final Roles roles = iAdmin.getSecurityRoles();
final UploadJob uploadJob = new UploadJobI();
uploadJob.setUsername(rstring(roles.rootName));
uploadJob.setGroupname(rstring(roles.systemGroupName));
uploadJob.setSubmitted(rtime(System.currentTimeMillis()));
uploadJob.setScheduledFor(rtime(System.currentTimeMillis()));
uploadJob.setStarted(rtime(System.currentTimeMillis()));
uploadJob.setFinished(rtime(System.currentTimeMillis()));
uploadJob.setMessage(rstring(getClass().getSimpleName()));
uploadJob.setStatus((JobStatus) factory.getTypesService().getEnumeration(JobStatus.class.getName(), JobHandle.FINISHED));
uploadJob.setType(rstring("Test"));
return uploadJob;
} | UploadJob function() throws ServerError { final Roles roles = iAdmin.getSecurityRoles(); final UploadJob uploadJob = new UploadJobI(); uploadJob.setUsername(rstring(roles.rootName)); uploadJob.setGroupname(rstring(roles.systemGroupName)); uploadJob.setSubmitted(rtime(System.currentTimeMillis())); uploadJob.setScheduledFor(rtime(System.currentTimeMillis())); uploadJob.setStarted(rtime(System.currentTimeMillis())); uploadJob.setFinished(rtime(System.currentTimeMillis())); uploadJob.setMessage(rstring(getClass().getSimpleName())); uploadJob.setStatus((JobStatus) factory.getTypesService().getEnumeration(JobStatus.class.getName(), JobHandle.FINISHED)); uploadJob.setType(rstring("Test")); return uploadJob; } | /**
* Creates a new finished upload job, without persisting it.
* @return the new job
* @throws ServerError unexpected
*/ | Creates a new finished upload job, without persisting it | getNewUploadJob | {
"repo_name": "stelfrich/openmicroscopy",
"path": "components/tools/OmeroJava/test/integration/MetadataServiceTest.java",
"license": "gpl-2.0",
"size": 84821
} | [
"org.testng.annotations.Test"
] | import org.testng.annotations.Test; | import org.testng.annotations.*; | [
"org.testng.annotations"
] | org.testng.annotations; | 598,980 |
@Nullable
public static AlignmentImpl getAlignment(final @NotNull AbstractBlockWrapper block) {
AbstractBlockWrapper current = block;
while (true) {
AlignmentImpl alignment = current.getAlignment();
if (alignment == null || alignment.getOffsetRespBlockBefore(block) == null) {
current = current.getParent();
if (current == null || current.getStartOffset() != block.getStartOffset()) {
return null;
}
}
else {
return alignment;
}
}
} | static AlignmentImpl function(final @NotNull AbstractBlockWrapper block) { AbstractBlockWrapper current = block; while (true) { AlignmentImpl alignment = current.getAlignment(); if (alignment == null alignment.getOffsetRespBlockBefore(block) == null) { current = current.getParent(); if (current == null current.getStartOffset() != block.getStartOffset()) { return null; } } else { return alignment; } } } | /**
* Checks if there is an {@link AlignmentImpl} object that should be used during adjusting
* {@link AbstractBlockWrapper#getWhiteSpace() white space} of the given block.
*
* @param block target block
* @return alignment object to use during adjusting white space of the given block if any; <code>null</code> otherwise
*/ | Checks if there is an <code>AlignmentImpl</code> object that should be used during adjusting <code>AbstractBlockWrapper#getWhiteSpace() white space</code> of the given block | getAlignment | {
"repo_name": "android-ia/platform_tools_idea",
"path": "platform/lang-impl/src/com/intellij/formatting/CoreFormatterUtil.java",
"license": "apache-2.0",
"size": 10455
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 2,128,615 |
public CompoundingMethod getCompoundingMethod() {
return compoundingMethod != null ? compoundingMethod : CompoundingMethod.NONE;
} | CompoundingMethod function() { return compoundingMethod != null ? compoundingMethod : CompoundingMethod.NONE; } | /**
* Gets the compounding method to use when there is more than one accrual period
* in each payment period, providing a default result if no override specified.
* <p>
* Compounding is used when combining accrual periods.
*
* @return the compounding method, not null
*/ | Gets the compounding method to use when there is more than one accrual period in each payment period, providing a default result if no override specified. Compounding is used when combining accrual periods | getCompoundingMethod | {
"repo_name": "jmptrader/Strata",
"path": "modules/product/src/main/java/com/opengamma/strata/product/swap/type/OvernightRateSwapLegConvention.java",
"license": "apache-2.0",
"size": 60593
} | [
"com.opengamma.strata.product.swap.CompoundingMethod"
] | import com.opengamma.strata.product.swap.CompoundingMethod; | import com.opengamma.strata.product.swap.*; | [
"com.opengamma.strata"
] | com.opengamma.strata; | 2,212,565 |
public double calculateMaxColWidth(int index) {
TableRowElement row = TableRowElement
.as(root.getFirstChildElement());
double maxWidth = 0;
while (row != null) {
final TableCellElement cell = row.getCells().getItem(index);
final boolean isVisible = !cell.getStyle().getDisplay()
.equals(Display.NONE.getCssName());
if (isVisible) {
maxWidth = Math.max(maxWidth, getBoundingWidth(cell));
}
row = TableRowElement.as(row.getNextSiblingElement());
}
return maxWidth;
} | double function(int index) { TableRowElement row = TableRowElement .as(root.getFirstChildElement()); double maxWidth = 0; while (row != null) { final TableCellElement cell = row.getCells().getItem(index); final boolean isVisible = !cell.getStyle().getDisplay() .equals(Display.NONE.getCssName()); if (isVisible) { maxWidth = Math.max(maxWidth, getBoundingWidth(cell)); } row = TableRowElement.as(row.getNextSiblingElement()); } return maxWidth; } | /**
* Iterates through all the cells in a column and returns the width of
* the widest element in this RowContainer.
*
* @param index
* the index of the column to inspect
* @return the pixel width of the widest element in the indicated column
*/ | Iterates through all the cells in a column and returns the width of the widest element in this RowContainer | calculateMaxColWidth | {
"repo_name": "Darsstar/framework",
"path": "client/src/main/java/com/vaadin/client/widgets/Escalator.java",
"license": "apache-2.0",
"size": 280287
} | [
"com.google.gwt.dom.client.Style",
"com.google.gwt.dom.client.TableCellElement",
"com.google.gwt.dom.client.TableRowElement"
] | import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.TableCellElement; import com.google.gwt.dom.client.TableRowElement; | import com.google.gwt.dom.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,807,249 |
Date getEvoStep(); | Date getEvoStep(); | /**
* Returns the value of the '<em><b>Evo Step</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Evo Step</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Evo Step</em>' attribute.
* @see #setEvoStep(Date)
* @see de.darwinspl.feature.evolution.evolutionoperation.EvolutionoperationPackage#getDwEvolutionOperation_EvoStep()
* @model
* @generated
*/ | Returns the value of the 'Evo Step' attribute. If the meaning of the 'Evo Step' attribute isn't clear, there really should be more of a description here... | getEvoStep | {
"repo_name": "DarwinSPL/DarwinSPL",
"path": "plugins/de.darwinspl.feature.evolution.editoroperation/src-gen/de/darwinspl/feature/evolution/evolutionoperation/DwEvolutionOperation.java",
"license": "apache-2.0",
"size": 1582
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 954,911 |
public void addClaim() throws ParseException {
String name = editTextName.getText().toString();
String description = editTextDescription.getText().toString();
//ensures no empty fields for date(s), name and description
if (startDate.getText().toString().equals("") ||endDate.getText().toString().equals("")|| name.equals("") || description.equals("")) {
Toast.makeText(AddClaimActivity.this,"Incomplete Fields", Toast.LENGTH_SHORT).show();
} else {
//Initializing variables
Date sdate = df.parse(startDate.getText().toString());
Date edate = df.parse(endDate.getText().toString());
//ensures end date is after start date
if (sdate.after(edate)) {
Toast.makeText(this, "End Date needs to be after Start Date", Toast.LENGTH_SHORT).show();
} else {
//create claim
id = CLC.addClaim(name, sdate, edate, description, this.user);
ArrayList<Destination> destination = parentActivity.getDestination();
CLC.getClaim(id).setDestination(destination);
//add Tag to Claim
for (int i = 0; i< tagsArrayList.size(); i++){
try {
CLC.addTagToClaim(id, tagsArrayList.get(i));
} catch (AlreadyExistsException e) {
}
}
//toast finished
Toast.makeText(AddClaimActivity.this,"Claim Saved.", Toast.LENGTH_SHORT).show();
finish();
}
}
} | void function() throws ParseException { String name = editTextName.getText().toString(); String description = editTextDescription.getText().toString(); if (startDate.getText().toString().equals(STRSTRSTRSTRIncomplete FieldsSTREnd Date needs to be after Start DateSTRClaim Saved.", Toast.LENGTH_SHORT).show(); finish(); } } } | /** adds a new claim and returns the user back to the claim list
* @throws Parse Exception
*/ | adds a new claim and returns the user back to the claim list | addClaim | {
"repo_name": "CMPUT301W15T12/C301Project",
"path": "CMPUT301W15T12/src/ca/ualberta/cs/cmput301w15t12/AddClaimActivity.java",
"license": "apache-2.0",
"size": 12261
} | [
"android.widget.Toast",
"java.text.ParseException",
"java.util.Date"
] | import android.widget.Toast; import java.text.ParseException; import java.util.Date; | import android.widget.*; import java.text.*; import java.util.*; | [
"android.widget",
"java.text",
"java.util"
] | android.widget; java.text; java.util; | 2,803,662 |
public void store(final SwapKey key, @Nullable final byte[] val) throws IgniteSpiException {
assert key != null;
final ConcurrentMap<SwapKey, SwapValue> part = partition(key.partition(), true);
assert part != null;
if (val == null) {
SwapValue swapVal = part.remove(key);
if (swapVal != null) {
removeFromFile(swapVal);
size.addAndGet(-swapVal.len);
cnt.decrementAndGet();
}
return;
}
final SwapValue swapVal = new SwapValue(val);
SwapValue old = part.put(key, swapVal);
if (old != null) {
size.addAndGet(val.length - old.len);
removeFromFile(old);
}
else {
size.addAndGet(val.length);
cnt.incrementAndGet();
}
que.add(swapVal);
} | void function(final SwapKey key, @Nullable final byte[] val) throws IgniteSpiException { assert key != null; final ConcurrentMap<SwapKey, SwapValue> part = partition(key.partition(), true); assert part != null; if (val == null) { SwapValue swapVal = part.remove(key); if (swapVal != null) { removeFromFile(swapVal); size.addAndGet(-swapVal.len); cnt.decrementAndGet(); } return; } final SwapValue swapVal = new SwapValue(val); SwapValue old = part.put(key, swapVal); if (old != null) { size.addAndGet(val.length - old.len); removeFromFile(old); } else { size.addAndGet(val.length); cnt.incrementAndGet(); } que.add(swapVal); } | /**
* Stores value in space.
*
* @param key Key.
* @param val Value.
* @throws org.apache.ignite.spi.IgniteSpiException In case of error.
*/ | Stores value in space | store | {
"repo_name": "dlnufox/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java",
"license": "apache-2.0",
"size": 57251
} | [
"java.util.concurrent.ConcurrentMap",
"org.apache.ignite.spi.IgniteSpiException",
"org.apache.ignite.spi.swapspace.SwapKey",
"org.jetbrains.annotations.Nullable"
] | import java.util.concurrent.ConcurrentMap; import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.spi.swapspace.SwapKey; import org.jetbrains.annotations.Nullable; | import java.util.concurrent.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.swapspace.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.util; org.apache.ignite; org.jetbrains.annotations; | 519,960 |
public void writeAndClose( boolean emitClassName, Object value )
throws IOException {
if ( response.getContentType() == null ) {
response.setContentType( "application/json; charset=" + Charset.defaultCharset().displayName() );
}
value.getClass().getModifiers();
JSONWriter writer = new JSONWriter( emitClassName );
writeAndClose( writer.write( value ) );
}
| void function( boolean emitClassName, Object value ) throws IOException { if ( response.getContentType() == null ) { response.setContentType( STR + Charset.defaultCharset().displayName() ); } value.getClass().getModifiers(); JSONWriter writer = new JSONWriter( emitClassName ); writeAndClose( writer.write( value ) ); } | /**
* 'application/json; charset=$deafultCharset$' will be used as default if no content-type has been set.
*
* @param emitClassName
* @param value
* @throws IOException
*/ | 'application/json; charset=$deafultCharset$' will be used as default if no content-type has been set | writeAndClose | {
"repo_name": "lat-lon/deegree2-base",
"path": "deegree2-core/src/main/java/org/deegree/enterprise/control/ajax/ResponseHandler.java",
"license": "lgpl-2.1",
"size": 4936
} | [
"java.io.IOException",
"java.nio.charset.Charset",
"org.stringtree.json.JSONWriter"
] | import java.io.IOException; import java.nio.charset.Charset; import org.stringtree.json.JSONWriter; | import java.io.*; import java.nio.charset.*; import org.stringtree.json.*; | [
"java.io",
"java.nio",
"org.stringtree.json"
] | java.io; java.nio; org.stringtree.json; | 1,058,709 |
public synchronized void endCurrentLogSegment(boolean writeEndTxn) {
LOG.info("Ending log segment " + curSegmentTxId);
Preconditions.checkState(isSegmentOpen(),
"Bad state: %s", state);
if (writeEndTxn) {
logEdit(LogSegmentOp.getInstance(cache.get(),
FSEditLogOpCodes.OP_END_LOG_SEGMENT));
logSync();
}
printStatistics(true);
final long lastTxId = getLastWrittenTxId();
try {
journalSet.finalizeLogSegment(curSegmentTxId, lastTxId);
editLogStream = null;
} catch (IOException e) {
//All journals have failed, it will be handled in logSync.
}
state = State.BETWEEN_LOG_SEGMENTS;
} | synchronized void function(boolean writeEndTxn) { LOG.info(STR + curSegmentTxId); Preconditions.checkState(isSegmentOpen(), STR, state); if (writeEndTxn) { logEdit(LogSegmentOp.getInstance(cache.get(), FSEditLogOpCodes.OP_END_LOG_SEGMENT)); logSync(); } printStatistics(true); final long lastTxId = getLastWrittenTxId(); try { journalSet.finalizeLogSegment(curSegmentTxId, lastTxId); editLogStream = null; } catch (IOException e) { } state = State.BETWEEN_LOG_SEGMENTS; } | /**
* Finalize the current log segment.
* Transitions from IN_SEGMENT state to BETWEEN_LOG_SEGMENTS state.
*/ | Finalize the current log segment. Transitions from IN_SEGMENT state to BETWEEN_LOG_SEGMENTS state | endCurrentLogSegment | {
"repo_name": "tseen/Federated-HDFS",
"path": "tseenliu/FedHDFS-hadoop-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java",
"license": "apache-2.0",
"size": 50974
} | [
"com.google.common.base.Preconditions",
"java.io.IOException",
"org.apache.hadoop.hdfs.server.namenode.FSEditLogOp"
] | import com.google.common.base.Preconditions; import java.io.IOException; import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp; | import com.google.common.base.*; import java.io.*; import org.apache.hadoop.hdfs.server.namenode.*; | [
"com.google.common",
"java.io",
"org.apache.hadoop"
] | com.google.common; java.io; org.apache.hadoop; | 1,376,011 |
@Deprecated
private static void updateData(Context context, String fileName) {
List<Session> historySessions = getSessionListFromFile(context, fileName);
saveSessionListToFile(context, fileName, historySessions);
} | static void function(Context context, String fileName) { List<Session> historySessions = getSessionListFromFile(context, fileName); saveSessionListToFile(context, fileName, historySessions); } | /**
* Get list and save new list
*/ | Get list and save new list | updateData | {
"repo_name": "plusCubed/plusTimer",
"path": "app/src/main/java/com/pluscubed/plustimer/utils/Utils.java",
"license": "gpl-3.0",
"size": 18831
} | [
"android.content.Context",
"com.pluscubed.plustimer.model.Session",
"java.util.List"
] | import android.content.Context; import com.pluscubed.plustimer.model.Session; import java.util.List; | import android.content.*; import com.pluscubed.plustimer.model.*; import java.util.*; | [
"android.content",
"com.pluscubed.plustimer",
"java.util"
] | android.content; com.pluscubed.plustimer; java.util; | 279,537 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.