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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
@Test
public void testRemoveValueNoStoreEntryNoCacheLoaderWriter() throws Exception {
final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap());
this.store = spy(fakeStore);
final Ehcache<String, String> ehcache = this.getEhcache(null);
assertFalse(ehcache.remove("key", "value"));
verify(this.store).compute(eq("key"), getAnyBiFunction(), getBooleanNullaryFunction());
verifyZeroInteractions(this.spiedResilienceStrategy);
assertThat(fakeStore.getEntryMap().containsKey("key"), is(false));
validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ConditionalRemoveOutcome.FAILURE_KEY_MISSING));
}
|
void function() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final Ehcache<String, String> ehcache = this.getEhcache(null); assertFalse(ehcache.remove("key", "value")); verify(this.store).compute(eq("key"), getAnyBiFunction(), getBooleanNullaryFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(fakeStore.getEntryMap().containsKey("key"), is(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ConditionalRemoveOutcome.FAILURE_KEY_MISSING)); }
|
/**
* Tests the effect of a {@link org.ehcache.Ehcache#remove(Object, Object)} for
* <ul>
* <li>key not present in {@code Store}</li>
* <li>no {@code CacheLoaderWriter}</li>
* </ul>
*/
|
Tests the effect of a <code>org.ehcache.Ehcache#remove(Object, Object)</code> for key not present in Store no CacheLoaderWriter
|
testRemoveValueNoStoreEntryNoCacheLoaderWriter
|
{
"repo_name": "palmanojkumar/ehcache3",
"path": "core/src/test/java/org/ehcache/EhcacheBasicRemoveValueTest.java",
"license": "apache-2.0",
"size": 39125
}
|
[
"java.util.Collections",
"java.util.EnumSet",
"org.ehcache.statistics.CacheOperationOutcomes",
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.mockito.Mockito"
] |
import java.util.Collections; import java.util.EnumSet; import org.ehcache.statistics.CacheOperationOutcomes; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.mockito.Mockito;
|
import java.util.*; import org.ehcache.statistics.*; import org.hamcrest.*; import org.junit.*; import org.mockito.*;
|
[
"java.util",
"org.ehcache.statistics",
"org.hamcrest",
"org.junit",
"org.mockito"
] |
java.util; org.ehcache.statistics; org.hamcrest; org.junit; org.mockito;
| 1,891,240
|
public static <N> Tupple2<Graph,BidiMap> minimalSpanningTreeKruskal(WeightedGraph<N> wg) {
// spaning tree
Graph g = new Graph();
// convert adjacency list weighted graph to edge list weighted graph
WeightedEdgeGraph weg = GraphConvertion.weightedGraphToWeightedEdgeGraph(wg);
List<WeightedNode<N>> nodes = wg.getNodes();
List<WeightedEdge<?,N>> edges = weg.getEdges();
// build evaluation map
Map<Edge,N> eval = new HashMap();
for (WeightedEdge<?,N> we : edges) {
eval.put(we, we.getWeight());
}
// create nodes of the spanning tree g and bijection with wg
BidiMap<Node,Node> bm = new BidiMap();
for(Node n : nodes) {
Node nn = g.createNewNode();
bm.put(n, nn);
}
// to manage connect components
Map<Node,Integer> ccVal = new HashMap<Node, Integer>();
// init connected component ids
int cpt=0;
for(Node n : (List<Node>) g.getNodes()) {
ccVal.put(n, cpt++);
}
// kruskal picks edges from a priority queue
// priority queue picks the element with the least valuation
PriorityQueue<Edge> heap = new PriorityQueue(eval.size(),new AdHocMapEvalComparator(eval));
heap.addAll(eval.keySet());
//
while(heap.size() != 0) {
Edge<Node> e = heap.poll();
// get the nodes of g corresponding to the ones of wg
Node nt1 = bm.getAB(e.n1);
Node nt2 = bm.getAB(e.n2);
// get cc ids
int s1 = ccVal.get(nt1);
int s2 = ccVal.get(nt2);
// if cc ids are different then merge, else, ignore
if(s1 != s2) {
int sn = s1;
for(Node n : getConnectedComponent(g,nt2)) {
ccVal.put(n,sn);
}
g.createEdge(nt1,nt2);
}
}
return new Tupple2(g, bm);
}
// TODO: unit test
|
static <N> Tupple2<Graph,BidiMap> function(WeightedGraph<N> wg) { Graph g = new Graph(); WeightedEdgeGraph weg = GraphConvertion.weightedGraphToWeightedEdgeGraph(wg); List<WeightedNode<N>> nodes = wg.getNodes(); List<WeightedEdge<?,N>> edges = weg.getEdges(); Map<Edge,N> eval = new HashMap(); for (WeightedEdge<?,N> we : edges) { eval.put(we, we.getWeight()); } BidiMap<Node,Node> bm = new BidiMap(); for(Node n : nodes) { Node nn = g.createNewNode(); bm.put(n, nn); } Map<Node,Integer> ccVal = new HashMap<Node, Integer>(); int cpt=0; for(Node n : (List<Node>) g.getNodes()) { ccVal.put(n, cpt++); } PriorityQueue<Edge> heap = new PriorityQueue(eval.size(),new AdHocMapEvalComparator(eval)); heap.addAll(eval.keySet()); Edge<Node> e = heap.poll(); Node nt1 = bm.getAB(e.n1); Node nt2 = bm.getAB(e.n2); int s1 = ccVal.get(nt1); int s2 = ccVal.get(nt2); if(s1 != s2) { int sn = s1; for(Node n : getConnectedComponent(g,nt2)) { ccVal.put(n,sn); } g.createEdge(nt1,nt2); } } return new Tupple2(g, bm); }
|
/**
* Computes the minimal spanning tree of a WeightedGraph using the Kruskal algorithm.
* @return tupple, first: maximal spanning tree, second: bijection between nodes of the spanning tree and of the weighted graph
*/
|
Computes the minimal spanning tree of a WeightedGraph using the Kruskal algorithm
|
minimalSpanningTreeKruskal
|
{
"repo_name": "nicolasst/moorea",
"path": "src/moorea/graphs/algorithms/GraphExtraction.java",
"license": "gpl-2.0",
"size": 5336
}
|
[
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.PriorityQueue"
] |
import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.PriorityQueue;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 833,372
|
private MenuItem addReserveMI(Menu menu) {
final MenuItem reserveMI = new MenuItem(menu, SWT.CASCADE);
reserveMI.setText(Messages.getString("BrowserMenu.Reserve"));
// create menu which hosts major and minor reserve
Menu reserveOpMI = new Menu(shell, SWT.DROP_DOWN);
reserveMI.setMenu(reserveOpMI);
// major release
MenuItem majorMI = new MenuItem(reserveOpMI, SWT.PUSH);
majorMI.setText(Messages.getString("BrowserMenu.MajorCmd"));
// minor release
MenuItem minorMI = new MenuItem(reserveOpMI, SWT.PUSH);
minorMI.setText(Messages.getString("BrowserMenu.MinorCmd"));
|
MenuItem function(Menu menu) { final MenuItem reserveMI = new MenuItem(menu, SWT.CASCADE); reserveMI.setText(Messages.getString(STR)); Menu reserveOpMI = new Menu(shell, SWT.DROP_DOWN); reserveMI.setMenu(reserveOpMI); MenuItem majorMI = new MenuItem(reserveOpMI, SWT.PUSH); majorMI.setText(Messages.getString(STR)); MenuItem minorMI = new MenuItem(reserveOpMI, SWT.PUSH); minorMI.setText(Messages.getString(STR));
|
/**
* Add reserve menu item (major and minor)
*
* @param menu
*/
|
Add reserve menu item (major and minor)
|
addReserveMI
|
{
"repo_name": "openefsa/CatalogueBrowser",
"path": "src/ui_main_menu/ToolsMenu.java",
"license": "lgpl-3.0",
"size": 45813
}
|
[
"org.eclipse.swt.widgets.Menu",
"org.eclipse.swt.widgets.MenuItem"
] |
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem;
|
import org.eclipse.swt.widgets.*;
|
[
"org.eclipse.swt"
] |
org.eclipse.swt;
| 1,047,103
|
public boolean sleep() throws InterruptedException {
// for small delays then just sleep
if (redeliveryDelay < 1000) {
currentRedeliveryPolicy.sleep(redeliveryDelay);
return true;
}
StopWatch watch = new StopWatch();
LOG.debug("Sleeping for: {} millis until attempting redelivery", redeliveryDelay);
while (watch.taken() < redeliveryDelay) {
// sleep using 1 sec interval
long delta = redeliveryDelay - watch.taken();
long max = Math.min(1000, delta);
if (max > 0) {
LOG.trace("Sleeping for: {} millis until waking up for re-check", max);
Thread.sleep(max);
}
// are we preparing for shutdown then only do redelivery if allowed
if (preparingShutdown && !currentRedeliveryPolicy.isAllowRedeliveryWhileStopping()) {
LOG.debug("Rejected redelivery while stopping");
return false;
}
}
return true;
}
}
|
boolean function() throws InterruptedException { if (redeliveryDelay < 1000) { currentRedeliveryPolicy.sleep(redeliveryDelay); return true; } StopWatch watch = new StopWatch(); LOG.debug(STR, redeliveryDelay); while (watch.taken() < redeliveryDelay) { long delta = redeliveryDelay - watch.taken(); long max = Math.min(1000, delta); if (max > 0) { LOG.trace(STR, max); Thread.sleep(max); } if (preparingShutdown && !currentRedeliveryPolicy.isAllowRedeliveryWhileStopping()) { LOG.debug(STR); return false; } } return true; } }
|
/**
* Method for sleeping during redelivery attempts.
* <p/>
* This task is for the synchronous blocking. If using async delayed then a scheduled thread pool is used for
* sleeping and trigger redeliveries.
*/
|
Method for sleeping during redelivery attempts. This task is for the synchronous blocking. If using async delayed then a scheduled thread pool is used for sleeping and trigger redeliveries
|
sleep
|
{
"repo_name": "pax95/camel",
"path": "core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java",
"license": "apache-2.0",
"size": 76544
}
|
[
"org.apache.camel.util.StopWatch"
] |
import org.apache.camel.util.StopWatch;
|
import org.apache.camel.util.*;
|
[
"org.apache.camel"
] |
org.apache.camel;
| 1,851,416
|
@Nullable
final Set<TreeFileArtifact> getTreeArtifactContents(Artifact artifact) {
return treeArtifactContents.get(artifact);
}
|
final Set<TreeFileArtifact> getTreeArtifactContents(Artifact artifact) { return treeArtifactContents.get(artifact); }
|
/**
* Returns a set of the given tree artifact's contents.
*
* <p>If the return value is {@code null}, this means nothing was injected, and the output
* TreeArtifact is to have its values read from disk instead.
*/
|
Returns a set of the given tree artifact's contents. If the return value is null, this means nothing was injected, and the output TreeArtifact is to have its values read from disk instead
|
getTreeArtifactContents
|
{
"repo_name": "akira-baruah/bazel",
"path": "src/main/java/com/google/devtools/build/lib/skyframe/OutputStore.java",
"license": "apache-2.0",
"size": 4705
}
|
[
"com.google.devtools.build.lib.actions.Artifact",
"java.util.Set"
] |
import com.google.devtools.build.lib.actions.Artifact; import java.util.Set;
|
import com.google.devtools.build.lib.actions.*; import java.util.*;
|
[
"com.google.devtools",
"java.util"
] |
com.google.devtools; java.util;
| 473,907
|
public Builder batchSize(final int batchSize) {
isTrue("batchSize >= 0", batchSize >= 0);
this.batchSize = batchSize;
return this;
}
|
Builder function(final int batchSize) { isTrue(STR, batchSize >= 0); this.batchSize = batchSize; return this; }
|
/**
* The batch size to use for each cursor.
*
* @param batchSize the batch size, which must be >= 0
* @return this
*/
|
The batch size to use for each cursor
|
batchSize
|
{
"repo_name": "ezbake/ezmongo",
"path": "ezmongo-java-driver/src/main/com/mongodb/ParallelScanOptions.java",
"license": "apache-2.0",
"size": 3647
}
|
[
"org.bson.util.Assertions"
] |
import org.bson.util.Assertions;
|
import org.bson.util.*;
|
[
"org.bson.util"
] |
org.bson.util;
| 996,624
|
public static void logError(Throwable exception, String message,
Object... args) {
message = MessageFormat.format(message, args);
log(IStatus.ERROR, IStatus.OK, message, exception);
}
|
static void function(Throwable exception, String message, Object... args) { message = MessageFormat.format(message, args); log(IStatus.ERROR, IStatus.OK, message, exception); }
|
/**
* Log the specified error.
*
* @param exception a low-level exception, or <code>null</code> if not
* applicable.
* @param message a human-readable message, localized to the current locale.
* @param args message arguments.
*/
|
Log the specified error
|
logError
|
{
"repo_name": "google-code-export/google-plugin-for-eclipse",
"path": "plugins/com.google.appengine.eclipse.datatools/src/com/google/appengine/eclipse/datatools/GoogleDatatoolsPluginLog.java",
"license": "epl-1.0",
"size": 5269
}
|
[
"java.text.MessageFormat",
"org.eclipse.core.runtime.IStatus"
] |
import java.text.MessageFormat; import org.eclipse.core.runtime.IStatus;
|
import java.text.*; import org.eclipse.core.runtime.*;
|
[
"java.text",
"org.eclipse.core"
] |
java.text; org.eclipse.core;
| 765,634
|
private void writeFieldBeginInternal(TField field, byte typeOverride) throws TException {
// short lastField = lastField_.pop();
// if there's a type override, use that.
byte typeToWrite = typeOverride == -1 ? getCompactType(field.type) : typeOverride;
// check if we can use delta encoding for the field id
if (field.id > lastFieldId_ && field.id - lastFieldId_ <= 15) {
// write them together
writeByteDirect((field.id - lastFieldId_) << 4 | typeToWrite);
} else {
// write them separate
writeByteDirect(typeToWrite);
writeI16(field.id);
}
lastFieldId_ = field.id;
// lastField_.push(field.id);
}
|
void function(TField field, byte typeOverride) throws TException { byte typeToWrite = typeOverride == -1 ? getCompactType(field.type) : typeOverride; if (field.id > lastFieldId_ && field.id - lastFieldId_ <= 15) { writeByteDirect((field.id - lastFieldId_) << 4 typeToWrite); } else { writeByteDirect(typeToWrite); writeI16(field.id); } lastFieldId_ = field.id; }
|
/**
* The workhorse of writeFieldBegin. It has the option of doing a
* 'type override' of the type header. This is used specifically in the
* boolean field case.
*/
|
The workhorse of writeFieldBegin. It has the option of doing a 'type override' of the type header. This is used specifically in the boolean field case
|
writeFieldBeginInternal
|
{
"repo_name": "rewardStyle/apache.thrift",
"path": "lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java",
"license": "apache-2.0",
"size": 27552
}
|
[
"org.apache.thrift.TException"
] |
import org.apache.thrift.TException;
|
import org.apache.thrift.*;
|
[
"org.apache.thrift"
] |
org.apache.thrift;
| 1,519,765
|
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
if (isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
if ("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
// TODO: handle non-primary volumes
}
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
}
// MediaProvider
else if (isMediaDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Uri contentUri = null;
if ("image".equals(type)) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if ("video".equals(type)) {
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
} else if ("audio".equals(type)) {
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
}
final String selection = "_id=?";
final String[] selectionArgs = new String[]{split[1]};
return getDataColumn(context, contentUri, selection, selectionArgs);
}
}
// MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme())) {
return getDataColumn(context, uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
}
|
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if (STR.equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } } else if (isDownloadsDocument(uri)) { final String id = DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId(Uri.parse(STR:STRimageSTRvideoSTRaudioSTR_id=?STRcontentSTRfile".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; }
|
/**
* Get a file path from a Uri. This will get the the path for Storage Access
* Framework Documents, as well as the _data field for the MediaStore and
* other file-based ContentProviders.
*
* @param context The context.
* @param uri The Uri to query.
* @author paulburke
*/
|
Get a file path from a Uri. This will get the the path for Storage Access Framework Documents, as well as the _data field for the MediaStore and other file-based ContentProviders
|
getPath
|
{
"repo_name": "ReyKoxha/nodebb-webview",
"path": "app/src/main/java/com/webview/nodebb/utility/MediaUtility.java",
"license": "agpl-3.0",
"size": 5003
}
|
[
"android.content.ContentUris",
"android.net.Uri",
"android.os.Build",
"android.os.Environment",
"android.provider.DocumentsContract"
] |
import android.content.ContentUris; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.DocumentsContract;
|
import android.content.*; import android.net.*; import android.os.*; import android.provider.*;
|
[
"android.content",
"android.net",
"android.os",
"android.provider"
] |
android.content; android.net; android.os; android.provider;
| 761,870
|
public static void componentsSetEnabled(Container[] containers, boolean enabled) {
for (Container cont : containers) {
componentsSetEnabled(cont, enabled);
}
}
|
static void function(Container[] containers, boolean enabled) { for (Container cont : containers) { componentsSetEnabled(cont, enabled); } }
|
/**
* call setEnabled(boolean) on all top-level components in list of frame/panel
* @param panel
* @param enabled
*/
|
call setEnabled(boolean) on all top-level components in list of frame/panel
|
componentsSetEnabled
|
{
"repo_name": "kmdouglass/Micro-Manager",
"path": "plugins/ASIdiSPIM/src/org/micromanager/asidispim/Utils/PanelUtils.java",
"license": "mit",
"size": 36214
}
|
[
"java.awt.Container"
] |
import java.awt.Container;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 921,294
|
@Test
@LargeTest
public void testEventIndices_SelectionON_CharacterGranularity() throws Throwable {
// Build a simple web page with an input and the text "Testing"
setupTestWithHTML("<input id=\"fn\" type=\"text\" value=\"Testing\">");
// Find a node in the accessibility tree with input type TYPE_CLASS_TEXT.
int editTextVirtualViewId =
waitForNodeMatching(sInputTypeMatcher, InputType.TYPE_CLASS_TEXT);
mNodeInfo = createAccessibilityNodeInfo(editTextVirtualViewId);
Assert.assertNotEquals(mNodeInfo, null);
focusNode(editTextVirtualViewId);
// Set granularity to CHARACTER, with selection TRUE
Bundle args = new Bundle();
args.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
args.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true);
// Simulate swiping left (backward) (adds to selections)
for (int i = 7; i > 0; i--) {
performTextActionOnUiThread(editTextVirtualViewId,
AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, args);
Assert.assertEquals(i - 1, mTestData.getTraverseFromIndex());
Assert.assertEquals(i, mTestData.getTraverseToIndex());
Assert.assertEquals(7, mTestData.getSelectionFromIndex());
Assert.assertEquals(i - 1, mTestData.getSelectionToIndex());
}
// Simulate swiping right (forward) (removes from selection)
for (int i = 0; i < 7; i++) {
performTextActionOnUiThread(editTextVirtualViewId,
AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, args);
Assert.assertEquals(i, mTestData.getTraverseFromIndex());
Assert.assertEquals(i + 1, mTestData.getTraverseToIndex());
Assert.assertEquals(7, mTestData.getSelectionFromIndex());
Assert.assertEquals(i + 1, mTestData.getSelectionToIndex());
}
// Turn selection mode off and traverse to beginning so we can select forwards
args.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, false);
for (int i = 7; i > 0; i--) {
performTextActionOnUiThread(editTextVirtualViewId,
AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, args);
}
// Turn selection mode on
args.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true);
// Simulate swiping right (forward) (adds to selection)
for (int i = 0; i < 7; i++) {
performTextActionOnUiThread(editTextVirtualViewId,
AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, args);
Assert.assertEquals(i, mTestData.getTraverseFromIndex());
Assert.assertEquals(i + 1, mTestData.getTraverseToIndex());
Assert.assertEquals(0, mTestData.getSelectionFromIndex());
Assert.assertEquals(i + 1, mTestData.getSelectionToIndex());
}
// Simulate swiping left (backward) (removes from selections)
for (int i = 7; i > 0; i--) {
performTextActionOnUiThread(editTextVirtualViewId,
AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, args);
Assert.assertEquals(i - 1, mTestData.getTraverseFromIndex());
Assert.assertEquals(i, mTestData.getTraverseToIndex());
Assert.assertEquals(0, mTestData.getSelectionFromIndex());
Assert.assertEquals(i - 1, mTestData.getSelectionToIndex());
}
}
|
void function() throws Throwable { setupTestWithHTML(STRfn\STRtext\STRTesting\">"); int editTextVirtualViewId = waitForNodeMatching(sInputTypeMatcher, InputType.TYPE_CLASS_TEXT); mNodeInfo = createAccessibilityNodeInfo(editTextVirtualViewId); Assert.assertNotEquals(mNodeInfo, null); focusNode(editTextVirtualViewId); Bundle args = new Bundle(); args.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER); args.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true); for (int i = 7; i > 0; i--) { performTextActionOnUiThread(editTextVirtualViewId, AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, args); Assert.assertEquals(i - 1, mTestData.getTraverseFromIndex()); Assert.assertEquals(i, mTestData.getTraverseToIndex()); Assert.assertEquals(7, mTestData.getSelectionFromIndex()); Assert.assertEquals(i - 1, mTestData.getSelectionToIndex()); } for (int i = 0; i < 7; i++) { performTextActionOnUiThread(editTextVirtualViewId, AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, args); Assert.assertEquals(i, mTestData.getTraverseFromIndex()); Assert.assertEquals(i + 1, mTestData.getTraverseToIndex()); Assert.assertEquals(7, mTestData.getSelectionFromIndex()); Assert.assertEquals(i + 1, mTestData.getSelectionToIndex()); } args.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, false); for (int i = 7; i > 0; i--) { performTextActionOnUiThread(editTextVirtualViewId, AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, args); } args.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true); for (int i = 0; i < 7; i++) { performTextActionOnUiThread(editTextVirtualViewId, AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, args); Assert.assertEquals(i, mTestData.getTraverseFromIndex()); Assert.assertEquals(i + 1, mTestData.getTraverseToIndex()); Assert.assertEquals(0, mTestData.getSelectionFromIndex()); Assert.assertEquals(i + 1, mTestData.getSelectionToIndex()); } for (int i = 7; i > 0; i--) { performTextActionOnUiThread(editTextVirtualViewId, AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, args); Assert.assertEquals(i - 1, mTestData.getTraverseFromIndex()); Assert.assertEquals(i, mTestData.getTraverseToIndex()); Assert.assertEquals(0, mTestData.getSelectionFromIndex()); Assert.assertEquals(i - 1, mTestData.getSelectionToIndex()); } }
|
/**
* Ensure traverse events and selection events are properly indexed when navigating an edit
* field by character with selection mode on
*/
|
Ensure traverse events and selection events are properly indexed when navigating an edit field by character with selection mode on
|
testEventIndices_SelectionON_CharacterGranularity
|
{
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/content/public/android/javatests/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityTest.java",
"license": "bsd-3-clause",
"size": 108058
}
|
[
"android.os.Bundle",
"android.text.InputType",
"android.view.accessibility.AccessibilityNodeInfo",
"org.junit.Assert"
] |
import android.os.Bundle; import android.text.InputType; import android.view.accessibility.AccessibilityNodeInfo; import org.junit.Assert;
|
import android.os.*; import android.text.*; import android.view.accessibility.*; import org.junit.*;
|
[
"android.os",
"android.text",
"android.view",
"org.junit"
] |
android.os; android.text; android.view; org.junit;
| 346,133
|
public Configurable withPolicy(HttpPipelinePolicy policy) {
this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null."));
return this;
}
|
Configurable function(HttpPipelinePolicy policy) { this.policies.add(Objects.requireNonNull(policy, STR)); return this; }
|
/**
* Adds the pipeline policy to the HTTP pipeline.
*
* @param policy the HTTP pipeline policy.
* @return the configurable object itself.
*/
|
Adds the pipeline policy to the HTTP pipeline
|
withPolicy
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManager.java",
"license": "mit",
"size": 10862
}
|
[
"com.azure.core.http.policy.HttpPipelinePolicy",
"java.util.Objects"
] |
import com.azure.core.http.policy.HttpPipelinePolicy; import java.util.Objects;
|
import com.azure.core.http.policy.*; import java.util.*;
|
[
"com.azure.core",
"java.util"
] |
com.azure.core; java.util;
| 2,815,114
|
@Transacional
public void exclui(ModelagemFuzzy modelagemFuzzy) throws AplicacaoException {
List<CadPlan> listaDeCadPlans = cadPlanDAO.recuperaListaDeCadPlanPorModelagemFuzzy(modelagemFuzzy);
if (listaDeCadPlans.isEmpty()){
// se não tem cadPlans associados a essa modelagem então pode excluir a modelagem
ModelagemFuzzy umaModelagemFuzzy = null;
try {
umaModelagemFuzzy = modelagemFuzzyDAO.getPorIdComLock((modelagemFuzzy.getId()));
} catch (ObjetoNaoEncontradoException e) {
throw new AplicacaoException("modelagemFuzzy.NAO_ENCONTRADO");
}
modelagemFuzzyDAO.exclui(umaModelagemFuzzy);
//======= PONTO CRITICO===== Exclui o arquivo da modelagem!
String caminhoDoArquivo = Constantes.CAMINHO_ABSOLUTO_MODELAGEM_UPLOADFILE + modelagemFuzzy.getNomeArquivo();
//chama o motor de inferencia para remover o arquivo fisico.
try {
MotorInferencia.removerArquivoModelagem(caminhoDoArquivo);
} catch (MotorInferenciaException e) {
throw new AplicacaoException(e.getMessage());
}
//======= PONTO CRITICO=====
}
else{
throw new AplicacaoException("modelagemFuzzy.USADA_EM_CADPLAN");
}
}
|
void function(ModelagemFuzzy modelagemFuzzy) throws AplicacaoException { List<CadPlan> listaDeCadPlans = cadPlanDAO.recuperaListaDeCadPlanPorModelagemFuzzy(modelagemFuzzy); if (listaDeCadPlans.isEmpty()){ ModelagemFuzzy umaModelagemFuzzy = null; try { umaModelagemFuzzy = modelagemFuzzyDAO.getPorIdComLock((modelagemFuzzy.getId())); } catch (ObjetoNaoEncontradoException e) { throw new AplicacaoException(STR); } modelagemFuzzyDAO.exclui(umaModelagemFuzzy); String caminhoDoArquivo = Constantes.CAMINHO_ABSOLUTO_MODELAGEM_UPLOADFILE + modelagemFuzzy.getNomeArquivo(); try { MotorInferencia.removerArquivoModelagem(caminhoDoArquivo); } catch (MotorInferenciaException e) { throw new AplicacaoException(e.getMessage()); } } else{ throw new AplicacaoException(STR); } }
|
/**
* Exclui uma modelagemFuzzy
* logo em seguida tenta excluir o arquivo de modelagem ligado a essa modelagem Fuzzy.
* @param modelagemFuzzy
* @throws AplicacaoException
*/
|
Exclui uma modelagemFuzzy logo em seguida tenta excluir o arquivo de modelagem ligado a essa modelagem Fuzzy
|
exclui
|
{
"repo_name": "dayse/gesplan",
"path": "src/service/ModelagemFuzzyAppService.java",
"license": "mit",
"size": 27224
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,665,945
|
ServiceCall<Void> arrayStringCsvNullAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback);
|
ServiceCall<Void> arrayStringCsvNullAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback);
|
/**
* Get a null array of string using the csv-array format.
*
* @param arrayQuery a null array of string using the csv-array format
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/
|
Get a null array of string using the csv-array format
|
arrayStringCsvNullAsync
|
{
"repo_name": "yugangw-msft/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/url/Queries.java",
"license": "mit",
"size": 53223
}
|
[
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback",
"java.util.List"
] |
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import java.util.List;
|
import com.microsoft.rest.*; import java.util.*;
|
[
"com.microsoft.rest",
"java.util"
] |
com.microsoft.rest; java.util;
| 1,955,360
|
public void testZeroSizeStream() throws IOException {
FixedBufferOutputStream out = new FixedBufferOutputStream(0); // Space for no byte at all
out.write(1); // Write a 1
out.write(2); // ...and a 2
out.write(3); // ...and a 3
out.write(TEST_DATA); // ...and a byte array
byte[] buffer = out.getBuffer(); // Get the buffer
assertNotNull(buffer); // It should never be null
assertEquals(0, buffer.length); // But it should be empty
}
|
void function() throws IOException { FixedBufferOutputStream out = new FixedBufferOutputStream(0); out.write(1); out.write(2); out.write(3); out.write(TEST_DATA); byte[] buffer = out.getBuffer(); assertNotNull(buffer); assertEquals(0, buffer.length); }
|
/** Test a stream with space for no bytes at all.
*/
|
Test a stream with space for no bytes at all
|
testZeroSizeStream
|
{
"repo_name": "OSBI/oodt",
"path": "commons/src/test/java/org/apache/oodt/commons/io/FixedBufferOutputStreamTest.java",
"license": "apache-2.0",
"size": 8554
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 321,166
|
public QueryMetrics queryMetrics();
|
QueryMetrics function();
|
/**
* Gets query metrics.
*
* @return Metrics.
*/
|
Gets query metrics
|
queryMetrics
|
{
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/IgniteCache.java",
"license": "apache-2.0",
"size": 82823
}
|
[
"org.apache.ignite.cache.query.QueryMetrics"
] |
import org.apache.ignite.cache.query.QueryMetrics;
|
import org.apache.ignite.cache.query.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 662,665
|
void flush() throws IOException;
|
void flush() throws IOException;
|
/**
* Flushes any resources opened for output by this file manager directly or
* indirectly. Flushing a closed file manager has no effect.
*
* @throws IOException
* if an I/O error occurred
* @see #close
*/
|
Flushes any resources opened for output by this file manager directly or indirectly. Flushing a closed file manager has no effect
|
flush
|
{
"repo_name": "w7cook/batch-javac",
"path": "src/share/classes/javax/tools/JavaFileManager.java",
"license": "gpl-2.0",
"size": 17561
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 188,259
|
NodeList nodes = element.getElementsByTagName(node);
if (nodes.getLength() > 0) {
return nodes.item(0).getTextContent();
} else {
return null;
}
}
Registration() {
mTags = new ArrayList<String>();
}
|
NodeList nodes = element.getElementsByTagName(node); if (nodes.getLength() > 0) { return nodes.item(0).getTextContent(); } else { return null; } } Registration() { mTags = new ArrayList<String>(); }
|
/**
* Get the node value
*
* @param element
* The element to read
* @param node
* The node name to retrieve
* @return
*/
|
Get the node value
|
getNodeValue
|
{
"repo_name": "apuyana/azure-mobile-services",
"path": "sdk/android/src/sdk/src/com/microsoft/windowsazure/mobileservices/Registration.java",
"license": "apache-2.0",
"size": 3727
}
|
[
"java.util.ArrayList",
"org.w3c.dom.NodeList"
] |
import java.util.ArrayList; import org.w3c.dom.NodeList;
|
import java.util.*; import org.w3c.dom.*;
|
[
"java.util",
"org.w3c.dom"
] |
java.util; org.w3c.dom;
| 669,983
|
if (cause instanceof SQLException) {
SQLException sqlException = (SQLException) cause;
return null == sqlException.getSQLState() ? new MySQLErrPacket(1, MySQLServerErrorCode.ER_INTERNAL_ERROR, getErrorMessage(sqlException))
: new MySQLErrPacket(1, sqlException.getErrorCode(), sqlException.getSQLState(), sqlException.getMessage());
}
if (cause instanceof CommonDistSQLException) {
CommonDistSQLException commonDistSQLException = (CommonDistSQLException) cause;
return new MySQLErrPacket(1, CommonDistSQLErrorCode.valueOf(commonDistSQLException), commonDistSQLException.getVariable());
}
if (cause instanceof TableModifyInTransactionException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE, ((TableModifyInTransactionException) cause).getTableName());
}
if (cause instanceof UnknownDatabaseException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_BAD_DB_ERROR, ((UnknownDatabaseException) cause).getDatabaseName());
}
if (cause instanceof SchemaNotExistedException) {
return null != ((SchemaNotExistedException) cause).getSchemaName()
? new MySQLErrPacket(1, MySQLServerErrorCode.ER_BAD_DB_ERROR, ((SchemaNotExistedException) cause).getSchemaName())
: new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_DB_ERROR);
}
if (cause instanceof NoDatabaseSelectedException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_DB_ERROR);
}
if (cause instanceof DBCreateExistsException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_DB_CREATE_EXISTS_ERROR, ((DBCreateExistsException) cause).getDatabaseName());
}
if (cause instanceof DBDropNotExistsException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_DB_DROP_NOT_EXISTS_ERROR, ((DBDropNotExistsException) cause).getDatabaseName());
}
if (cause instanceof TableExistsException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_TABLE_EXISTS_ERROR, ((TableExistsException) cause).getTableName());
}
if (cause instanceof NoSuchTableException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_SUCH_TABLE, ((NoSuchTableException) cause).getTableName());
}
if (cause instanceof CircuitBreakException) {
return new MySQLErrPacket(1, CommonErrorCode.CIRCUIT_BREAK_MODE);
}
if (cause instanceof UnsupportedCommandException) {
return new MySQLErrPacket(1, CommonErrorCode.UNSUPPORTED_COMMAND, ((UnsupportedCommandException) cause).getCommandType());
}
if (cause instanceof UnsupportedPreparedStatementException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_UNSUPPORTED_PS);
}
if (cause instanceof ShardingSphereConfigurationException || cause instanceof SQLParsingException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NOT_SUPPORTED_YET, cause.getMessage());
}
if (cause instanceof RuleNotExistedException || cause instanceof DatabaseNotExistedException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_SP_DOES_NOT_EXIST);
}
if (cause instanceof TableLockWaitTimeoutException) {
TableLockWaitTimeoutException exception = (TableLockWaitTimeoutException) cause;
return new MySQLErrPacket(1, CommonErrorCode.TABLE_LOCK_WAIT_TIMEOUT, exception.getTableName(),
exception.getSchemaName(), exception.getTimeoutMilliseconds());
}
if (cause instanceof TableLockedException) {
TableLockedException exception = (TableLockedException) cause;
return new MySQLErrPacket(1, CommonErrorCode.TABLE_LOCKED, exception.getTableName(),
exception.getSchemaName());
}
if (cause instanceof PipelineJobNotFoundException) {
return new MySQLErrPacket(1, CommonErrorCode.SCALING_JOB_NOT_EXIST, ((PipelineJobNotFoundException) cause).getJobId());
}
if (cause instanceof FrontendTooManyConnectionsException) {
return new MySQLErrPacket(0, MySQLServerErrorCode.ER_CON_COUNT_ERROR, MySQLServerErrorCode.ER_CON_COUNT_ERROR.getErrorMessage());
}
if (cause instanceof UnknownCharacterSetException) {
return new MySQLErrPacket(1, MySQLServerErrorCode.ER_UNKNOWN_CHARACTER_SET, cause.getMessage());
}
if (cause instanceof RuntimeException) {
return new MySQLErrPacket(1, CommonErrorCode.RUNTIME_EXCEPTION, cause.getMessage());
}
return new MySQLErrPacket(1, CommonErrorCode.UNKNOWN_EXCEPTION, cause.getMessage());
}
|
if (cause instanceof SQLException) { SQLException sqlException = (SQLException) cause; return null == sqlException.getSQLState() ? new MySQLErrPacket(1, MySQLServerErrorCode.ER_INTERNAL_ERROR, getErrorMessage(sqlException)) : new MySQLErrPacket(1, sqlException.getErrorCode(), sqlException.getSQLState(), sqlException.getMessage()); } if (cause instanceof CommonDistSQLException) { CommonDistSQLException commonDistSQLException = (CommonDistSQLException) cause; return new MySQLErrPacket(1, CommonDistSQLErrorCode.valueOf(commonDistSQLException), commonDistSQLException.getVariable()); } if (cause instanceof TableModifyInTransactionException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE, ((TableModifyInTransactionException) cause).getTableName()); } if (cause instanceof UnknownDatabaseException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_BAD_DB_ERROR, ((UnknownDatabaseException) cause).getDatabaseName()); } if (cause instanceof SchemaNotExistedException) { return null != ((SchemaNotExistedException) cause).getSchemaName() ? new MySQLErrPacket(1, MySQLServerErrorCode.ER_BAD_DB_ERROR, ((SchemaNotExistedException) cause).getSchemaName()) : new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_DB_ERROR); } if (cause instanceof NoDatabaseSelectedException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_DB_ERROR); } if (cause instanceof DBCreateExistsException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_DB_CREATE_EXISTS_ERROR, ((DBCreateExistsException) cause).getDatabaseName()); } if (cause instanceof DBDropNotExistsException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_DB_DROP_NOT_EXISTS_ERROR, ((DBDropNotExistsException) cause).getDatabaseName()); } if (cause instanceof TableExistsException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_TABLE_EXISTS_ERROR, ((TableExistsException) cause).getTableName()); } if (cause instanceof NoSuchTableException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_SUCH_TABLE, ((NoSuchTableException) cause).getTableName()); } if (cause instanceof CircuitBreakException) { return new MySQLErrPacket(1, CommonErrorCode.CIRCUIT_BREAK_MODE); } if (cause instanceof UnsupportedCommandException) { return new MySQLErrPacket(1, CommonErrorCode.UNSUPPORTED_COMMAND, ((UnsupportedCommandException) cause).getCommandType()); } if (cause instanceof UnsupportedPreparedStatementException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_UNSUPPORTED_PS); } if (cause instanceof ShardingSphereConfigurationException cause instanceof SQLParsingException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NOT_SUPPORTED_YET, cause.getMessage()); } if (cause instanceof RuleNotExistedException cause instanceof DatabaseNotExistedException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_SP_DOES_NOT_EXIST); } if (cause instanceof TableLockWaitTimeoutException) { TableLockWaitTimeoutException exception = (TableLockWaitTimeoutException) cause; return new MySQLErrPacket(1, CommonErrorCode.TABLE_LOCK_WAIT_TIMEOUT, exception.getTableName(), exception.getSchemaName(), exception.getTimeoutMilliseconds()); } if (cause instanceof TableLockedException) { TableLockedException exception = (TableLockedException) cause; return new MySQLErrPacket(1, CommonErrorCode.TABLE_LOCKED, exception.getTableName(), exception.getSchemaName()); } if (cause instanceof PipelineJobNotFoundException) { return new MySQLErrPacket(1, CommonErrorCode.SCALING_JOB_NOT_EXIST, ((PipelineJobNotFoundException) cause).getJobId()); } if (cause instanceof FrontendTooManyConnectionsException) { return new MySQLErrPacket(0, MySQLServerErrorCode.ER_CON_COUNT_ERROR, MySQLServerErrorCode.ER_CON_COUNT_ERROR.getErrorMessage()); } if (cause instanceof UnknownCharacterSetException) { return new MySQLErrPacket(1, MySQLServerErrorCode.ER_UNKNOWN_CHARACTER_SET, cause.getMessage()); } if (cause instanceof RuntimeException) { return new MySQLErrPacket(1, CommonErrorCode.RUNTIME_EXCEPTION, cause.getMessage()); } return new MySQLErrPacket(1, CommonErrorCode.UNKNOWN_EXCEPTION, cause.getMessage()); }
|
/**
* New instance of MySQL ERR packet.
*
* @param cause cause
* @return instance of MySQL ERR packet
*/
|
New instance of MySQL ERR packet
|
newInstance
|
{
"repo_name": "apache/incubator-shardingsphere",
"path": "shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java",
"license": "apache-2.0",
"size": 8684
}
|
[
"java.sql.SQLException",
"org.apache.shardingsphere.data.pipeline.core.exception.PipelineJobNotFoundException",
"org.apache.shardingsphere.db.protocol.error.CommonErrorCode",
"org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode",
"org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket",
"org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException",
"org.apache.shardingsphere.infra.exception.SchemaNotExistedException",
"org.apache.shardingsphere.proxy.backend.exception.CircuitBreakException",
"org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException",
"org.apache.shardingsphere.proxy.backend.exception.DBDropNotExistsException",
"org.apache.shardingsphere.proxy.backend.exception.DatabaseNotExistedException",
"org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException",
"org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException",
"org.apache.shardingsphere.proxy.backend.exception.TableLockWaitTimeoutException",
"org.apache.shardingsphere.proxy.backend.exception.TableLockedException",
"org.apache.shardingsphere.proxy.backend.exception.TableModifyInTransactionException",
"org.apache.shardingsphere.proxy.backend.exception.UnknownDatabaseException",
"org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.CommonDistSQLErrorCode",
"org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.CommonDistSQLException",
"org.apache.shardingsphere.proxy.frontend.exception.FrontendTooManyConnectionsException",
"org.apache.shardingsphere.proxy.frontend.exception.UnsupportedCommandException",
"org.apache.shardingsphere.proxy.frontend.exception.UnsupportedPreparedStatementException",
"org.apache.shardingsphere.proxy.frontend.mysql.command.query.exception.UnknownCharacterSetException",
"org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException",
"org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException",
"org.apache.shardingsphere.sql.parser.exception.SQLParsingException"
] |
import java.sql.SQLException; import org.apache.shardingsphere.data.pipeline.core.exception.PipelineJobNotFoundException; import org.apache.shardingsphere.db.protocol.error.CommonErrorCode; import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode; import org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket; import org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException; import org.apache.shardingsphere.infra.exception.SchemaNotExistedException; import org.apache.shardingsphere.proxy.backend.exception.CircuitBreakException; import org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException; import org.apache.shardingsphere.proxy.backend.exception.DBDropNotExistsException; import org.apache.shardingsphere.proxy.backend.exception.DatabaseNotExistedException; import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException; import org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException; import org.apache.shardingsphere.proxy.backend.exception.TableLockWaitTimeoutException; import org.apache.shardingsphere.proxy.backend.exception.TableLockedException; import org.apache.shardingsphere.proxy.backend.exception.TableModifyInTransactionException; import org.apache.shardingsphere.proxy.backend.exception.UnknownDatabaseException; import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.CommonDistSQLErrorCode; import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.CommonDistSQLException; import org.apache.shardingsphere.proxy.frontend.exception.FrontendTooManyConnectionsException; import org.apache.shardingsphere.proxy.frontend.exception.UnsupportedCommandException; import org.apache.shardingsphere.proxy.frontend.exception.UnsupportedPreparedStatementException; import org.apache.shardingsphere.proxy.frontend.mysql.command.query.exception.UnknownCharacterSetException; import org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException; import org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException; import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
|
import java.sql.*; import org.apache.shardingsphere.data.pipeline.core.exception.*; import org.apache.shardingsphere.db.protocol.error.*; import org.apache.shardingsphere.db.protocol.mysql.constant.*; import org.apache.shardingsphere.db.protocol.mysql.packet.generic.*; import org.apache.shardingsphere.infra.config.exception.*; import org.apache.shardingsphere.infra.exception.*; import org.apache.shardingsphere.proxy.backend.exception.*; import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.*; import org.apache.shardingsphere.proxy.frontend.exception.*; import org.apache.shardingsphere.proxy.frontend.mysql.command.query.exception.*; import org.apache.shardingsphere.sharding.route.engine.exception.*; import org.apache.shardingsphere.sql.parser.exception.*;
|
[
"java.sql",
"org.apache.shardingsphere"
] |
java.sql; org.apache.shardingsphere;
| 1,692,760
|
public static int getFooterCount(TableDesc table, JobConf job) throws IOException {
int footerCount;
try {
footerCount = Integer.parseInt(table.getProperties().getProperty(serdeConstants.FOOTER_COUNT, "0"));
if (footerCount > HiveConf.getIntVar(job, HiveConf.ConfVars.HIVE_FILE_MAX_FOOTER)) {
throw new IOException("footer number exceeds the limit defined in hive.file.max.footer");
}
} catch (NumberFormatException nfe) {
// Footer line number must be set as an integer.
throw new IOException(nfe);
}
return footerCount;
}
|
static int function(TableDesc table, JobConf job) throws IOException { int footerCount; try { footerCount = Integer.parseInt(table.getProperties().getProperty(serdeConstants.FOOTER_COUNT, "0")); if (footerCount > HiveConf.getIntVar(job, HiveConf.ConfVars.HIVE_FILE_MAX_FOOTER)) { throw new IOException(STR); } } catch (NumberFormatException nfe) { throw new IOException(nfe); } return footerCount; }
|
/**
* Get footer line count for a table.
*
* @param table
* Table description for target table.
*
* @param job
* Job configuration for current job.
*/
|
Get footer line count for a table
|
getFooterCount
|
{
"repo_name": "BUPTAnderson/apache-hive-2.1.1-src",
"path": "ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java",
"license": "apache-2.0",
"size": 136880
}
|
[
"java.io.IOException",
"org.apache.hadoop.hive.conf.HiveConf",
"org.apache.hadoop.hive.ql.plan.TableDesc",
"org.apache.hadoop.mapred.JobConf"
] |
import java.io.IOException; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.ql.plan.TableDesc; import org.apache.hadoop.mapred.JobConf;
|
import java.io.*; import org.apache.hadoop.hive.conf.*; import org.apache.hadoop.hive.ql.plan.*; import org.apache.hadoop.mapred.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 108,276
|
public static Optional<X509Certificate> parseCertificate(
Optional<Path> certPathOptional, boolean required) {
if (!isFileAvailable(certPathOptional, "certificate", required)) {
return Optional.empty();
}
Path certPath = certPathOptional.get();
try (InputStream certificateIn = Files.newInputStream(certPath)) {
X509Certificate certificate =
(X509Certificate)
CertificateFactory.getInstance("X.509").generateCertificate(certificateIn);
certificate.checkValidity();
return Optional.of(certificate);
} catch (CertificateExpiredException e) {
throwIfRequired(required, e, "The client certificate at %s has expired", certPath);
} catch (CertificateNotYetValidException e) {
throwIfRequired(required, e, "The client certificate at %s is not yet valid", certPath);
} catch (CertificateException e) {
throw new HumanReadableException(
e,
"The client certificate at %s does not appear to contain a valid X509 certificate",
certPath);
} catch (IOException e) {
throw new HumanReadableException(e, "Could not read the client certificate at %s", certPath);
}
return Optional.empty();
}
|
static Optional<X509Certificate> function( Optional<Path> certPathOptional, boolean required) { if (!isFileAvailable(certPathOptional, STR, required)) { return Optional.empty(); } Path certPath = certPathOptional.get(); try (InputStream certificateIn = Files.newInputStream(certPath)) { X509Certificate certificate = (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(certificateIn); certificate.checkValidity(); return Optional.of(certificate); } catch (CertificateExpiredException e) { throwIfRequired(required, e, STR, certPath); } catch (CertificateNotYetValidException e) { throwIfRequired(required, e, STR, certPath); } catch (CertificateException e) { throw new HumanReadableException( e, STR, certPath); } catch (IOException e) { throw new HumanReadableException(e, STR, certPath); } return Optional.empty(); }
|
/**
* Parses a PEM encoded X509 certificate
*
* @param certPathOptional The location of the certificate
* @param required whether to throw or ignore on unset / missing / expired certificates
* @throws {@link HumanReadableException} on issues with certificate
*/
|
Parses a PEM encoded X509 certificate
|
parseCertificate
|
{
"repo_name": "rmaz/buck",
"path": "src/com/facebook/buck/artifact_cache/ClientCertificateHandler.java",
"license": "apache-2.0",
"size": 9416
}
|
[
"com.facebook.buck.core.exceptions.HumanReadableException",
"java.io.IOException",
"java.io.InputStream",
"java.nio.file.Files",
"java.nio.file.Path",
"java.security.cert.CertificateException",
"java.security.cert.CertificateExpiredException",
"java.security.cert.CertificateFactory",
"java.security.cert.CertificateNotYetValidException",
"java.security.cert.X509Certificate",
"java.util.Optional"
] |
import com.facebook.buck.core.exceptions.HumanReadableException; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.security.cert.CertificateException; import java.security.cert.CertificateExpiredException; import java.security.cert.CertificateFactory; import java.security.cert.CertificateNotYetValidException; import java.security.cert.X509Certificate; import java.util.Optional;
|
import com.facebook.buck.core.exceptions.*; import java.io.*; import java.nio.file.*; import java.security.cert.*; import java.util.*;
|
[
"com.facebook.buck",
"java.io",
"java.nio",
"java.security",
"java.util"
] |
com.facebook.buck; java.io; java.nio; java.security; java.util;
| 2,578,970
|
@Test
public void testLoggingObjectIsNotLeakInMeta() {
String expected = meta.log.getLogChannelId();
meta.clear();
String actual = meta.log.getLogChannelId();
assertEquals( "Use same logChannel for empty constructors, or assign General level for clear() calls",
expected, actual );
}
|
void function() { String expected = meta.log.getLogChannelId(); meta.clear(); String actual = meta.log.getLogChannelId(); assertEquals( STR, expected, actual ); }
|
/**
* PDI-10762 - Trans and TransMeta leak
*/
|
PDI-10762 - Trans and TransMeta leak
|
testLoggingObjectIsNotLeakInMeta
|
{
"repo_name": "YuryBY/pentaho-kettle",
"path": "engine/test-src/org/pentaho/di/trans/TransTest.java",
"license": "apache-2.0",
"size": 12864
}
|
[
"org.junit.Assert"
] |
import org.junit.Assert;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 2,475,857
|
private static boolean isAllowedTag(HtmlTag tag) {
return ALLOWED_TAGS.contains(tag.getId().toLowerCase(Locale.ENGLISH));
}
|
static boolean function(HtmlTag tag) { return ALLOWED_TAGS.contains(tag.getId().toLowerCase(Locale.ENGLISH)); }
|
/**
* Determines if the HtmlTag is one which is allowed in a javadoc.
*
* @param tag the HtmlTag to check.
* @return {@code true} if the HtmlTag is an allowed html tag.
*/
|
Determines if the HtmlTag is one which is allowed in a javadoc
|
isAllowedTag
|
{
"repo_name": "bansalayush/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java",
"license": "lgpl-2.1",
"size": 19716
}
|
[
"java.util.Locale"
] |
import java.util.Locale;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,766,478
|
void waitForQueuedThreads(Semaphore s) {
long startTime = System.nanoTime();
while (!s.hasQueuedThreads()) {
if (millisElapsedSince(startTime) > LONG_DELAY_MS)
throw new AssertionFailedError("timed out");
Thread.yield();
}
}
|
void waitForQueuedThreads(Semaphore s) { long startTime = System.nanoTime(); while (!s.hasQueuedThreads()) { if (millisElapsedSince(startTime) > LONG_DELAY_MS) throw new AssertionFailedError(STR); Thread.yield(); } }
|
/**
* Spin-waits until s.hasQueuedThreads() becomes true.
*/
|
Spin-waits until s.hasQueuedThreads() becomes true
|
waitForQueuedThreads
|
{
"repo_name": "AdmireTheDistance/android_libcore",
"path": "jsr166-tests/src/test/java/jsr166/SemaphoreTest.java",
"license": "gpl-2.0",
"size": 27330
}
|
[
"java.util.concurrent.Semaphore",
"junit.framework.AssertionFailedError"
] |
import java.util.concurrent.Semaphore; import junit.framework.AssertionFailedError;
|
import java.util.concurrent.*; import junit.framework.*;
|
[
"java.util",
"junit.framework"
] |
java.util; junit.framework;
| 952,259
|
private void recordHistory(Key key, NetworkStatsHistory history) {
if (history.size() == 0) return;
noteRecordedHistory(history.getStart(), history.getEnd(), history.getTotalBytes());
NetworkStatsHistory target = mStats.get(key);
if (target == null) {
target = new NetworkStatsHistory(history.getBucketDuration());
mStats.put(key, target);
}
target.recordEntireHistory(history);
}
|
void function(Key key, NetworkStatsHistory history) { if (history.size() == 0) return; noteRecordedHistory(history.getStart(), history.getEnd(), history.getTotalBytes()); NetworkStatsHistory target = mStats.get(key); if (target == null) { target = new NetworkStatsHistory(history.getBucketDuration()); mStats.put(key, target); } target.recordEntireHistory(history); }
|
/**
* Record given {@link NetworkStatsHistory} into this collection.
*/
|
Record given <code>NetworkStatsHistory</code> into this collection
|
recordHistory
|
{
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/server/net/NetworkStatsCollection.java",
"license": "apache-2.0",
"size": 19024
}
|
[
"android.net.NetworkStatsHistory"
] |
import android.net.NetworkStatsHistory;
|
import android.net.*;
|
[
"android.net"
] |
android.net;
| 623,070
|
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mActivity = (ClinicalGuideActivity) getActivity();
View v = inflater.inflate(R.layout.patient_details, container, false);
RelativeLayout rl = (RelativeLayout) v.findViewById(R.id.layout);
Object arg = getArguments().get("viewMode");
if (arg != null) {
mViewMode = (Integer) arg;
} else {
mViewMode = MODE_EDIT;
}
if (mViewMode == MODE_ADD) {
mActivity.setTitle(ADD_PATIENT);
} else {
mActivity.setTitle(EDIT_PATIENT);
}
arg = getArguments().get(PatientsFragment.ARG_KEY_SELECTED_PATIENT);
if (arg != null) {
mPatient = (PatientDetails) arg;
} else {
mPatient = new PatientDetails(mActivity.getXmlParser()
.getPatientDetails());
}
int lastId = 0;
|
View function(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mActivity = (ClinicalGuideActivity) getActivity(); View v = inflater.inflate(R.layout.patient_details, container, false); RelativeLayout rl = (RelativeLayout) v.findViewById(R.id.layout); Object arg = getArguments().get(STR); if (arg != null) { mViewMode = (Integer) arg; } else { mViewMode = MODE_EDIT; } if (mViewMode == MODE_ADD) { mActivity.setTitle(ADD_PATIENT); } else { mActivity.setTitle(EDIT_PATIENT); } arg = getArguments().get(PatientsFragment.ARG_KEY_SELECTED_PATIENT); if (arg != null) { mPatient = (PatientDetails) arg; } else { mPatient = new PatientDetails(mActivity.getXmlParser() .getPatientDetails()); } int lastId = 0;
|
/**
* Initializes the PatientDetailsFragment.
*/
|
Initializes the PatientDetailsFragment
|
onCreateView
|
{
"repo_name": "ecemgroup/clinicalguide",
"path": "src/org/get/oxicam/clinicalguide/ui/PatientDetailsFragment.java",
"license": "apache-2.0",
"size": 19176
}
|
[
"android.os.Bundle",
"android.view.LayoutInflater",
"android.view.View",
"android.view.ViewGroup",
"android.widget.RelativeLayout",
"org.get.oxicam.clinicalguide.ClinicalGuideActivity",
"org.get.oxicam.clinicalguide.db.PatientDetails"
] |
import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import org.get.oxicam.clinicalguide.ClinicalGuideActivity; import org.get.oxicam.clinicalguide.db.PatientDetails;
|
import android.os.*; import android.view.*; import android.widget.*; import org.get.oxicam.clinicalguide.*; import org.get.oxicam.clinicalguide.db.*;
|
[
"android.os",
"android.view",
"android.widget",
"org.get.oxicam"
] |
android.os; android.view; android.widget; org.get.oxicam;
| 631,879
|
public HubBillingInfoFormat hubBillingInfo() {
return this.hubBillingInfo;
}
|
HubBillingInfoFormat function() { return this.hubBillingInfo; }
|
/**
* Get the hubBillingInfo property: Billing settings of the hub.
*
* @return the hubBillingInfo value.
*/
|
Get the hubBillingInfo property: Billing settings of the hub
|
hubBillingInfo
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/customerinsights/azure-resourcemanager-customerinsights/src/main/java/com/azure/resourcemanager/customerinsights/fluent/models/HubInner.java",
"license": "mit",
"size": 4443
}
|
[
"com.azure.resourcemanager.customerinsights.models.HubBillingInfoFormat"
] |
import com.azure.resourcemanager.customerinsights.models.HubBillingInfoFormat;
|
import com.azure.resourcemanager.customerinsights.models.*;
|
[
"com.azure.resourcemanager"
] |
com.azure.resourcemanager;
| 1,110,298
|
protected void deleteExpiredEntries() {
// Check if expiration is turned on.
if (maxLifetime <= 0) {
return;
}
// Remove all old entries. To do this, we remove objects from the end
// of the linked list until they are no longer too old. We get to avoid
// any hash lookups or looking at any more objects than is strictly
// neccessary.
LinkedListNode node = ageList.getLast();
// If there are no entries in the age list, return.
if (node == null) {
return;
}
// Determine the expireTime, which is the moment in time that elements
// should expire from cache. Then, we can do an easy to check to see
// if the expire time is greater than the expire time.
long expireTime = System.currentTimeMillis() - maxLifetime;
while (expireTime > node.timestamp) {
// Remove the object
remove(node.object);
// Get the next node.
node = ageList.getLast();
// If there are no more entries in the age list, return.
if (node == null) {
return;
}
}
}
|
void function() { if (maxLifetime <= 0) { return; } LinkedListNode node = ageList.getLast(); if (node == null) { return; } long expireTime = System.currentTimeMillis() - maxLifetime; while (expireTime > node.timestamp) { remove(node.object); node = ageList.getLast(); if (node == null) { return; } } }
|
/**
* Clears all entries out of cache where the entries are older than the
* maximum defined age.
*/
|
Clears all entries out of cache where the entries are older than the maximum defined age
|
deleteExpiredEntries
|
{
"repo_name": "derek-wang/ca.rides.openfire",
"path": "src/java/org/jivesoftware/util/cache/DefaultCache.java",
"license": "apache-2.0",
"size": 22820
}
|
[
"org.jivesoftware.util.LinkedListNode"
] |
import org.jivesoftware.util.LinkedListNode;
|
import org.jivesoftware.util.*;
|
[
"org.jivesoftware.util"
] |
org.jivesoftware.util;
| 52,021
|
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public List<UserRepresentation> getUsers(@QueryParam("search") String search,
@QueryParam("lastName") String last,
@QueryParam("firstName") String first,
@QueryParam("email") String email,
@QueryParam("username") String username,
@QueryParam("first") Integer firstResult,
@QueryParam("max") Integer maxResults) {
auth.requireView();
firstResult = firstResult != null ? firstResult : -1;
maxResults = maxResults != null ? maxResults : -1;
List<UserRepresentation> results = new ArrayList<UserRepresentation>();
List<UserModel> userModels;
if (search != null) {
userModels = session.users().searchForUser(search.trim(), realm, firstResult, maxResults);
} else if (last != null || first != null || email != null || username != null) {
Map<String, String> attributes = new HashMap<String, String>();
if (last != null) {
attributes.put(UserModel.LAST_NAME, last);
}
if (first != null) {
attributes.put(UserModel.FIRST_NAME, first);
}
if (email != null) {
attributes.put(UserModel.EMAIL, email);
}
if (username != null) {
attributes.put(UserModel.USERNAME, username);
}
userModels = session.users().searchForUserByAttributes(attributes, realm, firstResult, maxResults);
} else {
userModels = session.users().getUsers(realm, firstResult, maxResults, false);
}
for (UserModel user : userModels) {
results.add(ModelToRepresentation.toRepresentation(user));
}
return results;
}
|
@Produces(MediaType.APPLICATION_JSON) List<UserRepresentation> function(@QueryParam(STR) String search, @QueryParam(STR) String last, @QueryParam(STR) String first, @QueryParam("email") String email, @QueryParam(STR) String username, @QueryParam("first") Integer firstResult, @QueryParam("max") Integer maxResults) { auth.requireView(); firstResult = firstResult != null ? firstResult : -1; maxResults = maxResults != null ? maxResults : -1; List<UserRepresentation> results = new ArrayList<UserRepresentation>(); List<UserModel> userModels; if (search != null) { userModels = session.users().searchForUser(search.trim(), realm, firstResult, maxResults); } else if (last != null first != null email != null username != null) { Map<String, String> attributes = new HashMap<String, String>(); if (last != null) { attributes.put(UserModel.LAST_NAME, last); } if (first != null) { attributes.put(UserModel.FIRST_NAME, first); } if (email != null) { attributes.put(UserModel.EMAIL, email); } if (username != null) { attributes.put(UserModel.USERNAME, username); } userModels = session.users().searchForUserByAttributes(attributes, realm, firstResult, maxResults); } else { userModels = session.users().getUsers(realm, firstResult, maxResults, false); } for (UserModel user : userModels) { results.add(ModelToRepresentation.toRepresentation(user)); } return results; }
|
/**
* Get users
*
* Returns a list of users, filtered according to query parameters
*
* @param search A String contained in username, first or last name, or email
* @param last
* @param first
* @param email
* @param username
* @param first Pagination offset
* @param maxResults Pagination size
* @return
*/
|
Get users Returns a list of users, filtered according to query parameters
|
getUsers
|
{
"repo_name": "VihreatDeGrona/keycloak",
"path": "services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java",
"license": "apache-2.0",
"size": 38116
}
|
[
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"javax.ws.rs.Produces",
"javax.ws.rs.QueryParam",
"javax.ws.rs.core.MediaType",
"org.keycloak.models.UserModel",
"org.keycloak.models.utils.ModelToRepresentation",
"org.keycloak.representations.idm.UserRepresentation"
] |
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.keycloak.models.UserModel; import org.keycloak.models.utils.ModelToRepresentation; import org.keycloak.representations.idm.UserRepresentation;
|
import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.keycloak.models.*; import org.keycloak.models.utils.*; import org.keycloak.representations.idm.*;
|
[
"java.util",
"javax.ws",
"org.keycloak.models",
"org.keycloak.representations"
] |
java.util; javax.ws; org.keycloak.models; org.keycloak.representations;
| 1,189,915
|
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (other instanceof AnalysisLimits == false) {
return false;
}
AnalysisLimits that = (AnalysisLimits) other;
return Objects.equals(this.modelMemoryLimit, that.modelMemoryLimit) &&
Objects.equals(this.categorizationExamplesLimit, that.categorizationExamplesLimit);
}
|
boolean function(Object other) { if (this == other) { return true; } if (other instanceof AnalysisLimits == false) { return false; } AnalysisLimits that = (AnalysisLimits) other; return Objects.equals(this.modelMemoryLimit, that.modelMemoryLimit) && Objects.equals(this.categorizationExamplesLimit, that.categorizationExamplesLimit); }
|
/**
* Overridden equality test
*/
|
Overridden equality test
|
equals
|
{
"repo_name": "nknize/elasticsearch",
"path": "x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/AnalysisLimits.java",
"license": "apache-2.0",
"size": 9345
}
|
[
"java.util.Objects"
] |
import java.util.Objects;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,678,704
|
public static String[] splitWavInPart(String inputPath,int numParts,String outputPath,String nameOutputFile,int numberCharacter) throws UnsupportedAudioFileException, IOException, EccezioneSuoni {
return splitWavInPart(inputPath, numParts, outputPath, nameOutputFile, numberCharacter,1);
}
//MP3 PROPERTIES
|
static String[] function(String inputPath,int numParts,String outputPath,String nameOutputFile,int numberCharacter) throws UnsupportedAudioFileException, IOException, EccezioneSuoni { return splitWavInPart(inputPath, numParts, outputPath, nameOutputFile, numberCharacter,1); }
|
/**
* Split an wav file in a specific number of parts. The first number in part's name is 1.
* @param inputPath absolute path of mp3 file to split
* @param numParts number of parts
* @param outputPath absolute path of outout directory
* @param nameOutputFile base name of single part
* @param numberCharacter number of char in part's name
* @param firstNumberInTheName first number in part's name
* @return The names of splitted wav file parts
* @throws UnsupportedAudioFileException
* @throws IOException
* @throws EccezioneSuoni
* @throws JavaLayerException
*/
|
Split an wav file in a specific number of parts. The first number in part's name is 1
|
splitWavInPart
|
{
"repo_name": "sdecri/Souni",
"path": "src/suoni/Utils.java",
"license": "gpl-2.0",
"size": 30714
}
|
[
"java.io.IOException",
"javax.sound.sampled.UnsupportedAudioFileException"
] |
import java.io.IOException; import javax.sound.sampled.UnsupportedAudioFileException;
|
import java.io.*; import javax.sound.sampled.*;
|
[
"java.io",
"javax.sound"
] |
java.io; javax.sound;
| 245,341
|
@Test
public void formatElapsedTime100000()
{
final String title = "Test";
final long start = 1;
final long end = 100001;
final TimePrinter timePrinter = new TimePrinter();
final String result = timePrinter.formatElapsedTime(title, start, end);
assertNotNull(result);
assertThat(result, is("Test elapsed time 1:40 (100000 ms)"));
}
|
void function() { final String title = "Test"; final long start = 1; final long end = 100001; final TimePrinter timePrinter = new TimePrinter(); final String result = timePrinter.formatElapsedTime(title, start, end); assertNotNull(result); assertThat(result, is(STR)); }
|
/**
* Test the <code>formatElapsedTime()</code> method.
*/
|
Test the <code>formatElapsedTime()</code> method
|
formatElapsedTime100000
|
{
"repo_name": "jmthompson2015/vizzini",
"path": "core/src/test/java/org/vizzini/core/TimePrinterTest.java",
"license": "mit",
"size": 3628
}
|
[
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.junit.Test"
] |
import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test;
|
import org.hamcrest.*; import org.junit.*;
|
[
"org.hamcrest",
"org.junit"
] |
org.hamcrest; org.junit;
| 2,408,748
|
public ServiceFuture<VpnServerConfigurationInner> getByResourceGroupAsync(String resourceGroupName, String vpnServerConfigurationName, final ServiceCallback<VpnServerConfigurationInner> serviceCallback) {
return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, vpnServerConfigurationName), serviceCallback);
}
|
ServiceFuture<VpnServerConfigurationInner> function(String resourceGroupName, String vpnServerConfigurationName, final ServiceCallback<VpnServerConfigurationInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, vpnServerConfigurationName), serviceCallback); }
|
/**
* Retrieves the details of a VpnServerConfiguration.
*
* @param resourceGroupName The resource group name of the VpnServerConfiguration.
* @param vpnServerConfigurationName The name of the VpnServerConfiguration being retrieved.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
|
Retrieves the details of a VpnServerConfiguration
|
getByResourceGroupAsync
|
{
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/VpnServerConfigurationsInner.java",
"license": "mit",
"size": 70526
}
|
[
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] |
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
|
import com.microsoft.rest.*;
|
[
"com.microsoft.rest"
] |
com.microsoft.rest;
| 1,200,856
|
public static boolean getenableReleaseLockEvent()
{
return (java.lang.Boolean)Core.getConfiguration().getConstantValue("CommunityCommons.enableReleaseLockEvent");
}
|
static boolean function() { return (java.lang.Boolean)Core.getConfiguration().getConstantValue(STR); }
|
/**
* If this constant is set to 'true', old locks will be released automatically. Set this constant to 'false' if community commons locking is not used. Use true in all other cases.
*/
|
If this constant is set to 'true', old locks will be released automatically. Set this constant to 'false' if community commons locking is not used. Use true in all other cases
|
getenableReleaseLockEvent
|
{
"repo_name": "mrgroen/GoogleCharts",
"path": "test/javasource/communitycommons/proxies/constants/Constants.java",
"license": "apache-2.0",
"size": 659
}
|
[
"com.mendix.core.Core"
] |
import com.mendix.core.Core;
|
import com.mendix.core.*;
|
[
"com.mendix.core"
] |
com.mendix.core;
| 62,954
|
protected void awaitShutdown(final long timeout) throws InterruptedException {
synchronized (this.statusLock) {
final long deadline = System.currentTimeMillis() + timeout;
long remaining = timeout;
while (this.status != IOReactorStatus.SHUT_DOWN) {
this.statusLock.wait(remaining);
if (timeout > 0) {
remaining = deadline - System.currentTimeMillis();
if (remaining <= 0) {
break;
}
}
}
}
}
|
void function(final long timeout) throws InterruptedException { synchronized (this.statusLock) { final long deadline = System.currentTimeMillis() + timeout; long remaining = timeout; while (this.status != IOReactorStatus.SHUT_DOWN) { this.statusLock.wait(remaining); if (timeout > 0) { remaining = deadline - System.currentTimeMillis(); if (remaining <= 0) { break; } } } } }
|
/**
* Blocks for the given period of time in milliseconds awaiting
* the completion of the reactor shutdown. If the value of
* {@code timeout} is set to {@code 0} this method blocks
* indefinitely.
*
* @param timeout the maximum wait time.
* @throws InterruptedException if interrupted.
*/
|
Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown. If the value of timeout is set to 0 this method blocks indefinitely
|
awaitShutdown
|
{
"repo_name": "cictourgune/MDP-Airbnb",
"path": "httpcomponents-core-4.4/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java",
"license": "apache-2.0",
"size": 23568
}
|
[
"org.apache.http.nio.reactor.IOReactorStatus"
] |
import org.apache.http.nio.reactor.IOReactorStatus;
|
import org.apache.http.nio.reactor.*;
|
[
"org.apache.http"
] |
org.apache.http;
| 680,392
|
private boolean change_resubmit_option(SessionState state, Entity entity)
{
if (entity != null)
{
// editing
return propertyValueChanged(state, entity, AssignmentSubmission.ALLOW_RESUBMIT_NUMBER) || propertyValueChanged(state, entity, AssignmentSubmission.ALLOW_RESUBMIT_CLOSETIME);
}
return false;
}
|
boolean function(SessionState state, Entity entity) { if (entity != null) { return propertyValueChanged(state, entity, AssignmentSubmission.ALLOW_RESUBMIT_NUMBER) propertyValueChanged(state, entity, AssignmentSubmission.ALLOW_RESUBMIT_CLOSETIME); } return false; }
|
/**
* whether the resubmit option has been changed
* @param state
* @param a
* @return
*/
|
whether the resubmit option has been changed
|
change_resubmit_option
|
{
"repo_name": "rodriguezdevera/sakai",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 685575
}
|
[
"org.sakaiproject.assignment.api.AssignmentSubmission",
"org.sakaiproject.entity.api.Entity",
"org.sakaiproject.event.api.SessionState"
] |
import org.sakaiproject.assignment.api.AssignmentSubmission; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.event.api.SessionState;
|
import org.sakaiproject.assignment.api.*; import org.sakaiproject.entity.api.*; import org.sakaiproject.event.api.*;
|
[
"org.sakaiproject.assignment",
"org.sakaiproject.entity",
"org.sakaiproject.event"
] |
org.sakaiproject.assignment; org.sakaiproject.entity; org.sakaiproject.event;
| 1,051,833
|
private Node parseTypeExpressionList(JsDocToken token) {
Node typeExpr = parseTopLevelTypeExpression(token);
if (typeExpr == null) {
return null;
}
Node typeList = IR.block();
typeList.addChildToBack(typeExpr);
while (match(JsDocToken.COMMA)) {
next();
skipEOLs();
typeExpr = parseTopLevelTypeExpression(next());
if (typeExpr == null) {
return null;
}
typeList.addChildToBack(typeExpr);
}
return typeList;
}
|
Node function(JsDocToken token) { Node typeExpr = parseTopLevelTypeExpression(token); if (typeExpr == null) { return null; } Node typeList = IR.block(); typeList.addChildToBack(typeExpr); while (match(JsDocToken.COMMA)) { next(); skipEOLs(); typeExpr = parseTopLevelTypeExpression(next()); if (typeExpr == null) { return null; } typeList.addChildToBack(typeExpr); } return typeList; }
|
/**
* TypeExpressionList := TopLevelTypeExpression
* | TopLevelTypeExpression ',' TypeExpressionList
*/
|
TypeExpressionList := TopLevelTypeExpression | TopLevelTypeExpression ',' TypeExpressionList
|
parseTypeExpressionList
|
{
"repo_name": "maio/closure-compiler",
"path": "src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java",
"license": "apache-2.0",
"size": 86068
}
|
[
"com.google.javascript.rhino.IR",
"com.google.javascript.rhino.Node"
] |
import com.google.javascript.rhino.IR; import com.google.javascript.rhino.Node;
|
import com.google.javascript.rhino.*;
|
[
"com.google.javascript"
] |
com.google.javascript;
| 2,565,150
|
public static ims.ocrr.orderingresults.domain.objects.OrderInvestigation extractOrderInvestigation(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.OrderInvestigationBookingWithStatusVo valueObject)
{
return extractOrderInvestigation(domainFactory, valueObject, new HashMap());
}
|
static ims.ocrr.orderingresults.domain.objects.OrderInvestigation function(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.OrderInvestigationBookingWithStatusVo valueObject) { return extractOrderInvestigation(domainFactory, valueObject, new HashMap()); }
|
/**
* Create the domain object from the value object.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param valueObject - extract the domain object fields from this.
*/
|
Create the domain object from the value object
|
extractOrderInvestigation
|
{
"repo_name": "open-health-hub/openmaxims-linux",
"path": "openmaxims_workspace/ValueObjects/src/ims/ocrr/vo/domain/OrderInvestigationBookingWithStatusVoAssembler.java",
"license": "agpl-3.0",
"size": 19375
}
|
[
"java.util.HashMap"
] |
import java.util.HashMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,512,719
|
private long getTS(Path p) {
String[] parts = p.getName().split("\\.");
return Long.parseLong(parts[parts.length-1]);
}
}
|
long function(Path p) { String[] parts = p.getName().split("\\."); return Long.parseLong(parts[parts.length-1]); } }
|
/**
* Split a path to get the start time
* For example: 10.20.20.171%3A60020.1277499063250
* @param p path to split
* @return start time
*/
|
Split a path to get the start time For example: 10.20.20.171%3A60020.1277499063250
|
getTS
|
{
"repo_name": "toshimasa-nasu/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java",
"license": "apache-2.0",
"size": 34331
}
|
[
"org.apache.hadoop.fs.Path"
] |
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 2,716,305
|
public BigDecimal getFrozenBalance() {
return frozenBalance;
}
|
BigDecimal function() { return frozenBalance; }
|
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column cash_acc.frozen_balance
*
* @return the value of cash_acc.frozen_balance
*
* @mbggenerated
*/
|
This method was generated by MyBatis Generator. This method returns the value of the database column cash_acc.frozen_balance
|
getFrozenBalance
|
{
"repo_name": "wanghongfei/taolijie",
"path": "src/main/java/com/fh/taolijie/domain/acc/CashAccModel.java",
"license": "gpl-3.0",
"size": 8918
}
|
[
"java.math.BigDecimal"
] |
import java.math.BigDecimal;
|
import java.math.*;
|
[
"java.math"
] |
java.math;
| 99,042
|
public static long parseLong(TableRow row, String colName) {
String val = (String) row.get(colName);
return val!=null ? Long.parseLong(val) : 0;
}
|
static long function(TableRow row, String colName) { String val = (String) row.get(colName); return val!=null ? Long.parseLong(val) : 0; }
|
/**
* Extract INTEGER value from BQ table cell. Return 0 if null in BQ table
*/
|
Extract INTEGER value from BQ table cell. Return 0 if null in BQ table
|
parseLong
|
{
"repo_name": "modrykonik/dash-pipeline",
"path": "src/main/java/com/modrykonik/dash/io/BQUtils.java",
"license": "gpl-3.0",
"size": 6917
}
|
[
"com.google.api.services.bigquery.model.TableRow"
] |
import com.google.api.services.bigquery.model.TableRow;
|
import com.google.api.services.bigquery.model.*;
|
[
"com.google.api"
] |
com.google.api;
| 687,179
|
private void dialogChanged() {
IResource container = ResourcesPlugin.getWorkspace().getRoot()
.findMember(new Path(getContainerName().get("ProjectPath")));
if(!containerSourceText.getText().isEmpty() && !containerTargetText.getText().isEmpty())
{
okButton.setEnabled(true);
}
if (getContainerName().get("ProjectPath").length() == 0) {
updateStatus("File container must be specified");
return;
}
if (container == null
|| (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
updateStatus("File container must exist");
return;
}
if (!container.isAccessible()) {
updateStatus("Project must be writable");
return;
}
updateStatus(null);
}
|
void function() { IResource container = ResourcesPlugin.getWorkspace().getRoot() .findMember(new Path(getContainerName().get(STR))); if(!containerSourceText.getText().isEmpty() && !containerTargetText.getText().isEmpty()) { okButton.setEnabled(true); } if (getContainerName().get(STR).length() == 0) { updateStatus(STR); return; } if (container == null (container.getType() & (IResource.PROJECT IResource.FOLDER)) == 0) { updateStatus(STR); return; } if (!container.isAccessible()) { updateStatus(STR); return; } updateStatus(null); }
|
/**
* Ensures that both text fields are set.
*/
|
Ensures that both text fields are set
|
dialogChanged
|
{
"repo_name": "VisuFlow/visuflow-plugin",
"path": "src/de/unipaderborn/visuflow/debug/handlers/TargetHandlerDialog.java",
"license": "apache-2.0",
"size": 8899
}
|
[
"org.eclipse.core.resources.IResource",
"org.eclipse.core.resources.ResourcesPlugin",
"org.eclipse.core.runtime.Path"
] |
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*;
|
[
"org.eclipse.core"
] |
org.eclipse.core;
| 2,076,621
|
@JsOverlay
public final HandlerRegistration addSelectChangedListener(final EventListener<Select.Event> listener) {
return OLUtil.observe(this, "select", listener);
}
@JsType(isNative = true)
public interface Event extends ol.events.Event {
|
final HandlerRegistration function(final EventListener<Select.Event> listener) { return OLUtil.observe(this, STR, listener); } @JsType(isNative = true) public interface Event extends ol.events.Event {
|
/**
* Triggered when selection changes.
*
* @param listener listener
* @return handler registration
*/
|
Triggered when selection changes
|
addSelectChangedListener
|
{
"repo_name": "TDesjardins/GWT-OL3-Playground",
"path": "gwt-ol3-client/src/main/java/ol/interaction/Select.java",
"license": "apache-2.0",
"size": 3219
}
|
[
"com.google.gwt.event.shared.HandlerRegistration"
] |
import com.google.gwt.event.shared.HandlerRegistration;
|
import com.google.gwt.event.shared.*;
|
[
"com.google.gwt"
] |
com.google.gwt;
| 611,919
|
void startAugmentationNode(AugmentationIdentifier identifier) throws IOException;
|
void startAugmentationNode(AugmentationIdentifier identifier) throws IOException;
|
/**
* Emits start of augmentation node.
*
* <p>
* End of augmentation event is emitted by invoking {@link #endNode()}.
*
* <p>
* Valid sub-events are:
*
* <ul>
* <li>{@link #leafNode}</li>
* <li>{@link #startContainerNode(NodeIdentifier, int)}</li>
* <li>{@link #startChoiceNode(NodeIdentifier, int)}</li>
* <li>{@link #startLeafSet(NodeIdentifier, int)}</li>
* <li>{@link #startMapNode(NodeIdentifier, int)}</li>
* <li>{@link #startUnkeyedList(NodeIdentifier, int)}</li>
* </ul>
*
* @param identifier
* Augmentation identifier
* @throws IllegalArgumentException
* If augmentation is invalid in current context.
* @throws IOException if an underlying IO error occurs
*/
|
Emits start of augmentation node. End of augmentation event is emitted by invoking <code>#endNode()</code>. Valid sub-events are: <code>#leafNode</code> <code>#startContainerNode(NodeIdentifier, int)</code> <code>#startChoiceNode(NodeIdentifier, int)</code> <code>#startLeafSet(NodeIdentifier, int)</code> <code>#startMapNode(NodeIdentifier, int)</code> <code>#startUnkeyedList(NodeIdentifier, int)</code>
|
startAugmentationNode
|
{
"repo_name": "NovusTheory/yangtools",
"path": "yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/NormalizedNodeStreamWriter.java",
"license": "epl-1.0",
"size": 15824
}
|
[
"java.io.IOException",
"org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier"
] |
import java.io.IOException; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
|
import java.io.*; import org.opendaylight.yangtools.yang.data.api.*;
|
[
"java.io",
"org.opendaylight.yangtools"
] |
java.io; org.opendaylight.yangtools;
| 1,834,391
|
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// Used to avoid bug where we add item in the back stack
// and if we change orientation twice the item from the back stack has null values
if (save != null)
outState.putBundle("save", save);
else {
Bundle send = new Bundle();
send.putInt("backState", backState);
if (backState == 1) {
send.putParcelableArrayList("listData", genresList);
// used to restore the scroll listener variables
// Save scroll position
if (listView != null) {
Parcelable listState = listView.onSaveInstanceState();
send.putParcelable("listViewScroll", listState);
}
}
outState.putBundle("save", send);
}
}
|
void function(Bundle outState) { super.onSaveInstanceState(outState); if (save != null) outState.putBundle("save", save); else { Bundle send = new Bundle(); send.putInt(STR, backState); if (backState == 1) { send.putParcelableArrayList(STR, genresList); if (listView != null) { Parcelable listState = listView.onSaveInstanceState(); send.putParcelable(STR, listState); } } outState.putBundle("save", send); } }
|
/**
* Called to ask the fragment to save its current dynamic state,
* so it can later be reconstructed in a new instance of its process is restarted.
*
* @param outState Bundle in which to place your saved state.
*/
|
Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted
|
onSaveInstanceState
|
{
"repo_name": "sourcestream/moviedb-android",
"path": "app/src/main/java/de/sourcestream/movieDB/controller/GenresList.java",
"license": "apache-2.0",
"size": 12175
}
|
[
"android.os.Bundle",
"android.os.Parcelable"
] |
import android.os.Bundle; import android.os.Parcelable;
|
import android.os.*;
|
[
"android.os"
] |
android.os;
| 632,443
|
@Test
public void testStringNotExists( ) throws Exception {
Assert.assertNull(argMap.get("nameStringNull"));
}
|
void function( ) throws Exception { Assert.assertNull(argMap.get(STR)); }
|
/**
* Test string not exists.
*
* @throws Exception the exception
*/
|
Test string not exists
|
testStringNotExists
|
{
"repo_name": "petezybrick/iote2e",
"path": "iote2e-tests/src/main/java/com/pzybrick/iote2e/tests/common/TestArgMap.java",
"license": "apache-2.0",
"size": 4502
}
|
[
"org.junit.Assert"
] |
import org.junit.Assert;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 782,037
|
@Override
public AmberType getTargetType()
{
return _sourceField.getSourceType();
}
|
AmberType function() { return _sourceField.getSourceType(); }
|
/**
* Returns the target type as entity.
*/
|
Returns the target type as entity
|
getTargetType
|
{
"repo_name": "am-immanuel/quercus",
"path": "modules/resin/src/com/caucho/amber/field/OneToManyField.java",
"license": "gpl-2.0",
"size": 20114
}
|
[
"com.caucho.amber.type.AmberType"
] |
import com.caucho.amber.type.AmberType;
|
import com.caucho.amber.type.*;
|
[
"com.caucho.amber"
] |
com.caucho.amber;
| 2,274,791
|
private static byte[] createEntityMarkerKey(String entityId,
String entityType, byte[] revStartTime) throws IOException {
return KeyBuilder.newInstance().add(entityType).add(revStartTime)
.add(entityId).getBytesForLookup();
}
|
static byte[] function(String entityId, String entityType, byte[] revStartTime) throws IOException { return KeyBuilder.newInstance().add(entityType).add(revStartTime) .add(entityId).getBytesForLookup(); }
|
/**
* Creates an entity marker, serializing ENTITY_ENTRY_PREFIX + entity type +
* revstarttime + entity id.
*/
|
Creates an entity marker, serializing ENTITY_ENTRY_PREFIX + entity type + revstarttime + entity id
|
createEntityMarkerKey
|
{
"repo_name": "bitmybytes/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/RollingLevelDBTimelineStore.java",
"license": "apache-2.0",
"size": 70674
}
|
[
"java.io.IOException",
"org.apache.hadoop.yarn.server.timeline.util.LeveldbUtils"
] |
import java.io.IOException; import org.apache.hadoop.yarn.server.timeline.util.LeveldbUtils;
|
import java.io.*; import org.apache.hadoop.yarn.server.timeline.util.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 387,033
|
protected PlaceManager createPlace (PlaceConfig config, List<PlaceManagerDelegate> delegates,
PreStartupHook hook)
throws InstantiationException, InvocationException
{
PlaceManager pmgr = null;
try {
// create a place manager using the class supplied in the place config
pmgr = createPlaceManager(config);
// if we have delegates, inject their dependencies and add them
if (delegates != null) {
for (PlaceManagerDelegate delegate : delegates) {
_injector.injectMembers(delegate);
pmgr.addDelegate(delegate);
}
}
// let the pmgr know about us and its configuration
pmgr.init(this, _invmgr, _omgr, selectLocator(config), config);
} catch (Exception e) {
log.warning(e);
throw new InstantiationException("Error creating PlaceManager for " + config);
}
// let the manager abort the whole process if it fails any permissions checks
String errmsg = pmgr.checkPermissions();
if (errmsg != null) {
// give the place manager a chance to clean up after its early initialization process
pmgr.permissionsFailed();
throw new InvocationException(errmsg);
}
// and create and register the place object
PlaceObject plobj = pmgr.createPlaceObject();
_omgr.registerObject(plobj);
// stick the manager into our table
_pmgrs.put(plobj.getOid(), pmgr);
// start the place manager up with the newly created place object
try {
if (hook != null) {
hook.invoke(pmgr);
}
pmgr.startup(plobj);
} catch (Exception e) {
log.warning("Error starting place manager", "obj", plobj, "pmgr", pmgr, e);
}
return pmgr;
}
|
PlaceManager function (PlaceConfig config, List<PlaceManagerDelegate> delegates, PreStartupHook hook) throws InstantiationException, InvocationException { PlaceManager pmgr = null; try { pmgr = createPlaceManager(config); if (delegates != null) { for (PlaceManagerDelegate delegate : delegates) { _injector.injectMembers(delegate); pmgr.addDelegate(delegate); } } pmgr.init(this, _invmgr, _omgr, selectLocator(config), config); } catch (Exception e) { log.warning(e); throw new InstantiationException(STR + config); } String errmsg = pmgr.checkPermissions(); if (errmsg != null) { pmgr.permissionsFailed(); throw new InvocationException(errmsg); } PlaceObject plobj = pmgr.createPlaceObject(); _omgr.registerObject(plobj); _pmgrs.put(plobj.getOid(), pmgr); try { if (hook != null) { hook.invoke(pmgr); } pmgr.startup(plobj); } catch (Exception e) { log.warning(STR, "obj", plobj, "pmgr", pmgr, e); } return pmgr; }
|
/**
* Creates a place manager using the supplied config, injects dependencies into and registers
* the supplied list of delegates, runs the supplied pre-startup hook and finally returns it.
*/
|
Creates a place manager using the supplied config, injects dependencies into and registers the supplied list of delegates, runs the supplied pre-startup hook and finally returns it
|
createPlace
|
{
"repo_name": "threerings/narya",
"path": "core/src/main/java/com/threerings/crowd/server/PlaceRegistry.java",
"license": "lgpl-2.1",
"size": 10583
}
|
[
"com.threerings.crowd.data.PlaceConfig",
"com.threerings.crowd.data.PlaceObject",
"com.threerings.presents.server.InvocationException",
"java.util.List"
] |
import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceObject; import com.threerings.presents.server.InvocationException; import java.util.List;
|
import com.threerings.crowd.data.*; import com.threerings.presents.server.*; import java.util.*;
|
[
"com.threerings.crowd",
"com.threerings.presents",
"java.util"
] |
com.threerings.crowd; com.threerings.presents; java.util;
| 1,431,959
|
private PageModel getUpdatedTOS(ICallbackNotifier callback) {
if (isCancelled())
return null;
try {
// checking copyrights
PageModel p = new PageModel();
p.setPage("Baka-Tsuki:Copyrights");
p.setTitle("Baka-Tsuki:Copyrights");
p.setType(PageModel.TYPE_TOS);
// get current tos
NovelsDao.getInstance().getPageModel(p, callback);
PageModel newP = NovelsDao.getInstance().getPageModelFromInternet(p, callback);
if (newP != null && newP.getLastUpdate().getTime() > p.getLastUpdate().getTime()) {
Log.d(TAG, "TOS Updated.");
return newP;
}
} catch (Exception ex) {
String msg = "Failed to update: Term of Service.";
BakaReaderException bex = new BakaReaderException(msg, BakaReaderException.UPDATE_FAILED_TOS, ex);
exceptionList.add(bex);
Log.e(TAG, msg, bex);
publishProgress(msg);
}
return null;
}
|
PageModel function(ICallbackNotifier callback) { if (isCancelled()) return null; try { PageModel p = new PageModel(); p.setPage(STR); p.setTitle(STR); p.setType(PageModel.TYPE_TOS); NovelsDao.getInstance().getPageModel(p, callback); PageModel newP = NovelsDao.getInstance().getPageModelFromInternet(p, callback); if (newP != null && newP.getLastUpdate().getTime() > p.getLastUpdate().getTime()) { Log.d(TAG, STR); return newP; } } catch (Exception ex) { String msg = STR; BakaReaderException bex = new BakaReaderException(msg, BakaReaderException.UPDATE_FAILED_TOS, ex); exceptionList.add(bex); Log.e(TAG, msg, bex); publishProgress(msg); } return null; }
|
/***
* Check Term of Service from //www.baka-tsuki.org/project/index.php?title=Baka-Tsuki:Copyrights
*
* @param callback
* @return
*/
|
Check Term of Service from //www.baka-tsuki.org/project/index.php?title=Baka-Tsuki:Copyrights
|
getUpdatedTOS
|
{
"repo_name": "SandroHc/LNReader-Android",
"path": "app/src/main/java/com/erakk/lnreader/task/GetUpdatedChaptersTask.java",
"license": "apache-2.0",
"size": 12706
}
|
[
"android.util.Log",
"com.erakk.lnreader.callback.ICallbackNotifier",
"com.erakk.lnreader.dao.NovelsDao",
"com.erakk.lnreader.helper.BakaReaderException",
"com.erakk.lnreader.model.PageModel"
] |
import android.util.Log; import com.erakk.lnreader.callback.ICallbackNotifier; import com.erakk.lnreader.dao.NovelsDao; import com.erakk.lnreader.helper.BakaReaderException; import com.erakk.lnreader.model.PageModel;
|
import android.util.*; import com.erakk.lnreader.callback.*; import com.erakk.lnreader.dao.*; import com.erakk.lnreader.helper.*; import com.erakk.lnreader.model.*;
|
[
"android.util",
"com.erakk.lnreader"
] |
android.util; com.erakk.lnreader;
| 1,337,678
|
protected final void setVisibility(@NonNull View view, boolean visible) {
view.setVisibility(visible ? VISIBLE : GONE);
}
|
final void function(@NonNull View view, boolean visible) { view.setVisibility(visible ? VISIBLE : GONE); }
|
/**
* Exposed to subclasses if they have visibility logic for their views.
*/
|
Exposed to subclasses if they have visibility logic for their views
|
setVisibility
|
{
"repo_name": "philliphsu/ClockPlus",
"path": "app/src/main/java/com/philliphsu/clock2/alarms/ui/BaseAlarmViewHolder.java",
"license": "gpl-3.0",
"size": 14101
}
|
[
"android.support.annotation.NonNull",
"android.view.View"
] |
import android.support.annotation.NonNull; import android.view.View;
|
import android.support.annotation.*; import android.view.*;
|
[
"android.support",
"android.view"
] |
android.support; android.view;
| 2,487,393
|
public List<String> createMensagem(Object[]... mensagemCode) {
List<String> msgs = new ArrayList<String>();
for (int i = 0; i < mensagemCode.length; i++) {
Object[] mens = mensagemCode[i];
Object[] params = mensagemCode[i].clone();
params = ArrayUtils.removeElement(params, mens[0]);
try {
msgs.add(this.messageSource.getMessage((String) mens[0], params, Locale.CANADA));
} catch (NoSuchMessageException exp) {
msgs.add((String) mens[0]);
}
}
return msgs;
}
|
List<String> function(Object[]... mensagemCode) { List<String> msgs = new ArrayList<String>(); for (int i = 0; i < mensagemCode.length; i++) { Object[] mens = mensagemCode[i]; Object[] params = mensagemCode[i].clone(); params = ArrayUtils.removeElement(params, mens[0]); try { msgs.add(this.messageSource.getMessage((String) mens[0], params, Locale.CANADA)); } catch (NoSuchMessageException exp) { msgs.add((String) mens[0]); } } return msgs; }
|
/**
* Cria lista de mensagens
*
* @param mensagemCode
* uma ou mais mensagens com parametros.
*
* <pre>
* Exemplo
* <code>createMensagem( new Object[]{"msg.erro.login.not.mapping",param1,param2}, new Object[]{"msg.erro.login.not.mapping"}); </code>
* </pre>
*
* @return Lista de mensagens configuradas.
*/
|
Cria lista de mensagens
|
createMensagem
|
{
"repo_name": "EArchitecture/reuse-framework",
"path": "reuse-web/reuse-thymeleaf/src/main/java/com/github/earchitecture/reuse/view/spring/controller/BasicController.java",
"license": "apache-2.0",
"size": 6106
}
|
[
"java.util.ArrayList",
"java.util.List",
"java.util.Locale",
"org.apache.commons.lang3.ArrayUtils",
"org.springframework.context.NoSuchMessageException"
] |
import java.util.ArrayList; import java.util.List; import java.util.Locale; import org.apache.commons.lang3.ArrayUtils; import org.springframework.context.NoSuchMessageException;
|
import java.util.*; import org.apache.commons.lang3.*; import org.springframework.context.*;
|
[
"java.util",
"org.apache.commons",
"org.springframework.context"
] |
java.util; org.apache.commons; org.springframework.context;
| 2,776,366
|
@Override
public void showLoadingBackProgress() {
if (null != mProgressView) {
mProgressView.setVisibility(View.VISIBLE);
}
}
|
void function() { if (null != mProgressView) { mProgressView.setVisibility(View.VISIBLE); } }
|
/**
* Display a global spinner or any UI item to warn the user that there are some pending actions.
*/
|
Display a global spinner or any UI item to warn the user that there are some pending actions
|
showLoadingBackProgress
|
{
"repo_name": "noepitome/neon-android",
"path": "neon/src/main/java/im/neon/fragments/VectorSearchMessagesListFragment.java",
"license": "apache-2.0",
"size": 12117
}
|
[
"android.view.View"
] |
import android.view.View;
|
import android.view.*;
|
[
"android.view"
] |
android.view;
| 2,612,700
|
public boolean isSingleThreadModel() {
// Short-cuts
// If singleThreadModel is true, must have already checked this
// If instance != null, must have already loaded
if (singleThreadModel || instance != null) {
return singleThreadModel;
}
// The logic to determine this safely is more complex than one might
// expect. allocate() already has the necessary logic so re-use it.
// Make sure the Servlet is loaded with the right class loader
ClassLoader oldCL = null;
try {
oldCL = ((Context) getParent()).bind(false, null);
Servlet s = allocate();
deallocate(s);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
} finally {
((Context) getParent()).unbind(false, oldCL);
}
return singleThreadModel;
}
|
boolean function() { if (singleThreadModel instance != null) { return singleThreadModel; } ClassLoader oldCL = null; try { oldCL = ((Context) getParent()).bind(false, null); Servlet s = allocate(); deallocate(s); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } finally { ((Context) getParent()).unbind(false, oldCL); } return singleThreadModel; }
|
/**
* Return <code>true</code> if the servlet class represented by this
* component implements the <code>SingleThreadModel</code> interface.
*/
|
Return <code>true</code> if the servlet class represented by this component implements the <code>SingleThreadModel</code> interface
|
isSingleThreadModel
|
{
"repo_name": "wenzhucjy/tomcat_source",
"path": "tomcat-8.0.9-sourcecode/java/org/apache/catalina/core/StandardWrapper.java",
"license": "apache-2.0",
"size": 61655
}
|
[
"javax.servlet.Servlet",
"org.apache.catalina.Context",
"org.apache.tomcat.util.ExceptionUtils"
] |
import javax.servlet.Servlet; import org.apache.catalina.Context; import org.apache.tomcat.util.ExceptionUtils;
|
import javax.servlet.*; import org.apache.catalina.*; import org.apache.tomcat.util.*;
|
[
"javax.servlet",
"org.apache.catalina",
"org.apache.tomcat"
] |
javax.servlet; org.apache.catalina; org.apache.tomcat;
| 1,827,598
|
private Data getData(final String dataset) throws IOException {
// Load data
Data data = Data.create("data/" + dataset + ".csv", StandardCharsets.UTF_8, ';');
|
Data function(final String dataset) throws IOException { Data data = Data.create("data/" + dataset + ".csv", StandardCharsets.UTF_8, ';');
|
/**
* Loads a dataset from disk
*
* @param dataset
* @return
* @throws IOException
*/
|
Loads a dataset from disk
|
getData
|
{
"repo_name": "RaffaelBild/arx",
"path": "src/test/org/deidentifier/arx/test/TestClassification.java",
"license": "apache-2.0",
"size": 12778
}
|
[
"java.io.IOException",
"java.nio.charset.StandardCharsets",
"org.deidentifier.arx.Data"
] |
import java.io.IOException; import java.nio.charset.StandardCharsets; import org.deidentifier.arx.Data;
|
import java.io.*; import java.nio.charset.*; import org.deidentifier.arx.*;
|
[
"java.io",
"java.nio",
"org.deidentifier.arx"
] |
java.io; java.nio; org.deidentifier.arx;
| 2,601,250
|
public void onLoading(ImageLoadHandler handler) {
mFlag = mFlag | STATUS_LOADING;
if (null == handler) {
return;
}
if (mFirstImageViewHolder == null) {
handler.onLoading(this, null);
} else {
ImageViewHolder holder = mFirstImageViewHolder;
do {
final CubeImageView imageView = holder.getImageView();
if (null != imageView) {
handler.onLoading(this, imageView);
}
} while ((holder = holder.mNext) != null);
}
}
|
void function(ImageLoadHandler handler) { mFlag = mFlag STATUS_LOADING; if (null == handler) { return; } if (mFirstImageViewHolder == null) { handler.onLoading(this, null); } else { ImageViewHolder holder = mFirstImageViewHolder; do { final CubeImageView imageView = holder.getImageView(); if (null != imageView) { handler.onLoading(this, imageView); } } while ((holder = holder.mNext) != null); } }
|
/**
* When loading from network
*
* @param handler
*/
|
When loading from network
|
onLoading
|
{
"repo_name": "spermicide/cube-sdk",
"path": "core/src/in/srain/cube/image/ImageTask.java",
"license": "apache-2.0",
"size": 15354
}
|
[
"in.srain.cube.image.iface.ImageLoadHandler"
] |
import in.srain.cube.image.iface.ImageLoadHandler;
|
import in.srain.cube.image.iface.*;
|
[
"in.srain.cube"
] |
in.srain.cube;
| 292,509
|
public void setImageResizeHeight(int val) {
Element el = settingsFile.getRootElement().getChild(SETTING_IMGRESIZEHEIGHT);
if (null == el) {
el = new Element(SETTING_IMGRESIZEHEIGHT);
settingsFile.getRootElement().addContent(el);
}
el.setText(String.valueOf(val));
}
|
void function(int val) { Element el = settingsFile.getRootElement().getChild(SETTING_IMGRESIZEHEIGHT); if (null == el) { el = new Element(SETTING_IMGRESIZEHEIGHT); settingsFile.getRootElement().addContent(el); } el.setText(String.valueOf(val)); }
|
/**
* Sets the setting for the thumbnail width of images. This value indicates the maximum width of
* images which are displayed in the textfield. larger images are resized to fit the preferred
* maximum size and a link to the original image is inserted.
*
* @param val the preferred maximum width of an image
*/
|
Sets the setting for the thumbnail width of images. This value indicates the maximum width of images which are displayed in the textfield. larger images are resized to fit the preferred maximum size and a link to the original image is inserted
|
setImageResizeHeight
|
{
"repo_name": "sjPlot/Zettelkasten",
"path": "src/main/java/de/danielluedecke/zettelkasten/database/Settings.java",
"license": "gpl-3.0",
"size": 218287
}
|
[
"org.jdom2.Element"
] |
import org.jdom2.Element;
|
import org.jdom2.*;
|
[
"org.jdom2"
] |
org.jdom2;
| 1,759,787
|
public byte[] encodeToJsonBytes(T record) throws IOException{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
jsonEncoder = EncoderFactory.get().jsonEncoder(this.schema, baos, true);
avroWriter.write(record, jsonEncoder);
jsonEncoder.flush();
baos.flush();
return baos.toByteArray();
}
|
byte[] function(T record) throws IOException{ ByteArrayOutputStream baos = new ByteArrayOutputStream(); jsonEncoder = EncoderFactory.get().jsonEncoder(this.schema, baos, true); avroWriter.write(record, jsonEncoder); jsonEncoder.flush(); baos.flush(); return baos.toByteArray(); }
|
/**
* Encode record to Json and then convert to byte array.
*
* @param record the object to encode
* @return the byte[]
* @throws IOException Signals that an I/O exception has occurred.
*/
|
Encode record to Json and then convert to byte array
|
encodeToJsonBytes
|
{
"repo_name": "Oleh-Kravchenko/kaa",
"path": "common/endpoint-shared/src/main/java/org/kaaproject/kaa/common/avro/AvroJsonConverter.java",
"license": "apache-2.0",
"size": 4032
}
|
[
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"org.apache.avro.io.EncoderFactory"
] |
import java.io.ByteArrayOutputStream; import java.io.IOException; import org.apache.avro.io.EncoderFactory;
|
import java.io.*; import org.apache.avro.io.*;
|
[
"java.io",
"org.apache.avro"
] |
java.io; org.apache.avro;
| 497,323
|
@Authorized( { PrivilegeConstants.VIEW_PERSONS })
public Person getPersonByUuid(String uuid) throws APIException;
|
@Authorized( { PrivilegeConstants.VIEW_PERSONS }) Person function(String uuid) throws APIException;
|
/**
* Get Person by its UUID
*
* @param uuid
* @return
* @should find object given valid uuid
* @should return null if no object found with given uuid
*/
|
Get Person by its UUID
|
getPersonByUuid
|
{
"repo_name": "Bhamni/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/PersonService.java",
"license": "mpl-2.0",
"size": 41991
}
|
[
"org.openmrs.Person",
"org.openmrs.annotation.Authorized",
"org.openmrs.util.PrivilegeConstants"
] |
import org.openmrs.Person; import org.openmrs.annotation.Authorized; import org.openmrs.util.PrivilegeConstants;
|
import org.openmrs.*; import org.openmrs.annotation.*; import org.openmrs.util.*;
|
[
"org.openmrs",
"org.openmrs.annotation",
"org.openmrs.util"
] |
org.openmrs; org.openmrs.annotation; org.openmrs.util;
| 1,998,987
|
private void validateScores() {
boolean valid = true;
for(JTextField score : scores) {
String text = score.getText();
try {
if (!text.equals("")) {
if (Integer.parseInt(text) < 0)
throw new Exception();
}
score.setBackground(Color.WHITE);
save.setEnabled(true);
save.setText("Save");
}
catch (Exception e) {
score.setBackground(new Color(0xff9999));
valid = false;
}
}
save.setEnabled(valid);
}
|
void function() { boolean valid = true; for(JTextField score : scores) { String text = score.getText(); try { if (!text.equals(STRSave"); } catch (Exception e) { score.setBackground(new Color(0xff9999)); valid = false; } } save.setEnabled(valid); }
|
/**
* Validate that the scores are numerical
*/
|
Validate that the scores are numerical
|
validateScores
|
{
"repo_name": "bwyap/java-familyfeud",
"path": "src/bwyap/familyfeud/gui/control/FastMoneyAnswerPanel.java",
"license": "mit",
"size": 8628
}
|
[
"java.awt.Color",
"javax.swing.JTextField"
] |
import java.awt.Color; import javax.swing.JTextField;
|
import java.awt.*; import javax.swing.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 775,915
|
public static void write(CharSequence data, OutputStream output)
throws IOException {
write(data, output, Charset.defaultCharset());
}
|
static void function(CharSequence data, OutputStream output) throws IOException { write(data, output, Charset.defaultCharset()); }
|
/**
* Writes chars from a <code>CharSequence</code> to bytes on an
* <code>OutputStream</code> using the default character encoding of the
* platform.
* <p>
* This method uses {@link String#getBytes()}.
*
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since 2.0
*/
|
Writes chars from a <code>CharSequence</code> to bytes on an <code>OutputStream</code> using the default character encoding of the platform. This method uses <code>String#getBytes()</code>
|
write
|
{
"repo_name": "Giraudux/java-quel-bazar",
"path": "src/org/apache/commons/io/IOUtils.java",
"license": "mit",
"size": 100484
}
|
[
"java.io.IOException",
"java.io.OutputStream",
"java.nio.charset.Charset"
] |
import java.io.IOException; import java.io.OutputStream; import java.nio.charset.Charset;
|
import java.io.*; import java.nio.charset.*;
|
[
"java.io",
"java.nio"
] |
java.io; java.nio;
| 2,696,220
|
public void testLowThreadDiscoverViaServer()
throws Exception
{
// Let the rule container find the thread pool itself.
_busyContainerRule.setThreadPool( null );
// The thread pool we want to use.
LowThreadPool pool = new LowThreadPool();
_server.stop();
_server.setThreadPool( pool );
_server.start();
// Set the rule order
_handler.setRules( new Rule[] { _busyContainerRule, _rule } );
_server.handle( "/cheese/bar", _request, _response, 0 );
assertSame( "Found expected thread pool", pool, _busyContainerRule.getThreadPool() );
assertEquals( "/too-busy/bar", _request.getRequestURI() );
}
class LowThreadPool
extends QueuedThreadPool
implements ThreadPool
{
private boolean lowOnThreads = true;
|
void function() throws Exception { _busyContainerRule.setThreadPool( null ); LowThreadPool pool = new LowThreadPool(); _server.stop(); _server.setThreadPool( pool ); _server.start(); _handler.setRules( new Rule[] { _busyContainerRule, _rule } ); _server.handle( STR, _request, _response, 0 ); assertSame( STR, pool, _busyContainerRule.getThreadPool() ); assertEquals( STR, _request.getRequestURI() ); } class LowThreadPool extends QueuedThreadPool implements ThreadPool { private boolean lowOnThreads = true;
|
/**
* Test the ability of the {@link LowThreadsRuleContainer} to
* find the ThreadPool from the server.
*
* @throws Exception
*/
|
Test the ability of the <code>LowThreadsRuleContainer</code> to find the ThreadPool from the server
|
testLowThreadDiscoverViaServer
|
{
"repo_name": "cscotta/miso-java",
"path": "jetty/contrib/jetty-rewrite-handler/src/test/java/org/mortbay/jetty/handler/rewrite/LowThreadsRuleContainerTest.java",
"license": "mit",
"size": 4008
}
|
[
"org.mortbay.thread.QueuedThreadPool",
"org.mortbay.thread.ThreadPool"
] |
import org.mortbay.thread.QueuedThreadPool; import org.mortbay.thread.ThreadPool;
|
import org.mortbay.thread.*;
|
[
"org.mortbay.thread"
] |
org.mortbay.thread;
| 2,637,745
|
public List<SortedMap<String, Object>> getInputData(final String streamId) {
return inputData.get(streamId);
}
|
List<SortedMap<String, Object>> function(final String streamId) { return inputData.get(streamId); }
|
/**
* Return the input data for a specific stream ID.
*
* @param streamId The stream ID.
* @return The input data for this stream.
*/
|
Return the input data for a specific stream ID
|
getInputData
|
{
"repo_name": "krotscheck/storm-toolkit",
"path": "storm-toolkit-test/src/main/java/net/krotscheck/stk/test/topology/TestSpout.java",
"license": "apache-2.0",
"size": 10883
}
|
[
"java.util.List",
"java.util.SortedMap"
] |
import java.util.List; import java.util.SortedMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,349,381
|
public static String toDisplayable(String technicalName) {
String noUnderscoreName = technicalName.replace('_', ' ');
StringTokenizer wordsIterator = new StringTokenizer(noUnderscoreName, " ");
StringBuilder displayableName = new StringBuilder(technicalName.length());
boolean hasNextWord = wordsIterator.hasMoreTokens();
while (hasNextWord) {
String nextWord = wordsIterator.nextToken();
if (nextWord.toUpperCase().equals(nextWord) && nextWord.length() > 1) {
nextWord = nextWord.charAt(0) + nextWord.substring(1, nextWord.length()).toLowerCase();
}
displayableName.append(nextWord);
hasNextWord = wordsIterator.hasMoreTokens();
if (hasNextWord) {
displayableName.append(' ');
}
}
return displayableName.toString();
}
/**
* Ask the user for a value
*
* @param title
* the title for the dialog
* @param optionType
* the option types of the buttons such as in {@link DialogDescriptor}
|
static String function(String technicalName) { String noUnderscoreName = technicalName.replace('_', ' '); StringTokenizer wordsIterator = new StringTokenizer(noUnderscoreName, " "); StringBuilder displayableName = new StringBuilder(technicalName.length()); boolean hasNextWord = wordsIterator.hasMoreTokens(); while (hasNextWord) { String nextWord = wordsIterator.nextToken(); if (nextWord.toUpperCase().equals(nextWord) && nextWord.length() > 1) { nextWord = nextWord.charAt(0) + nextWord.substring(1, nextWord.length()).toLowerCase(); } displayableName.append(nextWord); hasNextWord = wordsIterator.hasMoreTokens(); if (hasNextWord) { displayableName.append(' '); } } return displayableName.toString(); } /** * Ask the user for a value * * @param title * the title for the dialog * @param optionType * the option types of the buttons such as in {@link DialogDescriptor}
|
/**
* String utility method that changes TEST_NAME to Test Name
*
* @param technicalName the technical name (e.g. a database table name)
* @return the display name
*/
|
String utility method that changes TEST_NAME to Test Name
|
toDisplayable
|
{
"repo_name": "GiggleCorp2017/JoPro",
"path": "JoProNetBeansSource/Desktop/src/org/joeffice/desktop/ui/OfficeUIUtils.java",
"license": "apache-2.0",
"size": 5529
}
|
[
"java.util.StringTokenizer",
"org.openide.DialogDescriptor"
] |
import java.util.StringTokenizer; import org.openide.DialogDescriptor;
|
import java.util.*; import org.openide.*;
|
[
"java.util",
"org.openide"
] |
java.util; org.openide;
| 1,982,165
|
public List<ReportSynthesisStudiesByCrpProgramDTO> getProjectStudiesListByFP(
List<LiaisonInstitution> liaisonInstitutions, List<ProjectExpectedStudy> selectedStudies, Phase phase);
|
List<ReportSynthesisStudiesByCrpProgramDTO> function( List<LiaisonInstitution> liaisonInstitutions, List<ProjectExpectedStudy> selectedStudies, Phase phase);
|
/**
* This method gets a list of projectExpectedStudy that are selected for all the LiaisonInstitutions (Excluding PMU)
*
* @param selectedStudies the selected studies
* @param liaisonInstitutions the liaisonInstitutions of the CRP
* @param phase the phase to fetch the studies from
* @return a list from ProjectExpectedStudy null if no exist records
*/
|
This method gets a list of projectExpectedStudy that are selected for all the LiaisonInstitutions (Excluding PMU)
|
getProjectStudiesListByFP
|
{
"repo_name": "CCAFS/MARLO",
"path": "marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/manager/ProjectExpectedStudyManager.java",
"license": "gpl-3.0",
"size": 6986
}
|
[
"java.util.List",
"org.cgiar.ccafs.marlo.data.model.LiaisonInstitution",
"org.cgiar.ccafs.marlo.data.model.Phase",
"org.cgiar.ccafs.marlo.data.model.ProjectExpectedStudy",
"org.cgiar.ccafs.marlo.data.model.ReportSynthesisStudiesByCrpProgramDTO"
] |
import java.util.List; import org.cgiar.ccafs.marlo.data.model.LiaisonInstitution; import org.cgiar.ccafs.marlo.data.model.Phase; import org.cgiar.ccafs.marlo.data.model.ProjectExpectedStudy; import org.cgiar.ccafs.marlo.data.model.ReportSynthesisStudiesByCrpProgramDTO;
|
import java.util.*; import org.cgiar.ccafs.marlo.data.model.*;
|
[
"java.util",
"org.cgiar.ccafs"
] |
java.util; org.cgiar.ccafs;
| 2,833,890
|
void onHomepageStateUpdated();
}
private static HomepageManager sInstance;
private final SharedPreferencesManager mSharedPreferencesManager;
private final ObserverList<HomepageStateListener> mHomepageStateListeners;
private SettingsLauncher mSettingsLauncher;
private HomepageManager() {
mSharedPreferencesManager = SharedPreferencesManager.getInstance();
mHomepageStateListeners = new ObserverList<>();
HomepagePolicyManager.getInstance().addListener(this);
PartnerBrowserCustomizations.getInstance().setPartnerHomepageListener(this);
mSettingsLauncher = new SettingsLauncherImpl();
}
|
void onHomepageStateUpdated(); } private static HomepageManager sInstance; private final SharedPreferencesManager mSharedPreferencesManager; private final ObserverList<HomepageStateListener> mHomepageStateListeners; private SettingsLauncher mSettingsLauncher; private HomepageManager() { mSharedPreferencesManager = SharedPreferencesManager.getInstance(); mHomepageStateListeners = new ObserverList<>(); HomepagePolicyManager.getInstance().addListener(this); PartnerBrowserCustomizations.getInstance().setPartnerHomepageListener(this); mSettingsLauncher = new SettingsLauncherImpl(); }
|
/**
* Called when the homepage is enabled or disabled or the homepage URL changes.
*/
|
Called when the homepage is enabled or disabled or the homepage URL changes
|
onHomepageStateUpdated
|
{
"repo_name": "nwjs/chromium.src",
"path": "chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java",
"license": "bsd-3-clause",
"size": 13574
}
|
[
"org.chromium.base.ObserverList",
"org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations",
"org.chromium.chrome.browser.preferences.SharedPreferencesManager",
"org.chromium.chrome.browser.settings.SettingsLauncherImpl",
"org.chromium.components.browser_ui.settings.SettingsLauncher"
] |
import org.chromium.base.ObserverList; import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.components.browser_ui.settings.SettingsLauncher;
|
import org.chromium.base.*; import org.chromium.chrome.browser.partnercustomizations.*; import org.chromium.chrome.browser.preferences.*; import org.chromium.chrome.browser.settings.*; import org.chromium.components.browser_ui.settings.*;
|
[
"org.chromium.base",
"org.chromium.chrome",
"org.chromium.components"
] |
org.chromium.base; org.chromium.chrome; org.chromium.components;
| 1,440,038
|
public void setDestination(BlockPos destination)
{
this.destination = destination;
}
|
void function(BlockPos destination) { this.destination = destination; }
|
/**
* Sets the destination of the job
*
* @param destination {@link BlockPos} of the destination
*/
|
Sets the destination of the job
|
setDestination
|
{
"repo_name": "MinecoloniesDevs/Minecolonies",
"path": "src/main/java/com/minecolonies/colony/jobs/JobDeliveryman.java",
"license": "gpl-3.0",
"size": 2392
}
|
[
"net.minecraft.util.BlockPos"
] |
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.*;
|
[
"net.minecraft.util"
] |
net.minecraft.util;
| 48,669
|
public synchronized Rect getFramingRectInPreview() {
if (framingRectInPreview == null) {
Rect framingRect = getFramingRect();
if (framingRect == null) {
return null;
}
Rect rect = new Rect(framingRect);
Point cameraResolution = configManager.getCameraResolution();
Point screenResolution = configManager.getScreenResolution();
if (cameraResolution == null || screenResolution == null) {
// Called early, before init even finished
return null;
}
rect.left = rect.left * cameraResolution.y / screenResolution.x;
rect.right = rect.right * cameraResolution.y / screenResolution.x;
rect.top = rect.top * cameraResolution.x / screenResolution.y;
rect.bottom = rect.bottom * cameraResolution.x / screenResolution.y;
framingRectInPreview = rect;
Log.d(TAG, "Calculated framingRectInPreview rect: "
+ framingRectInPreview);
Log.d(TAG, "cameraResolution: " + cameraResolution);
Log.d(TAG, "screenResolution: " + screenResolution);
}
return framingRectInPreview;
}
|
synchronized Rect function() { if (framingRectInPreview == null) { Rect framingRect = getFramingRect(); if (framingRect == null) { return null; } Rect rect = new Rect(framingRect); Point cameraResolution = configManager.getCameraResolution(); Point screenResolution = configManager.getScreenResolution(); if (cameraResolution == null screenResolution == null) { return null; } rect.left = rect.left * cameraResolution.y / screenResolution.x; rect.right = rect.right * cameraResolution.y / screenResolution.x; rect.top = rect.top * cameraResolution.x / screenResolution.y; rect.bottom = rect.bottom * cameraResolution.x / screenResolution.y; framingRectInPreview = rect; Log.d(TAG, STR + framingRectInPreview); Log.d(TAG, STR + cameraResolution); Log.d(TAG, STR + screenResolution); } return framingRectInPreview; }
|
/**
* Like {@link #getFramingRect} but coordinates are in terms of the preview
* frame, not UI / screen.
*/
|
Like <code>#getFramingRect</code> but coordinates are in terms of the preview frame, not UI / screen
|
getFramingRectInPreview
|
{
"repo_name": "JNDX25219/ZhiHuiDianTi",
"path": "app/src/main/java/com/example/administrator/zhihuidianti/activity/zxing/camera/CameraManager.java",
"license": "apache-2.0",
"size": 12399
}
|
[
"android.graphics.Point",
"android.graphics.Rect",
"android.util.Log"
] |
import android.graphics.Point; import android.graphics.Rect; import android.util.Log;
|
import android.graphics.*; import android.util.*;
|
[
"android.graphics",
"android.util"
] |
android.graphics; android.util;
| 2,376,627
|
protected void readHeaders(BufferedReader reader) {
while (true) {
String line;
try {
line = reader.readLine();
} catch (IOException ioex) {
throw new HttpException(ioex);
}
if (StringUtil.isBlank(line)) {
break;
}
int ndx = line.indexOf(':');
if (ndx != -1) {
header(line.substring(0, ndx), line.substring(ndx + 1));
} else {
throw new HttpException("Invalid header: " + line);
}
}
}
|
void function(BufferedReader reader) { while (true) { String line; try { line = reader.readLine(); } catch (IOException ioex) { throw new HttpException(ioex); } if (StringUtil.isBlank(line)) { break; } int ndx = line.indexOf(':'); if (ndx != -1) { header(line.substring(0, ndx), line.substring(ndx + 1)); } else { throw new HttpException(STR + line); } } }
|
/**
* Parses headers.
*/
|
Parses headers
|
readHeaders
|
{
"repo_name": "wsldl123292/jodd",
"path": "jodd-http/src/main/java/jodd/http/HttpBase.java",
"license": "bsd-3-clause",
"size": 23360
}
|
[
"java.io.BufferedReader",
"java.io.IOException"
] |
import java.io.BufferedReader; import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,680,592
|
@Override public void enterReturn(@NotNull IntlyParser.ReturnContext ctx) { }
|
@Override public void enterReturn(@NotNull IntlyParser.ReturnContext ctx) { }
|
/**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/
|
The default implementation does nothing
|
exitVar
|
{
"repo_name": "johnbradley/Intly",
"path": "src/intly/parser/IntlyBaseListener.java",
"license": "bsd-2-clause",
"size": 8238
}
|
[
"org.antlr.v4.runtime.misc.NotNull"
] |
import org.antlr.v4.runtime.misc.NotNull;
|
import org.antlr.v4.runtime.misc.*;
|
[
"org.antlr.v4"
] |
org.antlr.v4;
| 1,730,287
|
Preconditions.checkArgument(!Strings.isNullOrEmpty(name));
TemplateParameterBuilder builder = new TemplateParameterBuilder();
builder.name = name;
return builder;
}
|
Preconditions.checkArgument(!Strings.isNullOrEmpty(name)); TemplateParameterBuilder builder = new TemplateParameterBuilder(); builder.name = name; return builder; }
|
/**
* Start point of template parameter creation. Note, that it is necessary
* to set parameter name, so {@link IllegalArgumentException} will be
* thrown if method argument is <code>null</code> or empty.
*
* @param name name of template parameter
* @return builder object
* @throws IllegalArgumentException if parameter is null or empty
*/
|
Start point of template parameter creation. Note, that it is necessary to set parameter name, so <code>IllegalArgumentException</code> will be thrown if method argument is <code>null</code> or empty
|
parameterWithName
|
{
"repo_name": "mrudnytskyi/SmartWikiEditor",
"path": "src/main/java/intelligent/wiki/editor/io_impl/wiki/template_data/TemplateParameterBuilder.java",
"license": "gpl-2.0",
"size": 2925
}
|
[
"com.google.common.base.Preconditions",
"com.google.common.base.Strings"
] |
import com.google.common.base.Preconditions; import com.google.common.base.Strings;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 130,768
|
@XmlTransient
public HeartRate getEntity() {
if (entity.getHeartRateId() == null) {
HeartRateConverter converter = UriResolver.getInstance().resolve(HeartRateConverter.class, uri);
if (converter != null) {
entity = converter.getEntity();
}
}
return entity;
}
|
HeartRate function() { if (entity.getHeartRateId() == null) { HeartRateConverter converter = UriResolver.getInstance().resolve(HeartRateConverter.class, uri); if (converter != null) { entity = converter.getEntity(); } } return entity; }
|
/**
* Returns the HeartRate entity.
*
* @return an entity
*/
|
Returns the HeartRate entity
|
getEntity
|
{
"repo_name": "OSEHRA/HealtheMe",
"path": "src/main/java/com/krminc/phr/api/vitals/converter/HeartRateConverter.java",
"license": "apache-2.0",
"size": 8488
}
|
[
"com.krminc.phr.domain.vitals.HeartRate"
] |
import com.krminc.phr.domain.vitals.HeartRate;
|
import com.krminc.phr.domain.vitals.*;
|
[
"com.krminc.phr"
] |
com.krminc.phr;
| 1,165,966
|
@Nullable
protected com.google.gson.JsonElement number2;
@Nonnull
public WorkbookFunctionsBitxorParameterSetBuilder withNumber2(@Nullable final com.google.gson.JsonElement val) {
this.number2 = val;
return this;
}
@Nullable
protected WorkbookFunctionsBitxorParameterSetBuilder(){}
|
com.google.gson.JsonElement number2; public WorkbookFunctionsBitxorParameterSetBuilder function(@Nullable final com.google.gson.JsonElement val) { this.number2 = val; return this; } protected WorkbookFunctionsBitxorParameterSetBuilder(){}
|
/**
* Sets the Number2
* @param val the value to set it to
* @return the current builder object
*/
|
Sets the Number2
|
withNumber2
|
{
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/models/WorkbookFunctionsBitxorParameterSet.java",
"license": "mit",
"size": 4284
}
|
[
"javax.annotation.Nullable"
] |
import javax.annotation.Nullable;
|
import javax.annotation.*;
|
[
"javax.annotation"
] |
javax.annotation;
| 252,273
|
DeleteIndexRequestBuilder prepareDelete(String... indices);
|
DeleteIndexRequestBuilder prepareDelete(String... indices);
|
/**
* Deletes an index based on the index name.
*
* @param indices The indices to delete. Use "_all" to delete all indices.
*/
|
Deletes an index based on the index name
|
prepareDelete
|
{
"repo_name": "robin13/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java",
"license": "apache-2.0",
"size": 26479
}
|
[
"org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder"
] |
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder;
|
import org.elasticsearch.action.admin.indices.delete.*;
|
[
"org.elasticsearch.action"
] |
org.elasticsearch.action;
| 1,814,315
|
public void addRdfData(URL url, URI baseUri, String context)
throws RdfDownloadException, RdfParseException, ContextNameSyntaxException,
SemanticRepositoryConnectionException {
SemanticRepositoryLockManager.getInstance().lockToWrite();
client.addRdfData(url, baseUri, context);
SemanticRepositoryWOOperation o = new SemanticRepositoryAddRdfDataOperation(url, baseUri, context);
operations.add(o);
SRA_LOGGER.info("operation added: " + o);
}
|
void function(URL url, URI baseUri, String context) throws RdfDownloadException, RdfParseException, ContextNameSyntaxException, SemanticRepositoryConnectionException { SemanticRepositoryLockManager.getInstance().lockToWrite(); client.addRdfData(url, baseUri, context); SemanticRepositoryWOOperation o = new SemanticRepositoryAddRdfDataOperation(url, baseUri, context); operations.add(o); SRA_LOGGER.info(STR + o); }
|
/**
* Adds RDF data from the specified URL to the semantic repository.
*
* @param url
* URL to RDF data
* @param baseUri
* base URI of the rdf data
* @param context
* context to which RDF data will be added
* @throws RdfDownloadException
* if the namespace of RDF data already exists
* @throws RdfParseException
* if an error occurred while parsing the RDF data
* @throws ContextNameSyntaxException
* if the context is not valid URI
* @throws SemanticRepositoryConnectionException
* if some unexpected error occurs
*/
|
Adds RDF data from the specified URL to the semantic repository
|
addRdfData
|
{
"repo_name": "psnc-dl/darceo",
"path": "sra/common/src/main/java/pl/psnc/synat/sra/SemanticRepositoryManagedConnectionImpl.java",
"license": "gpl-3.0",
"size": 14023
}
|
[
"pl.psnc.synat.sra.concurrent.SemanticRepositoryLockManager",
"pl.psnc.synat.sra.exception.ContextNameSyntaxException",
"pl.psnc.synat.sra.exception.RdfDownloadException",
"pl.psnc.synat.sra.exception.RdfParseException",
"pl.psnc.synat.sra.exception.SemanticRepositoryConnectionException"
] |
import pl.psnc.synat.sra.concurrent.SemanticRepositoryLockManager; import pl.psnc.synat.sra.exception.ContextNameSyntaxException; import pl.psnc.synat.sra.exception.RdfDownloadException; import pl.psnc.synat.sra.exception.RdfParseException; import pl.psnc.synat.sra.exception.SemanticRepositoryConnectionException;
|
import pl.psnc.synat.sra.concurrent.*; import pl.psnc.synat.sra.exception.*;
|
[
"pl.psnc.synat"
] |
pl.psnc.synat;
| 1,400,065
|
public void drawItem(Graphics2D g2, XYItemRendererState state,
Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis,
ValueAxis rangeAxis, XYDataset dataset, int series, int item,
boolean selected, int pass) {
double x = dataset.getXValue(series, item);
double y = dataset.getYValue(series, item);
double z = 0.0;
if (dataset instanceof XYZDataset) {
z = ((XYZDataset) dataset).getZValue(series, item);
}
Paint p = this.paintScale.getPaint(z);
double xx0 = domainAxis.valueToJava2D(x + this.xOffset, dataArea,
plot.getDomainAxisEdge());
double yy0 = rangeAxis.valueToJava2D(y + this.yOffset, dataArea,
plot.getRangeAxisEdge());
double xx1 = domainAxis.valueToJava2D(x + this.blockWidth
+ this.xOffset, dataArea, plot.getDomainAxisEdge());
double yy1 = rangeAxis.valueToJava2D(y + this.blockHeight
+ this.yOffset, dataArea, plot.getRangeAxisEdge());
Rectangle2D block;
PlotOrientation orientation = plot.getOrientation();
if (orientation.equals(PlotOrientation.HORIZONTAL)) {
block = new Rectangle2D.Double(Math.min(yy0, yy1),
Math.min(xx0, xx1), Math.abs(yy1 - yy0),
Math.abs(xx0 - xx1));
}
else {
block = new Rectangle2D.Double(Math.min(xx0, xx1),
Math.min(yy0, yy1), Math.abs(xx1 - xx0),
Math.abs(yy1 - yy0));
}
g2.setPaint(p);
g2.fill(block);
g2.setStroke(new BasicStroke(1.0f));
g2.draw(block);
EntityCollection entities = state.getEntityCollection();
if (entities != null) {
addEntity(entities, block, dataset, series, item, selected, 0.0,
0.0);
}
}
|
void function(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, boolean selected, int pass) { double x = dataset.getXValue(series, item); double y = dataset.getYValue(series, item); double z = 0.0; if (dataset instanceof XYZDataset) { z = ((XYZDataset) dataset).getZValue(series, item); } Paint p = this.paintScale.getPaint(z); double xx0 = domainAxis.valueToJava2D(x + this.xOffset, dataArea, plot.getDomainAxisEdge()); double yy0 = rangeAxis.valueToJava2D(y + this.yOffset, dataArea, plot.getRangeAxisEdge()); double xx1 = domainAxis.valueToJava2D(x + this.blockWidth + this.xOffset, dataArea, plot.getDomainAxisEdge()); double yy1 = rangeAxis.valueToJava2D(y + this.blockHeight + this.yOffset, dataArea, plot.getRangeAxisEdge()); Rectangle2D block; PlotOrientation orientation = plot.getOrientation(); if (orientation.equals(PlotOrientation.HORIZONTAL)) { block = new Rectangle2D.Double(Math.min(yy0, yy1), Math.min(xx0, xx1), Math.abs(yy1 - yy0), Math.abs(xx0 - xx1)); } else { block = new Rectangle2D.Double(Math.min(xx0, xx1), Math.min(yy0, yy1), Math.abs(xx1 - xx0), Math.abs(yy1 - yy0)); } g2.setPaint(p); g2.fill(block); g2.setStroke(new BasicStroke(1.0f)); g2.draw(block); EntityCollection entities = state.getEntityCollection(); if (entities != null) { addEntity(entities, block, dataset, series, item, selected, 0.0, 0.0); } }
|
/**
* Draws the block representing the specified item.
*
* @param g2 the graphics device.
* @param state the state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the x-axis.
* @param rangeAxis the y-axis.
* @param dataset the dataset.
* @param series the series index.
* @param item the item index.
* @param pass the pass index.
*/
|
Draws the block representing the specified item
|
drawItem
|
{
"repo_name": "linuxuser586/jfreechart",
"path": "source/org/jfree/chart/renderer/xy/XYBlockRenderer.java",
"license": "lgpl-2.1",
"size": 15136
}
|
[
"java.awt.BasicStroke",
"java.awt.Graphics2D",
"java.awt.Paint",
"java.awt.geom.Rectangle2D",
"org.jfree.chart.axis.ValueAxis",
"org.jfree.chart.entity.EntityCollection",
"org.jfree.chart.plot.PlotOrientation",
"org.jfree.chart.plot.XYPlot",
"org.jfree.data.xy.XYDataset",
"org.jfree.data.xy.XYZDataset"
] |
import java.awt.BasicStroke; import java.awt.Graphics2D; import java.awt.Paint; import java.awt.geom.Rectangle2D; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.entity.EntityCollection; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYZDataset;
|
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.axis.*; import org.jfree.chart.entity.*; import org.jfree.chart.plot.*; import org.jfree.data.xy.*;
|
[
"java.awt",
"org.jfree.chart",
"org.jfree.data"
] |
java.awt; org.jfree.chart; org.jfree.data;
| 1,376,163
|
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException;
|
Principal function() throws SSLPeerUnverifiedException;
|
/**
* Returns the principal identifying the peer during the handshake.
*
* @return the principal identifying the peer.
* @throws SSLPeerUnverifiedException
* if the identity of the peer has not been verified.
*/
|
Returns the principal identifying the peer during the handshake
|
getPeerPrincipal
|
{
"repo_name": "JSDemos/android-sdk-20",
"path": "src/javax/net/ssl/SSLSession.java",
"license": "apache-2.0",
"size": 7312
}
|
[
"java.security.Principal"
] |
import java.security.Principal;
|
import java.security.*;
|
[
"java.security"
] |
java.security;
| 1,791,561
|
public BufferedImage generateFloorImage( InputStream is ) throws IllegalArgumentException
{
if ( is == null ) {
throw new IllegalArgumentException( "Argument must not be null!" );
}
return generateFloorImage( loadLayout( is ) );
}
/**
* Attempts to generate a matching floor image for the specified layout.<br>
* <br>
* The returned image can be later saved using<br>
* {@link ImageIO ImageIO.write(image, "PNG", new File("C:/yourImageName.PNG"));}
|
BufferedImage function( InputStream is ) throws IllegalArgumentException { if ( is == null ) { throw new IllegalArgumentException( STR ); } return generateFloorImage( loadLayout( is ) ); } /** * Attempts to generate a matching floor image for the specified layout.<br> * <br> * The returned image can be later saved using<br> * {@link ImageIO ImageIO.write(image, "PNG", new File(STR));}
|
/**
* Attempts to generate a matching floor image for the specified layout.<br>
* <br>
* The returned image can be later saved using<br>
* {@link ImageIO ImageIO.write(image, "PNG", new File("C:/yourImageName.PNG"));}<br>
* <br>
* <b>This method does NOT close the stream.</b>
*
* @param is
* input stream for the file containing the ship's room layout
* @return the floor image
*
* @throws IllegalArgumentException
* when the file contains syntax errors, or argument is null
*/
|
Attempts to generate a matching floor image for the specified layout. The returned image can be later saved using This method does NOT close the stream
|
generateFloorImage
|
{
"repo_name": "kartoFlane/superluminal2",
"path": "src/java/com/kartoflane/ftl/floorgen/FloorImageFactory.java",
"license": "gpl-2.0",
"size": 20241
}
|
[
"java.awt.image.BufferedImage",
"java.io.File",
"java.io.InputStream",
"javax.imageio.ImageIO"
] |
import java.awt.image.BufferedImage; import java.io.File; import java.io.InputStream; import javax.imageio.ImageIO;
|
import java.awt.image.*; import java.io.*; import javax.imageio.*;
|
[
"java.awt",
"java.io",
"javax.imageio"
] |
java.awt; java.io; javax.imageio;
| 53,139
|
public static MemoryAllocator createOffHeapStorage(StatisticsFactory sf, long offHeapMemorySize,
DistributedSystem system) {
if (offHeapMemorySize == 0 || Boolean.getBoolean(InternalLocator.FORCE_LOCATOR_DM_TYPE)) {
// Checking the FORCE_LOCATOR_DM_TYPE is a quick hack to keep our locator from allocating off
// heap memory.
return null;
}
if (offHeapMemorySize < MIN_SLAB_SIZE) {
throw new IllegalArgumentException("The amount of off heap memory must be at least "
+ MIN_SLAB_SIZE + " but it was set to " + offHeapMemorySize);
}
// Ensure that using off-heap will work with this JVM.
validateVmCompatibility();
if (system == null) {
throw new IllegalArgumentException("InternalDistributedSystem is null");
}
// ooohml provides the hook for disconnecting and closing cache on OutOfOffHeapMemoryException
OutOfOffHeapMemoryListener ooohml =
new DisconnectingOutOfOffHeapMemoryListener((InternalDistributedSystem) system);
return basicCreateOffHeapStorage(sf, offHeapMemorySize, ooohml);
}
|
static MemoryAllocator function(StatisticsFactory sf, long offHeapMemorySize, DistributedSystem system) { if (offHeapMemorySize == 0 Boolean.getBoolean(InternalLocator.FORCE_LOCATOR_DM_TYPE)) { return null; } if (offHeapMemorySize < MIN_SLAB_SIZE) { throw new IllegalArgumentException(STR + MIN_SLAB_SIZE + STR + offHeapMemorySize); } validateVmCompatibility(); if (system == null) { throw new IllegalArgumentException(STR); } OutOfOffHeapMemoryListener ooohml = new DisconnectingOutOfOffHeapMemoryListener((InternalDistributedSystem) system); return basicCreateOffHeapStorage(sf, offHeapMemorySize, ooohml); }
|
/**
* Constructs a MemoryAllocator for off-heap storage.
*
* @return MemoryAllocator for off-heap storage
*/
|
Constructs a MemoryAllocator for off-heap storage
|
createOffHeapStorage
|
{
"repo_name": "PurelyApplied/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapStorage.java",
"license": "apache-2.0",
"size": 16141
}
|
[
"org.apache.geode.StatisticsFactory",
"org.apache.geode.distributed.DistributedSystem",
"org.apache.geode.distributed.internal.InternalDistributedSystem",
"org.apache.geode.distributed.internal.InternalLocator"
] |
import org.apache.geode.StatisticsFactory; import org.apache.geode.distributed.DistributedSystem; import org.apache.geode.distributed.internal.InternalDistributedSystem; import org.apache.geode.distributed.internal.InternalLocator;
|
import org.apache.geode.*; import org.apache.geode.distributed.*; import org.apache.geode.distributed.internal.*;
|
[
"org.apache.geode"
] |
org.apache.geode;
| 2,755,274
|
@Test
public void testUnmarshallExampleAttribute() throws Exception {
final String xml = "<saml:Attribute FriendlyName=\"CurrentAddress\" Name=\"http://eidas.europa.eu/attributes/naturalperson/CurrentAddress\" NameFormat=\"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\" xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+ "<saml:AttributeValue xmlns:eidas=\"http://eidas.europa.eu/attributes/naturalperson\" xsi:type=\"eidas:CurrentAddressType\">"
+ "PGVpZGFzOkxvY2F0b3JEZXNpZ25hdG9yPjIyPC9laWRhczpMb2NhdG9yRGVzaWduYX\n"
+ "Rvcj48ZWlkYXM6VGhvcm91Z2hmYXJlPkFyY2FjaWEgQXZlbnVlPC9laWRhczpUaG9y\n"
+ "b3VnaGZhcmU+DQo8ZWlkYXM6UG9zdE5hbWU+TG9uZG9uPC9laWRhczpQb3N0TmFtZT\n"
+ "4NCjxlaWRhczpQb3N0Q29kZT5TVzFBIDFBQTwvZWlkYXM6UG9zdENvZGU+"
+ "</saml:AttributeValue>"
+ "</saml:Attribute>";
Document doc = XMLObjectProviderRegistrySupport.getParserPool().parse(new ByteArrayInputStream(xml.getBytes("UTF-8")));
Element elm = doc.getDocumentElement();
Attribute attribute = OpenSAMLTestBase.unmarshall(elm, Attribute.class);
Assert.assertNotNull(attribute);
Assert.assertEquals(AttributeConstants.EIDAS_CURRENT_ADDRESS_ATTRIBUTE_NAME, attribute.getName());
Assert.assertEquals(AttributeConstants.EIDAS_CURRENT_ADDRESS_ATTRIBUTE_FRIENDLY_NAME, attribute.getFriendlyName());
List<XMLObject> values = attribute.getAttributeValues();
Assert.assertTrue(values.size() == 1);
Assert.assertTrue(values.get(0) instanceof CurrentAddressType);
CurrentAddressType address = (CurrentAddressType) values.get(0);
Assert.assertEquals("22", address.getLocatorDesignator());
Assert.assertEquals("Arcacia Avenue", address.getThoroughfare());
Assert.assertEquals("London", address.getPostName());
Assert.assertEquals("SW1A 1AA", address.getPostCode());
}
|
void function() throws Exception { final String xml = STRCurrentAddress\STRhttp: + STRhttp: + STR + STR + STR + STR + STR + STR; Document doc = XMLObjectProviderRegistrySupport.getParserPool().parse(new ByteArrayInputStream(xml.getBytes("UTF-8"))); Element elm = doc.getDocumentElement(); Attribute attribute = OpenSAMLTestBase.unmarshall(elm, Attribute.class); Assert.assertNotNull(attribute); Assert.assertEquals(AttributeConstants.EIDAS_CURRENT_ADDRESS_ATTRIBUTE_NAME, attribute.getName()); Assert.assertEquals(AttributeConstants.EIDAS_CURRENT_ADDRESS_ATTRIBUTE_FRIENDLY_NAME, attribute.getFriendlyName()); List<XMLObject> values = attribute.getAttributeValues(); Assert.assertTrue(values.size() == 1); Assert.assertTrue(values.get(0) instanceof CurrentAddressType); CurrentAddressType address = (CurrentAddressType) values.get(0); Assert.assertEquals("22", address.getLocatorDesignator()); Assert.assertEquals(STR, address.getThoroughfare()); Assert.assertEquals(STR, address.getPostName()); Assert.assertEquals(STR, address.getPostCode()); }
|
/**
* Test unmarshalling an attribute holding a CurrentAddress type. Example is from eIDAS specs.
* <p>
* The example contains the Base64-encoding of the following XML-snippet:
*
* <pre>
* <eidas:LocatorDesignator>22</eidas:LocatorDesignator>
* <eidas:Thoroughfare>Arcacia Avenue</eidas:Thoroughfare>
* <eidas:PostName>London</eidas:PostName>
* <eidas:PostCode>SW1A 1AA</eidas:Postcode>
* </pre>
* </p>
*
* @throws Exception
* for errors.
*/
|
Test unmarshalling an attribute holding a CurrentAddress type. Example is from eIDAS specs. The example contains the Base64-encoding of the following XML-snippet: <code> 22 Arcacia Avenue London SW1A 1AA </code>
|
testUnmarshallExampleAttribute
|
{
"repo_name": "litsec/eidas-opensaml",
"path": "opensaml4/src/test/java/se/litsec/eidas/opensaml/ext/attributes/CurrentAddressTypeTest.java",
"license": "apache-2.0",
"size": 12614
}
|
[
"java.io.ByteArrayInputStream",
"java.util.List",
"org.junit.Assert",
"org.opensaml.core.xml.XMLObject",
"org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport",
"org.opensaml.saml.saml2.core.Attribute",
"org.w3c.dom.Document",
"org.w3c.dom.Element",
"se.litsec.eidas.opensaml.OpenSAMLTestBase"
] |
import java.io.ByteArrayInputStream; import java.util.List; import org.junit.Assert; import org.opensaml.core.xml.XMLObject; import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport; import org.opensaml.saml.saml2.core.Attribute; import org.w3c.dom.Document; import org.w3c.dom.Element; import se.litsec.eidas.opensaml.OpenSAMLTestBase;
|
import java.io.*; import java.util.*; import org.junit.*; import org.opensaml.core.xml.*; import org.opensaml.core.xml.config.*; import org.opensaml.saml.saml2.core.*; import org.w3c.dom.*; import se.litsec.eidas.opensaml.*;
|
[
"java.io",
"java.util",
"org.junit",
"org.opensaml.core",
"org.opensaml.saml",
"org.w3c.dom",
"se.litsec.eidas"
] |
java.io; java.util; org.junit; org.opensaml.core; org.opensaml.saml; org.w3c.dom; se.litsec.eidas;
| 755,675
|
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
defaultValue = "False")
@SimpleProperty
public void HighByteFirst(boolean highByteFirst) {
byteOrder = highByteFirst ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
}
|
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False") void function(boolean highByteFirst) { byteOrder = highByteFirst ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN; }
|
/**
* Specifies whether numbers are sent and received with the most significant
* byte first.
*
* @param highByteFirst {@code true} for high byte first, {@code false} for
* low byte first
*/
|
Specifies whether numbers are sent and received with the most significant byte first
|
HighByteFirst
|
{
"repo_name": "satgod/appinventor",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/BluetoothConnectionBase.java",
"license": "mit",
"size": 26399
}
|
[
"com.google.appinventor.components.annotations.DesignerProperty",
"com.google.appinventor.components.common.PropertyTypeConstants",
"java.nio.ByteOrder"
] |
import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.common.PropertyTypeConstants; import java.nio.ByteOrder;
|
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*; import java.nio.*;
|
[
"com.google.appinventor",
"java.nio"
] |
com.google.appinventor; java.nio;
| 2,147,055
|
public static String serialize(Object object) throws TurnusException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(object);
oos.close();
} catch (Exception e) {
throw new TurnusException("Object serialization error", e);
}
return Base64.getEncoder().encodeToString(baos.toByteArray());
}
|
static String function(Object object) throws TurnusException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(object); oos.close(); } catch (Exception e) { throw new TurnusException(STR, e); } return Base64.getEncoder().encodeToString(baos.toByteArray()); }
|
/**
* Serialize a generic object to a String. The string contains a lexical
* representation of xsd:base64Binary
*
* @param o
* the object
* @return the string representation of the object
* @throws TurnusException
* if the object cannot be serialized
*/
|
Serialize a generic object to a String. The string contains a lexical representation of xsd:base64Binary
|
serialize
|
{
"repo_name": "turnus/turnus",
"path": "turnus.common/src/turnus/common/util/ObjectUtils.java",
"license": "gpl-3.0",
"size": 3420
}
|
[
"java.io.ByteArrayOutputStream",
"java.io.ObjectOutputStream",
"java.util.Base64"
] |
import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.util.Base64;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 1,520,640
|
public static void onActivityCreateSetTheme(Activity activity) {
switch (sTheme) {
default:
case THEME_DEFAULT:
activity.setTheme(R.style.FirstTheme);
break;
case THEME_WHITE:
activity.setTheme(R.style.SecondTheme);
break;
case THEME_BLUE:
activity.setTheme(R.style.ThirdTheme);
break;
}
}
|
static void function(Activity activity) { switch (sTheme) { default: case THEME_DEFAULT: activity.setTheme(R.style.FirstTheme); break; case THEME_WHITE: activity.setTheme(R.style.SecondTheme); break; case THEME_BLUE: activity.setTheme(R.style.ThirdTheme); break; } }
|
/**
* Set the theme of the activity according to the configuration
*/
|
Set the theme of the activity according to the configuration
|
onActivityCreateSetTheme
|
{
"repo_name": "NYIT-CSCI455-2015-Spring/BluetoothChat",
"path": "Application/src/main/java/com/example/android/bluetoothchat/Utils.java",
"license": "apache-2.0",
"size": 1768
}
|
[
"android.app.Activity"
] |
import android.app.Activity;
|
import android.app.*;
|
[
"android.app"
] |
android.app;
| 121,927
|
public static int getDaysOfTheMonth(Connection pConexao, Date pData, boolean pUtil) {
return getDaysOfTheMonth(pConexao, pData, pUtil, -1);
}
|
static int function(Connection pConexao, Date pData, boolean pUtil) { return getDaysOfTheMonth(pConexao, pData, pUtil, -1); }
|
/**
* Chama o metodo getDiasDoMes(), considerando pCidade = -1
* @param pData Data a partir do qual será efetuado o cálculo dos dias do mês
* @param pUtil Indica se o cálculo será em dia útil(True) ou dia Corrido(False)
* @return Quantidade de dias do mês
*/
|
Chama o metodo getDiasDoMes(), considerando pCidade = -1
|
getDaysOfTheMonth
|
{
"repo_name": "dbsoftcombr/dbssdk",
"path": "src/main/java/br/com/dbsoft/util/DBSDate.java",
"license": "mit",
"size": 65869
}
|
[
"java.sql.Connection",
"java.sql.Date"
] |
import java.sql.Connection; import java.sql.Date;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 1,605,964
|
private ResultSet getPrimaryKeysODBC(
String catalog, String schema, String table) throws SQLException
{
CallableStatement cs = prepareCall(
"CALL SYSIBM.SQLPRIMARYKEYS(?, ?, ?, 'DATATYPE=''ODBC''')");
cs.setString(1, catalog);
cs.setString(2, schema);
cs.setString(3, table);
cs.execute();
return cs.getResultSet();
}
|
ResultSet function( String catalog, String schema, String table) throws SQLException { CallableStatement cs = prepareCall( STR); cs.setString(1, catalog); cs.setString(2, schema); cs.setString(3, table); cs.execute(); return cs.getResultSet(); }
|
/**
* Helper method for testing getPrimaryKeys - calls the ODBC procedure
* @throws SQLException
*/
|
Helper method for testing getPrimaryKeys - calls the ODBC procedure
|
getPrimaryKeysODBC
|
{
"repo_name": "gemxd/gemfirexd-oss",
"path": "gemfirexd/tools/src/testing/java/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java",
"license": "apache-2.0",
"size": 184366
}
|
[
"java.sql.CallableStatement",
"java.sql.ResultSet",
"java.sql.SQLException"
] |
import java.sql.CallableStatement; import java.sql.ResultSet; import java.sql.SQLException;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 2,594,499
|
@Test
public void networkHostEc2PublicIpv4() throws IOException {
Settings nodeSettings = Settings.builder()
.put("network.host", "_ec2:publicIpv4_")
.build();
NetworkService networkService = new NetworkService(nodeSettings);
networkService.addCustomNameResolver(new Ec2NameResolver(nodeSettings));
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
try {
networkService.resolveBindHostAddress(null);
} catch (IOException e) {
assertThat(e.getMessage(), containsString("public-ipv4"));
}
}
|
void function() throws IOException { Settings nodeSettings = Settings.builder() .put(STR, STR) .build(); NetworkService networkService = new NetworkService(nodeSettings); networkService.addCustomNameResolver(new Ec2NameResolver(nodeSettings)); try { networkService.resolveBindHostAddress(null); } catch (IOException e) { assertThat(e.getMessage(), containsString(STR)); } }
|
/**
* Test for network.host: _ec2:publicIpv4_
*/
|
Test for network.host: _ec2:publicIpv4_
|
networkHostEc2PublicIpv4
|
{
"repo_name": "jeteve/elasticsearch",
"path": "plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2NetworkTests.java",
"license": "apache-2.0",
"size": 7025
}
|
[
"java.io.IOException",
"org.elasticsearch.cloud.aws.network.Ec2NameResolver",
"org.elasticsearch.common.network.NetworkService",
"org.elasticsearch.common.settings.Settings",
"org.hamcrest.Matchers"
] |
import java.io.IOException; import org.elasticsearch.cloud.aws.network.Ec2NameResolver; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; import org.hamcrest.Matchers;
|
import java.io.*; import org.elasticsearch.cloud.aws.network.*; import org.elasticsearch.common.network.*; import org.elasticsearch.common.settings.*; import org.hamcrest.*;
|
[
"java.io",
"org.elasticsearch.cloud",
"org.elasticsearch.common",
"org.hamcrest"
] |
java.io; org.elasticsearch.cloud; org.elasticsearch.common; org.hamcrest;
| 2,146,932
|
public java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI> getSubterm_multisets_CardinalityOfHLAPI(){
java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI>();
for (Term elemnt : getSubterm()) {
if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.multisets.impl.CardinalityOfImpl.class)){
retour.add(new fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI(
(fr.lip6.move.pnml.hlpn.multisets.CardinalityOf)elemnt
));
}
}
return retour;
}
|
java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.multisets.impl.CardinalityOfImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI( (fr.lip6.move.pnml.hlpn.multisets.CardinalityOf)elemnt )); } } return retour; }
|
/**
* This accessor return a list of encapsulated subelement, only of CardinalityOfHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/
|
This accessor return a list of encapsulated subelement, only of CardinalityOfHLAPI kind. WARNING : this method can creates a lot of new object in memory
|
getSubterm_multisets_CardinalityOfHLAPI
|
{
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/lists/hlapi/SublistHLAPI.java",
"license": "epl-1.0",
"size": 111755
}
|
[
"fr.lip6.move.pnml.hlpn.terms.Term",
"java.util.ArrayList",
"java.util.List"
] |
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
|
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
|
[
"fr.lip6.move",
"java.util"
] |
fr.lip6.move; java.util;
| 283,803
|
@Test
public void testGetComputerOneValue() {
try {
assertEquals(1, companyDAO.getComputers(2L).size());
} catch (CompanyNotFoundException e) {
fail("Company Not Found");
}
}
|
void function() { try { assertEquals(1, companyDAO.getComputers(2L).size()); } catch (CompanyNotFoundException e) { fail(STR); } }
|
/**
* Test getComputer.
*/
|
Test getComputer
|
testGetComputerOneValue
|
{
"repo_name": "mathieuaime/computer-database",
"path": "computerDatabase-persistence/src/test/java/com/excilys/computerdatabase/daos/CompanyDAOTest.java",
"license": "apache-2.0",
"size": 5670
}
|
[
"com.excilys.computerdatabase.exceptions.CompanyNotFoundException"
] |
import com.excilys.computerdatabase.exceptions.CompanyNotFoundException;
|
import com.excilys.computerdatabase.exceptions.*;
|
[
"com.excilys.computerdatabase"
] |
com.excilys.computerdatabase;
| 1,777,000
|
public boolean isNodeIdInOutage(final long lnodeid, final Outage out) {
if (out == null) return false;
for (final Node onode : out.getNodeCollection()) {
if (onode.getId() == lnodeid) {
return true;
}
}
return false;
}
|
boolean function(final long lnodeid, final Outage out) { if (out == null) return false; for (final Node onode : out.getNodeCollection()) { if (onode.getId() == lnodeid) { return true; } } return false; }
|
/**
* <p>
* Return if nodeid is part of specified outage
* </p>
*
* @param lnodeid
* the nodeid to be looked up
* @return the node iis part of the specified outage
* @param getOutageSchedule(out) a {@link org.opennms.netmgt.config.poller.Outage} object.
*/
|
Return if nodeid is part of specified outage
|
isNodeIdInOutage
|
{
"repo_name": "bugcy013/opennms-tmp-tools",
"path": "opennms-config/src/main/java/org/opennms/netmgt/config/PollOutagesConfigManager.java",
"license": "gpl-2.0",
"size": 12311
}
|
[
"org.opennms.netmgt.config.poller.Node",
"org.opennms.netmgt.config.poller.Outage"
] |
import org.opennms.netmgt.config.poller.Node; import org.opennms.netmgt.config.poller.Outage;
|
import org.opennms.netmgt.config.poller.*;
|
[
"org.opennms.netmgt"
] |
org.opennms.netmgt;
| 1,178,632
|
public static boolean enableRead(SelectionKey key)
{
try {
key.interestOps(key.interestOps() | SelectionKey.OP_READ);
return true;
} catch(Exception ex) {
return false;
}
}
|
static boolean function(SelectionKey key) { try { key.interestOps(key.interestOps() SelectionKey.OP_READ); return true; } catch(Exception ex) { return false; } }
|
/**
* Modify the given selection key so that it does include the read
* operation.
*
* @param key The selection key to modify
* @return True is the key was modified, false otherwise
*/
|
Modify the given selection key so that it does include the read operation
|
enableRead
|
{
"repo_name": "cfloersch/Stdlib",
"path": "src/main/java/xpertss/io/NIOUtils.java",
"license": "gpl-2.0",
"size": 16983
}
|
[
"java.nio.channels.SelectionKey"
] |
import java.nio.channels.SelectionKey;
|
import java.nio.channels.*;
|
[
"java.nio"
] |
java.nio;
| 2,775,908
|
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
void stopAuth() {
if (mCancellationSignal != null) {
isScanning = true;
mCancellationSignal.cancel();
mCancellationSignal = null;
}
}
|
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) void stopAuth() { if (mCancellationSignal != null) { isScanning = true; mCancellationSignal.cancel(); mCancellationSignal = null; } }
|
/**
* Stop the finger print authentication.
*/
|
Stop the finger print authentication
|
stopAuth
|
{
"repo_name": "kevalpatel2106/PasscodeView",
"path": "passcodeview/src/main/java/com/kevalpatel/passcodeview/internal/FingerPrintAuthHelper.java",
"license": "apache-2.0",
"size": 12826
}
|
[
"android.os.Build",
"android.support.annotation.RequiresApi"
] |
import android.os.Build; import android.support.annotation.RequiresApi;
|
import android.os.*; import android.support.annotation.*;
|
[
"android.os",
"android.support"
] |
android.os; android.support;
| 2,763,128
|
private void initEstimatedFile(int len) {
minimizeSum = new long[len+1];
subofSubSum = new long[len+1];
totalEstimate = new double[len+1];
partitionRate = new double[5];
partitionRate[0] = (5985+5758+5863+5542+6183+5870+6034+6007+5792+6008)*1.0/10;
partitionRate[1] = (7307+8178+7038+6952+7337+7694+7206+7259+7528+7420)*1.0/10;
partitionRate[2] = (11094+11212+10742+10907+11292+12426+11317+11648+11427+11838)*1.0/10;
partitionRate[3] = (14937+13276+14582+13620+12959+14650+13785+14076+13610+14405)*1.0/10;
partitionRate[4] = (16181+16519+15121+14231+14121+15431+15121+13121+15983+14212)*1.0/10;
partitionRate[0] = 3500;
partitionRate[1] = 7500;
partitionRate[2] = 11000;
partitionRate[3] = 14000;
partitionRate[4] = 16000;
al = new ArrayList<ArrayList<Tuple>>();
for (int i = 0; i < len + 1; i++) {
ArrayList<Tuple> single = new ArrayList<Tuple>();
al.add(single);
}
tmpCombine = new long[len];
for (int i = 0; i < len; i++)
tmpCombine[i] = 0;
}
|
void function(int len) { minimizeSum = new long[len+1]; subofSubSum = new long[len+1]; totalEstimate = new double[len+1]; partitionRate = new double[5]; partitionRate[0] = (5985+5758+5863+5542+6183+5870+6034+6007+5792+6008)*1.0/10; partitionRate[1] = (7307+8178+7038+6952+7337+7694+7206+7259+7528+7420)*1.0/10; partitionRate[2] = (11094+11212+10742+10907+11292+12426+11317+11648+11427+11838)*1.0/10; partitionRate[3] = (14937+13276+14582+13620+12959+14650+13785+14076+13610+14405)*1.0/10; partitionRate[4] = (16181+16519+15121+14231+14121+15431+15121+13121+15983+14212)*1.0/10; partitionRate[0] = 3500; partitionRate[1] = 7500; partitionRate[2] = 11000; partitionRate[3] = 14000; partitionRate[4] = 16000; al = new ArrayList<ArrayList<Tuple>>(); for (int i = 0; i < len + 1; i++) { ArrayList<Tuple> single = new ArrayList<Tuple>(); al.add(single); } tmpCombine = new long[len]; for (int i = 0; i < len; i++) tmpCombine[i] = 0; }
|
/**
* initial the ArrayList al initial the tmpCombine array
*
* @param len
*/
|
initial the ArrayList al initial the tmpCombine array
|
initEstimatedFile
|
{
"repo_name": "hxquangnhat/PIG-ROLLUP-CHAINEDIRG",
"path": "src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigGenericMapReduce.java",
"license": "apache-2.0",
"size": 103504
}
|
[
"java.util.ArrayList",
"org.apache.pig.data.Tuple"
] |
import java.util.ArrayList; import org.apache.pig.data.Tuple;
|
import java.util.*; import org.apache.pig.data.*;
|
[
"java.util",
"org.apache.pig"
] |
java.util; org.apache.pig;
| 1,779,007
|
public static MergeStatus canMerge(Repository repository, String src, String toBranch) {
RevWalk revWalk = null;
try {
revWalk = new RevWalk(repository);
ObjectId branchId = repository.resolve(toBranch);
if (branchId == null) {
return MergeStatus.MISSING_INTEGRATION_BRANCH;
}
ObjectId srcId = repository.resolve(src);
if (srcId == null) {
return MergeStatus.MISSING_SRC_BRANCH;
}
RevCommit branchTip = revWalk.lookupCommit(branchId);
RevCommit srcTip = revWalk.lookupCommit(srcId);
if (revWalk.isMergedInto(srcTip, branchTip)) {
// already merged
return MergeStatus.ALREADY_MERGED;
} else if (revWalk.isMergedInto(branchTip, srcTip)) {
// fast-forward
return MergeStatus.MERGEABLE;
}
RecursiveMerger merger = (RecursiveMerger) MergeStrategy.RECURSIVE.newMerger(repository, true);
boolean canMerge = merger.merge(branchTip, srcTip);
if (canMerge) {
return MergeStatus.MERGEABLE;
}
} catch (NullPointerException e) {
LOGGER.error("Failed to determine canMerge", e);
} catch (IOException e) {
LOGGER.error("Failed to determine canMerge", e);
} finally {
if (revWalk != null) {
revWalk.close();
}
}
return MergeStatus.NOT_MERGEABLE;
}
public static class MergeResult {
public final MergeStatus status;
public final String sha;
MergeResult(MergeStatus status, String sha) {
this.status = status;
this.sha = sha;
}
}
|
static MergeStatus function(Repository repository, String src, String toBranch) { RevWalk revWalk = null; try { revWalk = new RevWalk(repository); ObjectId branchId = repository.resolve(toBranch); if (branchId == null) { return MergeStatus.MISSING_INTEGRATION_BRANCH; } ObjectId srcId = repository.resolve(src); if (srcId == null) { return MergeStatus.MISSING_SRC_BRANCH; } RevCommit branchTip = revWalk.lookupCommit(branchId); RevCommit srcTip = revWalk.lookupCommit(srcId); if (revWalk.isMergedInto(srcTip, branchTip)) { return MergeStatus.ALREADY_MERGED; } else if (revWalk.isMergedInto(branchTip, srcTip)) { return MergeStatus.MERGEABLE; } RecursiveMerger merger = (RecursiveMerger) MergeStrategy.RECURSIVE.newMerger(repository, true); boolean canMerge = merger.merge(branchTip, srcTip); if (canMerge) { return MergeStatus.MERGEABLE; } } catch (NullPointerException e) { LOGGER.error(STR, e); } catch (IOException e) { LOGGER.error(STR, e); } finally { if (revWalk != null) { revWalk.close(); } } return MergeStatus.NOT_MERGEABLE; } public static class MergeResult { public final MergeStatus status; public final String sha; MergeResult(MergeStatus status, String sha) { this.status = status; this.sha = sha; } }
|
/**
* Determines if we can cleanly merge one branch into another. Returns true
* if we can merge without conflict, otherwise returns false.
*
* @param repository
* @param src
* @param toBranch
* @return true if we can merge without conflict
*/
|
Determines if we can cleanly merge one branch into another. Returns true if we can merge without conflict, otherwise returns false
|
canMerge
|
{
"repo_name": "paulsputer/gitblit",
"path": "src/main/java/com/gitblit/utils/JGitUtils.java",
"license": "apache-2.0",
"size": 88271
}
|
[
"java.io.IOException",
"org.eclipse.jgit.lib.ObjectId",
"org.eclipse.jgit.lib.Repository",
"org.eclipse.jgit.merge.MergeStrategy",
"org.eclipse.jgit.merge.RecursiveMerger",
"org.eclipse.jgit.revwalk.RevCommit",
"org.eclipse.jgit.revwalk.RevWalk"
] |
import java.io.IOException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.merge.MergeStrategy; import org.eclipse.jgit.merge.RecursiveMerger; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk;
|
import java.io.*; import org.eclipse.jgit.lib.*; import org.eclipse.jgit.merge.*; import org.eclipse.jgit.revwalk.*;
|
[
"java.io",
"org.eclipse.jgit"
] |
java.io; org.eclipse.jgit;
| 173,602
|
public void setContainerVariableDeclHLAPI(
VariableDeclHLAPI elem) {
if (elem != null)
item.setContainerVariableDecl((VariableDecl) elem.getContainedItem());
}
|
void function( VariableDeclHLAPI elem) { if (elem != null) item.setContainerVariableDecl((VariableDecl) elem.getContainedItem()); }
|
/**
* set ContainerVariableDecl
*/
|
set ContainerVariableDecl
|
setContainerVariableDeclHLAPI
|
{
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/terms/hlapi/MultisetSortHLAPI.java",
"license": "epl-1.0",
"size": 16242
}
|
[
"fr.lip6.move.pnml.pthlpng.terms.VariableDecl"
] |
import fr.lip6.move.pnml.pthlpng.terms.VariableDecl;
|
import fr.lip6.move.pnml.pthlpng.terms.*;
|
[
"fr.lip6.move"
] |
fr.lip6.move;
| 2,645,464
|
protected Writer openWriter(File outputPath, boolean append) throws IOException {
return new BufferedWriter(new FileWriter(outputPath,append));
}
|
Writer function(File outputPath, boolean append) throws IOException { return new BufferedWriter(new FileWriter(outputPath,append)); }
|
/**
* Open a BufferedWriter on supplied File.
*
* @param outputPath
* @param append
* @return
* @throws IOException
*/
|
Open a BufferedWriter on supplied File
|
openWriter
|
{
"repo_name": "cerebis/shap",
"path": "src/main/java/org/mzd/shap/spring/io/FastaWriterImpl.java",
"license": "gpl-3.0",
"size": 7490
}
|
[
"java.io.BufferedWriter",
"java.io.File",
"java.io.FileWriter",
"java.io.IOException",
"java.io.Writer"
] |
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,178,821
|
SPIJNI.spiClose(m_port);
}
|
SPIJNI.spiClose(m_port); }
|
/**
* Free the resources used by this object
*/
|
Free the resources used by this object
|
free
|
{
"repo_name": "robolib/robolibj",
"path": "src/io/github/robolib/module/iface/SPI.java",
"license": "mit",
"size": 7383
}
|
[
"io.github.robolib.jni.SPIJNI"
] |
import io.github.robolib.jni.SPIJNI;
|
import io.github.robolib.jni.*;
|
[
"io.github.robolib"
] |
io.github.robolib;
| 2,568,011
|
public HashMap<String, HashMap<String, String>> getConfigurations(String code1){
if (code1 == null) {
return null;
}
return configurationsMap.get(code1);
}
|
HashMap<String, HashMap<String, String>> function(String code1){ if (code1 == null) { return null; } return configurationsMap.get(code1); }
|
/**
* Public method to get configurations as set using the code1 supplied
*
* @param code1
* the code1 value MONITOR_CONFIG.BCC_CODE1
* @return the configurations for the supplied code1
*/
|
Public method to get configurations as set using the code1 supplied
|
getConfigurations
|
{
"repo_name": "MastekLtd/JBEAM",
"path": "jbeam-core-components/jbeam-monitor-services/src/main/java/com/stgmastek/monitor/ws/util/Configurations.java",
"license": "lgpl-3.0",
"size": 24804
}
|
[
"java.util.HashMap"
] |
import java.util.HashMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,783,277
|
@Test
public void testSerialization() throws IOException, ClassNotFoundException {
PowerFunction2D f1 = new PowerFunction2D(1.0, 2.0);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(f1);
out.close();
ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(
buffer.toByteArray()));
PowerFunction2D f2 = (PowerFunction2D) in.readObject();
in.close();
assertEquals(f1, f2);
}
|
void function() throws IOException, ClassNotFoundException { PowerFunction2D f1 = new PowerFunction2D(1.0, 2.0); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(f1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); PowerFunction2D f2 = (PowerFunction2D) in.readObject(); in.close(); assertEquals(f1, f2); }
|
/**
* Serialize an instance, restore it, and check for equality.
*/
|
Serialize an instance, restore it, and check for equality
|
testSerialization
|
{
"repo_name": "oskopek/jfreechart-fse",
"path": "src/test/java/org/jfree/data/function/PowerFunction2DTest.java",
"license": "lgpl-2.1",
"size": 3917
}
|
[
"java.io.ByteArrayInputStream",
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.ObjectInput",
"java.io.ObjectInputStream",
"java.io.ObjectOutput",
"java.io.ObjectOutputStream",
"org.junit.Assert"
] |
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import org.junit.Assert;
|
import java.io.*; import org.junit.*;
|
[
"java.io",
"org.junit"
] |
java.io; org.junit;
| 1,733,032
|
public long relativeTimeInMillis() {
return TimeValue.nsecToMSec(relativeTimeInNanos());
}
|
long function() { return TimeValue.nsecToMSec(relativeTimeInNanos()); }
|
/**
* Returns a value of milliseconds that may be used for relative time calculations.
*
* This method should only be used for calculating time deltas. For an epoch based
* timestamp, see {@link #absoluteTimeInMillis()}.
*/
|
Returns a value of milliseconds that may be used for relative time calculations. This method should only be used for calculating time deltas. For an epoch based timestamp, see <code>#absoluteTimeInMillis()</code>
|
relativeTimeInMillis
|
{
"repo_name": "coding0011/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java",
"license": "apache-2.0",
"size": 31278
}
|
[
"org.elasticsearch.common.unit.TimeValue"
] |
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.*;
|
[
"org.elasticsearch.common"
] |
org.elasticsearch.common;
| 665,154
|
Map<AmberExpr, String> getJoinFetchMap()
{
return _joinFetchMap;
}
|
Map<AmberExpr, String> getJoinFetchMap() { return _joinFetchMap; }
|
/**
* Gets the (join) fetch map.
*/
|
Gets the (join) fetch map
|
getJoinFetchMap
|
{
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/amber/query/AmberSelectQuery.java",
"license": "gpl-2.0",
"size": 15115
}
|
[
"com.caucho.amber.expr.AmberExpr",
"java.util.Map"
] |
import com.caucho.amber.expr.AmberExpr; import java.util.Map;
|
import com.caucho.amber.expr.*; import java.util.*;
|
[
"com.caucho.amber",
"java.util"
] |
com.caucho.amber; java.util;
| 1,299,474
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.