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
|
---|---|---|---|---|---|---|---|---|---|---|---|
@InterfaceAudience.Private
public String generateIDForRevision(RevisionInternal rev, byte[] json, Map<String, AttachmentInternal> attachments, String previousRevisionId) {
MessageDigest md5Digest;
// Revision IDs have a generation count, a hyphen, and a UUID.
int generation = 0;
if(previousRevisionId != null) {
generation = RevisionInternal.generationFromRevID(previousRevisionId);
if(generation == 0) {
return null;
}
}
// Generate a digest for this revision based on the previous revision ID, document JSON,
// and attachment digests. This doesn't need to be secure; we just need to ensure that this
// code consistently generates the same ID given equivalent revisions.
try {
md5Digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
// single byte - length of previous revision id
// +
// previous revision id
int length = 0;
byte[] prevIDUTF8 = null;
if (previousRevisionId != null) {
prevIDUTF8 = previousRevisionId.getBytes(Charset.forName("UTF-8"));
length = prevIDUTF8.length;
}
if (length > 0xFF) {
return null;
}
byte lengthByte = (byte) (length & 0xFF);
byte[] lengthBytes = new byte[] { lengthByte };
md5Digest.update(lengthBytes); // prefix with length byte
if (length > 0 && prevIDUTF8 != null) {
md5Digest.update(prevIDUTF8);
}
// single byte - deletion flag
int isDeleted = ((rev.isDeleted() != false) ? 1 : 0);
byte[] deletedByte = new byte[] { (byte) isDeleted };
md5Digest.update(deletedByte);
// all attachment keys
List<String> attachmentKeys = new ArrayList<String>(attachments.keySet());
Collections.sort(attachmentKeys);
for (String key : attachmentKeys) {
AttachmentInternal attachment = attachments.get(key);
md5Digest.update(attachment.getBlobKey().getBytes());
}
// json
if (json != null) {
md5Digest.update(json);
}
byte[] md5DigestResult = md5Digest.digest();
String digestAsHex = Utils.bytesToHex(md5DigestResult);
int generationIncremented = generation + 1;
return String.format("%d-%s", generationIncremented, digestAsHex).toLowerCase();
} | @InterfaceAudience.Private String function(RevisionInternal rev, byte[] json, Map<String, AttachmentInternal> attachments, String previousRevisionId) { MessageDigest md5Digest; int generation = 0; if(previousRevisionId != null) { generation = RevisionInternal.generationFromRevID(previousRevisionId); if(generation == 0) { return null; } } try { md5Digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } int length = 0; byte[] prevIDUTF8 = null; if (previousRevisionId != null) { prevIDUTF8 = previousRevisionId.getBytes(Charset.forName("UTF-8")); length = prevIDUTF8.length; } if (length > 0xFF) { return null; } byte lengthByte = (byte) (length & 0xFF); byte[] lengthBytes = new byte[] { lengthByte }; md5Digest.update(lengthBytes); if (length > 0 && prevIDUTF8 != null) { md5Digest.update(prevIDUTF8); } int isDeleted = ((rev.isDeleted() != false) ? 1 : 0); byte[] deletedByte = new byte[] { (byte) isDeleted }; md5Digest.update(deletedByte); List<String> attachmentKeys = new ArrayList<String>(attachments.keySet()); Collections.sort(attachmentKeys); for (String key : attachmentKeys) { AttachmentInternal attachment = attachments.get(key); md5Digest.update(attachment.getBlobKey().getBytes()); } if (json != null) { md5Digest.update(json); } byte[] md5DigestResult = md5Digest.digest(); String digestAsHex = Utils.bytesToHex(md5DigestResult); int generationIncremented = generation + 1; return String.format("%d-%s", generationIncremented, digestAsHex).toLowerCase(); } | /**
* in CBLDatabase+Insertion.m
* - (NSString*) generateIDForRevision: (CBL_Revision*)rev
* withJSON: (NSData*)json
* attachments: (NSDictionary*)attachments
* prevID: (NSString*) prevID
* @exclude
*/ | in CBLDatabase+Insertion.m - (NSString*) generateIDForRevision: (CBL_Revision*)rev attachments: (NSDictionary*)attachments | generateIDForRevision | {
"repo_name": "netsense-sas/couchbase-lite-java-core",
"path": "src/main/java/com/couchbase/lite/Database.java",
"license": "apache-2.0",
"size": 203426
} | [
"com.couchbase.lite.internal.AttachmentInternal",
"com.couchbase.lite.internal.InterfaceAudience",
"com.couchbase.lite.internal.RevisionInternal",
"com.couchbase.lite.util.Utils",
"java.nio.charset.Charset",
"java.security.MessageDigest",
"java.security.NoSuchAlgorithmException",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"java.util.Map"
]
| import com.couchbase.lite.internal.AttachmentInternal; import com.couchbase.lite.internal.InterfaceAudience; import com.couchbase.lite.internal.RevisionInternal; import com.couchbase.lite.util.Utils; import java.nio.charset.Charset; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; | import com.couchbase.lite.internal.*; import com.couchbase.lite.util.*; import java.nio.charset.*; import java.security.*; import java.util.*; | [
"com.couchbase.lite",
"java.nio",
"java.security",
"java.util"
]
| com.couchbase.lite; java.nio; java.security; java.util; | 507,538 |
if (text == null) {
return null;
}
byte[] sba = text.getBytes(StandardCharsets.UTF_8);
if (sba.length <= maxLength) {
return text;
}
CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
// Ensure truncation by having byte buffer = maxBytes
ByteBuffer bb = ByteBuffer.wrap(sba, 0, maxLength);
CharBuffer cb = CharBuffer.allocate(maxLength);
// Ignore an incomplete character
decoder.onMalformedInput(CodingErrorAction.IGNORE);
decoder.decode(bb, cb, true);
decoder.flush(cb);
return new String(cb.array(), 0, cb.position());
} | if (text == null) { return null; } byte[] sba = text.getBytes(StandardCharsets.UTF_8); if (sba.length <= maxLength) { return text; } CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder(); ByteBuffer bb = ByteBuffer.wrap(sba, 0, maxLength); CharBuffer cb = CharBuffer.allocate(maxLength); decoder.onMalformedInput(CodingErrorAction.IGNORE); decoder.decode(bb, cb, true); decoder.flush(cb); return new String(cb.array(), 0, cb.position()); } | /**
* Truncates a string to the number of characters that fit in X bytes avoiding multi byte characters being cut in
* half at the cut off point. Also handles surrogate pairs where 2 characters in the string is actually one literal
* character.
*
* Based on: https://stackoverflow.com/a/35148974/1818849
*
*/ | Truncates a string to the number of characters that fit in X bytes avoiding multi byte characters being cut in half at the cut off point. Also handles surrogate pairs where 2 characters in the string is actually one literal character. Based on: HREF | truncateToNumValidBytes | {
"repo_name": "robin13/elasticsearch",
"path": "x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/customwordembedding/FeatureUtils.java",
"license": "apache-2.0",
"size": 3142
} | [
"java.nio.ByteBuffer",
"java.nio.CharBuffer",
"java.nio.charset.CharsetDecoder",
"java.nio.charset.CodingErrorAction",
"java.nio.charset.StandardCharsets"
]
| import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; | import java.nio.*; import java.nio.charset.*; | [
"java.nio"
]
| java.nio; | 407,210 |
private void doQuerySkuDetails(final OnInventoryFinishedListener listener) {
synchronized (this) {
mInAppSkus = null;
mSubscriptionSkus = null;
}
mIsPremium = false;
mBillingClient.querySkuDetailsAsync(
SkuDetailsParams.newBuilder().setSkusList(INAPP_PRODUCT_IDS).setType(SkuType.INAPP).build(),
(result, list) -> GoogleBillingHelper.this.onSkuDetailsResponse(result, list, false, listener));
mBillingClient.querySkuDetailsAsync(
SkuDetailsParams.newBuilder().setSkusList(SUBSCRIPTION_IDS).setType(SkuType.SUBS).build(),
(result, list) -> GoogleBillingHelper.this.onSkuDetailsResponse(result, list, true, listener));
} | void function(final OnInventoryFinishedListener listener) { synchronized (this) { mInAppSkus = null; mSubscriptionSkus = null; } mIsPremium = false; mBillingClient.querySkuDetailsAsync( SkuDetailsParams.newBuilder().setSkusList(INAPP_PRODUCT_IDS).setType(SkuType.INAPP).build(), (result, list) -> GoogleBillingHelper.this.onSkuDetailsResponse(result, list, false, listener)); mBillingClient.querySkuDetailsAsync( SkuDetailsParams.newBuilder().setSkusList(SUBSCRIPTION_IDS).setType(SkuType.SUBS).build(), (result, list) -> GoogleBillingHelper.this.onSkuDetailsResponse(result, list, true, listener)); } | /**
* Query SKU details.
*
* @param listener The listener called when the query is finished.
*/ | Query SKU details | doQuerySkuDetails | {
"repo_name": "jeisfeld/Augendiagnose",
"path": "AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/GoogleBillingHelper.java",
"license": "gpl-2.0",
"size": 16053
} | [
"com.android.billingclient.api.BillingClient",
"com.android.billingclient.api.SkuDetailsParams"
]
| import com.android.billingclient.api.BillingClient; import com.android.billingclient.api.SkuDetailsParams; | import com.android.billingclient.api.*; | [
"com.android.billingclient"
]
| com.android.billingclient; | 623,815 |
RecordId newRecordId(Map<String, String> variantProperties); | RecordId newRecordId(Map<String, String> variantProperties); | /**
* Creates a new record id containing a new generated master record id and the given variant
* properties.
*
* <p>This is a shortcut for IdGenerator.newRecordId(IdGenerator.newRecordId(), variantProperties).
*/ | Creates a new record id containing a new generated master record id and the given variant properties. This is a shortcut for IdGenerator.newRecordId(IdGenerator.newRecordId(), variantProperties) | newRecordId | {
"repo_name": "NGDATA/lilyproject",
"path": "cr/repository/api/src/main/java/org/lilyproject/repository/api/IdGenerator.java",
"license": "apache-2.0",
"size": 4751
} | [
"java.util.Map"
]
| import java.util.Map; | import java.util.*; | [
"java.util"
]
| java.util; | 203,060 |
logger.debug("Updating type :"+ esExtGbBfsfType);
BulkResponse bulkResponse = searchDao.bulkUpdateRecords(bfsfList, esIndexName, esExtGbBfsfType);
if (bulkResponse.hasFailures()) {
for (BulkItemResponse bulkItem : bulkResponse) {
if (bulkItem.isFailed()) {
// process failures by iterating through each bulk response item
logger.error("bulkUpdateRecords index: " + esIndexName + " and type: " +
esExtGbBfsfType + " item: "+ bulkItem.getId() +" message: " +bulkItem.getFailureMessage());
}
}
throw new Exception("External GB Update failed");
}
} | logger.debug(STR+ esExtGbBfsfType); BulkResponse bulkResponse = searchDao.bulkUpdateRecords(bfsfList, esIndexName, esExtGbBfsfType); if (bulkResponse.hasFailures()) { for (BulkItemResponse bulkItem : bulkResponse) { if (bulkItem.isFailed()) { logger.error(STR + esIndexName + STR + esExtGbBfsfType + STR+ bulkItem.getId() +STR +bulkItem.getFailureMessage()); } } throw new Exception(STR); } } | /** Bulk updates a list of bulkUpdateExtGB data
* @param the list of bfsf records
*
* @return
* @throws Exception
*/ | Bulk updates a list of bulkUpdateExtGB data | bulkUpdateExtGB | {
"repo_name": "TransformCore/BIS-BDT-Admin",
"path": "src/main/java/com/transformuk/bdt/service/ExternalGBService.java",
"license": "mit",
"size": 1815
} | [
"org.elasticsearch.action.bulk.BulkItemResponse",
"org.elasticsearch.action.bulk.BulkResponse"
]
| import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkResponse; | import org.elasticsearch.action.bulk.*; | [
"org.elasticsearch.action"
]
| org.elasticsearch.action; | 2,495,896 |
public Collection<LinkTemplate> getLinkTemplates(); | Collection<LinkTemplate> function(); | /**
* Get the Api's {@link Collection} of {@link LinkTemplate}s, which, when
* laid on top of the Api's {@link ResourceTemplate} tree, form a hypermedia
* graph of interrelated ResourceTemplates.
*
* @return the list of LinkTemplates that describe all of the
* relationships between the Api's ResourceTemplates.
*/ | Get the Api's <code>Collection</code> of <code>LinkTemplate</code>s, which, when laid on top of the Api's <code>ResourceTemplate</code> tree, form a hypermedia graph of interrelated ResourceTemplates | getLinkTemplates | {
"repo_name": "ZikFat/wrml-prototype",
"path": "src/main/java/org/wrml/core/model/api/Api.java",
"license": "apache-2.0",
"size": 2165
} | [
"org.wrml.core.model.Collection"
]
| import org.wrml.core.model.Collection; | import org.wrml.core.model.*; | [
"org.wrml.core"
]
| org.wrml.core; | 2,326,219 |
public ModemActivityInfo getModemActivityInfo() {
try {
ITelephony service = getITelephony();
if (service != null) {
return service.getModemActivityInfo();
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#getModemActivityInfo", e);
}
return null;
} | ModemActivityInfo function() { try { ITelephony service = getITelephony(); if (service != null) { return service.getModemActivityInfo(); } } catch (RemoteException e) { Log.e(TAG, STR, e); } return null; } | /**
* Returns the modem activity info.
* @hide
*/ | Returns the modem activity info | getModemActivityInfo | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/telephony/TelephonyManager.java",
"license": "gpl-3.0",
"size": 165169
} | [
"android.os.RemoteException",
"android.util.Log",
"com.android.internal.telephony.ITelephony"
]
| import android.os.RemoteException; import android.util.Log; import com.android.internal.telephony.ITelephony; | import android.os.*; import android.util.*; import com.android.internal.telephony.*; | [
"android.os",
"android.util",
"com.android.internal"
]
| android.os; android.util; com.android.internal; | 228,178 |
public void deleteFile(S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto); | void function(S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto); | /**
* Deletes a object from specified bucket.
*
* @param s3FileTransferRequestParamsDto the S3 file transfer request parameters. The S3 bucket name and the file name identify the S3 object to be
* deleted.
*/ | Deletes a object from specified bucket | deleteFile | {
"repo_name": "seoj/herd",
"path": "herd-code/herd-dao/src/main/java/org/finra/herd/dao/S3Dao.java",
"license": "apache-2.0",
"size": 10523
} | [
"org.finra.herd.model.dto.S3FileTransferRequestParamsDto"
]
| import org.finra.herd.model.dto.S3FileTransferRequestParamsDto; | import org.finra.herd.model.dto.*; | [
"org.finra.herd"
]
| org.finra.herd; | 857,037 |
@Override
public Deferred<Boolean> call(final Tree fetched_tree) throws Exception {
Tree stored_tree = fetched_tree;
final byte[] original_tree = stored_tree == null ? new byte[0] :
stored_tree.toStorageJson();
// now copy changes
if (stored_tree == null) {
stored_tree = local_tree;
} else {
stored_tree.copyChanges(local_tree, overwrite);
}
// reset the change map so we don't keep writing
initializeChangedMap();
final PutRequest put = new PutRequest(tsdb.treeTable(),
Tree.idToBytes(tree_id), TREE_FAMILY, TREE_QUALIFIER,
stored_tree.toStorageJson());
return tsdb.getClient().compareAndSet(put, original_tree);
}
}
// initiate the sync by attempting to fetch an existing tree from storage
return fetchTree(tsdb, tree_id).addCallbackDeferring(new StoreTreeCB(this));
} | Deferred<Boolean> function(final Tree fetched_tree) throws Exception { Tree stored_tree = fetched_tree; final byte[] original_tree = stored_tree == null ? new byte[0] : stored_tree.toStorageJson(); if (stored_tree == null) { stored_tree = local_tree; } else { stored_tree.copyChanges(local_tree, overwrite); } initializeChangedMap(); final PutRequest put = new PutRequest(tsdb.treeTable(), Tree.idToBytes(tree_id), TREE_FAMILY, TREE_QUALIFIER, stored_tree.toStorageJson()); return tsdb.getClient().compareAndSet(put, original_tree); } } return fetchTree(tsdb, tree_id).addCallbackDeferring(new StoreTreeCB(this)); } | /**
* Synchronizes the stored tree object (if found) with the local tree
* and issues a CAS call to write the update to storage.
* @return True if the CAS was successful, false if something changed
* in flight
*/ | Synchronizes the stored tree object (if found) with the local tree and issues a CAS call to write the update to storage | call | {
"repo_name": "OpenTSDB/opentsdb",
"path": "src/tree/Tree.java",
"license": "lgpl-2.1",
"size": 48179
} | [
"com.stumbleupon.async.Deferred",
"org.hbase.async.PutRequest"
]
| import com.stumbleupon.async.Deferred; import org.hbase.async.PutRequest; | import com.stumbleupon.async.*; import org.hbase.async.*; | [
"com.stumbleupon.async",
"org.hbase.async"
]
| com.stumbleupon.async; org.hbase.async; | 513,255 |
@Override
public void doSaveAs() {
SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
saveAsDialog.open();
IPath path = saveAsDialog.getResult();
if (path != null) {
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
if (file != null) {
doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
}
}
} | void function() { SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); saveAsDialog.open(); IPath path = saveAsDialog.getResult(); if (path != null) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (file != null) { doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); } } } | /**
* This also changes the editor's input.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This also changes the editor's input. | doSaveAs | {
"repo_name": "jhon0010/sirius-blog",
"path": "validation/fr.obeo.dsl.felix.metamodel.editor/src/felix/presentation/FelixEditor.java",
"license": "epl-1.0",
"size": 53885
} | [
"org.eclipse.core.resources.IFile",
"org.eclipse.core.resources.ResourcesPlugin",
"org.eclipse.core.runtime.IPath",
"org.eclipse.emf.common.util.URI",
"org.eclipse.ui.dialogs.SaveAsDialog",
"org.eclipse.ui.part.FileEditorInput"
]
| import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.emf.common.util.URI; import org.eclipse.ui.dialogs.SaveAsDialog; import org.eclipse.ui.part.FileEditorInput; | import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.emf.common.util.*; import org.eclipse.ui.dialogs.*; import org.eclipse.ui.part.*; | [
"org.eclipse.core",
"org.eclipse.emf",
"org.eclipse.ui"
]
| org.eclipse.core; org.eclipse.emf; org.eclipse.ui; | 426,906 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Us_west_1.class)) {
case AwsregionsPackage.US_WEST_1__REGION_NAME:
case AwsregionsPackage.US_WEST_1__COUNTRY:
case AwsregionsPackage.US_WEST_1__REGION_ID:
case AwsregionsPackage.US_WEST_1__CITY:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Us_west_1.class)) { case AwsregionsPackage.US_WEST_1__REGION_NAME: case AwsregionsPackage.US_WEST_1__COUNTRY: case AwsregionsPackage.US_WEST_1__REGION_ID: case AwsregionsPackage.US_WEST_1__CITY: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "occiware/Multi-Cloud-Studio",
"path": "plugins/org.eclipse.cmf.occi.multicloud.regions.aws.edit/src-gen/awsregions/provider/Us_west_1ItemProvider.java",
"license": "epl-1.0",
"size": 6877
} | [
"org.eclipse.emf.common.notify.Notification",
"org.eclipse.emf.edit.provider.ViewerNotification"
]
| import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; | import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
]
| org.eclipse.emf; | 43,784 |
SimpleVersion v1 = new SimpleVersion.Builder(rev(1))
.changeset(mapOf("key", "value1"))
.meta("v1 meta")
.build();
SimpleVersion v2 = new SimpleVersion.Builder(rev(2))
.parents(v1.revision)
.changeset(mapOf("key", "value2"))
.meta("v2 meta")
.build();
SimpleVersion v3 = new SimpleVersion.Builder(rev(3))
.parents(v2.revision)
.changeset(mapOf("key2", "value1"))
.meta("v3 meta")
.build();
SimpleVersionGraph versionGraph = SimpleVersionGraph.init(v1, v2, v3);
assertRevisions(versionGraph, setOf(v3.revision), asList(v3.revision), asList(v2.revision, v1.revision));
SimpleVersionGraph graph = versionGraph.optimize(v3.revision).getGraph();
assertNotFound(graph, v2.revision);
assertNotFound(graph, v1.revision);
VersionNode<String, String, String> node = graph.getVersionNode(v3.revision);
assertThat(node.getChangeset()).isEqualTo(mapOf("key", "value2", "key2", "value1"));
assertThat(node.getParentRevisions()).isEmpty();
assertThat(node.getMeta()).isEqualTo("v3 meta");
} | SimpleVersion v1 = new SimpleVersion.Builder(rev(1)) .changeset(mapOf("key", STR)) .meta(STR) .build(); SimpleVersion v2 = new SimpleVersion.Builder(rev(2)) .parents(v1.revision) .changeset(mapOf("key", STR)) .meta(STR) .build(); SimpleVersion v3 = new SimpleVersion.Builder(rev(3)) .parents(v2.revision) .changeset(mapOf("key2", STR)) .meta(STR) .build(); SimpleVersionGraph versionGraph = SimpleVersionGraph.init(v1, v2, v3); assertRevisions(versionGraph, setOf(v3.revision), asList(v3.revision), asList(v2.revision, v1.revision)); SimpleVersionGraph graph = versionGraph.optimize(v3.revision).getGraph(); assertNotFound(graph, v2.revision); assertNotFound(graph, v1.revision); VersionNode<String, String, String> node = graph.getVersionNode(v3.revision); assertThat(node.getChangeset()).isEqualTo(mapOf("key", STR, "key2", STR)); assertThat(node.getParentRevisions()).isEmpty(); assertThat(node.getMeta()).isEqualTo(STR); } | /**
* 1
* 2
* 3
*/ | 1 2 3 | squash_linear_history | {
"repo_name": "ssaarela/javersion",
"path": "javersion-core/src/test/java/org/javersion/core/OptimizedGraphTest.java",
"license": "apache-2.0",
"size": 15718
} | [
"java.util.Arrays",
"org.assertj.core.api.Assertions",
"org.javersion.core.SimpleVersionGraphTest"
]
| import java.util.Arrays; import org.assertj.core.api.Assertions; import org.javersion.core.SimpleVersionGraphTest; | import java.util.*; import org.assertj.core.api.*; import org.javersion.core.*; | [
"java.util",
"org.assertj.core",
"org.javersion.core"
]
| java.util; org.assertj.core; org.javersion.core; | 2,072,077 |
private String getComboOutput(final int k) {
final List<String> result = new ArrayList<String>();
final StringBuilder out = new StringBuilder();
try {
final List<Set<Integer>> output = getCombos(k);
final Iterator<Set<Integer>> setItr = output.iterator();
while (setItr.hasNext()) {
final StringBuilder builder = new StringBuilder();
final Iterator<Integer> numItr = setItr.next().iterator();
while (numItr.hasNext()) {
builder.append(numItr.next());
builder.append(SPACE);
}
result.add(builder.toString());
}
if (myBonusBallFlag) {
if (myBonusBallArray.length == 1) {
addBonusBallToList(result, myBonusBallArray[0]);
} else {
final List<String> originalList = new ArrayList<String>(
result);
addBonusBallToList(result, myBonusBallArray[0]);
for (int i = 1; i < myBonusBallArray.length; i++) {
final List<String> listWithThisBall = new ArrayList<String>(
originalList);
addBonusBallToList(listWithThisBall,
myBonusBallArray[i]);
result.addAll(listWithThisBall);
}
}
}
for (String line : result) {
out.append(line);
out.append(MS_NEWLINE);
}
} catch (final IllegalArgumentException e) {
out.append(toString());
}
return out.toString();
} | String function(final int k) { final List<String> result = new ArrayList<String>(); final StringBuilder out = new StringBuilder(); try { final List<Set<Integer>> output = getCombos(k); final Iterator<Set<Integer>> setItr = output.iterator(); while (setItr.hasNext()) { final StringBuilder builder = new StringBuilder(); final Iterator<Integer> numItr = setItr.next().iterator(); while (numItr.hasNext()) { builder.append(numItr.next()); builder.append(SPACE); } result.add(builder.toString()); } if (myBonusBallFlag) { if (myBonusBallArray.length == 1) { addBonusBallToList(result, myBonusBallArray[0]); } else { final List<String> originalList = new ArrayList<String>( result); addBonusBallToList(result, myBonusBallArray[0]); for (int i = 1; i < myBonusBallArray.length; i++) { final List<String> listWithThisBall = new ArrayList<String>( originalList); addBonusBallToList(listWithThisBall, myBonusBallArray[i]); result.addAll(listWithThisBall); } } } for (String line : result) { out.append(line); out.append(MS_NEWLINE); } } catch (final IllegalArgumentException e) { out.append(toString()); } return out.toString(); } | /**
* Outputs a String of all combinations. Any bonus balls are also taken into
* account and are looped onto the end.
*
* @param k
* the number of numbers in the game
* @return a String of all combinations
*/ | Outputs a String of all combinations. Any bonus balls are also taken into account and are looped onto the end | getComboOutput | {
"repo_name": "tt47cf6/JLotteryAnalyzer",
"path": "controller/Combinations.java",
"license": "gpl-2.0",
"size": 7743
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"java.util.Set"
]
| import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; | import java.util.*; | [
"java.util"
]
| java.util; | 2,392,303 |
@Nonnull
EChange internalAddChild (@Nonnull ITEMTYPE aChild); | EChange internalAddChild (@Nonnull ITEMTYPE aChild); | /**
* Add an existing child to this tree item. Use only internally!
*
* @param aChild
* The child to be added. May not be <code>null</code>.
* @return {@link EChange#UNCHANGED} if the child is already contained,
* {@link EChange#CHANGED} upon success.
*/ | Add an existing child to this tree item. Use only internally | internalAddChild | {
"repo_name": "lsimons/phloc-schematron-standalone",
"path": "phloc-commons/src/main/java/com/phloc/commons/tree/simple/ITreeItem.java",
"license": "apache-2.0",
"size": 2610
} | [
"com.phloc.commons.state.EChange",
"javax.annotation.Nonnull"
]
| import com.phloc.commons.state.EChange; import javax.annotation.Nonnull; | import com.phloc.commons.state.*; import javax.annotation.*; | [
"com.phloc.commons",
"javax.annotation"
]
| com.phloc.commons; javax.annotation; | 1,021,442 |
public MessageType parsePartialFrom(InputStream input,
ExtensionRegistryLite extensionRegistry)
throws InvalidProtocolBufferException; | MessageType function(InputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException; | /**
* Like {@link #parseFrom(InputStream, ExtensionRegistryLite)},
* but does not throw an exception if the message is missing required fields.
* Instead, a partial message is returned.
*/ | Like <code>#parseFrom(InputStream, ExtensionRegistryLite)</code>, but does not throw an exception if the message is missing required fields. Instead, a partial message is returned | parsePartialFrom | {
"repo_name": "legrosbuffle/kythe",
"path": "third_party/proto/java/core/src/main/java/com/google/protobuf/Parser.java",
"license": "apache-2.0",
"size": 11416
} | [
"java.io.InputStream"
]
| import java.io.InputStream; | import java.io.*; | [
"java.io"
]
| java.io; | 2,420,469 |
public static void calculateNewSelection( Rectangle bounds, List selection,
List children )
{
for ( int i = 0; i < children.size( ); i++ )
{
EditPart child = (EditPart) children.get( i );
if ( !child.isSelectable( ) || isInTable( child ) )
continue;
IFigure figure = ( (GraphicalEditPart) child ).getFigure( );
Rectangle r = figure.getBounds( ).getCopy( );
figure.translateToAbsolute( r );
Rectangle rect = bounds.getCopy( ).intersect( r );
if ( rect.width > 0
&& rect.height > 0
&& figure.isShowing( )
&& child.getTargetEditPart( CellDragTracker.MARQUEE_REQUEST ) == child
&& isFigureVisible( figure ) )
{
if ( !selection.contains( child ) )
{
selection.add( child );
}
}
}
} | static void function( Rectangle bounds, List selection, List children ) { for ( int i = 0; i < children.size( ); i++ ) { EditPart child = (EditPart) children.get( i ); if ( !child.isSelectable( ) isInTable( child ) ) continue; IFigure figure = ( (GraphicalEditPart) child ).getFigure( ); Rectangle r = figure.getBounds( ).getCopy( ); figure.translateToAbsolute( r ); Rectangle rect = bounds.getCopy( ).intersect( r ); if ( rect.width > 0 && rect.height > 0 && figure.isShowing( ) && child.getTargetEditPart( CellDragTracker.MARQUEE_REQUEST ) == child && isFigureVisible( figure ) ) { if ( !selection.contains( child ) ) { selection.add( child ); } } } } | /**
* Calculate the real selected objects in the selected bounds, complement
* the list if not in it.
*
* @param bounds
* @param selection
* @param children
*/ | Calculate the real selected objects in the selected bounds, complement the list if not in it | calculateNewSelection | {
"repo_name": "sguan-actuate/birt",
"path": "UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/TableUtil.java",
"license": "epl-1.0",
"size": 11499
} | [
"java.util.List",
"org.eclipse.birt.report.designer.internal.ui.editors.schematic.tools.CellDragTracker",
"org.eclipse.draw2d.IFigure",
"org.eclipse.draw2d.geometry.Rectangle",
"org.eclipse.gef.EditPart",
"org.eclipse.gef.GraphicalEditPart"
]
| import java.util.List; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.tools.CellDragTracker; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gef.EditPart; import org.eclipse.gef.GraphicalEditPart; | import java.util.*; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.tools.*; import org.eclipse.draw2d.*; import org.eclipse.draw2d.geometry.*; import org.eclipse.gef.*; | [
"java.util",
"org.eclipse.birt",
"org.eclipse.draw2d",
"org.eclipse.gef"
]
| java.util; org.eclipse.birt; org.eclipse.draw2d; org.eclipse.gef; | 287,303 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(ComponentDescription.class)) {
case DependencycheckerPackage.COMPONENT_DESCRIPTION__NAME:
case DependencycheckerPackage.COMPONENT_DESCRIPTION__FORBIDDEN_COMPONENTS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case DependencycheckerPackage.COMPONENT_DESCRIPTION__COMPONENT_ITEMS:
case DependencycheckerPackage.COMPONENT_DESCRIPTION__PORTS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(ComponentDescription.class)) { case DependencycheckerPackage.COMPONENT_DESCRIPTION__NAME: case DependencycheckerPackage.COMPONENT_DESCRIPTION__FORBIDDEN_COMPONENTS: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case DependencycheckerPackage.COMPONENT_DESCRIPTION__COMPONENT_ITEMS: case DependencycheckerPackage.COMPONENT_DESCRIPTION__PORTS: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "rage5474/dependencychecker",
"path": "src/de.raphaelgeissler.dependencychecker.model.edit/src/de/raphaelgeissler/dependencychecker/provider/ComponentDescriptionItemProvider.java",
"license": "epl-1.0",
"size": 9221
} | [
"de.raphaelgeissler.dependencychecker.ComponentDescription",
"de.raphaelgeissler.dependencychecker.DependencycheckerPackage",
"org.eclipse.emf.common.notify.Notification",
"org.eclipse.emf.edit.provider.ViewerNotification"
]
| import de.raphaelgeissler.dependencychecker.ComponentDescription; import de.raphaelgeissler.dependencychecker.DependencycheckerPackage; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; | import de.raphaelgeissler.dependencychecker.*; import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; | [
"de.raphaelgeissler.dependencychecker",
"org.eclipse.emf"
]
| de.raphaelgeissler.dependencychecker; org.eclipse.emf; | 2,092,371 |
public Color getColor(ClangToken token); | Color function(ClangToken token); | /**
* Returns a color for the given token
*
* @param token the token
* @return the color
*/ | Returns a color for the given token | getColor | {
"repo_name": "NationalSecurityAgency/ghidra",
"path": "Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/ColorProvider.java",
"license": "apache-2.0",
"size": 1196
} | [
"java.awt.Color"
]
| import java.awt.Color; | import java.awt.*; | [
"java.awt"
]
| java.awt; | 133,657 |
private void interactiveEvaluation(String userResponse, String correctResponse) {
if (userResponse.equals(correctResponse)) {
playSound(ExamController.CORRECT_WAV);
} else {
playSound(ExamController.INCORRECT_WAV);
}
for (Button radioButton : inputView.getRadioButtons()) {
if ((userResponse.equals(radioButton.getText())) && (!userResponse.equals(correctResponse))) {
radioButton.setForeground(inputView.getPrimaryShell().getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
} else if ((radioButton.getText().equals(correctResponse))) {
radioButton
.setForeground(inputView.getPrimaryShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN));
}
}
} | void function(String userResponse, String correctResponse) { if (userResponse.equals(correctResponse)) { playSound(ExamController.CORRECT_WAV); } else { playSound(ExamController.INCORRECT_WAV); } for (Button radioButton : inputView.getRadioButtons()) { if ((userResponse.equals(radioButton.getText())) && (!userResponse.equals(correctResponse))) { radioButton.setForeground(inputView.getPrimaryShell().getDisplay().getSystemColor(SWT.COLOR_DARK_RED)); } else if ((radioButton.getText().equals(correctResponse))) { radioButton .setForeground(inputView.getPrimaryShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN)); } } } | /**********************************************************************************************
* Name : interactiveEvaluation
* Purpose : highlight the user response green if they responded with the correct answer to
* the current question and otherwise highlight their response red and the correct answer green
* Parameters :
* @param: none
* Return :
* @return: none
*********************************************************************************************/ | Name : interactiveEvaluation Purpose : highlight the user response green if they responded with the correct answer to the current question and otherwise highlight their response red and the correct answer green Parameters : | interactiveEvaluation | {
"repo_name": "ivan-guerra/university_projects",
"path": "human_computer_interaction/exam_viewer/ExamController.java",
"license": "mit",
"size": 16919
} | [
"org.eclipse.swt.widgets.Button"
]
| import org.eclipse.swt.widgets.Button; | import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
]
| org.eclipse.swt; | 1,352,816 |
private int skipIntegrityPAD(byte[] rawMessage, int offset)
throws IndexOutOfBoundsException {
int skip = 0;
while (TypeConverter.byteToInt(rawMessage[offset + skip]) == 0xff) {
++skip;
}
int length = TypeConverter.byteToInt(rawMessage[offset + skip]);
if (length != skip) {
throw new IndexOutOfBoundsException("Message is corrupted.");
}
offset += skip + 2; // skip pad length and next header fields
if (offset >= rawMessage.length) {
throw new IndexOutOfBoundsException("Message is corrupted.");
}
return offset;
}
| int function(byte[] rawMessage, int offset) throws IndexOutOfBoundsException { int skip = 0; while (TypeConverter.byteToInt(rawMessage[offset + skip]) == 0xff) { ++skip; } int length = TypeConverter.byteToInt(rawMessage[offset + skip]); if (length != skip) { throw new IndexOutOfBoundsException(STR); } offset += skip + 2; if (offset >= rawMessage.length) { throw new IndexOutOfBoundsException(STR); } return offset; } | /**
* Skips the integrity pad and pad length fields.
*
* @param rawMessage
* - Byte array holding whole message data.
* @param offset
* - Offset to integrity pad.
* @return Offset to Auth Code
* @throws IndexOutOfBoundsException
* when message is corrupted and pad length does not appear
* after integrity pad or length is incorrect.
*/ | Skips the integrity pad and pad length fields | skipIntegrityPAD | {
"repo_name": "zhoujinl/jIPMI",
"path": "src/main/java/com/veraxsystems/vxipmi/coding/protocol/decoder/Protocolv20Decoder.java",
"license": "gpl-3.0",
"size": 8531
} | [
"com.veraxsystems.vxipmi.common.TypeConverter"
]
| import com.veraxsystems.vxipmi.common.TypeConverter; | import com.veraxsystems.vxipmi.common.*; | [
"com.veraxsystems.vxipmi"
]
| com.veraxsystems.vxipmi; | 1,023,748 |
public List<Client> getClients() {
return clients;
} | List<Client> function() { return clients; } | /**
* Get this application's clients.
*
* @return A list of clients.
*/ | Get this application's clients | getClients | {
"repo_name": "kangaroo-server/kangaroo",
"path": "kangaroo-server-authz/src/main/java/net/krotscheck/kangaroo/authz/common/database/entity/Application.java",
"license": "apache-2.0",
"size": 9184
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 990,243 |
public void menuAboutToShow( IMenuManager menu )
{
buildContextMenu( menu );
} | void function( IMenuManager menu ) { buildContextMenu( menu ); } | /**
* Called when the menu is about to show.
* @see IMenuListener#menuAboutToShow(IMenuManager)
*/ | Called when the menu is about to show | menuAboutToShow | {
"repo_name": "Charling-Huang/birt",
"path": "UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/ContextMenuProvider.java",
"license": "epl-1.0",
"size": 2306
} | [
"org.eclipse.jface.action.IMenuManager"
]
| import org.eclipse.jface.action.IMenuManager; | import org.eclipse.jface.action.*; | [
"org.eclipse.jface"
]
| org.eclipse.jface; | 2,486,378 |
public StudyTypeDAO getStudyTypeDAO() {
return studyTypeDAO;
} | StudyTypeDAO function() { return studyTypeDAO; } | /**
* <p>
* Getter for the field <code>studyTypeDAO</code>.
* </p>
*
* @return a {@link net.sourceforge.seqware.common.dao.StudyTypeDAO} object.
*/ | Getter for the field <code>studyTypeDAO</code>. | getStudyTypeDAO | {
"repo_name": "SeqWare/seqware",
"path": "seqware-common/src/main/java/net/sourceforge/seqware/common/business/impl/StudyServiceImpl.java",
"license": "gpl-3.0",
"size": 10715
} | [
"net.sourceforge.seqware.common.dao.StudyTypeDAO"
]
| import net.sourceforge.seqware.common.dao.StudyTypeDAO; | import net.sourceforge.seqware.common.dao.*; | [
"net.sourceforge.seqware"
]
| net.sourceforge.seqware; | 756,466 |
public void setParticleTexture(TextureAtlasSprite texture)
{
int i = this.getFXLayer();
if (i == 1)
{
this.particleTexture = texture;
}
else
{
throw new RuntimeException("Invalid call to Particle.setTex, use coordinate methods");
}
} | void function(TextureAtlasSprite texture) { int i = this.getFXLayer(); if (i == 1) { this.particleTexture = texture; } else { throw new RuntimeException(STR); } } | /**
* Sets the texture used by the particle.
*/ | Sets the texture used by the particle | setParticleTexture | {
"repo_name": "TheGreatAndPowerfulWeegee/wipunknown",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/particle/Particle.java",
"license": "gpl-3.0",
"size": 14640
} | [
"net.minecraft.client.renderer.texture.TextureAtlasSprite"
]
| import net.minecraft.client.renderer.texture.TextureAtlasSprite; | import net.minecraft.client.renderer.texture.*; | [
"net.minecraft.client"
]
| net.minecraft.client; | 1,822,477 |
public Encryption encryption() {
return this.encryption;
} | Encryption function() { return this.encryption; } | /**
* Get the encryption property: Not applicable. Azure Storage encryption at rest is enabled by default for all
* storage accounts and cannot be disabled.
*
* @return the encryption value.
*/ | Get the encryption property: Not applicable. Azure Storage encryption at rest is enabled by default for all storage accounts and cannot be disabled | encryption | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-storage/src/main/java/com/azure/resourcemanager/storage/fluent/models/StorageAccountPropertiesUpdateParameters.java",
"license": "mit",
"size": 24183
} | [
"com.azure.resourcemanager.storage.models.Encryption"
]
| import com.azure.resourcemanager.storage.models.Encryption; | import com.azure.resourcemanager.storage.models.*; | [
"com.azure.resourcemanager"
]
| com.azure.resourcemanager; | 2,780,166 |
private byte[] buildRequest()
{
if (uploadedFiles == null && useMultiPartContentType == false)
{
if (post.getParameterNames().size() == 0)
{
return "".getBytes();
}
Url url = new Url();
for (final String parameterName : post.getParameterNames())
{
List<StringValue> values = post.getParameterValues(parameterName);
for (StringValue value : values)
{
url.addQueryParameter(parameterName, value.toString());
}
}
String body = url.toString().substring(1);
return body.getBytes();
}
try
{
// Build up the input stream based on the files and parameters
ByteArrayOutputStream out = new ByteArrayOutputStream();
// Add parameters
for (final String parameterName : post.getParameterNames())
{
List<StringValue> values = post.getParameterValues(parameterName);
for (StringValue value : values)
{
newAttachment(out);
out.write("; name=\"".getBytes());
out.write(parameterName.getBytes());
out.write("\"".getBytes());
out.write(crlf.getBytes());
out.write(crlf.getBytes());
out.write(value.toString().getBytes());
out.write(crlf.getBytes());
}
}
// Add files
if (uploadedFiles != null)
{
for (String fieldName : uploadedFiles.keySet())
{
List<UploadedFile> files = uploadedFiles.get(fieldName);
for (UploadedFile uf : files)
{
newAttachment(out);
out.write("; name=\"".getBytes());
out.write(fieldName.getBytes());
out.write("\"; filename=\"".getBytes());
out.write(uf.getFile().getName().getBytes());
out.write("\"".getBytes());
out.write(crlf.getBytes());
out.write("Content-Type: ".getBytes());
out.write(uf.getContentType().getBytes());
out.write(crlf.getBytes());
out.write(crlf.getBytes());
// Load the file and put it into the the inputstream
FileInputStream fis = new FileInputStream(uf.getFile());
try
{
IOUtils.copy(fis, out);
}
finally
{
fis.close();
}
out.write(crlf.getBytes());
}
}
}
out.write(boundary.getBytes());
out.write("--".getBytes());
out.write(crlf.getBytes());
return out.toByteArray();
}
catch (IOException e)
{
// NOTE: IllegalStateException(Throwable) only exists since Java 1.5
throw new WicketRuntimeException(e);
}
}
| byte[] function() { if (uploadedFiles == null && useMultiPartContentType == false) { if (post.getParameterNames().size() == 0) { return STR; name=\STR\STR; name=\STR\STRSTR\STRContent-Type: STR--".getBytes()); out.write(crlf.getBytes()); return out.toByteArray(); } catch (IOException e) { throw new WicketRuntimeException(e); } } | /**
* Build the request based on the uploaded files and the parameters.
*
* @return The request as a string.
*/ | Build the request based on the uploaded files and the parameters | buildRequest | {
"repo_name": "mafulafunk/wicket",
"path": "wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java",
"license": "apache-2.0",
"size": 41258
} | [
"java.io.IOException",
"org.apache.wicket.WicketRuntimeException"
]
| import java.io.IOException; import org.apache.wicket.WicketRuntimeException; | import java.io.*; import org.apache.wicket.*; | [
"java.io",
"org.apache.wicket"
]
| java.io; org.apache.wicket; | 2,012,665 |
private void setupListeners(View view) {
mSave.setOnClickListener(new OnSyncedFolderSaveClickListener());
mCancel.setOnClickListener(new OnSyncedFolderCancelClickListener());
view.findViewById(R.id.delete).setOnClickListener(new OnSyncedFolderDeleteClickListener()); | void function(View view) { mSave.setOnClickListener(new OnSyncedFolderSaveClickListener()); mCancel.setOnClickListener(new OnSyncedFolderCancelClickListener()); view.findViewById(R.id.delete).setOnClickListener(new OnSyncedFolderDeleteClickListener()); | /**
* setup all listeners.
*
* @param view the parent view
*/ | setup all listeners | setupListeners | {
"repo_name": "jsargent7089/android",
"path": "src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java",
"license": "gpl-2.0",
"size": 26088
} | [
"android.view.View"
]
| import android.view.View; | import android.view.*; | [
"android.view"
]
| android.view; | 2,833,798 |
public static DMatrixRMaj multTransB( DMatrixSparseCSC A, DMatrixRMaj B, @Nullable DMatrixRMaj outputC,
@Nullable GrowArray<DGrowArray> workArrays ) {
if (A.numCols != B.numCols)
throw new MatrixDimensionException("Inconsistent matrix shapes. " + stringShapes(A, B));
outputC = reshapeOrDeclare(outputC, A.numRows, B.numRows);
if (workArrays == null)
workArrays = new GrowArray<>(DGrowArray::new);
ImplMultiplication_MT_DSCC.multTransB(A, B, outputC, workArrays);
return outputC;
} | static DMatrixRMaj function( DMatrixSparseCSC A, DMatrixRMaj B, @Nullable DMatrixRMaj outputC, @Nullable GrowArray<DGrowArray> workArrays ) { if (A.numCols != B.numCols) throw new MatrixDimensionException(STR + stringShapes(A, B)); outputC = reshapeOrDeclare(outputC, A.numRows, B.numRows); if (workArrays == null) workArrays = new GrowArray<>(DGrowArray::new); ImplMultiplication_MT_DSCC.multTransB(A, B, outputC, workArrays); return outputC; } | /**
* Performs matrix multiplication. C = A*B<sup>T</sup>
*
* @param A Matrix
* @param B Dense Matrix
* @param outputC Dense Matrix
*/ | Performs matrix multiplication. C = A*BT | multTransB | {
"repo_name": "lessthanoptimal/ejml",
"path": "main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_MT_DSCC.java",
"license": "apache-2.0",
"size": 9238
} | [
"org.ejml.MatrixDimensionException",
"org.ejml.UtilEjml",
"org.ejml.data.DGrowArray",
"org.ejml.data.DMatrixRMaj",
"org.ejml.data.DMatrixSparseCSC",
"org.jetbrains.annotations.Nullable"
]
| import org.ejml.MatrixDimensionException; import org.ejml.UtilEjml; import org.ejml.data.DGrowArray; import org.ejml.data.DMatrixRMaj; import org.ejml.data.DMatrixSparseCSC; import org.jetbrains.annotations.Nullable; | import org.ejml.*; import org.ejml.data.*; import org.jetbrains.annotations.*; | [
"org.ejml",
"org.ejml.data",
"org.jetbrains.annotations"
]
| org.ejml; org.ejml.data; org.jetbrains.annotations; | 1,549,465 |
private void writeNodeList(NodeBase[] p_nodeList)
{
Logger.v(TAG, "Writing new node list file with " + p_nodeList.length + " nodes");
if(m_isRunning && p_nodeList != null)
{
Element root = new Element(C_STR_NODELIST_ROOT);
// Last update attribute
Attribute lastUpdate =
new Attribute(C_STR_NODELIST_LASTUPDATE,
(new DateTime()).toString(m_dateTimeFormatter));
root.addAttribute(lastUpdate);
// Add each node as an element
for(NodeBase node : p_nodeList)
{
root.appendChild(node.serialize());
}
Document doc = new Document(root);
System.out.println(root.toXML());
writeXmlFile(doc, C_STR_NODELIST_FILENAME);
}
} | void function(NodeBase[] p_nodeList) { Logger.v(TAG, STR + p_nodeList.length + STR); if(m_isRunning && p_nodeList != null) { Element root = new Element(C_STR_NODELIST_ROOT); Attribute lastUpdate = new Attribute(C_STR_NODELIST_LASTUPDATE, (new DateTime()).toString(m_dateTimeFormatter)); root.addAttribute(lastUpdate); for(NodeBase node : p_nodeList) { root.appendChild(node.serialize()); } Document doc = new Document(root); System.out.println(root.toXML()); writeXmlFile(doc, C_STR_NODELIST_FILENAME); } } | /**
* Write out the node list
*
* <?xml version="1.0" encoding="ISO-8859-1"?>
* <nodes lastUpdate="">
* <node id="0013A20040303382" status=1 lastSeen="2012-02-20T16:27:09.619-07:00">
* <name>Unknown Node</name>
* <synetID>a001</synetID>
* <manufacturer>aabb</manufacturer>
* <profile>1</profile>
* <revision>e</revision>
* </node>
*</nodes>
*/ | Write out the node list Unknown Node a001 aabb 1 e | writeNodeList | {
"repo_name": "mkurdziel/BitHome-Hub-Java-V1",
"path": "Controller/src/synet/controller/messaging/MsgAdapterNet.java",
"license": "apache-2.0",
"size": 36750
} | [
"nu.xom.Attribute",
"nu.xom.Document",
"nu.xom.Element",
"org.joda.time.DateTime"
]
| import nu.xom.Attribute; import nu.xom.Document; import nu.xom.Element; import org.joda.time.DateTime; | import nu.xom.*; import org.joda.time.*; | [
"nu.xom",
"org.joda.time"
]
| nu.xom; org.joda.time; | 1,141,764 |
void updateMenuState( boolean createPermitted, boolean executePermitted ) {
Document doc = getDocumentRoot();
if ( doc != null ) {
// Main spoon menu
( (XulMenuitem) doc.getElementById( "process-run" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
XulToolbarbutton transRunButton = ( (XulToolbarbutton) doc.getElementById( "trans-run" ) ); //$NON-NLS-1$
if ( transRunButton != null ) {
transRunButton.setDisabled( !executePermitted );
}
( (XulMenuitem) doc.getElementById( "trans-preview" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "trans-debug" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "trans-replay" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "trans-verify" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "trans-impact" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "trans-get-sql" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
// Disable Show Last menu under the Action menu.
( (XulMenu) doc.getElementById( "trans-last" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
// Schedule is a plugin
if ( doc.getElementById( "trans-schedule" ) != null ) {
( (XulMenuitem) doc.getElementById( "trans-schedule" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
}
// Main spoon toolbar
( (XulToolbarbutton) doc.getElementById( "toolbar-file-new" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
( (XulToolbarbutton) doc.getElementById( "toolbar-file-save" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
( (XulToolbarbutton) doc.getElementById( "toolbar-file-save-as" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
// Popup menus
( (XulMenuitem) doc.getElementById( "trans-class-new" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "job-class-new" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
// Main spoon menu
( (XulMenu) doc.getElementById( "file-new" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "file-save" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "file-save-as" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "file-close" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
boolean exportAllowed = createPermitted && executePermitted;
( (XulMenu) doc.getElementById( "file-export" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "repository-export-all" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "file-save-as-vfs" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "edit-cut-steps" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "edit-copy-steps" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "edit.copy-file" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
( (XulMenuitem) doc.getElementById( "edit-paste-steps" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
XulMenuitem transCopyContextMenu = ( (XulMenuitem) doc.getElementById( "trans-graph-entry-copy" ) ); //$NON-NLS-1$
if ( transCopyContextMenu != null ) {
transCopyContextMenu.setDisabled( !exportAllowed );
}
}
} | void updateMenuState( boolean createPermitted, boolean executePermitted ) { Document doc = getDocumentRoot(); if ( doc != null ) { ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !executePermitted ); XulToolbarbutton transRunButton = ( (XulToolbarbutton) doc.getElementById( STR ) ); if ( transRunButton != null ) { transRunButton.setDisabled( !executePermitted ); } ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !executePermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !executePermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !executePermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !executePermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !executePermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !executePermitted ); ( (XulMenu) doc.getElementById( STR ) ).setDisabled( !executePermitted ); if ( doc.getElementById( STR ) != null ) { ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !executePermitted ); } ( (XulToolbarbutton) doc.getElementById( STR ) ).setDisabled( !createPermitted ); ( (XulToolbarbutton) doc.getElementById( STR ) ).setDisabled( !createPermitted ); ( (XulToolbarbutton) doc.getElementById( STR ) ).setDisabled( !createPermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !createPermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !createPermitted ); ( (XulMenu) doc.getElementById( STR ) ).setDisabled( !createPermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !createPermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !createPermitted ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !createPermitted ); boolean exportAllowed = createPermitted && executePermitted; ( (XulMenu) doc.getElementById( STR ) ).setDisabled( !exportAllowed ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !exportAllowed ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !exportAllowed ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !exportAllowed ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !exportAllowed ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !exportAllowed ); ( (XulMenuitem) doc.getElementById( STR ) ).setDisabled( !exportAllowed ); XulMenuitem transCopyContextMenu = ( (XulMenuitem) doc.getElementById( STR ) ); if ( transCopyContextMenu != null ) { transCopyContextMenu.setDisabled( !exportAllowed ); } } } | /**
* Change the menu-item states based on Execute and Create permissions.
* @param createPermitted
* - if true, we enable menu-items requiring creation permissions
* @param executePermitted
* - if true, we enable menu-items requiring execute permissions
*/ | Change the menu-item states based on Execute and Create permissions | updateMenuState | {
"repo_name": "AliaksandrShuhayeu/pentaho-kettle",
"path": "plugins/pur/core/src/main/java/org/pentaho/di/ui/repository/EESpoonPlugin.java",
"license": "apache-2.0",
"size": 23571
} | [
"org.pentaho.ui.xul.components.XulMenuitem",
"org.pentaho.ui.xul.components.XulToolbarbutton",
"org.pentaho.ui.xul.containers.XulMenu",
"org.pentaho.ui.xul.dom.Document"
]
| import org.pentaho.ui.xul.components.XulMenuitem; import org.pentaho.ui.xul.components.XulToolbarbutton; import org.pentaho.ui.xul.containers.XulMenu; import org.pentaho.ui.xul.dom.Document; | import org.pentaho.ui.xul.components.*; import org.pentaho.ui.xul.containers.*; import org.pentaho.ui.xul.dom.*; | [
"org.pentaho.ui"
]
| org.pentaho.ui; | 1,889,254 |
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
ConnectionControl info = (ConnectionControl) o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeBoolean(info.isClose());
dataOut.writeBoolean(info.isExit());
dataOut.writeBoolean(info.isFaultTolerant());
dataOut.writeBoolean(info.isResume());
dataOut.writeBoolean(info.isSuspend());
looseMarshalString(info.getConnectedBrokers(), dataOut);
looseMarshalString(info.getReconnectTo(), dataOut);
dataOut.writeBoolean(info.isRebalanceConnection());
looseMarshalByteArray(wireFormat, info.getToken(), dataOut);
} | void function(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionControl info = (ConnectionControl) o; super.looseMarshal(wireFormat, o, dataOut); dataOut.writeBoolean(info.isClose()); dataOut.writeBoolean(info.isExit()); dataOut.writeBoolean(info.isFaultTolerant()); dataOut.writeBoolean(info.isResume()); dataOut.writeBoolean(info.isSuspend()); looseMarshalString(info.getConnectedBrokers(), dataOut); looseMarshalString(info.getReconnectTo(), dataOut); dataOut.writeBoolean(info.isRebalanceConnection()); looseMarshalByteArray(wireFormat, info.getToken(), dataOut); } | /**
* Write the booleans that this object uses to a BooleanStream
*/ | Write the booleans that this object uses to a BooleanStream | looseMarshal | {
"repo_name": "tabish121/OpenWire",
"path": "openwire-legacy/src/main/java/io/openwire/codec/v8/ConnectionControlMarshaller.java",
"license": "apache-2.0",
"size": 5993
} | [
"io.openwire.codec.OpenWireFormat",
"io.openwire.commands.ConnectionControl",
"java.io.DataOutput",
"java.io.IOException"
]
| import io.openwire.codec.OpenWireFormat; import io.openwire.commands.ConnectionControl; import java.io.DataOutput; import java.io.IOException; | import io.openwire.codec.*; import io.openwire.commands.*; import java.io.*; | [
"io.openwire.codec",
"io.openwire.commands",
"java.io"
]
| io.openwire.codec; io.openwire.commands; java.io; | 972,469 |
private CacheDataRow checkRowExpired(CacheDataRow row) throws IgniteCheckedException {
assert row != null;
if (!(row.expireTime() > 0 && row.expireTime() <= U.currentTimeMillis()))
return row;
GridCacheContext cctx = entry.context();
CacheObject expiredVal = row.value();
if (cctx.deferredDelete() && !entry.detached() && !entry.isInternal()) {
entry.update(null, CU.TTL_ETERNAL, CU.EXPIRE_TIME_ETERNAL, entry.ver, true);
if (!entry.deletedUnlocked() && !entry.isStartVersion())
entry.deletedUnlocked(true);
}
else
entry.markObsolete0(cctx.cache().nextVersion(), true, null);
if (cctx.events().isRecordable(EVT_CACHE_OBJECT_EXPIRED)) {
cctx.events().addEvent(entry.partition(),
entry.key(),
cctx.localNodeId(),
null,
EVT_CACHE_OBJECT_EXPIRED,
null,
false,
expiredVal,
expiredVal != null,
null,
null,
true);
}
cctx.continuousQueries().onEntryExpired(entry, entry.key(), expiredVal);
entry.updatePlatformCache(null, null);
oldRowExpiredFlag = true;
return null;
}
}
private static class AtomicCacheUpdateClosure implements IgniteCacheOffheapManager.OffheapInvokeClosure {
private final GridCacheMapEntry entry;
private final AffinityTopologyVersion topVer;
private GridCacheVersion newVer;
private GridCacheOperation op;
private Object writeObj;
private Object[] invokeArgs;
private final boolean readThrough;
private final boolean writeThrough;
private final boolean keepBinary;
private final IgniteCacheExpiryPolicy expiryPlc;
private final boolean primary;
private final boolean verCheck;
private final CacheEntryPredicate[] filter;
private final long explicitTtl;
private final long explicitExpireTime;
private GridCacheVersion conflictVer;
private final boolean conflictResolve;
private final boolean intercept;
private final Long updateCntr;
private final boolean skipInterceptorOnConflict;
private GridCacheUpdateAtomicResult updateRes;
private IgniteTree.OperationType treeOp;
private CacheDataRow newRow;
private CacheDataRow oldRow;
private boolean oldRowExpiredFlag;
private boolean wasIntercepted;
AtomicCacheUpdateClosure(
GridCacheMapEntry entry,
AffinityTopologyVersion topVer,
GridCacheVersion newVer,
GridCacheOperation op,
Object writeObj,
Object[] invokeArgs,
boolean readThrough,
boolean writeThrough,
boolean keepBinary,
@Nullable IgniteCacheExpiryPolicy expiryPlc,
boolean primary,
boolean verCheck,
@Nullable CacheEntryPredicate[] filter,
long explicitTtl,
long explicitExpireTime,
@Nullable GridCacheVersion conflictVer,
boolean conflictResolve,
boolean intercept,
@Nullable Long updateCntr,
boolean skipInterceptorOnConflict) {
assert op == UPDATE || op == DELETE || op == TRANSFORM : op;
this.entry = entry;
this.topVer = topVer;
this.newVer = newVer;
this.op = op;
this.writeObj = writeObj;
this.invokeArgs = invokeArgs;
this.readThrough = readThrough;
this.writeThrough = writeThrough;
this.keepBinary = keepBinary;
this.expiryPlc = expiryPlc;
this.primary = primary;
this.verCheck = verCheck;
this.filter = filter;
this.explicitTtl = explicitTtl;
this.explicitExpireTime = explicitExpireTime;
this.conflictVer = conflictVer;
this.conflictResolve = conflictResolve;
this.intercept = intercept;
this.updateCntr = updateCntr;
this.skipInterceptorOnConflict = skipInterceptorOnConflict;
switch (op) {
case UPDATE:
treeOp = IgniteTree.OperationType.PUT;
break;
case DELETE:
treeOp = IgniteTree.OperationType.REMOVE;
break;
}
} | CacheDataRow function(CacheDataRow row) throws IgniteCheckedException { assert row != null; if (!(row.expireTime() > 0 && row.expireTime() <= U.currentTimeMillis())) return row; GridCacheContext cctx = entry.context(); CacheObject expiredVal = row.value(); if (cctx.deferredDelete() && !entry.detached() && !entry.isInternal()) { entry.update(null, CU.TTL_ETERNAL, CU.EXPIRE_TIME_ETERNAL, entry.ver, true); if (!entry.deletedUnlocked() && !entry.isStartVersion()) entry.deletedUnlocked(true); } else entry.markObsolete0(cctx.cache().nextVersion(), true, null); if (cctx.events().isRecordable(EVT_CACHE_OBJECT_EXPIRED)) { cctx.events().addEvent(entry.partition(), entry.key(), cctx.localNodeId(), null, EVT_CACHE_OBJECT_EXPIRED, null, false, expiredVal, expiredVal != null, null, null, true); } cctx.continuousQueries().onEntryExpired(entry, entry.key(), expiredVal); entry.updatePlatformCache(null, null); oldRowExpiredFlag = true; return null; } } private static class AtomicCacheUpdateClosure implements IgniteCacheOffheapManager.OffheapInvokeClosure { private final GridCacheMapEntry entry; private final AffinityTopologyVersion topVer; private GridCacheVersion newVer; private GridCacheOperation op; private Object writeObj; private Object[] invokeArgs; private final boolean readThrough; private final boolean writeThrough; private final boolean keepBinary; private final IgniteCacheExpiryPolicy expiryPlc; private final boolean primary; private final boolean verCheck; private final CacheEntryPredicate[] filter; private final long explicitTtl; private final long explicitExpireTime; private GridCacheVersion conflictVer; private final boolean conflictResolve; private final boolean intercept; private final Long updateCntr; private final boolean skipInterceptorOnConflict; private GridCacheUpdateAtomicResult updateRes; private IgniteTree.OperationType treeOp; private CacheDataRow newRow; private CacheDataRow oldRow; private boolean oldRowExpiredFlag; private boolean wasIntercepted; AtomicCacheUpdateClosure( GridCacheMapEntry entry, AffinityTopologyVersion topVer, GridCacheVersion newVer, GridCacheOperation op, Object writeObj, Object[] invokeArgs, boolean readThrough, boolean writeThrough, boolean keepBinary, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean primary, boolean verCheck, @Nullable CacheEntryPredicate[] filter, long explicitTtl, long explicitExpireTime, @Nullable GridCacheVersion conflictVer, boolean conflictResolve, boolean intercept, @Nullable Long updateCntr, boolean skipInterceptorOnConflict) { assert op == UPDATE op == DELETE op == TRANSFORM : op; this.entry = entry; this.topVer = topVer; this.newVer = newVer; this.op = op; this.writeObj = writeObj; this.invokeArgs = invokeArgs; this.readThrough = readThrough; this.writeThrough = writeThrough; this.keepBinary = keepBinary; this.expiryPlc = expiryPlc; this.primary = primary; this.verCheck = verCheck; this.filter = filter; this.explicitTtl = explicitTtl; this.explicitExpireTime = explicitExpireTime; this.conflictVer = conflictVer; this.conflictResolve = conflictResolve; this.intercept = intercept; this.updateCntr = updateCntr; this.skipInterceptorOnConflict = skipInterceptorOnConflict; switch (op) { case UPDATE: treeOp = IgniteTree.OperationType.PUT; break; case DELETE: treeOp = IgniteTree.OperationType.REMOVE; break; } } | /**
* Checks row for expiration and fire expire events if needed.
*
* @param row old row.
* @return {@code Null} if row was expired, row itself otherwise.
* @throws IgniteCheckedException
*/ | Checks row for expiration and fire expire events if needed | checkRowExpired | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java",
"license": "apache-2.0",
"size": 228249
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion",
"org.apache.ignite.internal.processors.cache.persistence.CacheDataRow",
"org.apache.ignite.internal.processors.cache.version.GridCacheVersion",
"org.apache.ignite.internal.util.IgniteTree",
"org.apache.ignite.internal.util.typedef.internal.U",
"org.jetbrains.annotations.Nullable"
]
| import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.apache.ignite.internal.util.IgniteTree; import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.*; import org.apache.ignite.internal.processors.affinity.*; import org.apache.ignite.internal.processors.cache.persistence.*; import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
]
| org.apache.ignite; org.jetbrains.annotations; | 2,076,537 |
public void addIgnoredView(View v) {
mViewAbove.addIgnoredView(v);
} | void function(View v) { mViewAbove.addIgnoredView(v); } | /**
* Add a View ignored by the Touch Down event when mode is Fullscreen
*
* @param v
* a view to be ignored
*/ | Add a View ignored by the Touch Down event when mode is Fullscreen | addIgnoredView | {
"repo_name": "Akylas/SlidingMenu",
"path": "library/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java",
"license": "apache-2.0",
"size": 34500
} | [
"android.view.View"
]
| import android.view.View; | import android.view.*; | [
"android.view"
]
| android.view; | 2,662,803 |
void setColumn( int column ) throws SemanticException; | void setColumn( int column ) throws SemanticException; | /**
* Sets the cell's column property. The input value gives the column in
* which the cell starts. Columns are numbered from 1.
*
* @param column
* the column index, starting from 1.
*
* @throws SemanticException
* if this property is locked.
*/ | Sets the cell's column property. The input value gives the column in which the cell starts. Columns are numbered from 1 | setColumn | {
"repo_name": "Charling-Huang/birt",
"path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/simpleapi/ICell.java",
"license": "epl-1.0",
"size": 8434
} | [
"org.eclipse.birt.report.model.api.activity.SemanticException"
]
| import org.eclipse.birt.report.model.api.activity.SemanticException; | import org.eclipse.birt.report.model.api.activity.*; | [
"org.eclipse.birt"
]
| org.eclipse.birt; | 1,934,301 |
void add(Module module); | void add(Module module); | /**
* Adds a module for further processing.
*
* @param module
* a module to add
*/ | Adds a module for further processing | add | {
"repo_name": "jilm/control4j",
"path": "src/cz/control4j/application/ApplicationHandler.java",
"license": "lgpl-3.0",
"size": 2762
} | [
"cz.control4j.Module"
]
| import cz.control4j.Module; | import cz.control4j.*; | [
"cz.control4j"
]
| cz.control4j; | 302,037 |
public void testReadID3v24Mp3WithExtendedHeaderAndCrc()
{
File orig = new File("testdata", "test47.mp3");
if (!orig.isFile())
{
System.err.println("Unable to test file - not available");
return;
}
File testFile = null;
Exception exceptionCaught = null;
try
{
testFile = AbstractTestCase.copyAudioToTmp("test47.mp3");
//Read File okay
AudioFile af = AudioFileIO.read(testFile);
System.out.println(af.getTag().toString());
assertEquals("tonight (instrumental)",af.getTag().getFirst(FieldKey.TITLE));
assertEquals("Young Gunz",af.getTag().getFirst(FieldKey.ARTIST));
ID3v23Tag id3v23Tag = (ID3v23Tag)af.getTag();
assertEquals(156497728,id3v23Tag.getCrc32());
assertEquals(0,id3v23Tag.getPaddingSize());
af.getTag().setField(FieldKey.ALBUM,"FRED");
af.commit();
af = AudioFileIO.read(testFile);
System.out.println(af.getTag().toString());
assertEquals("FRED",af.getTag().getFirst(FieldKey.ALBUM));
}
catch(Exception e)
{
e.printStackTrace();
exceptionCaught=e;
}
assertNull(exceptionCaught);
} | void function() { File orig = new File(STR, STR); if (!orig.isFile()) { System.err.println(STR); return; } File testFile = null; Exception exceptionCaught = null; try { testFile = AbstractTestCase.copyAudioToTmp(STR); AudioFile af = AudioFileIO.read(testFile); System.out.println(af.getTag().toString()); assertEquals(STR,af.getTag().getFirst(FieldKey.TITLE)); assertEquals(STR,af.getTag().getFirst(FieldKey.ARTIST)); ID3v23Tag id3v23Tag = (ID3v23Tag)af.getTag(); assertEquals(156497728,id3v23Tag.getCrc32()); assertEquals(0,id3v23Tag.getPaddingSize()); af.getTag().setField(FieldKey.ALBUM,"FRED"); af.commit(); af = AudioFileIO.read(testFile); System.out.println(af.getTag().toString()); assertEquals("FRED",af.getTag().getFirst(FieldKey.ALBUM)); } catch(Exception e) { e.printStackTrace(); exceptionCaught=e; } assertNull(exceptionCaught); } | /**
* Test read mp3 with extended header and crc-32 check
*/ | Test read mp3 with extended header and crc-32 check | testReadID3v24Mp3WithExtendedHeaderAndCrc | {
"repo_name": "craigpetchell/Jaudiotagger",
"path": "srctest/org/jaudiotagger/issues/Issue269Test.java",
"license": "lgpl-2.1",
"size": 8024
} | [
"java.io.File",
"org.jaudiotagger.AbstractTestCase",
"org.jaudiotagger.audio.AudioFile",
"org.jaudiotagger.audio.AudioFileIO",
"org.jaudiotagger.tag.FieldKey",
"org.jaudiotagger.tag.id3.ID3v23Tag"
]
| import java.io.File; import org.jaudiotagger.AbstractTestCase; import org.jaudiotagger.audio.AudioFile; import org.jaudiotagger.audio.AudioFileIO; import org.jaudiotagger.tag.FieldKey; import org.jaudiotagger.tag.id3.ID3v23Tag; | import java.io.*; import org.jaudiotagger.*; import org.jaudiotagger.audio.*; import org.jaudiotagger.tag.*; import org.jaudiotagger.tag.id3.*; | [
"java.io",
"org.jaudiotagger",
"org.jaudiotagger.audio",
"org.jaudiotagger.tag"
]
| java.io; org.jaudiotagger; org.jaudiotagger.audio; org.jaudiotagger.tag; | 2,009,357 |
public String[] getAllText() {
ArrayList<String> text = new ArrayList<String>();
for(Stream stream : hdgf.getTopLevelStreams()) {
findText(stream, text);
}
return text.toArray( new String[text.size()] );
} | String[] function() { ArrayList<String> text = new ArrayList<String>(); for(Stream stream : hdgf.getTopLevelStreams()) { findText(stream, text); } return text.toArray( new String[text.size()] ); } | /**
* Locates all the text entries in the file, and returns their
* contents.
*
* @return An array of each Text item in the document
*/ | Locates all the text entries in the file, and returns their contents | getAllText | {
"repo_name": "lvweiwolf/poi-3.16",
"path": "src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java",
"license": "apache-2.0",
"size": 4569
} | [
"java.util.ArrayList",
"org.apache.poi.hdgf.streams.Stream"
]
| import java.util.ArrayList; import org.apache.poi.hdgf.streams.Stream; | import java.util.*; import org.apache.poi.hdgf.streams.*; | [
"java.util",
"org.apache.poi"
]
| java.util; org.apache.poi; | 850,237 |
public Element toMarcXChangeDomElement() {
return MarcXChangeBuilder.record2DomElement(this, null);
} | Element function() { return MarcXChangeBuilder.record2DomElement(this, null); } | /**
* codes the record in DOM
*
* @return a DOM Element representing the record
*/ | codes the record in DOM | toMarcXChangeDomElement | {
"repo_name": "repoxIST/repoxLight",
"path": "repox-core/src/main/java/pt/utl/ist/marc/Record.java",
"license": "gpl-3.0",
"size": 25425
} | [
"org.w3c.dom.Element",
"pt.utl.ist.marc.xml.MarcXChangeBuilder"
]
| import org.w3c.dom.Element; import pt.utl.ist.marc.xml.MarcXChangeBuilder; | import org.w3c.dom.*; import pt.utl.ist.marc.xml.*; | [
"org.w3c.dom",
"pt.utl.ist"
]
| org.w3c.dom; pt.utl.ist; | 2,323,271 |
public static DateTime getUniversalTimestamp(final GroupByQuery query)
{
final Granularity gran = query.getGranularity();
final String timestampStringFromContext = query.getContextValue(CTX_KEY_FUDGE_TIMESTAMP, "");
if (!timestampStringFromContext.isEmpty()) {
return new DateTime(Long.parseLong(timestampStringFromContext));
} else if (Granularities.ALL.equals(gran)) {
final long timeStart = query.getIntervals().get(0).getStartMillis();
return gran.getIterable(new Interval(timeStart, timeStart + 1)).iterator().next().getStart();
} else {
return null;
}
} | static DateTime function(final GroupByQuery query) { final Granularity gran = query.getGranularity(); final String timestampStringFromContext = query.getContextValue(CTX_KEY_FUDGE_TIMESTAMP, ""); if (!timestampStringFromContext.isEmpty()) { return new DateTime(Long.parseLong(timestampStringFromContext)); } else if (Granularities.ALL.equals(gran)) { final long timeStart = query.getIntervals().get(0).getStartMillis(); return gran.getIterable(new Interval(timeStart, timeStart + 1)).iterator().next().getStart(); } else { return null; } } | /**
* If "query" has a single universal timestamp, return it. Otherwise return null. This is useful
* for keeping timestamps in sync across partial queries that may have different intervals.
*
* @param query the query
*
* @return universal timestamp, or null
*/ | If "query" has a single universal timestamp, return it. Otherwise return null. This is useful for keeping timestamps in sync across partial queries that may have different intervals | getUniversalTimestamp | {
"repo_name": "noddi/druid",
"path": "processing/src/main/java/io/druid/query/groupby/strategy/GroupByStrategyV2.java",
"license": "apache-2.0",
"size": 12685
} | [
"io.druid.java.util.common.granularity.Granularities",
"io.druid.java.util.common.granularity.Granularity",
"io.druid.query.groupby.GroupByQuery",
"org.joda.time.DateTime",
"org.joda.time.Interval"
]
| import io.druid.java.util.common.granularity.Granularities; import io.druid.java.util.common.granularity.Granularity; import io.druid.query.groupby.GroupByQuery; import org.joda.time.DateTime; import org.joda.time.Interval; | import io.druid.java.util.common.granularity.*; import io.druid.query.groupby.*; import org.joda.time.*; | [
"io.druid.java",
"io.druid.query",
"org.joda.time"
]
| io.druid.java; io.druid.query; org.joda.time; | 2,086,468 |
return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
} | return OpenWireObjectMessage.DATA_STRUCTURE_TYPE; } | /**
* Return the type of Data Structure we marshal
*
* @return short representation of the type data structure
*/ | Return the type of Data Structure we marshal | getDataStructureType | {
"repo_name": "tabish121/OpenWire",
"path": "openwire-legacy/src/main/java/io/openwire/codec/v8/OpenWireObjectMessageMarshaller.java",
"license": "apache-2.0",
"size": 3489
} | [
"io.openwire.commands.OpenWireObjectMessage"
]
| import io.openwire.commands.OpenWireObjectMessage; | import io.openwire.commands.*; | [
"io.openwire.commands"
]
| io.openwire.commands; | 1,027,758 |
public void onClickShareTextButton(View v) {
Toast.makeText(this, "TODO: Share text when this is clicked", Toast.LENGTH_LONG).show();
} | void function(View v) { Toast.makeText(this, STR, Toast.LENGTH_LONG).show(); } | /**
* This method is called when the Share Text Content button is clicked. It will simply share
* the text contained within the String textThatYouWantToShare.
*
* @param v Button that was clicked.
*/ | This method is called when the Share Text Content button is clicked. It will simply share the text contained within the String textThatYouWantToShare | onClickShareTextButton | {
"repo_name": "monal94/ud851-Exercises-student",
"path": "Lesson04b-Webpages-Maps-and-Sharing/T04b.02-Exercise-OpenMap/app/src/main/java/com/example/android/implicitintents/MainActivity.java",
"license": "apache-2.0",
"size": 5302
} | [
"android.view.View",
"android.widget.Toast"
]
| import android.view.View; import android.widget.Toast; | import android.view.*; import android.widget.*; | [
"android.view",
"android.widget"
]
| android.view; android.widget; | 2,196,879 |
public CSSStyleDeclaration getOverrideStyle(Element elt,
String pseudoElt) {
return ((DocumentCSS)getOwnerDocument()).getOverrideStyle(elt,
pseudoElt);
}
// SVGLangSpace support ////////////////////////////////////////////////// | CSSStyleDeclaration function(Element elt, String pseudoElt) { return ((DocumentCSS)getOwnerDocument()).getOverrideStyle(elt, pseudoElt); } | /**
* <b>DOM</b>: Implements {@link
* org.w3c.dom.css.DocumentCSS#getOverrideStyle(Element,String)}.
*/ | DOM: Implements <code>org.w3c.dom.css.DocumentCSS#getOverrideStyle(Element,String)</code> | getOverrideStyle | {
"repo_name": "shyamalschandra/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/dom/svg/SVGOMSVGElement.java",
"license": "apache-2.0",
"size": 29079
} | [
"org.w3c.dom.Element",
"org.w3c.dom.css.CSSStyleDeclaration",
"org.w3c.dom.css.DocumentCSS"
]
| import org.w3c.dom.Element; import org.w3c.dom.css.CSSStyleDeclaration; import org.w3c.dom.css.DocumentCSS; | import org.w3c.dom.*; import org.w3c.dom.css.*; | [
"org.w3c.dom"
]
| org.w3c.dom; | 1,308,065 |
public void deleteCommitteeScheduleMinute(CS committeeSchedule, List<CSM> deletedCommitteeScheduleMinutes, int itemNumber); | void function(CS committeeSchedule, List<CSM> deletedCommitteeScheduleMinutes, int itemNumber); | /**
*
* This method is to delete committee schedule minute entry from minute entry list.
* @param committeeSchedule
* @param deletedCommitteeScheduleMinutes
* @param itemNumber
*/ | This method is to delete committee schedule minute entry from minute entry list | deleteCommitteeScheduleMinute | {
"repo_name": "blackcathacker/kc.preclean",
"path": "coeus-code/src/main/java/org/kuali/coeus/common/committee/impl/meeting/CommonMeetingService.java",
"license": "apache-2.0",
"size": 4369
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 1,395,636 |
protected void handleUpdate(ProjectsUpdateMessage dto) {
List<String> updatedProjects = dto.getUpdatedProjects();
Set<String> projectToRefresh = computeUniqueHiLevelProjects(updatedProjects);
for (final String path : projectToRefresh) {
appContext
.getWorkspaceRoot()
.getContainer(path)
.then(
container -> {
if (container.isPresent()) {
container.get().synchronize();
}
});
}
pomEditorReconciler.reconcilePoms(updatedProjects);
} | void function(ProjectsUpdateMessage dto) { List<String> updatedProjects = dto.getUpdatedProjects(); Set<String> projectToRefresh = computeUniqueHiLevelProjects(updatedProjects); for (final String path : projectToRefresh) { appContext .getWorkspaceRoot() .getContainer(path) .then( container -> { if (container.isPresent()) { container.get().synchronize(); } }); } pomEditorReconciler.reconcilePoms(updatedProjects); } | /**
* Updates the tree of projects which were modified.
*
* @param dto describes a projects which were modified
*/ | Updates the tree of projects which were modified | handleUpdate | {
"repo_name": "sleshchenko/che",
"path": "plugins/plugin-maven/che-plugin-maven-ide/src/main/java/org/eclipse/che/plugin/maven/client/comunnication/MavenMessagesHandler.java",
"license": "epl-1.0",
"size": 5846
} | [
"java.util.List",
"java.util.Set",
"org.eclipse.che.plugin.maven.shared.dto.ProjectsUpdateMessage"
]
| import java.util.List; import java.util.Set; import org.eclipse.che.plugin.maven.shared.dto.ProjectsUpdateMessage; | import java.util.*; import org.eclipse.che.plugin.maven.shared.dto.*; | [
"java.util",
"org.eclipse.che"
]
| java.util; org.eclipse.che; | 1,123,687 |
public Identity getIdentity() throws TimeoutException, NotConnectedException {
byte options = 0;
boolean isResponseExpected = getResponseExpected(FUNCTION_GET_IDENTITY);
if(isResponseExpected) {
options = 8;
}
ByteBuffer bb = ipcon.createRequestBuffer(uid, (byte)8, FUNCTION_GET_IDENTITY, options, (byte)(0));
byte[] response = sendRequestExpectResponse(bb.array(), FUNCTION_GET_IDENTITY);
bb = ByteBuffer.wrap(response, 8, response.length - 8);
bb.order(ByteOrder.LITTLE_ENDIAN);
Identity obj = new Identity();
obj.uid = IPConnection.string(bb, 8);
obj.connectedUid = IPConnection.string(bb, 8);
obj.position = (char)(bb.get());
for(int i = 0; i < 3; i++) {
obj.hardwareVersion[i] = IPConnection.unsignedByte(bb.get());
}
for(int i = 0; i < 3; i++) {
obj.firmwareVersion[i] = IPConnection.unsignedByte(bb.get());
}
obj.deviceIdentifier = IPConnection.unsignedShort(bb.getShort());
return obj;
} | Identity function() throws TimeoutException, NotConnectedException { byte options = 0; boolean isResponseExpected = getResponseExpected(FUNCTION_GET_IDENTITY); if(isResponseExpected) { options = 8; } ByteBuffer bb = ipcon.createRequestBuffer(uid, (byte)8, FUNCTION_GET_IDENTITY, options, (byte)(0)); byte[] response = sendRequestExpectResponse(bb.array(), FUNCTION_GET_IDENTITY); bb = ByteBuffer.wrap(response, 8, response.length - 8); bb.order(ByteOrder.LITTLE_ENDIAN); Identity obj = new Identity(); obj.uid = IPConnection.string(bb, 8); obj.connectedUid = IPConnection.string(bb, 8); obj.position = (char)(bb.get()); for(int i = 0; i < 3; i++) { obj.hardwareVersion[i] = IPConnection.unsignedByte(bb.get()); } for(int i = 0; i < 3; i++) { obj.firmwareVersion[i] = IPConnection.unsignedByte(bb.get()); } obj.deviceIdentifier = IPConnection.unsignedShort(bb.getShort()); return obj; } | /**
* Returns the UID, the UID where the Bricklet is connected to,
* the position, the hardware and firmware version as well as the
* device identifier.
*
* The position can be 'a', 'b', 'c' or 'd'.
*
* The device identifiers can be found :ref:`here <device_identifier>`.
*
* .. versionadded:: 2.0.0~(Plugin)
*/ | Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c' or 'd'. The device identifiers can be found :ref:`here `. .. versionadded:: 2.0.0~(Plugin) | getIdentity | {
"repo_name": "ezeeb/pipes-tinkerforge",
"path": "src/main/java/com/tinkerforge/BrickletIO4.java",
"license": "apache-2.0",
"size": 19966
} | [
"java.nio.ByteBuffer",
"java.nio.ByteOrder"
]
| import java.nio.ByteBuffer; import java.nio.ByteOrder; | import java.nio.*; | [
"java.nio"
]
| java.nio; | 2,594,258 |
public void consumerRecord(ConsumerRecord<byte[], byte[]> consumedMessage) {
this.context.consumerRecord(consumedMessage);
} | void function(ConsumerRecord<byte[], byte[]> consumedMessage) { this.context.consumerRecord(consumedMessage); } | /**
* Set the record consumed from Kafka in a sink connector.
*
* @param consumedMessage the record
*/ | Set the record consumed from Kafka in a sink connector | consumerRecord | {
"repo_name": "KevinLiLu/kafka",
"path": "connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/RetryWithToleranceOperator.java",
"license": "apache-2.0",
"size": 10585
} | [
"org.apache.kafka.clients.consumer.ConsumerRecord"
]
| import org.apache.kafka.clients.consumer.ConsumerRecord; | import org.apache.kafka.clients.consumer.*; | [
"org.apache.kafka"
]
| org.apache.kafka; | 1,298,815 |
@Test(expected = WroRuntimeException.class)
public void testFilterInitParamsAreWrong()
throws Exception {
when(mockFilterConfig.getInitParameter(ConfigConstants.cacheUpdatePeriod.name())).thenReturn("InvalidNumber");
when(mockFilterConfig.getInitParameter(ConfigConstants.modelUpdatePeriod.name())).thenReturn("100");
victim.init(mockFilterConfig);
} | @Test(expected = WroRuntimeException.class) void function() throws Exception { when(mockFilterConfig.getInitParameter(ConfigConstants.cacheUpdatePeriod.name())).thenReturn(STR); when(mockFilterConfig.getInitParameter(ConfigConstants.modelUpdatePeriod.name())).thenReturn("100"); victim.init(mockFilterConfig); } | /**
* Set filter init params with proper values and check they are the same in {@link WroConfiguration} object.
*/ | Set filter init params with proper values and check they are the same in <code>WroConfiguration</code> object | testFilterInitParamsAreWrong | {
"repo_name": "dacofr/wro4j",
"path": "wro4j-core/src/test/java/ro/isdc/wro/http/TestWroFilter.java",
"license": "apache-2.0",
"size": 31161
} | [
"org.junit.Test",
"org.mockito.Mockito",
"ro.isdc.wro.WroRuntimeException",
"ro.isdc.wro.config.jmx.ConfigConstants"
]
| import org.junit.Test; import org.mockito.Mockito; import ro.isdc.wro.WroRuntimeException; import ro.isdc.wro.config.jmx.ConfigConstants; | import org.junit.*; import org.mockito.*; import ro.isdc.wro.*; import ro.isdc.wro.config.jmx.*; | [
"org.junit",
"org.mockito",
"ro.isdc.wro"
]
| org.junit; org.mockito; ro.isdc.wro; | 2,428,376 |
public static void assignOwnerTag(@SuppressWarnings("exports") final SecurityObject accessObject,
final AbstractAttribute attribute, final AbstractHtml ownerTag) {
if (accessObject == null || !(IndexedClassType.ABSTRACT_HTML.equals(accessObject.forClassType()))) {
throw new WffSecurityException("Not allowed to consume this method. This method is for internal use.");
}
attribute.setOwnerTagLockless(ownerTag);
} | static void function(@SuppressWarnings(STR) final SecurityObject accessObject, final AbstractAttribute attribute, final AbstractHtml ownerTag) { if (accessObject == null !(IndexedClassType.ABSTRACT_HTML.equals(accessObject.forClassType()))) { throw new WffSecurityException(STR); } attribute.setOwnerTagLockless(ownerTag); } | /**
* for internal use only.
*
* @param accessObject
* @param attribute
* @param ownerTag
* @since 3.0.15
*/ | for internal use only | assignOwnerTag | {
"repo_name": "webfirmframework/wff",
"path": "wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/attribute/core/AttributeUtil.java",
"license": "apache-2.0",
"size": 15292
} | [
"com.webfirmframework.wffweb.WffSecurityException",
"com.webfirmframework.wffweb.internal.constants.IndexedClassType",
"com.webfirmframework.wffweb.internal.security.object.SecurityObject",
"com.webfirmframework.wffweb.tag.html.AbstractHtml"
]
| import com.webfirmframework.wffweb.WffSecurityException; import com.webfirmframework.wffweb.internal.constants.IndexedClassType; import com.webfirmframework.wffweb.internal.security.object.SecurityObject; import com.webfirmframework.wffweb.tag.html.AbstractHtml; | import com.webfirmframework.wffweb.*; import com.webfirmframework.wffweb.internal.constants.*; import com.webfirmframework.wffweb.internal.security.object.*; import com.webfirmframework.wffweb.tag.html.*; | [
"com.webfirmframework.wffweb"
]
| com.webfirmframework.wffweb; | 398,969 |
public T pgp(String keyFileName, String keyUserid, String password, boolean armored, boolean integrity) {
PGPDataFormat pgp = new PGPDataFormat();
pgp.setKeyFileName(keyFileName);
pgp.setKeyUserid(keyUserid);
pgp.setPassword(password);
pgp.setArmored(armored);
pgp.setIntegrity(integrity);
return dataFormat(pgp);
} | T function(String keyFileName, String keyUserid, String password, boolean armored, boolean integrity) { PGPDataFormat pgp = new PGPDataFormat(); pgp.setKeyFileName(keyFileName); pgp.setKeyUserid(keyUserid); pgp.setPassword(password); pgp.setArmored(armored); pgp.setIntegrity(integrity); return dataFormat(pgp); } | /**
* Uses the PGP data format
*/ | Uses the PGP data format | pgp | {
"repo_name": "YMartsynkevych/camel",
"path": "camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java",
"license": "apache-2.0",
"size": 27884
} | [
"org.apache.camel.model.dataformat.PGPDataFormat"
]
| import org.apache.camel.model.dataformat.PGPDataFormat; | import org.apache.camel.model.dataformat.*; | [
"org.apache.camel"
]
| org.apache.camel; | 1,435,836 |
@Field(17)
public long offset() {
return this.io.getLongField(this, 17);
} | @Field(17) long function() { return this.io.getLongField(this, 17); } | /**
* Set if the parser has a valid file offset<br>
* < byte offset from starting packet start
*/ | Set if the parser has a valid file offset < byte offset from starting packet start | offset | {
"repo_name": "mutars/java_libav",
"path": "wrapper/src/main/java/com/mutar/libav/bridge/avcodec/AVCodecParserContext.java",
"license": "gpl-2.0",
"size": 9872
} | [
"org.bridj.ann.Field"
]
| import org.bridj.ann.Field; | import org.bridj.ann.*; | [
"org.bridj.ann"
]
| org.bridj.ann; | 2,344,900 |
public static void prepareRoute(ModelCamelContext context, RouteDefinition route,
List<OnExceptionDefinition> onExceptions,
List<InterceptDefinition> intercepts,
List<InterceptFromDefinition> interceptFromDefinitions,
List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions,
List<OnCompletionDefinition> onCompletions) {
Runnable propertyPlaceholdersChangeReverter = ProcessorDefinitionHelper.createPropertyPlaceholdersChangeReverter();
try {
prepareRouteImp(context, route, onExceptions, intercepts, interceptFromDefinitions, interceptSendToEndpointDefinitions, onCompletions);
} finally {
// Lets restore
propertyPlaceholdersChangeReverter.run();
}
} | static void function(ModelCamelContext context, RouteDefinition route, List<OnExceptionDefinition> onExceptions, List<InterceptDefinition> intercepts, List<InterceptFromDefinition> interceptFromDefinitions, List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions, List<OnCompletionDefinition> onCompletions) { Runnable propertyPlaceholdersChangeReverter = ProcessorDefinitionHelper.createPropertyPlaceholdersChangeReverter(); try { prepareRouteImp(context, route, onExceptions, intercepts, interceptFromDefinitions, interceptSendToEndpointDefinitions, onCompletions); } finally { propertyPlaceholdersChangeReverter.run(); } } | /**
* Prepares the route which supports context scoped features such as onException, interceptors and onCompletions
* <p/>
* This method does <b>not</b> mark the route as prepared afterwards.
*
* @param context the camel context
* @param route the route
* @param onExceptions optional list of onExceptions
* @param intercepts optional list of interceptors
* @param interceptFromDefinitions optional list of interceptFroms
* @param interceptSendToEndpointDefinitions optional list of interceptSendToEndpoints
* @param onCompletions optional list onCompletions
*/ | Prepares the route which supports context scoped features such as onException, interceptors and onCompletions This method does not mark the route as prepared afterwards | prepareRoute | {
"repo_name": "curso007/camel",
"path": "camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java",
"license": "apache-2.0",
"size": 29654
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 2,112,089 |
public boolean isInGroup(Entity e, String group) {
if(group != null) {
Bag<String> groups = groupsByEntity.get(e);
for(int i = 0; groups.size() > i; i++) {
String g = groups.get(i);
if(group == g || group.equals(g)) {
return true;
}
}
}
return false;
} | boolean function(Entity e, String group) { if(group != null) { Bag<String> groups = groupsByEntity.get(e); for(int i = 0; groups.size() > i; i++) { String g = groups.get(i); if(group == g group.equals(g)) { return true; } } } return false; } | /**
* Check if the entity is in the supplied group.
* @param group the group to check in.
* @param e the entity to check for.
* @return true if the entity is in the supplied group, false if not.
*/ | Check if the entity is in the supplied group | isInGroup | {
"repo_name": "pbanwait/Artemis-Framework",
"path": "artemis/src/com/artemis/managers/GroupManager.java",
"license": "bsd-3-clause",
"size": 3374
} | [
"com.artemis.Entity",
"com.artemis.utils.Bag"
]
| import com.artemis.Entity; import com.artemis.utils.Bag; | import com.artemis.*; import com.artemis.utils.*; | [
"com.artemis",
"com.artemis.utils"
]
| com.artemis; com.artemis.utils; | 2,483,598 |
public static void copyBytes(InputStream in, OutputStream out, int buffSize, boolean close) throws IOException {
try {
copyBytes(in, out, buffSize);
if (close) {
out.close();
out = null;
in.close();
in = null;
}
} finally {
if (close) {
closeStream(out);
closeStream(in);
}
}
} | static void function(InputStream in, OutputStream out, int buffSize, boolean close) throws IOException { try { copyBytes(in, out, buffSize); if (close) { out.close(); out = null; in.close(); in = null; } } finally { if (close) { closeStream(out); closeStream(in); } } } | /**
* Copies from one stream to another.
*
* @param in
* InputStrem to read from
* @param out
* OutputStream to write to
* @param buffSize
* the size of the buffer
* @param close
* whether or not close the InputStream and OutputStream at the
* end. The streams are closed in the finally clause.
*/ | Copies from one stream to another | copyBytes | {
"repo_name": "maoling/zookeeper",
"path": "zookeeper-server/src/main/java/org/apache/zookeeper/common/IOUtils.java",
"license": "apache-2.0",
"size": 3870
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream"
]
| import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; | import java.io.*; | [
"java.io"
]
| java.io; | 1,345,902 |
Collection<TimeSeriesEntry<V>> entryRange(long startTimestamp, long endTimestamp, int limit); | Collection<TimeSeriesEntry<V>> entryRange(long startTimestamp, long endTimestamp, int limit); | /**
* Returns ordered entries of this time-series collection within timestamp range. Including boundary values.
*
* @param startTimestamp start timestamp
* @param endTimestamp end timestamp
* @param limit result size limit
* @return elements collection
*/ | Returns ordered entries of this time-series collection within timestamp range. Including boundary values | entryRange | {
"repo_name": "redisson/redisson",
"path": "redisson/src/main/java/org/redisson/api/RTimeSeries.java",
"license": "apache-2.0",
"size": 9180
} | [
"java.util.Collection"
]
| import java.util.Collection; | import java.util.*; | [
"java.util"
]
| java.util; | 895,889 |
List<Job> findJobsByQueryCriteria(TimerJobQueryImpl jobQuery); | List<Job> findJobsByQueryCriteria(TimerJobQueryImpl jobQuery); | /**
* Executes a {@link JobQueryImpl} and returns the matching {@link TimerJobEntity} instances.
*/ | Executes a <code>JobQueryImpl</code> and returns the matching <code>TimerJobEntity</code> instances | findJobsByQueryCriteria | {
"repo_name": "stephraleigh/flowable-engine",
"path": "modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/TimerJobEntityManager.java",
"license": "apache-2.0",
"size": 3920
} | [
"java.util.List",
"org.flowable.engine.impl.TimerJobQueryImpl",
"org.flowable.engine.runtime.Job"
]
| import java.util.List; import org.flowable.engine.impl.TimerJobQueryImpl; import org.flowable.engine.runtime.Job; | import java.util.*; import org.flowable.engine.impl.*; import org.flowable.engine.runtime.*; | [
"java.util",
"org.flowable.engine"
]
| java.util; org.flowable.engine; | 1,965,723 |
public void setApoInformation(ApoInformation apoInformation); | void function(ApoInformation apoInformation); | /**
* Gibt die ApoInformation aus der Anfrage an diesen Request-Handler weiter.
* @param apoInformation Die ApoInformation mit den Apotheken-Informationen
*/ | Gibt die ApoInformation aus der Anfrage an diesen Request-Handler weiter | setApoInformation | {
"repo_name": "Captain-P-Goldfish/fiverx-api-java",
"path": "src/main/java/de/fiverx/handling/server/RequestHandler.java",
"license": "apache-2.0",
"size": 1925
} | [
"de.fiverx.webservice.security.sv0100.ApoInformation"
]
| import de.fiverx.webservice.security.sv0100.ApoInformation; | import de.fiverx.webservice.security.sv0100.*; | [
"de.fiverx.webservice"
]
| de.fiverx.webservice; | 1,858,122 |
public static boolean isPhoneNumber(String number) {
if (TextUtils.isEmpty(number)) {
return false;
}
Matcher match = Patterns.PHONE.matcher(number);
return match.matches();
}
public static final class Inbox implements BaseMmsColumns {
public static final Uri
CONTENT_URI = Uri.parse("content://mms/inbox");
public static final String DEFAULT_SORT_ORDER = "date DESC";
}
public static final class Sent implements BaseMmsColumns {
public static final Uri
CONTENT_URI = Uri.parse("content://mms/sent");
public static final String DEFAULT_SORT_ORDER = "date DESC";
}
public static final class Draft implements BaseMmsColumns {
public static final Uri
CONTENT_URI = Uri.parse("content://mms/drafts");
public static final String DEFAULT_SORT_ORDER = "date DESC";
}
public static final class Outbox implements BaseMmsColumns {
public static final Uri
CONTENT_URI = Uri.parse("content://mms/outbox");
public static final String DEFAULT_SORT_ORDER = "date DESC";
}
public static final class Addr implements BaseColumns {
public static final String MSG_ID = "msg_id";
public static final String CONTACT_ID = "contact_id";
public static final String ADDRESS = "address";
public static final String TYPE = "type";
public static final String CHARSET = "charset";
}
public static final class Part implements BaseColumns {
public static final String MSG_ID = "mid";
public static final String SEQ = "seq";
public static final String CONTENT_TYPE = "ct";
public static final String NAME = "name";
public static final String CHARSET = "chset";
public static final String FILENAME = "fn";
public static final String CONTENT_DISPOSITION = "cd";
public static final String CONTENT_ID = "cid";
public static final String CONTENT_LOCATION = "cl";
public static final String CT_START = "ctt_s";
public static final String CT_TYPE = "ctt_t";
public static final String _DATA = "_data";
public static final String TEXT = "text";
}
public static final class Rate {
public static final Uri CONTENT_URI = Uri.withAppendedPath(
Mms.CONTENT_URI, "rate");
public static final String SENT_TIME = "sent_time";
}
public static final class Intents {
private Intents() {
// Non-instantiatable.
}
public static final String EXTRA_CONTENTS = "contents";
public static final String EXTRA_TYPES = "types";
public static final String EXTRA_CC = "cc";
public static final String EXTRA_BCC = "bcc";
public static final String EXTRA_SUBJECT = "subject";
public static final String
CONTENT_CHANGED_ACTION = "android.intent.action.CONTENT_CHANGED";
public static final String DELETED_CONTENTS = "deleted_contents";
}
}
public static final class MmsSms implements BaseColumns {
public static final String TYPE_DISCRIMINATOR_COLUMN =
"transport_type";
public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/");
public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse(
"content://mms-sms/conversations");
public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse(
"content://mms-sms/messages/byphone");
public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse(
"content://mms-sms/undelivered");
public static final Uri CONTENT_DRAFT_URI = Uri.parse(
"content://mms-sms/draft");
public static final Uri CONTENT_LOCKED_URI = Uri.parse(
"content://mms-sms/locked");
public static final Uri SEARCH_URI = Uri.parse(
"content://mms-sms/search");
// Constants for message protocol types.
public static final int SMS_PROTO = 0;
public static final int MMS_PROTO = 1;
// Constants for error types of pending messages.
public static final int NO_ERROR = 0;
public static final int ERR_TYPE_GENERIC = 1;
public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2;
public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3;
public static final int ERR_TYPE_TRANSPORT_FAILURE = 4;
public static final int ERR_TYPE_GENERIC_PERMANENT = 10;
public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11;
public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12;
public static final class PendingMessages implements BaseColumns {
public static final Uri CONTENT_URI = Uri.withAppendedPath(
MmsSms.CONTENT_URI, "pending");
public static final String PROTO_TYPE = "proto_type";
public static final String MSG_ID = "msg_id";
public static final String MSG_TYPE = "msg_type";
public static final String ERROR_TYPE = "err_type";
public static final String ERROR_CODE = "err_code";
public static final String RETRY_INDEX = "retry_index";
public static final String DUE_TIME = "due_time";
public static final String LAST_TRY = "last_try";
}
public static final class WordsTable {
public static final String ID = "_id";
public static final String SOURCE_ROW_ID = "source_id";
public static final String TABLE_ID = "table_to_use";
public static final String INDEXED_TEXT = "index_text";
}
}
public static final class Carriers implements BaseColumns {
public static final Uri CONTENT_URI =
Uri.parse("content://telephony/carriers");
public static final String DEFAULT_SORT_ORDER = "name ASC";
public static final String NAME = "name";
public static final String APN = "apn";
public static final String PROXY = "proxy";
public static final String PORT = "port";
public static final String MMSPROXY = "mmsproxy";
public static final String MMSPORT = "mmsport";
public static final String SERVER = "server";
public static final String USER = "user";
public static final String PASSWORD = "password";
public static final String MMSC = "mmsc";
public static final String MCC = "mcc";
public static final String MNC = "mnc";
public static final String NUMERIC = "numeric";
public static final String AUTH_TYPE = "authtype";
public static final String TYPE = "type";
public static final String INACTIVE_TIMER = "inactivetimer";
// Only if enabled try Data Connection.
public static final String ENABLED = "enabled";
// Rules apply based on class.
public static final String CLASS = "class";
public static final String PROTOCOL = "protocol";
public static final String ROAMING_PROTOCOL = "roaming_protocol";
public static final String CURRENT = "current";
public static final String CARRIER_ENABLED = "carrier_enabled";
public static final String BEARER = "bearer";
}
public static final class CellBroadcasts implements BaseColumns {
private CellBroadcasts() {}
public static final Uri CONTENT_URI =
Uri.parse("content://cellbroadcasts");
public static final String GEOGRAPHICAL_SCOPE = "geo_scope";
public static final String SERIAL_NUMBER = "serial_number";
public static final String PLMN = "plmn";
public static final String LAC = "lac";
public static final String CID = "cid";
public static final String V1_MESSAGE_CODE = "message_code";
public static final String V1_MESSAGE_IDENTIFIER = "message_id";
public static final String SERVICE_CATEGORY = "service_category";
public static final String LANGUAGE_CODE = "language";
public static final String MESSAGE_BODY = "body";
public static final String DELIVERY_TIME = "date";
public static final String MESSAGE_READ = "read";
public static final String MESSAGE_FORMAT = "format";
public static final String MESSAGE_PRIORITY = "priority";
public static final String ETWS_WARNING_TYPE = "etws_warning_type";
public static final String CMAS_MESSAGE_CLASS = "cmas_message_class";
public static final String CMAS_CATEGORY = "cmas_category";
public static final String CMAS_RESPONSE_TYPE = "cmas_response_type";
public static final String CMAS_SEVERITY = "cmas_severity";
public static final String CMAS_URGENCY = "cmas_urgency";
public static final String CMAS_CERTAINTY = "cmas_certainty";
public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC";
public static final String[] QUERY_COLUMNS = {
_ID,
GEOGRAPHICAL_SCOPE,
PLMN,
LAC,
CID,
SERIAL_NUMBER,
SERVICE_CATEGORY,
LANGUAGE_CODE,
MESSAGE_BODY,
DELIVERY_TIME,
MESSAGE_READ,
MESSAGE_FORMAT,
MESSAGE_PRIORITY,
ETWS_WARNING_TYPE,
CMAS_MESSAGE_CLASS,
CMAS_CATEGORY,
CMAS_RESPONSE_TYPE,
CMAS_SEVERITY,
CMAS_URGENCY,
CMAS_CERTAINTY
};
}
public static final class Intents {
private Intents() {
// Not instantiable
}
public static final String SECRET_CODE_ACTION =
"android.provider.Telephony.SECRET_CODE";
public static final String SPN_STRINGS_UPDATED_ACTION =
"android.provider.Telephony.SPN_STRINGS_UPDATED";
public static final String EXTRA_SHOW_PLMN = "showPlmn";
public static final String EXTRA_PLMN = "plmn";
public static final String EXTRA_SHOW_SPN = "showSpn";
public static final String EXTRA_SPN = "spn";
} | static boolean function(String number) { if (TextUtils.isEmpty(number)) { return false; } Matcher match = Patterns.PHONE.matcher(number); return match.matches(); } public static final class Inbox implements BaseMmsColumns { public static final Uri CONTENT_URI = Uri.parse(STRdate DESC"; } public static final class Sent implements BaseMmsColumns { public static final Uri CONTENT_URI = Uri.parse(STRdate DESC"; } public static final class Draft implements BaseMmsColumns { public static final Uri CONTENT_URI = Uri.parse(STRdate DESC"; } public static final class Outbox implements BaseMmsColumns { public static final Uri CONTENT_URI = Uri.parse(STRdate DESC"; } public static final class Addr implements BaseColumns { public static final String MSG_ID = STR; public static final String CONTACT_ID = STR; public static final String ADDRESS = STR; public static final String TYPE = "type"; public static final String CHARSET = STR; } public static final class Part implements BaseColumns { public static final String MSG_ID = "mid"; public static final String SEQ = "seq"; public static final String CONTENT_TYPE = "ct"; public static final String NAME = "name"; public static final String CHARSET = "chset"; public static final String FILENAME = "fn"; public static final String CONTENT_DISPOSITION = "cd"; public static final String CONTENT_ID = "cid"; public static final String CONTENT_LOCATION = "cl"; public static final String CT_START = "ctt_s"; public static final String CT_TYPE = "ctt_t"; public static final String _DATA = "_data"; public static final String TEXT = "text"; } public static final class Rate { public static final Uri CONTENT_URI = Uri.withAppendedPath( Mms.CONTENT_URI, "rate"); public static final String SENT_TIME = STR; } public static final class Intents { private Intents() { } public static final String EXTRA_CONTENTS = STR; public static final String EXTRA_TYPES = "types"; public static final String EXTRA_CC = "cc"; public static final String EXTRA_BCC = "bcc"; public static final String EXTRA_SUBJECT = STR; public static final String CONTENT_CHANGED_ACTION = STR; public static final String DELETED_CONTENTS = STR; } } public static final class MmsSms implements BaseColumns { public static final String TYPE_DISCRIMINATOR_COLUMN = STR; public static final Uri CONTENT_URI = Uri.parse(STRcontent: public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse( STRcontent: public static final Uri CONTENT_DRAFT_URI = Uri.parse( STRcontent: public static final Uri SEARCH_URI = Uri.parse( STRpendingSTRproto_type"; public static final String MSG_ID = STR; public static final String MSG_TYPE = "msg_typeSTRerr_typeSTRerr_codeSTRretry_indexSTRdue_timeSTRlast_trySTR_idSTRsource_idSTRtable_to_useSTRindex_text"; } } public static final class Carriers implements BaseColumns { public static final Uri CONTENT_URI = Uri.parse(STRname ASC"; public static final String NAME = "name"; public static final String APN = "apn"; public static final String PROXY = "proxy"; public static final String PORT = "port"; public static final String MMSPROXY = STR; public static final String MMSPORT = STR; public static final String SERVER = STR; public static final String USER = "user"; public static final String PASSWORD = STR; public static final String MMSC = "mmsc"; public static final String MCC = "mcc"; public static final String MNC = "mnc"; public static final String NUMERIC = STR; public static final String AUTH_TYPE = STR; public static final String TYPE = "type"; public static final String INACTIVE_TIMER = STR; public static final String ENABLED = STR; public static final String CLASS = "class"; public static final String PROTOCOL = STR; public static final String ROAMING_PROTOCOL = STR; public static final String CURRENT = STR; public static final String CARRIER_ENABLED = STR; public static final String BEARER = STR; } public static final class CellBroadcasts implements BaseColumns { private CellBroadcasts() {} public static final Uri CONTENT_URI = Uri.parse(STRgeo_scopeSTRserial_numberSTRplmnSTRlacSTRcidSTRmessage_codeSTRmessage_idSTRservice_categorySTRlanguageSTRbodySTRdateSTRreadSTRformatSTRprioritySTRetws_warning_typeSTRcmas_message_classSTRcmas_categorySTRcmas_response_typeSTRcmas_severitySTRcmas_urgencySTRcmas_certaintySTR DESCSTRandroid.provider.Telephony.SECRET_CODESTRandroid.provider.Telephony.SPN_STRINGS_UPDATEDSTRshowPlmnSTRplmnSTRshowSpnSTRspn"; } | /**
* Returns true if the number is a Phone number
*
* @param number the input number to be tested
* @return true if number is a Phone number
*/ | Returns true if the number is a Phone number | isPhoneNumber | {
"repo_name": "koying/dashclock",
"path": "main/src/com/google/android/apps/dashclock/phone/TelephonyProviderConstants.java",
"license": "apache-2.0",
"size": 57027
} | [
"android.net.Uri",
"android.provider.BaseColumns",
"android.text.TextUtils",
"android.util.Patterns",
"java.util.regex.Matcher"
]
| import android.net.Uri; import android.provider.BaseColumns; import android.text.TextUtils; import android.util.Patterns; import java.util.regex.Matcher; | import android.net.*; import android.provider.*; import android.text.*; import android.util.*; import java.util.regex.*; | [
"android.net",
"android.provider",
"android.text",
"android.util",
"java.util"
]
| android.net; android.provider; android.text; android.util; java.util; | 1,513,182 |
public static ByteString wrap(final byte[] array) {
return USE_ZEROCOPYBYTESTRING? BigtableZeroCopyByteStringUtil.wrap(array): ByteString.copyFrom(array);
} | static ByteString function(final byte[] array) { return USE_ZEROCOPYBYTESTRING? BigtableZeroCopyByteStringUtil.wrap(array): ByteString.copyFrom(array); } | /**
* Wraps a byte array in a {@link ByteString} without copying it.
*/ | Wraps a byte array in a <code>ByteString</code> without copying it | wrap | {
"repo_name": "derjust/cloud-bigtable-client",
"path": "bigtable-client-core/src/main/java/com/google/cloud/bigtable/util/ByteStringer.java",
"license": "apache-2.0",
"size": 1472
} | [
"com.google.protobuf.BigtableZeroCopyByteStringUtil",
"com.google.protobuf.ByteString"
]
| import com.google.protobuf.BigtableZeroCopyByteStringUtil; import com.google.protobuf.ByteString; | import com.google.protobuf.*; | [
"com.google.protobuf"
]
| com.google.protobuf; | 1,732,420 |
@Test(dependsOnMethods = "init")
public void getArticlesByTag() throws Exception {
final TagQueryService tagQueryService = getTagQueryService();
JSONObject result = tagQueryService.getTagByTitle("Solo");
Assert.assertNotNull(result);
final JSONObject tag = result.getJSONObject(Tag.TAG);
Assert.assertNotNull(tag);
final String tagId = tag.getString(Keys.OBJECT_ID);
final ArticleQueryService articleQueryService = getArticleQueryService();
final List<JSONObject> articles = articleQueryService.getArticlesByTag(tagId, 1, Integer.MAX_VALUE);
Assert.assertNotNull(articles);
Assert.assertEquals(articles.size(), 1);
} | @Test(dependsOnMethods = "init") void function() throws Exception { final TagQueryService tagQueryService = getTagQueryService(); JSONObject result = tagQueryService.getTagByTitle("Solo"); Assert.assertNotNull(result); final JSONObject tag = result.getJSONObject(Tag.TAG); Assert.assertNotNull(tag); final String tagId = tag.getString(Keys.OBJECT_ID); final ArticleQueryService articleQueryService = getArticleQueryService(); final List<JSONObject> articles = articleQueryService.getArticlesByTag(tagId, 1, Integer.MAX_VALUE); Assert.assertNotNull(articles); Assert.assertEquals(articles.size(), 1); } | /**
* Get Articles By Tag.
*
* @throws Exception exception
*/ | Get Articles By Tag | getArticlesByTag | {
"repo_name": "AndiHappy/solo",
"path": "src/test/java/org/b3log/solo/service/ArticleQueryServiceTestCase.java",
"license": "apache-2.0",
"size": 6032
} | [
"java.util.List",
"org.b3log.latke.Keys",
"org.b3log.solo.model.Tag",
"org.json.JSONObject",
"org.testng.Assert",
"org.testng.annotations.Test"
]
| import java.util.List; import org.b3log.latke.Keys; import org.b3log.solo.model.Tag; import org.json.JSONObject; import org.testng.Assert; import org.testng.annotations.Test; | import java.util.*; import org.b3log.latke.*; import org.b3log.solo.model.*; import org.json.*; import org.testng.*; import org.testng.annotations.*; | [
"java.util",
"org.b3log.latke",
"org.b3log.solo",
"org.json",
"org.testng",
"org.testng.annotations"
]
| java.util; org.b3log.latke; org.b3log.solo; org.json; org.testng; org.testng.annotations; | 2,549,409 |
public static void showToastFromService(final Context context, final String msg, final int length) {
if (toastHandler == null) {
toastHandler = new Handler(Looper.getMainLooper());
}
toastHandler.post(new Runnable() { | static void function(final Context context, final String msg, final int length) { if (toastHandler == null) { toastHandler = new Handler(Looper.getMainLooper()); } toastHandler.post(new Runnable() { | /**
* In order to send a {@link Toast} from a {@link android.app.Service}, we
* have to do these tricks.
*/ | In order to send a <code>Toast</code> from a <code>android.app.Service</code>, we have to do these tricks | showToastFromService | {
"repo_name": "f-droid/fdroid-client",
"path": "app/src/main/java/org/fdroid/fdroid/Utils.java",
"license": "gpl-3.0",
"size": 36688
} | [
"android.content.Context",
"android.os.Handler",
"android.os.Looper"
]
| import android.content.Context; import android.os.Handler; import android.os.Looper; | import android.content.*; import android.os.*; | [
"android.content",
"android.os"
]
| android.content; android.os; | 2,225,991 |
public SiteConfigResourceInner withDefaultDocuments(List<String> defaultDocuments) {
this.defaultDocuments = defaultDocuments;
return this;
} | SiteConfigResourceInner function(List<String> defaultDocuments) { this.defaultDocuments = defaultDocuments; return this; } | /**
* Set the defaultDocuments value.
*
* @param defaultDocuments the defaultDocuments value to set
* @return the SiteConfigResourceInner object itself.
*/ | Set the defaultDocuments value | withDefaultDocuments | {
"repo_name": "jianghaolu/azure-sdk-for-java",
"path": "azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/implementation/SiteConfigResourceInner.java",
"license": "mit",
"size": 31433
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 422,671 |
@NotNull(message = "{NotNull.gov.nih.nci.calims2.domain.administration.ContactInformation.status}")
public gov.nih.nci.calims2.domain.administration.enumeration.ContactInformationStatus getStatus() {
return status;
} | @NotNull(message = STR) gov.nih.nci.calims2.domain.administration.enumeration.ContactInformationStatus function() { return status; } | /**
* Retrieves the value of the status attribute.
* @return status
**/ | Retrieves the value of the status attribute | getStatus | {
"repo_name": "NCIP/calims",
"path": "calims2-model/src/java/gov/nih/nci/calims2/domain/administration/ContactInformation.java",
"license": "bsd-3-clause",
"size": 10840
} | [
"javax.validation.constraints.NotNull"
]
| import javax.validation.constraints.NotNull; | import javax.validation.constraints.*; | [
"javax.validation"
]
| javax.validation; | 1,837,981 |
@Override
public String getText(Object object) {
String label = ((ParametricObjectSubstitution)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_ParametricObjectSubstitution_type") :
getString("_UI_ParametricObjectSubstitution_type") + " " + label;
}
| String function(Object object) { String label = ((ParametricObjectSubstitution)object).getName(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; } | /**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for the adapted class. | getText | {
"repo_name": "diverse-project/kcvl",
"path": "fr.inria.diverse.kcvl.metamodel.edit/src/main/java/org/omg/CVLMetamodelMaster/cvl/provider/ParametricObjectSubstitutionItemProvider.java",
"license": "epl-1.0",
"size": 4467
} | [
"org.omg.CVLMetamodelMaster"
]
| import org.omg.CVLMetamodelMaster; | import org.omg.*; | [
"org.omg"
]
| org.omg; | 1,796,261 |
public List listAllIpRanges(User loggedInUser) {
if (!loggedInUser.hasRole(RoleFactory.CONFIG_ADMIN)) {
throw new PermissionCheckFailureException();
}
return KickstartFactory.lookupRangeByOrg(loggedInUser.getOrg());
} | List function(User loggedInUser) { if (!loggedInUser.hasRole(RoleFactory.CONFIG_ADMIN)) { throw new PermissionCheckFailureException(); } return KickstartFactory.lookupRangeByOrg(loggedInUser.getOrg()); } | /**
* Lists all ip ranges for an org
* @param loggedInUser The current user
* @return List of KickstartIpRange objects
*
* @xmlrpc.doc List all Ip Ranges and their associated kickstarts available
* in the user's org.
* @xmlrpc.param #session_key()
* @xmlrpc.returntype #array() $KickstartIpRangeSerializer #array_end()
*
*/ | Lists all ip ranges for an org | listAllIpRanges | {
"repo_name": "renner/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/KickstartHandler.java",
"license": "gpl-2.0",
"size": 34483
} | [
"com.redhat.rhn.domain.kickstart.KickstartFactory",
"com.redhat.rhn.domain.role.RoleFactory",
"com.redhat.rhn.domain.user.User",
"com.redhat.rhn.frontend.xmlrpc.PermissionCheckFailureException",
"java.util.List"
]
| import com.redhat.rhn.domain.kickstart.KickstartFactory; import com.redhat.rhn.domain.role.RoleFactory; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.xmlrpc.PermissionCheckFailureException; import java.util.List; | import com.redhat.rhn.domain.kickstart.*; import com.redhat.rhn.domain.role.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.xmlrpc.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
]
| com.redhat.rhn; java.util; | 1,332,130 |
public Resourcepart getResource() {
return resource;
} | Resourcepart function() { return resource; } | /**
* Returns the resource to use when trying to reconnect to the server.
*
* @return the resource to use when trying to reconnect to the server.
*/ | Returns the resource to use when trying to reconnect to the server | getResource | {
"repo_name": "esl/Smack",
"path": "smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java",
"license": "apache-2.0",
"size": 36691
} | [
"org.jxmpp.jid.parts.Resourcepart"
]
| import org.jxmpp.jid.parts.Resourcepart; | import org.jxmpp.jid.parts.*; | [
"org.jxmpp.jid"
]
| org.jxmpp.jid; | 2,736,948 |
public void exportAllXMLFile() {
ResourceExportInterface resourceExportInterface = getActiveTransformation();
if ( resourceExportInterface == null ) {
resourceExportInterface = getActiveJob();
}
if ( resourceExportInterface == null ) {
return; // nothing to do here, prevent an NPE
}
// ((VariableSpace)resourceExportInterface).getVariable("Internal.Transformation.Filename.Directory");
// Ask the user for a zip file to export to:
//
try {
String zipFilename = null;
while ( Utils.isEmpty( zipFilename ) ) {
FileDialog dialog = new FileDialog( shell, SWT.SAVE );
dialog.setText( BaseMessages.getString( PKG, "Spoon.ExportResourceSelectZipFile" ) );
dialog.setFilterExtensions( new String[] { "*.zip;*.ZIP", "*" } );
dialog.setFilterNames( new String[] {
BaseMessages.getString( PKG, "System.FileType.ZIPFiles" ),
BaseMessages.getString( PKG, "System.FileType.AllFiles" ), } );
setFilterPath( dialog );
if ( dialog.open() != null ) {
lastDirOpened = dialog.getFilterPath();
zipFilename = dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName();
FileObject zipFileObject = KettleVFS.getFileObject( zipFilename );
if ( zipFileObject.exists() ) {
MessageBox box = new MessageBox( shell, SWT.YES | SWT.NO | SWT.CANCEL );
box
.setMessage( BaseMessages
.getString( PKG, "Spoon.ExportResourceZipFileExists.Message", zipFilename ) );
box.setText( BaseMessages.getString( PKG, "Spoon.ExportResourceZipFileExists.Title" ) );
int answer = box.open();
if ( answer == SWT.CANCEL ) {
return;
}
if ( answer == SWT.NO ) {
zipFilename = null;
}
}
} else {
return;
}
}
// Export the resources linked to the currently loaded file...
//
TopLevelResource topLevelResource =
ResourceUtil.serializeResourceExportInterface(
zipFilename, resourceExportInterface, (VariableSpace) resourceExportInterface, rep, metaStore );
String message =
ResourceUtil.getExplanation( zipFilename, topLevelResource.getResourceName(), resourceExportInterface );
// Show some information concerning all this work...
EnterTextDialog enterTextDialog =
new EnterTextDialog(
shell, BaseMessages.getString( PKG, "Spoon.Dialog.ResourceSerialized" ), BaseMessages.getString(
PKG, "Spoon.Dialog.ResourceSerializedSuccesfully" ), message );
enterTextDialog.setReadOnly();
enterTextDialog.open();
} catch ( Exception e ) {
new ErrorDialog( shell, BaseMessages.getString( PKG, "Spoon.Error" ), BaseMessages.getString(
PKG, "Spoon.ErrorExportingFile" ), e );
}
} | void function() { ResourceExportInterface resourceExportInterface = getActiveTransformation(); if ( resourceExportInterface == null ) { resourceExportInterface = getActiveJob(); } if ( resourceExportInterface == null ) { return; } String zipFilename = null; while ( Utils.isEmpty( zipFilename ) ) { FileDialog dialog = new FileDialog( shell, SWT.SAVE ); dialog.setText( BaseMessages.getString( PKG, STR ) ); dialog.setFilterExtensions( new String[] { STR, "*" } ); dialog.setFilterNames( new String[] { BaseMessages.getString( PKG, STR ), BaseMessages.getString( PKG, STR ), } ); setFilterPath( dialog ); if ( dialog.open() != null ) { lastDirOpened = dialog.getFilterPath(); zipFilename = dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName(); FileObject zipFileObject = KettleVFS.getFileObject( zipFilename ); if ( zipFileObject.exists() ) { MessageBox box = new MessageBox( shell, SWT.YES SWT.NO SWT.CANCEL ); box .setMessage( BaseMessages .getString( PKG, STR, zipFilename ) ); box.setText( BaseMessages.getString( PKG, STR ) ); int answer = box.open(); if ( answer == SWT.CANCEL ) { return; } if ( answer == SWT.NO ) { zipFilename = null; } } } else { return; } } ResourceUtil.serializeResourceExportInterface( zipFilename, resourceExportInterface, (VariableSpace) resourceExportInterface, rep, metaStore ); String message = ResourceUtil.getExplanation( zipFilename, topLevelResource.getResourceName(), resourceExportInterface ); EnterTextDialog enterTextDialog = new EnterTextDialog( shell, BaseMessages.getString( PKG, STR ), BaseMessages.getString( PKG, STR ), message ); enterTextDialog.setReadOnly(); enterTextDialog.open(); } catch ( Exception e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, STR ), BaseMessages.getString( PKG, STR ), e ); } } | /**
* Export this job or transformation including all depending resources to a single zip file.
*/ | Export this job or transformation including all depending resources to a single zip file | exportAllXMLFile | {
"repo_name": "flbrino/pentaho-kettle",
"path": "ui/src/main/java/org/pentaho/di/ui/spoon/Spoon.java",
"license": "apache-2.0",
"size": 353303
} | [
"org.apache.commons.vfs2.FileObject",
"org.eclipse.swt.widgets.FileDialog",
"org.eclipse.swt.widgets.MessageBox",
"org.pentaho.di.core.Const",
"org.pentaho.di.core.util.Utils",
"org.pentaho.di.core.variables.VariableSpace",
"org.pentaho.di.core.vfs.KettleVFS",
"org.pentaho.di.i18n.BaseMessages",
"org.pentaho.di.resource.ResourceExportInterface",
"org.pentaho.di.resource.ResourceUtil",
"org.pentaho.di.ui.core.dialog.EnterTextDialog",
"org.pentaho.di.ui.core.dialog.ErrorDialog"
]
| import org.apache.commons.vfs2.FileObject; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.MessageBox; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.resource.ResourceExportInterface; import org.pentaho.di.resource.ResourceUtil; import org.pentaho.di.ui.core.dialog.EnterTextDialog; import org.pentaho.di.ui.core.dialog.ErrorDialog; | import org.apache.commons.vfs2.*; import org.eclipse.swt.widgets.*; import org.pentaho.di.core.*; import org.pentaho.di.core.util.*; import org.pentaho.di.core.variables.*; import org.pentaho.di.core.vfs.*; import org.pentaho.di.i18n.*; import org.pentaho.di.resource.*; import org.pentaho.di.ui.core.dialog.*; | [
"org.apache.commons",
"org.eclipse.swt",
"org.pentaho.di"
]
| org.apache.commons; org.eclipse.swt; org.pentaho.di; | 1,833,104 |
@Incubating
ObjectFactory getObjects(); | ObjectFactory getObjects(); | /**
* Provides access to methods to create various kinds of model objects.
*
* @since 4.0
*/ | Provides access to methods to create various kinds of model objects | getObjects | {
"repo_name": "lsmaira/gradle",
"path": "subprojects/core-api/src/main/java/org/gradle/api/Project.java",
"license": "apache-2.0",
"size": 72230
} | [
"org.gradle.api.model.ObjectFactory"
]
| import org.gradle.api.model.ObjectFactory; | import org.gradle.api.model.*; | [
"org.gradle.api"
]
| org.gradle.api; | 2,646,065 |
public boolean avoidSerialExecutor(Operation op); | boolean function(Operation op); | /**
* Returns true if index maintenance has to potentially perform remote
* operations (e.g. global index maintenance, FK checks) for given operation,
* or a potentially expensive operation. This is used to switch the processor
* type to non-serial executor at GFE layer to avoid blocking the P2P reader
* thread.
*/ | Returns true if index maintenance has to potentially perform remote operations (e.g. global index maintenance, FK checks) for given operation, or a potentially expensive operation. This is used to switch the processor type to non-serial executor at GFE layer to avoid blocking the P2P reader thread | avoidSerialExecutor | {
"repo_name": "SnappyDataInc/snappy-store",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/IndexUpdater.java",
"license": "apache-2.0",
"size": 8107
} | [
"com.gemstone.gemfire.cache.Operation"
]
| import com.gemstone.gemfire.cache.Operation; | import com.gemstone.gemfire.cache.*; | [
"com.gemstone.gemfire"
]
| com.gemstone.gemfire; | 1,151,202 |
public static ConfigOption<Integer> fileSystemConnectionLimitIn(String scheme) {
return ConfigOptions.key("fs." + scheme + ".limit.input").defaultValue(-1);
} | static ConfigOption<Integer> function(String scheme) { return ConfigOptions.key("fs." + scheme + STR).defaultValue(-1); } | /**
* The total number of input connections that a file system for the given scheme may open.
* Unlimited be default.
*/ | The total number of input connections that a file system for the given scheme may open. Unlimited be default | fileSystemConnectionLimitIn | {
"repo_name": "gyfora/flink",
"path": "flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java",
"license": "apache-2.0",
"size": 17458
} | [
"org.apache.flink.configuration.ConfigOptions"
]
| import org.apache.flink.configuration.ConfigOptions; | import org.apache.flink.configuration.*; | [
"org.apache.flink"
]
| org.apache.flink; | 1,432,344 |
List<JSModule> createJsModules(
List<String> specs, List<String> jsFiles)
throws FlagUsageException, IOException {
if (isInTestMode()) {
return modulesSupplierForTesting.get();
}
Preconditions.checkState(specs != null);
Preconditions.checkState(!specs.isEmpty());
Preconditions.checkState(jsFiles != null);
final int totalNumJsFiles = jsFiles.size();
int nextJsFileIndex = 0;
Map<String, JSModule> modulesByName = Maps.newLinkedHashMap();
for (String spec : specs) {
// Format is "<name>:<num-js-files>[:[<dep>,...][:]]".
String[] parts = spec.split(":");
if (parts.length < 2 || parts.length > 4) {
throw new FlagUsageException("Expected 2-4 colon-delimited parts in "
+ "module spec: " + spec);
}
// Parse module name.
String name = parts[0];
checkModuleName(name);
if (modulesByName.containsKey(name)) {
throw new FlagUsageException("Duplicate module name: " + name);
}
JSModule module = new JSModule(name);
// Parse module inputs.
int numJsFiles = -1;
try {
numJsFiles = Integer.parseInt(parts[1]);
} catch (NumberFormatException ignored) {
numJsFiles = -1;
}
// We will allow modules of zero input.
if (numJsFiles < 0) {
throw new FlagUsageException("Invalid JS file count '" + parts[1]
+ "' for module: " + name);
}
if (nextJsFileIndex + numJsFiles > totalNumJsFiles) {
throw new FlagUsageException("Not enough JS files specified. Expected "
+ (nextJsFileIndex + numJsFiles - totalNumJsFiles)
+ " more in module:" + name);
}
List<String> moduleJsFiles =
jsFiles.subList(nextJsFileIndex, nextJsFileIndex + numJsFiles);
for (SourceFile input : createInputs(moduleJsFiles, false)) {
module.add(input);
}
nextJsFileIndex += numJsFiles;
if (parts.length > 2) {
// Parse module dependencies.
String depList = parts[2];
if (depList.length() > 0) {
String[] deps = depList.split(",");
for (String dep : deps) {
JSModule other = modulesByName.get(dep);
if (other == null) {
throw new FlagUsageException("Module '" + name
+ "' depends on unknown module '" + dep
+ "'. Be sure to list modules in dependency order.");
}
module.addDependency(other);
}
}
}
modulesByName.put(name, module);
}
if (nextJsFileIndex < totalNumJsFiles) {
throw new FlagUsageException("Too many JS files specified. Expected "
+ nextJsFileIndex + " but found " + totalNumJsFiles);
}
return Lists.newArrayList(modulesByName.values());
} | List<JSModule> createJsModules( List<String> specs, List<String> jsFiles) throws FlagUsageException, IOException { if (isInTestMode()) { return modulesSupplierForTesting.get(); } Preconditions.checkState(specs != null); Preconditions.checkState(!specs.isEmpty()); Preconditions.checkState(jsFiles != null); final int totalNumJsFiles = jsFiles.size(); int nextJsFileIndex = 0; Map<String, JSModule> modulesByName = Maps.newLinkedHashMap(); for (String spec : specs) { String[] parts = spec.split(":"); if (parts.length < 2 parts.length > 4) { throw new FlagUsageException(STR + STR + spec); } String name = parts[0]; checkModuleName(name); if (modulesByName.containsKey(name)) { throw new FlagUsageException(STR + name); } JSModule module = new JSModule(name); int numJsFiles = -1; try { numJsFiles = Integer.parseInt(parts[1]); } catch (NumberFormatException ignored) { numJsFiles = -1; } if (numJsFiles < 0) { throw new FlagUsageException(STR + parts[1] + STR + name); } if (nextJsFileIndex + numJsFiles > totalNumJsFiles) { throw new FlagUsageException(STR + (nextJsFileIndex + numJsFiles - totalNumJsFiles) + STR + name); } List<String> moduleJsFiles = jsFiles.subList(nextJsFileIndex, nextJsFileIndex + numJsFiles); for (SourceFile input : createInputs(moduleJsFiles, false)) { module.add(input); } nextJsFileIndex += numJsFiles; if (parts.length > 2) { String depList = parts[2]; if (depList.length() > 0) { String[] deps = depList.split(","); for (String dep : deps) { JSModule other = modulesByName.get(dep); if (other == null) { throw new FlagUsageException(STR + name + STR + dep + STR); } module.addDependency(other); } } } modulesByName.put(name, module); } if (nextJsFileIndex < totalNumJsFiles) { throw new FlagUsageException(STR + nextJsFileIndex + STR + totalNumJsFiles); } return Lists.newArrayList(modulesByName.values()); } | /**
* Creates module objects from a list of module specifications.
*
* @param specs A list of module specifications, not null or empty. The spec
* format is: <code>name:num-js-files[:[dep,...][:]]</code>. Module
* names must not contain the ':' character.
* @param jsFiles A list of JS file paths, not null
* @return An array of module objects
*/ | Creates module objects from a list of module specifications | createJsModules | {
"repo_name": "nicks/closure-compiler-old",
"path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java",
"license": "apache-2.0",
"size": 65803
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.Lists",
"com.google.common.collect.Maps",
"java.io.IOException",
"java.util.List",
"java.util.Map"
]
| import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import java.io.IOException; import java.util.List; import java.util.Map; | import com.google.common.base.*; import com.google.common.collect.*; import java.io.*; import java.util.*; | [
"com.google.common",
"java.io",
"java.util"
]
| com.google.common; java.io; java.util; | 965,944 |
final HibernateJpaVendorAdapter jpaEventVendorAdapter = new HibernateJpaVendorAdapter();
jpaEventVendorAdapter.setGenerateDdl(this.generateDdl);
jpaEventVendorAdapter.setShowSql(this.showSql);
return jpaEventVendorAdapter;
} | final HibernateJpaVendorAdapter jpaEventVendorAdapter = new HibernateJpaVendorAdapter(); jpaEventVendorAdapter.setGenerateDdl(this.generateDdl); jpaEventVendorAdapter.setShowSql(this.showSql); return jpaEventVendorAdapter; } | /**
* Jpa vendor adapter hibernate jpa vendor adapter.
*
* @return the hibernate jpa vendor adapter
*/ | Jpa vendor adapter hibernate jpa vendor adapter | jpaServiceVendorAdapter | {
"repo_name": "PetrGasparik/cas",
"path": "cas-server-support-jpa-service-registry/src/main/java/org/jasig/cas/config/JpaServiceRegistryConfiguration.java",
"license": "apache-2.0",
"size": 7001
} | [
"org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
]
| import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; | import org.springframework.orm.jpa.vendor.*; | [
"org.springframework.orm"
]
| org.springframework.orm; | 1,309,081 |
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<SqlStoredProcedureGetResultsInner> listSqlStoredProceduresAsync(
String resourceGroupName, String accountName, String databaseName, String containerName) {
return new PagedFlux<>(
() -> listSqlStoredProceduresSinglePageAsync(resourceGroupName, accountName, databaseName, containerName));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<SqlStoredProcedureGetResultsInner> function( String resourceGroupName, String accountName, String databaseName, String containerName) { return new PagedFlux<>( () -> listSqlStoredProceduresSinglePageAsync(resourceGroupName, accountName, databaseName, containerName)); } | /**
* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param databaseName Cosmos DB database name.
* @param containerName Cosmos DB container name.
* @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 List operation response, that contains the storedProcedures and their properties.
*/ | Lists the SQL storedProcedure under an existing Azure Cosmos DB database account | listSqlStoredProceduresAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/implementation/SqlResourcesClientImpl.java",
"license": "mit",
"size": 547809
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.cosmos.fluent.models.SqlStoredProcedureGetResultsInner"
]
| import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.cosmos.fluent.models.SqlStoredProcedureGetResultsInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.cosmos.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
]
| com.azure.core; com.azure.resourcemanager; | 1,839,520 |
public void onAuthenticationResult(String authToken) {
if ( DEBUG ) Log.d(TAG, "onAuthenticationResult(" + authToken + ")");
// Hide the progress dialog
hideProgress();
mAuthtoken = authToken;
if (authToken != null) {
if (!mConfirmCredentials) {
finishLogin();
Toast.makeText(this, "Logged in", Toast.LENGTH_LONG).show();
MainActivity.loginButton.setVisibility(View.GONE);
MainActivity.userLoggedInTextView.setText(getResources().getString(R.string.user_logged) + " " + mUsername);
MainActivity.userLoggedInTextView.setVisibility(View.VISIBLE);
// MainActivity.myBooksButton.setVisibility(View.VISIBLE);
} else {
finishConfirmCredentials(true);
}
} else {
Log.e(TAG, "onAuthenticationResult: failed to authenticate");
mMessage.setVisibility(View.VISIBLE);
mUsername=null;
Toast.makeText(this, KohaAuthHandler.auri, Toast.LENGTH_LONG).show();
if (mRequestNewAccount) {
// "Please enter a valid username/password.
mMessage
.setText(getText(R.string.auth_result_fail));
} else {
// "Please enter a valid password." (Used when the
// account is already in the database but the password
// doesn't work.)
mMessage
.setText(getText(R.string.auth_result_fail));
}
}
} | void function(String authToken) { if ( DEBUG ) Log.d(TAG, STR + authToken + ")"); hideProgress(); mAuthtoken = authToken; if (authToken != null) { if (!mConfirmCredentials) { finishLogin(); Toast.makeText(this, STR, Toast.LENGTH_LONG).show(); MainActivity.loginButton.setVisibility(View.GONE); MainActivity.userLoggedInTextView.setText(getResources().getString(R.string.user_logged) + " " + mUsername); MainActivity.userLoggedInTextView.setVisibility(View.VISIBLE); } else { finishConfirmCredentials(true); } } else { Log.e(TAG, STR); mMessage.setVisibility(View.VISIBLE); mUsername=null; Toast.makeText(this, KohaAuthHandler.auri, Toast.LENGTH_LONG).show(); if (mRequestNewAccount) { mMessage .setText(getText(R.string.auth_result_fail)); } else { mMessage .setText(getText(R.string.auth_result_fail)); } } } | /**
* Called when the authentication process completes (see attemptLogin()).
*/ | Called when the authentication process completes (see attemptLogin()) | onAuthenticationResult | {
"repo_name": "Dai-Nam-DNU/mhst2014",
"path": "test1-master/test1-master/AndroidOpac/src/edu/dnu/androidopac/authenticator/AuthenticatorActivity.java",
"license": "gpl-2.0",
"size": 10643
} | [
"android.util.Log",
"android.view.View",
"android.widget.Toast",
"edu.dnu.androidopac.MainActivity"
]
| import android.util.Log; import android.view.View; import android.widget.Toast; import edu.dnu.androidopac.MainActivity; | import android.util.*; import android.view.*; import android.widget.*; import edu.dnu.androidopac.*; | [
"android.util",
"android.view",
"android.widget",
"edu.dnu.androidopac"
]
| android.util; android.view; android.widget; edu.dnu.androidopac; | 2,393,731 |
void reconcile(ReconciliationCoordinator.Reconcile reconciliationRequest); | void reconcile(ReconciliationCoordinator.Reconcile reconciliationRequest); | /**
* Trigger reconciliation with the Mesos master.
*
* <p>Note: This method is a callback for the {@link TaskMonitor}.
*
* @param reconciliationRequest Message containing the tasks which shall be reconciled
*/ | Trigger reconciliation with the Mesos master. Note: This method is a callback for the <code>TaskMonitor</code> | reconcile | {
"repo_name": "rmetzger/flink",
"path": "flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/MesosResourceManagerActions.java",
"license": "apache-2.0",
"size": 2417
} | [
"org.apache.flink.mesos.scheduler.ReconciliationCoordinator"
]
| import org.apache.flink.mesos.scheduler.ReconciliationCoordinator; | import org.apache.flink.mesos.scheduler.*; | [
"org.apache.flink"
]
| org.apache.flink; | 2,507,534 |
@Override
public void deleteCliente(int id) {
Object record = hibernateTemplate.load(Cliente.class, id);
hibernateTemplate.delete(record);
}
| void function(int id) { Object record = hibernateTemplate.load(Cliente.class, id); hibernateTemplate.delete(record); } | /**
* Delete a Cliente with the id passed as parameter
*
* @param id
*/ | Delete a Cliente with the id passed as parameter | deleteCliente | {
"repo_name": "osmaroi/touchBar",
"path": "touchbar/src/es/bootools/touchbar/dao/ClienteDAO.java",
"license": "gpl-3.0",
"size": 2876
} | [
"es.bootools.touchbar.model.Cliente"
]
| import es.bootools.touchbar.model.Cliente; | import es.bootools.touchbar.model.*; | [
"es.bootools.touchbar"
]
| es.bootools.touchbar; | 726,932 |
private void saveAuthenticationXML(String path,
SourceParameters parameters,
SourceResolver resolver)
throws ProcessingException {
String authSaveResource = this.handler.getHandlerConfiguration().getSaveResource();
SourceParameters authSaveResourceParameters = this.handler.getHandlerConfiguration().getSaveResourceParameters();
if (authSaveResource == null) {
throw new ProcessingException("The context " + this.name + " does not support saving.");
}
synchronized(this.authContext) {
DocumentFragment fragment = this.getXML(path);
if (fragment == null) {
// create empty fake fragment
fragment = DOMUtil.createDocument().createDocumentFragment();
}
if (parameters != null) {
parameters = (SourceParameters)parameters.clone();
parameters.add(authSaveResourceParameters);
} else if (authSaveResourceParameters != null) {
parameters = (SourceParameters)authSaveResourceParameters.clone();
}
parameters = this.createParameters(parameters,
path,
false);
XMLUtil.writeDOM(authSaveResource,
null,
parameters,
fragment,
resolver,
"xml");
} // end synchronized
} | void function(String path, SourceParameters parameters, SourceResolver resolver) throws ProcessingException { String authSaveResource = this.handler.getHandlerConfiguration().getSaveResource(); SourceParameters authSaveResourceParameters = this.handler.getHandlerConfiguration().getSaveResourceParameters(); if (authSaveResource == null) { throw new ProcessingException(STR + this.name + STR); } synchronized(this.authContext) { DocumentFragment fragment = this.getXML(path); if (fragment == null) { fragment = DOMUtil.createDocument().createDocumentFragment(); } if (parameters != null) { parameters = (SourceParameters)parameters.clone(); parameters.add(authSaveResourceParameters); } else if (authSaveResourceParameters != null) { parameters = (SourceParameters)authSaveResourceParameters.clone(); } parameters = this.createParameters(parameters, path, false); XMLUtil.writeDOM(authSaveResource, null, parameters, fragment, resolver, "xml"); } } | /**
* Save Authentication
*/ | Save Authentication | saveAuthenticationXML | {
"repo_name": "apache/cocoon",
"path": "blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/context/AuthenticationContext.java",
"license": "apache-2.0",
"size": 34738
} | [
"org.apache.cocoon.ProcessingException",
"org.apache.cocoon.webapps.session.xml.XMLUtil",
"org.apache.cocoon.xml.dom.DOMUtil",
"org.apache.excalibur.source.SourceParameters",
"org.apache.excalibur.source.SourceResolver",
"org.w3c.dom.DocumentFragment"
]
| import org.apache.cocoon.ProcessingException; import org.apache.cocoon.webapps.session.xml.XMLUtil; import org.apache.cocoon.xml.dom.DOMUtil; import org.apache.excalibur.source.SourceParameters; import org.apache.excalibur.source.SourceResolver; import org.w3c.dom.DocumentFragment; | import org.apache.cocoon.*; import org.apache.cocoon.webapps.session.xml.*; import org.apache.cocoon.xml.dom.*; import org.apache.excalibur.source.*; import org.w3c.dom.*; | [
"org.apache.cocoon",
"org.apache.excalibur",
"org.w3c.dom"
]
| org.apache.cocoon; org.apache.excalibur; org.w3c.dom; | 424,787 |
if (_titleLabel == null) {
BoxPanel panel = new BoxPanel(BoxPanel.X_AXIS);
_titleLabel = new JLabel(title);
panel.add(_titleLabel);
panel.add(Box.createHorizontalGlue());
add(panel);
} else {
_titleLabel.setText(title);
}
} | if (_titleLabel == null) { BoxPanel panel = new BoxPanel(BoxPanel.X_AXIS); _titleLabel = new JLabel(title); panel.add(_titleLabel); panel.add(Box.createHorizontalGlue()); add(panel); } else { _titleLabel.setText(title); } } | /**
* Sets the title for the <tt>PaddedPanel</tt>.
*
* @param title the title to add
*/ | Sets the title for the PaddedPanel | setTitle | {
"repo_name": "gubatron/frostwire-desktop",
"path": "src/com/limegroup/gnutella/gui/PaddedPanel.java",
"license": "gpl-3.0",
"size": 2680
} | [
"javax.swing.Box",
"javax.swing.JLabel"
]
| import javax.swing.Box; import javax.swing.JLabel; | import javax.swing.*; | [
"javax.swing"
]
| javax.swing; | 550,888 |
public static <E> Map<E, Boolean> getChangeMapFromSets(Set<E> oldSet, Set<E> newSet) {
Map<E, Boolean> changeMap = new HashMap<>();
Set<E> additions = new HashSet<>(newSet);
additions.removeAll(oldSet);
Set<E> removals = new HashSet<>(oldSet);
removals.removeAll(newSet);
for (E s : additions) {
changeMap.put(s, true);
}
for (E s : removals) {
changeMap.put(s, false);
}
return changeMap;
} | static <E> Map<E, Boolean> function(Set<E> oldSet, Set<E> newSet) { Map<E, Boolean> changeMap = new HashMap<>(); Set<E> additions = new HashSet<>(newSet); additions.removeAll(oldSet); Set<E> removals = new HashSet<>(oldSet); removals.removeAll(newSet); for (E s : additions) { changeMap.put(s, true); } for (E s : removals) { changeMap.put(s, false); } return changeMap; } | /**
* Compares two <code>Sets</code> and returns a <code>Map</code> of elements not contained in both
* <code>Sets</code>. Elements contained in <code>oldSet</code> but not in <code>newSet</code> will be marked
* <code>false</code> in the returned map; the converse will be marked <code>true</code>.
* @param oldSet the older of the two <code>Sets</code>
* @param newSet the newer of the two <code>Sets</code>
* @param <E> type of element stored in the <code>Sets</code>
* @return a <code>Map</code> containing the difference between <code>oldSet</code> and <code>newSet</code>, and whether the
* element was added (<code>true</code>) or removed (<code>false</code>) in <code>newSet</code>
*/ | Compares two <code>Sets</code> and returns a <code>Map</code> of elements not contained in both <code>Sets</code>. Elements contained in <code>oldSet</code> but not in <code>newSet</code> will be marked <code>false</code> in the returned map; the converse will be marked <code>true</code> | getChangeMapFromSets | {
"repo_name": "huclengyue/LeanoteAndroid",
"path": "app/src/main/java/com/apkdv/leanote/utils/HtmlUtils.java",
"license": "gpl-3.0",
"size": 6929
} | [
"java.util.HashMap",
"java.util.HashSet",
"java.util.Map",
"java.util.Set"
]
| import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; | import java.util.*; | [
"java.util"
]
| java.util; | 2,347,402 |
public static Set<String> getKeyStoreFilenameExtensions()
{
HashSet<String> exts = new HashSet<>();
for (KeyStoreType ksType : values())
{
exts.addAll(ksType.getFilenameExtensions());
}
return exts;
} | static Set<String> function() { HashSet<String> exts = new HashSet<>(); for (KeyStoreType ksType : values()) { exts.addAll(ksType.getFilenameExtensions()); } return exts; } | /**
* Get set of all known keystore filename extensions.
*/ | Get set of all known keystore filename extensions | getKeyStoreFilenameExtensions | {
"repo_name": "gavioto/portecle",
"path": "src/main/net/sf/portecle/crypto/KeyStoreType.java",
"license": "gpl-2.0",
"size": 5328
} | [
"java.util.HashSet",
"java.util.Set"
]
| import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
]
| java.util; | 2,695,747 |
List<String> getColumnNames(); | List<String> getColumnNames(); | /**
* Gets column names.
*
* @return the column names
*/ | Gets column names | getColumnNames | {
"repo_name": "metatron-app/metatron-discovery",
"path": "discovery-common/src/main/java/app/metatron/discovery/common/data/projection/DataGrid.java",
"license": "apache-2.0",
"size": 1378
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 2,319,025 |
private void moveFileIfExists( Path fileToMove, Path directory )
throws ProxyException
{
if ( fileToMove != null && Files.exists(fileToMove) )
{
Path newLocation = directory.resolve(fileToMove.getFileName());
moveTempToTarget( fileToMove, newLocation );
}
} | void function( Path fileToMove, Path directory ) throws ProxyException { if ( fileToMove != null && Files.exists(fileToMove) ) { Path newLocation = directory.resolve(fileToMove.getFileName()); moveTempToTarget( fileToMove, newLocation ); } } | /**
* Moves the file into repository location if it exists
*
* @param fileToMove this could be either the main artifact, sha1 or md5 checksum file.
* @param directory directory to write files to
*/ | Moves the file into repository location if it exists | moveFileIfExists | {
"repo_name": "olamy/archiva",
"path": "archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java",
"license": "apache-2.0",
"size": 54447
} | [
"java.nio.file.Files",
"java.nio.file.Path"
]
| import java.nio.file.Files; import java.nio.file.Path; | import java.nio.file.*; | [
"java.nio"
]
| java.nio; | 2,744,256 |
public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
List<Item> items = new ArrayList<Item>(itemIds.size());
for (String id : itemIds)
{
items.add(new Item(id));
}
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
con.createPacketCollectorAndSend(request).nextResultOrThrow();
} | void function(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { List<Item> items = new ArrayList<Item>(itemIds.size()); for (String id : itemIds) { items.add(new Item(id)); } PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items)); con.createPacketCollectorAndSend(request).nextResultOrThrow(); } | /**
* Delete the items with the specified id's from the node.
*
* @param itemIds The list of id's of items to delete
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
* @throws InterruptedException
*/ | Delete the items with the specified id's from the node | deleteItem | {
"repo_name": "opg7371/Smack",
"path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java",
"license": "apache-2.0",
"size": 15225
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"org.jivesoftware.smack.SmackException",
"org.jivesoftware.smack.XMPPException",
"org.jivesoftware.smack.packet.IQ",
"org.jivesoftware.smackx.pubsub.packet.PubSub"
]
| import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smackx.pubsub.packet.PubSub; | import java.util.*; import org.jivesoftware.smack.*; import org.jivesoftware.smack.packet.*; import org.jivesoftware.smackx.pubsub.packet.*; | [
"java.util",
"org.jivesoftware.smack",
"org.jivesoftware.smackx"
]
| java.util; org.jivesoftware.smack; org.jivesoftware.smackx; | 1,133,065 |
@Override
protected void before() throws Throwable {
serverName = UUID.randomUUID().toString();
serviceRegistry = new MutableHandlerRegistry();
InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(serverName)
.fallbackHandlerRegistry(serviceRegistry);
if (useDirectExecutor) {
serverBuilder.directExecutor();
}
server = serverBuilder.build().start();
InProcessChannelBuilder channelBuilder = InProcessChannelBuilder.forName(serverName);
if (useDirectExecutor) {
channelBuilder.directExecutor();
}
channel = channelBuilder.build();
} | void function() throws Throwable { serverName = UUID.randomUUID().toString(); serviceRegistry = new MutableHandlerRegistry(); InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(serverName) .fallbackHandlerRegistry(serviceRegistry); if (useDirectExecutor) { serverBuilder.directExecutor(); } server = serverBuilder.build().start(); InProcessChannelBuilder channelBuilder = InProcessChannelBuilder.forName(serverName); if (useDirectExecutor) { channelBuilder.directExecutor(); } channel = channelBuilder.build(); } | /**
* Before the test has started, create the server and channel.
*/ | Before the test has started, create the server and channel | before | {
"repo_name": "nmittler/grpc-java",
"path": "testing/src/main/java/io/grpc/testing/GrpcServerRule.java",
"license": "bsd-3-clause",
"size": 5035
} | [
"io.grpc.inprocess.InProcessChannelBuilder",
"io.grpc.inprocess.InProcessServerBuilder",
"io.grpc.util.MutableHandlerRegistry",
"java.util.UUID"
]
| import io.grpc.inprocess.InProcessChannelBuilder; import io.grpc.inprocess.InProcessServerBuilder; import io.grpc.util.MutableHandlerRegistry; import java.util.UUID; | import io.grpc.inprocess.*; import io.grpc.util.*; import java.util.*; | [
"io.grpc.inprocess",
"io.grpc.util",
"java.util"
]
| io.grpc.inprocess; io.grpc.util; java.util; | 1,714,224 |
EClass getNullWidgetTransformer(); | EClass getNullWidgetTransformer(); | /**
* Returns the meta object for class '{@link com.odcgroup.page.transformmodel.NullWidgetTransformer <em>Null Widget Transformer</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Null Widget Transformer</em>'.
* @see com.odcgroup.page.transformmodel.NullWidgetTransformer
* @generated
*/ | Returns the meta object for class '<code>com.odcgroup.page.transformmodel.NullWidgetTransformer Null Widget Transformer</code>'. | getNullWidgetTransformer | {
"repo_name": "debabratahazra/DS",
"path": "designstudio/components/page/core/com.odcgroup.page.transformmodel/src/generated/java/com/odcgroup/page/transformmodel/TransformModelPackage.java",
"license": "epl-1.0",
"size": 69832
} | [
"org.eclipse.emf.ecore.EClass"
]
| import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
]
| org.eclipse.emf; | 1,975,676 |
public Node setNamedItemNS(Node arg) {
return setNamedItem(arg);
} | Node function(Node arg) { return setNamedItem(arg); } | /**
* Equivalent to <code>setNamedItem(arg)</code>.
*/ | Equivalent to <code>setNamedItem(arg)</code> | setNamedItemNS | {
"repo_name": "andreagenso/java2scala",
"path": "test/J2s/java/openjdk-6-src-b27/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java",
"license": "apache-2.0",
"size": 29864
} | [
"org.w3c.dom.Node"
]
| import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
]
| org.w3c.dom; | 832,726 |
//----------------- Public methods.
public void init(FilterConfig config) throws ServletException {
this.config = config;
if (config.getInitParameter("debug") != null) {
debug = Integer.parseInt(config.getInitParameter("debug"));
}
if (config.getInitParameter("contentType") != null) {
contentTypeRegEx = Pattern.compile(config.getInitParameter("contentType"));
} else {
contentTypeRegEx = shtmlRegEx;
}
isVirtualWebappRelative =
Boolean.parseBoolean(config.getInitParameter("isVirtualWebappRelative"));
if (config.getInitParameter("expires") != null)
expires = Long.valueOf(config.getInitParameter("expires"));
if (debug > 0)
config.getServletContext().log(
"SSIFilter.init() SSI invoker started with 'debug'=" + debug);
} | void function(FilterConfig config) throws ServletException { this.config = config; if (config.getInitParameter("debug") != null) { debug = Integer.parseInt(config.getInitParameter("debug")); } if (config.getInitParameter(STR) != null) { contentTypeRegEx = Pattern.compile(config.getInitParameter(STR)); } else { contentTypeRegEx = shtmlRegEx; } isVirtualWebappRelative = Boolean.parseBoolean(config.getInitParameter(STR)); if (config.getInitParameter(STR) != null) expires = Long.valueOf(config.getInitParameter(STR)); if (debug > 0) config.getServletContext().log( STR + debug); } | /**
* Initialize this servlet.
*
* @exception ServletException
* if an error occurs
*/ | Initialize this servlet | init | {
"repo_name": "plumer/codana",
"path": "tomcat_files/7.0.0/SSIFilter.java",
"license": "mit",
"size": 6828
} | [
"java.util.regex.Pattern",
"javax.servlet.FilterConfig",
"javax.servlet.ServletException"
]
| import java.util.regex.Pattern; import javax.servlet.FilterConfig; import javax.servlet.ServletException; | import java.util.regex.*; import javax.servlet.*; | [
"java.util",
"javax.servlet"
]
| java.util; javax.servlet; | 1,304,882 |
private ResultSet getColumnsMetaData( String schema, String table ) throws KettleDatabaseException {
ResultSet columns = null;
if ( getDatabaseMetaData() == null ) {
throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetDbMeta" ) );
}
try {
columns = getDatabaseMetaData().getColumns( null, schema, table, null );
} catch ( SQLException e ) {
throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetTableNames" ), e );
}
if ( columns == null ) {
throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetTableNames" ) );
}
return columns;
} | ResultSet function( String schema, String table ) throws KettleDatabaseException { ResultSet columns = null; if ( getDatabaseMetaData() == null ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, STR ) ); } try { columns = getDatabaseMetaData().getColumns( null, schema, table, null ); } catch ( SQLException e ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, STR ), e ); } if ( columns == null ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, STR ) ); } return columns; } | /**
* Retrieves the columns metadata matching the schema and table name.
*
* @param schema the schema name pattern
* @param table the table name pattern
* @return columns description row set
* @throws KettleDatabaseException if DatabaseMetaData is null or some database error occurs
*/ | Retrieves the columns metadata matching the schema and table name | getColumnsMetaData | {
"repo_name": "kurtwalker/pentaho-kettle",
"path": "core/src/main/java/org/pentaho/di/core/database/Database.java",
"license": "apache-2.0",
"size": 180922
} | [
"java.sql.ResultSet",
"java.sql.SQLException",
"org.pentaho.di.core.exception.KettleDatabaseException",
"org.pentaho.di.i18n.BaseMessages"
]
| import java.sql.ResultSet; import java.sql.SQLException; import org.pentaho.di.core.exception.KettleDatabaseException; import org.pentaho.di.i18n.BaseMessages; | import java.sql.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.i18n.*; | [
"java.sql",
"org.pentaho.di"
]
| java.sql; org.pentaho.di; | 1,655,437 |
public List<Changeset> getChangesets(Integer repositoryId, Integer page, Integer perPage, String orderField, String order) {
URLBuilder url = new URLBuilder(host, "/api/changesets/repository.xml")
.addFieldValuePair("repository_id", repositoryId)
.addFieldValuePair("page", page)
.addFieldValuePair("per_page", perPage)
.addFieldValuePair("order_field", orderField)
.addFieldValuePair("order", order);
InputStream httpStream = httpConnection.doGet(url.toURL());
return resourceFactory.buildChangesets(httpStream);
} | List<Changeset> function(Integer repositoryId, Integer page, Integer perPage, String orderField, String order) { URLBuilder url = new URLBuilder(host, STR) .addFieldValuePair(STR, repositoryId) .addFieldValuePair("page", page) .addFieldValuePair(STR, perPage) .addFieldValuePair(STR, orderField) .addFieldValuePair("order", order); InputStream httpStream = httpConnection.doGet(url.toURL()); return resourceFactory.buildChangesets(httpStream); } | /**
* Find all changesets for a specific repository
*
* @param repositoryId
* @param page
* @param perPage
* @param orderField
* @param order
* @return
*/ | Find all changesets for a specific repository | getChangesets | {
"repo_name": "raupachz/raupach-me.com",
"path": "src/main/java/org/beanstalk4j/BeanstalkApi.java",
"license": "apache-2.0",
"size": 38736
} | [
"java.io.InputStream",
"java.util.List",
"org.beanstalk4j.http.URLBuilder",
"org.beanstalk4j.model.Changeset"
]
| import java.io.InputStream; import java.util.List; import org.beanstalk4j.http.URLBuilder; import org.beanstalk4j.model.Changeset; | import java.io.*; import java.util.*; import org.beanstalk4j.http.*; import org.beanstalk4j.model.*; | [
"java.io",
"java.util",
"org.beanstalk4j.http",
"org.beanstalk4j.model"
]
| java.io; java.util; org.beanstalk4j.http; org.beanstalk4j.model; | 1,105,845 |
if (isBeforeFirst() || isAfterLast())
return null;
Component component = new Component();
long id = getLong(getColumnIndex(S.COLUMN_COMPONENTS_ID));
int quantity = getInt(getColumnIndex(S.COLUMN_COMPONENTS_QUANTITY));
String ctype = getString(getColumnIndex(S.COLUMN_COMPONENTS_TYPE));
component.setId(id);
component.setQuantity(quantity);
component.setType(ctype);
// Get the created Item
Item created = new Item();
long itemId1 = getLong(getColumnIndex(S.COLUMN_COMPONENTS_CREATED_ITEM_ID));
String itemName1 = getString(getColumnIndex("cr" + S.COLUMN_ITEMS_NAME));
// String jpnName = getString(getColumnIndex(S.COLUMN_ITEMS_JPN_NAME));
String type1 = getString(getColumnIndex("cr" + S.COLUMN_ITEMS_TYPE));
int rarity1 = getInt(getColumnIndex("cr" + S.COLUMN_ITEMS_RARITY));
// int carry_capacity = getInt(getColumnIndex(S.COLUMN_ITEMS_CARRY_CAPACITY));
// int buy = getInt(getColumnIndex(S.COLUMN_ITEMS_BUY));
// int sell = getInt(getColumnIndex(S.COLUMN_ITEMS_SELL));
// String description = getString(getColumnIndex(S.COLUMN_ITEMS_DESCRIPTION));
String fileLocation1 = getString(getColumnIndex("cr" + S.COLUMN_ITEMS_ICON_NAME));
// String armor_dupe_name_fix = getString(getColumnIndex(S.COLUMN_ITEMS_ARMOR_DUPE_NAME_FIX))
String subtype = getString(getColumnIndex("cr" + S.COLUMN_ITEMS_SUB_TYPE));
created.setId(itemId1);
created.setName(itemName1);
created.setSubType(subtype);
// created.setJpnName(jpnName);
created.setType(type1);
created.setRarity(rarity1);
// created.setCarryCapacity(carry_capacity);
// created.setBuy(buy);
// created.setSell(sell);
// created.setDescription(description);
created.setFileLocation(fileLocation1);
// created.setArmorDupeNameFix(armor_dupe_name_fix);
component.setCreated(created);
// Get the component Item
Item comp = new Item();
long itemId2 = getLong(getColumnIndex(S.COLUMN_COMPONENTS_COMPONENT_ITEM_ID));
String itemName2 = getString(getColumnIndex("co" + S.COLUMN_ITEMS_NAME));
String itemType2 = getString(getColumnIndex("co" + S.COLUMN_ITEMS_TYPE));
// String jpnName = getString(getColumnIndex(S.COLUMN_ITEMS_JPN_NAME));
// String type = getString(getColumnIndex(S.COLUMN_ITEMS_TYPE));
int rarity2 = getInt(getColumnIndex("co" + S.COLUMN_ITEMS_RARITY));
// int carry_capacity = getInt(getColumnIndex(S.COLUMN_ITEMS_CARRY_CAPACITY));
// int buy = getInt(getColumnIndex(S.COLUMN_ITEMS_BUY));
// int sell = getInt(getColumnIndex(S.COLUMN_ITEMS_SELL));
// String description = getString(getColumnIndex(S.COLUMN_ITEMS_DESCRIPTION));
String fileLocation2 = getString(getColumnIndex("co" + S.COLUMN_ITEMS_ICON_NAME));
// String armor_dupe_name_fix = getString(getColumnIndex(S.COLUMN_ITEMS_ARMOR_DUPE_NAME_FIX));
String subtype2 = getString(getColumnIndex("co" + S.COLUMN_ITEMS_SUB_TYPE));
comp.setId(itemId2);
comp.setName(itemName2);
comp.setSubType(subtype2);
comp.setRarity(rarity2);
comp.setType(itemType2);
// comp.setJpnName(jpnName);
// comp.setType(type);
// comp.setRarity(rarity2);
// comp.setCarryCapacity(carry_capacity);
// comp.setBuy(buy);
// comp.setSell(sell);
// comp.setDescription(description);
comp.setFileLocation(fileLocation2);
// comp.setArmorDupeNameFix(armor_dupe_name_fix);
component.setComponent(comp);
return component;
} | if (isBeforeFirst() isAfterLast()) return null; Component component = new Component(); long id = getLong(getColumnIndex(S.COLUMN_COMPONENTS_ID)); int quantity = getInt(getColumnIndex(S.COLUMN_COMPONENTS_QUANTITY)); String ctype = getString(getColumnIndex(S.COLUMN_COMPONENTS_TYPE)); component.setId(id); component.setQuantity(quantity); component.setType(ctype); Item created = new Item(); long itemId1 = getLong(getColumnIndex(S.COLUMN_COMPONENTS_CREATED_ITEM_ID)); String itemName1 = getString(getColumnIndex("cr" + S.COLUMN_ITEMS_NAME)); String type1 = getString(getColumnIndex("cr" + S.COLUMN_ITEMS_TYPE)); int rarity1 = getInt(getColumnIndex("cr" + S.COLUMN_ITEMS_RARITY)); String fileLocation1 = getString(getColumnIndex("cr" + S.COLUMN_ITEMS_ICON_NAME)); String subtype = getString(getColumnIndex("cr" + S.COLUMN_ITEMS_SUB_TYPE)); created.setId(itemId1); created.setName(itemName1); created.setSubType(subtype); created.setType(type1); created.setRarity(rarity1); created.setFileLocation(fileLocation1); component.setCreated(created); Item comp = new Item(); long itemId2 = getLong(getColumnIndex(S.COLUMN_COMPONENTS_COMPONENT_ITEM_ID)); String itemName2 = getString(getColumnIndex("co" + S.COLUMN_ITEMS_NAME)); String itemType2 = getString(getColumnIndex("co" + S.COLUMN_ITEMS_TYPE)); int rarity2 = getInt(getColumnIndex("co" + S.COLUMN_ITEMS_RARITY)); String fileLocation2 = getString(getColumnIndex("co" + S.COLUMN_ITEMS_ICON_NAME)); String subtype2 = getString(getColumnIndex("co" + S.COLUMN_ITEMS_SUB_TYPE)); comp.setId(itemId2); comp.setName(itemName2); comp.setSubType(subtype2); comp.setRarity(rarity2); comp.setType(itemType2); comp.setFileLocation(fileLocation2); component.setComponent(comp); return component; } | /**
* Returns a Component object configured for the current row, or null if the
* current row is invalid.
*/ | Returns a Component object configured for the current row, or null if the current row is invalid | getComponent | {
"repo_name": "jaysonthepirate/MHGenDatabase",
"path": "app/src/main/java/com/ghstudios/android/data/database/ComponentCursor.java",
"license": "mit",
"size": 4240
} | [
"com.ghstudios.android.data.classes.Component",
"com.ghstudios.android.data.classes.Item"
]
| import com.ghstudios.android.data.classes.Component; import com.ghstudios.android.data.classes.Item; | import com.ghstudios.android.data.classes.*; | [
"com.ghstudios.android"
]
| com.ghstudios.android; | 2,754,253 |
@Test()
public void testFormatSearchResultEntryWithAttributesWithoutValues()
throws Exception
{
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final LDAPSearch ldapSearch =
new LDAPSearch(outputStream, outputStream);
final List<String> requestedAttributes = Arrays.asList("objectClass", "uid",
"givenName", "sn", "undefined", "mail");
final ColumnFormatterLDAPSearchOutputHandler outputHandler =
new ColumnFormatterLDAPSearchOutputHandler(ldapSearch,
OutputFormat.TAB_DELIMITED_TEXT, requestedAttributes,
Integer.MAX_VALUE, false);
outputHandler.formatSearchResultEntry(new SearchResultEntry(new Entry(
"dn: uid=jdoe,ou=People,dc=example,dc=com",
"objectClass: ",
"uid: ",
"givenName: ",
"sn: ",
"cn: ",
"mail: ")));
assertEquals(
getOutputLines(outputStream),
Collections.singletonList(
"uid=jdoe,ou=People,dc=example,dc=com\t\t\t\t\t\t"));
} | @Test() void function() throws Exception { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final LDAPSearch ldapSearch = new LDAPSearch(outputStream, outputStream); final List<String> requestedAttributes = Arrays.asList(STR, "uid", STR, "sn", STR, "mail"); final ColumnFormatterLDAPSearchOutputHandler outputHandler = new ColumnFormatterLDAPSearchOutputHandler(ldapSearch, OutputFormat.TAB_DELIMITED_TEXT, requestedAttributes, Integer.MAX_VALUE, false); outputHandler.formatSearchResultEntry(new SearchResultEntry(new Entry( STR, STR, STR, STR, STR, STR, STR))); assertEquals( getOutputLines(outputStream), Collections.singletonList( STR)); } | /**
* Tests the behavior of the {@code formatSearchResultEntry} method for an
* entry that has attributes without values.
*
* @throws Exception If an unexpected problem occurs.
*/ | Tests the behavior of the formatSearchResultEntry method for an entry that has attributes without values | testFormatSearchResultEntryWithAttributesWithoutValues | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/tools/TabDelimitedLDAPSearchOutputHandlerTestCase.java",
"license": "gpl-2.0",
"size": 18369
} | [
"com.unboundid.ldap.sdk.Entry",
"com.unboundid.ldap.sdk.SearchResultEntry",
"com.unboundid.util.OutputFormat",
"java.io.ByteArrayOutputStream",
"java.util.Arrays",
"java.util.Collections",
"java.util.List",
"org.testng.annotations.Test"
]
| import com.unboundid.ldap.sdk.Entry; import com.unboundid.ldap.sdk.SearchResultEntry; import com.unboundid.util.OutputFormat; import java.io.ByteArrayOutputStream; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.testng.annotations.Test; | import com.unboundid.ldap.sdk.*; import com.unboundid.util.*; import java.io.*; import java.util.*; import org.testng.annotations.*; | [
"com.unboundid.ldap",
"com.unboundid.util",
"java.io",
"java.util",
"org.testng.annotations"
]
| com.unboundid.ldap; com.unboundid.util; java.io; java.util; org.testng.annotations; | 2,740,143 |
@SuppressWarnings("unchecked")
private static List<Palette> getSavedColorPalettes(SharedPreferences sharedPreferences) {
final String jsonColorPalettes = sharedPreferences.getString(KEY_SAVED_COLOR_PALETTES, "");
// No saved colors were found.
// Return an empty list.
if ("".equals(jsonColorPalettes)) {
return Collections.EMPTY_LIST;
}
// Parse the json into colorItems.
final List<Palette> palettes = GSON.fromJson(jsonColorPalettes, COLOR_PALETTE_LIST_TYPE);
// Sort the color items chronologically.
Collections.sort(palettes, CHRONOLOGICAL_COMPARATOR);
return palettes;
}
// Non instantiability.
private Palettes() {
} | @SuppressWarnings(STR) static List<Palette> function(SharedPreferences sharedPreferences) { final String jsonColorPalettes = sharedPreferences.getString(KEY_SAVED_COLOR_PALETTES, STR".equals(jsonColorPalettes)) { return Collections.EMPTY_LIST; } final List<Palette> palettes = GSON.fromJson(jsonColorPalettes, COLOR_PALETTE_LIST_TYPE); Collections.sort(palettes, CHRONOLOGICAL_COMPARATOR); return palettes; } private Palettes() { } | /**
* Get the {@link Palette}s of the user.
*
* @param sharedPreferences a {@link android.content.SharedPreferences} from which the {@link Palette}s will be retrieved.
* @return a {@link java.util.List} of {@link Palette}s.
*/ | Get the <code>Palette</code>s of the user | getSavedColorPalettes | {
"repo_name": "Learn-Android-app/CameraColorPicker",
"path": "CameraColorPicker/app/src/main/java/fr/tvbarthel/apps/cameracolorpicker/data/Palettes.java",
"license": "apache-2.0",
"size": 7601
} | [
"android.content.SharedPreferences",
"java.util.Collections",
"java.util.List"
]
| import android.content.SharedPreferences; import java.util.Collections; import java.util.List; | import android.content.*; import java.util.*; | [
"android.content",
"java.util"
]
| android.content; java.util; | 2,063,105 |
@Override
public Iterator<OBJECT> iterator() {
return this.map.values().iterator();
} | Iterator<OBJECT> function() { return this.map.values().iterator(); } | /**
* Returns the iterator for registered objects.
*/ | Returns the iterator for registered objects | iterator | {
"repo_name": "SHAF-WORK/shaf",
"path": "core/src/main/java/org/shaf/core/util/Repository.java",
"license": "apache-2.0",
"size": 4216
} | [
"java.util.Iterator"
]
| import java.util.Iterator; | import java.util.*; | [
"java.util"
]
| java.util; | 2,552,821 |
private static List<MediaType> getSortedProviderConsumeTypes(MessageBodyReader<?> mbr, Map<MessageBodyReader<?>, List<MediaType>> cache) {
List<MediaType> mediaTypes = cache.get(mbr);
if (mediaTypes == null) {
mediaTypes = JAXRSUtils.getProviderConsumeTypes(mbr);
// sort here before putting in the cache to avoid ConcurrentModificationException
mediaTypes = JAXRSUtils.sortMediaTypes(mediaTypes, null);
cache.put(mbr, mediaTypes);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getSortedProviderConsumeTypes - cache miss - caching " + mbr + " = " + mediaTypes);
}
}
return mediaTypes;
} | static List<MediaType> function(MessageBodyReader<?> mbr, Map<MessageBodyReader<?>, List<MediaType>> cache) { List<MediaType> mediaTypes = cache.get(mbr); if (mediaTypes == null) { mediaTypes = JAXRSUtils.getProviderConsumeTypes(mbr); mediaTypes = JAXRSUtils.sortMediaTypes(mediaTypes, null); cache.put(mbr, mediaTypes); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR + mbr + STR + mediaTypes); } } return mediaTypes; } | /**
* This method attempts to optimize performance by checking a cache of known MessageBodyReaders's media types,
* rather than calculating the media types for every provider on every request. If there is a cache miss, we
* will look up the media types by calling JAXRSUtils.getProviderConsumeTypes(mbr).
*/ | This method attempts to optimize performance by checking a cache of known MessageBodyReaders's media types, rather than calculating the media types for every provider on every request. If there is a cache miss, we will look up the media types by calling JAXRSUtils.getProviderConsumeTypes(mbr) | getSortedProviderConsumeTypes | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/provider/ProviderFactory.java",
"license": "epl-1.0",
"size": 81944
} | [
"com.ibm.websphere.ras.Tr",
"com.ibm.websphere.ras.TraceComponent",
"java.util.List",
"java.util.Map",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.ext.MessageBodyReader",
"org.apache.cxf.jaxrs.utils.JAXRSUtils"
]
| import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent; import java.util.List; import java.util.Map; import javax.ws.rs.core.MediaType; import javax.ws.rs.ext.MessageBodyReader; import org.apache.cxf.jaxrs.utils.JAXRSUtils; | import com.ibm.websphere.ras.*; import java.util.*; import javax.ws.rs.core.*; import javax.ws.rs.ext.*; import org.apache.cxf.jaxrs.utils.*; | [
"com.ibm.websphere",
"java.util",
"javax.ws",
"org.apache.cxf"
]
| com.ibm.websphere; java.util; javax.ws; org.apache.cxf; | 1,630,232 |
public void associateIndexWithNewTranslog(final String translogUUID) throws IOException {
metadataLock.writeLock().lock();
try (IndexWriter writer = newTemporaryAppendingIndexWriter(directory, null)) {
if (translogUUID.equals(getUserData(writer).get(Translog.TRANSLOG_UUID_KEY))) {
throw new IllegalArgumentException("a new translog uuid can't be equal to existing one. got [" + translogUUID + "]");
}
updateCommitData(writer, Map.of(Translog.TRANSLOG_UUID_KEY, translogUUID));
} finally {
metadataLock.writeLock().unlock();
}
} | void function(final String translogUUID) throws IOException { metadataLock.writeLock().lock(); try (IndexWriter writer = newTemporaryAppendingIndexWriter(directory, null)) { if (translogUUID.equals(getUserData(writer).get(Translog.TRANSLOG_UUID_KEY))) { throw new IllegalArgumentException(STR + translogUUID + "]"); } updateCommitData(writer, Map.of(Translog.TRANSLOG_UUID_KEY, translogUUID)); } finally { metadataLock.writeLock().unlock(); } } | /**
* Force bakes the given translog generation as recovery information in the lucene index. This is
* used when recovering from a snapshot or peer file based recovery where a new empty translog is
* created and the existing lucene index needs should be changed to use it.
*/ | Force bakes the given translog generation as recovery information in the lucene index. This is used when recovering from a snapshot or peer file based recovery where a new empty translog is created and the existing lucene index needs should be changed to use it | associateIndexWithNewTranslog | {
"repo_name": "ern/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/store/Store.java",
"license": "apache-2.0",
"size": 74145
} | [
"java.io.IOException",
"java.util.Map",
"org.apache.lucene.index.IndexWriter",
"org.elasticsearch.index.translog.Translog"
]
| import java.io.IOException; import java.util.Map; import org.apache.lucene.index.IndexWriter; import org.elasticsearch.index.translog.Translog; | import java.io.*; import java.util.*; import org.apache.lucene.index.*; import org.elasticsearch.index.translog.*; | [
"java.io",
"java.util",
"org.apache.lucene",
"org.elasticsearch.index"
]
| java.io; java.util; org.apache.lucene; org.elasticsearch.index; | 728,432 |
public void toFile(File file) throws IOException {
Collections.sort(dataSets, DataSetReference.comparator());
// prepare / fill the template
Template template = TemplateLoader.getInstance().getTemplate(
TemplateType.FileIndex);
VelocityContext velocityContext = new VelocityContext();
velocityContext.put(TemplateType.FileIndex.getContextName(), this);
// write the file
Writer writer = new FileWriter(file);
template.merge(velocityContext, writer);
writer.flush();
writer.close();
} | void function(File file) throws IOException { Collections.sort(dataSets, DataSetReference.comparator()); Template template = TemplateLoader.getInstance().getTemplate( TemplateType.FileIndex); VelocityContext velocityContext = new VelocityContext(); velocityContext.put(TemplateType.FileIndex.getContextName(), this); Writer writer = new FileWriter(file); template.merge(velocityContext, writer); writer.flush(); writer.close(); } | /**
* Writes this index to an HTML file using a velocity template.
*/ | Writes this index to an HTML file using a velocity template | toFile | {
"repo_name": "GreenDelta/olca-converter",
"path": "src/main/java/org/openlca/olcatdb/conversion/FileIndex.java",
"license": "mpl-2.0",
"size": 2109
} | [
"java.io.File",
"java.io.FileWriter",
"java.io.IOException",
"java.io.Writer",
"java.util.Collections",
"org.apache.velocity.Template",
"org.apache.velocity.VelocityContext",
"org.openlca.olcatdb.datatypes.DataSetReference",
"org.openlca.olcatdb.templates.TemplateLoader",
"org.openlca.olcatdb.templates.TemplateType"
]
| import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.util.Collections; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.openlca.olcatdb.datatypes.DataSetReference; import org.openlca.olcatdb.templates.TemplateLoader; import org.openlca.olcatdb.templates.TemplateType; | import java.io.*; import java.util.*; import org.apache.velocity.*; import org.openlca.olcatdb.datatypes.*; import org.openlca.olcatdb.templates.*; | [
"java.io",
"java.util",
"org.apache.velocity",
"org.openlca.olcatdb"
]
| java.io; java.util; org.apache.velocity; org.openlca.olcatdb; | 2,427,846 |
@Test
public void testCanopyReducerClusterFilter() throws Exception {
CanopyReducer reducer = new CanopyReducer();
Configuration conf = getConfiguration();
conf.set(CanopyConfigKeys.DISTANCE_MEASURE_KEY,
"org.apache.mahout.common.distance.ManhattanDistanceMeasure");
conf.set(CanopyConfigKeys.T1_KEY, String.valueOf(3.1));
conf.set(CanopyConfigKeys.T2_KEY, String.valueOf(2.1));
conf.set(CanopyConfigKeys.CF_KEY, "3");
DummyRecordWriter<Text, ClusterWritable> writer = new DummyRecordWriter<Text, ClusterWritable>();
Reducer<Text, VectorWritable, Text, ClusterWritable>.Context context = DummyRecordWriter
.build(reducer, conf, writer, Text.class, VectorWritable.class);
reducer.setup(context);
List<VectorWritable> points = getPointsWritable();
reducer.reduce(new Text("centroid"), points, context);
Set<Text> keys = writer.getKeys();
assertEquals("Number of centroids", 2, keys.size());
} | void function() throws Exception { CanopyReducer reducer = new CanopyReducer(); Configuration conf = getConfiguration(); conf.set(CanopyConfigKeys.DISTANCE_MEASURE_KEY, STR); conf.set(CanopyConfigKeys.T1_KEY, String.valueOf(3.1)); conf.set(CanopyConfigKeys.T2_KEY, String.valueOf(2.1)); conf.set(CanopyConfigKeys.CF_KEY, "3"); DummyRecordWriter<Text, ClusterWritable> writer = new DummyRecordWriter<Text, ClusterWritable>(); Reducer<Text, VectorWritable, Text, ClusterWritable>.Context context = DummyRecordWriter .build(reducer, conf, writer, Text.class, VectorWritable.class); reducer.setup(context); List<VectorWritable> points = getPointsWritable(); reducer.reduce(new Text(STR), points, context); Set<Text> keys = writer.getKeys(); assertEquals(STR, 2, keys.size()); } | /**
* Story: User can specify a cluster filter that limits the minimum size of
* canopies produced by the reducer
*/ | Story: User can specify a cluster filter that limits the minimum size of canopies produced by the reducer | testCanopyReducerClusterFilter | {
"repo_name": "bharcode/Kaggle",
"path": "CustomMahout/core/src/test/java/org/apache/mahout/clustering/canopy/TestCanopyCreation.java",
"license": "gpl-2.0",
"size": 29686
} | [
"java.util.List",
"java.util.Set",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.io.Text",
"org.apache.hadoop.mapreduce.Reducer",
"org.apache.mahout.clustering.iterator.ClusterWritable",
"org.apache.mahout.common.DummyRecordWriter",
"org.apache.mahout.math.VectorWritable"
]
| import java.util.List; import java.util.Set; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; import org.apache.mahout.clustering.iterator.ClusterWritable; import org.apache.mahout.common.DummyRecordWriter; import org.apache.mahout.math.VectorWritable; | import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.*; import org.apache.mahout.clustering.iterator.*; import org.apache.mahout.common.*; import org.apache.mahout.math.*; | [
"java.util",
"org.apache.hadoop",
"org.apache.mahout"
]
| java.util; org.apache.hadoop; org.apache.mahout; | 1,101,987 |
@Nullable public static byte[] readByteArray(DataInput in) throws IOException {
int len = in.readInt();
if (len == -1)
return null; // Value "-1" indicates null.
byte[] res = new byte[len];
in.readFully(res);
return res;
} | @Nullable static byte[] function(DataInput in) throws IOException { int len = in.readInt(); if (len == -1) return null; byte[] res = new byte[len]; in.readFully(res); return res; } | /**
* Reads byte array from input stream accounting for <tt>null</tt> values.
*
* @param in Stream to read from.
* @return Read byte array, possibly <tt>null</tt>.
* @throws java.io.IOException If read failed.
*/ | Reads byte array from input stream accounting for null values | readByteArray | {
"repo_name": "mcherkasov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 316648
} | [
"java.io.DataInput",
"java.io.IOException",
"org.jetbrains.annotations.Nullable"
]
| import java.io.DataInput; import java.io.IOException; import org.jetbrains.annotations.Nullable; | import java.io.*; import org.jetbrains.annotations.*; | [
"java.io",
"org.jetbrains.annotations"
]
| java.io; org.jetbrains.annotations; | 2,321,677 |
public void startMethod(String methodName, String type, short flags) {
short methodNameIndex = itsConstantPool.addUtf8(methodName);
short typeIndex = itsConstantPool.addUtf8(type);
itsCurrentMethod = new ClassFileMethod(methodName, methodNameIndex,
type, typeIndex, flags);
itsJumpFroms = new UintMap();
itsMethods.add(itsCurrentMethod);
addSuperBlockStart(0);
} | void function(String methodName, String type, short flags) { short methodNameIndex = itsConstantPool.addUtf8(methodName); short typeIndex = itsConstantPool.addUtf8(type); itsCurrentMethod = new ClassFileMethod(methodName, methodNameIndex, type, typeIndex, flags); itsJumpFroms = new UintMap(); itsMethods.add(itsCurrentMethod); addSuperBlockStart(0); } | /**
* Add a method and begin adding code.
*
* This method must be called before other methods for adding code, exception tables, etc. can be
* invoked.
*
* @param methodName the name of the method
* @param type a string representing the type
* @param flags the attributes of the field, such as ACC_PUBLIC, etc. bitwise or'd together
*/ | Add a method and begin adding code. This method must be called before other methods for adding code, exception tables, etc. can be invoked | startMethod | {
"repo_name": "killmag10/nodeschnaps",
"path": "deps/rhino/src/org/mozilla/classfile/ClassFileWriter.java",
"license": "lgpl-3.0",
"size": 167986
} | [
"org.mozilla.javascript.UintMap"
]
| import org.mozilla.javascript.UintMap; | import org.mozilla.javascript.*; | [
"org.mozilla.javascript"
]
| org.mozilla.javascript; | 923,830 |
final public void exec(final List<Var> variables, final List<Binding> values, final Context context, Consumer<ResultSet> output) {
if (Thread.interrupted()) {
throw new SPARQLExtException(new InterruptedException());
}
final Query q = createQuery(select, variables, values, context);
final Dataset inputDataset = ContextUtils.getDataset(context);
if (LOG.isTraceEnabled()) {
StringBuilder sb = new StringBuilder("Executing select query:\n");
sb.append(q.toString());
if (variables.size() > 0 && values.size() > 0) {
sb.append(" \nwith initial values:\n");
sb.append(LogUtils.log(variables, values));
} else {
sb.append(" \nwithout initial values.");
}
LOG.trace(sb.toString());
} else if (LOG.isDebugEnabled()) {
LOG.debug("Executing select query with " + values.size() + " bindings.");
}
try {
augmentQuery(q, variables, values);
final QueryEngineFactory factory = QueryEngineRegistry.get().find(q, inputDataset.asDatasetGraph(), context);
try (QueryExecution exec = new QueryExecutionBase(q, inputDataset, context, factory)) {
ResultSet resultSet = exec.execSelect();
if (LOG.isTraceEnabled()) {
ResultSetRewindable rewindable = ResultSetFactory.copyResults(resultSet);
final List<Var> resultVariables = getVariables(rewindable.getResultVars());
final List<Binding> resultBindings = new ArrayList<>();
while (rewindable.hasNext()) {
resultBindings.add(rewindable.nextBinding());
}
LOG.trace(String.format("Query output is\n%s", LogUtils.log(resultVariables, resultBindings)));
rewindable.reset();
resultSet = rewindable;
} else if (LOG.isDebugEnabled()) {
ResultSetRewindable rewindable = ResultSetFactory.copyResults(resultSet);
int size = 0;
while (rewindable.hasNext()) {
rewindable.next();
size++;
}
LOG.debug(String.format("Query has %s output for variables %s", size, rewindable.getResultVars()));
rewindable.reset();
resultSet = rewindable;
} else {
// got exception with call of unionOf in RootPlan. Would be better not to need to make rewindable
ResultSetRewindable rewindable = ResultSetFactory.copyResults(resultSet);
resultSet = rewindable;
}
output.accept(resultSet);
}
} catch (Exception ex) {
LOG.error("Error while executing SELECT Query " + q, ex);
throw new SPARQLExtException("Error while executing SELECT Query " + q, ex);
}
}
| final void function(final List<Var> variables, final List<Binding> values, final Context context, Consumer<ResultSet> output) { if (Thread.interrupted()) { throw new SPARQLExtException(new InterruptedException()); } final Query q = createQuery(select, variables, values, context); final Dataset inputDataset = ContextUtils.getDataset(context); if (LOG.isTraceEnabled()) { StringBuilder sb = new StringBuilder(STR); sb.append(q.toString()); if (variables.size() > 0 && values.size() > 0) { sb.append(STR); sb.append(LogUtils.log(variables, values)); } else { sb.append(STR); } LOG.trace(sb.toString()); } else if (LOG.isDebugEnabled()) { LOG.debug(STR + values.size() + STR); } try { augmentQuery(q, variables, values); final QueryEngineFactory factory = QueryEngineRegistry.get().find(q, inputDataset.asDatasetGraph(), context); try (QueryExecution exec = new QueryExecutionBase(q, inputDataset, context, factory)) { ResultSet resultSet = exec.execSelect(); if (LOG.isTraceEnabled()) { ResultSetRewindable rewindable = ResultSetFactory.copyResults(resultSet); final List<Var> resultVariables = getVariables(rewindable.getResultVars()); final List<Binding> resultBindings = new ArrayList<>(); while (rewindable.hasNext()) { resultBindings.add(rewindable.nextBinding()); } LOG.trace(String.format(STR, LogUtils.log(resultVariables, resultBindings))); rewindable.reset(); resultSet = rewindable; } else if (LOG.isDebugEnabled()) { ResultSetRewindable rewindable = ResultSetFactory.copyResults(resultSet); int size = 0; while (rewindable.hasNext()) { rewindable.next(); size++; } LOG.debug(String.format(STR, size, rewindable.getResultVars())); rewindable.reset(); resultSet = rewindable; } else { ResultSetRewindable rewindable = ResultSetFactory.copyResults(resultSet); resultSet = rewindable; } output.accept(resultSet); } } catch (Exception ex) { LOG.error(STR + q, ex); throw new SPARQLExtException(STR + q, ex); } } | /**
* Updates a values block with the execution of a SPARQL SELECT query.
*
* @param variables
* the variables
* @param values
* the list of bindings.
* @param context
* the execution context.
* @return the new list of bindings
*/ | Updates a values block with the execution of a SPARQL SELECT query | exec | {
"repo_name": "thesmartenergy/sparql-generate-jena",
"path": "sparql-generate-jena/src/main/java/fr/mines_stetienne/ci/sparql_generate/engine/SelectPlan.java",
"license": "apache-2.0",
"size": 8991
} | [
"fr.mines_stetienne.ci.sparql_generate.SPARQLExtException",
"fr.mines_stetienne.ci.sparql_generate.utils.ContextUtils",
"fr.mines_stetienne.ci.sparql_generate.utils.LogUtils",
"java.util.ArrayList",
"java.util.List",
"java.util.function.Consumer",
"org.apache.jena.query.Dataset",
"org.apache.jena.query.Query",
"org.apache.jena.query.QueryExecution",
"org.apache.jena.query.ResultSet",
"org.apache.jena.query.ResultSetFactory",
"org.apache.jena.query.ResultSetRewindable",
"org.apache.jena.sparql.core.Var",
"org.apache.jena.sparql.engine.QueryEngineFactory",
"org.apache.jena.sparql.engine.QueryEngineRegistry",
"org.apache.jena.sparql.engine.QueryExecutionBase",
"org.apache.jena.sparql.engine.binding.Binding",
"org.apache.jena.sparql.util.Context"
]
| import fr.mines_stetienne.ci.sparql_generate.SPARQLExtException; import fr.mines_stetienne.ci.sparql_generate.utils.ContextUtils; import fr.mines_stetienne.ci.sparql_generate.utils.LogUtils; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; import org.apache.jena.query.Dataset; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.ResultSet; import org.apache.jena.query.ResultSetFactory; import org.apache.jena.query.ResultSetRewindable; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.QueryEngineFactory; import org.apache.jena.sparql.engine.QueryEngineRegistry; import org.apache.jena.sparql.engine.QueryExecutionBase; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.util.Context; | import fr.mines_stetienne.ci.sparql_generate.*; import fr.mines_stetienne.ci.sparql_generate.utils.*; import java.util.*; import java.util.function.*; import org.apache.jena.query.*; import org.apache.jena.sparql.core.*; import org.apache.jena.sparql.engine.*; import org.apache.jena.sparql.engine.binding.*; import org.apache.jena.sparql.util.*; | [
"fr.mines_stetienne.ci",
"java.util",
"org.apache.jena"
]
| fr.mines_stetienne.ci; java.util; org.apache.jena; | 2,774,109 |
public void setActiveGroupPanel(GroupPanel activePanel) {
if (this.activePanel != null && this.activePanel != activePanel) {
this.activePanel.setActive(false);
}
this.activePanel = activePanel;
activePanel.scroll();
activePanel.setActive(true);
}
| void function(GroupPanel activePanel) { if (this.activePanel != null && this.activePanel != activePanel) { this.activePanel.setActive(false); } this.activePanel = activePanel; activePanel.scroll(); activePanel.setActive(true); } | /**
* Sets given <code>activePanel</code> as the currently active panel.
*/ | Sets given <code>activePanel</code> as the currently active panel | setActiveGroupPanel | {
"repo_name": "tectronics/cubeon",
"path": "core/common/src/main/java/org/netbeans/cubeon/common/ui/internals/AbstractGroupView.java",
"license": "apache-2.0",
"size": 3400
} | [
"org.netbeans.cubeon.common.ui.GroupPanel"
]
| import org.netbeans.cubeon.common.ui.GroupPanel; | import org.netbeans.cubeon.common.ui.*; | [
"org.netbeans.cubeon"
]
| org.netbeans.cubeon; | 373,668 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.