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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
void onSourceInfoRefreshed(long durationUs, boolean isSeekable, boolean isLive); } private static final long DEFAULT_LAST_SAMPLE_DURATION_US = 10000; private static final Map<String, String> ICY_METADATA_HEADERS = createIcyMetadataHeaders(); private static final Format ICY_FORMAT = Format.createSampleFormat("icy", MimeTypes.APPLICATION_ICY, Format.OFFSET_SAMPLE_RELATIVE); private final Uri uri; private final DataSource dataSource; private final DrmSessionManager<?> drmSessionManager; private final LoadErrorHandlingPolicy loadErrorHandlingPolicy; private final EventDispatcher eventDispatcher; private final Listener listener; private final Allocator allocator; @Nullable private final String customCacheKey; private final long continueLoadingCheckIntervalBytes; private final Loader loader; private final ExtractorHolder extractorHolder; private final ConditionVariable loadCondition; private final Runnable maybeFinishPrepareRunnable; private final Runnable onContinueLoadingRequestedRunnable; private final Handler handler; @Nullable private Callback callback; @Nullable private SeekMap seekMap; @Nullable private IcyHeaders icyHeaders; private SampleQueue[] sampleQueues; private TrackId[] sampleQueueTrackIds; private boolean sampleQueuesBuilt; private boolean prepared; @Nullable private PreparedState preparedState; private boolean haveAudioVideoTracks; private int dataType; private boolean seenFirstTrackSelection; private boolean notifyDiscontinuity; private boolean notifiedReadingStarted; private int enabledTrackCount; private long durationUs; private long length; private boolean isLive; private long lastSeekPositionUs; private long pendingResetPositionUs; private boolean pendingDeferredRetry; private int extractedSamplesCountAtStartOfLoad; private boolean loadingFinished; private boolean released; // maybeFinishPrepare is not posted to the handler until initialization completes. @SuppressWarnings({ "nullness:argument.type.incompatible", "nullness:methodref.receiver.bound.invalid" }) public ProgressiveMediaPeriod( Uri uri, DataSource dataSource, Extractor[] extractors, DrmSessionManager<?> drmSessionManager, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Listener listener, Allocator allocator, @Nullable String customCacheKey, int continueLoadingCheckIntervalBytes) { this.uri = uri; this.dataSource = dataSource; this.drmSessionManager = drmSessionManager; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.listener = listener; this.allocator = allocator; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; loader = new Loader("Loader:ProgressiveMediaPeriod"); extractorHolder = new ExtractorHolder(extractors); loadCondition = new ConditionVariable(); maybeFinishPrepareRunnable = this::maybeFinishPrepare; onContinueLoadingRequestedRunnable = () -> { if (!released) { Assertions.checkNotNull(callback) .onContinueLoadingRequested(ProgressiveMediaPeriod.this); } }; handler = new Handler(); sampleQueueTrackIds = new TrackId[0]; sampleQueues = new SampleQueue[0]; pendingResetPositionUs = C.TIME_UNSET; length = C.LENGTH_UNSET; durationUs = C.TIME_UNSET; dataType = C.DATA_TYPE_MEDIA; eventDispatcher.mediaPeriodCreated(); }
void onSourceInfoRefreshed(long durationUs, boolean isSeekable, boolean isLive); } private static final long DEFAULT_LAST_SAMPLE_DURATION_US = 10000; private static final Map<String, String> ICY_METADATA_HEADERS = createIcyMetadataHeaders(); private static final Format ICY_FORMAT = Format.createSampleFormat("icy", MimeTypes.APPLICATION_ICY, Format.OFFSET_SAMPLE_RELATIVE); private final Uri uri; private final DataSource dataSource; private final DrmSessionManager<?> drmSessionManager; private final LoadErrorHandlingPolicy loadErrorHandlingPolicy; private final EventDispatcher eventDispatcher; private final Listener listener; private final Allocator allocator; @Nullable private final String customCacheKey; private final long continueLoadingCheckIntervalBytes; private final Loader loader; private final ExtractorHolder extractorHolder; private final ConditionVariable loadCondition; private final Runnable maybeFinishPrepareRunnable; private final Runnable onContinueLoadingRequestedRunnable; private final Handler handler; @Nullable private Callback callback; @Nullable private SeekMap seekMap; @Nullable private IcyHeaders icyHeaders; private SampleQueue[] sampleQueues; private TrackId[] sampleQueueTrackIds; private boolean sampleQueuesBuilt; private boolean prepared; @Nullable private PreparedState preparedState; private boolean haveAudioVideoTracks; private int dataType; private boolean seenFirstTrackSelection; private boolean notifyDiscontinuity; private boolean notifiedReadingStarted; private int enabledTrackCount; private long durationUs; private long length; private boolean isLive; private long lastSeekPositionUs; private long pendingResetPositionUs; private boolean pendingDeferredRetry; private int extractedSamplesCountAtStartOfLoad; private boolean loadingFinished; private boolean released; @SuppressWarnings({ STR, STR }) public ProgressiveMediaPeriod( Uri uri, DataSource dataSource, Extractor[] extractors, DrmSessionManager<?> drmSessionManager, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Listener listener, Allocator allocator, @Nullable String customCacheKey, int continueLoadingCheckIntervalBytes) { this.uri = uri; this.dataSource = dataSource; this.drmSessionManager = drmSessionManager; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.listener = listener; this.allocator = allocator; this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; loader = new Loader(STR); extractorHolder = new ExtractorHolder(extractors); loadCondition = new ConditionVariable(); maybeFinishPrepareRunnable = this::maybeFinishPrepare; onContinueLoadingRequestedRunnable = () -> { if (!released) { Assertions.checkNotNull(callback) .onContinueLoadingRequested(ProgressiveMediaPeriod.this); } }; handler = new Handler(); sampleQueueTrackIds = new TrackId[0]; sampleQueues = new SampleQueue[0]; pendingResetPositionUs = C.TIME_UNSET; length = C.LENGTH_UNSET; durationUs = C.TIME_UNSET; dataType = C.DATA_TYPE_MEDIA; eventDispatcher.mediaPeriodCreated(); }
/** * Called when the duration, the ability to seek within the period, or the categorization as * live stream changes. * * @param durationUs The duration of the period, or {@link C#TIME_UNSET}. * @param isSeekable Whether the period is seekable. * @param isLive Whether the period is live. */
Called when the duration, the ability to seek within the period, or the categorization as live stream changes
onSourceInfoRefreshed
{ "repo_name": "superbderrick/ExoPlayer", "path": "library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaPeriod.java", "license": "apache-2.0", "size": 42922 }
[ "android.net.Uri", "android.os.Handler", "androidx.annotation.Nullable", "com.google.android.exoplayer2.Format", "com.google.android.exoplayer2.drm.DrmSessionManager", "com.google.android.exoplayer2.extractor.Extractor", "com.google.android.exoplayer2.extractor.SeekMap", "com.google.android.exoplayer2.metadata.icy.IcyHeaders", "com.google.android.exoplayer2.source.MediaSourceEventListener", "com.google.android.exoplayer2.upstream.Allocator", "com.google.android.exoplayer2.upstream.DataSource", "com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy", "com.google.android.exoplayer2.upstream.Loader", "com.google.android.exoplayer2.util.Assertions", "com.google.android.exoplayer2.util.ConditionVariable", "com.google.android.exoplayer2.util.MimeTypes", "java.util.Map" ]
import android.net.Uri; import android.os.Handler; import androidx.annotation.Nullable; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.drm.DrmSessionManager; import com.google.android.exoplayer2.extractor.Extractor; import com.google.android.exoplayer2.extractor.SeekMap; import com.google.android.exoplayer2.metadata.icy.IcyHeaders; import com.google.android.exoplayer2.source.MediaSourceEventListener; import com.google.android.exoplayer2.upstream.Allocator; import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy; import com.google.android.exoplayer2.upstream.Loader; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.ConditionVariable; import com.google.android.exoplayer2.util.MimeTypes; import java.util.Map;
import android.net.*; import android.os.*; import androidx.annotation.*; import com.google.android.exoplayer2.*; import com.google.android.exoplayer2.drm.*; import com.google.android.exoplayer2.extractor.*; import com.google.android.exoplayer2.metadata.icy.*; import com.google.android.exoplayer2.source.*; import com.google.android.exoplayer2.upstream.*; import com.google.android.exoplayer2.util.*; import java.util.*;
[ "android.net", "android.os", "androidx.annotation", "com.google.android", "java.util" ]
android.net; android.os; androidx.annotation; com.google.android; java.util;
2,451,169
void findUnknownTables(String catName, String dbName, List<String> tables, CheckResult result) throws IOException, MetaException, TException { Set<Path> dbPaths = new HashSet<>(); Set<String> tableNames = new HashSet<>(tables); for (String tableName : tables) { Table table = getMsc().getTable(catName, dbName, tableName); // hack, instead figure out a way to get the db paths String isExternal = table.getParameters().get("EXTERNAL"); if (!"TRUE".equalsIgnoreCase(isExternal)) { Path tablePath = getPath(table); if (tablePath != null) { dbPaths.add(tablePath.getParent()); } } } for (Path dbPath : dbPaths) { FileSystem fs = dbPath.getFileSystem(conf); FileStatus[] statuses = fs.listStatus(dbPath, FileUtils.HIDDEN_FILES_PATH_FILTER); for (FileStatus status : statuses) { if (status.isDirectory() && !tableNames.contains(status.getPath().getName())) { result.getTablesNotInMs().add(status.getPath().getName()); } } } }
void findUnknownTables(String catName, String dbName, List<String> tables, CheckResult result) throws IOException, MetaException, TException { Set<Path> dbPaths = new HashSet<>(); Set<String> tableNames = new HashSet<>(tables); for (String tableName : tables) { Table table = getMsc().getTable(catName, dbName, tableName); String isExternal = table.getParameters().get(STR); if (!"TRUE".equalsIgnoreCase(isExternal)) { Path tablePath = getPath(table); if (tablePath != null) { dbPaths.add(tablePath.getParent()); } } } for (Path dbPath : dbPaths) { FileSystem fs = dbPath.getFileSystem(conf); FileStatus[] statuses = fs.listStatus(dbPath, FileUtils.HIDDEN_FILES_PATH_FILTER); for (FileStatus status : statuses) { if (status.isDirectory() && !tableNames.contains(status.getPath().getName())) { result.getTablesNotInMs().add(status.getPath().getName()); } } } }
/** * Check for table directories that aren't in the metastore. * * @param catName * name of the catalog, if not specified default catalog will be used. * @param dbName * Name of the database * @param tables * List of table names * @param result * Add any found tables to this * @throws IOException * Most likely filesystem related * @throws MetaException * Failed to get required information from the metastore. * @throws NoSuchObjectException * Failed to get required information from the metastore. * @throws TException * Thrift communication error. */
Check for table directories that aren't in the metastore
findUnknownTables
{ "repo_name": "sankarh/hive", "path": "standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreChecker.java", "license": "apache-2.0", "size": 28341 }
[ "java.io.IOException", "java.util.HashSet", "java.util.List", "java.util.Set", "org.apache.hadoop.fs.FileStatus", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hive.metastore.api.MetaException", "org.apache.hadoop.hive.metastore.api.Table", "org.apache.hadoop.hive.metastore.utils.FileUtils", "org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils", "org.apache.thrift.TException" ]
import java.io.IOException; import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.utils.FileUtils; import org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils; import org.apache.thrift.TException;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.metastore.utils.*; import org.apache.thrift.*;
[ "java.io", "java.util", "org.apache.hadoop", "org.apache.thrift" ]
java.io; java.util; org.apache.hadoop; org.apache.thrift;
587,144
private static String attributeToNative(String oldName, Location loc, boolean isLateBound) throws EvalException { if (oldName.isEmpty()) { throw new EvalException(loc, "Attribute name cannot be empty"); } if (isLateBound) { if (oldName.charAt(0) != '_') { throw new EvalException(loc, "When an attribute value is a function, " + "the attribute must be private (start with '_')"); } return ":" + oldName.substring(1); } if (oldName.charAt(0) == '_') { return "$" + oldName.substring(1); } return oldName; } // TODO(bazel-team): implement attribute copy and other rule properties
static String function(String oldName, Location loc, boolean isLateBound) throws EvalException { if (oldName.isEmpty()) { throw new EvalException(loc, STR); } if (isLateBound) { if (oldName.charAt(0) != '_') { throw new EvalException(loc, STR + STR); } return ":" + oldName.substring(1); } if (oldName.charAt(0) == '_') { return "$" + oldName.substring(1); } return oldName; }
/** * In native code, private values start with $. * In Skylark, private values start with _, because of the grammar. */
In native code, private values start with $. In Skylark, private values start with _, because of the grammar
attributeToNative
{ "repo_name": "rhuss/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java", "license": "apache-2.0", "size": 25357 }
[ "com.google.devtools.build.lib.events.Location", "com.google.devtools.build.lib.syntax.EvalException" ]
import com.google.devtools.build.lib.events.Location; import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.events.*; import com.google.devtools.build.lib.syntax.*;
[ "com.google.devtools" ]
com.google.devtools;
427,114
//------------------------------------------------------------------------- public static SinglePayment of(Currency currency, double amount, LocalDate paymentDate) { return new SinglePayment(CurrencyAmount.of(currency, amount), paymentDate); }
static SinglePayment function(Currency currency, double amount, LocalDate paymentDate) { return new SinglePayment(CurrencyAmount.of(currency, amount), paymentDate); }
/** * Creates an instance. * * @param currency the currency * @param amount the amount * @param paymentDate the payment date * @return the payment instance */
Creates an instance
of
{ "repo_name": "nssales/Strata", "path": "modules/finance/src/main/java/com/opengamma/strata/finance/credit/SinglePayment.java", "license": "apache-2.0", "size": 11885 }
[ "com.opengamma.strata.basics.currency.Currency", "com.opengamma.strata.basics.currency.CurrencyAmount", "java.time.LocalDate" ]
import com.opengamma.strata.basics.currency.Currency; import com.opengamma.strata.basics.currency.CurrencyAmount; import java.time.LocalDate;
import com.opengamma.strata.basics.currency.*; import java.time.*;
[ "com.opengamma.strata", "java.time" ]
com.opengamma.strata; java.time;
2,407,538
public Observable<ServiceResponse<Page<DedicatedHostGroupInner>>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<DedicatedHostGroupInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response to get the next page of dedicated host groups. * ServiceResponse<PageImpl1<DedicatedHostGroupInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;DedicatedHostGroupInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response to get the next page of dedicated host groups
listByResourceGroupNextSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/compute/mgmt-v2019_03_01/src/main/java/com/microsoft/azure/management/compute/v2019_03_01/implementation/DedicatedHostGroupsInner.java", "license": "mit", "size": 54449 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
370,852
public Iterator getFooterSnippets() { return getSnippets(REGION_FOOTER); } private class PageRegionIterator extends IteratorFilter { int region; public PageRegionIterator(int region) { super(snippets.iterator()); this.region = region; init(); }
Iterator function() { return getSnippets(REGION_FOOTER); } private class PageRegionIterator extends IteratorFilter { int region; public PageRegionIterator(int region) { super(snippets.iterator()); this.region = region; init(); }
/** Return an iterator containing the snippets in the content region of * the page. */
Return an iterator containing the snippets in the content region of
getFooterSnippets
{ "repo_name": "superzadeh/processdash", "path": "src/net/sourceforge/processdash/net/cms/PageContentTO.java", "license": "gpl-3.0", "size": 4838 }
[ "java.util.Iterator", "net.sourceforge.processdash.util.IteratorFilter" ]
import java.util.Iterator; import net.sourceforge.processdash.util.IteratorFilter;
import java.util.*; import net.sourceforge.processdash.util.*;
[ "java.util", "net.sourceforge.processdash" ]
java.util; net.sourceforge.processdash;
470,121
public void mouseMoved(MouseEvent e) { int x = e.getX(); int y = e.getY(); // Don't show anything out of the plot region. if ((x > border.left) && (x < border.left + width) && (y > border.top) && (y < border.top + height)) { // Convert the X to an index on the histogram. x = (x - border.left) / binWidth; y = counts[x]; setToolTipText((indexMultiplier * x) + ": " + y); } else { setToolTipText(null); } }
void function(MouseEvent e) { int x = e.getX(); int y = e.getY(); if ((x > border.left) && (x < border.left + width) && (y > border.top) && (y < border.top + height)) { x = (x - border.left) / binWidth; y = counts[x]; setToolTipText((indexMultiplier * x) + STR + y); } else { setToolTipText(null); } }
/** * This method will be called when the mouse is moved over the component. It * will set the tooltip text on the component to show the histogram data. */
This method will be called when the mouse is moved over the component. It will set the tooltip text on the component to show the histogram data
mouseMoved
{ "repo_name": "JGeraldoLima/projetoIA2015_2", "path": "ProcessamentoImagens/src/com/util/DisplayGrayHistogram.java", "license": "mit", "size": 8434 }
[ "java.awt.event.MouseEvent" ]
import java.awt.event.MouseEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,965,087
public AxisLocation getDomainAxisLocation(int index) { AxisLocation result = null; if (index < this.domainAxisLocations.size()) { result = (AxisLocation) this.domainAxisLocations.get(index); } if (result == null) { result = AxisLocation.getOpposite(getDomainAxisLocation()); } return result; } /** * Sets the location for a domain axis and sends a {@link PlotChangeEvent}
AxisLocation function(int index) { AxisLocation result = null; if (index < this.domainAxisLocations.size()) { result = (AxisLocation) this.domainAxisLocations.get(index); } if (result == null) { result = AxisLocation.getOpposite(getDomainAxisLocation()); } return result; } /** * Sets the location for a domain axis and sends a {@link PlotChangeEvent}
/** * Returns the location for a domain axis. If this hasn't been set * explicitly, the method returns the location that is opposite to the * primary domain axis location. * * @param index the axis index. * * @return The location (never <code>null</code>). */
Returns the location for a domain axis. If this hasn't been set explicitly, the method returns the location that is opposite to the primary domain axis location
getDomainAxisLocation
{ "repo_name": "raedle/univis", "path": "lib/jfreechart-1.0.1/src/org/jfree/chart/plot/XYPlot.java", "license": "lgpl-2.1", "size": 137931 }
[ "org.jfree.chart.axis.AxisLocation", "org.jfree.chart.event.PlotChangeEvent" ]
import org.jfree.chart.axis.AxisLocation; import org.jfree.chart.event.PlotChangeEvent;
import org.jfree.chart.axis.*; import org.jfree.chart.event.*;
[ "org.jfree.chart" ]
org.jfree.chart;
2,480,533
public ComposeableAdapterFactory getRootAdapterFactory() { return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); }
ComposeableAdapterFactory function() { return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); }
/** * This returns the root adapter factory that contains this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This returns the root adapter factory that contains this factory.
getRootAdapterFactory
{ "repo_name": "TristanFAURE/query2Table", "path": "plugins/org.topcased.model2doc.query2table.edit/src/org/topcased/model2doc/query2table/provider/Query2tableItemProviderAdapterFactory.java", "license": "epl-1.0", "size": 11163 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,138,491
public Accessible getAccessibleChild(int i) { return null; }
Accessible function(int i) { return null; }
/** * Returns <code>null</code> since list children don't have children * themselves. * * @return <code>null</code> */
Returns <code>null</code> since list children don't have children themselves
getAccessibleChild
{ "repo_name": "taciano-perez/JamVM-PH", "path": "src/classpath/javax/swing/JList.java", "license": "gpl-2.0", "size": 78269 }
[ "javax.accessibility.Accessible" ]
import javax.accessibility.Accessible;
import javax.accessibility.*;
[ "javax.accessibility" ]
javax.accessibility;
315,034
private void sendPlaybackStartedEvent(AvsItem item){ alexaManager.sendPlaybackStartedEvent(item, 0, null); Log.i(TAG, "Sending SpeechStartedEvent"); }
void function(AvsItem item){ alexaManager.sendPlaybackStartedEvent(item, 0, null); Log.i(TAG, STR); }
/** * Send an event back to Alexa that we're starting a speech event * https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/reference/audioplayer#PlaybackNearlyFinished Event */
Send an event back to Alexa that we're starting a speech event HREF Event
sendPlaybackStartedEvent
{ "repo_name": "thebayesianconspiracy/gringottsApp", "path": "app/src/main/java/com/willblaschko/android/alexavoicelibrary/BaseActivity.java", "license": "gpl-2.0", "size": 19806 }
[ "android.util.Log", "com.willblaschko.android.alexa.interfaces.AvsItem" ]
import android.util.Log; import com.willblaschko.android.alexa.interfaces.AvsItem;
import android.util.*; import com.willblaschko.android.alexa.interfaces.*;
[ "android.util", "com.willblaschko.android" ]
android.util; com.willblaschko.android;
2,598,012
public static <K,V> Object getByPath(Map<K,V> receiver, String path) { return getByPathDispatch(receiver, splitPath(path), 0, throwCantFindValue(path)); }
static <K,V> Object function(Map<K,V> receiver, String path) { return getByPathDispatch(receiver, splitPath(path), 0, throwCantFindValue(path)); }
/** * Same as {@link #getByPath(List, String)}, but for Map. */
Same as <code>#getByPath(List, String)</code>, but for Map
getByPath
{ "repo_name": "nknize/elasticsearch", "path": "modules/lang-painless/src/main/java/org/elasticsearch/painless/api/Augmentation.java", "license": "apache-2.0", "size": 28336 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,020,113
public ViewGroup.LayoutParams getChildLayoutParams(WXComponent child, View childView, int width, int height, int left, int right, int top, int bottom) { ViewGroup.LayoutParams lp = null; if (childView != null) { lp = childView.getLayoutParams(); } if(lp == null) { lp = new ViewGroup.LayoutParams(width,height); }else{ lp.width = width; lp.height = height; if(lp instanceof ViewGroup.MarginLayoutParams){ ((ViewGroup.MarginLayoutParams) lp).setMargins(left,top,right,bottom); } } return lp; }
ViewGroup.LayoutParams function(WXComponent child, View childView, int width, int height, int left, int right, int top, int bottom) { ViewGroup.LayoutParams lp = null; if (childView != null) { lp = childView.getLayoutParams(); } if(lp == null) { lp = new ViewGroup.LayoutParams(width,height); }else{ lp.width = width; lp.height = height; if(lp instanceof ViewGroup.MarginLayoutParams){ ((ViewGroup.MarginLayoutParams) lp).setMargins(left,top,right,bottom); } } return lp; }
/** * Get or generate new layout parameter for child view */
Get or generate new layout parameter for child view
getChildLayoutParams
{ "repo_name": "cxfeng1/incubator-weex", "path": "android/sdk/src/main/java/com/taobao/weex/ui/component/WXVContainer.java", "license": "apache-2.0", "size": 17320 }
[ "android.view.View", "android.view.ViewGroup" ]
import android.view.View; import android.view.ViewGroup;
import android.view.*;
[ "android.view" ]
android.view;
2,892,060
public static String getSHA1Checksum(File file) throws IOException, NoSuchAlgorithmException { byte[] b = getChecksum("SHA1", file); return getHex(b); } private static final String HEXES = "0123456789ABCDEF";
static String function(File file) throws IOException, NoSuchAlgorithmException { byte[] b = getChecksum("SHA1", file); return getHex(b); } private static final String HEXES = STR;
/** * Calculates the SHA1 checksum of a specified file. * * @param file the file to generate the MD5 checksum * @return the hex representation of the SHA1 hash * @throws IOException when the file passed in does not exist * @throws NoSuchAlgorithmException when the SHA1 algorithm is not available */
Calculates the SHA1 checksum of a specified file
getSHA1Checksum
{ "repo_name": "simon-eastwood/DependencyCheckCM", "path": "dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java", "license": "apache-2.0", "size": 5353 }
[ "java.io.File", "java.io.IOException", "java.security.NoSuchAlgorithmException" ]
import java.io.File; import java.io.IOException; import java.security.NoSuchAlgorithmException;
import java.io.*; import java.security.*;
[ "java.io", "java.security" ]
java.io; java.security;
2,125,693
public static String formatToHtml(Map<String, String> infos, Type type) { final StringBuilder res = new StringBuilder(); final String[] fields; final String[] fieldsGetConfig = { "bytecode_revision", "wifi_ssid", "wifi_crypt", "net_dhcp", "net_ip", "net_mask", "net_gateway", "net_dns", "server_url", "login", "proxy_enabled", "proxy_ip", "proxy_port" }; final String[] fieldsGetRunningState = { "connection_mode", "net_ip", "net_mask", "net_gateway", "net_dns", "sState", "sResource", "gItState", "gSleepState", "gStreamingState", "gProcessingState", "gProcessingWaitState", "gBusyState", "gItApp" }; switch (type) { case getConfig: fields = fieldsGetConfig; break; case getRunningState: fields = fieldsGetRunningState; break; default: fields = new String[0]; } res.append("<table>"); for (final String key : fields) { res.append("<tr><td>"); res.append(key); res.append("</td><td>"); res.append(infos.get(key)); res.append("</td></tr>"); } res.append("</table>"); return res.toString(); }
static String function(Map<String, String> infos, Type type) { final StringBuilder res = new StringBuilder(); final String[] fields; final String[] fieldsGetConfig = { STR, STR, STR, STR, STR, STR, STR, STR, STR, "login", STR, STR, STR }; final String[] fieldsGetRunningState = { STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR }; switch (type) { case getConfig: fields = fieldsGetConfig; break; case getRunningState: fields = fieldsGetRunningState; break; default: fields = new String[0]; } res.append(STR); for (final String key : fields) { res.append(STR); res.append(key); res.append(STR); res.append(infos.get(key)); res.append(STR); } res.append(STR); return res.toString(); }
/** * Fonction utilitaire pour permettre d'afficher un paquet sous forme HTML * * @return la représentation du paquet en html */
Fonction utilitaire pour permettre d'afficher un paquet sous forme HTML
formatToHtml
{ "repo_name": "sebastienhouzet/nabaztag-source-code", "path": "server/OS/net/violet/platform/xmpp/packet/IQCommandPacket.java", "license": "mit", "size": 5121 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,485,355
public static java.util.List getCategoryGroups(java.lang.String param0) { org.sakaiproject.component.api.ServerConfigurationService service = getInstance(); if (service == null) return null; return service.getCategoryGroups(param0); }
static java.util.List function(java.lang.String param0) { org.sakaiproject.component.api.ServerConfigurationService service = getInstance(); if (service == null) return null; return service.getCategoryGroups(param0); }
/** * Access the list of groups by category (site type) * * @param category * The tool category * @return An ordered list of tool ids (String) indicating the desired tool display order, or an empty list if there are none for this category. */
Access the list of groups by category (site type)
getCategoryGroups
{ "repo_name": "harfalm/Sakai-10.1", "path": "kernel/component-manager/src/main/java/org/sakaiproject/component/cover/ServerConfigurationService.java", "license": "apache-2.0", "size": 10764 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,783,497
public void testAddVirtualMachine() { VirtualMachineMetaData virtualMachine = new VirtualMachineMetaData(); virtualMachine.getVirtualMachineLocation().setVirtualMachineId("test-vm"); virtualMachine.getVirtualMachineLocation().setGroupManagerId("gm1"); virtualMachine.getVirtualMachineLocation().setLocalControllerId("lc1"); repository_.addVirtualMachine(virtualMachine); // Check the database HColumnFamily<String, String> columnFamily = new HColumnFamilyImpl<String, String>( keyspace_, CassandraUtils.VIRTUALMACHINES_CF, StringSerializer.get(), StringSerializer.get()); columnFamily.addKey("test-vm"); columnFamily.addColumnName("ipAddress") .addColumnName("xmlRepresentation") .addColumnName("status") .addColumnName("errorCode") .addColumnName("groupManager") .addColumnName("localController"); String ipAddress = columnFamily.getString("ipAddress"); assertEquals(Globals.DEFAULT_INITIALIZATION, ipAddress); String xmlRepresentation = columnFamily.getString("xmlRepresentation"); assertEquals(Globals.DEFAULT_INITIALIZATION, xmlRepresentation); VirtualMachineStatus status = VirtualMachineStatus.valueOf(columnFamily.getString("status")); assertEquals(VirtualMachineStatus.UNKNOWN, status); VirtualMachineErrorCode errorCode = VirtualMachineErrorCode.valueOf(columnFamily.getString("errorCode")); assertEquals(VirtualMachineErrorCode.UNKNOWN, errorCode); String groupManager = columnFamily.getString("groupManager"); assertEquals("gm1", groupManager); String localController = columnFamily.getString("localController"); assertEquals("lc1", localController); }
void function() { VirtualMachineMetaData virtualMachine = new VirtualMachineMetaData(); virtualMachine.getVirtualMachineLocation().setVirtualMachineId(STR); virtualMachine.getVirtualMachineLocation().setGroupManagerId("gm1"); virtualMachine.getVirtualMachineLocation().setLocalControllerId("lc1"); repository_.addVirtualMachine(virtualMachine); HColumnFamily<String, String> columnFamily = new HColumnFamilyImpl<String, String>( keyspace_, CassandraUtils.VIRTUALMACHINES_CF, StringSerializer.get(), StringSerializer.get()); columnFamily.addKey(STR); columnFamily.addColumnName(STR) .addColumnName(STR) .addColumnName(STR) .addColumnName(STR) .addColumnName(STR) .addColumnName(STR); String ipAddress = columnFamily.getString(STR); assertEquals(Globals.DEFAULT_INITIALIZATION, ipAddress); String xmlRepresentation = columnFamily.getString(STR); assertEquals(Globals.DEFAULT_INITIALIZATION, xmlRepresentation); VirtualMachineStatus status = VirtualMachineStatus.valueOf(columnFamily.getString(STR)); assertEquals(VirtualMachineStatus.UNKNOWN, status); VirtualMachineErrorCode errorCode = VirtualMachineErrorCode.valueOf(columnFamily.getString(STR)); assertEquals(VirtualMachineErrorCode.UNKNOWN, errorCode); String groupManager = columnFamily.getString(STR); assertEquals("gm1", groupManager); String localController = columnFamily.getString(STR); assertEquals("lc1", localController); }
/** * Adds a virtual machine. */
Adds a virtual machine
testAddVirtualMachine
{ "repo_name": "snoozesoftware/snoozenode", "path": "src/test/java/org/inria/myriads/snoozenode/database/api/impl/cassandra/TestGroupManagerCassandraRepository.java", "license": "gpl-2.0", "size": 39999 }
[ "me.prettyprint.cassandra.serializers.StringSerializer", "me.prettyprint.cassandra.service.HColumnFamilyImpl", "me.prettyprint.hector.api.HColumnFamily", "org.inria.myriads.snoozecommon.communication.virtualcluster.VirtualMachineMetaData", "org.inria.myriads.snoozecommon.communication.virtualcluster.status.VirtualMachineErrorCode", "org.inria.myriads.snoozecommon.communication.virtualcluster.status.VirtualMachineStatus", "org.inria.myriads.snoozecommon.globals.Globals", "org.inria.myriads.snoozenode.database.api.impl.cassandra.utils.CassandraUtils" ]
import me.prettyprint.cassandra.serializers.StringSerializer; import me.prettyprint.cassandra.service.HColumnFamilyImpl; import me.prettyprint.hector.api.HColumnFamily; import org.inria.myriads.snoozecommon.communication.virtualcluster.VirtualMachineMetaData; import org.inria.myriads.snoozecommon.communication.virtualcluster.status.VirtualMachineErrorCode; import org.inria.myriads.snoozecommon.communication.virtualcluster.status.VirtualMachineStatus; import org.inria.myriads.snoozecommon.globals.Globals; import org.inria.myriads.snoozenode.database.api.impl.cassandra.utils.CassandraUtils;
import me.prettyprint.cassandra.serializers.*; import me.prettyprint.cassandra.service.*; import me.prettyprint.hector.api.*; import org.inria.myriads.snoozecommon.communication.virtualcluster.*; import org.inria.myriads.snoozecommon.communication.virtualcluster.status.*; import org.inria.myriads.snoozecommon.globals.*; import org.inria.myriads.snoozenode.database.api.impl.cassandra.utils.*;
[ "me.prettyprint.cassandra", "me.prettyprint.hector", "org.inria.myriads" ]
me.prettyprint.cassandra; me.prettyprint.hector; org.inria.myriads;
1,947,105
EReference getODSchema_EntityContainer();
EReference getODSchema_EntityContainer();
/** * Returns the meta object for the containment reference '{@link edm.ODSchema#getEntityContainer <em>Entity Container</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Entity Container</em>'. * @see edm.ODSchema#getEntityContainer() * @see #getODSchema() * @generated */
Returns the meta object for the containment reference '<code>edm.ODSchema#getEntityContainer Entity Container</code>'.
getODSchema_EntityContainer
{ "repo_name": "SOM-Research/odata-generator", "path": "metamodel/som.odata.metamodel/src/edm/EdmPackage.java", "license": "epl-1.0", "size": 93631 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,599,327
public static void setViewValues(DirectionStep step, ImageView image, TextView text, TextView distance) { if (step != null) { image.setImageResource( Constants.BEARINGS[step.rel_direction].getImageId()); try { text.setText(Html.fromHtml(step.text())); } catch (NullPointerException e) { if (Constants.DEBUG) { Log.e("Route Step Error", "No Direction Text"); } } distance.setText(step.getStepDistance()); } }
static void function(DirectionStep step, ImageView image, TextView text, TextView distance) { if (step != null) { image.setImageResource( Constants.BEARINGS[step.rel_direction].getImageId()); try { text.setText(Html.fromHtml(step.text())); } catch (NullPointerException e) { if (Constants.DEBUG) { Log.e(STR, STR); } } distance.setText(step.getStepDistance()); } }
/** * Populates the given views with the direction step information. * @param step the direction step used to populate the view * @param image view that will hold the direction icon * @param text text view that will show the direction text * @param distance text view that will show the direction distance */
Populates the given views with the direction step information
setViewValues
{ "repo_name": "lbouma/Cyclopath", "path": "android/src/org/cyclopath/android/DirectionAdapter.java", "license": "apache-2.0", "size": 2958 }
[ "android.text.Html", "android.util.Log", "android.widget.ImageView", "android.widget.TextView", "org.cyclopath.android.conf.Constants", "org.cyclopath.android.items.DirectionStep" ]
import android.text.Html; import android.util.Log; import android.widget.ImageView; import android.widget.TextView; import org.cyclopath.android.conf.Constants; import org.cyclopath.android.items.DirectionStep;
import android.text.*; import android.util.*; import android.widget.*; import org.cyclopath.android.conf.*; import org.cyclopath.android.items.*;
[ "android.text", "android.util", "android.widget", "org.cyclopath.android" ]
android.text; android.util; android.widget; org.cyclopath.android;
1,844,905
public void load(String file) throws FileNotFoundException, IOException, InvalidConfigurationException { Preconditions.checkNotNull(file, "File cannot be null"); load(new File(file)); }
void function(String file) throws FileNotFoundException, IOException, InvalidConfigurationException { Preconditions.checkNotNull(file, STR); load(new File(file)); }
/** * Loads this {@link FileConfiguration} from the specified location. * <p /> * All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given file. * <p /> * If the file cannot be loaded for any reason, an exception will be thrown. * * @param file * File to load from. * @throws FileNotFoundException * Thrown when the given file cannot be opened. * @throws IOException * Thrown when the given file cannot be read. * @throws InvalidConfigurationException * Thrown when the given file is not a valid Configuration. * @throws IllegalArgumentException * Thrown when file is null. */
Loads this <code>FileConfiguration</code> from the specified location. All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given file. If the file cannot be loaded for any reason, an exception will be thrown
load
{ "repo_name": "HexogenDev/CyanWool-Platform", "path": "src/main/java/net/cyanwool/platform/configuration/file/FileConfiguration.java", "license": "mit", "size": 7469 }
[ "com.google.common.base.Preconditions", "java.io.File", "java.io.FileNotFoundException", "java.io.IOException", "net.cyanwool.platform.configuration.InvalidConfigurationException" ]
import com.google.common.base.Preconditions; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import net.cyanwool.platform.configuration.InvalidConfigurationException;
import com.google.common.base.*; import java.io.*; import net.cyanwool.platform.configuration.*;
[ "com.google.common", "java.io", "net.cyanwool.platform" ]
com.google.common; java.io; net.cyanwool.platform;
1,231,804
@SuppressWarnings("unchecked") public void removeEffect(String iEffect, IEffectConsumer consumer, IEffectSourceProvider effectSource) { IEffectContainer effect = consumer.getEffect(iEffect); if (effect != null) { Iterator<IEffect> iterator = effect.getEffects().iterator(); IEffect e; while (iterator.hasNext()) { e = iterator.next(); if (e.getEffectSourceProvider() == effectSource) { removeEffectContainer(effect, e, consumer); stopEffect(e); } } } }
@SuppressWarnings(STR) void function(String iEffect, IEffectConsumer consumer, IEffectSourceProvider effectSource) { IEffectContainer effect = consumer.getEffect(iEffect); if (effect != null) { Iterator<IEffect> iterator = effect.getEffects().iterator(); IEffect e; while (iterator.hasNext()) { e = iterator.next(); if (e.getEffectSourceProvider() == effectSource) { removeEffectContainer(effect, e, consumer); stopEffect(e); } } } }
/** * Removes and stops the effect previously applied as item enchantement * * @param iEffect * @param consumer */
Removes and stops the effect previously applied as item enchantement
removeEffect
{ "repo_name": "NeumimTo/NT-RPG", "path": "Plugin/src/main/java/cz/neumimto/rpg/effects/EffectService.java", "license": "gpl-2.0", "size": 13324 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,169,646
public void accept(PrintComponentVisitor visitor) { visitor.visit(this); }
void function(PrintComponentVisitor visitor) { visitor.visit(this); }
/** * Call back visitor. * * @param visitor */
Call back visitor
accept
{ "repo_name": "lat-lon/geomajas", "path": "plugin/geomajas-plugin-printing/printing/src/main/java/org/geomajas/plugin/printing/component/impl/AbstractLegendComponentImpl.java", "license": "agpl-3.0", "size": 5780 }
[ "org.geomajas.plugin.printing.component.PrintComponentVisitor" ]
import org.geomajas.plugin.printing.component.PrintComponentVisitor;
import org.geomajas.plugin.printing.component.*;
[ "org.geomajas.plugin" ]
org.geomajas.plugin;
1,006,775
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<QueryTextInner> listByServer( String resourceGroupName, String serverName, List<String> queryIds) { return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, queryIds)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<QueryTextInner> function( String resourceGroupName, String serverName, List<String> queryIds) { return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, queryIds)); }
/** * Retrieve the Query-Store query texts for specified queryIds. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param queryIds The query identifiers. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of query texts. */
Retrieve the Query-Store query texts for specified queryIds
listByServer
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsClientImpl.java", "license": "mit", "size": 25663 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.mariadb.fluent.models.QueryTextInner", "java.util.List" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.mariadb.fluent.models.QueryTextInner; import java.util.List;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.mariadb.fluent.models.*; import java.util.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.util" ]
com.azure.core; com.azure.resourcemanager; java.util;
163,375
public void testSkipRunFailsOnOnlyExecutionAttemptNoAutoPurge(HttpServletRequest request, PrintWriter out) throws Exception { SharedCounterTask.counter.set(0); NonSerializableTaskAndResult task = new NonSerializableTaskAndResult(); ImmediateSkippingTrigger trigger = new ImmediateSkippingTrigger(1); trigger.skipExecutionAttemptsWithFailure.add(1); TaskStatus<?> status = scheduler.schedule(task, trigger); for (long start = System.nanoTime(); !status.hasResult() && System.nanoTime() - start < TIMEOUT_NS_DISK_WRITE_PATH; Thread.sleep(POLL_INTERVAL)) status = scheduler.getStatus(status.getTaskId()); if (!status.isDone() || status.isCancelled()) throw new Exception("Task did not complete successfully. " + status); try { Object result = status.get(); throw new Exception("Expecting the only execution attempt to be skipped. Instead result is: " + result); } catch (SkippedException x) { if (!(x.getCause() instanceof ArrayIndexOutOfBoundsException) || x.getCause().getMessage() == null || x.getCause().getMessage().indexOf(" 1.") < 0) throw x; } }
void function(HttpServletRequest request, PrintWriter out) throws Exception { SharedCounterTask.counter.set(0); NonSerializableTaskAndResult task = new NonSerializableTaskAndResult(); ImmediateSkippingTrigger trigger = new ImmediateSkippingTrigger(1); trigger.skipExecutionAttemptsWithFailure.add(1); TaskStatus<?> status = scheduler.schedule(task, trigger); for (long start = System.nanoTime(); !status.hasResult() && System.nanoTime() - start < TIMEOUT_NS_DISK_WRITE_PATH; Thread.sleep(POLL_INTERVAL)) status = scheduler.getStatus(status.getTaskId()); if (!status.isDone() status.isCancelled()) throw new Exception(STR + status); try { Object result = status.get(); throw new Exception(STR + result); } catch (SkippedException x) { if (!(x.getCause() instanceof ArrayIndexOutOfBoundsException) x.getCause().getMessage() == null x.getCause().getMessage().indexOf(STR) < 0) throw x; } }
/** * Trigger.skipRun fails causing the only execution attempt to be skipped. * Verify that the task entry remains in the persistent store because we disabled autopurge. */
Trigger.skipRun fails causing the only execution attempt to be skipped. Verify that the task entry remains in the persistent store because we disabled autopurge
testSkipRunFailsOnOnlyExecutionAttemptNoAutoPurge
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.concurrent.persistent_fat_errorpaths/test-applications/persistenterrtest/src/web/PersistentErrorTestServlet.java", "license": "epl-1.0", "size": 67702 }
[ "com.ibm.websphere.concurrent.persistent.TaskStatus", "java.io.PrintWriter", "javax.enterprise.concurrent.SkippedException", "javax.servlet.http.HttpServletRequest" ]
import com.ibm.websphere.concurrent.persistent.TaskStatus; import java.io.PrintWriter; import javax.enterprise.concurrent.SkippedException; import javax.servlet.http.HttpServletRequest;
import com.ibm.websphere.concurrent.persistent.*; import java.io.*; import javax.enterprise.concurrent.*; import javax.servlet.http.*;
[ "com.ibm.websphere", "java.io", "javax.enterprise", "javax.servlet" ]
com.ibm.websphere; java.io; javax.enterprise; javax.servlet;
2,838,175
public ServerId getServerId() { return serverId; }
ServerId function() { return serverId; }
/** * Returns the serverId. */
Returns the serverId
getServerId
{ "repo_name": "lewie/openhab", "path": "bundles/binding/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/common/HomematicContext.java", "license": "epl-1.0", "size": 3362 }
[ "org.openhab.binding.homematic.internal.communicator.client.ServerId" ]
import org.openhab.binding.homematic.internal.communicator.client.ServerId;
import org.openhab.binding.homematic.internal.communicator.client.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,472,004
public int readBit() throws IOException { if (iIs == null) { throw new IOException("Already closed"); } if (iNextBit == 8) { iBuffer = iIs.read(); if (iBuffer == -1) { throw new EOFException(); } iNextBit = 0; } int bit = iBuffer & (1 << iNextBit); iNextBit++; bit = (bit == 0) ? 0 : 1; return bit; }
int function() throws IOException { if (iIs == null) { throw new IOException(STR); } if (iNextBit == 8) { iBuffer = iIs.read(); if (iBuffer == -1) { throw new EOFException(); } iNextBit = 0; } int bit = iBuffer & (1 << iNextBit); iNextBit++; bit = (bit == 0) ? 0 : 1; return bit; }
/** * Read the next bit from the stream. * * @return 0 if the bit is 0, 1 if the bit is 1. * @throws IOException if the underlying stream throws it */
Read the next bit from the stream
readBit
{ "repo_name": "p-smith/open-ig", "path": "src/hu/openig/utils/BitInputStream.java", "license": "lgpl-3.0", "size": 2832 }
[ "java.io.EOFException", "java.io.IOException" ]
import java.io.EOFException; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,376,326
public IBlockState getHeldBlockState() { return Block.getStateById(this.dataWatcher.getWatchableObjectShort(16) & 65535); }
IBlockState function() { return Block.getStateById(this.dataWatcher.getWatchableObjectShort(16) & 65535); }
/** * Gets this enderman's held block state */
Gets this enderman's held block state
getHeldBlockState
{ "repo_name": "TorchPowered/Thallium", "path": "src/main/java/net/minecraft/entity/monster/EntityEnderman.java", "license": "mit", "size": 22044 }
[ "net.minecraft.block.Block", "net.minecraft.block.state.IBlockState" ]
import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState;
import net.minecraft.block.*; import net.minecraft.block.state.*;
[ "net.minecraft.block" ]
net.minecraft.block;
1,387,459
public void testAdvanced8(){ String v="hello ${ext+word}"; String correct="hello "; Map<String,String> map=new HashMap<String, String>(); map.put("word", "file"); assertEquals(correct, TemplateUtils.createAdvancedText(v,map)); }
void function(){ String v=STR; String correct=STR; Map<String,String> map=new HashMap<String, String>(); map.put("word", "file"); assertEquals(correct, TemplateUtils.createAdvancedText(v,map)); }
/** * file-extension,but not have extension */
file-extension,but not have extension
testAdvanced8
{ "repo_name": "akjava/akjava_gwtlib", "path": "test/test/utils/TemplateUtilsTest.java", "license": "apache-2.0", "size": 5974 }
[ "com.akjava.lib.common.utils.TemplateUtils", "java.util.HashMap", "java.util.Map" ]
import com.akjava.lib.common.utils.TemplateUtils; import java.util.HashMap; import java.util.Map;
import com.akjava.lib.common.utils.*; import java.util.*;
[ "com.akjava.lib", "java.util" ]
com.akjava.lib; java.util;
1,458,653
private static TesterRequirements buildTesterRequirements( Annotation testerAnnotation) throws ConflictingRequirementsException { Class<? extends Annotation> annotationClass = testerAnnotation.annotationType(); final Feature<?>[] presentFeatures; final Feature<?>[] absentFeatures; try { presentFeatures = (Feature[]) annotationClass.getMethod("value") .invoke(testerAnnotation); absentFeatures = (Feature[]) annotationClass.getMethod("absent") .invoke(testerAnnotation); } catch (Exception e) { throw new IllegalArgumentException( "Error extracting features from tester annotation.", e); } Set<Feature<?>> allPresentFeatures = addImpliedFeatures(Helpers.<Feature<?>>copyToSet(presentFeatures)); Set<Feature<?>> allAbsentFeatures = addImpliedFeatures(Helpers.<Feature<?>>copyToSet(absentFeatures)); Set<Feature<?>> conflictingFeatures = intersection(allPresentFeatures, allAbsentFeatures); if (!conflictingFeatures.isEmpty()) { throw new ConflictingRequirementsException("Annotation explicitly or " + "implicitly requires one or more features to be both present " + "and absent.", conflictingFeatures, testerAnnotation); } return new TesterRequirements(allPresentFeatures, allAbsentFeatures); }
static TesterRequirements function( Annotation testerAnnotation) throws ConflictingRequirementsException { Class<? extends Annotation> annotationClass = testerAnnotation.annotationType(); final Feature<?>[] presentFeatures; final Feature<?>[] absentFeatures; try { presentFeatures = (Feature[]) annotationClass.getMethod("value") .invoke(testerAnnotation); absentFeatures = (Feature[]) annotationClass.getMethod(STR) .invoke(testerAnnotation); } catch (Exception e) { throw new IllegalArgumentException( STR, e); } Set<Feature<?>> allPresentFeatures = addImpliedFeatures(Helpers.<Feature<?>>copyToSet(presentFeatures)); Set<Feature<?>> allAbsentFeatures = addImpliedFeatures(Helpers.<Feature<?>>copyToSet(absentFeatures)); Set<Feature<?>> conflictingFeatures = intersection(allPresentFeatures, allAbsentFeatures); if (!conflictingFeatures.isEmpty()) { throw new ConflictingRequirementsException(STR + STR + STR, conflictingFeatures, testerAnnotation); } return new TesterRequirements(allPresentFeatures, allAbsentFeatures); }
/** * Find all the constraints explicitly or implicitly specified by a single * tester annotation. * @param testerAnnotation a tester annotation * @return the requirements specified by the annotation * @throws ConflictingRequirementsException if the requirements are mutually * inconsistent. */
Find all the constraints explicitly or implicitly specified by a single tester annotation
buildTesterRequirements
{ "repo_name": "aiyanbo/guava", "path": "guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java", "license": "apache-2.0", "size": 12603 }
[ "com.google.common.collect.testing.Helpers", "java.lang.annotation.Annotation", "java.util.Set" ]
import com.google.common.collect.testing.Helpers; import java.lang.annotation.Annotation; import java.util.Set;
import com.google.common.collect.testing.*; import java.lang.annotation.*; import java.util.*;
[ "com.google.common", "java.lang", "java.util" ]
com.google.common; java.lang; java.util;
2,870,079
public Color getOuterRadiusColor() { return r1Color; }
Color function() { return r1Color; }
/** * Get the color used to draw the lens' outer radius. * * @return color of the boundary (null if border is not drawn) */
Get the color used to draw the lens' outer radius
getOuterRadiusColor
{ "repo_name": "sharwell/zgrnbviewer", "path": "org-tvl-netbeans-zgrviewer/src/fr/inria/zvtm/lens/FixedSizeLens.java", "license": "lgpl-3.0", "size": 22880 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,015,173
public static boolean sameSet(Object[] a, Vector b) { if (a == null || b == null || a.length != b.size()) { return false; } if (a.length == 0) { return true; } // Convert the array into a set Hashtable t = new Hashtable(); for (int i = 0; i < a.length; i++) { t.put(a[i], a[i]); } for (int i = 0; i < b.size(); i++) { Object o = b.elementAt(i); if (t.remove(o) == null) { return false; } } return (t.size() == 0); }
static boolean function(Object[] a, Vector b) { if (a == null b == null a.length != b.size()) { return false; } if (a.length == 0) { return true; } Hashtable t = new Hashtable(); for (int i = 0; i < a.length; i++) { t.put(a[i], a[i]); } for (int i = 0; i < b.size(); i++) { Object o = b.elementAt(i); if (t.remove(o) == null) { return false; } } return (t.size() == 0); }
/** * Compares the contents of an array and a Vector for set equality. Assumes * input array and vector are sets (i.e. no duplicate entries) */
Compares the contents of an array and a Vector for set equality. Assumes input array and vector are sets (i.e. no duplicate entries)
sameSet
{ "repo_name": "flax3lbs/cpptasks-parallel", "path": "src/main/java/net/sf/antcontrib/cpptasks/CUtil.java", "license": "apache-2.0", "size": 19108 }
[ "java.util.Hashtable", "java.util.Vector" ]
import java.util.Hashtable; import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
494,178
private PortletCategoryBean filterCategoryFavoritesOnly( PortletCategoryBean category, Set<IPortletDefinition> favoritePortlets) { // Subcategories final Set<PortletCategoryBean> subcategories = new HashSet<>(); category.getSubcategories() .forEach( sub -> { final PortletCategoryBean filteredBean = filterCategoryFavoritesOnly(sub, favoritePortlets); if (filteredBean != null) { subcategories.add(filteredBean); } }); // Portlets final Set<PortletDefinitionBean> portlets = new HashSet<>(); category.getPortlets() .forEach( child -> { if (isPortletAFavorite(child, favoritePortlets)) { logger.debug( "Including portlet '{}' because it is a favorite: {}", child.getFname()); portlets.add(child); } else { logger.debug( "Skipping portlet '{}' because it IS NOT a favorite: {}", child.getFname()); } }); return !subcategories.isEmpty() || !portlets.isEmpty() ? PortletCategoryBean.create( category.getId(), category.getName(), category.getDescription(), subcategories, portlets) : null; }
PortletCategoryBean function( PortletCategoryBean category, Set<IPortletDefinition> favoritePortlets) { final Set<PortletCategoryBean> subcategories = new HashSet<>(); category.getSubcategories() .forEach( sub -> { final PortletCategoryBean filteredBean = filterCategoryFavoritesOnly(sub, favoritePortlets); if (filteredBean != null) { subcategories.add(filteredBean); } }); final Set<PortletDefinitionBean> portlets = new HashSet<>(); category.getPortlets() .forEach( child -> { if (isPortletAFavorite(child, favoritePortlets)) { logger.debug( STR, child.getFname()); portlets.add(child); } else { logger.debug( STR, child.getFname()); } }); return !subcategories.isEmpty() !portlets.isEmpty() ? PortletCategoryBean.create( category.getId(), category.getName(), category.getDescription(), subcategories, portlets) : null; }
/** * Returns the filtered category, or <code>null</code> if there is no content remaining in the * category. */
Returns the filtered category, or <code>null</code> if there is no content remaining in the category
filterCategoryFavoritesOnly
{ "repo_name": "GIP-RECIA/esup-uportal", "path": "uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/ChannelListController.java", "license": "apache-2.0", "size": 28627 }
[ "java.util.HashSet", "java.util.Set", "org.apereo.portal.layout.dlm.remoting.registry.v43.PortletCategoryBean", "org.apereo.portal.layout.dlm.remoting.registry.v43.PortletDefinitionBean", "org.apereo.portal.portlet.om.IPortletDefinition" ]
import java.util.HashSet; import java.util.Set; import org.apereo.portal.layout.dlm.remoting.registry.v43.PortletCategoryBean; import org.apereo.portal.layout.dlm.remoting.registry.v43.PortletDefinitionBean; import org.apereo.portal.portlet.om.IPortletDefinition;
import java.util.*; import org.apereo.portal.layout.dlm.remoting.registry.v43.*; import org.apereo.portal.portlet.om.*;
[ "java.util", "org.apereo.portal" ]
java.util; org.apereo.portal;
108,875
public void setFixedParameters(Map<Parameter, Object> parameters) { if (parameters == null) throw new IllegalArgumentException("fixedParameters can't be set to null"); fixedParameters = parameters; }
void function(Map<Parameter, Object> parameters) { if (parameters == null) throw new IllegalArgumentException(STR); fixedParameters = parameters; }
/** * Set a subset of parameters to be fixed, i.e. they don't have to be considered * in neighbourhood calculation. Their values will be set to null in the resulting configurations. * @param parameters */
Set a subset of parameters to be fixed, i.e. they don't have to be considered in neighbourhood calculation. Their values will be set to null in the resulting configurations
setFixedParameters
{ "repo_name": "EDACC/edacc_api", "path": "src/edacc/parameterspace/graph/ParameterGraph.java", "license": "mit", "size": 45114 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,601,409
public void setEnvFiles(File[] files) { qEnvFiles.setValue(files); }
void function(File[] files) { qEnvFiles.setValue(files); }
/** * Set the environment files for the interview. * @param files the environment files for the interview * @see #getEnvFiles */
Set the environment files for the interview
setEnvFiles
{ "repo_name": "otmarjr/jtreg-fork", "path": "dist-with-aspectj/jtreg/lib/javatest/com/sun/javatest/interview/EnvironmentInterview.java", "license": "gpl-2.0", "size": 12830 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,762,413
@Override protected void onPostExecute(String result) { Log.i(LOG_TAG, "Query result " + result); if (result == null) { result = errorMessage; } dialog.dismiss(); GotResult(result); } }
void function(String result) { Log.i(LOG_TAG, STR + result); if (result == null) { result = errorMessage; } dialog.dismiss(); GotResult(result); } }
/** * Fires the AppInventor GotResult() method */
Fires the AppInventor GotResult() method
onPostExecute
{ "repo_name": "be1be1/appinventor-polyu", "path": "appinventor/components/src/com/google/appinventor/components/runtime/FusiontablesControl.java", "license": "apache-2.0", "size": 39787 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
2,111,824
public void updateFloat(int columnIndex, float x) throws SQLException { resultSet.updateFloat(columnIndex, x); }
void function(int columnIndex, float x) throws SQLException { resultSet.updateFloat(columnIndex, x); }
/** * Updates the designated column with a <code>float</code> value. The * updater methods are used to update column values in the current row or * the insert row. The updater methods do not update the underlying * database; instead the <code>updateRow</code> or <code>insertRow</code> * methods are called to update the database. * * @param columnIndex * the first column is 1, the second is 2, ... * @param x * the new column value. * @throws SQLException * if a database access error occurs. */
Updates the designated column with a <code>float</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database
updateFloat
{ "repo_name": "hannoman/xxl", "path": "src/xxl/core/relational/resultSets/DecoratorResultSet.java", "license": "lgpl-3.0", "size": 169497 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,780,858
protected java.sql.NClob getNativeNClob(int columnIndex) throws SQLException { String stringVal = getStringForNClob(columnIndex); if (stringVal == null) { return null; } return getNClobFromString(stringVal, columnIndex); }
java.sql.NClob function(int columnIndex) throws SQLException { String stringVal = getStringForNClob(columnIndex); if (stringVal == null) { return null; } return getNClobFromString(stringVal, columnIndex); }
/** * JDBC 4.0 Get a NCLOB column. * * @param columnIndex * the first column is 1, the second is 2, ... * * @return an object representing a NCLOB * * @throws SQLException * if an error occurs */
JDBC 4.0 Get a NCLOB column
getNativeNClob
{ "repo_name": "swankjesse/mysql-connector-j", "path": "src/com/mysql/jdbc/JDBC4UpdatableResultSet.java", "license": "gpl-2.0", "size": 21195 }
[ "java.sql.NClob", "java.sql.SQLException" ]
import java.sql.NClob; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,633,106
public static void restrainedRePack(Window win) { Dimension orig = win.getSize(); Dimension max = new Dimension((int) (orig.width * 1.1), (int) (orig.height * 1.1)); Dimension min = new Dimension((int) (orig.width / 1.1), (int) (orig.height / 1.1)); win.pack(); // If the window is wider than 110% of its original size, clip it if (win.getSize().width > max.width) { win.setSize(max.width, win.getSize().height); } // If the window is taller than 110% of its original size, clip it if (win.getSize().height > max.height) { win.setSize(win.getSize().width, max.height); } // If the window is narrower than 90% of its original size, grow it if (win.getSize().width < min.width) { win.setSize(min.width, win.getSize().height); } // If the window is shorter than 90% of its original size, grow it if (win.getSize().height < min.height) { win.setSize(win.getSize().width, min.height); } Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); // If the window is wider than the screen, clip it if (screenDim.width < win.getSize().width) { win.setSize(screenDim.width, win.getSize().height); } // If the window is taller than the screen, clip it if (screenDim.height < win.getSize().height) { win.setSize(win.getSize().width, screenDim.height); } refresh(win); // log.log(Level.INFO, "Failure", ex); // log.fine("Size was "+orig); // log.fine("Size is "+win.getSize()); }
static void function(Window win) { Dimension orig = win.getSize(); Dimension max = new Dimension((int) (orig.width * 1.1), (int) (orig.height * 1.1)); Dimension min = new Dimension((int) (orig.width / 1.1), (int) (orig.height / 1.1)); win.pack(); if (win.getSize().width > max.width) { win.setSize(max.width, win.getSize().height); } if (win.getSize().height > max.height) { win.setSize(win.getSize().width, max.height); } if (win.getSize().width < min.width) { win.setSize(min.width, win.getSize().height); } if (win.getSize().height < min.height) { win.setSize(win.getSize().width, min.height); } Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); if (screenDim.width < win.getSize().width) { win.setSize(screenDim.width, win.getSize().height); } if (screenDim.height < win.getSize().height) { win.setSize(win.getSize().width, screenDim.height); } refresh(win); }
/** * A more restricted version of pack() for component responding to live * component tweaks. Assuming that the window already has a sensible on * screen size, do a pack, but don't let the window grow or shrink by more * than 10%. * * @param win * The window to be packed */
A more restricted version of pack() for component responding to live component tweaks. Assuming that the window already has a sensible on screen size, do a pack, but don't let the window grow or shrink by more than 10%
restrainedRePack
{ "repo_name": "truhanen/JSana", "path": "JSana/src_others/org/crosswire/common/swing/GuiUtil.java", "license": "gpl-2.0", "size": 20415 }
[ "java.awt.Dimension", "java.awt.Toolkit", "java.awt.Window" ]
import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,131,794
private static int log(final int level, final String tag, final String msg, final Object[] args, final Throwable tr) { // try String.format first if (msg.contains("%")) { try { return log(level, tag, String.format(msg, args), tr); } catch (IllegalFormatException e) { // failed } } // just concatenate Objects.toString() StringBuilder sb = new StringBuilder(msg); for (Object a : args) { sb.append(a); } return log(level, tag, sb.toString(), tr); }
static int function(final int level, final String tag, final String msg, final Object[] args, final Throwable tr) { if (msg.contains("%")) { try { return log(level, tag, String.format(msg, args), tr); } catch (IllegalFormatException e) { } } StringBuilder sb = new StringBuilder(msg); for (Object a : args) { sb.append(a); } return log(level, tag, sb.toString(), tr); }
/** * Send a formatted log message. * * @param level Logging level * @param tag Used to identify the source of a log message. It usually identifies the class * or activity where the log call occurs. * @param msg The message you would like logged. * @param args Arguments for msg's String formatting. * @param tr A Throwable for printing stack traces. */
Send a formatted log message
log
{ "repo_name": "felixb/ub0rlogg0r", "path": "logg0r/src/main/java/de/ub0r/android/logg0r/Log.java", "license": "apache-2.0", "size": 13227 }
[ "java.util.IllegalFormatException" ]
import java.util.IllegalFormatException;
import java.util.*;
[ "java.util" ]
java.util;
2,210,454
private synchronized ExtendedBlock popNextSuspectBlock() { Iterator<ExtendedBlock> iter = suspectBlocks.iterator(); if (!iter.hasNext()) { return null; } ExtendedBlock block = iter.next(); iter.remove(); return block; }
synchronized ExtendedBlock function() { Iterator<ExtendedBlock> iter = suspectBlocks.iterator(); if (!iter.hasNext()) { return null; } ExtendedBlock block = iter.next(); iter.remove(); return block; }
/** * If there are elements in the suspectBlocks list, removes * and returns the first one. Otherwise, returns null. */
If there are elements in the suspectBlocks list, removes and returns the first one. Otherwise, returns null
popNextSuspectBlock
{ "repo_name": "ZhangXFeng/hadoop", "path": "src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java", "license": "apache-2.0", "size": 25752 }
[ "java.util.Iterator", "org.apache.hadoop.hdfs.protocol.ExtendedBlock" ]
import java.util.Iterator; import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
import java.util.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
252,068
@Pure default int getIdistanceLinf(Point2D<?, ?> point) { assert point != null : AssertMessages.notNullParameter(); return Math.max(Math.abs(ix() - point.ix()), Math.abs(iy() - point.iy())); }
default int getIdistanceLinf(Point2D<?, ?> point) { assert point != null : AssertMessages.notNullParameter(); return Math.max(Math.abs(ix() - point.ix()), Math.abs(iy() - point.iy())); }
/** * Computes the L-infinite distance between this point and * point p1. The L-infinite distance is equal to * MAX[abs(x1-x2), abs(y1-y2)]. * @param point the other point * @return the distance. */
Computes the L-infinite distance between this point and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)]
getIdistanceLinf
{ "repo_name": "tpiotrow/afc", "path": "core/math/src/main/java/org/arakhne/afc/math/geometry/d2/Point2D.java", "license": "apache-2.0", "size": 32880 }
[ "org.arakhne.afc.vmutil.asserts.AssertMessages" ]
import org.arakhne.afc.vmutil.asserts.AssertMessages;
import org.arakhne.afc.vmutil.asserts.*;
[ "org.arakhne.afc" ]
org.arakhne.afc;
2,243,967
protected ResourceBundle getResourceBundle(final String rbBaseName, final Locale resourceBundleLocale, final boolean loop) { ResourceBundle rb = null; if (rbBaseName == null) { return null; } try { if (resourceBundleLocale != null) { rb = ResourceBundle.getBundle(rbBaseName, resourceBundleLocale); } else { rb = ResourceBundle.getBundle(rbBaseName); } } catch (final MissingResourceException ex) { if (!loop) { logger.debug("Unable to locate ResourceBundle " + rbBaseName); return null; } } String substr = rbBaseName; int i; while (rb == null && (i = substr.lastIndexOf('.')) > 0) { substr = substr.substring(0, i); try { if (resourceBundleLocale != null) { rb = ResourceBundle.getBundle(substr, resourceBundleLocale); } else { rb = ResourceBundle.getBundle(substr); } } catch (final MissingResourceException ex) { logger.debug("Unable to locate ResourceBundle " + substr); } } return rb; }
ResourceBundle function(final String rbBaseName, final Locale resourceBundleLocale, final boolean loop) { ResourceBundle rb = null; if (rbBaseName == null) { return null; } try { if (resourceBundleLocale != null) { rb = ResourceBundle.getBundle(rbBaseName, resourceBundleLocale); } else { rb = ResourceBundle.getBundle(rbBaseName); } } catch (final MissingResourceException ex) { if (!loop) { logger.debug(STR + rbBaseName); return null; } } String substr = rbBaseName; int i; while (rb == null && (i = substr.lastIndexOf('.')) > 0) { substr = substr.substring(0, i); try { if (resourceBundleLocale != null) { rb = ResourceBundle.getBundle(substr, resourceBundleLocale); } else { rb = ResourceBundle.getBundle(substr); } } catch (final MissingResourceException ex) { logger.debug(STR + substr); } } return rb; }
/** * Override this to use a ResourceBundle.Control in Java 6 * * @param rbBaseName The base name of the resource bundle, a fully qualified class name. * @param resourceBundleLocale The locale to use when formatting the message. * @param loop If true the key will be treated as a package or class name and a resource bundle will * be located based on all or part of the package name. If false the key is expected to be the exact bundle id. * @return The ResourceBundle. */
Override this to use a ResourceBundle.Control in Java 6
getResourceBundle
{ "repo_name": "dotCMS/log4j", "path": "log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java", "license": "apache-2.0", "size": 10397 }
[ "java.util.Locale", "java.util.MissingResourceException", "java.util.ResourceBundle" ]
import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle;
import java.util.*;
[ "java.util" ]
java.util;
499,819
public String postProcess( MsgObject msg, String currentName ) { boolean value1Empty = nameValues.getValue( "Value1" )[0].equals(Config.EMPTY_STR); boolean value2Empty = nameValues.getValue( "Value2" )[0].equals(Config.EMPTY_STR); String op1 = nameValues.getValue( "Operator1" )[0]; String op2 = nameValues.getValue( "Operator2" )[0]; String[] values = nameValues.getValue( FormTags.VALUE_TAG ); boolean valueEmpty = values.length == 1 && values[0].equals( Config.EMPTY_STR ); if( ( valueEmpty && value1Empty && op1.toUpperCase().indexOf( "NULL" ) == -1 ) || ( valueEmpty && value2Empty && op2.toUpperCase().indexOf( "NULL" ) == -1 ) ) { isActive = false; } return currentName; }
String function( MsgObject msg, String currentName ) { boolean value1Empty = nameValues.getValue( STR )[0].equals(Config.EMPTY_STR); boolean value2Empty = nameValues.getValue( STR )[0].equals(Config.EMPTY_STR); String op1 = nameValues.getValue( STR )[0]; String op2 = nameValues.getValue( STR )[0]; String[] values = nameValues.getValue( FormTags.VALUE_TAG ); boolean valueEmpty = values.length == 1 && values[0].equals( Config.EMPTY_STR ); if( ( valueEmpty && value1Empty && op1.toUpperCase().indexOf( "NULL" ) == -1 ) ( valueEmpty && value2Empty && op2.toUpperCase().indexOf( "NULL" ) == -1 ) ) { isActive = false; } return currentName; }
/** * This element is invalid if there are no Values associated with it. * Therefore in the postprocessing we check to make sure we have a valid * Value. If there isn't one, set this element's isActive to false. * (unless, of course, the operator is IS NULL or IS NOT NULL) * *@param msg Description of the Parameter *@param currentName Description of the Parameter *@return Description of the Return Value *@since */
This element is invalid if there are no Values associated with it. Therefore in the postprocessing we check to make sure we have a valid Value. If there isn't one, set this element's isActive to false. (unless, of course, the operator is IS NULL or IS NOT NULL)
postProcess
{ "repo_name": "jchoyt/mrald-lite", "path": "src/org/mitre/mrald/query/OrFilterElement.java", "license": "apache-2.0", "size": 16231 }
[ "org.mitre.mrald.control.MsgObject", "org.mitre.mrald.util.Config", "org.mitre.mrald.util.FormTags" ]
import org.mitre.mrald.control.MsgObject; import org.mitre.mrald.util.Config; import org.mitre.mrald.util.FormTags;
import org.mitre.mrald.control.*; import org.mitre.mrald.util.*;
[ "org.mitre.mrald" ]
org.mitre.mrald;
382,211
public boolean isLast() throws SQLException { synchronized (checkClosed().getConnectionMutex()) { return this.rowData.isLast(); } }
boolean function() throws SQLException { synchronized (checkClosed().getConnectionMutex()) { return this.rowData.isLast(); } }
/** * JDBC 2.0 * * <p> * Determine if the cursor is on the last row of the result set. Note: * Calling isLast() may be expensive since the JDBC driver might need to * fetch ahead one row in order to determine whether the current row is the * last row in the result set. * </p> * * @return true if on the last row, false otherwise. * * @exception SQLException * if a database-access error occurs. */
JDBC 2.0 Determine if the cursor is on the last row of the result set. Note: Calling isLast() may be expensive since the JDBC driver might need to fetch ahead one row in order to determine whether the current row is the last row in the result set.
isLast
{ "repo_name": "shubhanshu-gupta/Apache-Solr", "path": "example/solr/collection1/lib/mysql-connector-java-5.1.32/src/com/mysql/jdbc/ResultSetImpl.java", "license": "apache-2.0", "size": 247329 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
545,765
@VisibleForTesting public static ScanLevelProjection build(List<SchemaPath> projectionList, List<ScanProjectionParser> parsers, TupleMetadata outputSchema) { return new Builder() .projection(projectionList) .parsers(parsers) .providedSchema(outputSchema) .build(); }
static ScanLevelProjection function(List<SchemaPath> projectionList, List<ScanProjectionParser> parsers, TupleMetadata outputSchema) { return new Builder() .projection(projectionList) .parsers(parsers) .providedSchema(outputSchema) .build(); }
/** * Builder shortcut, primarily for tests. */
Builder shortcut, primarily for tests
build
{ "repo_name": "johnnywale/drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/scan/project/ScanLevelProjection.java", "license": "apache-2.0", "size": 22109 }
[ "java.util.List", "org.apache.drill.common.expression.SchemaPath", "org.apache.drill.exec.record.metadata.TupleMetadata" ]
import java.util.List; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.record.metadata.TupleMetadata;
import java.util.*; import org.apache.drill.common.expression.*; import org.apache.drill.exec.record.metadata.*;
[ "java.util", "org.apache.drill" ]
java.util; org.apache.drill;
448,435
public void readSpawnData(ByteBuf additionalData);
void function(ByteBuf additionalData);
/** * Called by the client when it receives a Entity spawn packet. * Data should be read out of the stream in the same way as it was written. * * @param data The packet data stream */
Called by the client when it receives a Entity spawn packet. Data should be read out of the stream in the same way as it was written
readSpawnData
{ "repo_name": "Scrik/Cauldron-1", "path": "eclipse/cauldron/src/main/java/cpw/mods/fml/common/registry/IEntityAdditionalSpawnData.java", "license": "gpl-3.0", "size": 1127 }
[ "io.netty.buffer.ByteBuf" ]
import io.netty.buffer.ByteBuf;
import io.netty.buffer.*;
[ "io.netty.buffer" ]
io.netty.buffer;
2,276,935
public int getSortedColumnIndex() { RowSorter<?> controller = getRowSorter(); if (controller != null) { SortKey sortKey = SortUtils.getFirstSortingKey(controller.getSortKeys()); if (sortKey != null) { return convertColumnIndexToView(sortKey.getColumn()); } } return -1; }
int function() { RowSorter<?> controller = getRowSorter(); if (controller != null) { SortKey sortKey = SortUtils.getFirstSortingKey(controller.getSortKeys()); if (sortKey != null) { return convertColumnIndexToView(sortKey.getColumn()); } } return -1; }
/** * Returns the view column index of the primary sort column. * * @return the view column index of the primary sort column or -1 if nothing * sorted or the primary sort column not visible. */
Returns the view column index of the primary sort column
getSortedColumnIndex
{ "repo_name": "syncer/swingx", "path": "swingx-core/src/main/java/org/jdesktop/swingx/JXTable.java", "license": "lgpl-2.1", "size": 163674 }
[ "javax.swing.RowSorter", "org.jdesktop.swingx.sort.SortUtils" ]
import javax.swing.RowSorter; import org.jdesktop.swingx.sort.SortUtils;
import javax.swing.*; import org.jdesktop.swingx.sort.*;
[ "javax.swing", "org.jdesktop.swingx" ]
javax.swing; org.jdesktop.swingx;
195,365
void rollLog() throws IOException; boolean append(TxnHeader hdr, Record r) throws IOException;
void rollLog() throws IOException; boolean append(TxnHeader hdr, Record r) throws IOException;
/** * Append a request to the transaction log * @param hdr the transaction header * @param r the transaction itself * returns true iff something appended, otw false * @throws IOException */
Append a request to the transaction log
append
{ "repo_name": "joyent/zookeeper", "path": "src/java/main/org/apache/zookeeper/server/persistence/TxnLog.java", "license": "apache-2.0", "size": 3685 }
[ "java.io.IOException", "org.apache.jute.Record", "org.apache.zookeeper.txn.TxnHeader" ]
import java.io.IOException; import org.apache.jute.Record; import org.apache.zookeeper.txn.TxnHeader;
import java.io.*; import org.apache.jute.*; import org.apache.zookeeper.txn.*;
[ "java.io", "org.apache.jute", "org.apache.zookeeper" ]
java.io; org.apache.jute; org.apache.zookeeper;
2,885,672
Boolean isColStClsSupported() { return ValuePool.getBoolean(type == Types.NULL ? true : getColStClsName() != null); }
Boolean isColStClsSupported() { return ValuePool.getBoolean(type == Types.NULL ? true : getColStClsName() != null); }
/** * Retrieves whether, under the current release, class path and hosting * JVM, HSQLDB supports storing this type in table columns. <p> * * This value also typically represents whether HSQLDB supports retrieving * values of this type in the columns of ResultSets. * @return whether, under the current release, class path * and hosting JVM, HSQLDB supports storing this * type in table columns */
Retrieves whether, under the current release, class path and hosting JVM, HSQLDB supports storing this type in table columns. This value also typically represents whether HSQLDB supports retrieving values of this type in the columns of ResultSets
isColStClsSupported
{ "repo_name": "ckaestne/LEADT", "path": "workspace/hsqldb/src/org/hsqldb/DITypeInfo.java", "license": "gpl-3.0", "size": 36588 }
[ "org.hsqldb.store.ValuePool" ]
import org.hsqldb.store.ValuePool;
import org.hsqldb.store.*;
[ "org.hsqldb.store" ]
org.hsqldb.store;
1,710,380
public CommandLine getCommandLine () { return commandLine; }
CommandLine function () { return commandLine; }
/** * Get the command line parameters. * * @return The command line paramters. */
Get the command line parameters
getCommandLine
{ "repo_name": "grappendorf/openmetix", "path": "src/java/de/iritgo/openmetix/framework/IritgoEngine.java", "license": "gpl-2.0", "size": 15691 }
[ "org.apache.commons.cli.CommandLine" ]
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.*;
[ "org.apache.commons" ]
org.apache.commons;
299,677
public void setPasswordPolicy(String code, String data) { ComponentName demoDeviceAdmin = new ComponentName(context, AgentDeviceAdminReceiver.class); int attempts, length, history, specialChars; String alphanumeric, complex; boolean isAlphanumeric, isComplex; long timout; resultBuilder.build(code); try { JSONObject policyData = new JSONObject(data); if (!policyData .isNull(resources.getString(R.string.policy_password_max_failed_attempts)) && policyData.get(resources.getString(R.string.policy_password_max_failed_attempts)) != null) { attempts = Integer.parseInt((String) policyData.get(resources.getString( R.string.policy_password_max_failed_attempts))); devicePolicyManager.setMaximumFailedPasswordsForWipe(demoDeviceAdmin, attempts); } if (!policyData.isNull(resources.getString(R.string.policy_password_min_length)) && policyData.get(resources.getString(R.string.policy_password_min_length)) != null) { length = Integer.parseInt((String) policyData .get(resources.getString(R.string.policy_password_min_length))); devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, length); } if (!policyData.isNull(resources.getString(R.string.policy_password_pin_history)) && policyData.get(resources.getString(R.string.policy_password_pin_history)) != null) { history = Integer.parseInt((String) policyData .get(resources.getString(R.string.policy_password_pin_history))); devicePolicyManager.setPasswordHistoryLength(demoDeviceAdmin, history); } if (!policyData .isNull(resources.getString(R.string.policy_password_min_complex_chars)) && policyData.get(resources.getString(R.string.policy_password_min_complex_chars)) != null) { specialChars = Integer.parseInt((String) policyData.get(resources.getString( R.string.policy_password_min_complex_chars))); devicePolicyManager.setPasswordMinimumSymbols(demoDeviceAdmin, specialChars); } if (!policyData .isNull(resources.getString(R.string.policy_password_require_alphanumeric)) && policyData .get(resources.getString(R.string.policy_password_require_alphanumeric)) != null) { if (policyData.get(resources.getString( R.string.policy_password_require_alphanumeric)) instanceof String) { alphanumeric = (String) policyData.get(resources.getString( R.string.policy_password_require_alphanumeric)); if (alphanumeric .equals(resources.getString(R.string.shared_pref_default_status))) { devicePolicyManager.setPasswordQuality(demoDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC); } } else if (policyData.get(resources.getString( R.string.policy_password_require_alphanumeric)) instanceof Boolean) { isAlphanumeric = policyData.getBoolean(resources.getString( R.string.policy_password_require_alphanumeric)); if (isAlphanumeric) { devicePolicyManager.setPasswordQuality(demoDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC); } } } if (!policyData.isNull(resources.getString(R.string.policy_password_allow_simple)) && policyData.get(resources.getString(R.string.policy_password_allow_simple)) != null) { if (policyData.get(resources.getString( R.string.policy_password_allow_simple)) instanceof String) { complex = (String) policyData.get(resources.getString( R.string.policy_password_allow_simple)); if (!complex.equals(resources.getString(R.string.shared_pref_default_status))) { devicePolicyManager.setPasswordQuality(demoDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_COMPLEX); } } else if (policyData.get(resources.getString( R.string.policy_password_allow_simple)) instanceof Boolean) { isComplex = policyData.getBoolean( resources.getString(R.string.policy_password_allow_simple)); if (!isComplex) { devicePolicyManager.setPasswordQuality(demoDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_COMPLEX); } } } if (!policyData.isNull(resources.getString(R.string.policy_password_pin_age_in_days)) && policyData.get(resources.getString(R.string.policy_password_pin_age_in_days)) != null) { int daysOfExp = Integer.parseInt((String) policyData.get(resources.getString( R.string.policy_password_pin_age_in_days))); timout = (long) (daysOfExp * DAY_MILLISECONDS_MULTIPLIER); devicePolicyManager.setPasswordExpirationTimeout(demoDeviceAdmin, timout); } } catch (JSONException e) { Log.e(TAG, "Invalid JSON format." + e); } }
void function(String code, String data) { ComponentName demoDeviceAdmin = new ComponentName(context, AgentDeviceAdminReceiver.class); int attempts, length, history, specialChars; String alphanumeric, complex; boolean isAlphanumeric, isComplex; long timout; resultBuilder.build(code); try { JSONObject policyData = new JSONObject(data); if (!policyData .isNull(resources.getString(R.string.policy_password_max_failed_attempts)) && policyData.get(resources.getString(R.string.policy_password_max_failed_attempts)) != null) { attempts = Integer.parseInt((String) policyData.get(resources.getString( R.string.policy_password_max_failed_attempts))); devicePolicyManager.setMaximumFailedPasswordsForWipe(demoDeviceAdmin, attempts); } if (!policyData.isNull(resources.getString(R.string.policy_password_min_length)) && policyData.get(resources.getString(R.string.policy_password_min_length)) != null) { length = Integer.parseInt((String) policyData .get(resources.getString(R.string.policy_password_min_length))); devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, length); } if (!policyData.isNull(resources.getString(R.string.policy_password_pin_history)) && policyData.get(resources.getString(R.string.policy_password_pin_history)) != null) { history = Integer.parseInt((String) policyData .get(resources.getString(R.string.policy_password_pin_history))); devicePolicyManager.setPasswordHistoryLength(demoDeviceAdmin, history); } if (!policyData .isNull(resources.getString(R.string.policy_password_min_complex_chars)) && policyData.get(resources.getString(R.string.policy_password_min_complex_chars)) != null) { specialChars = Integer.parseInt((String) policyData.get(resources.getString( R.string.policy_password_min_complex_chars))); devicePolicyManager.setPasswordMinimumSymbols(demoDeviceAdmin, specialChars); } if (!policyData .isNull(resources.getString(R.string.policy_password_require_alphanumeric)) && policyData .get(resources.getString(R.string.policy_password_require_alphanumeric)) != null) { if (policyData.get(resources.getString( R.string.policy_password_require_alphanumeric)) instanceof String) { alphanumeric = (String) policyData.get(resources.getString( R.string.policy_password_require_alphanumeric)); if (alphanumeric .equals(resources.getString(R.string.shared_pref_default_status))) { devicePolicyManager.setPasswordQuality(demoDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC); } } else if (policyData.get(resources.getString( R.string.policy_password_require_alphanumeric)) instanceof Boolean) { isAlphanumeric = policyData.getBoolean(resources.getString( R.string.policy_password_require_alphanumeric)); if (isAlphanumeric) { devicePolicyManager.setPasswordQuality(demoDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC); } } } if (!policyData.isNull(resources.getString(R.string.policy_password_allow_simple)) && policyData.get(resources.getString(R.string.policy_password_allow_simple)) != null) { if (policyData.get(resources.getString( R.string.policy_password_allow_simple)) instanceof String) { complex = (String) policyData.get(resources.getString( R.string.policy_password_allow_simple)); if (!complex.equals(resources.getString(R.string.shared_pref_default_status))) { devicePolicyManager.setPasswordQuality(demoDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_COMPLEX); } } else if (policyData.get(resources.getString( R.string.policy_password_allow_simple)) instanceof Boolean) { isComplex = policyData.getBoolean( resources.getString(R.string.policy_password_allow_simple)); if (!isComplex) { devicePolicyManager.setPasswordQuality(demoDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_COMPLEX); } } } if (!policyData.isNull(resources.getString(R.string.policy_password_pin_age_in_days)) && policyData.get(resources.getString(R.string.policy_password_pin_age_in_days)) != null) { int daysOfExp = Integer.parseInt((String) policyData.get(resources.getString( R.string.policy_password_pin_age_in_days))); timout = (long) (daysOfExp * DAY_MILLISECONDS_MULTIPLIER); devicePolicyManager.setPasswordExpirationTimeout(demoDeviceAdmin, timout); } } catch (JSONException e) { Log.e(TAG, STR + e); } }
/** * Set device password policy. * @param code - Operation code. * @param data - Data required (Password policy parameters). * @param requestMode - Request mode(Normal mode or policy bundle mode). */
Set device password policy
setPasswordPolicy
{ "repo_name": "ayyoob/product-iot-server", "path": "modules/tools/mdm-android-agent-archetype/src/main/resources/archetype-resources/src/main/java/org/wso2/mdm/agent/services/Operation.java", "license": "apache-2.0", "size": 31674 }
[ "android.app.admin.DevicePolicyManager", "android.content.ComponentName", "android.util.Log" ]
import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.util.Log;
import android.app.admin.*; import android.content.*; import android.util.*;
[ "android.app", "android.content", "android.util" ]
android.app; android.content; android.util;
403,465
public TermsFacetBuilder param(String name, Object value) { if (params == null) { params = Maps.newHashMap(); } params.put(name, value); return this; }
TermsFacetBuilder function(String name, Object value) { if (params == null) { params = Maps.newHashMap(); } params.put(name, value); return this; }
/** * A parameter that will be passed to the script. * * @param name The name of the script parameter. * @param value The value of the script parameter. */
A parameter that will be passed to the script
param
{ "repo_name": "corochoone/elasticsearch", "path": "src/main/java/org/elasticsearch/search/facet/terms/TermsFacetBuilder.java", "license": "apache-2.0", "size": 8332 }
[ "com.google.common.collect.Maps" ]
import com.google.common.collect.Maps;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
865,681
public static final FileSystem getFileSystem() throws IOException { if (isHadoopAvailable()) { return FileSystem.newInstance(getHadoopConfig()); } else { return FileSystem.newInstanceLocal(new Configuration()).getRaw(); } }
static final FileSystem function() throws IOException { if (isHadoopAvailable()) { return FileSystem.newInstance(getHadoopConfig()); } else { return FileSystem.newInstanceLocal(new Configuration()).getRaw(); } }
/** * Returns the {@link FileSystem}. * * @return the file system. * @throws IOException * if an I/O error occurs. */
Returns the <code>FileSystem</code>
getFileSystem
{ "repo_name": "SHAF-WORK/shaf", "path": "core/src/main/java/org/shaf/core/util/IOUtils.java", "license": "apache-2.0", "size": 10457 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FileSystem" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,033,370
@Test public void testCalculateMedian() { // check null list assertTrue(Double.isNaN(Statistics.calculateMedian(null, false))); assertTrue(Double.isNaN(Statistics.calculateMedian(null, true))); // check empty list List <Number>list = new ArrayList<Number>(); assertTrue(Double.isNaN(Statistics.calculateMedian(list, false))); assertTrue(Double.isNaN(Statistics.calculateMedian(list, true))); // check list containing null list.add(null); try { Statistics.calculateMedian(list, false); fail("Should have thrown a NullPointerException"); } catch (NullPointerException e) { //we expect ot go in here } try { Statistics.calculateMedian(list, true); fail("Should have thrown a NullPointerException"); } catch (NullPointerException e) { //we expect to go in here } }
void function() { assertTrue(Double.isNaN(Statistics.calculateMedian(null, false))); assertTrue(Double.isNaN(Statistics.calculateMedian(null, true))); List <Number>list = new ArrayList<Number>(); assertTrue(Double.isNaN(Statistics.calculateMedian(list, false))); assertTrue(Double.isNaN(Statistics.calculateMedian(list, true))); list.add(null); try { Statistics.calculateMedian(list, false); fail(STR); } catch (NullPointerException e) { } try { Statistics.calculateMedian(list, true); fail(STR); } catch (NullPointerException e) { } }
/** * Some checks for the calculateMedian(List, boolean) method. */
Some checks for the calculateMedian(List, boolean) method
testCalculateMedian
{ "repo_name": "greearb/jfreechart-fse-ct", "path": "src/test/java/org/jfree/data/statistics/StatisticsTest.java", "license": "lgpl-2.1", "size": 15191 }
[ "java.util.ArrayList", "java.util.List", "org.junit.Assert" ]
import java.util.ArrayList; import java.util.List; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
2,238,428
public void setMonthViewSelectedStyle(Style s) { mv.setSelectedStyle(s); }
void function(Style s) { mv.setSelectedStyle(s); }
/** * Sets the selected style of the month view component within the calendar * * @param s style for the month view */
Sets the selected style of the month view component within the calendar
setMonthViewSelectedStyle
{ "repo_name": "diamonddevgroup/CodenameOne", "path": "CodenameOne/src/com/codename1/ui/Calendar.java", "license": "gpl-2.0", "size": 49055 }
[ "com.codename1.ui.plaf.Style" ]
import com.codename1.ui.plaf.Style;
import com.codename1.ui.plaf.*;
[ "com.codename1.ui" ]
com.codename1.ui;
1,913,403
try(ByteArrayOutputStream baos = new ByteArrayOutputStream()){ ImageIO.write(bufferedImage, IMAGE_FORMAT, baos); baos.flush(); byte[] imageInByte = baos.toByteArray(); return imageInByte; } } /** * Convert array of bytes into {@link BufferedImage}
try(ByteArrayOutputStream baos = new ByteArrayOutputStream()){ ImageIO.write(bufferedImage, IMAGE_FORMAT, baos); baos.flush(); byte[] imageInByte = baos.toByteArray(); return imageInByte; } } /** * Convert array of bytes into {@link BufferedImage}
/** * Convert {@link BufferedImage} into array of bytes * * @param bufferedImage * @return * @throws IOException */
Convert <code>BufferedImage</code> into array of bytes
bufferedImageToByteArray
{ "repo_name": "pajikos/ssc", "path": "src/main/java/cz/vse/kit/ssc/utils/DataConvertUtils.java", "license": "lgpl-3.0", "size": 1357 }
[ "java.awt.image.BufferedImage", "java.io.ByteArrayOutputStream", "javax.imageio.ImageIO" ]
import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import javax.imageio.ImageIO;
import java.awt.image.*; import java.io.*; import javax.imageio.*;
[ "java.awt", "java.io", "javax.imageio" ]
java.awt; java.io; javax.imageio;
2,092,791
private void setRetryAfterHeader(MessageContext messageContext) { Object timestampOb = messageContext.getProperty(APIThrottleConstants.THROTTLED_NEXT_ACCESS_TIMESTAMP); if (timestampOb != null) { long timestamp = (Long) timestampOb; SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z"); dateFormat.setTimeZone(TimeZone.getTimeZone(APIThrottleConstants.GMT)); Date date = new Date(timestamp); String retryAfterValue = dateFormat.format(date); Map headers = (Map) ((Axis2MessageContext) messageContext).getAxis2MessageContext() .getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS); headers.put(APIThrottleConstants.HEADER_RETRY_AFTER, retryAfterValue); } }
void function(MessageContext messageContext) { Object timestampOb = messageContext.getProperty(APIThrottleConstants.THROTTLED_NEXT_ACCESS_TIMESTAMP); if (timestampOb != null) { long timestamp = (Long) timestampOb; SimpleDateFormat dateFormat = new SimpleDateFormat(STR); dateFormat.setTimeZone(TimeZone.getTimeZone(APIThrottleConstants.GMT)); Date date = new Date(timestamp); String retryAfterValue = dateFormat.format(date); Map headers = (Map) ((Axis2MessageContext) messageContext).getAxis2MessageContext() .getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS); headers.put(APIThrottleConstants.HEADER_RETRY_AFTER, retryAfterValue); } }
/** * When sent with a 429 (Too Many Requests) response, this indicates how long to wait before making a new request. * Retry-After: <http-date> format header will be set. ex: Retry-After: Fri, 31 Dec 1999 23:59:59 GMT * @param messageContext */
When sent with a 429 (Too Many Requests) response, this indicates how long to wait before making a new request. Retry-After: format header will be set. ex: Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
setRetryAfterHeader
{ "repo_name": "jaadds/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/throttling/ThrottleHandler.java", "license": "apache-2.0", "size": 63176 }
[ "java.text.SimpleDateFormat", "java.util.Date", "java.util.Map", "java.util.TimeZone", "org.apache.synapse.MessageContext", "org.apache.synapse.core.axis2.Axis2MessageContext" ]
import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import java.util.TimeZone; import org.apache.synapse.MessageContext; import org.apache.synapse.core.axis2.Axis2MessageContext;
import java.text.*; import java.util.*; import org.apache.synapse.*; import org.apache.synapse.core.axis2.*;
[ "java.text", "java.util", "org.apache.synapse" ]
java.text; java.util; org.apache.synapse;
904,412
boolean append(List<HistoryCell> lasts, List<HistoryCell> os) { if (lasts == null) { return false; } boolean ret = false; if (os.size() == 1) { HistoryCell o = os.get(0); HistoryCell last = lasts.get(lasts.size() - 1); if (o.canAppend(last)) { lasts.add(o); ret = true; } } return ret; }
boolean append(List<HistoryCell> lasts, List<HistoryCell> os) { if (lasts == null) { return false; } boolean ret = false; if (os.size() == 1) { HistoryCell o = os.get(0); HistoryCell last = lasts.get(lasts.size() - 1); if (o.canAppend(last)) { lasts.add(o); ret = true; } } return ret; }
/** * try to append this change to the last ones */
try to append this change to the last ones
append
{ "repo_name": "adamd/z", "path": "src/neoe/ne/History.java", "license": "bsd-2-clause", "size": 2336 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
162,757
public void setLayeredPane(JLayeredPane f) { if (f == null) throw new IllegalComponentStateException(); if (layeredPane != null) remove(layeredPane); layeredPane = f; add(f, -1); } public JRootPane() { setLayout(createRootLayout()); getGlassPane(); getLayeredPane(); getContentPane(); setOpaque(true); updateUI(); }
void function(JLayeredPane f) { if (f == null) throw new IllegalComponentStateException(); if (layeredPane != null) remove(layeredPane); layeredPane = f; add(f, -1); } public JRootPane() { setLayout(createRootLayout()); getGlassPane(); getLayeredPane(); getContentPane(); setOpaque(true); updateUI(); }
/** * Set the layered pane for the root pane. * * @param f The JLayeredPane to be used. * * @throws IllegalComponentStateException if JLayeredPane * parameter is null. */
Set the layered pane for the root pane
setLayeredPane
{ "repo_name": "taciano-perez/JamVM-PH", "path": "src/classpath/javax/swing/JRootPane.java", "license": "gpl-2.0", "size": 17752 }
[ "java.awt.IllegalComponentStateException" ]
import java.awt.IllegalComponentStateException;
import java.awt.*;
[ "java.awt" ]
java.awt;
851,541
public BillingProfileStatusReasonCode billingProfileStatusReasonCode() { return this.billingProfileStatusReasonCode; }
BillingProfileStatusReasonCode function() { return this.billingProfileStatusReasonCode; }
/** * Get the billingProfileStatusReasonCode property: Reason for the specified billing profile status. * * @return the billingProfileStatusReasonCode value. */
Get the billingProfileStatusReasonCode property: Reason for the specified billing profile status
billingProfileStatusReasonCode
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPropertyProperties.java", "license": "mit", "size": 9344 }
[ "com.azure.resourcemanager.billing.models.BillingProfileStatusReasonCode" ]
import com.azure.resourcemanager.billing.models.BillingProfileStatusReasonCode;
import com.azure.resourcemanager.billing.models.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
57,664
EClass getDataOutputAssociation();
EClass getDataOutputAssociation();
/** * Returns the meta object for class '{@link org.eclipse.bpmn2.DataOutputAssociation <em>Data Output Association</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Data Output Association</em>'. * @see org.eclipse.bpmn2.DataOutputAssociation * @generated */
Returns the meta object for class '<code>org.eclipse.bpmn2.DataOutputAssociation Data Output Association</code>'.
getDataOutputAssociation
{ "repo_name": "lqjack/fixflow", "path": "modules/fixflow-core/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 1014933 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,408,075
public static Clustering createSingletonClustering (InstanceList instances) { int[] labels = new int[instances.size()]; for (int i = 0; i < labels.length; i++) labels[i] = i; return new Clustering(instances, labels.length, labels); }
static Clustering function (InstanceList instances) { int[] labels = new int[instances.size()]; for (int i = 0; i < labels.length; i++) labels[i] = i; return new Clustering(instances, labels.length, labels); }
/** * Initializes Clustering to one Instance per cluster. * @param instances * @return Singleton Clustering. */
Initializes Clustering to one Instance per cluster
createSingletonClustering
{ "repo_name": "shalomeir/tctm", "path": "src/cc/mallet/cluster/util/ClusterUtils.java", "license": "epl-1.0", "size": 6874 }
[ "cc.mallet.cluster.Clustering", "cc.mallet.types.InstanceList" ]
import cc.mallet.cluster.Clustering; import cc.mallet.types.InstanceList;
import cc.mallet.cluster.*; import cc.mallet.types.*;
[ "cc.mallet.cluster", "cc.mallet.types" ]
cc.mallet.cluster; cc.mallet.types;
215,186
public ISarlFieldBuilder addSarlField(String name) { return this.addVarSarlField(name); } @Inject private Provider<ISarlClassBuilder> iSarlClassBuilderProvider;
ISarlFieldBuilder function(String name) { return this.addVarSarlField(name); } private Provider<ISarlClassBuilder> iSarlClassBuilderProvider;
/** Create a SarlField. * * <p>This function is equivalent to {@link #addVarSarlField}. * @param name - the name of the SarlField. * @return the builder. */
Create a SarlField. This function is equivalent to <code>#addVarSarlField</code>
addSarlField
{ "repo_name": "jgfoster/sarl", "path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlAnnotationTypeBuilderImpl.java", "license": "apache-2.0", "size": 7024 }
[ "javax.inject.Provider" ]
import javax.inject.Provider;
import javax.inject.*;
[ "javax.inject" ]
javax.inject;
461,684
public void start() throws AxisFault { try { embedded = new SimpleHttpServer(httpFactory, port); embedded.init(); embedded.start(); } catch (IOException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } }
void function() throws AxisFault { try { embedded = new SimpleHttpServer(httpFactory, port); embedded.init(); embedded.start(); } catch (IOException e) { log.error(e.getMessage(), e); throw AxisFault.makeFault(e); } }
/** * Start this server as a NON-daemon. */
Start this server as a NON-daemon
start
{ "repo_name": "apache/axis2-java", "path": "modules/transport/http/src/org/apache/axis2/transport/http/SimpleHTTPServer.java", "license": "apache-2.0", "size": 11212 }
[ "java.io.IOException", "org.apache.axis2.AxisFault", "org.apache.axis2.transport.http.server.SimpleHttpServer" ]
import java.io.IOException; import org.apache.axis2.AxisFault; import org.apache.axis2.transport.http.server.SimpleHttpServer;
import java.io.*; import org.apache.axis2.*; import org.apache.axis2.transport.http.server.*;
[ "java.io", "org.apache.axis2" ]
java.io; org.apache.axis2;
1,586,836
public ArrayList<DataNode> getDataNodes() { ArrayList<DataNode> list = new ArrayList<DataNode>(); for (int i = 0; i < dataNodes.size(); i++) { DataNode node = dataNodes.get(i).datanode; list.add(node); } return list; }
ArrayList<DataNode> function() { ArrayList<DataNode> list = new ArrayList<DataNode>(); for (int i = 0; i < dataNodes.size(); i++) { DataNode node = dataNodes.get(i).datanode; list.add(node); } return list; }
/** * Gets a list of the started DataNodes. May be empty. */
Gets a list of the started DataNodes. May be empty
getDataNodes
{ "repo_name": "vlajos/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java", "license": "apache-2.0", "size": 105726 }
[ "java.util.ArrayList", "org.apache.hadoop.hdfs.server.datanode.DataNode" ]
import java.util.ArrayList; import org.apache.hadoop.hdfs.server.datanode.DataNode;
import java.util.*; import org.apache.hadoop.hdfs.server.datanode.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
952,916
public CcLibraryHelper addDefines(Iterable<String> defines) { Iterables.addAll(this.defines, defines); return this; }
CcLibraryHelper function(Iterable<String> defines) { Iterables.addAll(this.defines, defines); return this; }
/** * Adds the given defines to the compiler command line. */
Adds the given defines to the compiler command line
addDefines
{ "repo_name": "hermione521/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java", "license": "apache-2.0", "size": 61939 }
[ "com.google.common.collect.Iterables" ]
import com.google.common.collect.Iterables;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
2,686,163
@Test public void testXmlTransient() throws Exception { Logger.getLogger(getClass()).debug("TEST " + name.getMethodName()); object.setNode(descriptor1); String xml = ConfigUtility.getStringForGraph(object); assertTrue(xml.contains("<nodeId>")); assertTrue(xml.contains("<nodeName>")); assertTrue(xml.contains("<nodeTerminologyId>")); assertTrue(xml.contains("<nodeTerminology>")); assertTrue(xml.contains("<nodeVersion>")); assertFalse(xml.contains("<node>")); }
void function() throws Exception { Logger.getLogger(getClass()).debug(STR + name.getMethodName()); object.setNode(descriptor1); String xml = ConfigUtility.getStringForGraph(object); assertTrue(xml.contains(STR)); assertTrue(xml.contains(STR)); assertTrue(xml.contains(STR)); assertTrue(xml.contains(STR)); assertTrue(xml.contains(STR)); assertFalse(xml.contains(STR)); }
/** * Test xml transient fields * * @throws Exception the exception */
Test xml transient fields
testXmlTransient
{ "repo_name": "WestCoastInformatics/UMLS-Terminology-Server", "path": "jpa-model/src/test/java/com/wci/umls/server/jpa/test/content/DescriptorTreePositionJpaUnitTest.java", "license": "apache-2.0", "size": 7036 }
[ "com.wci.umls.server.helpers.ConfigUtility", "org.apache.log4j.Logger", "org.junit.Assert" ]
import com.wci.umls.server.helpers.ConfigUtility; import org.apache.log4j.Logger; import org.junit.Assert;
import com.wci.umls.server.helpers.*; import org.apache.log4j.*; import org.junit.*;
[ "com.wci.umls", "org.apache.log4j", "org.junit" ]
com.wci.umls; org.apache.log4j; org.junit;
79,275
protected boolean setLog(ComponentStateLog log) { current = true; LogType newType = getType(log); this.log = log; stringValue = convertToString(newType); boolean changed = type != newType || stringValue.length() > maxWidth; if (stringValue.length() > maxWidth) { maxWidth = stringValue.length(); } this.type = newType; return changed; }
boolean function(ComponentStateLog log) { current = true; LogType newType = getType(log); this.log = log; stringValue = convertToString(newType); boolean changed = type != newType stringValue.length() > maxWidth; if (stringValue.length() > maxWidth) { maxWidth = stringValue.length(); } this.type = newType; return changed; }
/** * Returns true iff the given log has a different type to the previous type or requires a larger width. */
Returns true iff the given log has a different type to the previous type or requires a larger width
setLog
{ "repo_name": "OliverColeman/europa", "path": "src/main/java/com/ojcoleman/europa/monitor/OverviewMonitor.java", "license": "gpl-3.0", "size": 11872 }
[ "com.ojcoleman.europa.configurable.ComponentStateLog" ]
import com.ojcoleman.europa.configurable.ComponentStateLog;
import com.ojcoleman.europa.configurable.*;
[ "com.ojcoleman.europa" ]
com.ojcoleman.europa;
568,969
public void output(ItemStack stack, World world, int x, int y, int z, int direction);
void function(ItemStack stack, World world, int x, int y, int z, int direction);
/** * Output an item. * * Do not null the passed stack, keep it at stack size 0 instead. * * @param stack Item to output * @param world World the interactive sorter is in * @param position Position of the interactive sorter * @param direction Direction the item is being OUTPUT from */
Output an item. Do not null the passed stack, keep it at stack size 0 instead
output
{ "repo_name": "Vexatos/PeripheralsPlusPlus", "path": "src/api/resources/reference/miscperipherals/api/IInteractiveSorterOutput.java", "license": "gpl-2.0", "size": 824 }
[ "net.minecraft.item.ItemStack", "net.minecraft.world.World" ]
import net.minecraft.item.ItemStack; import net.minecraft.world.World;
import net.minecraft.item.*; import net.minecraft.world.*;
[ "net.minecraft.item", "net.minecraft.world" ]
net.minecraft.item; net.minecraft.world;
1,378,108
@Override public void handle(Callback callbacks[]) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof NameCallback) { if (realm.getContainer().getLogger().isTraceEnabled()) realm.getContainer().getLogger().trace(sm.getString("jaasCallback.username", username)); ((NameCallback) callbacks[i]).setName(username); } else if (callbacks[i] instanceof PasswordCallback) { final char[] passwordcontents; if (password != null) { passwordcontents = password.toCharArray(); } else { passwordcontents = new char[0]; } ((PasswordCallback) callbacks[i]).setPassword (passwordcontents); } else if (callbacks[i] instanceof TextInputCallback) { TextInputCallback cb = ((TextInputCallback) callbacks[i]); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals("cnonce")) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals("realmName")) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals("authMethod")) { cb.setText(authMethod); } else { throw new UnsupportedCallbackException(callbacks[i]); } } else { throw new UnsupportedCallbackException(callbacks[i]); } } }
void function(Callback callbacks[]) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof NameCallback) { if (realm.getContainer().getLogger().isTraceEnabled()) realm.getContainer().getLogger().trace(sm.getString(STR, username)); ((NameCallback) callbacks[i]).setName(username); } else if (callbacks[i] instanceof PasswordCallback) { final char[] passwordcontents; if (password != null) { passwordcontents = password.toCharArray(); } else { passwordcontents = new char[0]; } ((PasswordCallback) callbacks[i]).setPassword (passwordcontents); } else if (callbacks[i] instanceof TextInputCallback) { TextInputCallback cb = ((TextInputCallback) callbacks[i]); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals(STR)) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals(STR)) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals(STR)) { cb.setText(authMethod); } else { throw new UnsupportedCallbackException(callbacks[i]); } } else { throw new UnsupportedCallbackException(callbacks[i]); } } }
/** * Retrieve the information requested in the provided <code>Callbacks</code>. * This implementation only recognizes {@link NameCallback}, * {@link PasswordCallback} and {@link TextInputCallback}. * {@link TextInputCallback} is used to pass the various additional * parameters required for DIGEST authentication. * * @param callbacks The set of <code>Callback</code>s to be processed * * @exception IOException if an input/output error occurs * @exception UnsupportedCallbackException if the login method requests * an unsupported callback type */
Retrieve the information requested in the provided <code>Callbacks</code>. This implementation only recognizes <code>NameCallback</code>, <code>PasswordCallback</code> and <code>TextInputCallback</code>. <code>TextInputCallback</code> is used to pass the various additional parameters required for DIGEST authentication
handle
{ "repo_name": "pistolove/sourcecode4junit", "path": "Source4Tomcat/src/org/apache/catalina/realm/JAASCallbackHandler.java", "license": "apache-2.0", "size": 8278 }
[ "java.io.IOException", "javax.security.auth.callback.Callback", "javax.security.auth.callback.NameCallback", "javax.security.auth.callback.PasswordCallback", "javax.security.auth.callback.TextInputCallback", "javax.security.auth.callback.UnsupportedCallbackException" ]
import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.TextInputCallback; import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.*; import javax.security.auth.callback.*;
[ "java.io", "javax.security" ]
java.io; javax.security;
921,918
@Nullable public static <T> T newInstance(Class<T> cls) throws IgniteCheckedException { boolean set = false; Constructor<T> ctor = null; try { ctor = cls.getDeclaredConstructor(); if (ctor == null) return null; if (!ctor.isAccessible()) { ctor.setAccessible(true); set = true; } return ctor.newInstance(); } catch (NoSuchMethodException e) { throw new IgniteCheckedException("Failed to find empty constructor for class: " + cls, e); } catch (InstantiationException | InvocationTargetException | IllegalAccessException e) { throw new IgniteCheckedException("Failed to create new instance for class: " + cls, e); } finally { if (ctor != null && set) ctor.setAccessible(false); } }
@Nullable static <T> T function(Class<T> cls) throws IgniteCheckedException { boolean set = false; Constructor<T> ctor = null; try { ctor = cls.getDeclaredConstructor(); if (ctor == null) return null; if (!ctor.isAccessible()) { ctor.setAccessible(true); set = true; } return ctor.newInstance(); } catch (NoSuchMethodException e) { throw new IgniteCheckedException(STR + cls, e); } catch (InstantiationException InvocationTargetException IllegalAccessException e) { throw new IgniteCheckedException(STR + cls, e); } finally { if (ctor != null && set) ctor.setAccessible(false); } }
/** * Creates new instance of a class only if it has an empty constructor (can be non-public). * * @param cls Class to instantiate. * @return New instance of the class or {@code null} if empty constructor could not be assigned. * @throws IgniteCheckedException If failed. */
Creates new instance of a class only if it has an empty constructor (can be non-public)
newInstance
{ "repo_name": "WilliamDo/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 325083 }
[ "java.lang.reflect.Constructor", "java.lang.reflect.InvocationTargetException", "org.apache.ignite.IgniteCheckedException", "org.jetbrains.annotations.Nullable" ]
import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import org.apache.ignite.IgniteCheckedException; import org.jetbrains.annotations.Nullable;
import java.lang.reflect.*; import org.apache.ignite.*; import org.jetbrains.annotations.*;
[ "java.lang", "org.apache.ignite", "org.jetbrains.annotations" ]
java.lang; org.apache.ignite; org.jetbrains.annotations;
1,202,584
@Override public void characters(char[] ch, int start, int length) throws SAXException { if (currentElement == null) { throw new SAXException("misformed XML"); } else { currentValue += new String(ch, start, length); } }
void function(char[] ch, int start, int length) throws SAXException { if (currentElement == null) { throw new SAXException(STR); } else { currentValue += new String(ch, start, length); } }
/** Function to handle the characters that have been passed to this object from the main * GenericXMLParser; The element these characters belong to has been set by the previous startElement * event * * @param ch The character array containing the characters * @param start The position where the characters corresponding to this element start * @param length The length of the character string for the current element */
Function to handle the characters that have been passed to this object from the main GenericXMLParser; The element these characters belong to has been set by the previous startElement event
characters
{ "repo_name": "BiosemanticsDotOrg/GeneDiseasePaper", "path": "java/DataImport/src/org/erasmusmc/dataimport/Medline/xmlparsers/NodeHandler.java", "license": "agpl-3.0", "size": 15807 }
[ "org.xml.sax.SAXException" ]
import org.xml.sax.SAXException;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
1,026,190
public Indication getIndication(final String tokenId) { XmlToken token = getTokenById(tokenId); if (token != null) { return token.getIndication(); } return null; }
Indication function(final String tokenId) { XmlToken token = getTokenById(tokenId); if (token != null) { return token.getIndication(); } return null; }
/** * This method returns the indication obtained after the validation of a token. * * @param tokenId * DSS unique identifier of the token * @return the indication for the given token Id */
This method returns the indication obtained after the validation of a token
getIndication
{ "repo_name": "openlimit-signcubes/dss", "path": "dss-simple-report-jaxb/src/main/java/eu/europa/esig/dss/simplereport/SimpleReport.java", "license": "lgpl-2.1", "size": 12053 }
[ "eu.europa.esig.dss.enumerations.Indication", "eu.europa.esig.dss.simplereport.jaxb.XmlToken" ]
import eu.europa.esig.dss.enumerations.Indication; import eu.europa.esig.dss.simplereport.jaxb.XmlToken;
import eu.europa.esig.dss.enumerations.*; import eu.europa.esig.dss.simplereport.jaxb.*;
[ "eu.europa.esig" ]
eu.europa.esig;
706,344
public ServiceResponse<SubProductInner> putSubResource(SubProductInner product) throws CloudException, IOException, InterruptedException { return putSubResourceAsync(product).toBlocking().last(); }
ServiceResponse<SubProductInner> function(SubProductInner product) throws CloudException, IOException, InterruptedException { return putSubResourceAsync(product).toBlocking().last(); }
/** * Long running put request with sub resource. * * @param product Sub Product to put * @throws CloudException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @throws InterruptedException exception thrown when long running operation is interrupted * @return the SubProductInner object wrapped in ServiceResponse if successful. */
Long running put request with sub resource
putSubResource
{ "repo_name": "haocs/autorest", "path": "src/generator/AutoRest.Java.Azure.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsInner.java", "license": "mit", "size": 313853 }
[ "com.microsoft.azure.CloudException", "com.microsoft.rest.ServiceResponse", "java.io.IOException" ]
import com.microsoft.azure.CloudException; import com.microsoft.rest.ServiceResponse; import java.io.IOException;
import com.microsoft.azure.*; import com.microsoft.rest.*; import java.io.*;
[ "com.microsoft.azure", "com.microsoft.rest", "java.io" ]
com.microsoft.azure; com.microsoft.rest; java.io;
2,482,504
// ///////////////////////////////////////////////////////// public void setFormatter(final int col, final Format formatter) { getTableColumn(col).setFormatter(formatter); }
void function(final int col, final Format formatter) { getTableColumn(col).setFormatter(formatter); }
/** * Sets the formatter. * * @param col the col * @param formatter the formatter */
Sets the formatter
setFormatter
{ "repo_name": "kiswanij/jk-util", "path": "src/main/java/com/jk/util/model/table/JKTableModel.java", "license": "mit", "size": 27674 }
[ "java.text.Format" ]
import java.text.Format;
import java.text.*;
[ "java.text" ]
java.text;
1,076,775
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) { if (slotInd == 0) { this.nameField.setText(stack == null ? "" : stack.getDisplayName()); this.nameField.setEnabled(stack != null); if (stack != null) { this.renameItem(); } } }
void function(Container containerToSend, int slotInd, ItemStack stack) { if (slotInd == 0) { this.nameField.setText(stack == null ? "" : stack.getDisplayName()); this.nameField.setEnabled(stack != null); if (stack != null) { this.renameItem(); } } }
/** * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual * contents of that slot. Args: Container, slot number, slot contents */
Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual contents of that slot. Args: Container, slot number, slot contents
sendSlotContents
{ "repo_name": "SkidJava/BaseClient", "path": "new_1.8.8/net/minecraft/client/gui/GuiRepair.java", "license": "gpl-2.0", "size": 8373 }
[ "net.minecraft.inventory.Container", "net.minecraft.item.ItemStack" ]
import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack;
import net.minecraft.inventory.*; import net.minecraft.item.*;
[ "net.minecraft.inventory", "net.minecraft.item" ]
net.minecraft.inventory; net.minecraft.item;
1,602,706
public void setWebApp(WebApp webApp) { if (c_logger.isTraceDebugEnabled()) { c_logger.traceDebug(this, "setWebApp"," setWebApp = " + webApp); } if(this._webApp == null) { this._webApp = webApp; } }
void function(WebApp webApp) { if (c_logger.isTraceDebugEnabled()) { c_logger.traceDebug(this, STR,STR + webApp); } if(this._webApp == null) { this._webApp = webApp; } }
/** * Set the WebApp for this application * @param webApp */
Set the WebApp for this application
setWebApp
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.sipcontainer/src/com/ibm/ws/sip/container/parser/SipAppDesc.java", "license": "epl-1.0", "size": 54998 }
[ "com.ibm.ws.webcontainer.webapp.WebApp" ]
import com.ibm.ws.webcontainer.webapp.WebApp;
import com.ibm.ws.webcontainer.webapp.*;
[ "com.ibm.ws" ]
com.ibm.ws;
2,046,507
public void accept(final MethodVisitor mv) { AbstractInsnNode insn = first; while (insn != null) { insn.accept(mv); insn = insn.next; } }
void function(final MethodVisitor mv) { AbstractInsnNode insn = first; while (insn != null) { insn.accept(mv); insn = insn.next; } }
/** * Makes the given visitor visit all of the instructions in this list. * * @param mv the method visitor that must visit the instructions. */
Makes the given visitor visit all of the instructions in this list
accept
{ "repo_name": "nxmatic/objectweb-asm-4.0", "path": "src/org/objectweb/asm/tree/InsnList.java", "license": "bsd-3-clause", "size": 17746 }
[ "org.objectweb.asm.MethodVisitor" ]
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.*;
[ "org.objectweb.asm" ]
org.objectweb.asm;
12,777
@Override public void concat(Path trg, Path [] psrcs) throws IOException { statistics.incrementWriteOps(1); storageStatistics.incrementOpCounter(OpType.CONCAT); // Make target absolute Path absF = fixRelativePart(trg); // Make all srcs absolute Path[] srcs = new Path[psrcs.length]; for (int i=0; i<psrcs.length; i++) { srcs[i] = fixRelativePart(psrcs[i]); } // Try the concat without resolving any links String[] srcsStr = new String[psrcs.length]; try { for (int i=0; i<psrcs.length; i++) { srcsStr[i] = getPathName(srcs[i]); } dfs.concat(getPathName(absF), srcsStr); } catch (UnresolvedLinkException e) { // Exception could be from trg or any src. // Fully resolve trg and srcs. Fail if any of them are a symlink. FileStatus stat = getFileLinkStatus(absF); if (stat.isSymlink()) { throw new IOException("Cannot concat with a symlink target: " + trg + " -> " + stat.getPath()); } absF = fixRelativePart(stat.getPath()); for (int i=0; i<psrcs.length; i++) { stat = getFileLinkStatus(srcs[i]); if (stat.isSymlink()) { throw new IOException("Cannot concat with a symlink src: " + psrcs[i] + " -> " + stat.getPath()); } srcs[i] = fixRelativePart(stat.getPath()); } // Try concat again. Can still race with another symlink. for (int i=0; i<psrcs.length; i++) { srcsStr[i] = getPathName(srcs[i]); } dfs.concat(getPathName(absF), srcsStr); } }
void function(Path trg, Path [] psrcs) throws IOException { statistics.incrementWriteOps(1); storageStatistics.incrementOpCounter(OpType.CONCAT); Path absF = fixRelativePart(trg); Path[] srcs = new Path[psrcs.length]; for (int i=0; i<psrcs.length; i++) { srcs[i] = fixRelativePart(psrcs[i]); } String[] srcsStr = new String[psrcs.length]; try { for (int i=0; i<psrcs.length; i++) { srcsStr[i] = getPathName(srcs[i]); } dfs.concat(getPathName(absF), srcsStr); } catch (UnresolvedLinkException e) { FileStatus stat = getFileLinkStatus(absF); if (stat.isSymlink()) { throw new IOException(STR + trg + STR + stat.getPath()); } absF = fixRelativePart(stat.getPath()); for (int i=0; i<psrcs.length; i++) { stat = getFileLinkStatus(srcs[i]); if (stat.isSymlink()) { throw new IOException(STR + psrcs[i] + STR + stat.getPath()); } srcs[i] = fixRelativePart(stat.getPath()); } for (int i=0; i<psrcs.length; i++) { srcsStr[i] = getPathName(srcs[i]); } dfs.concat(getPathName(absF), srcsStr); } }
/** * Move blocks from srcs to trg and delete srcs afterwards. * The file block sizes must be the same. * * @param trg existing file to append to * @param psrcs list of files (same block size, same replication) * @throws IOException */
Move blocks from srcs to trg and delete srcs afterwards. The file block sizes must be the same
concat
{ "repo_name": "wenxinhe/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java", "license": "apache-2.0", "size": 105324 }
[ "java.io.IOException", "org.apache.hadoop.fs.FileStatus", "org.apache.hadoop.fs.Path", "org.apache.hadoop.fs.UnresolvedLinkException", "org.apache.hadoop.hdfs.DFSOpsCountStatistics" ]
import java.io.IOException; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.UnresolvedLinkException; import org.apache.hadoop.hdfs.DFSOpsCountStatistics;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,409,859
@DoesServiceRequest public void upload(final InputStream sourceStream, final long length, final AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException, IOException { if (opContext == null) { opContext = new OperationContext(); } options = FileRequestOptions.applyDefaults(options, this.fileServiceClient); if (length <= 0) { throw new IllegalArgumentException(SR.INVALID_FILE_LENGTH); } if (sourceStream.markSupported()) { // Mark sourceStream for current position. sourceStream.mark(Constants.MAX_MARK_LENGTH); } final FileOutputStream streamRef = this.openWriteNew(length, accessCondition, options, opContext); try { streamRef.write(sourceStream, length); } finally { streamRef.close(); } }
void function(final InputStream sourceStream, final long length, final AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException, IOException { if (opContext == null) { opContext = new OperationContext(); } options = FileRequestOptions.applyDefaults(options, this.fileServiceClient); if (length <= 0) { throw new IllegalArgumentException(SR.INVALID_FILE_LENGTH); } if (sourceStream.markSupported()) { sourceStream.mark(Constants.MAX_MARK_LENGTH); } final FileOutputStream streamRef = this.openWriteNew(length, accessCondition, options, opContext); try { streamRef.write(sourceStream, length); } finally { streamRef.close(); } }
/** * Uploads the source stream data to the file using the specified access condition, request options, and operation * context. * * @param sourceStream * An {@link IntputStream} object to read from. * @param length * A <code>long</code> which represents the length, in bytes, of the stream data. This must be great than * zero. * @param accessCondition * An {@link AccessCondition} object which represents the access conditions for the file. * @param options * A {@link FileRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudFileClient}). * @param opContext * An {@link OperationContext} object which represents the context for the current operation. This object * is used to track requests to the storage service, and to provide additional runtime information about * the operation. * * @throws IOException * If an I/O exception occurred. * @throws StorageException * If a storage service error occurred. */
Uploads the source stream data to the file using the specified access condition, request options, and operation context
upload
{ "repo_name": "peterhoeltschi/AzureStorage", "path": "microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java", "license": "apache-2.0", "size": 119971 }
[ "com.microsoft.azure.storage.AccessCondition", "com.microsoft.azure.storage.Constants", "com.microsoft.azure.storage.OperationContext", "com.microsoft.azure.storage.StorageException", "java.io.IOException", "java.io.InputStream" ]
import com.microsoft.azure.storage.AccessCondition; import com.microsoft.azure.storage.Constants; import com.microsoft.azure.storage.OperationContext; import com.microsoft.azure.storage.StorageException; import java.io.IOException; import java.io.InputStream;
import com.microsoft.azure.storage.*; import java.io.*;
[ "com.microsoft.azure", "java.io" ]
com.microsoft.azure; java.io;
2,774,558
public IncomeVerificationPrecheckMilitaryInfo getUsMilitaryInfo() { return usMilitaryInfo; }
IncomeVerificationPrecheckMilitaryInfo function() { return usMilitaryInfo; }
/** * Get usMilitaryInfo * @return usMilitaryInfo **/
Get usMilitaryInfo
getUsMilitaryInfo
{ "repo_name": "plaid/plaid-java", "path": "src/main/java/com/plaid/client/model/IncomeVerificationPrecheckRequest.java", "license": "mit", "size": 9709 }
[ "com.plaid.client.model.IncomeVerificationPrecheckMilitaryInfo" ]
import com.plaid.client.model.IncomeVerificationPrecheckMilitaryInfo;
import com.plaid.client.model.*;
[ "com.plaid.client" ]
com.plaid.client;
1,350,706
public static MozuClient<com.mozu.api.contracts.commerceruntime.channels.ChannelGroup> updateChannelGroupClient(com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, String code, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.ChannelGroupUrl.updateChannelGroupUrl(code, responseFields); String verb = "PUT"; Class<?> clz = com.mozu.api.contracts.commerceruntime.channels.ChannelGroup.class; MozuClient<com.mozu.api.contracts.commerceruntime.channels.ChannelGroup> mozuClient = new MozuClient(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.setBody(channelGroup); return mozuClient; }
static MozuClient<com.mozu.api.contracts.commerceruntime.channels.ChannelGroup> function(com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, String code, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.ChannelGroupUrl.updateChannelGroupUrl(code, responseFields); String verb = "PUT"; Class<?> clz = com.mozu.api.contracts.commerceruntime.channels.ChannelGroup.class; MozuClient<com.mozu.api.contracts.commerceruntime.channels.ChannelGroup> mozuClient = new MozuClient(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.setBody(channelGroup); return mozuClient; }
/** * Updates one or more properties of a defined channel group. * <p><pre><code> * MozuClient<com.mozu.api.contracts.commerceruntime.channels.ChannelGroup> mozuClient=UpdateChannelGroupClient( channelGroup, code, responseFields); * client.setBaseAddress(url); * client.executeRequest(); * ChannelGroup channelGroup = client.Result(); * </code></pre></p> * @param code Code that identifies the channel group. * @param responseFields Use this field to include those fields which are not included by default. * @param channelGroup Properties of the channel group to update. * @return Mozu.Api.MozuClient <com.mozu.api.contracts.commerceruntime.channels.ChannelGroup> * @see com.mozu.api.contracts.commerceruntime.channels.ChannelGroup * @see com.mozu.api.contracts.commerceruntime.channels.ChannelGroup */
Updates one or more properties of a defined channel group. <code><code> MozuClient mozuClient=UpdateChannelGroupClient( channelGroup, code, responseFields); client.setBaseAddress(url); client.executeRequest(); ChannelGroup channelGroup = client.Result(); </code></code>
updateChannelGroupClient
{ "repo_name": "eileenzhuang1/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/ChannelGroupClient.java", "license": "mit", "size": 11623 }
[ "com.mozu.api.MozuClient", "com.mozu.api.MozuUrl" ]
import com.mozu.api.MozuClient; import com.mozu.api.MozuUrl;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
1,681,800
public void updateForm() { if (!(getSyncSource() instanceof PIMCalendarSyncSource)) { notifyError( new AdminException("This is not a PIMCalendarSyncSource! " + "Unable to process SyncSource values." ) ); return; } super.updateForm(); updateEntityTypeCheckBoxes(); }
void function() { if (!(getSyncSource() instanceof PIMCalendarSyncSource)) { notifyError( new AdminException(STR + STR ) ); return; } super.updateForm(); updateEntityTypeCheckBoxes(); }
/** * Updates the form */
Updates the form
updateForm
{ "repo_name": "accesstest3/cfunambol", "path": "modules/foundation/foundation-core/src/main/java/com/funambol/foundation/admin/PIMCalendarSyncSourceConfigPanel.java", "license": "agpl-3.0", "size": 11618 }
[ "com.funambol.admin.AdminException", "com.funambol.foundation.engine.source.PIMCalendarSyncSource" ]
import com.funambol.admin.AdminException; import com.funambol.foundation.engine.source.PIMCalendarSyncSource;
import com.funambol.admin.*; import com.funambol.foundation.engine.source.*;
[ "com.funambol.admin", "com.funambol.foundation" ]
com.funambol.admin; com.funambol.foundation;
769,564
@Override public ChannelFuture writeRstStream(ChannelHandlerContext ctx, int streamId, long errorCode, ChannelPromise promise) { Http2Stream stream = connection().stream(streamId); ChannelFuture future = frameWriter().writeRstStream(ctx, streamId, errorCode, promise); ctx.flush(); if (stream != null) { stream.resetSent(); closeStream(stream, promise); } return future; }
ChannelFuture function(ChannelHandlerContext ctx, int streamId, long errorCode, ChannelPromise promise) { Http2Stream stream = connection().stream(streamId); ChannelFuture future = frameWriter().writeRstStream(ctx, streamId, errorCode, promise); ctx.flush(); if (stream != null) { stream.resetSent(); closeStream(stream, promise); } return future; }
/** * Writes a {@code RST_STREAM} frame to the remote endpoint and updates the connection state appropriately. */
Writes a RST_STREAM frame to the remote endpoint and updates the connection state appropriately
writeRstStream
{ "repo_name": "meghana0507/grpc-java-poll", "path": "lib/netty/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java", "license": "bsd-3-clause", "size": 20151 }
[ "io.netty.channel.ChannelFuture", "io.netty.channel.ChannelHandlerContext", "io.netty.channel.ChannelPromise" ]
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise;
import io.netty.channel.*;
[ "io.netty.channel" ]
io.netty.channel;
744,060
public Node getXblFirstChild() { return xblManager.getXblFirstChild(this); }
Node function() { return xblManager.getXblFirstChild(this); }
/** * Get the first child node of this node in the fully flattened tree. */
Get the first child node of this node in the fully flattened tree
getXblFirstChild
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/dom/AbstractDocument.java", "license": "apache-2.0", "size": 95361 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,813,084
checkNotNull(from); checkNotNull(to); CharBuffer buf = CharBuffer.allocate(BUF_SIZE); long total = 0; while (from.read(buf) != -1) { buf.flip(); to.append(buf); total += buf.remaining(); buf.clear(); } return total; }
checkNotNull(from); checkNotNull(to); CharBuffer buf = CharBuffer.allocate(BUF_SIZE); long total = 0; while (from.read(buf) != -1) { buf.flip(); to.append(buf); total += buf.remaining(); buf.clear(); } return total; }
/** * Copies all characters between the {@link Readable} and {@link Appendable} * objects. Does not close or flush either object. * * @param from the object to read from * @param to the object to write to * @return the number of characters copied * @throws IOException if an I/O error occurs */
Copies all characters between the <code>Readable</code> and <code>Appendable</code> objects. Does not close or flush either object
copy
{ "repo_name": "privatemousse/guava", "path": "guava/src/com/google/common/io/CharStreams.java", "license": "mit", "size": 7412 }
[ "com.google.common.base.Preconditions", "java.nio.CharBuffer" ]
import com.google.common.base.Preconditions; import java.nio.CharBuffer;
import com.google.common.base.*; import java.nio.*;
[ "com.google.common", "java.nio" ]
com.google.common; java.nio;
1,898,705
@Generated("This method was generated using jOOQ-tools") static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Seq<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>> crossJoin(Stream<T1> s1, Stream<T2> s2, Stream<T3> s3, Stream<T4> s4, Stream<T5> s5, Stream<T6> s6, Stream<T7> s7, Stream<T8> s8, Stream<T9> s9) { return crossJoin(seq(s1), seq(s2), seq(s3), seq(s4), seq(s5), seq(s6), seq(s7), seq(s8), seq(s9)); }
@Generated(STR) static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Seq<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>> crossJoin(Stream<T1> s1, Stream<T2> s2, Stream<T3> s3, Stream<T4> s4, Stream<T5> s5, Stream<T6> s6, Stream<T7> s7, Stream<T8> s8, Stream<T9> s9) { return crossJoin(seq(s1), seq(s2), seq(s3), seq(s4), seq(s5), seq(s6), seq(s7), seq(s8), seq(s9)); }
/** * Cross join 9 streams into one. * <p> * <code><pre> * // (tuple(1, "a"), tuple(1, "b"), tuple(2, "a"), tuple(2, "b")) * Seq.of(1, 2).crossJoin(Seq.of("a", "b")) * </pre></code> */
Cross join 9 streams into one. <code><code> (tuple(1, "a"), tuple(1, "b"), tuple(2, "a"), tuple(2, "b")) Seq.of(1, 2).crossJoin(Seq.of("a", "b")) </code></code>
crossJoin
{ "repo_name": "stephenh/jOOL", "path": "src/main/java/org/jooq/lambda/Seq.java", "license": "apache-2.0", "size": 198501 }
[ "java.util.stream.Stream", "javax.annotation.Generated", "org.jooq.lambda.tuple.Tuple9" ]
import java.util.stream.Stream; import javax.annotation.Generated; import org.jooq.lambda.tuple.Tuple9;
import java.util.stream.*; import javax.annotation.*; import org.jooq.lambda.tuple.*;
[ "java.util", "javax.annotation", "org.jooq.lambda" ]
java.util; javax.annotation; org.jooq.lambda;
424,281
@Override public Map getForcedReadOnlyFields() { Map map = super.getForcedReadOnlyFields(); map.put(KFSPropertyConstants.AMOUNT, Boolean.TRUE); map.put("invoiceItemTaxAmount", Boolean.TRUE); map.put("openAmount", Boolean.TRUE); return map; }
Map function() { Map map = super.getForcedReadOnlyFields(); map.put(KFSPropertyConstants.AMOUNT, Boolean.TRUE); map.put(STR, Boolean.TRUE); map.put(STR, Boolean.TRUE); return map; }
/** * Make amount and sales tax read only * * @see org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase#getForcedReadOnlyFields() */
Make amount and sales tax read only
getForcedReadOnlyFields
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/document/web/struts/CustomerInvoiceForm.java", "license": "agpl-3.0", "size": 9944 }
[ "java.util.Map", "org.kuali.kfs.sys.KFSPropertyConstants" ]
import java.util.Map; import org.kuali.kfs.sys.KFSPropertyConstants;
import java.util.*; import org.kuali.kfs.sys.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
978,909
protected AuthenticationSession getAuthenticationSession() { return getPersistenceSession().getServicesInjector().lookupService(AuthenticationSessionProvider.class).getAuthenticationSession(); }
AuthenticationSession function() { return getPersistenceSession().getServicesInjector().lookupService(AuthenticationSessionProvider.class).getAuthenticationSession(); }
/** * Default implementation looks up from singleton, but can be overridden for * testing. */
Default implementation looks up from singleton, but can be overridden for testing
getAuthenticationSession
{ "repo_name": "sanderginn/isis", "path": "core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java", "license": "apache-2.0", "size": 45612 }
[ "org.apache.isis.core.commons.authentication.AuthenticationSession", "org.apache.isis.core.commons.authentication.AuthenticationSessionProvider" ]
import org.apache.isis.core.commons.authentication.AuthenticationSession; import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
import org.apache.isis.core.commons.authentication.*;
[ "org.apache.isis" ]
org.apache.isis;
467,435
private static String parseName(final SimpleParser parser) { final StringBuilder result = new StringBuilder(); parser.eatWhiteSpace(); while (parser.isIdentifier()) { result.append(parser.readChar()); } return result.toString(); }
static String function(final SimpleParser parser) { final StringBuilder result = new StringBuilder(); parser.eatWhiteSpace(); while (parser.isIdentifier()) { result.append(parser.readChar()); } return result.toString(); }
/** * Parse a name. * @param parser The parser to use. * @return The name. */
Parse a name
parseName
{ "repo_name": "larhoy/SentimentProjectV2", "path": "SentimentAnalysisV2/encog-core-3.1.0/src/main/java/org/encog/ml/factory/parse/ArchitectureParse.java", "license": "mit", "size": 5436 }
[ "org.encog.util.SimpleParser" ]
import org.encog.util.SimpleParser;
import org.encog.util.*;
[ "org.encog.util" ]
org.encog.util;
2,382,650
public static void unload(){ // Inform: SagaLogger.info("Unloading wars."); save(); instance = null; }
static void function(){ SagaLogger.info(STR); save(); instance = null; }
/** * Unloads the manager. * */
Unloads the manager
unload
{ "repo_name": "andfRa/Saga", "path": "src/org/saga/factions/WarManager.java", "license": "gpl-3.0", "size": 10291 }
[ "org.saga.SagaLogger" ]
import org.saga.SagaLogger;
import org.saga.*;
[ "org.saga" ]
org.saga;
1,764,519
public static List<VirtualFile> getSuitableIgnoreFiles(@NotNull Project project, @NotNull IgnoreFileType fileType, @NotNull VirtualFile file) throws ExternalFileException { List<VirtualFile> files = ContainerUtil.newArrayList(); if (file.getCanonicalPath() == null || project.getBaseDir() == null || !VfsUtilCore.isAncestor(project.getBaseDir(), file, true)) { throw new ExternalFileException(); } VirtualFile baseDir = project.getBaseDir(); if (baseDir != null && !baseDir.equals(file)) { do { file = file.getParent(); VirtualFile ignoreFile = file.findChild(fileType.getIgnoreLanguage().getFilename()); ContainerUtil.addIfNotNull(ignoreFile, files); } while (!file.equals(project.getBaseDir())); } return files; }
static List<VirtualFile> function(@NotNull Project project, @NotNull IgnoreFileType fileType, @NotNull VirtualFile file) throws ExternalFileException { List<VirtualFile> files = ContainerUtil.newArrayList(); if (file.getCanonicalPath() == null project.getBaseDir() == null !VfsUtilCore.isAncestor(project.getBaseDir(), file, true)) { throw new ExternalFileException(); } VirtualFile baseDir = project.getBaseDir(); if (baseDir != null && !baseDir.equals(file)) { do { file = file.getParent(); VirtualFile ignoreFile = file.findChild(fileType.getIgnoreLanguage().getFilename()); ContainerUtil.addIfNotNull(ignoreFile, files); } while (!file.equals(project.getBaseDir())); } return files; }
/** * Returns all Ignore files in given {@link Project} that can match current passed file. * * @param project current project * @param file current file * @return collection of suitable Ignore files * @throws ExternalFileException */
Returns all Ignore files in given <code>Project</code> that can match current passed file
getSuitableIgnoreFiles
{ "repo_name": "bedla/idea-gitignore", "path": "src/mobi/hsz/idea/gitignore/util/Utils.java", "license": "mit", "size": 15562 }
[ "com.intellij.openapi.project.Project", "com.intellij.openapi.vfs.VfsUtilCore", "com.intellij.openapi.vfs.VirtualFile", "com.intellij.util.containers.ContainerUtil", "java.util.List", "mobi.hsz.idea.gitignore.file.type.IgnoreFileType", "org.jetbrains.annotations.NotNull" ]
import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.ContainerUtil; import java.util.List; import mobi.hsz.idea.gitignore.file.type.IgnoreFileType; import org.jetbrains.annotations.NotNull;
import com.intellij.openapi.project.*; import com.intellij.openapi.vfs.*; import com.intellij.util.containers.*; import java.util.*; import mobi.hsz.idea.gitignore.file.type.*; import org.jetbrains.annotations.*;
[ "com.intellij.openapi", "com.intellij.util", "java.util", "mobi.hsz.idea", "org.jetbrains.annotations" ]
com.intellij.openapi; com.intellij.util; java.util; mobi.hsz.idea; org.jetbrains.annotations;
359,269
private CourseInfoModel srtStream(String url, boolean preferCache) throws Exception { Bundle p = new Bundle(); p.putString("format", "json"); String json = null; if (NetworkUtil.isConnected(context) && !preferCache) { // get data from server String urlWithAppendedParams = HttpManager.toGetUrl(url, p); logger.debug("Url "+urlWithAppendedParams); json = http.get(urlWithAppendedParams, getAuthHeaders()).body; // cache the response //cache.put(url, json); } else { json = cache.get(url); } if (json == null) { return null; } logger.debug("srt stream= " + json); Gson gson = new GsonBuilder().create(); CourseInfoModel res = gson.fromJson(json, CourseInfoModel.class); return res; }
CourseInfoModel function(String url, boolean preferCache) throws Exception { Bundle p = new Bundle(); p.putString(STR, "json"); String json = null; if (NetworkUtil.isConnected(context) && !preferCache) { String urlWithAppendedParams = HttpManager.toGetUrl(url, p); logger.debug(STR+urlWithAppendedParams); json = http.get(urlWithAppendedParams, getAuthHeaders()).body; } else { json = cache.get(url); } if (json == null) { return null; } logger.debug(STR + json); Gson gson = new GsonBuilder().create(); CourseInfoModel res = gson.fromJson(json, CourseInfoModel.class); return res; }
/** * Returns Stream object from the given URL. * @param url * @param preferCache * @return * @throws Exception */
Returns Stream object from the given URL
srtStream
{ "repo_name": "miptliot/edx-app-android", "path": "VideoLocker/src/main/java/org/edx/mobile/http/Api.java", "license": "apache-2.0", "size": 44937 }
[ "android.os.Bundle", "com.google.gson.Gson", "com.google.gson.GsonBuilder", "org.edx.mobile.model.api.CourseInfoModel", "org.edx.mobile.util.NetworkUtil" ]
import android.os.Bundle; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.edx.mobile.model.api.CourseInfoModel; import org.edx.mobile.util.NetworkUtil;
import android.os.*; import com.google.gson.*; import org.edx.mobile.model.api.*; import org.edx.mobile.util.*;
[ "android.os", "com.google.gson", "org.edx.mobile" ]
android.os; com.google.gson; org.edx.mobile;
235,746
void remoteFailure(ErrorExplanation explanation);
void remoteFailure(ErrorExplanation explanation);
/** * Indicates that the remote participant has failed to answer the query. * * @param explanation an explanation of failure, provided by the remote participant */
Indicates that the remote participant has failed to answer the query
remoteFailure
{ "repo_name": "joshsh/rdfagents", "path": "rdfagents-core/src/main/java/net/fortytwo/rdfagents/messaging/subscribe/old/SubscriberOld.java", "license": "mit", "size": 3654 }
[ "net.fortytwo.rdfagents.model.ErrorExplanation" ]
import net.fortytwo.rdfagents.model.ErrorExplanation;
import net.fortytwo.rdfagents.model.*;
[ "net.fortytwo.rdfagents" ]
net.fortytwo.rdfagents;
619,326
private long getRate(OFType type) { return (long) rateMeterMap.get(type).getOneMinuteRate(); }
long function(OFType type) { return (long) rateMeterMap.get(type).getOneMinuteRate(); }
/** * Returns the average meter rate within recent 1 minute. * * @param type OpenFlow message type * @return rate value */
Returns the average meter rate within recent 1 minute
getRate
{ "repo_name": "sonu283304/onos", "path": "providers/openflow/message/src/main/java/org/onosproject/provider/of/message/impl/OpenFlowControlMessageAggregator.java", "license": "apache-2.0", "size": 5474 }
[ "org.projectfloodlight.openflow.protocol.OFType" ]
import org.projectfloodlight.openflow.protocol.OFType;
import org.projectfloodlight.openflow.protocol.*;
[ "org.projectfloodlight.openflow" ]
org.projectfloodlight.openflow;
1,182,232
public void removeRoute(IpPrefix spfx, IpPrefix gpfx) { McastRouteGroup group = findMcastGroup(gpfx); if (group == null) { // The group does not exist, we can't remove it. return; } if (spfx.prefixLength() > 0) { group.removeSource(spfx); if (group.getSources().size() == 0 && group.getEgressPoints().size() == 0) { removeGroup(group); } } else { // Group remove has been explicitly requested. group.removeSources(); group.withdrawIntent(); removeGroup(group); } }
void function(IpPrefix spfx, IpPrefix gpfx) { McastRouteGroup group = findMcastGroup(gpfx); if (group == null) { return; } if (spfx.prefixLength() > 0) { group.removeSource(spfx); if (group.getSources().size() == 0 && group.getEgressPoints().size() == 0) { removeGroup(group); } } else { group.removeSources(); group.withdrawIntent(); removeGroup(group); } }
/** * Remove a multicast route. * * @param spfx the source prefix * @param gpfx the group prefix */
Remove a multicast route
removeRoute
{ "repo_name": "packet-tracker/onos-1.4.0-custom-build", "path": "apps/mfwd/src/main/java/org/onosproject/mfwd/impl/McastRouteTable.java", "license": "apache-2.0", "size": 11479 }
[ "org.onlab.packet.IpPrefix" ]
import org.onlab.packet.IpPrefix;
import org.onlab.packet.*;
[ "org.onlab.packet" ]
org.onlab.packet;
1,603,208
private void clearAllocationNodes(AllocationNode fromNode) { if (!fromNode.wasInitialized) { return; } // Bulk release allocations for performance (it's significantly faster when using // DefaultAllocator because the allocator's lock only needs to be acquired and released once) // [Internal: See b/29542039]. int allocationCount = (writeAllocationNode.wasInitialized ? 1 : 0) + ((int) (writeAllocationNode.startPosition - fromNode.startPosition) / allocationLength); Allocation[] allocationsToRelease = new Allocation[allocationCount]; AllocationNode currentNode = fromNode; for (int i = 0; i < allocationsToRelease.length; i++) { allocationsToRelease[i] = currentNode.allocation; currentNode = currentNode.clear(); } allocator.release(allocationsToRelease); }
void function(AllocationNode fromNode) { if (!fromNode.wasInitialized) { return; } int allocationCount = (writeAllocationNode.wasInitialized ? 1 : 0) + ((int) (writeAllocationNode.startPosition - fromNode.startPosition) / allocationLength); Allocation[] allocationsToRelease = new Allocation[allocationCount]; AllocationNode currentNode = fromNode; for (int i = 0; i < allocationsToRelease.length; i++) { allocationsToRelease[i] = currentNode.allocation; currentNode = currentNode.clear(); } allocator.release(allocationsToRelease); }
/** * Clears allocation nodes starting from {@code fromNode}. * * @param fromNode The node from which to clear. */
Clears allocation nodes starting from fromNode
clearAllocationNodes
{ "repo_name": "amzn/exoplayer-amazon-port", "path": "library/core/src/main/java/com/google/android/exoplayer2/source/SampleDataQueue.java", "license": "apache-2.0", "size": 20405 }
[ "com.google.android.exoplayer2.upstream.Allocation" ]
import com.google.android.exoplayer2.upstream.Allocation;
import com.google.android.exoplayer2.upstream.*;
[ "com.google.android" ]
com.google.android;
680,699
public static void assertEquals(List expecteds, List actuals) { assertEquals(null, expecteds, actuals); }
static void function(List expecteds, List actuals) { assertEquals(null, expecteds, actuals); }
/** * Asserts that two Lists are equal.<br> * * @param expecteds * @param actuals */
Asserts that two Lists are equal
assertEquals
{ "repo_name": "aalmiray/ezmorph", "path": "subprojects/ezmorph-core/src/main/java/org/kordamp/ezmorph/test/ArrayAssertions.java", "license": "apache-2.0", "size": 49243 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
370,451
@Override public CriteriaTemplate fetchBycategoryIdAndTypeId( int criteria_category_id, int criteria_type_id, boolean retrieveFromCache) { Object[] finderArgs = new Object[] { criteria_category_id, criteria_type_id }; Object result = null; if (retrieveFromCache) { result = finderCache.getResult(FINDER_PATH_FETCH_BY_CATEGORYIDANDTYPEID, finderArgs, this); } if (result instanceof CriteriaTemplate) { CriteriaTemplate criteriaTemplate = (CriteriaTemplate)result; if ((criteria_category_id != criteriaTemplate.getCriteria_category_id()) || (criteria_type_id != criteriaTemplate.getCriteria_type_id())) { result = null; } } if (result == null) { StringBundler query = new StringBundler(4); query.append(_SQL_SELECT_CRITERIATEMPLATE_WHERE); query.append(_FINDER_COLUMN_CATEGORYIDANDTYPEID_CRITERIA_CATEGORY_ID_2); query.append(_FINDER_COLUMN_CATEGORYIDANDTYPEID_CRITERIA_TYPE_ID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(criteria_category_id); qPos.add(criteria_type_id); List<CriteriaTemplate> list = q.list(); if (list.isEmpty()) { finderCache.putResult(FINDER_PATH_FETCH_BY_CATEGORYIDANDTYPEID, finderArgs, list); } else { if (list.size() > 1) { Collections.sort(list, Collections.reverseOrder()); if (_log.isWarnEnabled()) { _log.warn( "CriteriaTemplatePersistenceImpl.fetchBycategoryIdAndTypeId(int, int, boolean) with parameters (" + StringUtil.merge(finderArgs) + ") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder."); } } CriteriaTemplate criteriaTemplate = list.get(0); result = criteriaTemplate; cacheResult(criteriaTemplate); if ((criteriaTemplate.getCriteria_category_id() != criteria_category_id) || (criteriaTemplate.getCriteria_type_id() != criteria_type_id)) { finderCache.putResult(FINDER_PATH_FETCH_BY_CATEGORYIDANDTYPEID, finderArgs, criteriaTemplate); } } } catch (Exception e) { finderCache.removeResult(FINDER_PATH_FETCH_BY_CATEGORYIDANDTYPEID, finderArgs); throw processException(e); } finally { closeSession(session); } } if (result instanceof List<?>) { return null; } else { return (CriteriaTemplate)result; } }
CriteriaTemplate function( int criteria_category_id, int criteria_type_id, boolean retrieveFromCache) { Object[] finderArgs = new Object[] { criteria_category_id, criteria_type_id }; Object result = null; if (retrieveFromCache) { result = finderCache.getResult(FINDER_PATH_FETCH_BY_CATEGORYIDANDTYPEID, finderArgs, this); } if (result instanceof CriteriaTemplate) { CriteriaTemplate criteriaTemplate = (CriteriaTemplate)result; if ((criteria_category_id != criteriaTemplate.getCriteria_category_id()) (criteria_type_id != criteriaTemplate.getCriteria_type_id())) { result = null; } } if (result == null) { StringBundler query = new StringBundler(4); query.append(_SQL_SELECT_CRITERIATEMPLATE_WHERE); query.append(_FINDER_COLUMN_CATEGORYIDANDTYPEID_CRITERIA_CATEGORY_ID_2); query.append(_FINDER_COLUMN_CATEGORYIDANDTYPEID_CRITERIA_TYPE_ID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(criteria_category_id); qPos.add(criteria_type_id); List<CriteriaTemplate> list = q.list(); if (list.isEmpty()) { finderCache.putResult(FINDER_PATH_FETCH_BY_CATEGORYIDANDTYPEID, finderArgs, list); } else { if (list.size() > 1) { Collections.sort(list, Collections.reverseOrder()); if (_log.isWarnEnabled()) { _log.warn( STR + StringUtil.merge(finderArgs) + STR); } } CriteriaTemplate criteriaTemplate = list.get(0); result = criteriaTemplate; cacheResult(criteriaTemplate); if ((criteriaTemplate.getCriteria_category_id() != criteria_category_id) (criteriaTemplate.getCriteria_type_id() != criteria_type_id)) { finderCache.putResult(FINDER_PATH_FETCH_BY_CATEGORYIDANDTYPEID, finderArgs, criteriaTemplate); } } } catch (Exception e) { finderCache.removeResult(FINDER_PATH_FETCH_BY_CATEGORYIDANDTYPEID, finderArgs); throw processException(e); } finally { closeSession(session); } } if (result instanceof List<?>) { return null; } else { return (CriteriaTemplate)result; } }
/** * Returns the criteria template where criteria_category_id = &#63; and criteria_type_id = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache. * * @param criteria_category_id the criteria_category_id * @param criteria_type_id the criteria_type_id * @param retrieveFromCache whether to retrieve from the finder cache * @return the matching criteria template, or <code>null</code> if a matching criteria template could not be found */
Returns the criteria template where criteria_category_id = &#63; and criteria_type_id = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache
fetchBycategoryIdAndTypeId
{ "repo_name": "falko0000/moduleEProc", "path": "Criterias/Criterias-service/src/main/java/tj/criterias/service/persistence/impl/CriteriaTemplatePersistenceImpl.java", "license": "lgpl-2.1", "size": 74582 }
[ "com.liferay.portal.kernel.dao.orm.Query", "com.liferay.portal.kernel.dao.orm.QueryPos", "com.liferay.portal.kernel.dao.orm.Session", "com.liferay.portal.kernel.util.StringBundler", "com.liferay.portal.kernel.util.StringUtil", "java.util.Collections", "java.util.List" ]
import com.liferay.portal.kernel.dao.orm.Query; import com.liferay.portal.kernel.dao.orm.QueryPos; import com.liferay.portal.kernel.dao.orm.Session; import com.liferay.portal.kernel.util.StringBundler; import com.liferay.portal.kernel.util.StringUtil; import java.util.Collections; import java.util.List;
import com.liferay.portal.kernel.dao.orm.*; import com.liferay.portal.kernel.util.*; import java.util.*;
[ "com.liferay.portal", "java.util" ]
com.liferay.portal; java.util;
1,236,329
@Test public void whenDrinkCofeeThenDrink() { Engeneer eng = new Engeneer(); assertThat(eng.drinkCofee(), is("Woooow")); }
void function() { Engeneer eng = new Engeneer(); assertThat(eng.drinkCofee(), is(STR)); }
/** * DrinkCofee method test. */
DrinkCofee method test
whenDrinkCofeeThenDrink
{ "repo_name": "helycopternicht/elazarev", "path": "chapter_002/Professions/src/test/java/ru/elazarev/EngeneerTest.java", "license": "apache-2.0", "size": 1600 }
[ "org.hamcrest.core.Is", "org.junit.Assert" ]
import org.hamcrest.core.Is; import org.junit.Assert;
import org.hamcrest.core.*; import org.junit.*;
[ "org.hamcrest.core", "org.junit" ]
org.hamcrest.core; org.junit;
35,434