method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public VariableDescriptor createChild(final Long parentDescriptorId, final VariableDescriptor entity) { VariableDescriptor parent = this.find(parentDescriptorId); return this.createChild(parent.getGameModel(), (DescriptorListI) parent, entity, false, false); }
VariableDescriptor function(final Long parentDescriptorId, final VariableDescriptor entity) { VariableDescriptor parent = this.find(parentDescriptorId); return this.createChild(parent.getGameModel(), (DescriptorListI) parent, entity, false, false); }
/** * Create a new descriptor as a child of another * * @param parentDescriptorId owner of the descriptor * @param entity the new descriptor to create * * @return the new child */
Create a new descriptor as a child of another
createChild
{ "repo_name": "Heigvd/Wegas", "path": "wegas-core/src/main/java/com/wegas/core/ejb/VariableDescriptorFacade.java", "license": "mit", "size": 52276 }
[ "com.wegas.core.persistence.variable.DescriptorListI", "com.wegas.core.persistence.variable.VariableDescriptor" ]
import com.wegas.core.persistence.variable.DescriptorListI; import com.wegas.core.persistence.variable.VariableDescriptor;
import com.wegas.core.persistence.variable.*;
[ "com.wegas.core" ]
com.wegas.core;
1,367,408
public Timestamp getEndDate(); public static final String COLUMNNAME_GenerateOrder = "GenerateOrder";
Timestamp function(); public static final String COLUMNNAME_GenerateOrder = STR;
/** Get End Date. * Last effective date (inclusive) */
Get End Date. Last effective date (inclusive)
getEndDate
{ "repo_name": "arthurmelo88/palmetalADP", "path": "adempiere_360/base/src/org/compiere/model/I_C_ProjectPhase.java", "license": "gpl-2.0", "size": 9571 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,567,998
protected int getProviderCount(int managementType, int schoolType) throws RemoteException { ReportBusiness rb = getReportBusiness(); String managementType1 = null; String managementType2 = null; String managementType3 = null; String managementType4 = null; switch (managementType) { case COMMUNE: managementType1 = "COMMUNE"; managementType2 = managementType1; managementType3 = managementType1; managementType4 = managementType1; break; case PRIVATE: managementType1 = "COMPANY"; managementType2 = "FOUNDATION"; managementType3 = "OTHER"; managementType4 = "COOPERATIVE_COMMUNE_LIABILITY"; break; } int schoolType1 = 0; int schoolType2 = 0; int schoolType3 = 0; int schoolType4 = 0; switch (schoolType) { case SCHOOL_TYPE_PRE_SCHOOL: schoolType1 = rb.getPreSchoolTypeId(); schoolType2 = rb.getGeneralPreSchoolTypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_FAMILY_DAYCARE: schoolType1 = rb.getFamilyDayCareSchoolTypeId(); schoolType2 = rb.getGeneralFamilyDaycareSchoolTypeId(); schoolType3 = rb.getFamilyAfterSchool6TypeId(); schoolType4 = rb.getFamilyAfterSchool7_9TypeId(); break; case SCHOOL_TYPE_FAMILY_DAYCARE_PRE_SCHOOL_OPERATION: schoolType1 = rb.getFamilyDayCareSchoolTypeId(); schoolType2 = rb.getGeneralFamilyDaycareSchoolTypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_FAMILY_DAYCARE_AFTER_SCHOOL_OPERATION: schoolType1 = rb.getFamilyAfterSchool6TypeId(); schoolType2 = rb.getFamilyAfterSchool7_9TypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_AFTER_SCHOOL: schoolType1 = rb.getAfterSchool6TypeId(); schoolType2 = rb.getAfterSchool7_9TypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_ELEMENTARY_SCHOOL: schoolType1 = rb.getElementarySchoolTypeId(); schoolType2 = rb.getPreSchoolClassTypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_ELEMENTARY_SCHOOL_ONLY: schoolType1 = rb.getElementarySchoolTypeId(); schoolType2 = schoolType1; schoolType3 = schoolType1; schoolType4 = schoolType1; break; case SCHOOL_TYPE_ELEMENTARY_SCHOOL_PRES_SCHOOL_CLASS: schoolType1 = rb.getPreSchoolClassTypeId(); schoolType2 = schoolType1; schoolType3 = schoolType1; schoolType4 = schoolType1; break; case SCHOOL_TYPE_HIGH_SCHOOL: schoolType1 = rb.getHighSchoolTypeId(); schoolType2 = schoolType1; schoolType3 = schoolType1; schoolType4 = schoolType1; break; } PreparedQuery query = null; query = getQuery(QUERY_PROVIDER_COUNT); if (query == null) { query = new PreparedQuery(getConnection()); query.setSelectCountSubQuery(); query.setSelectDistinctSchools(); query.setOnlyNackaSchools(); query.setFourSchoolTypesForProvidersWithoutPlacements(); // parameter 1-4 query.setFourManagementTypes(); // parameter 5-8 query.setNotForeignSchools(); query.prepare(); setQuery(QUERY_PROVIDER_COUNT, query); } query.setInt(1, schoolType1); query.setInt(2, schoolType2); query.setInt(3, schoolType3); query.setInt(4, schoolType4); query.setString(5, managementType1); query.setString(6, managementType2); query.setString(7, managementType3); query.setString(8, managementType4); int nrOfProviders = query.execute(); if (schoolType == SCHOOL_TYPE_HIGH_SCHOOL) { // Special case subtract additional 'Nacka Gymnasium' nrOfProviders--; } return nrOfProviders; }
int function(int managementType, int schoolType) throws RemoteException { ReportBusiness rb = getReportBusiness(); String managementType1 = null; String managementType2 = null; String managementType3 = null; String managementType4 = null; switch (managementType) { case COMMUNE: managementType1 = STR; managementType2 = managementType1; managementType3 = managementType1; managementType4 = managementType1; break; case PRIVATE: managementType1 = STR; managementType2 = STR; managementType3 = "OTHER"; managementType4 = STR; break; } int schoolType1 = 0; int schoolType2 = 0; int schoolType3 = 0; int schoolType4 = 0; switch (schoolType) { case SCHOOL_TYPE_PRE_SCHOOL: schoolType1 = rb.getPreSchoolTypeId(); schoolType2 = rb.getGeneralPreSchoolTypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_FAMILY_DAYCARE: schoolType1 = rb.getFamilyDayCareSchoolTypeId(); schoolType2 = rb.getGeneralFamilyDaycareSchoolTypeId(); schoolType3 = rb.getFamilyAfterSchool6TypeId(); schoolType4 = rb.getFamilyAfterSchool7_9TypeId(); break; case SCHOOL_TYPE_FAMILY_DAYCARE_PRE_SCHOOL_OPERATION: schoolType1 = rb.getFamilyDayCareSchoolTypeId(); schoolType2 = rb.getGeneralFamilyDaycareSchoolTypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_FAMILY_DAYCARE_AFTER_SCHOOL_OPERATION: schoolType1 = rb.getFamilyAfterSchool6TypeId(); schoolType2 = rb.getFamilyAfterSchool7_9TypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_AFTER_SCHOOL: schoolType1 = rb.getAfterSchool6TypeId(); schoolType2 = rb.getAfterSchool7_9TypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_ELEMENTARY_SCHOOL: schoolType1 = rb.getElementarySchoolTypeId(); schoolType2 = rb.getPreSchoolClassTypeId(); schoolType3 = schoolType2; schoolType4 = schoolType2; break; case SCHOOL_TYPE_ELEMENTARY_SCHOOL_ONLY: schoolType1 = rb.getElementarySchoolTypeId(); schoolType2 = schoolType1; schoolType3 = schoolType1; schoolType4 = schoolType1; break; case SCHOOL_TYPE_ELEMENTARY_SCHOOL_PRES_SCHOOL_CLASS: schoolType1 = rb.getPreSchoolClassTypeId(); schoolType2 = schoolType1; schoolType3 = schoolType1; schoolType4 = schoolType1; break; case SCHOOL_TYPE_HIGH_SCHOOL: schoolType1 = rb.getHighSchoolTypeId(); schoolType2 = schoolType1; schoolType3 = schoolType1; schoolType4 = schoolType1; break; } PreparedQuery query = null; query = getQuery(QUERY_PROVIDER_COUNT); if (query == null) { query = new PreparedQuery(getConnection()); query.setSelectCountSubQuery(); query.setSelectDistinctSchools(); query.setOnlyNackaSchools(); query.setFourSchoolTypesForProvidersWithoutPlacements(); query.setFourManagementTypes(); query.setNotForeignSchools(); query.prepare(); setQuery(QUERY_PROVIDER_COUNT, query); } query.setInt(1, schoolType1); query.setInt(2, schoolType2); query.setInt(3, schoolType3); query.setInt(4, schoolType4); query.setString(5, managementType1); query.setString(6, managementType2); query.setString(7, managementType3); query.setString(8, managementType4); int nrOfProviders = query.execute(); if (schoolType == SCHOOL_TYPE_HIGH_SCHOOL) { nrOfProviders--; } return nrOfProviders; }
/** * Returns the number of providers for the specified management and school type. */
Returns the number of providers for the specified management and school type
getProviderCount
{ "repo_name": "idega/platform2", "path": "src/se/idega/idegaweb/commune/school/report/business/NackaProviderSummaryReportModel.java", "license": "gpl-3.0", "size": 26823 }
[ "java.rmi.RemoteException" ]
import java.rmi.RemoteException;
import java.rmi.*;
[ "java.rmi" ]
java.rmi;
1,723,100
public static void writeBufferedImage(BufferedImage image, String format, OutputStream outputStream, float quality, boolean encodeAlpha) throws IOException { ImageEncoder imageEncoder = ImageEncoderFactory.newInstance(format, quality, encodeAlpha); imageEncoder.encode(image, outputStream); }
static void function(BufferedImage image, String format, OutputStream outputStream, float quality, boolean encodeAlpha) throws IOException { ImageEncoder imageEncoder = ImageEncoderFactory.newInstance(format, quality, encodeAlpha); imageEncoder.encode(image, outputStream); }
/** * Encode the image in a specific format and write it to an OutputStream. * * @param image The image to be encoded. * @param format The {@link ImageFormat} to use. * @param outputStream The OutputStream to write the encoded image to. * @param quality The quality to use for the image encoding (not * supported by all ImageEncoders). * @param encodeAlpha Whether to encode alpha transparency (not supported * by all ImageEncoders). * @throws IOException */
Encode the image in a specific format and write it to an OutputStream
writeBufferedImage
{ "repo_name": "opensim-org/opensim-gui", "path": "Gui/opensim/jfreechart/src/org/jfree/chart/encoders/EncoderUtil.java", "license": "apache-2.0", "size": 7542 }
[ "java.awt.image.BufferedImage", "java.io.IOException", "java.io.OutputStream" ]
import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream;
import java.awt.image.*; import java.io.*;
[ "java.awt", "java.io" ]
java.awt; java.io;
2,216,455
public void removeSessionListener(IVideoSharingEventListener listener) { if (logger.isActivated()) { logger.info("Remove an event listener"); } synchronized(lock) { listeners.unregister(listener); } }
void function(IVideoSharingEventListener listener) { if (logger.isActivated()) { logger.info(STR); } synchronized(lock) { listeners.unregister(listener); } }
/** * Remove session listener * * @param listener Listener */
Remove session listener
removeSessionListener
{ "repo_name": "rex-xxx/mt6572_x201", "path": "mediatek/packages/apps/RCSe/core/src/com/orangelabs/rcs/service/api/server/richcall/VideoSharingSession.java", "license": "gpl-2.0", "size": 7840 }
[ "com.orangelabs.rcs.service.api.client.richcall.IVideoSharingEventListener" ]
import com.orangelabs.rcs.service.api.client.richcall.IVideoSharingEventListener;
import com.orangelabs.rcs.service.api.client.richcall.*;
[ "com.orangelabs.rcs" ]
com.orangelabs.rcs;
1,914,843
@Override // FsDatasetSpi public void invalidate(String bpid, Block invalidBlks[]) throws IOException { invalidate(bpid, invalidBlks, true); }
@Override void function(String bpid, Block invalidBlks[]) throws IOException { invalidate(bpid, invalidBlks, true); }
/** * We're informed that a block is no longer valid. Delete it. */
We're informed that a block is no longer valid. Delete it
invalidate
{ "repo_name": "Ethanlm/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java", "license": "apache-2.0", "size": 117789 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.protocol.Block" ]
import java.io.IOException; import org.apache.hadoop.hdfs.protocol.Block;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
124,145
public void setPromptView(View prompt) { boolean showing = isShowing(); if (showing) { removePromptView(); } mPromptView = prompt; if (showing) { show(); } }
void function(View prompt) { boolean showing = isShowing(); if (showing) { removePromptView(); } mPromptView = prompt; if (showing) { show(); } }
/** * Set a view to act as a user prompt for this popup window. Where the prompt view will appear * is controlled by {@link #setPromptPosition(int)}. * * @param prompt View to use as an informational prompt. */
Set a view to act as a user prompt for this popup window. Where the prompt view will appear is controlled by <code>#setPromptPosition(int)</code>
setPromptView
{ "repo_name": "Kingjimny/gdmc-mm", "path": "extra_libs/AppCompatLibrary/src/android/support/v7/internal/widget/ListPopupWindow.java", "license": "apache-2.0", "size": 55014 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,829,849
public void showDetails(WifiP2pDevice device) { this.device = device; this.getView().setVisibility(View.VISIBLE); TextView view = (TextView) mContentView.findViewById(R.id.device_address); view.setText(device.deviceAddress); view = (TextView) mContentView.findViewById(R.id.device_info); view.setText(device.toString()); }
void function(WifiP2pDevice device) { this.device = device; this.getView().setVisibility(View.VISIBLE); TextView view = (TextView) mContentView.findViewById(R.id.device_address); view.setText(device.deviceAddress); view = (TextView) mContentView.findViewById(R.id.device_info); view.setText(device.toString()); }
/** * Updates the UI with device data * * @param device the device to be displayed */
Updates the UI with device data
showDetails
{ "repo_name": "lucky-code/Practice", "path": "kuaichuan2.0/app/src/main/java/com/ckt/io/wifidirect/fragment/DeviceDetailFragment.java", "license": "apache-2.0", "size": 3489 }
[ "android.net.wifi.p2p.WifiP2pDevice", "android.view.View", "android.widget.TextView" ]
import android.net.wifi.p2p.WifiP2pDevice; import android.view.View; import android.widget.TextView;
import android.net.wifi.p2p.*; import android.view.*; import android.widget.*;
[ "android.net", "android.view", "android.widget" ]
android.net; android.view; android.widget;
2,328,242
ReferenceEntry<K, V> getEntry(@Nullable Object key) { // does not impact recency ordering if (key == null) { return null; } int hash = hash(key); return segmentFor(hash).getEntry(key, hash); }
ReferenceEntry<K, V> getEntry(@Nullable Object key) { if (key == null) { return null; } int hash = hash(key); return segmentFor(hash).getEntry(key, hash); }
/** * Returns the internal entry for the specified key. The entry may be loading, expired, or * partially collected. */
Returns the internal entry for the specified key. The entry may be loading, expired, or partially collected
getEntry
{ "repo_name": "typetools/guava", "path": "guava/src/com/google/common/cache/LocalCache.java", "license": "apache-2.0", "size": 151408 }
[ "org.checkerframework.checker.nullness.qual.Nullable" ]
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.nullness.qual.*;
[ "org.checkerframework.checker" ]
org.checkerframework.checker;
1,068,514
public static Logger getLogger(final Object value) { return getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2)); }
static Logger function(final Object value) { return getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2)); }
/** * Returns a Logger using the fully qualified class name of the value as the * Logger name. * * @param value * The value whose class name should be used as the Logger name. * If null the name of the calling class will be used as the * logger name. * @return The Logger. * @throws UnsupportedOperationException * if {@code value} is {@code null} and the calling class cannot * be determined. */
Returns a Logger using the fully qualified class name of the value as the Logger name
getLogger
{ "repo_name": "SourceStudyNotes/log4j2", "path": "src/main/java/org/apache/logging/log4j/LogManager.java", "license": "apache-2.0", "size": 26557 }
[ "org.apache.logging.log4j.util.ReflectionUtil" ]
import org.apache.logging.log4j.util.ReflectionUtil;
import org.apache.logging.log4j.util.*;
[ "org.apache.logging" ]
org.apache.logging;
1,711,856
protected int[] retrieveEndOfElementTypeNamePosition(int start, int end) { this.scanner.resetTo(start, end); try { int token; int count = 0; while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) { switch(token) { case TerminalTokens.TokenNameLPAREN: ++count; break; case TerminalTokens.TokenNameRPAREN: --count; break; case TerminalTokens.TokenNameIdentifier: case TerminalTokens.TokenNamebyte: case TerminalTokens.TokenNamechar: case TerminalTokens.TokenNamedouble: case TerminalTokens.TokenNamefloat: case TerminalTokens.TokenNameint: case TerminalTokens.TokenNamelong: case TerminalTokens.TokenNameshort: case TerminalTokens.TokenNameboolean: if (count > 0) break; return new int[]{this.scanner.startPosition, this.scanner.currentPosition - 1}; } } } catch(InvalidInputException e) { // ignore } return new int[]{-1, -1}; }
int[] function(int start, int end) { this.scanner.resetTo(start, end); try { int token; int count = 0; while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) { switch(token) { case TerminalTokens.TokenNameLPAREN: ++count; break; case TerminalTokens.TokenNameRPAREN: --count; break; case TerminalTokens.TokenNameIdentifier: case TerminalTokens.TokenNamebyte: case TerminalTokens.TokenNamechar: case TerminalTokens.TokenNamedouble: case TerminalTokens.TokenNamefloat: case TerminalTokens.TokenNameint: case TerminalTokens.TokenNamelong: case TerminalTokens.TokenNameshort: case TerminalTokens.TokenNameboolean: if (count > 0) break; return new int[]{this.scanner.startPosition, this.scanner.currentPosition - 1}; } } } catch(InvalidInputException e) { } return new int[]{-1, -1}; }
/** * This method is used to retrieve the start and end position of a name or primitive type token. * * @return int[] a single dimensional array, with two elements, for the start and end positions of the name respectively */
This method is used to retrieve the start and end position of a name or primitive type token
retrieveEndOfElementTypeNamePosition
{ "repo_name": "trylimits/Eclipse-Postfix-Code-Completion", "path": "luna/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java", "license": "epl-1.0", "size": 252832 }
[ "org.eclipse.jdt.core.compiler.InvalidInputException", "org.eclipse.jdt.internal.compiler.parser.TerminalTokens" ]
import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
import org.eclipse.jdt.core.compiler.*; import org.eclipse.jdt.internal.compiler.parser.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
2,247,006
@Test public void testExecutionHookTimeoutWithFallback() { TestHystrixCommand<Boolean> command = new TestCommandWithTimeout(50, TestCommandWithTimeout.FALLBACK_SUCCESS); try { command.queue().get(); } catch (Exception e) { throw new RuntimeException("not expecting", e); } // the run() method should run as we're not short-circuited or rejected assertEquals(1, command.builder.executionHook.startRun.get()); // we should not have a response because of timeout assertNull(command.builder.executionHook.runSuccessResponse); // we should not have an exception because run() didn't fail, it timed out assertNull(command.builder.executionHook.runFailureException); // the fallback() method should be run due to timeout assertEquals(1, command.builder.executionHook.startFallback.get()); // response since we have a fallback assertNotNull(command.builder.executionHook.fallbackSuccessResponse); // null since fallback succeeds assertNull(command.builder.executionHook.fallbackFailureException); // execution occurred assertEquals(1, command.builder.executionHook.startExecute.get()); // we should have a response because of fallback assertNotNull(command.builder.executionHook.endExecuteSuccessResponse); // we should not have an exception because of fallback assertNull(command.builder.executionHook.endExecuteFailureException); // thread execution // assertEquals(1, command.builder.executionHook.threadStart.get()); // we need to wait for the thread to complete before the onThreadComplete hook will be called // try { // Thread.sleep(400); // } catch (InterruptedException e) { // // ignore // } // assertEquals(1, command.builder.executionHook.threadComplete.get()); // semaphore isolated assertFalse(command.isExecutedInThread()); } /* * @Test * public void testExecutionHookRejectedWithFallback() { * TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); * SingleThreadedPool pool = new SingleThreadedPool(1); * * try { * // fill the queue * new TestCommandRejection(circuitBreaker, pool, 500, 600, TestCommandRejection.FALLBACK_SUCCESS).queue(); * new TestCommandRejection(circuitBreaker, pool, 500, 600, TestCommandRejection.FALLBACK_SUCCESS).queue(); * } catch (Exception e) { * // ignore * } * * TestCommandRejection command = new TestCommandRejection(circuitBreaker, pool, 500, 600, TestCommandRejection.FALLBACK_SUCCESS); * try { * // now execute one that will be rejected * command.queue().get(); * } catch (Exception e) { * throw new RuntimeException("not expecting", e); * } * * assertTrue(command.isResponseRejected()); * * // the run() method should not run as we're rejected * assertEquals(0, command.builder.executionHook.startRun.get()); * // we should not have a response because of rejection * assertNull(command.builder.executionHook.runSuccessResponse); * // we should not have an exception because we didn't run * assertNull(command.builder.executionHook.runFailureException); * * // the fallback() method should be run due to rejection * assertEquals(1, command.builder.executionHook.startFallback.get()); * // response since we have a fallback * assertNotNull(command.builder.executionHook.fallbackSuccessResponse); * // null since fallback succeeds * assertNull(command.builder.executionHook.fallbackFailureException); * * // execution occurred * assertEquals(1, command.builder.executionHook.startExecute.get()); * // we should have a response because of fallback * assertNotNull(command.builder.executionHook.endExecuteSuccessResponse); * // we should not have an exception because of fallback * assertNull(command.builder.executionHook.endExecuteFailureException); * * // thread execution * // assertEquals(0, command.builder.executionHook.threadStart.get()); * // assertEquals(0, command.builder.executionHook.threadComplete.get()); * }
void function() { TestHystrixCommand<Boolean> command = new TestCommandWithTimeout(50, TestCommandWithTimeout.FALLBACK_SUCCESS); try { command.queue().get(); } catch (Exception e) { throw new RuntimeException(STR, e); } assertEquals(1, command.builder.executionHook.startRun.get()); assertNull(command.builder.executionHook.runSuccessResponse); assertNull(command.builder.executionHook.runFailureException); assertEquals(1, command.builder.executionHook.startFallback.get()); assertNotNull(command.builder.executionHook.fallbackSuccessResponse); assertNull(command.builder.executionHook.fallbackFailureException); assertEquals(1, command.builder.executionHook.startExecute.get()); assertNotNull(command.builder.executionHook.endExecuteSuccessResponse); assertNull(command.builder.executionHook.endExecuteFailureException); assertFalse(command.isExecutedInThread()); } /* * * public void testExecutionHookRejectedWithFallback() { * TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); * SingleThreadedPool pool = new SingleThreadedPool(1); * * try { * * new TestCommandRejection(circuitBreaker, pool, 500, 600, TestCommandRejection.FALLBACK_SUCCESS).queue(); * new TestCommandRejection(circuitBreaker, pool, 500, 600, TestCommandRejection.FALLBACK_SUCCESS).queue(); * } catch (Exception e) { * * } * * TestCommandRejection command = new TestCommandRejection(circuitBreaker, pool, 500, 600, TestCommandRejection.FALLBACK_SUCCESS); * try { * * command.queue().get(); * } catch (Exception e) { * throw new RuntimeException(STR, e); * } * * assertTrue(command.isResponseRejected()); * * * assertEquals(0, command.builder.executionHook.startRun.get()); * * assertNull(command.builder.executionHook.runSuccessResponse); * * assertNull(command.builder.executionHook.runFailureException); * * * assertEquals(1, command.builder.executionHook.startFallback.get()); * * assertNotNull(command.builder.executionHook.fallbackSuccessResponse); * * assertNull(command.builder.executionHook.fallbackFailureException); * * * assertEquals(1, command.builder.executionHook.startExecute.get()); * * assertNotNull(command.builder.executionHook.endExecuteSuccessResponse); * * assertNull(command.builder.executionHook.endExecuteFailureException); * * * * * }
/** * Execution hook on timeout with a fallback */
Execution hook on timeout with a fallback
testExecutionHookTimeoutWithFallback
{ "repo_name": "daveray/Hystrix", "path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java", "license": "apache-2.0", "size": 357869 }
[ "com.netflix.hystrix.HystrixCircuitBreakerTest", "org.junit.Assert" ]
import com.netflix.hystrix.HystrixCircuitBreakerTest; import org.junit.Assert;
import com.netflix.hystrix.*; import org.junit.*;
[ "com.netflix.hystrix", "org.junit" ]
com.netflix.hystrix; org.junit;
2,004,376
private Query readTextQuery(BinaryRawReader reader) { boolean loc = reader.readBoolean(); String txt = reader.readString(); String typ = reader.readString(); final int pageSize = reader.readInt(); //TODO: IGNITE-12266, uncomment when limit parameter is added to Platforms // // final int limit = reader.readInt(); // return new TextQuery(typ, txt, limit).setPageSize(pageSize).setLocal(loc); return new TextQuery(typ, txt).setPageSize(pageSize).setLocal(loc); }
Query function(BinaryRawReader reader) { boolean loc = reader.readBoolean(); String txt = reader.readString(); String typ = reader.readString(); final int pageSize = reader.readInt(); return new TextQuery(typ, txt).setPageSize(pageSize).setLocal(loc); }
/** * Reads text query. * * @param reader Binary reader. * @return Query. */
Reads text query
readTextQuery
{ "repo_name": "samaitra/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java", "license": "apache-2.0", "size": 57640 }
[ "org.apache.ignite.binary.BinaryRawReader", "org.apache.ignite.cache.query.Query", "org.apache.ignite.cache.query.TextQuery" ]
import org.apache.ignite.binary.BinaryRawReader; import org.apache.ignite.cache.query.Query; import org.apache.ignite.cache.query.TextQuery;
import org.apache.ignite.binary.*; import org.apache.ignite.cache.query.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,853,328
// ! Recorded module traces. public List<Trace> getTraces() { if (!isLoaded()) { throw new IllegalStateException("Error: The module is not loaded"); } return new ArrayList<Trace>(m_traces); }
List<Trace> function() { if (!isLoaded()) { throw new IllegalStateException(STR); } return new ArrayList<Trace>(m_traces); }
/** * Returns all debug traces recorded for this module. * * @return A list of debug traces. */
Returns all debug traces recorded for this module
getTraces
{ "repo_name": "AmesianX/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/API/disassembly/Module.java", "license": "apache-2.0", "size": 29580 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,172,096
@Override public String getText(Object object) { String label = ((FastXSLTMediator)object).getDescription(); return label == null || label.length() == 0 ? getString("_UI_FastXSLTMediator_type") : getString("_UI_FastXSLTMediator_type") + " " + label; }
String function(Object object) { String label = ((FastXSLTMediator)object).getDescription(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; }
/** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This returns the label text for the adapted class.
getText
{ "repo_name": "prabushi/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/FastXSLTMediatorItemProvider.java", "license": "apache-2.0", "size": 12835 }
[ "org.wso2.developerstudio.eclipse.gmf.esb.FastXSLTMediator" ]
import org.wso2.developerstudio.eclipse.gmf.esb.FastXSLTMediator;
import org.wso2.developerstudio.eclipse.gmf.esb.*;
[ "org.wso2.developerstudio" ]
org.wso2.developerstudio;
2,532,804
public void debug(Object message) { getLogger().log(FQCN, Priority.DEBUG, message, null ); }
void function(Object message) { getLogger().log(FQCN, Priority.DEBUG, message, null ); }
/** * Logs a message with <code>org.apache.log4j.Priority.DEBUG</code>. * * @param message to log * @see org.apache.juli.logging.Log#debug(Object) */
Logs a message with <code>org.apache.log4j.Priority.DEBUG</code>
debug
{ "repo_name": "yuyupapa/OpenSource", "path": "apache-tomcat-6.0.48/output/extras/logging/commons-logging-1.1.1-src/src/java/org/apache/juli/logging/impl/Log4JLogger.java", "license": "apache-2.0", "size": 11293 }
[ "org.apache.log4j.Priority" ]
import org.apache.log4j.Priority;
import org.apache.log4j.*;
[ "org.apache.log4j" ]
org.apache.log4j;
289,029
@Test(expected = IOException.class) public void testTableRecordReaderScannerFailMapreduceTwice() throws IOException, InterruptedException { Table htable = createIOEScannerTable(Bytes.toBytes("table3-mr"), 2); runTestMapreduce(htable); }
@Test(expected = IOException.class) void function() throws IOException, InterruptedException { Table htable = createIOEScannerTable(Bytes.toBytes(STR), 2); runTestMapreduce(htable); }
/** * Run test assuming Scanner IOException failure using newer mapreduce api * * @throws IOException * @throws InterruptedException */
Run test assuming Scanner IOException failure using newer mapreduce api
testTableRecordReaderScannerFailMapreduceTwice
{ "repo_name": "francisliu/hbase", "path": "hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormat.java", "license": "apache-2.0", "size": 18059 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.Table", "org.apache.hadoop.hbase.util.Bytes", "org.junit.Test" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Test;
import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
2,631,965
@Override public List<RMNode> arrangeNodesForScriptExecution(final List<RMNode> nodes, List<SelectionScript> scripts) { long startTime = System.currentTimeMillis(); boolean scriptSpecified = scripts != null && scripts.size() > 0; // if no scripts are specified return filtered free nodes if (!scriptSpecified) { return nodes; } try { // finding intersection HashMap<RMNode, Probability> intersectionMap = new HashMap<RMNode, Probability>(); for (RMNode rmnode : nodes) { boolean intersection = true; double intersectionProbability = 1; for (SelectionScript script : scripts) { String digest = new String(script.digest()); if (probabilities.containsKey(digest) && probabilities.get(digest).containsKey(rmnode)) { double probability = probabilities.get(digest).get(rmnode).value(); if (probability == 0) { intersection = false; break; } else { intersectionProbability *= probability; } } else { intersectionProbability *= Probability.defaultValue(); } } if (intersection) { intersectionMap.put(rmnode, new Probability(intersectionProbability)); } } // sorting results based on calculated probability List<RMNode> res = new ArrayList<RMNode>(); res.addAll(intersectionMap.keySet()); Collections.sort(res, new NodeProbabilityComparator(intersectionMap)); if (logger.isDebugEnabled()) { logger.debug("The following nodes are selected for scripts execution (time is " + (System.currentTimeMillis() - startTime) + " ms) :"); if (res.size() > 0) { for (RMNode rmnode : res) { logger.debug(rmnode.getNodeURL() + " : probability " + intersectionMap.get(rmnode)); } } else { logger.debug("None"); } } return res; } catch (NoSuchAlgorithmException e) { logger.error(e.getMessage(), e); return new ArrayList<RMNode>(); } }
List<RMNode> function(final List<RMNode> nodes, List<SelectionScript> scripts) { long startTime = System.currentTimeMillis(); boolean scriptSpecified = scripts != null && scripts.size() > 0; if (!scriptSpecified) { return nodes; } try { HashMap<RMNode, Probability> intersectionMap = new HashMap<RMNode, Probability>(); for (RMNode rmnode : nodes) { boolean intersection = true; double intersectionProbability = 1; for (SelectionScript script : scripts) { String digest = new String(script.digest()); if (probabilities.containsKey(digest) && probabilities.get(digest).containsKey(rmnode)) { double probability = probabilities.get(digest).get(rmnode).value(); if (probability == 0) { intersection = false; break; } else { intersectionProbability *= probability; } } else { intersectionProbability *= Probability.defaultValue(); } } if (intersection) { intersectionMap.put(rmnode, new Probability(intersectionProbability)); } } List<RMNode> res = new ArrayList<RMNode>(); res.addAll(intersectionMap.keySet()); Collections.sort(res, new NodeProbabilityComparator(intersectionMap)); if (logger.isDebugEnabled()) { logger.debug(STR + (System.currentTimeMillis() - startTime) + STR); if (res.size() > 0) { for (RMNode rmnode : res) { logger.debug(rmnode.getNodeURL() + STR + intersectionMap.get(rmnode)); } } else { logger.debug("None"); } } return res; } catch (NoSuchAlgorithmException e) { logger.error(e.getMessage(), e); return new ArrayList<RMNode>(); } }
/** * Find appropriate candidates nodes for script execution, taking into * account "free" and "exclusion" nodes lists. * * @param selectionScriptList - set of scripts to execute * @param freeNodes - free nodes list provided by resource manager * @param exclusionNodes - exclusion nodes list * @return candidates node list for script execution */
Find appropriate candidates nodes for script execution, taking into account "free" and "exclusion" nodes lists
arrangeNodesForScriptExecution
{ "repo_name": "acontes/scheduling", "path": "src/resource-manager/src/org/ow2/proactive/resourcemanager/selection/statistics/ProbablisticSelectionManager.java", "license": "agpl-3.0", "size": 11200 }
[ "java.security.NoSuchAlgorithmException", "java.util.ArrayList", "java.util.Collections", "java.util.HashMap", "java.util.List", "org.ow2.proactive.resourcemanager.rmnode.RMNode", "org.ow2.proactive.scripting.SelectionScript" ]
import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import org.ow2.proactive.resourcemanager.rmnode.RMNode; import org.ow2.proactive.scripting.SelectionScript;
import java.security.*; import java.util.*; import org.ow2.proactive.resourcemanager.rmnode.*; import org.ow2.proactive.scripting.*;
[ "java.security", "java.util", "org.ow2.proactive" ]
java.security; java.util; org.ow2.proactive;
2,807,840
public Column getOtherConfigColumn() { ColumnDescription columndesc = new ColumnDescription( BridgeColumn.OTHERCONFIG .columnName(), "getOtherConfigColumn", VersionNum.VERSION100); return (Column) super.getColumnHandler(columndesc); }
Column function() { ColumnDescription columndesc = new ColumnDescription( BridgeColumn.OTHERCONFIG .columnName(), STR, VersionNum.VERSION100); return (Column) super.getColumnHandler(columndesc); }
/** * Get the Column entity which column name is "other_config" from the Row * entity of attributes. * @return the Column entity which column name is "other_config" */
Get the Column entity which column name is "other_config" from the Row entity of attributes
getOtherConfigColumn
{ "repo_name": "sdnwiselab/onos", "path": "protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java", "license": "apache-2.0", "size": 26432 }
[ "org.onosproject.ovsdb.rfc.notation.Column", "org.onosproject.ovsdb.rfc.tableservice.ColumnDescription" ]
import org.onosproject.ovsdb.rfc.notation.Column; import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
import org.onosproject.ovsdb.rfc.notation.*; import org.onosproject.ovsdb.rfc.tableservice.*;
[ "org.onosproject.ovsdb" ]
org.onosproject.ovsdb;
2,541,935
@Test public void articleSanitizerIframeYoutubeTest() throws Exception { // Load a feed InputStream is = getClass().getResourceAsStream("/feed/feed_rss2_korben.xml"); RssReader reader = new RssReader(); reader.readRssFeed(is); Feed feed = reader.getFeed(); Assert.assertEquals("http://korben.info", feed.getUrl()); List<Article> articleList = reader.getArticleList(); Assert.assertEquals(30, articleList.size()); Article article = articleList.get(20); // Allow iframes to Youtube ArticleSanitizer articleSanitizer = new ArticleSanitizer(); String html = articleSanitizer.sanitize(feed.getUrl(), article.getDescription()); Assert.assertTrue(html.contains("Y&#39;a pas que XBMC dans la vie")); Assert.assertTrue(html.contains("<iframe src=\"//www.youtube.com/embed/n2d4c8JIT0E?feature&#61;player_embedded\" height=\"360\" width=\"640\">")); // Allow iframes to Youtube HTTPS article = articleList.get(0); articleSanitizer = new ArticleSanitizer(); html = articleSanitizer.sanitize(feed.getUrl(), article.getDescription()); Assert.assertTrue(html.contains("La RetroN 5 sera équipée d&#39;une sortie HDMI")); Assert.assertTrue(html.contains("<iframe src=\"//www.youtube.com/embed/5OcNy7t17LA?feature&#61;player_embedded\" height=\"360\" width=\"640\">")); // Allow iframes to Youtube without protocol article = articleList.get(15); articleSanitizer = new ArticleSanitizer(); html = articleSanitizer.sanitize(feed.getUrl(), article.getDescription()); Assert.assertTrue(html.contains("Si quand vous étiez petit")); Assert.assertTrue(html.contains("<iframe src=\"//www.youtube.com/embed/7vIi0U4rSX4?feature&#61;player_embedded\" height=\"360\" width=\"640\">")); }
void function() throws Exception { InputStream is = getClass().getResourceAsStream(STR); RssReader reader = new RssReader(); reader.readRssFeed(is); Feed feed = reader.getFeed(); Assert.assertEquals(STRY&#39;a pas que XBMC dans la vieSTR<iframe src=\STRLa RetroN 5 sera équipée d&#39;une sortie HDMISTR<iframe src=\STRSi quand vous étiez petitSTR<iframe src=\" }
/** * Tests the article sanitizer. * * @throws Exception */
Tests the article sanitizer
articleSanitizerIframeYoutubeTest
{ "repo_name": "Feitianyuan/reader", "path": "reader-core/src/test/java/com/sismics/util/TestArticleSanitizer.java", "license": "gpl-2.0", "size": 17543 }
[ "com.sismics.reader.core.dao.file.rss.RssReader", "com.sismics.reader.core.model.jpa.Feed", "java.io.InputStream", "junit.framework.Assert" ]
import com.sismics.reader.core.dao.file.rss.RssReader; import com.sismics.reader.core.model.jpa.Feed; import java.io.InputStream; import junit.framework.Assert;
import com.sismics.reader.core.dao.file.rss.*; import com.sismics.reader.core.model.jpa.*; import java.io.*; import junit.framework.*;
[ "com.sismics.reader", "java.io", "junit.framework" ]
com.sismics.reader; java.io; junit.framework;
534,032
@Override public void enterSpecFun(@NotNull ErlangParser.SpecFunContext ctx) { }
@Override public void enterSpecFun(@NotNull ErlangParser.SpecFunContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitFunction
{ "repo_name": "lyskouski/erlang-netbeans", "path": "src/by/creativity/erlang/lexer/ErlangBaseListener.java", "license": "gpl-2.0", "size": 35296 }
[ "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;
2,291,970
protected ProcessorExchangePair createProcessorExchangePair(int index, Endpoint endpoint, Producer producer, Exchange exchange, ExchangePattern pattern) { Processor prepared = producer; // copy exchange, and do not share the unit of work Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false); // if we share unit of work, we need to prepare the child exchange if (isShareUnitOfWork()) { prepareSharedUnitOfWork(copy, exchange); } // set property which endpoint we send to setToEndpoint(copy, prepared); // rework error handling to support fine grained error handling RouteContext routeContext = exchange.getUnitOfWork() != null ? exchange.getUnitOfWork().getRouteContext() : null; prepared = createErrorHandler(routeContext, copy, prepared); // invoke on prepare on the exchange if specified if (onPrepare != null) { try { onPrepare.process(copy); } catch (Exception e) { copy.setException(e); } } // and create the pair return new RecipientProcessorExchangePair(index, producerCache, endpoint, producer, prepared, copy, pattern); }
ProcessorExchangePair function(int index, Endpoint endpoint, Producer producer, Exchange exchange, ExchangePattern pattern) { Processor prepared = producer; Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false); if (isShareUnitOfWork()) { prepareSharedUnitOfWork(copy, exchange); } setToEndpoint(copy, prepared); RouteContext routeContext = exchange.getUnitOfWork() != null ? exchange.getUnitOfWork().getRouteContext() : null; prepared = createErrorHandler(routeContext, copy, prepared); if (onPrepare != null) { try { onPrepare.process(copy); } catch (Exception e) { copy.setException(e); } } return new RecipientProcessorExchangePair(index, producerCache, endpoint, producer, prepared, copy, pattern); }
/** * This logic is similar to MulticastProcessor but we have to return a RecipientProcessorExchangePair instead */
This logic is similar to MulticastProcessor but we have to return a RecipientProcessorExchangePair instead
createProcessorExchangePair
{ "repo_name": "CodeSmell/camel", "path": "core/camel-base/src/main/java/org/apache/camel/processor/RecipientListProcessor.java", "license": "apache-2.0", "size": 11837 }
[ "org.apache.camel.Endpoint", "org.apache.camel.Exchange", "org.apache.camel.ExchangePattern", "org.apache.camel.Processor", "org.apache.camel.Producer", "org.apache.camel.spi.RouteContext", "org.apache.camel.support.ExchangeHelper" ]
import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.spi.RouteContext; import org.apache.camel.support.ExchangeHelper;
import org.apache.camel.*; import org.apache.camel.spi.*; import org.apache.camel.support.*;
[ "org.apache.camel" ]
org.apache.camel;
638,982
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { String resolvedId = null; try { // The namespace is useful for resolving namespace aware // grammars such as XML schema. Let it take precedence over // the external identifier if one exists. if (namespaceURI != null) { resolvedId = resolveURI(namespaceURI); } if (!getUseLiteralSystemId() && baseURI != null) { // Attempt to resolve the system identifier against the base URI. try { URI uri = new URI(new URI(baseURI), systemId); systemId = uri.toString(); } // Ignore the exception. Fallback to the literal system identifier. catch (URI.MalformedURIException ex) {} } // Resolve against an external identifier if one exists. This // is useful for resolving DTD external subsets and other // external entities. For XML schemas if there was no namespace // mapping we might be able to resolve a system identifier // specified as a location hint. if (resolvedId == null) { if (publicId != null && systemId != null) { resolvedId = resolvePublic(publicId, systemId); } else if (systemId != null) { resolvedId = resolveSystem(systemId); } } } // Ignore IOException. It cannot be thrown from this method. catch (IOException ex) {} if (resolvedId != null) { return new DOMInputImpl(publicId, resolvedId, baseURI); } return null; }
LSInput function(String type, String namespaceURI, String publicId, String systemId, String baseURI) { String resolvedId = null; try { if (namespaceURI != null) { resolvedId = resolveURI(namespaceURI); } if (!getUseLiteralSystemId() && baseURI != null) { try { URI uri = new URI(new URI(baseURI), systemId); systemId = uri.toString(); } catch (URI.MalformedURIException ex) {} } if (resolvedId == null) { if (publicId != null && systemId != null) { resolvedId = resolvePublic(publicId, systemId); } else if (systemId != null) { resolvedId = resolveSystem(systemId); } } } catch (IOException ex) {} if (resolvedId != null) { return new DOMInputImpl(publicId, resolvedId, baseURI); } return null; }
/** * <p>Resolves a resource using the catalog. This method interprets that * the namespace URI corresponds to uri entries in the catalog. * Where both a namespace and an external identifier exist, the namespace * takes precedence.</p> * * @param type the type of the resource being resolved * @param namespaceURI the namespace of the resource being resolved, * or <code>null</code> if none was supplied * @param publicId the public identifier of the resource being resolved, * or <code>null</code> if none was supplied * @param systemId the system identifier of the resource being resolved, * or <code>null</code> if none was supplied * @param baseURI the absolute base URI of the resource being parsed, * or <code>null</code> if there is no base URI */
Resolves a resource using the catalog. This method interprets that the namespace URI corresponds to uri entries in the catalog. Where both a namespace and an external identifier exist, the namespace takes precedence
resolveResource
{ "repo_name": "JetBrains/jdk8u_jaxp", "path": "src/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java", "license": "gpl-2.0", "size": 22323 }
[ "com.sun.org.apache.xerces.internal.dom.DOMInputImpl", "java.io.IOException", "org.w3c.dom.ls.LSInput" ]
import com.sun.org.apache.xerces.internal.dom.DOMInputImpl; import java.io.IOException; import org.w3c.dom.ls.LSInput;
import com.sun.org.apache.xerces.internal.dom.*; import java.io.*; import org.w3c.dom.ls.*;
[ "com.sun.org", "java.io", "org.w3c.dom" ]
com.sun.org; java.io; org.w3c.dom;
920,800
public static Object getProxyInstance(Bundle client, Class<?> superclass, Collection<Class<?>> ifaces, Callable<Object> dispatcher, InvocationListener listener) throws UnableToProxyException{ if(superclass != null && (superclass.getModifiers() & Modifier.FINAL) != 0) throw new FinalModifierException(superclass); ProxyClassLoader pcl = null; SortedSet<Class<?>> interfaces = createSet(ifaces); synchronized (cache) { BundleWiring wiring = client == null ? null : (BundleWiring)client.adapt(BundleWiring.class); WeakReference<ProxyClassLoader> ref = cache.get(wiring); if(ref != null) pcl = ref.get(); if (pcl != null && pcl.isInvalid(interfaces)) { pcl = null; cache.remove(wiring); } if(pcl == null) { pcl = new ProxyClassLoader(client); cache.put(wiring, new WeakReference<ProxyClassLoader>(pcl)); } } Class<?> c = pcl.createProxyClass(superclass, interfaces); try { Constructor<?> con = c.getDeclaredConstructor(Callable.class, InvocationListener.class); con.setAccessible(true); return con.newInstance(dispatcher, listener); } catch (Exception e) { throw new UnableToProxyException(ifaces.iterator().next(), e); } }
static Object function(Bundle client, Class<?> superclass, Collection<Class<?>> ifaces, Callable<Object> dispatcher, InvocationListener listener) throws UnableToProxyException{ if(superclass != null && (superclass.getModifiers() & Modifier.FINAL) != 0) throw new FinalModifierException(superclass); ProxyClassLoader pcl = null; SortedSet<Class<?>> interfaces = createSet(ifaces); synchronized (cache) { BundleWiring wiring = client == null ? null : (BundleWiring)client.adapt(BundleWiring.class); WeakReference<ProxyClassLoader> ref = cache.get(wiring); if(ref != null) pcl = ref.get(); if (pcl != null && pcl.isInvalid(interfaces)) { pcl = null; cache.remove(wiring); } if(pcl == null) { pcl = new ProxyClassLoader(client); cache.put(wiring, new WeakReference<ProxyClassLoader>(pcl)); } } Class<?> c = pcl.createProxyClass(superclass, interfaces); try { Constructor<?> con = c.getDeclaredConstructor(Callable.class, InvocationListener.class); con.setAccessible(true); return con.newInstance(dispatcher, listener); } catch (Exception e) { throw new UnableToProxyException(ifaces.iterator().next(), e); } }
/** * Generate a new proxy instance implementing the supplied interfaces and using the supplied * dispatcher and listener * @param client the bundle that is trying to generate this proxy (can be null) * @param superclass The superclass to use (or null for Object) * @param ifaces The set of interfaces to implement (may be empty if superclass is non null) * @param dispatcher * @param listener * @return * @throws UnableToProxyException */
Generate a new proxy instance implementing the supplied interfaces and using the supplied dispatcher and listener
getProxyInstance
{ "repo_name": "alien11689/aries", "path": "proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java", "license": "apache-2.0", "size": 5567 }
[ "java.lang.ref.WeakReference", "java.lang.reflect.Constructor", "java.lang.reflect.Modifier", "java.util.Collection", "java.util.SortedSet", "java.util.concurrent.Callable", "org.apache.aries.proxy.FinalModifierException", "org.apache.aries.proxy.InvocationListener", "org.apache.aries.proxy.UnableToProxyException", "org.osgi.framework.Bundle", "org.osgi.framework.wiring.BundleWiring" ]
import java.lang.ref.WeakReference; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; import java.util.Collection; import java.util.SortedSet; import java.util.concurrent.Callable; import org.apache.aries.proxy.FinalModifierException; import org.apache.aries.proxy.InvocationListener; import org.apache.aries.proxy.UnableToProxyException; import org.osgi.framework.Bundle; import org.osgi.framework.wiring.BundleWiring;
import java.lang.ref.*; import java.lang.reflect.*; import java.util.*; import java.util.concurrent.*; import org.apache.aries.proxy.*; import org.osgi.framework.*; import org.osgi.framework.wiring.*;
[ "java.lang", "java.util", "org.apache.aries", "org.osgi.framework" ]
java.lang; java.util; org.apache.aries; org.osgi.framework;
1,612,530
public Adapter createParticipantAdapter() { return null; }
Adapter function() { return null; }
/** * Creates a new adapter for an object of class '{@link iso20022.Participant <em>Participant</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see iso20022.Participant * @generated */
Creates a new adapter for an object of class '<code>iso20022.Participant Participant</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway.
createParticipantAdapter
{ "repo_name": "ISO20022ArchitectForum/sample-code-public", "path": "DLT/Corda/ISO20022Generated/src/iso20022/util/Iso20022AdapterFactory.java", "license": "apache-2.0", "size": 55827 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
781,714
public JobStepInner withOutput(JobStepOutput output) { this.output = output; return this; }
JobStepInner function(JobStepOutput output) { this.output = output; return this; }
/** * Set the output property: Output destination properties of the job step. * * @param output the output value to set. * @return the JobStepInner object itself. */
Set the output property: Output destination properties of the job step
withOutput
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/fluent/models/JobStepInner.java", "license": "mit", "size": 6120 }
[ "com.azure.resourcemanager.sql.models.JobStepOutput" ]
import com.azure.resourcemanager.sql.models.JobStepOutput;
import com.azure.resourcemanager.sql.models.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
936,340
@Deprecated public String getCaseDatabasePath() throws UnsupportedOperationException { if (Case.CaseType.SINGLE_USER_CASE == caseType) { return Paths.get(getCaseDirectory(), caseDatabaseName).toString(); } else { throw new UnsupportedOperationException(); } }
String function() throws UnsupportedOperationException { if (Case.CaseType.SINGLE_USER_CASE == caseType) { return Paths.get(getCaseDirectory(), caseDatabaseName).toString(); } else { throw new UnsupportedOperationException(); } }
/** * Gets the full path to the case database file if the case is a single-user * case. * * @return The full path to the case database file for a single-user case. * * @throws UnsupportedOperationException If called for a multi-user case. * @deprecated Do not use. */
Gets the full path to the case database file if the case is a single-user case
getCaseDatabasePath
{ "repo_name": "narfindustries/autopsy", "path": "Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java", "license": "apache-2.0", "size": 21816 }
[ "java.nio.file.Paths" ]
import java.nio.file.Paths;
import java.nio.file.*;
[ "java.nio" ]
java.nio;
2,099,600
public static List<String> getRepositoryMembers(RepositoryModel repository, String serverUrl, String account, char[] password) throws IOException { String url = asLink(serverUrl, RpcRequest.LIST_REPOSITORY_MEMBERS, repository.name); Collection<String> list = JsonUtils.retrieveJson(url, NAMES_TYPE, account, password); return new ArrayList<String>(list); }
static List<String> function(RepositoryModel repository, String serverUrl, String account, char[] password) throws IOException { String url = asLink(serverUrl, RpcRequest.LIST_REPOSITORY_MEMBERS, repository.name); Collection<String> list = JsonUtils.retrieveJson(url, NAMES_TYPE, account, password); return new ArrayList<String>(list); }
/** * Retrieves the list of users that can access the specified repository. * * @param repository * @param serverUrl * @param account * @param password * @return list of members * @throws IOException */
Retrieves the list of users that can access the specified repository
getRepositoryMembers
{ "repo_name": "gitblit/gitblit", "path": "src/main/java/com/gitblit/utils/RpcUtils.java", "license": "apache-2.0", "size": 22645 }
[ "com.gitblit.Constants", "com.gitblit.models.RepositoryModel", "java.io.IOException", "java.util.ArrayList", "java.util.Collection", "java.util.List" ]
import com.gitblit.Constants; import com.gitblit.models.RepositoryModel; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List;
import com.gitblit.*; import com.gitblit.models.*; import java.io.*; import java.util.*;
[ "com.gitblit", "com.gitblit.models", "java.io", "java.util" ]
com.gitblit; com.gitblit.models; java.io; java.util;
1,064,946
@SuppressWarnings("rawtypes") public static <I extends WritableComparable, M extends Writable, P extends Writable> MessageCombiner<I, M, P> createMessageCombiner( Configuration conf) { Class<? extends MessageCombiner<I, M, P>> vertexCombinerClass = getMessageCombinerClass(conf); try { return vertexCombinerClass.newInstance(); } catch (Exception e) { throw new IllegalStateException(e); } }
@SuppressWarnings(STR) static <I extends WritableComparable, M extends Writable, P extends Writable> MessageCombiner<I, M, P> function( Configuration conf) { Class<? extends MessageCombiner<I, M, P>> vertexCombinerClass = getMessageCombinerClass(conf); try { return vertexCombinerClass.newInstance(); } catch (Exception e) { throw new IllegalStateException(e); } }
/** * Create a user vertex combiner class * * @param conf * Configuration to check * @return Instantiated user vertex combiner class */
Create a user vertex combiner class
createMessageCombiner
{ "repo_name": "sigmod/asterixdb-analytics", "path": "pregelix/pregelix-api/src/main/java/edu/uci/ics/pregelix/api/util/BspUtils.java", "license": "apache-2.0", "size": 39926 }
[ "edu.uci.ics.pregelix.api.graph.MessageCombiner", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.io.Writable", "org.apache.hadoop.io.WritableComparable" ]
import edu.uci.ics.pregelix.api.graph.MessageCombiner; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableComparable;
import edu.uci.ics.pregelix.api.graph.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*;
[ "edu.uci.ics", "org.apache.hadoop" ]
edu.uci.ics; org.apache.hadoop;
1,979,072
protected final int doReadBytes(ByteBuf byteBuf) throws Exception { int writerIndex = byteBuf.writerIndex(); int localReadAmount; unsafe().recvBufAllocHandle().attemptedBytesRead(byteBuf.writableBytes()); if (byteBuf.hasMemoryAddress()) { localReadAmount = socket.readAddress(byteBuf.memoryAddress(), writerIndex, byteBuf.capacity()); } else { ByteBuffer buf = byteBuf.internalNioBuffer(writerIndex, byteBuf.writableBytes()); localReadAmount = socket.read(buf, buf.position(), buf.limit()); } if (localReadAmount > 0) { byteBuf.writerIndex(writerIndex + localReadAmount); } return localReadAmount; }
final int function(ByteBuf byteBuf) throws Exception { int writerIndex = byteBuf.writerIndex(); int localReadAmount; unsafe().recvBufAllocHandle().attemptedBytesRead(byteBuf.writableBytes()); if (byteBuf.hasMemoryAddress()) { localReadAmount = socket.readAddress(byteBuf.memoryAddress(), writerIndex, byteBuf.capacity()); } else { ByteBuffer buf = byteBuf.internalNioBuffer(writerIndex, byteBuf.writableBytes()); localReadAmount = socket.read(buf, buf.position(), buf.limit()); } if (localReadAmount > 0) { byteBuf.writerIndex(writerIndex + localReadAmount); } return localReadAmount; }
/** * Read bytes into the given {@link ByteBuf} and return the amount. */
Read bytes into the given <code>ByteBuf</code> and return the amount
doReadBytes
{ "repo_name": "mcobrien/netty", "path": "transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueChannel.java", "license": "apache-2.0", "size": 19100 }
[ "io.netty.buffer.ByteBuf", "java.nio.ByteBuffer" ]
import io.netty.buffer.ByteBuf; import java.nio.ByteBuffer;
import io.netty.buffer.*; import java.nio.*;
[ "io.netty.buffer", "java.nio" ]
io.netty.buffer; java.nio;
906,438
@Override protected void cleanup( TestParameters tParam, PrintWriter log ) { log.println( " disposing xDrawDoc " ); util.DesktopTools.closeDoc(xDrawDoc); }
void function( TestParameters tParam, PrintWriter log ) { log.println( STR ); util.DesktopTools.closeDoc(xDrawDoc); }
/** * in general this method disposes the testenvironment and document * * @param tParam class which contains additional test parameters * @param log class to log the test state and result * * * @see TestParameters * @see PrintWriter * */
in general this method disposes the testenvironment and document
cleanup
{ "repo_name": "sbbic/core", "path": "qadevOOo/tests/java/mod/_svx/SvxShapeControl.java", "license": "gpl-3.0", "size": 4629 }
[ "java.io.PrintWriter" ]
import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
2,587,951
@GET @Path("/offers/*") @TypeHint(Offer[].class) public Response getAllOffers(@QueryParam("apiKey") @ValidApiKey String apiKey) { List<Offer> offers = marketPlDao.getAllOffers(apiKey); for (Offer offer : offers) { LOGGER.debug("| Offer:" + offer.getId()); } return ResponseSurrogate.of(offers); }
@Path(STR) @TypeHint(Offer[].class) Response function(@QueryParam(STR) @ValidApiKey String apiKey) { List<Offer> offers = marketPlDao.getAllOffers(apiKey); for (Offer offer : offers) { LOGGER.debug(STR + offer.getId()); } return ResponseSurrogate.of(offers); }
/** * Gets all offers of an organisation (independent of the marketplace). If the API key is not valid * an analogous message is returned. It is also checked, if the id is a positive number otherwise a message * for an invalid number is returned. * * @param apiKey * The valid query parameter API key affiliated to one specific organisation, * to which the offers belongs to. * @return A Response as List of Offers in JSON. */
Gets all offers of an organisation (independent of the marketplace). If the API key is not valid an analogous message is returned. It is also checked, if the id is a positive number otherwise a message for an invalid number is returned
getAllOffers
{ "repo_name": "InteractiveSystemsGroup/GamificationEngine-Kinben", "path": "src/main/java/info/interactivesystems/gamificationengine/api/MarketPlaceApi.java", "license": "lgpl-3.0", "size": 39617 }
[ "com.webcohesion.enunciate.metadata.rs.TypeHint", "info.interactivesystems.gamificationengine.api.validation.ValidApiKey", "info.interactivesystems.gamificationengine.entities.marketPlace.Offer", "java.util.List", "javax.ws.rs.Path", "javax.ws.rs.QueryParam", "javax.ws.rs.core.Response" ]
import com.webcohesion.enunciate.metadata.rs.TypeHint; import info.interactivesystems.gamificationengine.api.validation.ValidApiKey; import info.interactivesystems.gamificationengine.entities.marketPlace.Offer; import java.util.List; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response;
import com.webcohesion.enunciate.metadata.rs.*; import info.interactivesystems.gamificationengine.api.validation.*; import info.interactivesystems.gamificationengine.entities.*; import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "com.webcohesion.enunciate", "info.interactivesystems.gamificationengine", "java.util", "javax.ws" ]
com.webcohesion.enunciate; info.interactivesystems.gamificationengine; java.util; javax.ws;
1,994,801
public ImageIcon getButtonIcon() { // return new ImageIcon(ProjectMap.class.getClassLoader().getResource("images/mapas.png")); return PluginServices.getIconTheme().get("document-map-icon"); }
ImageIcon function() { return PluginServices.getIconTheme().get(STR); }
/** * Returns image of button. * * @return Image button. */
Returns image of button
getButtonIcon
{ "repo_name": "iCarto/siga", "path": "appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/ProjectMapFactory.java", "license": "gpl-3.0", "size": 17605 }
[ "com.iver.andami.PluginServices", "javax.swing.ImageIcon" ]
import com.iver.andami.PluginServices; import javax.swing.ImageIcon;
import com.iver.andami.*; import javax.swing.*;
[ "com.iver.andami", "javax.swing" ]
com.iver.andami; javax.swing;
1,955,978
public void putValuesAsync(Map<String,Object> defValues){ for (String key: defValues.keySet()){ putValueAsyncFor(key, defValues.get(key)); } }
void function(Map<String,Object> defValues){ for (String key: defValues.keySet()){ putValueAsyncFor(key, defValues.get(key)); } }
/** * async method * @param defValues */
async method
putValuesAsync
{ "repo_name": "michele-paparella/Thunder", "path": "thunder/src/main/java/com/thunder/prefs/SharedPrefsManager.java", "license": "apache-2.0", "size": 8591 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,002,105
public void parseBEASTBlock(BeastGenerator options) throws ImportException, IOException { readBEASTBlock(options); }
void function(BeastGenerator options) throws ImportException, IOException { readBEASTBlock(options); }
/** * Parses a 'BEAST' block. */
Parses a 'BEAST' block
parseBEASTBlock
{ "repo_name": "codeaudit/beast-mcmc", "path": "src/dr/app/oldbeauti/NexusApplicationImporter.java", "license": "lgpl-2.1", "size": 12967 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
624,140
protected void flushEntityCache() { List<CachedDbEntity> cachedEntities = dbEntityCache.getCachedEntities(); for (CachedDbEntity cachedDbEntity : cachedEntities) { flushCachedEntity(cachedDbEntity); } // log cache state after flush LOG.flushedCacheState(dbEntityCache.getCachedEntities()); }
void function() { List<CachedDbEntity> cachedEntities = dbEntityCache.getCachedEntities(); for (CachedDbEntity cachedDbEntity : cachedEntities) { flushCachedEntity(cachedDbEntity); } LOG.flushedCacheState(dbEntityCache.getCachedEntities()); }
/** * Flushes the entity cache: * Depending on the entity state, the required {@link DbOperation} is performed and the cache is updated. */
Flushes the entity cache: Depending on the entity state, the required <code>DbOperation</code> is performed and the cache is updated
flushEntityCache
{ "repo_name": "bentrm/camunda-bpm-platform", "path": "engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java", "license": "apache-2.0", "size": 20376 }
[ "java.util.List", "org.camunda.bpm.engine.impl.db.entitymanager.cache.CachedDbEntity" ]
import java.util.List; import org.camunda.bpm.engine.impl.db.entitymanager.cache.CachedDbEntity;
import java.util.*; import org.camunda.bpm.engine.impl.db.entitymanager.cache.*;
[ "java.util", "org.camunda.bpm" ]
java.util; org.camunda.bpm;
2,630,319
public Report convertToHTML(File output) { return this.convertASCIIDOC(null, output, ERConstants.BACKEND_HTML); }
Report function(File output) { return this.convertASCIIDOC(null, output, ERConstants.BACKEND_HTML); }
/** * Converts the asciidoc to HTML. All asciidoctor messages will be provided in the * AsciidoctorConversionReport. The process runs recursively if If the folder contains * further ER folders. The process checks for er.adoc files. If these are missing, the * resulting Report contains appropriate messages. * @param output */
Converts the asciidoc to HTML. All asciidoctor messages will be provided in the AsciidoctorConversionReport. The process runs recursively if If the folder contains further ER folders. The process checks for er.adoc files. If these are missing, the resulting Report contains appropriate messages
convertToHTML
{ "repo_name": "ingosimonis/ERConverter", "path": "src/main/java/org/ogc/er/EngineeringReportFolder.java", "license": "gpl-3.0", "size": 13168 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,829,481
public MIDITrack map(NoteModifier mod, double after) { for (MIDINote n : this) { if (n.getStartBeat() >= after) { mod.modify(n); } } this.changes.firePropertyChange(MODIFIED, null, this); return this; }
MIDITrack function(NoteModifier mod, double after) { for (MIDINote n : this) { if (n.getStartBeat() >= after) { mod.modify(n); } } this.changes.firePropertyChange(MODIFIED, null, this); return this; }
/** * {@code map} calls the {@code NoteModifier}'s map only if the note's start * beat is after the specified value. * * @param mod * a <code>NoteModifier</code> implementation. * @param after * a <code>double</code> value. Modify notes only after this * start beat. * * @see com.rockhoppertech.music.midi.js.MIDITrack#map(NoteModifier) * @return this to cascade calls */
map calls the NoteModifier's map only if the note's start beat is after the specified value
map
{ "repo_name": "genedelisa/rockymusic", "path": "rockymusic-core/src/main/java/com/rockhoppertech/music/midi/js/MIDITrack.java", "license": "apache-2.0", "size": 74678 }
[ "com.rockhoppertech.music.modifiers.NoteModifier" ]
import com.rockhoppertech.music.modifiers.NoteModifier;
import com.rockhoppertech.music.modifiers.*;
[ "com.rockhoppertech.music" ]
com.rockhoppertech.music;
1,904,430
@Test public void testStopGatewaySender_Group() throws Exception { Integer locator1Port = locatorSite1.getPort(); // setup servers in Site #1 (London) server1 = startServerWithGroups(3, "SenderGroup1", locator1Port); server2 = startServerWithGroups(4, "SenderGroup1", locator1Port); server3 = startServerWithGroups(5, "SenderGroup1", locator1Port); server1.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true)); server2.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true)); server3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true)); server1.invoke(() -> startSender("ln")); server2.invoke(() -> startSender("ln")); server3.invoke(() -> startSender("ln")); server1.invoke(() -> verifySenderState("ln", true, false)); server2.invoke(() -> verifySenderState("ln", true, false)); server3.invoke(() -> verifySenderState("ln", true, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server1.getVM()), "ln", true, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server2.getVM()), "ln", true, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server3.getVM()), "ln", true, false)); String command = CliStrings.STOP_GATEWAYSENDER + " --" + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --" + CliStrings.GROUP + "=SenderGroup1"; CommandResult cmdResult = executeCommandWithIgnoredExceptions(command); assertThat(cmdResult).isNotNull(); assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK); TabularResultModel resultData = cmdResult.getResultData() .getTableSection(CliStrings.STOP_GATEWAYSENDER); List<String> status = resultData.getValuesInColumn("Result"); assertThat(status).containsExactlyInAnyOrder("OK", "OK", "OK"); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server1.getVM()), "ln", false, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server2.getVM()), "ln", false, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server3.getVM()), "ln", false, false)); server1.invoke(() -> verifySenderState("ln", false, false)); server2.invoke(() -> verifySenderState("ln", false, false)); server3.invoke(() -> verifySenderState("ln", false, false)); }
void function() throws Exception { Integer locator1Port = locatorSite1.getPort(); server1 = startServerWithGroups(3, STR, locator1Port); server2 = startServerWithGroups(4, STR, locator1Port); server3 = startServerWithGroups(5, STR, locator1Port); server1.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true)); server2.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true)); server3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true)); server1.invoke(() -> startSender("ln")); server2.invoke(() -> startSender("ln")); server3.invoke(() -> startSender("ln")); server1.invoke(() -> verifySenderState("ln", true, false)); server2.invoke(() -> verifySenderState("ln", true, false)); server3.invoke(() -> verifySenderState("ln", true, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server1.getVM()), "ln", true, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server2.getVM()), "ln", true, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server3.getVM()), "ln", true, false)); String command = CliStrings.STOP_GATEWAYSENDER + STR + CliStrings.STOP_GATEWAYSENDER__ID + STR + CliStrings.GROUP + STR; CommandResult cmdResult = executeCommandWithIgnoredExceptions(command); assertThat(cmdResult).isNotNull(); assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK); TabularResultModel resultData = cmdResult.getResultData() .getTableSection(CliStrings.STOP_GATEWAYSENDER); List<String> status = resultData.getValuesInColumn(STR); assertThat(status).containsExactlyInAnyOrder("OK", "OK", "OK"); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server1.getVM()), "ln", false, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server2.getVM()), "ln", false, false)); locatorSite1.invoke( () -> validateGatewaySenderMXBeanProxy(getMember(server3.getVM()), "ln", false, false)); server1.invoke(() -> verifySenderState("ln", false, false)); server2.invoke(() -> verifySenderState("ln", false, false)); server3.invoke(() -> verifySenderState("ln", false, false)); }
/** * test to validate that the start gateway sender starts the gateway sender on a group of members */
test to validate that the start gateway sender starts the gateway sender on a group of members
testStopGatewaySender_Group
{ "repo_name": "smgoller/geode", "path": "geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java", "license": "apache-2.0", "size": 15145 }
[ "java.util.List", "org.apache.geode.internal.cache.wan.wancommand.WANCommandUtils", "org.apache.geode.management.cli.Result", "org.apache.geode.management.internal.cli.result.CommandResult", "org.apache.geode.management.internal.cli.result.model.TabularResultModel", "org.apache.geode.management.internal.i18n.CliStrings", "org.assertj.core.api.Assertions" ]
import java.util.List; import org.apache.geode.internal.cache.wan.wancommand.WANCommandUtils; import org.apache.geode.management.cli.Result; import org.apache.geode.management.internal.cli.result.CommandResult; import org.apache.geode.management.internal.cli.result.model.TabularResultModel; import org.apache.geode.management.internal.i18n.CliStrings; import org.assertj.core.api.Assertions;
import java.util.*; import org.apache.geode.internal.cache.wan.wancommand.*; import org.apache.geode.management.cli.*; import org.apache.geode.management.internal.cli.result.*; import org.apache.geode.management.internal.cli.result.model.*; import org.apache.geode.management.internal.i18n.*; import org.assertj.core.api.*;
[ "java.util", "org.apache.geode", "org.assertj.core" ]
java.util; org.apache.geode; org.assertj.core;
892,360
default <T extends Page> T goToSafely(T page) { return getSeb().goToSafely(page); }
default <T extends Page> T goToSafely(T page) { return getSeb().goToSafely(page); }
/** * Safely go to already constructed page. Page is automatically verified * against its conditions. If verification fails null is returned. * * @param page * The page instance to go to * @return The same page instance or null if page is not verified */
Safely go to already constructed page. Page is automatically verified against its conditions. If verification fails null is returned
goToSafely
{ "repo_name": "etnetera/SeleniumBrowser", "path": "src/main/java/cz/etnetera/seb/SebContext.java", "license": "apache-2.0", "size": 27433 }
[ "cz.etnetera.seb.page.Page" ]
import cz.etnetera.seb.page.Page;
import cz.etnetera.seb.page.*;
[ "cz.etnetera.seb" ]
cz.etnetera.seb;
1,129,255
public void doSortbygrouptitle(RunData rundata, Context context) { setupSort(rundata, context, SORT_GROUPTITLE); } // doSortbygrouptitle
void function(RunData rundata, Context context) { setupSort(rundata, context, SORT_GROUPTITLE); }
/** * Do sort by group title */
Do sort by group title
doSortbygrouptitle
{ "repo_name": "ouit0408/sakai", "path": "announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/tool/AnnouncementAction.java", "license": "apache-2.0", "size": 173337 }
[ "org.sakaiproject.cheftool.Context", "org.sakaiproject.cheftool.RunData" ]
import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.RunData;
import org.sakaiproject.cheftool.*;
[ "org.sakaiproject.cheftool" ]
org.sakaiproject.cheftool;
1,241,896
public void register(DiagnosticsPlugin plugin) { checkNotNull(plugin, "plugin can't be null"); if (!enabled) { return; } long periodMillis = plugin.getPeriodMillis(); if (periodMillis < -1) { throw new IllegalArgumentException(plugin + " can't return a periodMillis smaller than -1"); } logger.finest(plugin.getClass().toString() + " is " + (periodMillis == DISABLED ? "disabled" : "enabled")); if (periodMillis == DISABLED) { return; } pluginsMap.put(plugin.getClass(), plugin); plugin.onStart(); if (periodMillis > 0) { // it is a periodic task scheduler.scheduleAtFixedRate(new WritePluginTask(plugin), 0, periodMillis, MILLISECONDS); } else { addStaticPlugin(plugin); } }
void function(DiagnosticsPlugin plugin) { checkNotNull(plugin, STR); if (!enabled) { return; } long periodMillis = plugin.getPeriodMillis(); if (periodMillis < -1) { throw new IllegalArgumentException(plugin + STR); } logger.finest(plugin.getClass().toString() + STR + (periodMillis == DISABLED ? STR : STR)); if (periodMillis == DISABLED) { return; } pluginsMap.put(plugin.getClass(), plugin); plugin.onStart(); if (periodMillis > 0) { scheduler.scheduleAtFixedRate(new WritePluginTask(plugin), 0, periodMillis, MILLISECONDS); } else { addStaticPlugin(plugin); } }
/** * Registers a {@link DiagnosticsPlugin}. * * This method is threadsafe. * * There is no checking for duplicate registration. * * If the {@link Diagnostics} is disabled, the call is ignored. * * @param plugin the plugin to register * @throws NullPointerException if plugin is null. */
Registers a <code>DiagnosticsPlugin</code>. This method is threadsafe. There is no checking for duplicate registration. If the <code>Diagnostics</code> is disabled, the call is ignored
register
{ "repo_name": "tombujok/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/internal/diagnostics/Diagnostics.java", "license": "apache-2.0", "size": 9378 }
[ "com.hazelcast.util.Preconditions" ]
import com.hazelcast.util.Preconditions;
import com.hazelcast.util.*;
[ "com.hazelcast.util" ]
com.hazelcast.util;
1,680,288
@NotNull() public final ResultCode getResultCode() { return resultCode; }
@NotNull() final ResultCode function() { return resultCode; }
/** * Retrieves the result code for this LDAP exception. * * @return The result code for this LDAP exception. */
Retrieves the result code for this LDAP exception
getResultCode
{ "repo_name": "UnboundID/ldapsdk", "path": "src/com/unboundid/ldap/sdk/LDAPException.java", "license": "gpl-2.0", "size": 21050 }
[ "com.unboundid.util.NotNull" ]
import com.unboundid.util.NotNull;
import com.unboundid.util.*;
[ "com.unboundid.util" ]
com.unboundid.util;
2,893,235
public static void setProperToolbarSize(Context context, Toolbar toolbar) { toolbar.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, MizLib.hasKitKat() ? MizLib.getActionBarAndStatusBarHeight(context) : MizLib.getActionBarHeight(context))); }
static void function(Context context, Toolbar toolbar) { toolbar.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, MizLib.hasKitKat() ? MizLib.getActionBarAndStatusBarHeight(context) : MizLib.getActionBarHeight(context))); }
/** * Since Toolbar needs to be bigger than the default height in some cases, * this method will change the height to include the status bar on Kitkat and newer. * @param context * @param toolbar */
Since Toolbar needs to be bigger than the default height in some cases, this method will change the height to include the status bar on Kitkat and newer
setProperToolbarSize
{ "repo_name": "MizzleDK/Mizuu", "path": "app/src/main/java/com/miz/utils/ViewUtils.java", "license": "apache-2.0", "size": 19698 }
[ "android.content.Context", "android.support.v7.widget.Toolbar", "android.view.ViewGroup", "android.widget.FrameLayout", "com.miz.functions.MizLib" ]
import android.content.Context; import android.support.v7.widget.Toolbar; import android.view.ViewGroup; import android.widget.FrameLayout; import com.miz.functions.MizLib;
import android.content.*; import android.support.v7.widget.*; import android.view.*; import android.widget.*; import com.miz.functions.*;
[ "android.content", "android.support", "android.view", "android.widget", "com.miz.functions" ]
android.content; android.support; android.view; android.widget; com.miz.functions;
1,182,228
protected Calendar getTodayMinusThreeMonths() { Calendar todayMinusThreeMonths = Calendar.getInstance(); // Set to today. todayMinusThreeMonths.add(Calendar.MONTH, -3); // Back up 3 months. todayMinusThreeMonths.set(Calendar.HOUR, 12); todayMinusThreeMonths.set(Calendar.MINUTE, 0); todayMinusThreeMonths.set(Calendar.SECOND, 0); todayMinusThreeMonths.set(Calendar.MILLISECOND, 0); todayMinusThreeMonths.set(Calendar.AM_PM, Calendar.AM); return todayMinusThreeMonths; }
Calendar function() { Calendar todayMinusThreeMonths = Calendar.getInstance(); todayMinusThreeMonths.add(Calendar.MONTH, -3); todayMinusThreeMonths.set(Calendar.HOUR, 12); todayMinusThreeMonths.set(Calendar.MINUTE, 0); todayMinusThreeMonths.set(Calendar.SECOND, 0); todayMinusThreeMonths.set(Calendar.MILLISECOND, 0); todayMinusThreeMonths.set(Calendar.AM_PM, Calendar.AM); return todayMinusThreeMonths; }
/** * Creates and returns a Calendar object of today minus three months. * * @return Calendar object of today minus three months. */
Creates and returns a Calendar object of today minus three months
getTodayMinusThreeMonths
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/purap/document/service/impl/PurchaseOrderServiceImpl.java", "license": "agpl-3.0", "size": 129962 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
232,273
public boolean isConsumer(ImageConsumer consumer) { return consumers.contains(consumer); }
boolean function(ImageConsumer consumer) { return consumers.contains(consumer); }
/** * This method determines if a given ImageConsumer object is * currently registered with this ImageProducer as one of its * consumers. * * @param consumer to consumer to register with the producer */
This method determines if a given ImageConsumer object is currently registered with this ImageProducer as one of its consumers
isConsumer
{ "repo_name": "maddalab/jmagick", "path": "src/magick/MagickProducer.java", "license": "lgpl-2.1", "size": 4391 }
[ "java.awt.image.ImageConsumer" ]
import java.awt.image.ImageConsumer;
import java.awt.image.*;
[ "java.awt" ]
java.awt;
371,629
@Deployment(resources = { "org/activiti/engine/test/bpmn/callactivity/CallActivity.testSubProcessDataInputOutput.bpmn20.xml", "org/activiti/engine/test/bpmn/callactivity/simpleSubProcess.bpmn20.xml" }) public void testSubProcessWithDataInputOutput() { Map<String, Object> vars = new HashMap<String, Object>(); vars.put("superVariable", "Hello from the super process."); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("subProcessDataInputOutput", vars); // one task in the subprocess should be active after starting the process instance TaskQuery taskQuery = taskService.createTaskQuery(); org.flowable.task.api.Task taskBeforeSubProcess = taskQuery.singleResult(); assertEquals("Task in subprocess", taskBeforeSubProcess.getName()); assertEquals("Hello from the super process.", runtimeService.getVariable(taskBeforeSubProcess.getProcessInstanceId(), "subVariable")); assertEquals("Hello from the super process.", taskService.getVariable(taskBeforeSubProcess.getId(), "subVariable")); runtimeService.setVariable(taskBeforeSubProcess.getProcessInstanceId(), "subVariable", "Hello from sub process."); // super variable is unchanged assertEquals("Hello from the super process.", runtimeService.getVariable(processInstance.getId(), "superVariable")); // Completing this task ends the subprocess which leads to a task in the super process taskService.complete(taskBeforeSubProcess.getId()); // one task in the subprocess should be active after starting the process instance org.flowable.task.api.Task taskAfterSubProcess = taskQuery.singleResult(); assertEquals("Task in super process", taskAfterSubProcess.getName()); assertEquals("Hello from sub process.", runtimeService.getVariable(processInstance.getId(), "superVariable")); assertEquals("Hello from sub process.", taskService.getVariable(taskAfterSubProcess.getId(), "superVariable")); vars.clear(); vars.put("x", 5l); // Completing this task ends the super process which leads to a task in the super process taskService.complete(taskAfterSubProcess.getId(), vars); // now we are the second time in the sub process but passed variables via expressions org.flowable.task.api.Task taskInSecondSubProcess = taskQuery.singleResult(); assertEquals("Task in subprocess", taskInSecondSubProcess.getName()); assertEquals(10l, runtimeService.getVariable(taskInSecondSubProcess.getProcessInstanceId(), "y")); assertEquals(10l, taskService.getVariable(taskInSecondSubProcess.getId(), "y")); // Completing this task ends the subprocess which leads to a task in the super process taskService.complete(taskInSecondSubProcess.getId()); // one task in the subprocess should be active after starting the process instance org.flowable.task.api.Task taskAfterSecondSubProcess = taskQuery.singleResult(); assertEquals("Task in super process", taskAfterSecondSubProcess.getName()); assertEquals(15l, runtimeService.getVariable(taskAfterSecondSubProcess.getProcessInstanceId(), "z")); assertEquals(15l, taskService.getVariable(taskAfterSecondSubProcess.getId(), "z")); // and end last task in Super process taskService.complete(taskAfterSecondSubProcess.getId()); assertProcessEnded(processInstance.getId()); assertEquals(0, runtimeService.createExecutionQuery().list().size()); }
@Deployment(resources = { STR, STR }) void function() { Map<String, Object> vars = new HashMap<String, Object>(); vars.put(STR, STR); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(STR, vars); TaskQuery taskQuery = taskService.createTaskQuery(); org.flowable.task.api.Task taskBeforeSubProcess = taskQuery.singleResult(); assertEquals(STR, taskBeforeSubProcess.getName()); assertEquals(STR, runtimeService.getVariable(taskBeforeSubProcess.getProcessInstanceId(), STR)); assertEquals(STR, taskService.getVariable(taskBeforeSubProcess.getId(), STR)); runtimeService.setVariable(taskBeforeSubProcess.getProcessInstanceId(), STR, STR); assertEquals(STR, runtimeService.getVariable(processInstance.getId(), STR)); taskService.complete(taskBeforeSubProcess.getId()); org.flowable.task.api.Task taskAfterSubProcess = taskQuery.singleResult(); assertEquals(STR, taskAfterSubProcess.getName()); assertEquals(STR, runtimeService.getVariable(processInstance.getId(), STR)); assertEquals(STR, taskService.getVariable(taskAfterSubProcess.getId(), STR)); vars.clear(); vars.put("x", 5l); taskService.complete(taskAfterSubProcess.getId(), vars); org.flowable.task.api.Task taskInSecondSubProcess = taskQuery.singleResult(); assertEquals(STR, taskInSecondSubProcess.getName()); assertEquals(10l, runtimeService.getVariable(taskInSecondSubProcess.getProcessInstanceId(), "y")); assertEquals(10l, taskService.getVariable(taskInSecondSubProcess.getId(), "y")); taskService.complete(taskInSecondSubProcess.getId()); org.flowable.task.api.Task taskAfterSecondSubProcess = taskQuery.singleResult(); assertEquals(STR, taskAfterSecondSubProcess.getName()); assertEquals(15l, runtimeService.getVariable(taskAfterSecondSubProcess.getProcessInstanceId(), "z")); assertEquals(15l, taskService.getVariable(taskAfterSecondSubProcess.getId(), "z")); taskService.complete(taskAfterSecondSubProcess.getId()); assertProcessEnded(processInstance.getId()); assertEquals(0, runtimeService.createExecutionQuery().list().size()); }
/** * Test case for handing over process variables to a sub process */
Test case for handing over process variables to a sub process
testSubProcessWithDataInputOutput
{ "repo_name": "lsmall/flowable-engine", "path": "modules/flowable5-test/src/test/java/org/activiti/engine/test/bpmn/callactivity/CallActivityAdvancedTest.java", "license": "apache-2.0", "size": 17688 }
[ "java.util.HashMap", "java.util.Map", "org.flowable.engine.runtime.ProcessInstance", "org.flowable.engine.test.Deployment", "org.flowable.task.api.TaskQuery" ]
import java.util.HashMap; import java.util.Map; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.test.Deployment; import org.flowable.task.api.TaskQuery;
import java.util.*; import org.flowable.engine.runtime.*; import org.flowable.engine.test.*; import org.flowable.task.api.*;
[ "java.util", "org.flowable.engine", "org.flowable.task" ]
java.util; org.flowable.engine; org.flowable.task;
2,100,251
Pair<? extends Iterable<JobRecord>, String> queryRootPipelines( String classFilter, String cursor, int limit);
Pair<? extends Iterable<JobRecord>, String> queryRootPipelines( String classFilter, String cursor, int limit);
/** * Queries the data store for all root Pipeline. * * @param classFilter An optional filter by class display name. * @param cursor An optional cursor (used for paging). * @param limit Results limit (zero or negative will be treated as no limit). * @return a Pair of job records and a next cursor (or null, if no more results). */
Queries the data store for all root Pipeline
queryRootPipelines
{ "repo_name": "svn2github/appengine-pipeline", "path": "java/src/main/java/com/google/appengine/tools/pipeline/impl/backend/PipelineBackEnd.java", "license": "apache-2.0", "size": 9063 }
[ "com.google.appengine.tools.pipeline.impl.model.JobRecord", "com.google.appengine.tools.pipeline.util.Pair" ]
import com.google.appengine.tools.pipeline.impl.model.JobRecord; import com.google.appengine.tools.pipeline.util.Pair;
import com.google.appengine.tools.pipeline.impl.model.*; import com.google.appengine.tools.pipeline.util.*;
[ "com.google.appengine" ]
com.google.appengine;
2,410,996
public void terminate(TaskId taskId) { terminate(taskId, false); }
void function(TaskId taskId) { terminate(taskId, false); }
/** * Update the eligible list of task and dependencies if necessary. * This function considered that the taskId is in eligible task list. * Visibility is package because user cannot use this method. * * @param taskId the task to remove from running task. */
Update the eligible list of task and dependencies if necessary. This function considered that the taskId is in eligible task list. Visibility is package because user cannot use this method
terminate
{ "repo_name": "ShatalovYaroslav/scheduling", "path": "scheduler/scheduler-server/src/main/java/org/ow2/proactive/scheduler/descriptor/JobDescriptorImpl.java", "license": "agpl-3.0", "size": 33615 }
[ "org.ow2.proactive.scheduler.common.task.TaskId" ]
import org.ow2.proactive.scheduler.common.task.TaskId;
import org.ow2.proactive.scheduler.common.task.*;
[ "org.ow2.proactive" ]
org.ow2.proactive;
1,405,657
private Document createDocument(final SmlDocumentation sosDocumentation) { final Document document = Document.Factory.newInstance(); if (sosDocumentation.isSetDescription()) { document.addNewDescription().setStringValue(sosDocumentation.getDescription()); } else { document.addNewDescription().setStringValue(""); } if (sosDocumentation.isSetDate()) { document.setDate(sosDocumentation.getDate().getValue().toDate()); } if (sosDocumentation.isSetContact()) { document.addNewContact().addNewResponsibleParty().setIndividualName(sosDocumentation.getContact()); } if (sosDocumentation.isSetFormat()) { document.setFormat(sosDocumentation.getFormat()); } if (sosDocumentation.isSetVersion()) { document.setVersion(sosDocumentation.getVersion()); } return document; }
Document function(final SmlDocumentation sosDocumentation) { final Document document = Document.Factory.newInstance(); if (sosDocumentation.isSetDescription()) { document.addNewDescription().setStringValue(sosDocumentation.getDescription()); } else { document.addNewDescription().setStringValue(""); } if (sosDocumentation.isSetDate()) { document.setDate(sosDocumentation.getDate().getValue().toDate()); } if (sosDocumentation.isSetContact()) { document.addNewContact().addNewResponsibleParty().setIndividualName(sosDocumentation.getContact()); } if (sosDocumentation.isSetFormat()) { document.setFormat(sosDocumentation.getFormat()); } if (sosDocumentation.isSetVersion()) { document.setVersion(sosDocumentation.getVersion()); } return document; }
/** * Create a XML Documentation element from SOS documentation * * @param sosDocumentation * SOS documentation * @return XML Documentation element */
Create a XML Documentation element from SOS documentation
createDocument
{ "repo_name": "ahuarte47/SOS", "path": "coding/sensorML-v101/src/main/java/org/n52/sos/encode/SensorMLEncoderv101.java", "license": "gpl-2.0", "size": 65192 }
[ "net.opengis.sensorML.x101.DocumentDocument", "org.n52.sos.ogc.sensorML.elements.SmlDocumentation" ]
import net.opengis.sensorML.x101.DocumentDocument; import org.n52.sos.ogc.sensorML.elements.SmlDocumentation;
import net.opengis.*; import org.n52.sos.ogc.*;
[ "net.opengis", "org.n52.sos" ]
net.opengis; org.n52.sos;
2,299,035
public static DateTimeValue parse(String dateTime) throws ParseException { return new DateTimeValue(dateTime); }
static DateTimeValue function(String dateTime) throws ParseException { return new DateTimeValue(dateTime); }
/** * Makes an instance of date/time value from a {@code String} in {@code yyyy-mm-dd}, {@code yyyy-mm-ddThh:mm}, * {@code yyyy-mm-ddThh:mm:ss} or {@code yyyy-mm-ddThh:mm:ss.nnnnnnnnn} format. * * @param dateTime Date/time in {@code String} format ({@code yyyy-mm-dd}). * @throws NullPointerException If {@code dateTime} is {@code null}. * @throws ParseException If {@code date} don't respect the {@code yyyy-mm-dd}, {@code yyyy-mm-ddThh:mm}, * {@code yyyy-mm-ddThh:mm:ss} or {@code yyyy-mm-ddThh:mm:ss.nnnnnnnnn} format. * @return An instance of date/time value. */
Makes an instance of date/time value from a String in yyyy-mm-dd, yyyy-mm-ddThh:mm, yyyy-mm-ddThh:mm:ss or yyyy-mm-ddThh:mm:ss.nnnnnnnnn format
parse
{ "repo_name": "otoniel-isidoro/assertj-db", "path": "src/main/java/org/assertj/db/type/DateTimeValue.java", "license": "apache-2.0", "size": 9042 }
[ "java.text.ParseException" ]
import java.text.ParseException;
import java.text.*;
[ "java.text" ]
java.text;
2,431,064
public ValueVector getChildByOrdinal(int id) { return vectors.getByOrdinal(id); }
ValueVector function(int id) { return vectors.getByOrdinal(id); }
/** * Returns a {@link org.apache.arrow.vector.ValueVector} corresponding to the given ordinal identifier. * * @param id the ordinal of the child to return * @return the corresponding child */
Returns a <code>org.apache.arrow.vector.ValueVector</code> corresponding to the given ordinal identifier
getChildByOrdinal
{ "repo_name": "majetideepak/arrow", "path": "java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java", "license": "apache-2.0", "size": 10043 }
[ "org.apache.arrow.vector.ValueVector" ]
import org.apache.arrow.vector.ValueVector;
import org.apache.arrow.vector.*;
[ "org.apache.arrow" ]
org.apache.arrow;
2,519,638
public void writeContent(ArrayList<String> content) throws IOException { for (Iterator<String> content_iterator = content.iterator(); content_iterator.hasNext();) { String content_line = (String) content_iterator.next(); writingBuffer.write(content_line); writingBuffer.newLine(); } writingBuffer.close(); }
void function(ArrayList<String> content) throws IOException { for (Iterator<String> content_iterator = content.iterator(); content_iterator.hasNext();) { String content_line = (String) content_iterator.next(); writingBuffer.write(content_line); writingBuffer.newLine(); } writingBuffer.close(); }
/** * Write content. * * @param content the content * @throws IOException Signals that an I/O exception has occurred. */
Write content
writeContent
{ "repo_name": "alu0100694765/Microblogging", "path": "src/write/WriteFile.java", "license": "gpl-2.0", "size": 2599 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.Iterator" ]
import java.io.IOException; import java.util.ArrayList; import java.util.Iterator;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,729,105
public void onCriticalHit(Entity entityHit) { }
void function(Entity entityHit) { }
/** * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically */
Called when the player performs a critical hit on the Entity. Args: entity that was hit critically
onCriticalHit
{ "repo_name": "dogjaw2233/tiu-s-mod", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/player/EntityPlayer.java", "license": "lgpl-2.1", "size": 90554 }
[ "net.minecraft.entity.Entity" ]
import net.minecraft.entity.Entity;
import net.minecraft.entity.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
1,377,882
public static boolean authorizeActionBoolean(Context c, DSpaceObject o, int a, boolean useInheritance) throws SQLException { boolean isAuthorized = true; if (o == null) { return false; } try { authorizeAction(c, o, a, useInheritance); } catch (AuthorizeException e) { isAuthorized = false; } return isAuthorized; }
static boolean function(Context c, DSpaceObject o, int a, boolean useInheritance) throws SQLException { boolean isAuthorized = true; if (o == null) { return false; } try { authorizeAction(c, o, a, useInheritance); } catch (AuthorizeException e) { isAuthorized = false; } return isAuthorized; }
/** * same authorize, returns boolean for those who don't want to deal with * catching exceptions. * * @param c * DSpace context, containing current user * @param o * DSpaceObject * @param a * action being attempted, from * <code>org.dspace.core.Constants</code> * @param useInheritance * flag to say if ADMIN action on the current object or parent * object can be used * * @return <code>true</code> if the current user in the context is * authorized to perform the given action on the given object */
same authorize, returns boolean for those who don't want to deal with catching exceptions
authorizeActionBoolean
{ "repo_name": "ojacobson/dryad-repo", "path": "dspace/modules/api/src/main/java/org/dspace/authorize/AuthorizeManager.java", "license": "bsd-3-clause", "size": 29430 }
[ "java.sql.SQLException", "org.dspace.content.DSpaceObject", "org.dspace.core.Context" ]
import java.sql.SQLException; import org.dspace.content.DSpaceObject; import org.dspace.core.Context;
import java.sql.*; import org.dspace.content.*; import org.dspace.core.*;
[ "java.sql", "org.dspace.content", "org.dspace.core" ]
java.sql; org.dspace.content; org.dspace.core;
2,202,391
List<String> queryLoadedModuleNames();
List<String> queryLoadedModuleNames();
/** * Obtain a list of the current module names. * * @return the module names */
Obtain a list of the current module names
queryLoadedModuleNames
{ "repo_name": "ctomc/jboss-modules", "path": "src/main/java/org/jboss/modules/management/ModuleLoaderMXBean.java", "license": "apache-2.0", "size": 4426 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
991,331
public Timestamp getCostAdjustmentDate () { return (Timestamp)get_Value(COLUMNNAME_CostAdjustmentDate); }
Timestamp function () { return (Timestamp)get_Value(COLUMNNAME_CostAdjustmentDate); }
/** Get Cost Adjustment Date. @return Product Cost Adjustment */
Get Cost Adjustment Date
getCostAdjustmentDate
{ "repo_name": "neuroidss/adempiere", "path": "base/src/org/compiere/model/X_M_CostDetail.java", "license": "gpl-2.0", "size": 28060 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,493,256
@Override public OkHttpChannelBuilder maxInboundMessageSize(int max) { Preconditions.checkArgument(max >= 0, "negative max"); maxInboundMessageSize = max; return this; }
OkHttpChannelBuilder function(int max) { Preconditions.checkArgument(max >= 0, STR); maxInboundMessageSize = max; return this; }
/** * Sets the maximum message size allowed for a single gRPC frame. If an inbound messages * larger than this limit is received it will not be processed and the RPC will fail with * RESOURCE_EXHAUSTED. */
Sets the maximum message size allowed for a single gRPC frame. If an inbound messages larger than this limit is received it will not be processed and the RPC will fail with RESOURCE_EXHAUSTED
maxInboundMessageSize
{ "repo_name": "dapengzhang0/grpc-java", "path": "okhttp/src/main/java/io/grpc/okhttp/OkHttpChannelBuilder.java", "license": "apache-2.0", "size": 32436 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
2,260,386
private HashMap<String,MessageInfo> toHashMap (List<MessageInfo> infoList) { HashMap<String,MessageInfo> result=new HashMap<String,MessageInfo>(); for (MessageInfo info:infoList) { result.put(info.getKey(),info); } return result; }
HashMap<String,MessageInfo> function (List<MessageInfo> infoList) { HashMap<String,MessageInfo> result=new HashMap<String,MessageInfo>(); for (MessageInfo info:infoList) { result.put(info.getKey(),info); } return result; }
/** * Converts the given meta-information list into a map, with the * map keys being the message keys. * * @param infoList The meta-information in list form. * * @return The map. */
Converts the given meta-information list into a map, with the map keys being the message keys
toHashMap
{ "repo_name": "nagyist/marketcetera", "path": "trunk/util/src/main/java/org/marketcetera/util/l10n/MessageComparator.java", "license": "apache-2.0", "size": 8686 }
[ "java.util.HashMap", "java.util.List" ]
import java.util.HashMap; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,254,636
@Override public void enterClassOrInterfaceType(@NotNull Java7Parser.ClassOrInterfaceTypeContext ctx) { }
@Override public void enterClassOrInterfaceType(@NotNull Java7Parser.ClassOrInterfaceTypeContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitElementValue
{ "repo_name": "jsteenbeeke/antlr-java-parser", "path": "src/main/java/com/github/antlrjavaparser/Java7ParserBaseListener.java", "license": "lgpl-3.0", "size": 53492 }
[ "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,899,427
public boolean isNewV11Prefs() { if (mHasHeaders != null && mLoadHeaders != null) try { return (Boolean) mHasHeaders.invoke(this); } catch (final IllegalArgumentException e) { } catch (final IllegalAccessException e) { } catch (final InvocationTargetException e) { } return false; }
boolean function() { if (mHasHeaders != null && mLoadHeaders != null) try { return (Boolean) mHasHeaders.invoke(this); } catch (final IllegalArgumentException e) { } catch (final IllegalAccessException e) { } catch (final InvocationTargetException e) { } return false; }
/** * Checks to see if using new v11+ way of handling PrefsFragments. * * @return Returns false pre-v11, else checks to see if using headers. */
Checks to see if using new v11+ way of handling PrefsFragments
isNewV11Prefs
{ "repo_name": "SPECURE/ratel-nettest", "path": "RMBTAndroid/src/at/alladin/rmbt/android/preferences/RMBTPreferenceActivity.java", "license": "apache-2.0", "size": 8413 }
[ "java.lang.reflect.InvocationTargetException" ]
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,474,007
private void adjustItem(int position, View v, boolean invalidChildHeight) { // Adjust item height ViewGroup.LayoutParams lp = v.getLayoutParams(); int height; if (position != mSrcPos && position != mFirstExpPos && position != mSecondExpPos) { height = ViewGroup.LayoutParams.WRAP_CONTENT; } else { height = calcItemHeight(position, v, invalidChildHeight); } if (height != lp.height) { lp.height = height; v.setLayoutParams(lp); } // Adjust item gravity if (position == mFirstExpPos || position == mSecondExpPos) { if (position < mSrcPos) { ((DragSortItemView) v).setGravity(Gravity.BOTTOM); } else if (position > mSrcPos) { ((DragSortItemView) v).setGravity(Gravity.TOP); } } // Finally adjust item visibility int oldVis = v.getVisibility(); int vis = View.VISIBLE; if (position == mSrcPos && mFloatView != null) { vis = View.INVISIBLE; } if (vis != oldVis) { v.setVisibility(vis); } }
void function(int position, View v, boolean invalidChildHeight) { ViewGroup.LayoutParams lp = v.getLayoutParams(); int height; if (position != mSrcPos && position != mFirstExpPos && position != mSecondExpPos) { height = ViewGroup.LayoutParams.WRAP_CONTENT; } else { height = calcItemHeight(position, v, invalidChildHeight); } if (height != lp.height) { lp.height = height; v.setLayoutParams(lp); } if (position == mFirstExpPos position == mSecondExpPos) { if (position < mSrcPos) { ((DragSortItemView) v).setGravity(Gravity.BOTTOM); } else if (position > mSrcPos) { ((DragSortItemView) v).setGravity(Gravity.TOP); } } int oldVis = v.getVisibility(); int vis = View.VISIBLE; if (position == mSrcPos && mFloatView != null) { vis = View.INVISIBLE; } if (vis != oldVis) { v.setVisibility(vis); } }
/** * Sets layout param height, gravity, and visibility on * wrapped item. */
Sets layout param height, gravity, and visibility on wrapped item
adjustItem
{ "repo_name": "yukuku/androidbible", "path": "DragSortListView/src/main/java/com/mobeta/android/dslv/DragSortListView.java", "license": "apache-2.0", "size": 75209 }
[ "android.view.Gravity", "android.view.View", "android.view.ViewGroup" ]
import android.view.Gravity; import android.view.View; import android.view.ViewGroup;
import android.view.*;
[ "android.view" ]
android.view;
61,081
@Test public void testPropertyToMessageAttribute() throws JMSException { internalTestPropertyToMessageAttribute(new SQSTextMessage()); internalTestPropertyToMessageAttribute(new SQSObjectMessage()); internalTestPropertyToMessageAttribute(new SQSBytesMessage()); }
void function() throws JMSException { internalTestPropertyToMessageAttribute(new SQSTextMessage()); internalTestPropertyToMessageAttribute(new SQSObjectMessage()); internalTestPropertyToMessageAttribute(new SQSBytesMessage()); }
/** * Test propertyToMessageAttribute with messages of different type */
Test propertyToMessageAttribute with messages of different type
testPropertyToMessageAttribute
{ "repo_name": "lkb2k/amazon-sqs-java-messaging-lib", "path": "src/test/java/com/amazon/sqs/javamessaging/SQSMessageProducerTest.java", "license": "apache-2.0", "size": 27446 }
[ "com.amazon.sqs.javamessaging.message.SQSBytesMessage", "com.amazon.sqs.javamessaging.message.SQSObjectMessage", "com.amazon.sqs.javamessaging.message.SQSTextMessage", "javax.jms.JMSException" ]
import com.amazon.sqs.javamessaging.message.SQSBytesMessage; import com.amazon.sqs.javamessaging.message.SQSObjectMessage; import com.amazon.sqs.javamessaging.message.SQSTextMessage; import javax.jms.JMSException;
import com.amazon.sqs.javamessaging.message.*; import javax.jms.*;
[ "com.amazon.sqs", "javax.jms" ]
com.amazon.sqs; javax.jms;
1,770,281
@Test public void testNoMissingEOWHappyPathWithMultiEventWindow() throws Exception { final DbusEventBuffer dbusBuf = new DbusEventBuffer(getConfig(1000,1000,100,500,AllocationPolicy.HEAP_MEMORY, QueuePolicy.BLOCK_ON_WRITE, AssertLevel.NONE)); dbusBuf.setDropOldEvents(true); DbusEventGenerator generator = new DbusEventGenerator(); Vector<DbusEvent> events = new Vector<DbusEvent>(); generator.generateEvents(6, 1, 100, 10, events); // conversion of readable events to writable is for TESTING ONLY: DbusEventInternalWritable writableEvent = DbusEventCorrupter.makeWritable(events.get(1)); writableEvent.setSequence(events.get(0).sequence()); writableEvent.applyCrc(); writableEvent = DbusEventCorrupter.makeWritable(events.get(2)); writableEvent.setSequence(events.get(0).sequence()); writableEvent.setSrcId((short)-2); writableEvent.applyCrc(); writableEvent = DbusEventCorrupter.makeWritable(events.get(3)); writableEvent.setSequence(events.get(0).sequence()+100); writableEvent.applyCrc(); writableEvent = DbusEventCorrupter.makeWritable(events.get(4)); writableEvent.setSequence(events.get(3).sequence()); writableEvent.applyCrc(); writableEvent = DbusEventCorrupter.makeWritable(events.get(5)); writableEvent.setSequence(events.get(0).sequence()+100); writableEvent.setSrcId((short)-2); writableEvent.applyCrc(); // Increment the SCN and reuse for (int i=0; i < 6; ++i) { DbusEvent e = events.get(i); assertTrue("invalid event #" + i, e.isValid()); } // Set up the ReadChannel with 2 events ByteArrayOutputStream oStream = new ByteArrayOutputStream(); WritableByteChannel oChannel = Channels.newChannel(oStream); for (int i = 0; i < 6; ++i) { ((DbusEventInternalReadable)events.get(i)).writeTo(oChannel,Encoding.BINARY); } byte[] writeBytes = oStream.toByteArray(); ByteArrayInputStream iStream = new ByteArrayInputStream(writeBytes); final ReadableByteChannel rChannel = Channels.newChannel(iStream); try { dbusBuf.readEvents(rChannel); // Should NOT throw invalid event exception } catch (InvalidEventException ie) { LOG.error("Exception trace is " + ie.getMessage(), ie); Assert.fail(); return; } }
void function() throws Exception { final DbusEventBuffer dbusBuf = new DbusEventBuffer(getConfig(1000,1000,100,500,AllocationPolicy.HEAP_MEMORY, QueuePolicy.BLOCK_ON_WRITE, AssertLevel.NONE)); dbusBuf.setDropOldEvents(true); DbusEventGenerator generator = new DbusEventGenerator(); Vector<DbusEvent> events = new Vector<DbusEvent>(); generator.generateEvents(6, 1, 100, 10, events); DbusEventInternalWritable writableEvent = DbusEventCorrupter.makeWritable(events.get(1)); writableEvent.setSequence(events.get(0).sequence()); writableEvent.applyCrc(); writableEvent = DbusEventCorrupter.makeWritable(events.get(2)); writableEvent.setSequence(events.get(0).sequence()); writableEvent.setSrcId((short)-2); writableEvent.applyCrc(); writableEvent = DbusEventCorrupter.makeWritable(events.get(3)); writableEvent.setSequence(events.get(0).sequence()+100); writableEvent.applyCrc(); writableEvent = DbusEventCorrupter.makeWritable(events.get(4)); writableEvent.setSequence(events.get(3).sequence()); writableEvent.applyCrc(); writableEvent = DbusEventCorrupter.makeWritable(events.get(5)); writableEvent.setSequence(events.get(0).sequence()+100); writableEvent.setSrcId((short)-2); writableEvent.applyCrc(); for (int i=0; i < 6; ++i) { DbusEvent e = events.get(i); assertTrue(STR + i, e.isValid()); } ByteArrayOutputStream oStream = new ByteArrayOutputStream(); WritableByteChannel oChannel = Channels.newChannel(oStream); for (int i = 0; i < 6; ++i) { ((DbusEventInternalReadable)events.get(i)).writeTo(oChannel,Encoding.BINARY); } byte[] writeBytes = oStream.toByteArray(); ByteArrayInputStream iStream = new ByteArrayInputStream(writeBytes); final ReadableByteChannel rChannel = Channels.newChannel(iStream); try { dbusBuf.readEvents(rChannel); } catch (InvalidEventException ie) { LOG.error(STR + ie.getMessage(), ie); Assert.fail(); return; } }
/** * Testcase send the following sequence: * two valid packets, EOW, two valid packets, EOW */
Testcase send the following sequence: two valid packets, EOW, two valid packets, EOW
testNoMissingEOWHappyPathWithMultiEventWindow
{ "repo_name": "rahuljoshi123/databus", "path": "databus-core/databus-core-impl/src/test/java/com/linkedin/databus/core/TestDbusEventBuffer.java", "license": "apache-2.0", "size": 192220 }
[ "com.linkedin.databus.core.DbusEventBuffer", "com.linkedin.databus.core.test.DbusEventCorrupter", "com.linkedin.databus.core.test.DbusEventGenerator", "com.linkedin.databus2.core.AssertLevel", "java.io.ByteArrayInputStream", "java.io.ByteArrayOutputStream", "java.nio.channels.Channels", "java.nio.channels.ReadableByteChannel", "java.nio.channels.WritableByteChannel", "java.util.Vector", "junit.framework.Assert", "org.testng.AssertJUnit" ]
import com.linkedin.databus.core.DbusEventBuffer; import com.linkedin.databus.core.test.DbusEventCorrupter; import com.linkedin.databus.core.test.DbusEventGenerator; import com.linkedin.databus2.core.AssertLevel; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; import java.util.Vector; import junit.framework.Assert; import org.testng.AssertJUnit;
import com.linkedin.databus.core.*; import com.linkedin.databus.core.test.*; import com.linkedin.databus2.core.*; import java.io.*; import java.nio.channels.*; import java.util.*; import junit.framework.*; import org.testng.*;
[ "com.linkedin.databus", "com.linkedin.databus2", "java.io", "java.nio", "java.util", "junit.framework", "org.testng" ]
com.linkedin.databus; com.linkedin.databus2; java.io; java.nio; java.util; junit.framework; org.testng;
344,778
public HashMap getExternalOperations() throws RemoteException;
HashMap function() throws RemoteException;
/** * Gets all external operations for the associated VectorProperty. * * @return HashMap containing internal name/display name mappings of the operations. * * @exception RemoteException if there was an error during remote access of this method. */
Gets all external operations for the associated VectorProperty
getExternalOperations
{ "repo_name": "tolo/JServer", "path": "src/java/com/teletalk/jserver/rmi/remote/RemoteVectorProperty.java", "license": "apache-2.0", "size": 3789 }
[ "java.rmi.RemoteException", "java.util.HashMap" ]
import java.rmi.RemoteException; import java.util.HashMap;
import java.rmi.*; import java.util.*;
[ "java.rmi", "java.util" ]
java.rmi; java.util;
2,499,622
@Override public void exitLcExprs(@NotNull ErlangParser.LcExprsContext ctx) { }
@Override public void exitLcExprs(@NotNull ErlangParser.LcExprsContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterLcExprs
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/ErlangBaseListener.java", "license": "gpl-3.0", "size": 35359 }
[ "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;
559,261
public static Resource ASAP() { return ResourceFactory.createResource("https://asap.ahabs.wisc.edu/annotation/php/feature_info.php?FeatureID="); }
static Resource function() { return ResourceFactory.createResource("https: }
/** * Returns the link-out URI for objects of "A Systematic Annotation Package for Community Analysis of Genomes". */
Returns the link-out URI for objects of "A Systematic Annotation Package for Community Analysis of Genomes"
ASAP
{ "repo_name": "BioInterchange/BioInterchange", "path": "supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/GOXRef.java", "license": "mit", "size": 41277 }
[ "com.hp.hpl.jena.rdf.model.Resource", "com.hp.hpl.jena.rdf.model.ResourceFactory" ]
import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.*;
[ "com.hp.hpl" ]
com.hp.hpl;
2,193,319
Widget createWidgetConfig(ActionLink link);
Widget createWidgetConfig(ActionLink link);
/** * Creates a widget configuration object * * @param link the link representing the data for the configuration object * * @return the configuration object or null if the link is null or does not represent a configuration object */
Creates a widget configuration object
createWidgetConfig
{ "repo_name": "appnativa/rare", "path": "source/rare/core/com/appnativa/rare/ui/iWindowManager.java", "license": "gpl-3.0", "size": 16340 }
[ "com.appnativa.rare.net.ActionLink", "com.appnativa.rare.spot.Widget" ]
import com.appnativa.rare.net.ActionLink; import com.appnativa.rare.spot.Widget;
import com.appnativa.rare.net.*; import com.appnativa.rare.spot.*;
[ "com.appnativa.rare" ]
com.appnativa.rare;
2,731,505
ObjectOutputStream oos = null; ObjectInputStream ois = null; try { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); // A oos = new ObjectOutputStream(bos); // B // serialize and pass the object oos.writeObject(oldObj); // C oos.flush(); // D final ByteArrayInputStream bin = new ByteArrayInputStream(bos .toByteArray()); // E ois = new ObjectInputStream(bin); // F // return the new object return ois.readObject(); // G } catch (final Exception e) { throw new EncogError(e); } finally { try { if (oos != null) { oos.close(); } if (ois != null) { ois.close(); } } catch (final Exception e) { throw new EncogError(e); } } } private ObjectCloner() { }
ObjectOutputStream oos = null; ObjectInputStream ois = null; try { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); oos.writeObject(oldObj); oos.flush(); final ByteArrayInputStream bin = new ByteArrayInputStream(bos .toByteArray()); ois = new ObjectInputStream(bin); return ois.readObject(); } catch (final Exception e) { throw new EncogError(e); } finally { try { if (oos != null) { oos.close(); } if (ois != null) { ois.close(); } } catch (final Exception e) { throw new EncogError(e); } } } private ObjectCloner() { }
/** * Perform a deep copy. * * @param oldObj * The old object. * @return The new object. */
Perform a deep copy
deepCopy
{ "repo_name": "larhoy/SentimentProjectV2", "path": "SentimentAnalysisV2/encog-core-3.1.0/src/main/java/org/encog/util/obj/ObjectCloner.java", "license": "mit", "size": 2397 }
[ "java.io.ByteArrayInputStream", "java.io.ByteArrayOutputStream", "java.io.ObjectInputStream", "java.io.ObjectOutputStream", "org.encog.EncogError" ]
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import org.encog.EncogError;
import java.io.*; import org.encog.*;
[ "java.io", "org.encog" ]
java.io; org.encog;
1,637,808
@Update({ "update ASYNC_PROCESS_EXCEPTION", "set ASYNC_ID = #{asyncId,jdbcType=BIGINT},", "UPDATED_AT = #{updatedAt,jdbcType=TIMESTAMP},", "CREATED_AT = #{createdAt,jdbcType=TIMESTAMP},", "LOCK_VERSION = #{lockVersion,jdbcType=INTEGER},", "DELETED_FLG = #{deletedFlg,jdbcType=INTEGER}", "where ID = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(AsyncProcessException record);
@Update({ STR, STR, STR, STR, STR, STR, STR }) int updateByPrimaryKey(AsyncProcessException record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table ASYNC_PROCESS_EXCEPTION * * @mbggenerated */
This method was generated by MyBatis Generator. This method corresponds to the database table ASYNC_PROCESS_EXCEPTION
updateByPrimaryKey
{ "repo_name": "agwlvssainokuni/springapp", "path": "common/src/generated/java/cherry/common/db/gen/mapper/AsyncProcessExceptionMapper.java", "license": "apache-2.0", "size": 10739 }
[ "org.apache.ibatis.annotations.Update" ]
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.*;
[ "org.apache.ibatis" ]
org.apache.ibatis;
709,184
public void setOutputFormat(Properties format) { m_handler.setOutputFormat(format); }
void function(Properties format) { m_handler.setOutputFormat(format); }
/** * Set the properties of the handler * @param format the output properties to set * @see Serializer#setOutputFormat(Properties) */
Set the properties of the handler
setOutputFormat
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.xml/src/main/resources/META-INF/modules/java.xml/classes/com/sun/org/apache/xml/internal/serializer/ToUnknownStream.java", "license": "apache-2.0", "size": 38096 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
584,575
@Authorized(PrivilegeConstants.GET_CONCEPTS) public List<ConceptSearchResult> getConcepts(String phrase, List<Locale> locales, boolean includeRetired, List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, List<ConceptDatatype> requireDatatypes, List<ConceptDatatype> excludeDatatypes, Concept answersToConcept, Integer start, Integer size) throws APIException;
@Authorized(PrivilegeConstants.GET_CONCEPTS) List<ConceptSearchResult> function(String phrase, List<Locale> locales, boolean includeRetired, List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, List<ConceptDatatype> requireDatatypes, List<ConceptDatatype> excludeDatatypes, Concept answersToConcept, Integer start, Integer size) throws APIException;
/** * Searches for concepts by the given parameters. * * @param phrase matched to the start of any word in any of the names of a concept (if * blank/null, matches all concepts) * @param locales List&lt;Locale&gt; to restrict to * @param includeRetired boolean if false, will exclude retired concepts * @param requireClasses List&lt;ConceptClass&gt; to restrict to * @param excludeClasses List&lt;ConceptClass&gt; to leave out of results * @param requireDatatypes List&lt;ConceptDatatype&gt; to restrict to * @param excludeDatatypes List&lt;ConceptDatatype&gt; to leave out of results * @param answersToConcept all results will be a possible answer to this concept * @param start all results less than this number will be removed * @param size if non zero, all results after <code>start</code> + <code>size</code> will be * removed * @return a list of conceptSearchResults * @throws APIException * @should return concept search results that match unique concepts * @should return a search result whose concept name contains all word tokens as first * @should return a search result for phrase with stop words * @should not return concepts with matching names that are voided * @should return preferred names higher * @should find concept by full code * @since 1.8 */
Searches for concepts by the given parameters
getConcepts
{ "repo_name": "michaelhofer/openmrs-core", "path": "api/src/main/java/org/openmrs/api/ConceptService.java", "license": "mpl-2.0", "size": 72165 }
[ "java.util.List", "java.util.Locale", "org.openmrs.Concept", "org.openmrs.ConceptClass", "org.openmrs.ConceptDatatype", "org.openmrs.ConceptSearchResult", "org.openmrs.annotation.Authorized", "org.openmrs.util.PrivilegeConstants" ]
import java.util.List; import java.util.Locale; import org.openmrs.Concept; import org.openmrs.ConceptClass; import org.openmrs.ConceptDatatype; import org.openmrs.ConceptSearchResult; import org.openmrs.annotation.Authorized; import org.openmrs.util.PrivilegeConstants;
import java.util.*; import org.openmrs.*; import org.openmrs.annotation.*; import org.openmrs.util.*;
[ "java.util", "org.openmrs", "org.openmrs.annotation", "org.openmrs.util" ]
java.util; org.openmrs; org.openmrs.annotation; org.openmrs.util;
513,206
@Override public String toString() { return new ToStringBuilder(this) .append("name", this.name) .append("types", this.types) .append("size", this.size) .append("isNullable", this.isNullable) .toString(); }
String function() { return new ToStringBuilder(this) .append("name", this.name) .append("types", this.types) .append("size", this.size) .append(STR, this.isNullable) .toString(); }
/** * Returns string representation of this class instance. The information * includes {@link #name}, {@link #types}, {@link #size} and * {@link #isNullable}. * @return String representation of this class */
Returns string representation of this class instance. The information includes <code>#name</code>, <code>#types</code>, <code>#size</code> and <code>#isNullable</code>
toString
{ "repo_name": "eFaps/eFaps-Kernel", "path": "src/main/java/org/efaps/db/databases/information/ColumnInformation.java", "license": "apache-2.0", "size": 4999 }
[ "org.apache.commons.lang3.builder.ToStringBuilder" ]
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.*;
[ "org.apache.commons" ]
org.apache.commons;
1,488,629
public static List<OWLOntologyChange> handleAddOrRemoveAxs( OWLOntology ontology, Set<OWLAxiom> axioms, Annotation annotation, boolean isAddAxioms) { return ModificationHelper.handleAddOrRemoveAxs(ontology, axioms, annotation, isAddAxioms); } // ----------------- CONTAINMENT HELPERS ------------------------------
static List<OWLOntologyChange> function( OWLOntology ontology, Set<OWLAxiom> axioms, Annotation annotation, boolean isAddAxioms) { return ModificationHelper.handleAddOrRemoveAxs(ontology, axioms, annotation, isAddAxioms); }
/** * handles addition or removal of these axioms, * depending on the value of parameter isAddAxiom * * @param ontology * ontology * @param axioms * axioms * @param annotation * Annotation of type {@link OWLAspectAnd} or {@link OWLAspectOr} specifying current aspects * @param isAddAxioms * boolean telling whether this method is addAxioms() * @return list of changes applied successfully (considering successful updating of aspect annotations) */
handles addition or removal of these axioms, depending on the value of parameter isAddAxiom
handleAddOrRemoveAxs
{ "repo_name": "ag-csw/aspect-owlapi", "path": "src/main/java/de/fuberlin/csw/aood/owlapi/helpers/HelperFacade.java", "license": "gpl-3.0", "size": 14829 }
[ "java.lang.annotation.Annotation", "java.util.List", "java.util.Set", "org.semanticweb.owlapi.model.OWLAxiom", "org.semanticweb.owlapi.model.OWLOntology", "org.semanticweb.owlapi.model.OWLOntologyChange" ]
import java.lang.annotation.Annotation; import java.util.List; import java.util.Set; import org.semanticweb.owlapi.model.OWLAxiom; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyChange;
import java.lang.annotation.*; import java.util.*; import org.semanticweb.owlapi.model.*;
[ "java.lang", "java.util", "org.semanticweb.owlapi" ]
java.lang; java.util; org.semanticweb.owlapi;
2,371,106
void getStreamStatement(TicketStatementQuery ticket, CallContext context, ServerStreamListener listener);
void getStreamStatement(TicketStatementQuery ticket, CallContext context, ServerStreamListener listener);
/** * Returns data for a SQL query based data stream. * @param ticket Ticket message containing the statement handle. * @param context Per-call context. * @param listener An interface for sending data back to the client. */
Returns data for a SQL query based data stream
getStreamStatement
{ "repo_name": "apache/arrow", "path": "java/flight/flight-sql/src/main/java/org/apache/arrow/flight/sql/FlightSqlProducer.java", "license": "apache-2.0", "size": 31807 }
[ "org.apache.arrow.flight.sql.impl.FlightSql" ]
import org.apache.arrow.flight.sql.impl.FlightSql;
import org.apache.arrow.flight.sql.impl.*;
[ "org.apache.arrow" ]
org.apache.arrow;
1,405,686
@WebMethod @WebResult(name = "rval", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102") @RequestWrapper(localName = "performCmsMetadataKeyAction", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102", className = "com.google.api.ads.admanager.jaxws.v202102.CmsMetadataServiceInterfaceperformCmsMetadataKeyAction") @ResponseWrapper(localName = "performCmsMetadataKeyActionResponse", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102", className = "com.google.api.ads.admanager.jaxws.v202102.CmsMetadataServiceInterfaceperformCmsMetadataKeyActionResponse") public UpdateResult performCmsMetadataKeyAction( @WebParam(name = "keyAction", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102") CmsMetadataKeyAction keyAction, @WebParam(name = "filterStatement", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102") Statement filterStatement) throws ApiException_Exception ;
@WebResult(name = "rval", targetNamespace = STRperformCmsMetadataKeyActionSTRhttps: @ResponseWrapper(localName = "performCmsMetadataKeyActionResponseSTRhttps: UpdateResult function( @WebParam(name = "keyActionSTRhttps: CmsMetadataKeyAction keyAction, @WebParam(name = "filterStatementSTRhttps: Statement filterStatement) throws ApiException_Exception ;
/** * * Performs actions on {@link CmsMetadataKey} objects that match the given {@link * Statement#query}. * * @param keyAction the action to perform * @param filterStatement a Publisher Query Language statement used to filter a set of cms * metadata keys. * @return the result of the action performed * * * @param keyAction * @param filterStatement * @return * returns com.google.api.ads.admanager.jaxws.v202102.UpdateResult * @throws ApiException_Exception */
Performs actions on <code>CmsMetadataKey</code> objects that match the given <code>Statement#query</code>
performCmsMetadataKeyAction
{ "repo_name": "googleads/googleads-java-lib", "path": "modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/v202102/CmsMetadataServiceInterface.java", "license": "apache-2.0", "size": 8959 }
[ "javax.jws.WebParam", "javax.jws.WebResult", "javax.xml.ws.ResponseWrapper" ]
import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.ResponseWrapper;
import javax.jws.*; import javax.xml.ws.*;
[ "javax.jws", "javax.xml" ]
javax.jws; javax.xml;
2,194,144
public static void archiveActions(User user, String label) { WriteMode m = ModeFactory.getWriteMode("Action_queries", "archive_actions"); Map<String, Object> params = new HashMap<String, Object>(); params.put("user_id", user.getId()); params.put("org_id", user.getOrg().getId()); params.put("label", label); m.executeUpdate(params); }
static void function(User user, String label) { WriteMode m = ModeFactory.getWriteMode(STR, STR); Map<String, Object> params = new HashMap<String, Object>(); params.put(STR, user.getId()); params.put(STR, user.getOrg().getId()); params.put("label", label); m.executeUpdate(params); }
/** * Archives the action set with the given label. * @param user User associated with the set of actions. * @param label Action label to be updated. */
Archives the action set with the given label
archiveActions
{ "repo_name": "ogajduse/spacewalk", "path": "java/code/src/com/redhat/rhn/manager/action/ActionManager.java", "license": "gpl-2.0", "size": 71516 }
[ "com.redhat.rhn.common.db.datasource.ModeFactory", "com.redhat.rhn.common.db.datasource.WriteMode", "com.redhat.rhn.domain.user.User", "java.util.HashMap", "java.util.Map" ]
import com.redhat.rhn.common.db.datasource.ModeFactory; import com.redhat.rhn.common.db.datasource.WriteMode; import com.redhat.rhn.domain.user.User; import java.util.HashMap; import java.util.Map;
import com.redhat.rhn.common.db.datasource.*; import com.redhat.rhn.domain.user.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
1,822,258
public static byte[] encodeAsPNG(BufferedImage image, boolean encodeAlpha, int compression) throws IOException { return EncoderUtil.encode(image, ImageFormat.PNG, compression, encodeAlpha); }
static byte[] function(BufferedImage image, boolean encodeAlpha, int compression) throws IOException { return EncoderUtil.encode(image, ImageFormat.PNG, compression, encodeAlpha); }
/** * Encodes a {@link BufferedImage} to PNG format. * * @param image the image (<code>null</code> not permitted). * @param encodeAlpha encode alpha? * @param compression the PNG compression level (0-9). * * @return The byte array in PNG format. * * @throws IOException if there is an I/O problem. */
Encodes a <code>BufferedImage</code> to PNG format
encodeAsPNG
{ "repo_name": "oskopek/jfreechart-fse", "path": "src/main/java/org/jfree/chart/ChartUtilities.java", "license": "lgpl-2.1", "size": 29584 }
[ "java.awt.image.BufferedImage", "java.io.IOException", "org.jfree.chart.encoders.EncoderUtil", "org.jfree.chart.encoders.ImageFormat" ]
import java.awt.image.BufferedImage; import java.io.IOException; import org.jfree.chart.encoders.EncoderUtil; import org.jfree.chart.encoders.ImageFormat;
import java.awt.image.*; import java.io.*; import org.jfree.chart.encoders.*;
[ "java.awt", "java.io", "org.jfree.chart" ]
java.awt; java.io; org.jfree.chart;
837,322
@Override public void toPNML(FileChannel fc) { // id 1 // idref 0 // attributes 1 // sons 1 final int bufferSizeKB = 8; final int bufferSize = bufferSizeKB * 1024; final ByteBuffer bytebuf = ByteBuffer.allocateDirect(bufferSize); final String charsetEncoding = PNMLEncoding.UTF_8.getName(); Boolean prettyPrintStatus = ModelRepository.getInstance().isPrettyPrintActive(); String retline = ""; String headline = ""; PrettyPrintData prpd = null; if (prettyPrintStatus) { retline = "\n"; prpd = ModelRepository.getInstance().getPrettyPrintData(); headline = prpd.getCurrentLineHeader(); } StringBuilder sb = new StringBuilder(); sb.append(headline); sb.append("<partitionelement"); if (prettyPrintStatus) { headline = prpd.increaseLineHeaderLevel(); } // begin attributes, id and id ref processing if (getId() != null) { sb.append(" id"); sb.append("=\""); sb.append(getId()); sb.append("\""); } if (getName() != null) { sb.append(" name"); sb.append("=\""); sb.append(getName()); sb.append("\""); } boolean haveSons = false; sb.append(">"); sb.append(retline); // sons, follow processing if (getPartitionelementconstants() != null) { try { writeIntoStream(bytebuf, fc, sb.toString().getBytes(Charset.forName(charsetEncoding))); } catch (IOException io) { io.printStackTrace(); // fail fast return; } sb.delete(0, sb.length()); java.util.List<fr.lip6.move.pnml.pthlpng.terms.Term> items = getPartitionelementconstants(); for (Iterator<Term> iterator = items.iterator(); iterator.hasNext();) { Term item = iterator.next(); item.toPNML(fc); haveSons = true; } } if (prettyPrintStatus) { headline = prpd.decreaseLineHeaderLevel(); } sb.append(headline); sb.append("</partitionelement>"); sb.append(retline); try { writeIntoStream(bytebuf, fc, sb.toString().getBytes(Charset.forName(charsetEncoding))); } catch (IOException io) { io.printStackTrace(); // fail fast return; } sb = null; }
void function(FileChannel fc) { final int bufferSizeKB = 8; final int bufferSize = bufferSizeKB * 1024; final ByteBuffer bytebuf = ByteBuffer.allocateDirect(bufferSize); final String charsetEncoding = PNMLEncoding.UTF_8.getName(); Boolean prettyPrintStatus = ModelRepository.getInstance().isPrettyPrintActive(); String retline = STRSTR\nSTR<partitionelementSTR idSTR=\STR\STR nameSTR=\STR\STR>STR</partitionelement>"); sb.append(retline); try { writeIntoStream(bytebuf, fc, sb.toString().getBytes(Charset.forName(charsetEncoding))); } catch (IOException io) { io.printStackTrace(); return; } sb = null; }
/** * Return the string containing the pnml output */
Return the string containing the pnml output
toPNML
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/partitions/impl/PartitionElementImpl.java", "license": "epl-1.0", "size": 22690 }
[ "fr.lip6.move.pnml.framework.utils.ModelRepository", "fr.lip6.move.pnml.framework.utils.PNMLEncoding", "java.io.IOException", "java.nio.ByteBuffer", "java.nio.channels.FileChannel", "java.nio.charset.Charset" ]
import fr.lip6.move.pnml.framework.utils.ModelRepository; import fr.lip6.move.pnml.framework.utils.PNMLEncoding; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.charset.Charset;
import fr.lip6.move.pnml.framework.utils.*; import java.io.*; import java.nio.*; import java.nio.channels.*; import java.nio.charset.*;
[ "fr.lip6.move", "java.io", "java.nio" ]
fr.lip6.move; java.io; java.nio;
1,928,698
public static Integer integerValue(Map<String,?> map, String key) { return integerValue(map, key, null); }
static Integer function(Map<String,?> map, String key) { return integerValue(map, key, null); }
/** * Returns the Integer value of the given property in the map or null */
Returns the Integer value of the given property in the map or null
integerValue
{ "repo_name": "nkasvosve/beyondj", "path": "beyondj-common-util/src/main/java/com/lenox/common/util/Maps.java", "license": "apache-2.0", "size": 5625 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
462,096
@Generated @Selector("sourceTimeRanges") public native NSArray<? extends NSValue> sourceTimeRanges();
@Selector(STR) native NSArray<? extends NSValue> function();
/** * [@property] sourceTimeRanges * <p> * An NSArray of NSValue objects wrapping CMTimeRange structures, each representing one source time range. * <p> * The value of this property is suitable for using as a parameter for -[AVAssetReaderOutput resetForReadingTimeRanges:]. */
[@property] sourceTimeRanges An NSArray of NSValue objects wrapping CMTimeRange structures, each representing one source time range. The value of this property is suitable for using as a parameter for -[AVAssetReaderOutput resetForReadingTimeRanges:]
sourceTimeRanges
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/avfoundation/AVAssetWriterInputPassDescription.java", "license": "apache-2.0", "size": 5544 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
51,723
protected static boolean booleanCompare(Object obj1, Object obj2, int compOp) throws TypeMismatchException { if (!(obj1 instanceof Boolean) || !(obj2 instanceof Boolean)) { throw new TypeMismatchException( "Booleans can only be compared with booleans"); } if (compOp == TOK_EQ) { return obj1.equals(obj2); } else if (compOp == TOK_NE) { return !obj1.equals(obj2); } else { throw new TypeMismatchException( "Boolean values can only be compared with = or <>"); } }
static boolean function(Object obj1, Object obj2, int compOp) throws TypeMismatchException { if (!(obj1 instanceof Boolean) !(obj2 instanceof Boolean)) { throw new TypeMismatchException( STR); } if (compOp == TOK_EQ) { return obj1.equals(obj2); } else if (compOp == TOK_NE) { return !obj1.equals(obj2); } else { throw new TypeMismatchException( STR); } }
/** * Compare two booleans. * * @return a boolean indicating the result of applying the comparison operator on the arguments. * @throws TypeMismatchException When either one of the arguments is not a Boolean, or the * comparison operator is not supported. */
Compare two booleans
booleanCompare
{ "repo_name": "jdeppe-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/cache/query/internal/types/TypeUtils.java", "license": "apache-2.0", "size": 17606 }
[ "org.apache.geode.cache.query.TypeMismatchException" ]
import org.apache.geode.cache.query.TypeMismatchException;
import org.apache.geode.cache.query.*;
[ "org.apache.geode" ]
org.apache.geode;
1,784,168
protected boolean validateSourceStorageDomain() { Guid sourceDomainId = getParameters().getSourceDomainId(); if (sourceDomainId == null || Guid.Empty.equals(sourceDomainId)) { sourceDomainId = getImage().getStorageIds().get(0); getParameters().setSourceDomainId(sourceDomainId); } StorageDomainValidator validator = new StorageDomainValidator(getStorageDomainDao().getForStoragePool(sourceDomainId, getImage().getStoragePoolId())); return validate(validator.isDomainExistAndActive()); }
boolean function() { Guid sourceDomainId = getParameters().getSourceDomainId(); if (sourceDomainId == null Guid.Empty.equals(sourceDomainId)) { sourceDomainId = getImage().getStorageIds().get(0); getParameters().setSourceDomainId(sourceDomainId); } StorageDomainValidator validator = new StorageDomainValidator(getStorageDomainDao().getForStoragePool(sourceDomainId, getImage().getStoragePoolId())); return validate(validator.isDomainExistAndActive()); }
/** * Validate a source storage domain of image, when a source storage domain is not provided * any of the domains image will be used */
Validate a source storage domain of image, when a source storage domain is not provided any of the domains image will be used
validateSourceStorageDomain
{ "repo_name": "yingyun001/ovirt-engine", "path": "backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyDiskCommand.java", "license": "apache-2.0", "size": 22410 }
[ "org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator", "org.ovirt.engine.core.compat.Guid" ]
import org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator; import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.bll.validator.storage.*; import org.ovirt.engine.core.compat.*;
[ "org.ovirt.engine" ]
org.ovirt.engine;
1,353,418
@Override public String toString() { return String.format(Locale.ENGLISH, "QR(%d,%d,fullRank=%s)", originalColumns, originalRows, hasFullRank()); }
String function() { return String.format(Locale.ENGLISH, STR, originalColumns, originalRows, hasFullRank()); }
/** * Returns a rough string rendition of a QR. */
Returns a rough string rendition of a QR
toString
{ "repo_name": "BigData-Lab-Frankfurt/HiBench-DSE", "path": "common/mahout-distribution-0.7-hadoop1/math/src/main/java/org/apache/mahout/math/QRDecomposition.java", "license": "apache-2.0", "size": 7939 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
2,895,096
private static boolean portAvailable(int port) { ServerSocket socket = null; try { socket = new ServerSocket(port); socket.setReuseAddress(true); return true; } catch (IOException e) { // Do not handle exception. } finally { if (socket != null) { try { socket.close(); } catch (IOException e) { // Do not handle exception. } } } return false; }
static boolean function(int port) { ServerSocket socket = null; try { socket = new ServerSocket(port); socket.setReuseAddress(true); return true; } catch (IOException e) { } finally { if (socket != null) { try { socket.close(); } catch (IOException e) { } } } return false; }
/** * Return false if 'port' is already used, true otherwise. */
Return false if 'port' is already used, true otherwise
portAvailable
{ "repo_name": "fengtan/php-builtin-web-server-plugin", "path": "src/main/java/org/jenkinsci/plugins/phpwebserver/beans/PhpWebserver.java", "license": "mit", "size": 1346 }
[ "java.io.IOException", "java.net.ServerSocket" ]
import java.io.IOException; import java.net.ServerSocket;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
1,932,020
public void forceBlock() throws JspException { if (currentState().isBlockTag()) { return; // just ignore since we are already in the block } closeTagAndMarkAsBlock(); }
void function() throws JspException { if (currentState().isBlockTag()) { return; } closeTagAndMarkAsBlock(); }
/** * Indicate that the currently open tag should be closed and marked * as a block level element. * <p>Useful when you plan to write additional content in the body * outside the context of the current {@link TagWriter}. */
Indicate that the currently open tag should be closed and marked as a block level element. Useful when you plan to write additional content in the body outside the context of the current <code>TagWriter</code>
forceBlock
{ "repo_name": "QBNemo/spring-mvc-showcase", "path": "src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java", "license": "apache-2.0", "size": 6956 }
[ "javax.servlet.jsp.JspException" ]
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.*;
[ "javax.servlet" ]
javax.servlet;
344,440
public void sendResponse(String destPeer, ResolverResponseMsg response);
void function(String destPeer, ResolverResponseMsg response);
/** * Send a resolver response. If <tt>destPeer</tt> is <tt>null</tt> then the * response is propagated. Propagated responses are generally announcements * and not responses to active queries. * * @param destPeer The destination peer of the response or <tt>null</tt> if * the response is to be propagated. * @param response The response to be sent. */
Send a resolver response. If destPeer is null then the response is propagated. Propagated responses are generally announcements and not responses to active queries
sendResponse
{ "repo_name": "johnjianfang/jxse", "path": "src/main/java/net/jxta/resolver/ResolverService.java", "license": "apache-2.0", "size": 6962 }
[ "net.jxta.protocol.ResolverResponseMsg" ]
import net.jxta.protocol.ResolverResponseMsg;
import net.jxta.protocol.*;
[ "net.jxta.protocol" ]
net.jxta.protocol;
1,812,959
public void testAndNotPosPosFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; int aSign = 1; int bSign = 1; byte rBytes[] = {73, -92, -48, 4, 12, 6, 4, 32, 48, 64, 0, 8, 2}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.andNot(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals("incorrect sign", 1, result.signum()); }
void function() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; int aSign = 1; int bSign = 1; byte rBytes[] = {73, -92, -48, 4, 12, 6, 4, 32, 48, 64, 0, 8, 2}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.andNot(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, 1, result.signum()); }
/** * andNot for two positive numbers; the first is shorter */
andNot for two positive numbers; the first is shorter
testAndNotPosPosFirstShorter
{ "repo_name": "skyHALud/codenameone", "path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java", "license": "gpl-2.0", "size": 7641 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
2,260,289
public Builder get(String bucket, String blob, BlobSourceOption... options) { toGet.put(BlobInfo.of(bucket, blob), Lists.newArrayList(options)); return this; }
Builder function(String bucket, String blob, BlobSourceOption... options) { toGet.put(BlobInfo.of(bucket, blob), Lists.newArrayList(options)); return this; }
/** * Retrieve metadata for the given blob. */
Retrieve metadata for the given blob
get
{ "repo_name": "dgv3/googlecloudjava", "path": "gcloud-java-storage/src/main/java/com/google/gcloud/storage/BatchRequest.java", "license": "apache-2.0", "size": 3378 }
[ "com.google.common.collect.Lists", "com.google.gcloud.storage.Storage" ]
import com.google.common.collect.Lists; import com.google.gcloud.storage.Storage;
import com.google.common.collect.*; import com.google.gcloud.storage.*;
[ "com.google.common", "com.google.gcloud" ]
com.google.common; com.google.gcloud;
1,022,355
public GlobalId getRight() { return right; }
GlobalId function() { return right; }
/** * GlobalId of right (or current) domain object reference */
GlobalId of right (or current) domain object reference
getRight
{ "repo_name": "ramasinka/javers", "path": "javers-core/src/main/java/org/javers/core/diff/changetype/ReferenceChange.java", "license": "apache-2.0", "size": 2260 }
[ "org.javers.core.metamodel.object.GlobalId" ]
import org.javers.core.metamodel.object.GlobalId;
import org.javers.core.metamodel.object.*;
[ "org.javers.core" ]
org.javers.core;
1,832,895
public AlipayObject getBizModel() { return this.bizModel; }
AlipayObject function() { return this.bizModel; }
/** * <p>Getter for the field <code>bizModel</code>.</p> * * @return a {@link cn.felord.wepay.ali.sdk.api.AlipayObject} object. */
Getter for the field <code>bizModel</code>
getBizModel
{ "repo_name": "NotFound403/WePay", "path": "src/main/java/cn/felord/wepay/ali/sdk/api/request/SsdataDataserviceRiskAlixiaohaoQueryRequest.java", "license": "apache-2.0", "size": 4849 }
[ "cn.felord.wepay.ali.sdk.api.AlipayObject" ]
import cn.felord.wepay.ali.sdk.api.AlipayObject;
import cn.felord.wepay.ali.sdk.api.*;
[ "cn.felord.wepay" ]
cn.felord.wepay;
2,552,907
@Ignore @Test public void testDST() { // VT: NOTE: This test will try to spawn the system browser, or print a link you need to visit to get the callback. // You will need to visit the link on the same box, the callback URL is pointing to 'localhost'. // Make sure you have a browser that can deal with the page (Lynx, as of 2.8.8dev.12, can't deal with the buttons on the callback page. // In the worst case, just @Ignore this test. ThreadContext.push("testDST"); Marker m = new Marker("testDST"); try { Map<Thermostat, String> ts2source = new TreeMap<Thermostat, String>(); // This calendar has to be in Mountain Time Zone with the DST offset present, so do all the events (check individually // if your time zone is different). // It has to contain 24 periods, spanning from $hour to ($hour + 1) (except the last for now, which has to end at 23:59). // Events have to be recurring, with recurrence set to "daily, never expires" (careful: it'll expire in 2 years anyway). Thermostat ts1 = new NullThermostat("DZ Test Case: DST Test (with DST)"); ts2source.put(ts1, ts1.getName()); logger.info("Targets: " + ts2source); ScheduleUpdater updater = new GCalScheduleUpdater(ts2source); long start = System.currentTimeMillis(); Map<Thermostat, SortedMap<Period, ZoneStatus>> schedule = updater.update(); logger.info("Took " + (System.currentTimeMillis() - start) + "ms to complete"); logger.info("Schedule retrieved: " + schedule); SortedMap<Period, ZoneStatus> events = schedule.values().iterator().next(); testEvents(events); } catch (AssertionFailedError ex) { throw ex; } catch (Throwable t) { logger.error("Oops", t); fail("Unexpected exception, see logs"); } finally { m.close(); ThreadContext.pop(); } }
void function() { ThreadContext.push(STR); Marker m = new Marker(STR); try { Map<Thermostat, String> ts2source = new TreeMap<Thermostat, String>(); Thermostat ts1 = new NullThermostat(STR); ts2source.put(ts1, ts1.getName()); logger.info(STR + ts2source); ScheduleUpdater updater = new GCalScheduleUpdater(ts2source); long start = System.currentTimeMillis(); Map<Thermostat, SortedMap<Period, ZoneStatus>> schedule = updater.update(); logger.info(STR + (System.currentTimeMillis() - start) + STR); logger.info(STR + schedule); SortedMap<Period, ZoneStatus> events = schedule.values().iterator().next(); testEvents(events); } catch (AssertionFailedError ex) { throw ex; } catch (Throwable t) { logger.error("Oops", t); fail(STR); } finally { m.close(); ThreadContext.pop(); } }
/** * Test case to reproduce and fix {@link https://github.com/home-climate-control/dz/issues/6}. * * Also see {@link https://github.com/home-climate-control/dz/issues/42}. */
Test case to reproduce and fix <code>HREF>. Also see <code>HREF>
testDST
{ "repo_name": "marcass/dz-1", "path": "dz3-scheduler-gcal-v3/src/test/java/net/sf/dz3/scheduler/gcal/GCalScheduleUpdaterTest.java", "license": "gpl-3.0", "size": 11299 }
[ "java.util.Map", "java.util.SortedMap", "java.util.TreeMap", "junit.framework.AssertionFailedError", "net.sf.dz3.device.model.Thermostat", "net.sf.dz3.device.model.ZoneStatus", "net.sf.dz3.instrumentation.Marker", "net.sf.dz3.scheduler.Period", "net.sf.dz3.scheduler.ScheduleUpdater", "org.apache.logging.log4j.ThreadContext", "org.junit.Assert" ]
import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; import junit.framework.AssertionFailedError; import net.sf.dz3.device.model.Thermostat; import net.sf.dz3.device.model.ZoneStatus; import net.sf.dz3.instrumentation.Marker; import net.sf.dz3.scheduler.Period; import net.sf.dz3.scheduler.ScheduleUpdater; import org.apache.logging.log4j.ThreadContext; import org.junit.Assert;
import java.util.*; import junit.framework.*; import net.sf.dz3.device.model.*; import net.sf.dz3.instrumentation.*; import net.sf.dz3.scheduler.*; import org.apache.logging.log4j.*; import org.junit.*;
[ "java.util", "junit.framework", "net.sf.dz3", "org.apache.logging", "org.junit" ]
java.util; junit.framework; net.sf.dz3; org.apache.logging; org.junit;
731,168
@SuppressWarnings("unchecked") public default THIS withSort(Column<ITEM, ?> column, SortDirection direction) { ((Grid<ITEM>) this).sort(column, direction); return (THIS) this; }
@SuppressWarnings(STR) default THIS function(Column<ITEM, ?> column, SortDirection direction) { ((Grid<ITEM>) this).sort(column, direction); return (THIS) this; }
/** * Sort this Grid in user-specified direction by a column. * * @param column * a column to sort against * @param direction * a sort order value (ascending/descending) * @return this for method chaining * @see Grid#sort(Column, SortDirection) */
Sort this Grid in user-specified direction by a column
withSort
{ "repo_name": "viydaag/vaadin-fluent-api", "path": "src/main/java/com/vaadin/fluent/api/FluentGrid.java", "license": "apache-2.0", "size": 18344 }
[ "com.vaadin.shared.data.sort.SortDirection", "com.vaadin.ui.Grid" ]
import com.vaadin.shared.data.sort.SortDirection; import com.vaadin.ui.Grid;
import com.vaadin.shared.data.sort.*; import com.vaadin.ui.*;
[ "com.vaadin.shared", "com.vaadin.ui" ]
com.vaadin.shared; com.vaadin.ui;
1,447,928
private void resize(int p_71370_1_, int p_71370_2_) { this.displayWidth = p_71370_1_ <= 0 ? 1 : p_71370_1_; this.displayHeight = p_71370_2_ <= 0 ? 1 : p_71370_2_; if (this.currentScreen != null) { ScaledResolution var3 = new ScaledResolution(this, p_71370_1_, p_71370_2_); int var4 = var3.getScaledWidth(); int var5 = var3.getScaledHeight(); this.currentScreen.setWorldAndResolution(this, var4, var5); } this.loadingScreen = new LoadingScreenRenderer(this); this.updateFramebufferSize(); }
void function(int p_71370_1_, int p_71370_2_) { this.displayWidth = p_71370_1_ <= 0 ? 1 : p_71370_1_; this.displayHeight = p_71370_2_ <= 0 ? 1 : p_71370_2_; if (this.currentScreen != null) { ScaledResolution var3 = new ScaledResolution(this, p_71370_1_, p_71370_2_); int var4 = var3.getScaledWidth(); int var5 = var3.getScaledHeight(); this.currentScreen.setWorldAndResolution(this, var4, var5); } this.loadingScreen = new LoadingScreenRenderer(this); this.updateFramebufferSize(); }
/** * Called to resize the current screen. */
Called to resize the current screen
resize
{ "repo_name": "mviitanen/marsmod", "path": "mcp/src/minecraft/net/minecraft/client/Minecraft.java", "license": "gpl-2.0", "size": 118195 }
[ "net.minecraft.client.gui.ScaledResolution" ]
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.*;
[ "net.minecraft.client" ]
net.minecraft.client;
2,112,673
if (node instanceof ObjectNode) { ObjectNode onode = (ObjectNode) node; // If there is only one field, then that field must be a // logical operator String firstField = onode.fieldNames().next(); if (UnaryLogicalOperator.fromString(firstField) != null) { return UnaryLogicalExpression.fromJson(onode); } else if (NaryLogicalOperator.fromString(firstField) != null) { return NaryLogicalExpression.fromJson(onode); } else { return ComparisonExpression.fromJson(onode); } } else { throw Error.get(QueryConstants.ERR_INVALID_QUERY, node.toString()); } }
if (node instanceof ObjectNode) { ObjectNode onode = (ObjectNode) node; String firstField = onode.fieldNames().next(); if (UnaryLogicalOperator.fromString(firstField) != null) { return UnaryLogicalExpression.fromJson(onode); } else if (NaryLogicalOperator.fromString(firstField) != null) { return NaryLogicalExpression.fromJson(onode); } else { return ComparisonExpression.fromJson(onode); } } else { throw Error.get(QueryConstants.ERR_INVALID_QUERY, node.toString()); } }
/** * Parses a query expression from the given json node */
Parses a query expression from the given json node
fromJson
{ "repo_name": "bserdar/lightblue-core", "path": "query-api/src/main/java/com/redhat/lightblue/query/QueryExpression.java", "license": "gpl-3.0", "size": 6634 }
[ "com.fasterxml.jackson.databind.node.ObjectNode", "com.redhat.lightblue.util.Error" ]
import com.fasterxml.jackson.databind.node.ObjectNode; import com.redhat.lightblue.util.Error;
import com.fasterxml.jackson.databind.node.*; import com.redhat.lightblue.util.*;
[ "com.fasterxml.jackson", "com.redhat.lightblue" ]
com.fasterxml.jackson; com.redhat.lightblue;
2,367,714
@Nullable protected OriginName injectCustomOriginName(HttpRequestMessage request) { // override for custom vip injection return null; }
OriginName function(HttpRequestMessage request) { return null; }
/** * Inject your own custom VIP based on your own processing * * Note: this method gets called in the constructor so if overloading it or any methods called within, you cannot * rely on your own constructor parameters. * * @return {@code null} if unused. */
Inject your own custom VIP based on your own processing Note: this method gets called in the constructor so if overloading it or any methods called within, you cannot rely on your own constructor parameters
injectCustomOriginName
{ "repo_name": "Netflix/zuul", "path": "zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java", "license": "apache-2.0", "size": 49043 }
[ "com.netflix.zuul.message.http.HttpRequestMessage", "com.netflix.zuul.origins.OriginName" ]
import com.netflix.zuul.message.http.HttpRequestMessage; import com.netflix.zuul.origins.OriginName;
import com.netflix.zuul.message.http.*; import com.netflix.zuul.origins.*;
[ "com.netflix.zuul" ]
com.netflix.zuul;
1,910,866
public void enableDashedLine(float lineLength, float spaceLength, float phase) { mDashPathEffect = new DashPathEffect(new float[] { lineLength, spaceLength }, phase); }
void function(float lineLength, float spaceLength, float phase) { mDashPathEffect = new DashPathEffect(new float[] { lineLength, spaceLength }, phase); }
/** * Enables the line to be drawn in dashed mode, e.g. like this * "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF. * Keep in mind that hardware acceleration boosts performance. * * @param lineLength the length of the line pieces * @param spaceLength the length of space in between the pieces * @param phase offset, in degrees (normally, use 0) */
Enables the line to be drawn in dashed mode, e.g. like this "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF. Keep in mind that hardware acceleration boosts performance
enableDashedLine
{ "repo_name": "Zhangbaowen13/greenhouse", "path": "MPChartLib/src/com/github/mikephil/charting/data/LineDataSet.java", "license": "apache-2.0", "size": 9893 }
[ "android.graphics.DashPathEffect" ]
import android.graphics.DashPathEffect;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,134,035
public void setInterfaceIp(Ip4Address interfaceIp) { this.interfaceIp = interfaceIp; }
void function(Ip4Address interfaceIp) { this.interfaceIp = interfaceIp; }
/** * Sets interface IP address. * * @param interfaceIp interface IP address */
Sets interface IP address
setInterfaceIp
{ "repo_name": "kuujo/onos", "path": "protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/topology/DefaultIsisLinkInformation.java", "license": "apache-2.0", "size": 4251 }
[ "org.onlab.packet.Ip4Address" ]
import org.onlab.packet.Ip4Address;
import org.onlab.packet.*;
[ "org.onlab.packet" ]
org.onlab.packet;
1,385,198
public void configureConnector(String connName, Map<String, String> connConfig) throws IOException { String url = endpointForResource(String.format("connectors/%s/config", connName)); ObjectMapper mapper = new ObjectMapper(); int status; try { String content = mapper.writeValueAsString(connConfig); status = executePut(url, content); } catch (IOException e) { log.error("Could not execute PUT request to " + url, e); throw e; } if (status >= HttpServletResponse.SC_BAD_REQUEST) { throw new ConnectRestException(status, "Could not execute PUT request"); } }
void function(String connName, Map<String, String> connConfig) throws IOException { String url = endpointForResource(String.format(STR, connName)); ObjectMapper mapper = new ObjectMapper(); int status; try { String content = mapper.writeValueAsString(connConfig); status = executePut(url, content); } catch (IOException e) { log.error(STR + url, e); throw e; } if (status >= HttpServletResponse.SC_BAD_REQUEST) { throw new ConnectRestException(status, STR); } }
/** * Configure a connector. If the connector does not already exist, a new one will be created and * the given configuration will be applied to it. * * @param connName the name of the connector * @param connConfig the intended configuration * @throws IOException if call to the REST api fails. * @throws ConnectRestException if REST api returns error status */
Configure a connector. If the connector does not already exist, a new one will be created and the given configuration will be applied to it
configureConnector
{ "repo_name": "KevinLiLu/kafka", "path": "connect/runtime/src/test/java/org/apache/kafka/connect/util/clusters/EmbeddedConnectCluster.java", "license": "apache-2.0", "size": 20145 }
[ "com.fasterxml.jackson.databind.ObjectMapper", "java.io.IOException", "java.util.Map", "javax.servlet.http.HttpServletResponse", "org.apache.kafka.connect.runtime.rest.errors.ConnectRestException" ]
import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.apache.kafka.connect.runtime.rest.errors.ConnectRestException;
import com.fasterxml.jackson.databind.*; import java.io.*; import java.util.*; import javax.servlet.http.*; import org.apache.kafka.connect.runtime.rest.errors.*;
[ "com.fasterxml.jackson", "java.io", "java.util", "javax.servlet", "org.apache.kafka" ]
com.fasterxml.jackson; java.io; java.util; javax.servlet; org.apache.kafka;
97,334
public SubAwardFDPAgreement getSubAwardFDPAgreement() { return subAwardFDPAgreement; }
SubAwardFDPAgreement function() { return subAwardFDPAgreement; }
/** * Gets the subAwardFDPAgreement attribute. * @return Returns the subAwardFDPAgreement. */
Gets the subAwardFDPAgreement attribute
getSubAwardFDPAgreement
{ "repo_name": "vivantech/kc_fixes", "path": "src/main/java/org/kuali/kra/subawardReporting/printing/service/impl/SubAwardPrintingServiceImpl.java", "license": "apache-2.0", "size": 13209 }
[ "org.kuali.kra.subawardReporting.printing.print.SubAwardFDPAgreement" ]
import org.kuali.kra.subawardReporting.printing.print.SubAwardFDPAgreement;
import org.kuali.kra.*;
[ "org.kuali.kra" ]
org.kuali.kra;
1,509,855