method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Test public void testSelectTracksPreferHigherSampleRateBeforeBitrate() throws Exception { Format higherSampleRateLowerBitrateFormat = Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000, Format.NO_VALUE, 2, 44100, null, null, 0, null); Format lowerSampleRateHigherBitrateFormat = Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 30000, Format.NO_VALUE, 2, 22050, null, null, 0, null); TrackSelectorResult result = trackSelector.selectTracks( new RendererCapabilities[] {ALL_AUDIO_FORMAT_SUPPORTED_RENDERER_CAPABILITIES}, singleTrackGroup(higherSampleRateLowerBitrateFormat, lowerSampleRateHigherBitrateFormat)); assertThat(result.selections.get(0).getSelectedFormat()) .isEqualTo(higherSampleRateLowerBitrateFormat); }
void function() throws Exception { Format higherSampleRateLowerBitrateFormat = Format.createAudioSampleFormat(STR, MimeTypes.AUDIO_AAC, null, 15000, Format.NO_VALUE, 2, 44100, null, null, 0, null); Format lowerSampleRateHigherBitrateFormat = Format.createAudioSampleFormat(STR, MimeTypes.AUDIO_AAC, null, 30000, Format.NO_VALUE, 2, 22050, null, null, 0, null); TrackSelectorResult result = trackSelector.selectTracks( new RendererCapabilities[] {ALL_AUDIO_FORMAT_SUPPORTED_RENDERER_CAPABILITIES}, singleTrackGroup(higherSampleRateLowerBitrateFormat, lowerSampleRateHigherBitrateFormat)); assertThat(result.selections.get(0).getSelectedFormat()) .isEqualTo(higherSampleRateLowerBitrateFormat); }
/** * Tests that track selector will prefer audio tracks with higher sample rate over tracks with * higher bitrate when other factors are the same, and tracks are within renderer's * capabilities. */
Tests that track selector will prefer audio tracks with higher sample rate over tracks with higher bitrate when other factors are the same, and tracks are within renderer's capabilities
testSelectTracksPreferHigherSampleRateBeforeBitrate
{ "repo_name": "tntcrowd/ExoPlayer", "path": "library/core/src/test/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelectorTest.java", "license": "apache-2.0", "size": 52718 }
[ "com.google.android.exoplayer2.Format", "com.google.android.exoplayer2.RendererCapabilities", "com.google.android.exoplayer2.util.MimeTypes", "com.google.common.truth.Truth" ]
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.RendererCapabilities; import com.google.android.exoplayer2.util.MimeTypes; import com.google.common.truth.Truth;
import com.google.android.exoplayer2.*; import com.google.android.exoplayer2.util.*; import com.google.common.truth.*;
[ "com.google.android", "com.google.common" ]
com.google.android; com.google.common;
940,988
public boolean verify(KdcRequest kdcRequest, PluginRequestContext requestContext, PaDataEntry paData) throws KrbException;
boolean function(KdcRequest kdcRequest, PluginRequestContext requestContext, PaDataEntry paData) throws KrbException;
/** * Optional: verify preauthentication data sent by the client, setting the * TKT_FLG_PRE_AUTH or TKT_FLG_HW_AUTH flag in the enc_tkt_reply's "flags" * field as appropriate. */
Optional: verify preauthentication data sent by the client, setting the TKT_FLG_PRE_AUTH or TKT_FLG_HW_AUTH flag in the enc_tkt_reply's "flags" field as appropriate
verify
{ "repo_name": "drankye/haox", "path": "haox-kerb/kerb-server/src/main/java/org/apache/kerberos/kerb/server/preauth/KdcPreauth.java", "license": "apache-2.0", "size": 2122 }
[ "org.apache.kerberos.kerb.KrbException", "org.apache.kerberos.kerb.preauth.PluginRequestContext", "org.apache.kerberos.kerb.server.request.KdcRequest", "org.apache.kerberos.kerb.spec.pa.PaDataEntry" ]
import org.apache.kerberos.kerb.KrbException; import org.apache.kerberos.kerb.preauth.PluginRequestContext; import org.apache.kerberos.kerb.server.request.KdcRequest; import org.apache.kerberos.kerb.spec.pa.PaDataEntry;
import org.apache.kerberos.kerb.*; import org.apache.kerberos.kerb.preauth.*; import org.apache.kerberos.kerb.server.request.*; import org.apache.kerberos.kerb.spec.pa.*;
[ "org.apache.kerberos" ]
org.apache.kerberos;
2,849,671
protected Map<String, Object> extractContent(PropertySource<?> propertySource) { return new Binder(ConfigurationPropertySources.from(propertySource)).bind("", STRING_OBJECT_MAP) .orElseGet(LinkedHashMap::new); }
Map<String, Object> function(PropertySource<?> propertySource) { return new Binder(ConfigurationPropertySources.from(propertySource)).bind("", STRING_OBJECT_MAP) .orElseGet(LinkedHashMap::new); }
/** * Extract the raw content based on the specified {@link PropertySource}. * @param propertySource the property source to use * @return the raw content */
Extract the raw content based on the specified <code>PropertySource</code>
extractContent
{ "repo_name": "ilayaperumalg/spring-boot", "path": "spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/InfoPropertiesInfoContributor.java", "license": "apache-2.0", "size": 4984 }
[ "java.util.LinkedHashMap", "java.util.Map", "org.springframework.boot.context.properties.bind.Binder", "org.springframework.boot.context.properties.source.ConfigurationPropertySources", "org.springframework.core.env.PropertySource" ]
import java.util.LinkedHashMap; import java.util.Map; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.context.properties.source.ConfigurationPropertySources; import org.springframework.core.env.PropertySource;
import java.util.*; import org.springframework.boot.context.properties.bind.*; import org.springframework.boot.context.properties.source.*; import org.springframework.core.env.*;
[ "java.util", "org.springframework.boot", "org.springframework.core" ]
java.util; org.springframework.boot; org.springframework.core;
2,764,188
public void setOutlineStroke(Stroke stroke) { this.outlineStroke = stroke; }
void function(Stroke stroke) { this.outlineStroke = stroke; }
/** * Sets the outline stroke. * * @param stroke the stroke. * * @see #getOutlineStroke() */
Sets the outline stroke
setOutlineStroke
{ "repo_name": "martingwhite/astor", "path": "examples/chart_11/source/org/jfree/chart/title/LegendGraphic.java", "license": "gpl-2.0", "size": 23375 }
[ "java.awt.Stroke" ]
import java.awt.Stroke;
import java.awt.*;
[ "java.awt" ]
java.awt;
219,261
private int createDialog(Component parent, Object upperObject, JPanel lowerPanel, String title, int optionType, Icon icon, boolean resizable, boolean modal) { // Set the button panel to the supplied lower panel. buttonPanel is // needed to be global in order to resize the buttons for the case // where the look & feel changes while the dialog is open buttonPanel = lowerPanel; // Check if no buttons were provided if (buttonPanel == null) { // Create the button panel based on the option type provided createButtonPanel(parent, optionType); } // Size and position the dialog's button(s) setButtonWidth(); // Add a change listener to the keyboard focus manager so component // focus changes can be detected KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(new PropertyChangeListener() { Component focusOwner;
int function(Component parent, Object upperObject, JPanel lowerPanel, String title, int optionType, Icon icon, boolean resizable, boolean modal) { buttonPanel = lowerPanel; if (buttonPanel == null) { createButtonPanel(parent, optionType); } setButtonWidth(); KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(new PropertyChangeListener() { Component focusOwner;
/************************************************************************** * Create the dialog. If no buttons are provided (lower panel) then create * the buttons and button listeners needed based on the dialog type * * @param parent * window to center the dialog over * * @param upperObject * object containing the dialog components or message * * @param lowerPanel * panel containing the dialog buttons * * @param title * title to display in the dialog window frame * * @param optionType * dialog type: LOAD_OPTION, SAVE_OPTION, SEARCH_OPTION, * READ_OPTION, PRINT_OPTION, CLOSE_OPTION, OK_OPTION, or * OK_CANCEL_OPTION * * @param icon * icon to display to the left of the text message * * @param resizable * true to allow the dialog to be resized * * @param modal * false to allow the main application window to still be * operated while the dialog is open * * @return Selected button type *************************************************************************/
Create the dialog. If no buttons are provided (lower panel) then create the buttons and button listeners needed based on the dialog type
createDialog
{ "repo_name": "CACTUS-Mission/TRAPSat", "path": "TRAPSat_cFS/cfs/cfe/tools/perfutils-java/src/CFSPerformanceMonitor/CPMDialogHandler.java", "license": "mit", "size": 57337 }
[ "java.awt.Component", "java.awt.KeyboardFocusManager", "java.beans.PropertyChangeListener", "javax.swing.Icon", "javax.swing.JPanel" ]
import java.awt.Component; import java.awt.KeyboardFocusManager; import java.beans.PropertyChangeListener; import javax.swing.Icon; import javax.swing.JPanel;
import java.awt.*; import java.beans.*; import javax.swing.*;
[ "java.awt", "java.beans", "javax.swing" ]
java.awt; java.beans; javax.swing;
1,329,718
public Area appendChild(int index, Node child){ if(this == child){ throw new Error("Cannot append a node to itself."); } child.setParent(this); children.add(index, child); return this; }
Area function(int index, Node child){ if(this == child){ throw new Error(STR); } child.setParent(this); children.add(index, child); return this; }
/** * Appends a child node at the given index * @param index insert point * @param child node to be appended * @return the node */
Appends a child node at the given index
appendChild
{ "repo_name": "abdulmudabir/Gagawa", "path": "src/com/hp/gagawa/java/elements/Area.java", "license": "mit", "size": 6230 }
[ "com.hp.gagawa.java.Node" ]
import com.hp.gagawa.java.Node;
import com.hp.gagawa.java.*;
[ "com.hp.gagawa" ]
com.hp.gagawa;
2,305,862
private Point estimateContentSize() { // The size is estimated as: // X = screenSizeX // Y = screenSizeY - top bar - bottom bar - custom tabs bar Point screenSize = new Point(); WindowManager wm = (WindowManager) mApplication.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getSize(screenSize); Resources resources = mApplication.getResources(); int statusBarId = resources.getIdentifier("status_bar_height", "dimen", "android"); try { screenSize.y -= resources.getDimensionPixelSize(R.dimen.custom_tabs_control_container_height); screenSize.y -= resources.getDimensionPixelSize(statusBarId); } catch (Resources.NotFoundException e) { // Nothing, this is just a best effort estimate. } float density = resources.getDisplayMetrics().density; screenSize.x /= density; screenSize.y /= density; return screenSize; }
Point function() { Point screenSize = new Point(); WindowManager wm = (WindowManager) mApplication.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getSize(screenSize); Resources resources = mApplication.getResources(); int statusBarId = resources.getIdentifier(STR, "dimen", STR); try { screenSize.y -= resources.getDimensionPixelSize(R.dimen.custom_tabs_control_container_height); screenSize.y -= resources.getDimensionPixelSize(statusBarId); } catch (Resources.NotFoundException e) { } float density = resources.getDisplayMetrics().density; screenSize.x /= density; screenSize.y /= density; return screenSize; }
/** * Provides an estimate of the contents size. * * The estimate is likely to be incorrect. This is not a problem, as the aim * is to avoid getting a different layout and resources than needed at * render time. */
Provides an estimate of the contents size. The estimate is likely to be incorrect. This is not a problem, as the aim is to avoid getting a different layout and resources than needed at render time
estimateContentSize
{ "repo_name": "CapOM/ChromiumGStreamerBackend", "path": "chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java", "license": "bsd-3-clause", "size": 31131 }
[ "android.content.Context", "android.content.res.Resources", "android.graphics.Point", "android.view.WindowManager" ]
import android.content.Context; import android.content.res.Resources; import android.graphics.Point; import android.view.WindowManager;
import android.content.*; import android.content.res.*; import android.graphics.*; import android.view.*;
[ "android.content", "android.graphics", "android.view" ]
android.content; android.graphics; android.view;
2,222,485
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<AppServiceCertificateOrderInner>> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)) .<PagedResponse<AppServiceCertificateOrderInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<AppServiceCertificateOrderInner>> function() { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)) .<PagedResponse<AppServiceCertificateOrderInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
/** * List all certificate orders in a subscription. * * @throws DefaultErrorResponseErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return collection of certificate orders. */
List all certificate orders in a subscription
listSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/implementation/AppServiceCertificateOrdersClientImpl.java", "license": "mit", "size": 205075 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.FluxUtil", "com.azure.resourcemanager.appservice.fluent.models.AppServiceCertificateOrderInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.appservice.fluent.models.AppServiceCertificateOrderInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.appservice.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,360,360
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
Condition function() throws CSSException { throw new CSSException(STR); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.ConditionFactory#createOnlyChildCondition()}. */
SAC: Implements <code>org.w3c.css.sac.ConditionFactory#createOnlyChildCondition()</code>
createOnlyChildCondition
{ "repo_name": "bdaum/zoraPD", "path": "com.bdaum.zoom.css/src/org/akrogen/tkui/css/core/impl/sac/CSSConditionFactoryImpl.java", "license": "gpl-2.0", "size": 5806 }
[ "org.w3c.css.sac.CSSException", "org.w3c.css.sac.Condition" ]
import org.w3c.css.sac.CSSException; import org.w3c.css.sac.Condition;
import org.w3c.css.sac.*;
[ "org.w3c.css" ]
org.w3c.css;
2,657,360
private void checkFeatureGeneName(SequenceVariant sequenceFeature) throws IncompatibleGeneAndProteinNameException { if (!SequenceVariant.isValidGeneName(geneNames, sequenceFeature.getGeneName())) { throw new IncompatibleGeneAndProteinNameException(query, sequenceFeature.getGeneName(), geneNames.stream().map(EntityName::getName).collect(Collectors.toList())); } } }
void function(SequenceVariant sequenceFeature) throws IncompatibleGeneAndProteinNameException { if (!SequenceVariant.isValidGeneName(geneNames, sequenceFeature.getGeneName())) { throw new IncompatibleGeneAndProteinNameException(query, sequenceFeature.getGeneName(), geneNames.stream().map(EntityName::getName).collect(Collectors.toList())); } } }
/** * Check that gene name is compatible with protein name * Part of the contract a validator should implement to validate a feature on an isoform sequence */
Check that gene name is compatible with protein name Part of the contract a validator should implement to validate a feature on an isoform sequence
checkFeatureGeneName
{ "repo_name": "calipho-sib/nextprot-api", "path": "isoform-mapper/src/main/java/org/nextprot/api/isoform/mapper/domain/feature/impl/SequenceVariant.java", "license": "gpl-2.0", "size": 9357 }
[ "java.util.stream.Collectors", "org.nextprot.api.core.domain.EntityName", "org.nextprot.api.isoform.mapper.domain.impl.exception.IncompatibleGeneAndProteinNameException" ]
import java.util.stream.Collectors; import org.nextprot.api.core.domain.EntityName; import org.nextprot.api.isoform.mapper.domain.impl.exception.IncompatibleGeneAndProteinNameException;
import java.util.stream.*; import org.nextprot.api.core.domain.*; import org.nextprot.api.isoform.mapper.domain.impl.exception.*;
[ "java.util", "org.nextprot.api" ]
java.util; org.nextprot.api;
309,067
public static <T extends Collection<?>> T notEmpty(T collection) { return notEmpty(collection, DEFAULT_NOT_EMPTY_COLLECTION_EXCEPTION_MESSAGE); } // notEmpty map //---------------------------------------------------------------------------------
static <T extends Collection<?>> T function(T collection) { return notEmpty(collection, DEFAULT_NOT_EMPTY_COLLECTION_EXCEPTION_MESSAGE); }
/** * <p>Validate that the specified argument collection is neither <code>null</code> * nor a size of zero (no elements); otherwise throwing an exception. * * <pre>Validate.notEmpty(myCollection);</pre> * * <p>The message in the exception is &quot;The validated collection is * empty&quot;.</p> * * @param <T> the collection type * @param collection the collection to check * @return the validated collection (never <code>null</code> method for chaining) * @throws NullPointerException if the collection is <code>null</code> * @throws IllegalArgumentException if the collection is empty * @see #notEmpty(Collection, String, Object...) */
Validate that the specified argument collection is neither <code>null</code> nor a size of zero (no elements); otherwise throwing an exception. <code>Validate.notEmpty(myCollection);</code> The message in the exception is &quot;The validated collection is empty&quot;
notEmpty
{ "repo_name": "SpoonLabs/astor", "path": "examples/lang_39/src/java/org/apache/commons/lang3/Validate.java", "license": "gpl-2.0", "size": 34463 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,716,399
private String processUserId(String userId) { // Set userId if null if (userId == null) { log.debug("\"{}\" header is null. Use \"anonymous\" as userId.", Constants.XRD_HEADER_USER_ID); return "anonymous"; } return userId; }
String function(String userId) { if (userId == null) { log.debug("\"{}\STRanonymous\STR, Constants.XRD_HEADER_USER_ID); return STR; } return userId; }
/** * Returns "anonymous" if the given user id is null. Otherwise returns the * given user id. * * @param userId user id to be checked * @return "anonymous" if the given user id is null; otherwise userId */
Returns "anonymous" if the given user id is null. Otherwise returns the given user id
processUserId
{ "repo_name": "vrk-kpa/REST-adapter-service", "path": "src/src/main/java/fi/vrk/xroad/restadapterservice/ConsumerGateway.java", "license": "mit", "size": 44828 }
[ "fi.vrk.xroad.restadapterservice.util.Constants" ]
import fi.vrk.xroad.restadapterservice.util.Constants;
import fi.vrk.xroad.restadapterservice.util.*;
[ "fi.vrk.xroad" ]
fi.vrk.xroad;
646,519
public static void doWithLocalMethods(Class<?> clazz, MethodCallback mc) { Method[] methods = getDeclaredMethods(clazz); for (Method method : methods) { try { mc.doWith(method); } catch (IllegalAccessException ex) { throw new IllegalStateException("Not allowed to access method '" + method.getName() + "': " + ex); } } }
static void function(Class<?> clazz, MethodCallback mc) { Method[] methods = getDeclaredMethods(clazz); for (Method method : methods) { try { mc.doWith(method); } catch (IllegalAccessException ex) { throw new IllegalStateException(STR + method.getName() + STR + ex); } } }
/** * Perform the given callback operation on all matching methods of the given * class, as locally declared or equivalent thereof (such as default methods * on Java 8 based interfaces that the given class implements). * @param clazz the class to introspect * @param mc the callback to invoke for each method * @since 4.2 * @see #doWithMethods */
Perform the given callback operation on all matching methods of the given class, as locally declared or equivalent thereof (such as default methods on Java 8 based interfaces that the given class implements)
doWithLocalMethods
{ "repo_name": "shivpun/spring-framework", "path": "spring-core/src/main/java/org/springframework/util/ReflectionUtils.java", "license": "apache-2.0", "size": 29419 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,786,609
public GeoGridsConfigBuilder mapLength (Distance mapLength) { this.mapLength = mapLength; return this; }
GeoGridsConfigBuilder function (Distance mapLength) { this.mapLength = mapLength; return this; }
/** * mapLength * sets mapLength value * @param mapLength * @return GeoGridsConfigBuilder with mapLength set */
mapLength sets mapLength value
mapLength
{ "repo_name": "vangav/vos_backend", "path": "src/com/vangav/backend/geo/geo_grids/GeoGridsConfig.java", "license": "mit", "size": 17673 }
[ "com.vangav.backend.metrics.distance.Distance" ]
import com.vangav.backend.metrics.distance.Distance;
import com.vangav.backend.metrics.distance.*;
[ "com.vangav.backend" ]
com.vangav.backend;
582,575
boolean processRegionInTransition(final String encodedRegionName, final HRegionInfo regionInfo) throws KeeperException, IOException { RegionTransitionData data = ZKAssign.getData(watcher, encodedRegionName); if (data == null) return false; HRegionInfo hri = regionInfo; if (hri == null) { Pair<HRegionInfo, HServerAddress> p = MetaReader.getRegion(catalogTracker, data.getRegionName()); if (p == null) return false; hri = p.getFirst(); } processRegionsInTransition(data, hri); return true; }
boolean processRegionInTransition(final String encodedRegionName, final HRegionInfo regionInfo) throws KeeperException, IOException { RegionTransitionData data = ZKAssign.getData(watcher, encodedRegionName); if (data == null) return false; HRegionInfo hri = regionInfo; if (hri == null) { Pair<HRegionInfo, HServerAddress> p = MetaReader.getRegion(catalogTracker, data.getRegionName()); if (p == null) return false; hri = p.getFirst(); } processRegionsInTransition(data, hri); return true; }
/** * Process failover of <code>encodedName</code>. Look in * @param encodedRegionName Region to process failover for. * @param encodedRegionName RegionInfo. If null we'll go get it from meta table. * @return * @throws KeeperException * @throws IOException */
Process failover of <code>encodedName</code>. Look in
processRegionInTransition
{ "repo_name": "simplegeo/hadoop-hbase", "path": "src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java", "license": "apache-2.0", "size": 73693 }
[ "java.io.IOException", "org.apache.hadoop.hbase.HRegionInfo", "org.apache.hadoop.hbase.HServerAddress", "org.apache.hadoop.hbase.catalog.MetaReader", "org.apache.hadoop.hbase.executor.RegionTransitionData", "org.apache.hadoop.hbase.util.Pair", "org.apache.hadoop.hbase.zookeeper.ZKAssign", "org.apache....
import java.io.IOException; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HServerAddress; import org.apache.hadoop.hbase.catalog.MetaReader; import org.apache.hadoop.hbase.executor.RegionTransitionData; import org.apache.hadoop.hbase.util.Pair; import org.apache.hadoop.hbase.zookeeper.ZKAssign; import org.apache.zookeeper.KeeperException;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.catalog.*; import org.apache.hadoop.hbase.executor.*; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.hbase.zookeeper.*; import org.apache.zookeeper.*;
[ "java.io", "org.apache.hadoop", "org.apache.zookeeper" ]
java.io; org.apache.hadoop; org.apache.zookeeper;
2,058,678
public static String getIp(){ InetAddress address = getAddress(); if (address==null) { return null; } return address.getHostAddress(); }
static String function(){ InetAddress address = getAddress(); if (address==null) { return null; } return address.getHostAddress(); }
/** * get ip * @return */
get ip
getIp
{ "repo_name": "WangTengFei9023/xxl-job", "path": "xxl-job-core/src/main/java/com/xxl/job/core/util/IpUtil.java", "license": "gpl-2.0", "size": 3321 }
[ "java.net.InetAddress" ]
import java.net.InetAddress;
import java.net.*;
[ "java.net" ]
java.net;
1,857,507
EReference getCallFunction_FuncExpr();
EReference getCallFunction_FuncExpr();
/** * Returns the meta object for the containment reference '{@link org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.CallFunction#getFuncExpr <em>Func Expr</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Func Expr</em>'. * @see org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.CallFunction#getFuncExpr() * @see #getCallFunction() * @generated */
Returns the meta object for the containment reference '<code>org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.CallFunction#getFuncExpr Func Expr</code>'.
getCallFunction_FuncExpr
{ "repo_name": "miklossy/xtext-core", "path": "org.eclipse.xtext.testlanguages/src-gen/org/eclipse/xtext/testlanguages/backtracking/beeLangTestLanguage/BeeLangTestLanguagePackage.java", "license": "epl-1.0", "size": 161651 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
682,300
public java.util.List<fr.lip6.move.pnml.hlpn.dots.hlapi.DotConstantHLAPI> getSubterm_dots_DotConstantHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.dots.hlapi.DotConstantHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.dots.hlapi.DotConstantHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.dots.impl.DotConstantImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.dots.hlapi.DotConstantHLAPI( (fr.lip6.move.pnml.hlpn.dots.DotConstant)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.dots.hlapi.DotConstantHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.dots.hlapi.DotConstantHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.dots.hlapi.DotConstantHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.dots.impl.DotConstantImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.dots.hlapi.DotConstantHLAPI( (fr.lip6.move.pnml.hlpn.dots.DotConstant)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of DotConstantHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of DotConstantHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_dots_DotConstantHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/finiteIntRanges/hlapi/GreaterThanHLAPI.java", "license": "epl-1.0", "size": 108747 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,531,703
public Column<T> removeUpdatable() { childNode.removeAttribute("updatable"); return this; } // --------------------------------------------------------------------------------------------------------|| // ClassName: Column ElementName: xsd:string ElementType : column-definition // MaxOccurs: - isGeneric: true isAttribute: true isEnum: false isDataType: true // --------------------------------------------------------------------------------------------------------||
Column<T> function() { childNode.removeAttribute(STR); return this; }
/** * Removes the <code>updatable</code> attribute * @return the current instance of <code>Column<T></code> */
Removes the <code>updatable</code> attribute
removeUpdatable
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm21/ColumnImpl.java", "license": "epl-1.0", "size": 13605 }
[ "org.jboss.shrinkwrap.descriptor.api.orm21.Column" ]
import org.jboss.shrinkwrap.descriptor.api.orm21.Column;
import org.jboss.shrinkwrap.descriptor.api.orm21.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
2,622,368
public void writePacketData(PacketBuffer data) throws IOException { data.writeVarIntToBuffer(this.protocolVersion); data.writeString(this.ip); data.writeShort(this.port); data.writeVarIntToBuffer(this.requestedState.getId()); }
void function(PacketBuffer data) throws IOException { data.writeVarIntToBuffer(this.protocolVersion); data.writeString(this.ip); data.writeShort(this.port); data.writeVarIntToBuffer(this.requestedState.getId()); }
/** * Writes the raw packet data to the data stream. */
Writes the raw packet data to the data stream
writePacketData
{ "repo_name": "KubaKaszycki/FreeCraft", "path": "src/main/java/kk/freecraft/network/handshake/client/C00Handshake.java", "license": "gpl-3.0", "size": 1905 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,126,135
public void testToArray2() throws InterruptedException { PriorityBlockingQueue<Integer> q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); Arrays.sort(ints); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.take()); }
void function() throws InterruptedException { PriorityBlockingQueue<Integer> q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); Arrays.sort(ints); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.take()); }
/** * toArray(a) contains all elements */
toArray(a) contains all elements
testToArray2
{ "repo_name": "AdmireTheDistance/android_libcore", "path": "jsr166-tests/src/test/java/jsr166/PriorityBlockingQueueTest.java", "license": "gpl-2.0", "size": 23247 }
[ "java.util.Arrays", "java.util.concurrent.PriorityBlockingQueue" ]
import java.util.Arrays; import java.util.concurrent.PriorityBlockingQueue;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
875,275
protected final boolean isValidBearerSubjectConfirmationData(final SubjectConfirmationData data, final SAML2MessageContext context) { if (data == null) { logger.debug("SubjectConfirmationData cannot be null for Bearer confirmation"); return false; } // TODO Validate inResponseTo if (data.getNotBefore() != null) { logger.debug("SubjectConfirmationData notBefore must be null for Bearer confirmation"); return false; } if (data.getNotOnOrAfter() == null) { logger.debug("SubjectConfirmationData notOnOrAfter cannot be null for Bearer confirmation"); return false; } if (data.getNotOnOrAfter().plusSeconds(acceptedSkew).isBeforeNow()) { logger.debug("SubjectConfirmationData notOnOrAfter is too old"); return false; } try { if (data.getRecipient() == null) { logger.debug("SubjectConfirmationData recipient cannot be null for Bearer confirmation"); return false; } else { final Endpoint endpoint = context.getSAMLEndpointContext().getEndpoint(); if (endpoint == null) { logger.warn("No endpoint was found in the SAML endpoint context"); return false; } final URI recipientUri = new URI(data.getRecipient()); final URI appEndpointUri = new URI(endpoint.getLocation()); if (!UriUtils.urisEqualAfterPortNormalization(recipientUri, appEndpointUri)) { logger.debug("SubjectConfirmationData recipient {} does not match SP assertion consumer URL, found. " + "SP ACS URL from context: {}", recipientUri, appEndpointUri); return false; } } } catch (URISyntaxException use) { logger.error("Unable to check SubjectConfirmationData recipient, a URI has invalid syntax.", use); return false; } return true; }
final boolean function(final SubjectConfirmationData data, final SAML2MessageContext context) { if (data == null) { logger.debug(STR); return false; } if (data.getNotBefore() != null) { logger.debug(STR); return false; } if (data.getNotOnOrAfter() == null) { logger.debug(STR); return false; } if (data.getNotOnOrAfter().plusSeconds(acceptedSkew).isBeforeNow()) { logger.debug(STR); return false; } try { if (data.getRecipient() == null) { logger.debug(STR); return false; } else { final Endpoint endpoint = context.getSAMLEndpointContext().getEndpoint(); if (endpoint == null) { logger.warn(STR); return false; } final URI recipientUri = new URI(data.getRecipient()); final URI appEndpointUri = new URI(endpoint.getLocation()); if (!UriUtils.urisEqualAfterPortNormalization(recipientUri, appEndpointUri)) { logger.debug(STR + STR, recipientUri, appEndpointUri); return false; } } } catch (URISyntaxException use) { logger.error(STR, use); return false; } return true; }
/** * Validate Bearer subject confirmation data * - notBefore * - NotOnOrAfter * - recipient * * @param data the data * @param context the context * @return true if all Bearer subject checks are passing */
Validate Bearer subject confirmation data - notBefore - NotOnOrAfter - recipient
isValidBearerSubjectConfirmationData
{ "repo_name": "jkacer/pac4j", "path": "pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2DefaultResponseValidator.java", "license": "apache-2.0", "size": 32653 }
[ "java.net.URISyntaxException", "org.opensaml.saml.saml2.core.SubjectConfirmationData", "org.opensaml.saml.saml2.metadata.Endpoint", "org.pac4j.saml.context.SAML2MessageContext", "org.pac4j.saml.util.UriUtils" ]
import java.net.URISyntaxException; import org.opensaml.saml.saml2.core.SubjectConfirmationData; import org.opensaml.saml.saml2.metadata.Endpoint; import org.pac4j.saml.context.SAML2MessageContext; import org.pac4j.saml.util.UriUtils;
import java.net.*; import org.opensaml.saml.saml2.core.*; import org.opensaml.saml.saml2.metadata.*; import org.pac4j.saml.context.*; import org.pac4j.saml.util.*;
[ "java.net", "org.opensaml.saml", "org.pac4j.saml" ]
java.net; org.opensaml.saml; org.pac4j.saml;
951,785
public void read(byte[] b, int off, int len, long pos) throws IOException { if (b == null) { throw new NullPointerException("b == null!"); } // Fix 4430357 - if off + len < 0, overflow occurred if ((off < 0) || (len < 0) || (pos < 0) || (off + len > b.length) || (off + len < 0)) { throw new IndexOutOfBoundsException(); } if (pos + len > length) { throw new IndexOutOfBoundsException(); } long index = pos/BUFFER_LENGTH; int offset = (int)pos % BUFFER_LENGTH; while (len > 0) { int nbytes = Math.min(len, BUFFER_LENGTH - offset); byte[] buf = getCacheBlock(index++); System.arraycopy(buf, offset, b, off, nbytes); len -= nbytes; off += nbytes; offset = 0; // Always after the first time } }
void function(byte[] b, int off, int len, long pos) throws IOException { if (b == null) { throw new NullPointerException(STR); } if ((off < 0) (len < 0) (pos < 0) (off + len > b.length) (off + len < 0)) { throw new IndexOutOfBoundsException(); } if (pos + len > length) { throw new IndexOutOfBoundsException(); } long index = pos/BUFFER_LENGTH; int offset = (int)pos % BUFFER_LENGTH; while (len > 0) { int nbytes = Math.min(len, BUFFER_LENGTH - offset); byte[] buf = getCacheBlock(index++); System.arraycopy(buf, offset, b, off, nbytes); len -= nbytes; off += nbytes; offset = 0; } }
/** * Copy <code>len</code> bytes from the cache, starting * at cache position <code>pos</code>, into the array * <code>b</code> at offset <code>off</code>. * * @exception NullPointerException if b is <code>null</code> * @exception IndexOutOfBoundsException if <code>off</code>, * <code>len</code> or <code>pos</code> are negative or if * <code>off + len > b.length</code> or if any portion of the * requested data is not in the cache (including if * <code>pos</code> is in a block that has already been disposed). */
Copy <code>len</code> bytes from the cache, starting at cache position <code>pos</code>, into the array <code>b</code> at offset <code>off</code>
read
{ "repo_name": "flyzsd/java-code-snippets", "path": "ibm.jdk8/src/javax/imageio/stream/MemoryCache.java", "license": "mit", "size": 12092 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,444,701
public void deleteMessagesFromDLC(List<AndesMessageMetadata> messagesToRemove) throws AndesException { InboundDeleteDLCMessagesEvent deleteDLCMessagesEvent = new InboundDeleteDLCMessagesEvent(messagesToRemove); deleteDLCMessagesEvent.prepareForDelete(messagingEngine); inboundEventManager.publishStateEvent(deleteDLCMessagesEvent); }
void function(List<AndesMessageMetadata> messagesToRemove) throws AndesException { InboundDeleteDLCMessagesEvent deleteDLCMessagesEvent = new InboundDeleteDLCMessagesEvent(messagesToRemove); deleteDLCMessagesEvent.prepareForDelete(messagingEngine); inboundEventManager.publishStateEvent(deleteDLCMessagesEvent); }
/** * Method to delete message from the dead letter channel. * * @param messagesToRemove List of messages to remove */
Method to delete message from the dead letter channel
deleteMessagesFromDLC
{ "repo_name": "hemikak/andes", "path": "modules/andes-core/broker/src/main/java/org/wso2/andes/kernel/Andes.java", "license": "apache-2.0", "size": 28306 }
[ "java.util.List", "org.wso2.andes.kernel.disruptor.inbound.InboundDeleteDLCMessagesEvent" ]
import java.util.List; import org.wso2.andes.kernel.disruptor.inbound.InboundDeleteDLCMessagesEvent;
import java.util.*; import org.wso2.andes.kernel.disruptor.inbound.*;
[ "java.util", "org.wso2.andes" ]
java.util; org.wso2.andes;
2,673,810
protected void annotateProxyClass(Class cl) throws IOException { writeAnnotation(RiverClassLoader.getClassAnnotation(cl)); }
void function(Class cl) throws IOException { writeAnnotation(RiverClassLoader.getClassAnnotation(cl)); }
/** * Annotates the stream descriptor for the proxy class * <code>cl</code>. * * <p><code>MarshalOutputStream</code> implements this method as * follows: * * <p>This method invokes {@link RiverClassLoader#getClassAnnotation * RiverClassLoader.getClassAnnotation} with <code>cl</code> to get * the appropriate class annotation string value (possibly * <code>null</code>), and then it invokes this stream's {@link * #writeAnnotation writeAnnotation} method with that string to * record the annotation. * * @param cl the proxy class to annotate * * @throws IOException if <code>writeAnnotation</code> throws an * <code>IOException</code> * * @throws NullPointerException if <code>cl</code> is * <code>null</code> **/
Annotates the stream descriptor for the proxy class <code>cl</code>. <code>MarshalOutputStream</code> implements this method as follows: This method invokes <code>RiverClassLoader#getClassAnnotation RiverClassLoader.getClassAnnotation</code> with <code>cl</code> to get the appropriate class annotation string value (possibly <code>null</code>), and then it invokes this stream's <code>#writeAnnotation writeAnnotation</code> method with that string to record the annotation
annotateProxyClass
{ "repo_name": "cdegroot/river", "path": "src/net/jini/io/MarshalOutputStream.java", "license": "apache-2.0", "size": 6631 }
[ "java.io.IOException", "net.jini.loader.RiverClassLoader" ]
import java.io.IOException; import net.jini.loader.RiverClassLoader;
import java.io.*; import net.jini.loader.*;
[ "java.io", "net.jini.loader" ]
java.io; net.jini.loader;
1,632,285
public LeaseStatus leaseStatus() { return this.leaseStatus; }
LeaseStatus function() { return this.leaseStatus; }
/** * Get the lease status of the container. Possible values include: 'Locked', 'Unlocked'. * * @return the leaseStatus value */
Get the lease status of the container. Possible values include: 'Locked', 'Unlocked'
leaseStatus
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/BlobContainerInner.java", "license": "mit", "size": 7633 }
[ "com.microsoft.azure.management.storage.v2019_06_01.LeaseStatus" ]
import com.microsoft.azure.management.storage.v2019_06_01.LeaseStatus;
import com.microsoft.azure.management.storage.v2019_06_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,602,103
@Test public void testPartialFlushWithCleanAndRollOverAndFailure() throws Exception { Assert.assertNull(storage.retrieve(new byte[8])); byte[] b = new byte[]{48, 48, 48, 48, 98, 48, 52, 54, 49, 57, 55, 51, 52, 97, 53, 101, 56, 56, 97, 55, 98, 53, 52, 51, 98, 50, 102, 51, 49, 97, 97, 54, 1, 50, 48, 49, 51, 45, 49, 49, 45, 48, 55, 1, 50, 48, 49, 51, 45, 49, 49, 45, 48, 55, 32, 48, 48, 58, 51, 49, 58, 52, 56, 1, 49, 48, 53, 53, 57, 52, 50, 1, 50, 1, 49, 53, 49, 49, 54, 49, 56, 52, 1, 49, 53, 49, 49, 57, 50, 49, 49, 1, 49, 53, 49, 50, 57, 54, 54, 53, 1, 49, 53, 49, 50, 49, 53, 52, 56, 1, 49, 48, 48, 56, 48, 51, 52, 50, 1, 55, 56, 56, 50, 54, 53, 52, 56, 1, 49, 1, 48, 1, 48, 46, 48, 1, 48, 46, 48, 1, 48, 46, 48}; byte[] b_org = new byte[]{48, 48, 48, 48, 98, 48, 52, 54, 49, 57, 55, 51, 52, 97, 53, 101, 56, 56, 97, 55, 98, 53, 52, 51, 98, 50, 102, 51, 49, 97, 97, 54, 1, 50, 48, 49, 51, 45, 49, 49, 45, 48, 55, 1, 50, 48, 49, 51, 45, 49, 49, 45, 48, 55, 32, 48, 48, 58, 51, 49, 58, 52, 56, 1, 49, 48, 53, 53, 57, 52, 50, 1, 50, 1, 49, 53, 49, 49, 54, 49, 56, 52, 1, 49, 53, 49, 49, 57, 50, 49, 49, 1, 49, 53, 49, 50, 57, 54, 54, 53, 1, 49, 53, 49, 50, 49, 53, 52, 56, 1, 49, 48, 48, 56, 48, 51, 52, 50, 1, 55, 56, 56, 50, 54, 53, 52, 56, 1, 49, 1, 48, 1, 48, 46, 48, 1, 48, 46, 48, 1, 48, 46, 48}; byte[] address = storage.store(new Slice(b, 0, b.length)); Assert.assertNotNull(address); storage.flush(); storage.clean(address); byte[] addr = null; for (int i = 0; i < 5; i++) { b[0] = (byte)(b[0] + 1); addr = storage.store(new Slice(b, 0, b.length)); } storage = getStorage("1", true); Assert.assertNull(storage.retrieve(addr)); for (int i = 0; i < 5; i++) { b[0] = (byte)(b[0] + 1); Assert.assertNull(storage.store(new Slice(b, 0, b.length))); } storage.flush(); b_org[0] = (byte)(b_org[0] + 1); match(storage.retrieve(address), new String(b_org)); b_org[0] = (byte)(b_org[0] + 1); match(storage.retrieveNext(), new String(b_org)); b_org[0] = (byte)(b_org[0] + 1); match(storage.retrieveNext(), new String(b_org)); }
void function() throws Exception { Assert.assertNull(storage.retrieve(new byte[8])); byte[] b = new byte[]{48, 48, 48, 48, 98, 48, 52, 54, 49, 57, 55, 51, 52, 97, 53, 101, 56, 56, 97, 55, 98, 53, 52, 51, 98, 50, 102, 51, 49, 97, 97, 54, 1, 50, 48, 49, 51, 45, 49, 49, 45, 48, 55, 1, 50, 48, 49, 51, 45, 49, 49, 45, 48, 55, 32, 48, 48, 58, 51, 49, 58, 52, 56, 1, 49, 48, 53, 53, 57, 52, 50, 1, 50, 1, 49, 53, 49, 49, 54, 49, 56, 52, 1, 49, 53, 49, 49, 57, 50, 49, 49, 1, 49, 53, 49, 50, 57, 54, 54, 53, 1, 49, 53, 49, 50, 49, 53, 52, 56, 1, 49, 48, 48, 56, 48, 51, 52, 50, 1, 55, 56, 56, 50, 54, 53, 52, 56, 1, 49, 1, 48, 1, 48, 46, 48, 1, 48, 46, 48, 1, 48, 46, 48}; byte[] b_org = new byte[]{48, 48, 48, 48, 98, 48, 52, 54, 49, 57, 55, 51, 52, 97, 53, 101, 56, 56, 97, 55, 98, 53, 52, 51, 98, 50, 102, 51, 49, 97, 97, 54, 1, 50, 48, 49, 51, 45, 49, 49, 45, 48, 55, 1, 50, 48, 49, 51, 45, 49, 49, 45, 48, 55, 32, 48, 48, 58, 51, 49, 58, 52, 56, 1, 49, 48, 53, 53, 57, 52, 50, 1, 50, 1, 49, 53, 49, 49, 54, 49, 56, 52, 1, 49, 53, 49, 49, 57, 50, 49, 49, 1, 49, 53, 49, 50, 57, 54, 54, 53, 1, 49, 53, 49, 50, 49, 53, 52, 56, 1, 49, 48, 48, 56, 48, 51, 52, 50, 1, 55, 56, 56, 50, 54, 53, 52, 56, 1, 49, 1, 48, 1, 48, 46, 48, 1, 48, 46, 48, 1, 48, 46, 48}; byte[] address = storage.store(new Slice(b, 0, b.length)); Assert.assertNotNull(address); storage.flush(); storage.clean(address); byte[] addr = null; for (int i = 0; i < 5; i++) { b[0] = (byte)(b[0] + 1); addr = storage.store(new Slice(b, 0, b.length)); } storage = getStorage("1", true); Assert.assertNull(storage.retrieve(addr)); for (int i = 0; i < 5; i++) { b[0] = (byte)(b[0] + 1); Assert.assertNull(storage.store(new Slice(b, 0, b.length))); } storage.flush(); b_org[0] = (byte)(b_org[0] + 1); match(storage.retrieve(address), new String(b_org)); b_org[0] = (byte)(b_org[0] + 1); match(storage.retrieveNext(), new String(b_org)); b_org[0] = (byte)(b_org[0] + 1); match(storage.retrieveNext(), new String(b_org)); }
/** * This tests the clean when the files are roll-over and the storage fails * * @throws Exception */
This tests the clean when the files are roll-over and the storage fails
testPartialFlushWithCleanAndRollOverAndFailure
{ "repo_name": "DataTorrent/Megh", "path": "flume/src/test/java/com/datatorrent/flume/storage/HDFSStorageTest.java", "license": "apache-2.0", "size": 29152 }
[ "com.datatorrent.netlet.util.Slice", "org.junit.Assert" ]
import com.datatorrent.netlet.util.Slice; import org.junit.Assert;
import com.datatorrent.netlet.util.*; import org.junit.*;
[ "com.datatorrent.netlet", "org.junit" ]
com.datatorrent.netlet; org.junit;
1,922,617
private String getPath(String statusJson) throws Exception { JSONParser parser = new JSONParser(); JSONObject details = (JSONObject) parser.parse(statusJson); return (String) details.get("Path"); }
String function(String statusJson) throws Exception { JSONParser parser = new JSONParser(); JSONObject details = (JSONObject) parser.parse(statusJson); return (String) details.get("Path"); }
/** * Given the JSON output from the GETTRASHPATH call, return the * 'path' value. * * @param statusJson JSON from GETTRASHPATH * @return The value of 'path' in statusJson * @throws Exception */
Given the JSON output from the GETTRASHPATH call, return the 'path' value
getPath
{ "repo_name": "xiao-chen/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/fs/http/server/TestHttpFSServer.java", "license": "apache-2.0", "size": 57335 }
[ "org.apache.hadoop.fs.Path", "org.json.simple.JSONObject", "org.json.simple.parser.JSONParser" ]
import org.apache.hadoop.fs.Path; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser;
import org.apache.hadoop.fs.*; import org.json.simple.*; import org.json.simple.parser.*;
[ "org.apache.hadoop", "org.json.simple" ]
org.apache.hadoop; org.json.simple;
2,121,020
@NotNull() static CompareResult readCompareResultFrom(final int messageID, @NotNull final ASN1StreamReaderSequence messageSequence, @NotNull final ASN1StreamReader reader) throws LDAPException { return new CompareResult(LDAPResult.readLDAPResultFrom(messageID, messageSequence, reader)); }
@NotNull() static CompareResult readCompareResultFrom(final int messageID, @NotNull final ASN1StreamReaderSequence messageSequence, @NotNull final ASN1StreamReader reader) throws LDAPException { return new CompareResult(LDAPResult.readLDAPResultFrom(messageID, messageSequence, reader)); }
/** * Creates a new compare result object with the provided message ID and with * the protocol op and controls read from the given ASN.1 stream reader. * * @param messageID The LDAP message ID for the LDAP message that is * associated with this LDAP result. * @param messageSequence The ASN.1 stream reader sequence used in the * course of reading the LDAP message elements. * @param reader The ASN.1 stream reader from which to read the * protocol op and controls. * * @return The decoded compare result. * * @throws LDAPException If a problem occurs while reading or decoding data * from the ASN.1 stream reader. */
Creates a new compare result object with the provided message ID and with the protocol op and controls read from the given ASN.1 stream reader
readCompareResultFrom
{ "repo_name": "UnboundID/ldapsdk", "path": "src/com/unboundid/ldap/sdk/CompareResult.java", "license": "gpl-2.0", "size": 5647 }
[ "com.unboundid.asn1.ASN1StreamReader", "com.unboundid.asn1.ASN1StreamReaderSequence", "com.unboundid.util.NotNull" ]
import com.unboundid.asn1.ASN1StreamReader; import com.unboundid.asn1.ASN1StreamReaderSequence; import com.unboundid.util.NotNull;
import com.unboundid.asn1.*; import com.unboundid.util.*;
[ "com.unboundid.asn1", "com.unboundid.util" ]
com.unboundid.asn1; com.unboundid.util;
2,607,191
public Output<TFloat32> maxOutput() { return maxOutput; } public static class Options { private List<Long> dilations; private List<Long> paddingList; private Options() { }
Output<TFloat32> function() { return maxOutput; } public static class Options { private List<Long> dilations; private List<Long> paddingList; private Options() { }
/** * Gets maxOutput. * * @return maxOutput. */
Gets maxOutput
maxOutput
{ "repo_name": "tensorflow/java", "path": "tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRelu.java", "license": "apache-2.0", "size": 9650 }
[ "java.util.List", "org.tensorflow.Output", "org.tensorflow.types.TFloat32" ]
import java.util.List; import org.tensorflow.Output; import org.tensorflow.types.TFloat32;
import java.util.*; import org.tensorflow.*; import org.tensorflow.types.*;
[ "java.util", "org.tensorflow", "org.tensorflow.types" ]
java.util; org.tensorflow; org.tensorflow.types;
702,207
public Element generateElement(Document document) { Element node = document.createElement(mxGraphMlConstants.PORT); node.setAttribute(mxGraphMlConstants.PORT_NAME, name); for (mxGraphMlData data : portDataMap.values()) { Element dataElement = data.generateNodeElement(document); node.appendChild(dataElement); } return node; }
Element function(Document document) { Element node = document.createElement(mxGraphMlConstants.PORT); node.setAttribute(mxGraphMlConstants.PORT_NAME, name); for (mxGraphMlData data : portDataMap.values()) { Element dataElement = data.generateNodeElement(document); node.appendChild(dataElement); } return node; }
/** * Generates a Key Element from this class. * * @param document Document where the key Element will be inserted. * @return Returns the generated Elements. */
Generates a Key Element from this class
generateElement
{ "repo_name": "ernestp/consulo", "path": "platform/graph-impl/src/com/mxgraph/io/graphml/mxGraphMlPort.java", "license": "apache-2.0", "size": 2001 }
[ "org.w3c.dom.Document", "org.w3c.dom.Element" ]
import org.w3c.dom.Document; import org.w3c.dom.Element;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
775,034
public static Foo findByUuid_C_Last(java.lang.String uuid, long companyId, OrderByComparator<Foo> orderByComparator) throws blade.servicebuilder.exception.NoSuchFooException { return getPersistence() .findByUuid_C_Last(uuid, companyId, orderByComparator); }
static Foo function(java.lang.String uuid, long companyId, OrderByComparator<Foo> orderByComparator) throws blade.servicebuilder.exception.NoSuchFooException { return getPersistence() .findByUuid_C_Last(uuid, companyId, orderByComparator); }
/** * Returns the last foo in the ordered set where uuid = &#63; and companyId = &#63;. * * @param uuid the uuid * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the last matching foo * @throws blade.servicebuilder.NoSuchFooException if a matching foo could not be found */
Returns the last foo in the ordered set where uuid = &#63; and companyId = &#63;
findByUuid_C_Last
{ "repo_name": "vernaillen/blade", "path": "maven/blade.servicebuilder/blade.servicebuilder.api/src/main/java/blade/servicebuilder/service/persistence/FooUtil.java", "license": "apache-2.0", "size": 38021 }
[ "com.liferay.portal.kernel.util.OrderByComparator" ]
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.*;
[ "com.liferay.portal" ]
com.liferay.portal;
2,158,356
public Sha256Hash getTxnHashAndMerkleRoot(List<Sha256Hash> matchedHashes) throws VerificationException { matchedHashes.clear(); // An empty set will not work if (transactionCount == 0) throw new VerificationException("Got a CPartialMerkleTree with 0 transactions"); // check for excessively high numbers of transactions if (transactionCount > Block.MAX_BLOCK_SIZE / 60) // 60 is the lower bound for the size of a serialized CTransaction throw new VerificationException("Got a CPartialMerkleTree with more transactions than is possible"); // there can never be more hashes provided than one for every txid if (hashes.size() > transactionCount) throw new VerificationException("Got a CPartialMerkleTree with more hashes than transactions"); // there must be at least one bit per node in the partial tree, and at least one node per hash if (matchedChildBits.length*8 < hashes.size()) throw new VerificationException("Got a CPartialMerkleTree with fewer matched bits than hashes"); // calculate height of tree int height = 0; while (getTreeWidth(height) > 1) height++; // traverse the partial tree ValuesUsed used = new ValuesUsed(); Sha256Hash merkleRoot = recursiveExtractHashes(height, 0, used, matchedHashes); // verify that all bits were consumed (except for the padding caused by serializing it as a byte sequence) if ((used.bitsUsed+7)/8 != matchedChildBits.length || // verify that all hashes were consumed used.hashesUsed != hashes.size()) throw new VerificationException("Got a CPartialMerkleTree that didn't need all the data it provided"); return merkleRoot; }
Sha256Hash function(List<Sha256Hash> matchedHashes) throws VerificationException { matchedHashes.clear(); if (transactionCount == 0) throw new VerificationException(STR); if (transactionCount > Block.MAX_BLOCK_SIZE / 60) throw new VerificationException(STR); if (hashes.size() > transactionCount) throw new VerificationException(STR); if (matchedChildBits.length*8 < hashes.size()) throw new VerificationException(STR); int height = 0; while (getTreeWidth(height) > 1) height++; ValuesUsed used = new ValuesUsed(); Sha256Hash merkleRoot = recursiveExtractHashes(height, 0, used, matchedHashes); if ((used.bitsUsed+7)/8 != matchedChildBits.length used.hashesUsed != hashes.size()) throw new VerificationException(STR); return merkleRoot; }
/** * Extracts tx hashes that are in this merkle tree * and returns the merkle root of this tree. * * The returned root should be checked against the * merkle root contained in the block header for security. * * @param matchedHashes A list which will contain the matched txn (will be cleared) * Required to be a LinkedHashSet in order to retain order or transactions in the block * @return the merkle root of this merkle tree * @throws ProtocolException if this partial merkle tree is invalid */
Extracts tx hashes that are in this merkle tree and returns the merkle root of this tree. The returned root should be checked against the merkle root contained in the block header for security
getTxnHashAndMerkleRoot
{ "repo_name": "inuitwallet/nubitj", "path": "core/src/main/java/com/woollysammoth/nubitj/core/PartialMerkleTree.java", "license": "apache-2.0", "size": 8206 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,181,791
@FIXVersion(introduced = "4.4") public void setFinancingDetails() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
@FIXVersion(introduced = "4.4") void function() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
/** * Sets the FinancingDetails component class to the proper implementation. */
Sets the FinancingDetails component class to the proper implementation
setFinancingDetails
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/AllocationInstructionMsg.java", "license": "gpl-3.0", "size": 122626 }
[ "net.hades.fix.message.anno.FIXVersion" ]
import net.hades.fix.message.anno.FIXVersion;
import net.hades.fix.message.anno.*;
[ "net.hades.fix" ]
net.hades.fix;
1,939,787
public static void write(byte[] data, Writer output, String encoding) throws IOException { if (data != null) { if (encoding == null) { write(data, output); } else { output.write(new String(data, encoding)); } } }
static void function(byte[] data, Writer output, String encoding) throws IOException { if (data != null) { if (encoding == null) { write(data, output); } else { output.write(new String(data, encoding)); } } }
/** * Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code> * using the specified character encoding. * <p> * Character encoding names can be found at * <a href="http://www.iana.org/assignments/character-sets">IANA</a>. * <p> * This method uses {@link String#String(byte[], String)}. * * @param data the byte array to write, do not modify during output, * null ignored * @param output the <code>Writer</code> to write to * @param encoding the encoding to use, null means platform default * @throws NullPointerException if output is null * @throws IOException if an I/O error occurs * @since Commons IO 1.1 */
Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code> using the specified character encoding. Character encoding names can be found at IANA. This method uses <code>String#String(byte[], String)</code>
write
{ "repo_name": "arteam/unitils", "path": "unitils-core/src/main/java/org/unitils/thirdparty/org/apache/commons/io/IOUtils.java", "license": "apache-2.0", "size": 40609 }
[ "java.io.IOException", "java.io.Writer" ]
import java.io.IOException; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
1,143,665
private static void incRemoteRecoveryTime(long amount, Statistics stats) { stats.incLong(CachePerfStats.REMOTERECOVERY_TIME, amount); }
static void function(long amount, Statistics stats) { stats.incLong(CachePerfStats.REMOTERECOVERY_TIME, amount); }
/** * increase the time on remote recovery */
increase the time on remote recovery
incRemoteRecoveryTime
{ "repo_name": "papicella/snappy-store", "path": "tests/core/src/main/java/cacheperf/CachePerfStatsVersion.java", "license": "apache-2.0", "size": 2420 }
[ "com.gemstone.gemfire.Statistics" ]
import com.gemstone.gemfire.Statistics;
import com.gemstone.gemfire.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
653,236
public Map<String, List<UploadedFile>> getUploadedFiles(Object exchange);
Map<String, List<UploadedFile>> function(Object exchange);
/** * The uploaded files, if any. * The key of the map if the HTML's <code>name</code> attribute. */
The uploaded files, if any. The key of the map if the HTML's <code>name</code> attribute
getUploadedFiles
{ "repo_name": "spincast/spincast-framework", "path": "spincast-core-parent/spincast-core/src/main/java/org/spincast/core/server/Server.java", "license": "apache-2.0", "size": 11510 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,684,200
@Test public void testMatrix3fConstructor() { final ImmutableMatrix3f matrix1 = new ImmutableMatrix3f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); final ImmutableMatrix3f matrix2 = new ImmutableMatrix3f(matrix1); assertNotSame(matrix1.m, matrix2.m); assertArrayEquals(matrix1.m, matrix2.m, 0.001f); }
void function() { final ImmutableMatrix3f matrix1 = new ImmutableMatrix3f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); final ImmutableMatrix3f matrix2 = new ImmutableMatrix3f(matrix1); assertNotSame(matrix1.m, matrix2.m); assertArrayEquals(matrix1.m, matrix2.m, 0.001f); }
/** * Tests the constructor with Matrix3f argument. */
Tests the constructor with Matrix3f argument
testMatrix3fConstructor
{ "repo_name": "kayahr/gramath", "path": "src/test/java/de/ailis/gramath/ImmutableMatrix3fTest.java", "license": "mit", "size": 12327 }
[ "de.ailis.gramath.support.Assert", "org.junit.Assert" ]
import de.ailis.gramath.support.Assert; import org.junit.Assert;
import de.ailis.gramath.support.*; import org.junit.*;
[ "de.ailis.gramath", "org.junit" ]
de.ailis.gramath; org.junit;
1,622,660
@Override public void addPages() { pageDrivers = new ConnectionPageDriver(this); addPage(pageDrivers); List<DataSourceProviderDescriptor> providers = DataSourceProviderRegistry.getInstance().getDataSourceProviders(); for (DataSourceProviderDescriptor provider : providers) { DataSourceViewDescriptor view = provider.getView(IActionConstants.NEW_CONNECTION_POINT); availableProvides.add(provider); if (view != null) { ConnectionPageSettings pageSettings = new ConnectionPageSettings( NewConnectionWizard.this, view); settingsPages.put(provider, pageSettings); addPage(pageSettings); } } pageGeneral = new ConnectionPageGeneral(this); pageNetwork = new ConnectionPageNetwork(this); addPage(pageGeneral); addPage(pageNetwork); // Initial settings if (selection != null && !selection.isEmpty()) { final Object element = selection.getFirstElement(); if (element instanceof DBNLocalFolder) { pageGeneral.setDataSourceFolder(((DBNLocalFolder) element).getFolder()); } } }
void function() { pageDrivers = new ConnectionPageDriver(this); addPage(pageDrivers); List<DataSourceProviderDescriptor> providers = DataSourceProviderRegistry.getInstance().getDataSourceProviders(); for (DataSourceProviderDescriptor provider : providers) { DataSourceViewDescriptor view = provider.getView(IActionConstants.NEW_CONNECTION_POINT); availableProvides.add(provider); if (view != null) { ConnectionPageSettings pageSettings = new ConnectionPageSettings( NewConnectionWizard.this, view); settingsPages.put(provider, pageSettings); addPage(pageSettings); } } pageGeneral = new ConnectionPageGeneral(this); pageNetwork = new ConnectionPageNetwork(this); addPage(pageGeneral); addPage(pageNetwork); if (selection != null && !selection.isEmpty()) { final Object element = selection.getFirstElement(); if (element instanceof DBNLocalFolder) { pageGeneral.setDataSourceFolder(((DBNLocalFolder) element).getFolder()); } } }
/** * Adding the page to the wizard. */
Adding the page to the wizard
addPages
{ "repo_name": "Corvu/dbeaver", "path": "plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/NewConnectionWizard.java", "license": "gpl-2.0", "size": 6722 }
[ "java.util.List", "org.jkiss.dbeaver.model.navigator.DBNLocalFolder", "org.jkiss.dbeaver.registry.DataSourceProviderDescriptor", "org.jkiss.dbeaver.registry.DataSourceProviderRegistry", "org.jkiss.dbeaver.registry.DataSourceViewDescriptor", "org.jkiss.dbeaver.ui.IActionConstants" ]
import java.util.List; import org.jkiss.dbeaver.model.navigator.DBNLocalFolder; import org.jkiss.dbeaver.registry.DataSourceProviderDescriptor; import org.jkiss.dbeaver.registry.DataSourceProviderRegistry; import org.jkiss.dbeaver.registry.DataSourceViewDescriptor; import org.jkiss.dbeaver.ui.IActionConstants;
import java.util.*; import org.jkiss.dbeaver.model.navigator.*; import org.jkiss.dbeaver.registry.*; import org.jkiss.dbeaver.ui.*;
[ "java.util", "org.jkiss.dbeaver" ]
java.util; org.jkiss.dbeaver;
1,015,836
// shouldn't be called from outside the class. public void rebuild() throws WebServicesException { this.me = (User) org.objectweb.proactive.api.PAActiveObject.getStubOnThis(); client.oneWayCall("wsRegisterMigratedUser", new Object[] { i_user }); createGUI(); }
void function() throws WebServicesException { this.me = (User) org.objectweb.proactive.api.PAActiveObject.getStubOnThis(); client.oneWayCall(STR, new Object[] { i_user }); createGUI(); }
/** * called after migration, to reconstruct the logic. In the initActivity : * myStrategyManager.onArrival("rebuild"); * @throws WebServicesException */
called after migration, to reconstruct the logic. In the initActivity : myStrategyManager.onArrival("rebuild")
rebuild
{ "repo_name": "acontes/programming", "path": "src/Examples/org/objectweb/proactive/examples/webservices/c3dWS/WSUser.java", "license": "agpl-3.0", "size": 14381 }
[ "org.objectweb.proactive.api.PAActiveObject", "org.objectweb.proactive.extensions.webservices.exceptions.WebServicesException" ]
import org.objectweb.proactive.api.PAActiveObject; import org.objectweb.proactive.extensions.webservices.exceptions.WebServicesException;
import org.objectweb.proactive.api.*; import org.objectweb.proactive.extensions.webservices.exceptions.*;
[ "org.objectweb.proactive" ]
org.objectweb.proactive;
59,137
Collection<BlatResult> blatQuery( BioSequence b ) throws IOException;
Collection<BlatResult> blatQuery( BioSequence b ) throws IOException;
/** * Run a BLAT search using the gfClient. * * @param b The genome is inferred from the Taxon held by the sequence. * @return Collection of BlatResult objects. * @throws IOException when there are IO problems. */
Run a BLAT search using the gfClient
blatQuery
{ "repo_name": "ppavlidis/Gemma", "path": "gemma-core/src/main/java/ubic/gemma/core/apps/Blat.java", "license": "apache-2.0", "size": 3942 }
[ "java.io.IOException", "java.util.Collection" ]
import java.io.IOException; import java.util.Collection;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,753,072
public void setContentView(View root) { mRootView = root; mWindow.setContentView(root); }
void function(View root) { mRootView = root; mWindow.setContentView(root); }
/** * Set content view. * * @param root Root view */
Set content view
setContentView
{ "repo_name": "ResurrectionRemix/packages_apps_DUI", "path": "src/com/android/systemui/navigation/editor/PopupWindows.java", "license": "apache-2.0", "size": 3400 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
308,043
private void handleMultiInstanceReportResponse(SerialMessage serialMessage, int offset) { logger.trace("Process Multi-instance Report"); int commandClassCode = serialMessage.getMessagePayloadByte(offset); int instances = serialMessage.getMessagePayloadByte(offset + 1); if (instances == 0) { setInstances(1); } else { CommandClass commandClass = CommandClass.getCommandClass(commandClassCode); if (commandClass == null) { logger.error(String.format("NODE %d: Unsupported command class 0x%02x", this.getNode().getNodeId(), commandClassCode)); return; } logger.debug(String.format("NODE %d: Requested Command Class = %s (0x%02x)", this.getNode().getNodeId(), commandClass.getLabel() , commandClassCode)); ZWaveCommandClass zwaveCommandClass = this.getNode().getCommandClass(commandClass); if (zwaveCommandClass == null) { logger.error(String.format("NODE %d: Unsupported command class %s (0x%02x)", this.getNode().getNodeId(), commandClass.getLabel(), commandClassCode)); return; } zwaveCommandClass.setInstances(instances); logger.debug("NODE {}: Instances = {}, number of instances set.", this.getNode().getNodeId(), instances); } // Check how many outstanding requests we're waiting for before advancing... int waiting = 0; for (ZWaveCommandClass zwaveCommandClass : this.getNode().getCommandClasses()) { // We never sent the NO_OP request, so ignore it here. if (zwaveCommandClass.getCommandClass() == CommandClass.NO_OPERATION) continue; if (zwaveCommandClass.getInstances() == 0) { // Still waiting for an instance report of another command class. waiting++; logger.debug("NODE {}: Waiting for command class {}.", this.getNode().getNodeId(), zwaveCommandClass.getCommandClass().getLabel()); } } if(waiting != 0) { logger.debug("NODE {}: Waiting for {} responses.", this.getNode().getNodeId(), waiting); return; } // All requests received - advance node stage. this.getNode().advanceNodeStage(NodeStage.STATIC_VALUES); }
void function(SerialMessage serialMessage, int offset) { logger.trace(STR); int commandClassCode = serialMessage.getMessagePayloadByte(offset); int instances = serialMessage.getMessagePayloadByte(offset + 1); if (instances == 0) { setInstances(1); } else { CommandClass commandClass = CommandClass.getCommandClass(commandClassCode); if (commandClass == null) { logger.error(String.format(STR, this.getNode().getNodeId(), commandClassCode)); return; } logger.debug(String.format(STR, this.getNode().getNodeId(), commandClass.getLabel() , commandClassCode)); ZWaveCommandClass zwaveCommandClass = this.getNode().getCommandClass(commandClass); if (zwaveCommandClass == null) { logger.error(String.format(STR, this.getNode().getNodeId(), commandClass.getLabel(), commandClassCode)); return; } zwaveCommandClass.setInstances(instances); logger.debug(STR, this.getNode().getNodeId(), instances); } int waiting = 0; for (ZWaveCommandClass zwaveCommandClass : this.getNode().getCommandClasses()) { if (zwaveCommandClass.getCommandClass() == CommandClass.NO_OPERATION) continue; if (zwaveCommandClass.getInstances() == 0) { waiting++; logger.debug(STR, this.getNode().getNodeId(), zwaveCommandClass.getCommandClass().getLabel()); } } if(waiting != 0) { logger.debug(STR, this.getNode().getNodeId(), waiting); return; } this.getNode().advanceNodeStage(NodeStage.STATIC_VALUES); }
/** * Handles Multi Instance Report message. Handles Report on * the number of instances for the command class. * @param serialMessage the serial message to process. * @param offset the offset at which to start procesing. */
Handles Multi Instance Report message. Handles Report on the number of instances for the command class
handleMultiInstanceReportResponse
{ "repo_name": "woodrowbarlow/ZWaveManagement", "path": "src/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveMultiInstanceCommandClass.java", "license": "lgpl-3.0", "size": 24123 }
[ "org.openhab.binding.zwave.internal.protocol.NodeStage", "org.openhab.binding.zwave.internal.protocol.SerialMessage" ]
import org.openhab.binding.zwave.internal.protocol.NodeStage; import org.openhab.binding.zwave.internal.protocol.SerialMessage;
import org.openhab.binding.zwave.internal.protocol.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,808,392
@Override public Map<String, ActionInputParameter> getRequiredParameters() { Map<String, ActionInputParameter> ret = new HashMap<String, ActionInputParameter>(); for (Map.Entry<String, ActionInputParameter> entry : requestParams.entrySet()) { ActionInputParameter annotatedParameter = entry.getValue(); if (annotatedParameter.isRequired()) { ret.put(entry.getKey(), annotatedParameter); } } for (Map.Entry<String, ActionInputParameter> entry : pathVariables.entrySet()) { ActionInputParameter annotatedParameter = entry.getValue(); ret.put(entry.getKey(), annotatedParameter); } // requestBody not supported, would have to use exploded modifier return ret; } /** * Allows to set the cardinality, i.e. specify if the action refers to a collection or a single resource. Default is * {@link Cardinality#SINGLE}
Map<String, ActionInputParameter> function() { Map<String, ActionInputParameter> ret = new HashMap<String, ActionInputParameter>(); for (Map.Entry<String, ActionInputParameter> entry : requestParams.entrySet()) { ActionInputParameter annotatedParameter = entry.getValue(); if (annotatedParameter.isRequired()) { ret.put(entry.getKey(), annotatedParameter); } } for (Map.Entry<String, ActionInputParameter> entry : pathVariables.entrySet()) { ActionInputParameter annotatedParameter = entry.getValue(); ret.put(entry.getKey(), annotatedParameter); } return ret; } /** * Allows to set the cardinality, i.e. specify if the action refers to a collection or a single resource. Default is * {@link Cardinality#SINGLE}
/** * Determines action input parameters for required url variables. * * @return required url variables */
Determines action input parameters for required url variables
getRequiredParameters
{ "repo_name": "dschulten/hydra-java", "path": "spring-hateoas-ext/src/main/java/de/escalon/hypermedia/spring/SpringActionDescriptor.java", "license": "apache-2.0", "size": 12042 }
[ "de.escalon.hypermedia.action.Cardinality", "de.escalon.hypermedia.affordance.ActionInputParameter", "java.util.HashMap", "java.util.Map" ]
import de.escalon.hypermedia.action.Cardinality; import de.escalon.hypermedia.affordance.ActionInputParameter; import java.util.HashMap; import java.util.Map;
import de.escalon.hypermedia.action.*; import de.escalon.hypermedia.affordance.*; import java.util.*;
[ "de.escalon.hypermedia", "java.util" ]
de.escalon.hypermedia; java.util;
824,806
public HashMap<String, Integer> uniqueSites() { HashMap<String, Integer> snps = new HashMap<String, Integer>(); for (int tag = 0; tag < myNumTags; tag++) { //Visit each tag in TOPM for (int variant = 0; variant < myMaxVariants; variant++) { //Visit each variant in TOPM byte off = getVariantPosOff(tag, variant); if (off == BYTE_MISSING) { continue; } int a = getStartPosition(tag); int b = getVariantPosOff(tag, variant); int c = a + b; String pos = getChromosome(tag) + "\t" + c; snps.put(pos, tag); } } return snps; }
HashMap<String, Integer> function() { HashMap<String, Integer> snps = new HashMap<String, Integer>(); for (int tag = 0; tag < myNumTags; tag++) { for (int variant = 0; variant < myMaxVariants; variant++) { byte off = getVariantPosOff(tag, variant); if (off == BYTE_MISSING) { continue; } int a = getStartPosition(tag); int b = getVariantPosOff(tag, variant); int c = a + b; String pos = getChromosome(tag) + "\t" + c; snps.put(pos, tag); } } return snps; }
/** * Maps unique sites (i.e. bestChr and position) to the indices of the * tags in which they are found. */
Maps unique sites (i.e. bestChr and position) to the indices of the tags in which they are found
uniqueSites
{ "repo_name": "yzhnasa/TASSEL-iRods", "path": "src/net/maizegenetics/dna/map/TagsOnPhysicalMap.java", "license": "mit", "size": 48325 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,341,978
public Map<String, List<CmsFormDataBean>> getReplies() { if (m_replies == null) { m_replies = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {
Map<String, List<CmsFormDataBean>> function() { if (m_replies == null) { m_replies = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {
/** * Returns a lazily initialized map that provides the list of replies, if a comment id is provided as key. * * @return lazily initialized map that provides the list of replies, if a comment id is provided as key. */
Returns a lazily initialized map that provides the list of replies, if a comment id is provided as key
getReplies
{ "repo_name": "alkacon/alkacon-oamp", "path": "com.alkacon.opencms.v8.comments/src/com/alkacon/opencms/v8/comments/CmsRepliesAccessBean.java", "license": "gpl-3.0", "size": 5996 }
[ "com.alkacon.opencms.v8.formgenerator.database.CmsFormDataBean", "java.util.List", "java.util.Map", "org.apache.commons.collections.Transformer", "org.opencms.util.CmsCollectionsGenericWrapper" ]
import com.alkacon.opencms.v8.formgenerator.database.CmsFormDataBean; import java.util.List; import java.util.Map; import org.apache.commons.collections.Transformer; import org.opencms.util.CmsCollectionsGenericWrapper;
import com.alkacon.opencms.v8.formgenerator.database.*; import java.util.*; import org.apache.commons.collections.*; import org.opencms.util.*;
[ "com.alkacon.opencms", "java.util", "org.apache.commons", "org.opencms.util" ]
com.alkacon.opencms; java.util; org.apache.commons; org.opencms.util;
250,054
int updateByPrimaryKeySelective(Message record);
int updateByPrimaryKeySelective(Message record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_prj_message * * @mbggenerated Mon Sep 21 13:52:03 ICT 2015 */
This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_message
updateByPrimaryKeySelective
{ "repo_name": "maduhu/mycollab", "path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/project/dao/MessageMapper.java", "license": "agpl-3.0", "size": 5509 }
[ "com.esofthead.mycollab.module.project.domain.Message" ]
import com.esofthead.mycollab.module.project.domain.Message;
import com.esofthead.mycollab.module.project.domain.*;
[ "com.esofthead.mycollab" ]
com.esofthead.mycollab;
1,497,848
public List<AbstractNode> getNodes() { return nodes; }
List<AbstractNode> function() { return nodes; }
/** * Returns the sequence of nodes. */
Returns the sequence of nodes
getNodes
{ "repo_name": "cursem/ScriptCompressor", "path": "ScriptCompressor1.0/src/dk/brics/tajs/flowgraph/BasicBlock.java", "license": "apache-2.0", "size": 9318 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
349,672
@Test public void testValidateTokenOldTokenAfterJuly() { token.setExpiresOn(null); token.setVersion(null); String hmac = generator.generateSignature(token, DEFAULT_KEY_VERSION); token.setHmac(hmac); // move the clock before July 2018 when(mockClock.currentTimeMillis()).thenReturn(OLD_TOKEN_EXPIRATION_EPOCH_MS+1); try { // call under test generator.validateToken(token); fail(); } catch (UnauthorizedException e) { // expected assertEquals(TOKEN_HAS_EXPIRED, e.getMessage()); } }
void function() { token.setExpiresOn(null); token.setVersion(null); String hmac = generator.generateSignature(token, DEFAULT_KEY_VERSION); token.setHmac(hmac); when(mockClock.currentTimeMillis()).thenReturn(OLD_TOKEN_EXPIRATION_EPOCH_MS+1); try { generator.validateToken(token); fail(); } catch (UnauthorizedException e) { assertEquals(TOKEN_HAS_EXPIRED, e.getMessage()); } }
/** * Prior to PLFM-4958, tokens would not expire and had no version. * All such tokens will be treated as expired after July 2018. * To test this case both version and expiration fields are cleared. * */
Prior to PLFM-4958, tokens would not expire and had no version. All such tokens will be treated as expired after July 2018. To test this case both version and expiration fields are cleared
testValidateTokenOldTokenAfterJuly
{ "repo_name": "Sage-Bionetworks/Synapse-Repository-Services", "path": "services/repository-managers/src/test/java/org/sagebionetworks/repo/manager/token/TokenGeneratorImplTest.java", "license": "apache-2.0", "size": 8679 }
[ "org.junit.Assert", "org.mockito.Mockito", "org.sagebionetworks.repo.model.UnauthorizedException" ]
import org.junit.Assert; import org.mockito.Mockito; import org.sagebionetworks.repo.model.UnauthorizedException;
import org.junit.*; import org.mockito.*; import org.sagebionetworks.repo.model.*;
[ "org.junit", "org.mockito", "org.sagebionetworks.repo" ]
org.junit; org.mockito; org.sagebionetworks.repo;
2,146,610
private void defaultOnMeasure(int widthSpec, int heightSpec) { final int widthMode = MeasureSpec.getMode(widthSpec); final int heightMode = MeasureSpec.getMode(heightSpec); final int widthSize = MeasureSpec.getSize(widthSpec); final int heightSize = MeasureSpec.getSize(heightSpec); int width = 0; int height = 0; switch (widthMode) { case MeasureSpec.EXACTLY: case MeasureSpec.AT_MOST: width = widthSize; break; case MeasureSpec.UNSPECIFIED: default: width = ViewCompat.getMinimumWidth(this); break; } switch (heightMode) { case MeasureSpec.EXACTLY: case MeasureSpec.AT_MOST: height = heightSize; break; case MeasureSpec.UNSPECIFIED: default: height = ViewCompat.getMinimumHeight(this); break; } setMeasuredDimension(width, height); }
void function(int widthSpec, int heightSpec) { final int widthMode = MeasureSpec.getMode(widthSpec); final int heightMode = MeasureSpec.getMode(heightSpec); final int widthSize = MeasureSpec.getSize(widthSpec); final int heightSize = MeasureSpec.getSize(heightSpec); int width = 0; int height = 0; switch (widthMode) { case MeasureSpec.EXACTLY: case MeasureSpec.AT_MOST: width = widthSize; break; case MeasureSpec.UNSPECIFIED: default: width = ViewCompat.getMinimumWidth(this); break; } switch (heightMode) { case MeasureSpec.EXACTLY: case MeasureSpec.AT_MOST: height = heightSize; break; case MeasureSpec.UNSPECIFIED: default: height = ViewCompat.getMinimumHeight(this); break; } setMeasuredDimension(width, height); }
/** * Used when onMeasure is called before layout manager is set */
Used when onMeasure is called before layout manager is set
defaultOnMeasure
{ "repo_name": "devDavide/Decisiongram", "path": "TMessagesProj/src/main/java/org/telegram/messenger/support/widget/RecyclerView.java", "license": "gpl-2.0", "size": 438498 }
[ "android.support.v4.view.ViewCompat" ]
import android.support.v4.view.ViewCompat;
import android.support.v4.view.*;
[ "android.support" ]
android.support;
659,801
public Map<AbstractProject,Integer> getTransitiveUpstreamBuilds() { return _getUpstreamBuilds(getParent().getTransitiveUpstreamProjects()); }
Map<AbstractProject,Integer> function() { return _getUpstreamBuilds(getParent().getTransitiveUpstreamProjects()); }
/** * Works like {@link #getUpstreamBuilds()} but also includes all the transitive * dependencies as well. */
Works like <code>#getUpstreamBuilds()</code> but also includes all the transitive dependencies as well
getTransitiveUpstreamBuilds
{ "repo_name": "rwaldron/jenkins", "path": "core/src/main/java/hudson/model/AbstractBuild.java", "license": "mit", "size": 46957 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
648,090
if (soapModel == null) { return null; } StepTransition model = new StepTransitionImpl(); model.setStepTransitionId(soapModel.getStepTransitionId()); model.setUserId(soapModel.getUserId()); model.setGroupId(soapModel.getGroupId()); model.setCompanyId(soapModel.getCompanyId()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setDossierProcessId(soapModel.getDossierProcessId()); model.setPreDossierStepId(soapModel.getPreDossierStepId()); model.setPostDossierStepId(soapModel.getPostDossierStepId()); model.setAutoCondition(soapModel.getAutoCondition()); model.setTransitionName(soapModel.getTransitionName()); model.setDossierStatus(soapModel.getDossierStatus()); model.setSendResults(soapModel.getSendResults()); model.setUserAssignment(soapModel.getUserAssignment()); model.setNewProcessOrder(soapModel.getNewProcessOrder()); return model; }
if (soapModel == null) { return null; } StepTransition model = new StepTransitionImpl(); model.setStepTransitionId(soapModel.getStepTransitionId()); model.setUserId(soapModel.getUserId()); model.setGroupId(soapModel.getGroupId()); model.setCompanyId(soapModel.getCompanyId()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setDossierProcessId(soapModel.getDossierProcessId()); model.setPreDossierStepId(soapModel.getPreDossierStepId()); model.setPostDossierStepId(soapModel.getPostDossierStepId()); model.setAutoCondition(soapModel.getAutoCondition()); model.setTransitionName(soapModel.getTransitionName()); model.setDossierStatus(soapModel.getDossierStatus()); model.setSendResults(soapModel.getSendResults()); model.setUserAssignment(soapModel.getUserAssignment()); model.setNewProcessOrder(soapModel.getNewProcessOrder()); return model; }
/** * Converts the soap model instance into a normal model instance. * * @param soapModel the soap model instance to convert * @return the normal model instance */
Converts the soap model instance into a normal model instance
toModel
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-processmgt-portlet/docroot/WEB-INF/src/org/oep/processmgt/model/impl/StepTransitionModelImpl.java", "license": "apache-2.0", "size": 22520 }
[ "org.oep.processmgt.model.StepTransition" ]
import org.oep.processmgt.model.StepTransition;
import org.oep.processmgt.model.*;
[ "org.oep.processmgt" ]
org.oep.processmgt;
2,238,972
public static boolean validateOutputDirectory(CFlags flags, String outputFlag) { final File directory = (File) flags.getValue(outputFlag); if (directory.exists()) { if (!flags.isSet(FORCE)) { Diagnostic.error(ErrorType.DIRECTORY_EXISTS, directory.getPath()); return false; } else if (!directory.isDirectory()) { flags.setParseMessage("The directory \"" + directory + "\" already exists and is not a directory. Please remove it first or choose a different file"); return false; } } return true; }
static boolean function(CFlags flags, String outputFlag) { final File directory = (File) flags.getValue(outputFlag); if (directory.exists()) { if (!flags.isSet(FORCE)) { Diagnostic.error(ErrorType.DIRECTORY_EXISTS, directory.getPath()); return false; } else if (!directory.isDirectory()) { flags.setParseMessage(STRSTR\STR); return false; } } return true; }
/** * Validate the output dir flags. * @param flags the flags * @param outputFlag the name of the flag used to specify the output directory * @return true if valid, otherwise false */
Validate the output dir flags
validateOutputDirectory
{ "repo_name": "RealTimeGenomics/rtg-tools", "path": "src/com/rtg/launcher/CommonFlags.java", "license": "bsd-2-clause", "size": 30102 }
[ "com.rtg.util.cli.CFlags", "com.rtg.util.diagnostic.Diagnostic", "com.rtg.util.diagnostic.ErrorType", "java.io.File" ]
import com.rtg.util.cli.CFlags; import com.rtg.util.diagnostic.Diagnostic; import com.rtg.util.diagnostic.ErrorType; import java.io.File;
import com.rtg.util.cli.*; import com.rtg.util.diagnostic.*; import java.io.*;
[ "com.rtg.util", "java.io" ]
com.rtg.util; java.io;
1,124,743
public static MockWebServiceClient createClient(ApplicationContext applicationContext, ClientInterceptor[] interceptors) { Assert.notNull(applicationContext, "'applicationContext' must not be null"); MockStrategiesHelper strategiesHelper = new MockStrategiesHelper(applicationContext); WebServiceMessageReceiver messageReceiver = strategiesHelper.getStrategy(WebServiceMessageReceiver.class, SoapMessageDispatcher.class); WebServiceMessageFactory messageFactory = strategiesHelper.getStrategy(WebServiceMessageFactory.class, SaajSoapMessageFactory.class); return createClient(messageReceiver, messageFactory, interceptors); }
static MockWebServiceClient function(ApplicationContext applicationContext, ClientInterceptor[] interceptors) { Assert.notNull(applicationContext, STR); MockStrategiesHelper strategiesHelper = new MockStrategiesHelper(applicationContext); WebServiceMessageReceiver messageReceiver = strategiesHelper.getStrategy(WebServiceMessageReceiver.class, SoapMessageDispatcher.class); WebServiceMessageFactory messageFactory = strategiesHelper.getStrategy(WebServiceMessageFactory.class, SaajSoapMessageFactory.class); return createClient(messageReceiver, messageFactory, interceptors); }
/** * Creates a {@code MockWebServiceClient} instance based on the given {@link WebServiceMessageReceiver} and {@link * WebServiceMessageFactory}. Supports interceptors that can be applied on the outgoing message. * * @param applicationContext to extract mocks from * @param interceptors * @return the created client */
Creates a MockWebServiceClient instance based on the given <code>WebServiceMessageReceiver</code> and <code>WebServiceMessageFactory</code>. Supports interceptors that can be applied on the outgoing message
createClient
{ "repo_name": "lukas-krecan/smock", "path": "springws/src/main/java/net/javacrumbs/smock/springws/server/SmockServer.java", "license": "apache-2.0", "size": 3229 }
[ "org.springframework.context.ApplicationContext", "org.springframework.util.Assert", "org.springframework.ws.WebServiceMessageFactory", "org.springframework.ws.client.support.interceptor.ClientInterceptor", "org.springframework.ws.soap.saaj.SaajSoapMessageFactory", "org.springframework.ws.soap.server.Soap...
import org.springframework.context.ApplicationContext; import org.springframework.util.Assert; import org.springframework.ws.WebServiceMessageFactory; import org.springframework.ws.client.support.interceptor.ClientInterceptor; import org.springframework.ws.soap.saaj.SaajSoapMessageFactory; import org.springframework.ws.soap.server.SoapMessageDispatcher; import org.springframework.ws.test.server.MockWebServiceClient; import org.springframework.ws.test.support.MockStrategiesHelper; import org.springframework.ws.transport.WebServiceMessageReceiver;
import org.springframework.context.*; import org.springframework.util.*; import org.springframework.ws.*; import org.springframework.ws.client.support.interceptor.*; import org.springframework.ws.soap.saaj.*; import org.springframework.ws.soap.server.*; import org.springframework.ws.test.server.*; import org.springframework.ws.test.support.*; import org.springframework.ws.transport.*;
[ "org.springframework.context", "org.springframework.util", "org.springframework.ws" ]
org.springframework.context; org.springframework.util; org.springframework.ws;
576,448
public Builder typeface(Typeface medium, Typeface regular) { this.mediumFont = medium; this.regularFont = regular; return this; }
Builder function(Typeface medium, Typeface regular) { this.mediumFont = medium; this.regularFont = regular; return this; }
/** * Sets the fonts used in the dialog. * * @param medium The font used on titles and action buttons. Null uses the default. * @param regular The font used everywhere else, like on the content and list items. Null uses the default. * @return The Builder instance so you can chain calls to it. */
Sets the fonts used in the dialog
typeface
{ "repo_name": "trafi/material-dialogs", "path": "library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java", "license": "mit", "size": 70017 }
[ "android.graphics.Typeface" ]
import android.graphics.Typeface;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,531,443
public int getAccessibleSelectionCount() { Object[] rootPath = new Object[1]; rootPath[0] = treeModel.getRoot(); if (rootPath[0] == null) return 0; TreePath childPath = new TreePath(rootPath); if (JTree.this.isPathSelected(childPath)) { return 1; } else { return 0; } }
int function() { Object[] rootPath = new Object[1]; rootPath[0] = treeModel.getRoot(); if (rootPath[0] == null) return 0; TreePath childPath = new TreePath(rootPath); if (JTree.this.isPathSelected(childPath)) { return 1; } else { return 0; } }
/** * Returns the number of items currently selected. * If no items are selected, the return value will be 0. * * @return the number of items currently selected. */
Returns the number of items currently selected. If no items are selected, the return value will be 0
getAccessibleSelectionCount
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/javax/swing/JTree.java", "license": "apache-2.0", "size": 215008 }
[ "javax.swing.tree.TreePath" ]
import javax.swing.tree.TreePath;
import javax.swing.tree.*;
[ "javax.swing" ]
javax.swing;
1,403,495
public List<DagConnection> getBroadcastConnections() { return this.broadcastConnections; }
List<DagConnection> function() { return this.broadcastConnections; }
/** * Return the list of inputs associated with broadcast variables for this node. */
Return the list of inputs associated with broadcast variables for this node
getBroadcastConnections
{ "repo_name": "hequn8128/flink", "path": "flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java", "license": "apache-2.0", "size": 41457 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
912,276
private void updateButtonStatus() { Tab currentTab = mLocationBarModel.getTab(); boolean tabCrashed = currentTab != null && SadTab.isShowing(currentTab); mToolbar.updateButtonVisibility(); mToolbar.updateBackButtonVisibility(currentTab != null && currentTab.canGoBack()); mToolbar.updateForwardButtonVisibility(currentTab != null && currentTab.canGoForward()); updateReloadState(tabCrashed); updateBookmarkButtonStatus(); if (mToolbar.getMenuButtonWrapper() != null && !isBottomToolbarVisible()) { mToolbar.getMenuButtonWrapper().setVisibility(View.VISIBLE); } }
void function() { Tab currentTab = mLocationBarModel.getTab(); boolean tabCrashed = currentTab != null && SadTab.isShowing(currentTab); mToolbar.updateButtonVisibility(); mToolbar.updateBackButtonVisibility(currentTab != null && currentTab.canGoBack()); mToolbar.updateForwardButtonVisibility(currentTab != null && currentTab.canGoForward()); updateReloadState(tabCrashed); updateBookmarkButtonStatus(); if (mToolbar.getMenuButtonWrapper() != null && !isBottomToolbarVisible()) { mToolbar.getMenuButtonWrapper().setVisibility(View.VISIBLE); } }
/** * Updates the current button states and calls appropriate abstract visibility methods, giving * inheriting classes the chance to update the button visuals as well. */
Updates the current button states and calls appropriate abstract visibility methods, giving inheriting classes the chance to update the button visuals as well
updateButtonStatus
{ "repo_name": "endlessm/chromium-browser", "path": "chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java", "license": "bsd-3-clause", "size": 71970 }
[ "android.view.View", "org.chromium.chrome.browser.tab.SadTab", "org.chromium.chrome.browser.tab.Tab" ]
import android.view.View; import org.chromium.chrome.browser.tab.SadTab; import org.chromium.chrome.browser.tab.Tab;
import android.view.*; import org.chromium.chrome.browser.tab.*;
[ "android.view", "org.chromium.chrome" ]
android.view; org.chromium.chrome;
1,245,978
public synchronized boolean poll_next_response() { checkShutdownState(); Request currRequest; // poll on each pending request Enumeration ve = dynamicRequests.elements(); while (ve.hasMoreElements() == true) { currRequest = (Request)ve.nextElement(); if (currRequest.poll_response() == true) { return true; } } return false; }
synchronized boolean function() { checkShutdownState(); Request currRequest; Enumeration ve = dynamicRequests.elements(); while (ve.hasMoreElements() == true) { currRequest = (Request)ve.nextElement(); if (currRequest.poll_response() == true) { return true; } } return false; }
/** * Find out if any of the deferred invocations have a response yet. */
Find out if any of the deferred invocations have a response yet
poll_next_response
{ "repo_name": "JetBrains/jdk8u_corba", "path": "src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java", "license": "gpl-2.0", "size": 70996 }
[ "java.util.Enumeration", "org.omg.CORBA" ]
import java.util.Enumeration; import org.omg.CORBA;
import java.util.*; import org.omg.*;
[ "java.util", "org.omg" ]
java.util; org.omg;
1,258,678
public int monitorExecution(final DAGClient dagClient, HiveTxnManager txnMgr, HiveConf conf, DAG dag) throws InterruptedException { DAGStatus status = null; completed = new HashSet<String>(); boolean running = false; boolean done = false; int failedCounter = 0; int rc = 0; DAGStatus.State lastState = null; String lastReport = null; Set<StatusGetOpts> opts = new HashSet<StatusGetOpts>(); Heartbeater heartbeater = new Heartbeater(txnMgr, conf); long startTime = 0; boolean isProfileEnabled = conf.getBoolVar(conf, HiveConf.ConfVars.TEZ_EXEC_SUMMARY); boolean inPlaceUpdates = conf.getBoolVar(conf, HiveConf.ConfVars.TEZ_EXEC_INPLACE_PROGRESS); boolean wideTerminal = false; boolean isTerminal = inPlaceUpdates == true ? isUnixTerminal() : false; // we need at least 80 chars wide terminal to display in-place updates properly if (isTerminal) { if (getTerminalWidth() >= MIN_TERMINAL_WIDTH) { wideTerminal = true; } } boolean inPlaceEligible = false; if (inPlaceUpdates && isTerminal && wideTerminal && !console.getIsSilent()) { inPlaceEligible = true; } shutdownList.add(dagClient); console.printInfo("\n"); perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.TEZ_RUN_DAG); perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.TEZ_SUBMIT_TO_RUNNING); while (true) { try { status = dagClient.getDAGStatus(opts); Map<String, Progress> progressMap = status.getVertexProgress(); DAGStatus.State state = status.getState(); heartbeater.heartbeat(); if (state != lastState || state == RUNNING) { lastState = state; switch (state) { case SUBMITTED: console.printInfo("Status: Submitted"); break; case INITING: console.printInfo("Status: Initializing"); startTime = System.currentTimeMillis(); break; case RUNNING: if (!running) { perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.TEZ_SUBMIT_TO_RUNNING); console.printInfo("Status: Running (" + dagClient.getExecutionContext() + ")\n"); startTime = System.currentTimeMillis(); running = true; } if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, false, dagClient); // log the progress report to log file as well lastReport = logStatus(progressMap, lastReport, console); } else { lastReport = printStatus(progressMap, lastReport, console); } break; case SUCCEEDED: if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, false, dagClient); // log the progress report to log file as well lastReport = logStatus(progressMap, lastReport, console); } else { lastReport = printStatus(progressMap, lastReport, console); } if (isProfileEnabled) { double duration = (System.currentTimeMillis() - startTime) / 1000.0; console.printInfo("Status: DAG finished successfully in " + String.format("%.2f seconds", duration)); console.printInfo("\n"); printMethodsSummary(); printDagSummary(progressMap, console, dagClient, conf, dag); } running = false; done = true; break; case KILLED: if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, true, dagClient); // log the progress report to log file as well lastReport = logStatus(progressMap, lastReport, console); } console.printInfo("Status: Killed"); running = false; done = true; rc = 1; break; case FAILED: case ERROR: if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, true, dagClient); // log the progress report to log file as well lastReport = logStatus(progressMap, lastReport, console); } console.printError("Status: Failed"); running = false; done = true; rc = 2; break; } } if (!done) { Thread.sleep(checkInterval); } } catch (Exception e) { console.printInfo("Exception: " + e.getMessage()); if (++failedCounter % maxRetryInterval / checkInterval == 0 || e instanceof InterruptedException) { try { console.printInfo("Killing DAG..."); dagClient.tryKillDAG(); } catch (IOException io) { // best effort } catch (TezException te) { // best effort } e.printStackTrace(); console.printError("Execution has failed."); rc = 1; done = true; } else { console.printInfo("Retrying..."); } } finally { if (done) { if (rc != 0 && status != null) { for (String diag : status.getDiagnostics()) { console.printError(diag); } } shutdownList.remove(dagClient); break; } } } perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.TEZ_RUN_DAG); return rc; }
int function(final DAGClient dagClient, HiveTxnManager txnMgr, HiveConf conf, DAG dag) throws InterruptedException { DAGStatus status = null; completed = new HashSet<String>(); boolean running = false; boolean done = false; int failedCounter = 0; int rc = 0; DAGStatus.State lastState = null; String lastReport = null; Set<StatusGetOpts> opts = new HashSet<StatusGetOpts>(); Heartbeater heartbeater = new Heartbeater(txnMgr, conf); long startTime = 0; boolean isProfileEnabled = conf.getBoolVar(conf, HiveConf.ConfVars.TEZ_EXEC_SUMMARY); boolean inPlaceUpdates = conf.getBoolVar(conf, HiveConf.ConfVars.TEZ_EXEC_INPLACE_PROGRESS); boolean wideTerminal = false; boolean isTerminal = inPlaceUpdates == true ? isUnixTerminal() : false; if (isTerminal) { if (getTerminalWidth() >= MIN_TERMINAL_WIDTH) { wideTerminal = true; } } boolean inPlaceEligible = false; if (inPlaceUpdates && isTerminal && wideTerminal && !console.getIsSilent()) { inPlaceEligible = true; } shutdownList.add(dagClient); console.printInfo("\n"); perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.TEZ_RUN_DAG); perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.TEZ_SUBMIT_TO_RUNNING); while (true) { try { status = dagClient.getDAGStatus(opts); Map<String, Progress> progressMap = status.getVertexProgress(); DAGStatus.State state = status.getState(); heartbeater.heartbeat(); if (state != lastState state == RUNNING) { lastState = state; switch (state) { case SUBMITTED: console.printInfo(STR); break; case INITING: console.printInfo(STR); startTime = System.currentTimeMillis(); break; case RUNNING: if (!running) { perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.TEZ_SUBMIT_TO_RUNNING); console.printInfo(STR + dagClient.getExecutionContext() + ")\n"); startTime = System.currentTimeMillis(); running = true; } if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, false, dagClient); lastReport = logStatus(progressMap, lastReport, console); } else { lastReport = printStatus(progressMap, lastReport, console); } break; case SUCCEEDED: if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, false, dagClient); lastReport = logStatus(progressMap, lastReport, console); } else { lastReport = printStatus(progressMap, lastReport, console); } if (isProfileEnabled) { double duration = (System.currentTimeMillis() - startTime) / 1000.0; console.printInfo(STR + String.format(STR, duration)); console.printInfo("\n"); printMethodsSummary(); printDagSummary(progressMap, console, dagClient, conf, dag); } running = false; done = true; break; case KILLED: if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, true, dagClient); lastReport = logStatus(progressMap, lastReport, console); } console.printInfo(STR); running = false; done = true; rc = 1; break; case FAILED: case ERROR: if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, true, dagClient); lastReport = logStatus(progressMap, lastReport, console); } console.printError(STR); running = false; done = true; rc = 2; break; } } if (!done) { Thread.sleep(checkInterval); } } catch (Exception e) { console.printInfo(STR + e.getMessage()); if (++failedCounter % maxRetryInterval / checkInterval == 0 e instanceof InterruptedException) { try { console.printInfo(STR); dagClient.tryKillDAG(); } catch (IOException io) { } catch (TezException te) { } e.printStackTrace(); console.printError(STR); rc = 1; done = true; } else { console.printInfo(STR); } } finally { if (done) { if (rc != 0 && status != null) { for (String diag : status.getDiagnostics()) { console.printError(diag); } } shutdownList.remove(dagClient); break; } } } perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.TEZ_RUN_DAG); return rc; }
/** * monitorExecution handles status printing, failures during execution and final status retrieval. * * @param dagClient client that was used to kick off the job * @param txnMgr transaction manager for this operation * @param conf configuration file for this operation * @return int 0 - success, 1 - killed, 2 - failed */
monitorExecution handles status printing, failures during execution and final status retrieval
monitorExecution
{ "repo_name": "wangbin83-gmail-com/hive-1.1.0-cdh5.4.8", "path": "ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java", "license": "apache-2.0", "size": 30771 }
[ "java.io.IOException", "java.util.HashSet", "java.util.Map", "java.util.Set", "org.apache.hadoop.hive.conf.HiveConf", "org.apache.hadoop.hive.ql.exec.Heartbeater", "org.apache.hadoop.hive.ql.lockmgr.HiveTxnManager", "org.apache.hadoop.hive.ql.log.PerfLogger", "org.apache.tez.dag.api.TezException", ...
import java.io.IOException; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.ql.exec.Heartbeater; import org.apache.hadoop.hive.ql.lockmgr.HiveTxnManager; import org.apache.hadoop.hive.ql.log.PerfLogger; import org.apache.tez.dag.api.TezException; import org.apache.tez.dag.api.client.DAGClient; import org.apache.tez.dag.api.client.DAGStatus; import org.apache.tez.dag.api.client.Progress; import org.apache.tez.dag.api.client.StatusGetOpts;
import java.io.*; import java.util.*; import org.apache.hadoop.hive.conf.*; import org.apache.hadoop.hive.ql.exec.*; import org.apache.hadoop.hive.ql.lockmgr.*; import org.apache.hadoop.hive.ql.log.*; import org.apache.tez.dag.api.*; import org.apache.tez.dag.api.client.*;
[ "java.io", "java.util", "org.apache.hadoop", "org.apache.tez" ]
java.io; java.util; org.apache.hadoop; org.apache.tez;
1,106,385
private void init() { // Force the background to software rendering because otherwise the Blur // filter won't work. setLayerToSW(this); // Set up the paint for the label text mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTextPaint.setColor(mTextColor); if (mTextHeight == 0) { mTextHeight = mTextPaint.getTextSize(); } else { mTextPaint.setTextSize(mTextHeight); } // Set up the paint for the pie slices mPiePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPiePaint.setStyle(Paint.Style.FILL); mPiePaint.setTextSize(mTextHeight); // Set up the paint for the shadow mShadowPaint = new Paint(0); mShadowPaint.setColor(0xff101010); mShadowPaint.setMaskFilter(new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL)); // Add a child view to draw the pie. Putting this in a child view // makes it possible to draw it on a separate hardware layer that rotates // independently mPieView = new PieView(getContext()); addView(mPieView); mPieView.rotateTo(mPieRotation); // The pointer doesn't need hardware acceleration, but in order to show up // in front of the pie it also needs to be on a separate view. mPointerView = new PointerView(getContext()); addView(mPointerView); // Set up an animator to animate the PieRotation property. This is used to // correct the pie's orientation after the user lets go of it. if (Build.VERSION.SDK_INT >= 11) { mAutoCenterAnimator = ObjectAnimator.ofInt(PieChart.this, "PieRotation", 0);
void function() { setLayerToSW(this); mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTextPaint.setColor(mTextColor); if (mTextHeight == 0) { mTextHeight = mTextPaint.getTextSize(); } else { mTextPaint.setTextSize(mTextHeight); } mPiePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPiePaint.setStyle(Paint.Style.FILL); mPiePaint.setTextSize(mTextHeight); mShadowPaint = new Paint(0); mShadowPaint.setColor(0xff101010); mShadowPaint.setMaskFilter(new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL)); mPieView = new PieView(getContext()); addView(mPieView); mPieView.rotateTo(mPieRotation); mPointerView = new PointerView(getContext()); addView(mPointerView); if (Build.VERSION.SDK_INT >= 11) { mAutoCenterAnimator = ObjectAnimator.ofInt(PieChart.this, STR, 0);
/** * Initialize the control. This code is in a separate method so that it can be * called from both constructors. */
Initialize the control. This code is in a separate method so that it can be called from both constructors
init
{ "repo_name": "khanh245/Android-Sample", "path": "PieCustomView/src/oit/edu/piecustomview/charting/PieChart.java", "license": "mit", "size": 33609 }
[ "android.animation.ObjectAnimator", "android.graphics.BlurMaskFilter", "android.graphics.Paint", "android.os.Build" ]
import android.animation.ObjectAnimator; import android.graphics.BlurMaskFilter; import android.graphics.Paint; import android.os.Build;
import android.animation.*; import android.graphics.*; import android.os.*;
[ "android.animation", "android.graphics", "android.os" ]
android.animation; android.graphics; android.os;
1,733,665
@Override public Iterable<GenericRecord> convertRecord(Schema outputSchema, GenericRecord inputRecord, WorkUnitState workUnit) throws DataConversionException { try { return new SingleRecordIterable<>(AvroUtils.convertRecordSchema(inputRecord, outputSchema)); } catch (IOException e) { throw new DataConversionException(e); } }
Iterable<GenericRecord> function(Schema outputSchema, GenericRecord inputRecord, WorkUnitState workUnit) throws DataConversionException { try { return new SingleRecordIterable<>(AvroUtils.convertRecordSchema(inputRecord, outputSchema)); } catch (IOException e) { throw new DataConversionException(e); } }
/** * Convert the schema of inputRecord to outputSchema. */
Convert the schema of inputRecord to outputSchema
convertRecord
{ "repo_name": "chavdar/gobblin-1", "path": "gobblin-core-base/src/main/java/gobblin/converter/filter/AvroProjectionConverter.java", "license": "apache-2.0", "size": 3225 }
[ "java.io.IOException", "org.apache.avro.Schema", "org.apache.avro.generic.GenericRecord" ]
import java.io.IOException; import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord;
import java.io.*; import org.apache.avro.*; import org.apache.avro.generic.*;
[ "java.io", "org.apache.avro" ]
java.io; org.apache.avro;
1,854,837
public void handleEvent(Event evt) { Object[] defs = docRemovedListener.defsToBeRemoved.toArray(); docRemovedListener.defsToBeRemoved.clear(); for (int i = 0; i < defs.length; i++) { XBLOMDefinitionElement def = (XBLOMDefinitionElement) defs[i]; if (def.getAttributeNS(null, XBL_REF_ATTRIBUTE).length() == 0) { DefinitionRecord defRec = (DefinitionRecord) definitions.get(def, null); removeDefinition(defRec); } else { removeDefinitionRef(def); } } Object[] imps = docRemovedListener.importsToBeRemoved.toArray(); docRemovedListener.importsToBeRemoved.clear(); for (int i = 0; i < imps.length; i++) { removeImport((Element) imps[i]); } Object[] nodes = docRemovedListener.nodesToBeInvalidated.toArray(); docRemovedListener.nodesToBeInvalidated.clear(); for (int i = 0; i < nodes.length; i++) { invalidateChildNodes((Node) nodes[i]); } } } protected class TemplateMutationListener implements EventListener { protected Element importElement; public TemplateMutationListener(Element imp) { importElement = imp; }
void function(Event evt) { Object[] defs = docRemovedListener.defsToBeRemoved.toArray(); docRemovedListener.defsToBeRemoved.clear(); for (int i = 0; i < defs.length; i++) { XBLOMDefinitionElement def = (XBLOMDefinitionElement) defs[i]; if (def.getAttributeNS(null, XBL_REF_ATTRIBUTE).length() == 0) { DefinitionRecord defRec = (DefinitionRecord) definitions.get(def, null); removeDefinition(defRec); } else { removeDefinitionRef(def); } } Object[] imps = docRemovedListener.importsToBeRemoved.toArray(); docRemovedListener.importsToBeRemoved.clear(); for (int i = 0; i < imps.length; i++) { removeImport((Element) imps[i]); } Object[] nodes = docRemovedListener.nodesToBeInvalidated.toArray(); docRemovedListener.nodesToBeInvalidated.clear(); for (int i = 0; i < nodes.length; i++) { invalidateChildNodes((Node) nodes[i]); } } } protected class TemplateMutationListener implements EventListener { protected Element importElement; public TemplateMutationListener(Element imp) { importElement = imp; }
/** * Handles the event. */
Handles the event
handleEvent
{ "repo_name": "shyamalschandra/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/svg12/DefaultXBLManager.java", "license": "apache-2.0", "size": 70751 }
[ "org.apache.flex.forks.batik.dom.svg12.XBLOMDefinitionElement", "org.w3c.dom.Element", "org.w3c.dom.Node", "org.w3c.dom.events.Event", "org.w3c.dom.events.EventListener" ]
import org.apache.flex.forks.batik.dom.svg12.XBLOMDefinitionElement; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.events.Event; import org.w3c.dom.events.EventListener;
import org.apache.flex.forks.batik.dom.svg12.*; import org.w3c.dom.*; import org.w3c.dom.events.*;
[ "org.apache.flex", "org.w3c.dom" ]
org.apache.flex; org.w3c.dom;
1,321,961
@Nullable private Integer lookupNullable(Object value) { return table.get(value); } } } static class Deserializer { private final DeserializingMemoTable memo = new DeserializingMemoTable(); @Nullable private Integer tagForMemoizedBefore = null; private final Deque<Object> memoizedBeforeStackForSanityChecking = new ArrayDeque<>();
Integer function(Object value) { return table.get(value); } } } static class Deserializer { private final DeserializingMemoTable memo = new DeserializingMemoTable(); @Nullable private Integer tagForMemoizedBefore = null; private final Deque<Object> memoizedBeforeStackForSanityChecking = new ArrayDeque<>();
/** * If the value is already memoized, return its on-the-wire id; otherwise return null. Opaque. * * <p>Beware accidental unboxing of a null result. */
If the value is already memoized, return its on-the-wire id; otherwise return null. Opaque. Beware accidental unboxing of a null result
lookupNullable
{ "repo_name": "ButterflyNetwork/bazel", "path": "src/main/java/com/google/devtools/build/lib/skyframe/serialization/Memoizer.java", "license": "apache-2.0", "size": 16539 }
[ "java.util.ArrayDeque", "java.util.Deque", "javax.annotation.Nullable" ]
import java.util.ArrayDeque; import java.util.Deque; import javax.annotation.Nullable;
import java.util.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
2,558,359
FunctionTypeBuilder inferFromOverriddenFunction( @Nullable FunctionType oldType, @Nullable Node paramsParent) { if (oldType == null) { return this; } // Propagate the template types, if they exist. this.templateTypeNames = oldType.getTemplateTypeMap().getTemplateKeys(); returnType = oldType.getReturnType(); returnTypeInferred = oldType.isReturnTypeInferred(); if (paramsParent == null) { // Not a function literal. parameters = oldType.getParameters(); if (parameters == null) { parameters = new FunctionParamBuilder(typeRegistry).build(); } } else { // We're overriding with a function literal. Apply type information // to each parameter of the literal. FunctionParamBuilder paramBuilder = new FunctionParamBuilder(typeRegistry); Iterator<Parameter> oldParams = oldType.getParameters().iterator(); boolean warnedAboutArgList = false; boolean oldParamsListHitOptArgs = false; for (Node currentParam = paramsParent.getFirstChild(); currentParam != null; currentParam = currentParam.getNext()) { if (oldParams.hasNext()) { Parameter oldParam = oldParams.next(); oldParamsListHitOptArgs = oldParamsListHitOptArgs || oldParam.isVariadic() || oldParam.isOptional(); // The subclass method might write its var_args as individual arguments. boolean isOptionalArg = oldParam.isOptional(); boolean isVarArgs = oldParam.isVariadic(); if (currentParam.getNext() != null && isVarArgs) { isVarArgs = false; isOptionalArg = true; } // The subclass method might also make a required parameter into an optional parameter // with a default value if (currentParam.isDefaultValue()) { isOptionalArg = true; } paramBuilder.newParameterFrom( Parameter.create(oldParam.getJSType(), isOptionalArg, isVarArgs)); } else { warnedAboutArgList |= addParameter( paramBuilder, typeRegistry.getNativeType(UNKNOWN_TYPE), warnedAboutArgList, codingConvention.isOptionalParameter(currentParam) || oldParamsListHitOptArgs || currentParam.isDefaultValue(), codingConvention.isVarArgsParameter(currentParam)); } } // Clone any remaining params that aren't in the function literal, // but make them optional. while (oldParams.hasNext()) { paramBuilder.newOptionalParameterFrom(oldParams.next()); } parameters = paramBuilder.build(); } return this; }
FunctionTypeBuilder inferFromOverriddenFunction( @Nullable FunctionType oldType, @Nullable Node paramsParent) { if (oldType == null) { return this; } this.templateTypeNames = oldType.getTemplateTypeMap().getTemplateKeys(); returnType = oldType.getReturnType(); returnTypeInferred = oldType.isReturnTypeInferred(); if (paramsParent == null) { parameters = oldType.getParameters(); if (parameters == null) { parameters = new FunctionParamBuilder(typeRegistry).build(); } } else { FunctionParamBuilder paramBuilder = new FunctionParamBuilder(typeRegistry); Iterator<Parameter> oldParams = oldType.getParameters().iterator(); boolean warnedAboutArgList = false; boolean oldParamsListHitOptArgs = false; for (Node currentParam = paramsParent.getFirstChild(); currentParam != null; currentParam = currentParam.getNext()) { if (oldParams.hasNext()) { Parameter oldParam = oldParams.next(); oldParamsListHitOptArgs = oldParamsListHitOptArgs oldParam.isVariadic() oldParam.isOptional(); boolean isOptionalArg = oldParam.isOptional(); boolean isVarArgs = oldParam.isVariadic(); if (currentParam.getNext() != null && isVarArgs) { isVarArgs = false; isOptionalArg = true; } if (currentParam.isDefaultValue()) { isOptionalArg = true; } paramBuilder.newParameterFrom( Parameter.create(oldParam.getJSType(), isOptionalArg, isVarArgs)); } else { warnedAboutArgList = addParameter( paramBuilder, typeRegistry.getNativeType(UNKNOWN_TYPE), warnedAboutArgList, codingConvention.isOptionalParameter(currentParam) oldParamsListHitOptArgs currentParam.isDefaultValue(), codingConvention.isVarArgsParameter(currentParam)); } } while (oldParams.hasNext()) { paramBuilder.newOptionalParameterFrom(oldParams.next()); } parameters = paramBuilder.build(); } return this; }
/** * Infer the parameter and return types of a function from * the parameter and return types of the function it is overriding. * * @param oldType The function being overridden. Does nothing if this is null. * @param paramsParent The PARAM_LIST node of the function that we're assigning to. * If null, that just means we're not initializing this to a function * literal. */
Infer the parameter and return types of a function from the parameter and return types of the function it is overriding
inferFromOverriddenFunction
{ "repo_name": "vobruba-martin/closure-compiler", "path": "src/com/google/javascript/jscomp/FunctionTypeBuilder.java", "license": "apache-2.0", "size": 45869 }
[ "com.google.javascript.rhino.Node", "com.google.javascript.rhino.jstype.FunctionParamBuilder", "com.google.javascript.rhino.jstype.FunctionType", "java.util.Iterator", "javax.annotation.Nullable" ]
import com.google.javascript.rhino.Node; import com.google.javascript.rhino.jstype.FunctionParamBuilder; import com.google.javascript.rhino.jstype.FunctionType; import java.util.Iterator; import javax.annotation.Nullable;
import com.google.javascript.rhino.*; import com.google.javascript.rhino.jstype.*; import java.util.*; import javax.annotation.*;
[ "com.google.javascript", "java.util", "javax.annotation" ]
com.google.javascript; java.util; javax.annotation;
2,040,725
@Test public void testExplainShortcutNoAlias() throws Throwable { String cmd = "a = load 'input' USING mock.Storage() as (x:chararray,y:chararray,z:long);" + "b = foreach a generate $0 as foo;" + "\\e;"; ByteArrayInputStream cmdstream = new ByteArrayInputStream(cmd.getBytes()); InputStreamReader reader = new InputStreamReader(cmdstream); Grunt grunt = new Grunt(new BufferedReader(reader), context); grunt.exec(); }
void function() throws Throwable { String cmd = STR + STR + "\\e;"; ByteArrayInputStream cmdstream = new ByteArrayInputStream(cmd.getBytes()); InputStreamReader reader = new InputStreamReader(cmdstream); Grunt grunt = new Grunt(new BufferedReader(reader), context); grunt.exec(); }
/** * When no alias is passed, entire script should be explained * * @throws Throwable */
When no alias is passed, entire script should be explained
testExplainShortcutNoAlias
{ "repo_name": "ljl1988com/pig", "path": "test/org/apache/pig/test/TestShortcuts.java", "license": "apache-2.0", "size": 12055 }
[ "java.io.BufferedReader", "java.io.ByteArrayInputStream", "java.io.InputStreamReader", "org.apache.pig.tools.grunt.Grunt" ]
import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.InputStreamReader; import org.apache.pig.tools.grunt.Grunt;
import java.io.*; import org.apache.pig.tools.grunt.*;
[ "java.io", "org.apache.pig" ]
java.io; org.apache.pig;
2,789,869
public void handleMethodPOST(URI uri, HTTPRequest httpRequest, ToadletContext toadletContext) throws IOException, ToadletContextClosedException { handleRequest(new FreenetRequest(uri, Method.POST, httpRequest, toadletContext)); } /** * {@inheritDoc}
void function(URI uri, HTTPRequest httpRequest, ToadletContext toadletContext) throws IOException, ToadletContextClosedException { handleRequest(new FreenetRequest(uri, Method.POST, httpRequest, toadletContext)); } /** * {@inheritDoc}
/** * Handles a HTTP POST request. * * @param uri * The URI of the request * @param httpRequest * The HTTP request * @param toadletContext * The toadlet context * @throws IOException * if an I/O error occurs * @throws ToadletContextClosedException * if the toadlet context is closed */
Handles a HTTP POST request
handleMethodPOST
{ "repo_name": "ArneBab/Sone", "path": "src/main/java/net/pterodactylus/sone/web/page/PageToadlet.java", "license": "gpl-3.0", "size": 5979 }
[ "java.io.IOException", "net.pterodactylus.util.web.Method" ]
import java.io.IOException; import net.pterodactylus.util.web.Method;
import java.io.*; import net.pterodactylus.util.web.*;
[ "java.io", "net.pterodactylus.util" ]
java.io; net.pterodactylus.util;
2,449,459
public Collection<T> asList(String jsonArrayString) throws Exception;
Collection<T> function(String jsonArrayString) throws Exception;
/** * JSON String representing an array of T is being transformed into * a collection<T> * * @param jsonArrayString * @return * @throws Exception */
JSON String representing an array of T is being transformed into a collection
asList
{ "repo_name": "vals-productions/sqlighter", "path": "distr/2.0.1/android/com/vals/a2ios/amfibian/intf/AnObject.java", "license": "apache-2.0", "size": 2916 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
68,376
@Override protected void handleMass(){ if(this.updateTicks%10!=0)return; double preciseAmount=0; this.mass=this.getDefaultMass(); if(theTank != null && theTank.getFluid() != null && theTank.getFluid().amount>0){ preciseAmount = theTank.getFluid().amount; } this.itemInsideCount=0; for (int i = 0; i < getSizeInventory(); i++) { ItemStack itemstack = getStackInSlot(i); if (itemstack == null) { continue; } if (itemstack.stackSize <= 0) { continue; }else{ this.itemInsideCount+=itemstack.stackSize; } } mass+=(this.itemInsideCount*0.0001);//1 item = 1 kilo mass+=(preciseAmount/10000);//1 bucket = 1 kilo }
void function(){ if(this.updateTicks%10!=0)return; double preciseAmount=0; this.mass=this.getDefaultMass(); if(theTank != null && theTank.getFluid() != null && theTank.getFluid().amount>0){ preciseAmount = theTank.getFluid().amount; } this.itemInsideCount=0; for (int i = 0; i < getSizeInventory(); i++) { ItemStack itemstack = getStackInSlot(i); if (itemstack == null) { continue; } if (itemstack.stackSize <= 0) { continue; }else{ this.itemInsideCount+=itemstack.stackSize; } } mass+=(this.itemInsideCount*0.0001); mass+=(preciseAmount/10000); }
/** * handle mass depending on items and liquid */
handle mass depending on items and liquid
handleMass
{ "repo_name": "BlesseNtumble/Traincraft-5", "path": "src/main/java/train/common/api/Tender.java", "license": "lgpl-2.1", "size": 7522 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
1,254,909
private void maybeUpdatePicker(ConnectivityState state, RoundRobinPicker picker) { // Discard the new picker if we are sure it won't make any difference, in order to save // re-processing pending streams, and avoid unnecessary resetting of the pointer in // RoundRobinPicker. if (picker.dropList.equals(currentPicker.dropList) && picker.pickList.equals(currentPicker.pickList)) { return; } currentPicker = picker; logger.log( ChannelLogLevel.INFO, "{0}: picks={1}, drops={2}", state, picker.pickList, picker.dropList); helper.updateBalancingState(state, picker); }
void function(ConnectivityState state, RoundRobinPicker picker) { if (picker.dropList.equals(currentPicker.dropList) && picker.pickList.equals(currentPicker.pickList)) { return; } currentPicker = picker; logger.log( ChannelLogLevel.INFO, STR, state, picker.pickList, picker.dropList); helper.updateBalancingState(state, picker); }
/** * Update the given picker to the helper if it's different from the current one. */
Update the given picker to the helper if it's different from the current one
maybeUpdatePicker
{ "repo_name": "carl-mastrangelo/grpc-java", "path": "grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java", "license": "apache-2.0", "size": 37274 }
[ "io.grpc.ChannelLogger", "io.grpc.ConnectivityState" ]
import io.grpc.ChannelLogger; import io.grpc.ConnectivityState;
import io.grpc.*;
[ "io.grpc" ]
io.grpc;
1,457,166
static Set<String> convertToUpperCaseSet( String[] array ) { if ( array == null ) { return Collections.emptySet(); } Set<String> strings = new HashSet<String>(); for ( String currentString : array ) { strings.add( currentString.toUpperCase() ); } return strings; }
static Set<String> convertToUpperCaseSet( String[] array ) { if ( array == null ) { return Collections.emptySet(); } Set<String> strings = new HashSet<String>(); for ( String currentString : array ) { strings.add( currentString.toUpperCase() ); } return strings; }
/** * package-local visibility for testing purposes */
package-local visibility for testing purposes
convertToUpperCaseSet
{ "repo_name": "TatsianaKasiankova/pentaho-kettle", "path": "plugins/meta-inject/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInject.java", "license": "apache-2.0", "size": 30119 }
[ "java.util.Collections", "java.util.HashSet", "java.util.Set" ]
import java.util.Collections; import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,651,417
if(hour == null) { hour = Spinner3D.create(startHour, endHour, currentHour, 1); hour.setRowFormatter(new RowFormatter() {
if(hour == null) { hour = Spinner3D.create(startHour, endHour, currentHour, 1); hour.setRowFormatter(new RowFormatter() {
/** * Default constructor */
Default constructor
initSpinner
{ "repo_name": "Firethunder/CodenameOne", "path": "CodenameOne/src/com/codename1/ui/spinner/TimeSpinner3D.java", "license": "gpl-2.0", "size": 14422 }
[ "com.codename1.ui.spinner.SpinnerNode" ]
import com.codename1.ui.spinner.SpinnerNode;
import com.codename1.ui.spinner.*;
[ "com.codename1.ui" ]
com.codename1.ui;
1,668,218
@Override public String selectLabels(ClusterNode<ProcessInstances> cluster, Entry<String, Object> feature){ //calculate tfIdf for each word HashMap<String, Double> labelCandidates = calculateScores(cluster, feature); if (enhancer != null){ labelCandidates = selectTopWords(labelCandidates); //3. enhance label candidates enhancer.enhanceLabelCandidates(labelCandidates); } //take top 2 label candidates //markers for the top two words return selectTopWordsAsLabel(feature); }
String function(ClusterNode<ProcessInstances> cluster, Entry<String, Object> feature){ HashMap<String, Double> labelCandidates = calculateScores(cluster, feature); if (enhancer != null){ labelCandidates = selectTopWords(labelCandidates); enhancer.enhanceLabelCandidates(labelCandidates); } return selectTopWordsAsLabel(feature); }
/** * Selects a label for a cluster by calculating the candidate scores for each word, taking * the top 7 label candidates and enhancing this set by external resources, to finally * take the top 2 label candidates for the cluster's label. */
Selects a label for a cluster by calculating the candidate scores for each word, taking the top 7 label candidates and enhancing this set by external resources, to finally take the top 2 label candidates for the cluster's label
selectLabels
{ "repo_name": "tobiashoppe/promnicat", "path": "src/de/uni_potsdam/hpi/bpt/promnicat/analysisModules/clustering/labeling/HierarchicalClusterLabeler.java", "license": "gpl-3.0", "size": 7836 }
[ "de.uni_potsdam.hpi.bpt.promnicat.analysisModules.clustering.ClusterNode", "de.uni_potsdam.hpi.bpt.promnicat.analysisModules.clustering.ProcessInstances", "java.util.HashMap", "java.util.Map" ]
import de.uni_potsdam.hpi.bpt.promnicat.analysisModules.clustering.ClusterNode; import de.uni_potsdam.hpi.bpt.promnicat.analysisModules.clustering.ProcessInstances; import java.util.HashMap; import java.util.Map;
import de.uni_potsdam.hpi.bpt.promnicat.*; import java.util.*;
[ "de.uni_potsdam.hpi", "java.util" ]
de.uni_potsdam.hpi; java.util;
2,332,906
public boolean forOneArbitraryMatch(final Transition pTr, final IMatchProcessor<? super TransitionNotPublicMatch> processor) { return rawForOneArbitraryMatch(new Object[]{pTr}, processor); }
boolean function(final Transition pTr, final IMatchProcessor<? super TransitionNotPublicMatch> processor) { return rawForOneArbitraryMatch(new Object[]{pTr}, processor); }
/** * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. * Neither determinism nor randomness of selection is guaranteed. * @param pTr the fixed value of pattern parameter tr, or null if not bound. * @param processor the action that will process the selected match. * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked * */
Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. Neither determinism nor randomness of selection is guaranteed
forOneArbitraryMatch
{ "repo_name": "ELTE-Soft/xUML-RT-Executor", "path": "plugins/hu.eltesoft.modelexecution.validation/src-gen/hu/eltesoft/modelexecution/validation/TransitionNotPublicMatcher.java", "license": "epl-1.0", "size": 10311 }
[ "hu.eltesoft.modelexecution.validation.TransitionNotPublicMatch", "org.eclipse.incquery.runtime.api.IMatchProcessor", "org.eclipse.uml2.uml.Transition" ]
import hu.eltesoft.modelexecution.validation.TransitionNotPublicMatch; import org.eclipse.incquery.runtime.api.IMatchProcessor; import org.eclipse.uml2.uml.Transition;
import hu.eltesoft.modelexecution.validation.*; import org.eclipse.incquery.runtime.api.*; import org.eclipse.uml2.uml.*;
[ "hu.eltesoft.modelexecution", "org.eclipse.incquery", "org.eclipse.uml2" ]
hu.eltesoft.modelexecution; org.eclipse.incquery; org.eclipse.uml2;
2,705,683
public final void testIsActive2() { final ProcessorDef arg = create(); final Project project = new Project(); project.setProperty("cond", ""); arg.setProject(project); arg.setIf("cond"); assertTrue(arg.isActive()); }
final void function() { final ProcessorDef arg = create(); final Project project = new Project(); project.setProperty("cond", STRcond"); assertTrue(arg.isActive()); }
/** * Tests that isActive returns true when "if" references a set property. */
Tests that isActive returns true when "if" references a set property
testIsActive2
{ "repo_name": "manu4linux/nar-maven-plugin", "path": "src/test/java/com/github/maven_nar/cpptasks/TestProcessorDef.java", "license": "apache-2.0", "size": 8748 }
[ "org.apache.tools.ant.Project" ]
import org.apache.tools.ant.Project;
import org.apache.tools.ant.*;
[ "org.apache.tools" ]
org.apache.tools;
1,750,303
public static long createBookmarksFolderOnce(Context context, String title, long parentId) { Long id = chromeBrowserProviderCall(Long.class, ChromeBrowserProvider.CLIENT_API_CREATE_BOOKMARKS_FOLDER_ONCE, context, argsToBundle(title, parentId)); return id != null ? id.longValue() : INVALID_BOOKMARK_ID; }
static long function(Context context, String title, long parentId) { Long id = chromeBrowserProviderCall(Long.class, ChromeBrowserProvider.CLIENT_API_CREATE_BOOKMARKS_FOLDER_ONCE, context, argsToBundle(title, parentId)); return id != null ? id.longValue() : INVALID_BOOKMARK_ID; }
/** * Creates a bookmark folder or returns its ID if it already exists. * This method does not update the last modified folder in the UI. * * @param title Title of the new or existing bookmark folder. * @param parentId ID of the parent folder. Must be in the Mobile Bookmarks branch. * @return The ID of the new created folder (or INVALID_BOOKMARK_ID on error). * Will return the ID of any existing folder in the same parent with the same name. */
Creates a bookmark folder or returns its ID if it already exists. This method does not update the last modified folder in the UI
createBookmarksFolderOnce
{ "repo_name": "zcbenz/cefode-chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/ChromeBrowserProviderClient.java", "license": "bsd-3-clause", "size": 7755 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
839,962
public void removeAtIndex(int index) { if ((index >= 0) && (index < cleanupActions.size())) { FieldFormatterCleanup action = cleanupActions.remove(index); for (ListDataListener listener : listeners) { listener.intervalRemoved(new ListDataEvent(action, ListDataEvent.INTERVAL_REMOVED, index, index)); } } }
void function(int index) { if ((index >= 0) && (index < cleanupActions.size())) { FieldFormatterCleanup action = cleanupActions.remove(index); for (ListDataListener listener : listeners) { listener.intervalRemoved(new ListDataEvent(action, ListDataEvent.INTERVAL_REMOVED, index, index)); } } }
/** * Removes the action at the specified index from the list. * Removal is only done when index {@code >=0} and index {@code<=} list size * @param index The index to remove */
Removes the action at the specified index from the list. Removal is only done when index >=0 and index list size
removeAtIndex
{ "repo_name": "Braunch/jabref", "path": "src/main/java/net/sf/jabref/gui/cleanup/CleanupActionsListModel.java", "license": "mit", "size": 2596 }
[ "javax.swing.event.ListDataEvent", "javax.swing.event.ListDataListener", "net.sf.jabref.model.cleanup.FieldFormatterCleanup" ]
import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; import net.sf.jabref.model.cleanup.FieldFormatterCleanup;
import javax.swing.event.*; import net.sf.jabref.model.cleanup.*;
[ "javax.swing", "net.sf.jabref" ]
javax.swing; net.sf.jabref;
2,857,947
public XObject execute(XPathContext xctxt, int currentNode) throws javax.xml.transform.TransformerException { DTM dtm = xctxt.getDTM(currentNode); if (dtm != null) { int expType = dtm.getExpandedTypeID(currentNode); return execute(xctxt, currentNode, dtm, expType); } return NodeTest.SCORE_NONE; }
XObject function(XPathContext xctxt, int currentNode) throws javax.xml.transform.TransformerException { DTM dtm = xctxt.getDTM(currentNode); if (dtm != null) { int expType = dtm.getExpandedTypeID(currentNode); return execute(xctxt, currentNode, dtm, expType); } return NodeTest.SCORE_NONE; }
/** * Execute this pattern step, including predicates. * * * @param xctxt XPath runtime context. * @param currentNode The current node context. * * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST}, * {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE}, * {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD}, * {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or * {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */
Execute this pattern step, including predicates
execute
{ "repo_name": "shun634501730/java_source_cn", "path": "src_en/com/sun/org/apache/xpath/internal/patterns/StepPattern.java", "license": "apache-2.0", "size": 27433 }
[ "com.sun.org.apache.xpath.internal.XPathContext", "com.sun.org.apache.xpath.internal.objects.XObject" ]
import com.sun.org.apache.xpath.internal.XPathContext; import com.sun.org.apache.xpath.internal.objects.XObject;
import com.sun.org.apache.xpath.internal.*; import com.sun.org.apache.xpath.internal.objects.*;
[ "com.sun.org" ]
com.sun.org;
911,563
wf(wr, "%s\n", StringUtils.join(l_nm_var, " ")); wf(wr, "%s\n", StringUtils.join(l_ar_var, " ")); }
wf(wr, "%s\n", StringUtils.join(l_nm_var, " ")); wf(wr, "%s\n", StringUtils.join(l_ar_var, " ")); }
/** * Write metadata in the file. * * @throws IOException if there is a problem in writing. */
Write metadata in the file
writeMetaData
{ "repo_name": "mauro-idsia/blip", "path": "core/src/main/java/ch/idsia/blip/core/io/dat/DatFileLineWriter.java", "license": "lgpl-3.0", "size": 1665 }
[ "ch.idsia.blip.core.utils.RandomStuff", "ch.idsia.blip.core.utils.other.StringUtils" ]
import ch.idsia.blip.core.utils.RandomStuff; import ch.idsia.blip.core.utils.other.StringUtils;
import ch.idsia.blip.core.utils.*; import ch.idsia.blip.core.utils.other.*;
[ "ch.idsia.blip" ]
ch.idsia.blip;
915,306
public Index indexes();
Index function();
/** * Returns an {@link net.varkhan.base.containers.Index} over the indexes in the collection. * * @return an {@code Index} enumerating all indexes in the collection */
Returns an <code>net.varkhan.base.containers.Index</code> over the indexes in the collection
indexes
{ "repo_name": "varkhan/VCom4j", "path": "Base/Containers/src/net/varkhan/base/containers/type/IndexedFloatContainer.java", "license": "lgpl-2.1", "size": 6483 }
[ "net.varkhan.base.containers.Index" ]
import net.varkhan.base.containers.Index;
import net.varkhan.base.containers.*;
[ "net.varkhan.base" ]
net.varkhan.base;
2,332,125
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { return this.isItemValidForSlot(index, itemStackIn); }
boolean function(int index, ItemStack itemStackIn, EnumFacing direction) { return this.isItemValidForSlot(index, itemStackIn); }
/** * Returns true if automation can insert the given item in the given slot from the given side. Args: slot, item, * side */
Returns true if automation can insert the given item in the given slot from the given side. Args: slot, item, side
canInsertItem
{ "repo_name": "cj3636/TheNewJourney", "path": "src/main/java/com/thenewjourney/blocks/furnace/tileentity/DioriteFurnaceTileEntity.java", "license": "lgpl-2.1", "size": 18192 }
[ "net.minecraft.item.ItemStack", "net.minecraft.util.EnumFacing" ]
import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing;
import net.minecraft.item.*; import net.minecraft.util.*;
[ "net.minecraft.item", "net.minecraft.util" ]
net.minecraft.item; net.minecraft.util;
2,523,512
protected Export export; @ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY ) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE}) @Basic( optional = true ) @JoinColumn(name = "export_id", nullable = true ) public Export getExport() { return this.export; }
Export export; @ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY ) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE}) @Basic( optional = true ) @JoinColumn(name = STR, nullable = true ) public Export function() { return this.export; }
/** * Return the value associated with the column: export. * @return A Export object (this.export) */
Return the value associated with the column: export
getExport
{ "repo_name": "servinglynk/servinglynk-hmis", "path": "hmis-model-v2016/src/main/java/com/servinglynk/hmis/warehouse/model/v2016/Enrollment.java", "license": "mpl-2.0", "size": 46569 }
[ "javax.persistence.Basic", "javax.persistence.CascadeType", "javax.persistence.FetchType", "javax.persistence.JoinColumn", "javax.persistence.ManyToOne" ]
import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
962,594
public static final short bytesToShort(byte[] p_bytes) { ByteBuffer shortBuffer = ByteBuffer.allocate(Short.BYTES); assert(p_bytes.length == 2); shortBuffer.put(p_bytes, 0, p_bytes.length); shortBuffer.flip(); return shortBuffer.getShort(); }
static final short function(byte[] p_bytes) { ByteBuffer shortBuffer = ByteBuffer.allocate(Short.BYTES); assert(p_bytes.length == 2); shortBuffer.put(p_bytes, 0, p_bytes.length); shortBuffer.flip(); return shortBuffer.getShort(); }
/** * Converts a 2 byte array to a short * @param p_bytes The byte array * @return The short value */
Converts a 2 byte array to a short
bytesToShort
{ "repo_name": "telgin/Imagine", "path": "src/util/ByteConversion.java", "license": "mit", "size": 7628 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
971,529
public void setAlarmActuatorState(String deviceId, boolean on) throws RWESmarthomeSessionExpiredException { final String CHANGE_ALARM_ACTUATOR_CHANGE_REQUEST = String.format( "<BaseRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"SetActuatorStatesRequest\" Version=\"%s\" RequestId=\"%s\" SessionId=\"%s\" BasedOnConfigVersion=\"%s\">" + "<ActuatorStates>" + "<LogicalDeviceState xsi:type=\"AlarmActuatorState\" LID=\"%s\">" + "<IsOn>%s</IsOn>" + "</LogicalDeviceState>" + "</ActuatorStates>" + "</BaseRequest>", RWESmarthomeSession.getFirmwareVersion(), rweSmarthomeSession.getRequestId(), rweSmarthomeSession.getSessionId(), rweSmarthomeSession.getCurrentConfigurationVersion(), deviceId, on); String response = rweSmarthomeSession.executeRequest(CHANGE_ALARM_ACTUATOR_CHANGE_REQUEST, "/cmd"); if (!response.contains("Result=\"Ok\"")) { logger.warn("Response not ok: " + response); } }
void function(String deviceId, boolean on) throws RWESmarthomeSessionExpiredException { final String CHANGE_ALARM_ACTUATOR_CHANGE_REQUEST = String.format( STRhttp: + STR + STRAlarmActuatorState\STR%s\">" + STR + STR + STR + STR, RWESmarthomeSession.getFirmwareVersion(), rweSmarthomeSession.getRequestId(), rweSmarthomeSession.getSessionId(), rweSmarthomeSession.getCurrentConfigurationVersion(), deviceId, on); String response = rweSmarthomeSession.executeRequest(CHANGE_ALARM_ACTUATOR_CHANGE_REQUEST, "/cmd"); if (!response.contains(STROk\STRResponse not ok: " + response); } }
/** * Changes the alarm state * * @param deviceId * @param on * @throws RWESmarthomeSessionExpiredException */
Changes the alarm state
setAlarmActuatorState
{ "repo_name": "cdjackson/openhab", "path": "bundles/binding/org.openhab.binding.rwesmarthome/src/main/java/org/openhab/binding/rwesmarthome/internal/communicator/RWESmarthomeCommunicator.java", "license": "epl-1.0", "size": 41331 }
[ "org.openhab.binding.rwesmarthome.internal.communicator.exceptions.RWESmarthomeSessionExpiredException" ]
import org.openhab.binding.rwesmarthome.internal.communicator.exceptions.RWESmarthomeSessionExpiredException;
import org.openhab.binding.rwesmarthome.internal.communicator.exceptions.*;
[ "org.openhab.binding" ]
org.openhab.binding;
2,293,821
public List<String> getList(String key) { return getList(key, null); }
List<String> function(String key) { return getList(key, null); }
/** * Returns the List of Strings associated with the given parameter, * or an empty List in case there is no List of Strings for this parameter.<p> * * The list returned is a copy of the internal data of this object, and as * such you may alter it freely.<p> * * @param key the parameter to look up the value for * * @return the List of Strings associated with the given parameter, * or an empty List in case there is no List of Strings for this parameter */
Returns the List of Strings associated with the given parameter, or an empty List in case there is no List of Strings for this parameter. The list returned is a copy of the internal data of this object, and as such you may alter it freely
getList
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/configuration/CmsParameterConfiguration.java", "license": "lgpl-2.1", "size": 29371 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
514,258
public void draw(VariableNumber x, int num) throws IllegalArgumentException { current = num; this.clear(true); int[] values = x.getInterval1000(); double range = x.getUniStats().getRangeValue(); double min = x.getUniStats().getMinValue(); setGrid(true); setXRange(x.getValue(0), x.getValue(x.Size() - 1)); if (x.getType() == JWATConstants.DATE) { SimpleDateFormat f = new SimpleDateFormat("dd.MM.yy HH:mm:ss"); addXTick(f.format(new Date((long) (min + range / 10))), min + range / 10); addXTick(f.format(new Date((long) (min + range / 2))), min + range / 2); addXTick(f.format(new Date((long) x.getValue(x.Size() - 1))), x.getValue(x.Size() - 1)); //setXLabel("Time fom [" + f.format(new Date((long)x.getValue(0))) +"] to [" + f.format(new Date((long)x.getValue(x.Size()-1)))+"]"); } setPlotRectangle(new Rectangle(20, 20, WIDTH - 30, HEIGHT - 40)); for (int i = 1; i < values.length; i++) { addPoint(1, min + (range * i / 1000), values[i] - values[i - 1], true); } repaint(); }
void function(VariableNumber x, int num) throws IllegalArgumentException { current = num; this.clear(true); int[] values = x.getInterval1000(); double range = x.getUniStats().getRangeValue(); double min = x.getUniStats().getMinValue(); setGrid(true); setXRange(x.getValue(0), x.getValue(x.Size() - 1)); if (x.getType() == JWATConstants.DATE) { SimpleDateFormat f = new SimpleDateFormat(STR); addXTick(f.format(new Date((long) (min + range / 10))), min + range / 10); addXTick(f.format(new Date((long) (min + range / 2))), min + range / 2); addXTick(f.format(new Date((long) x.getValue(x.Size() - 1))), x.getValue(x.Size() - 1)); } setPlotRectangle(new Rectangle(20, 20, WIDTH - 30, HEIGHT - 40)); for (int i = 1; i < values.length; i++) { addPoint(1, min + (range * i / 1000), values[i] - values[i - 1], true); } repaint(); }
/** * Sets up new variable information to draw * @param x variable to draw * @throws IllegalArgumentException */
Sets up new variable information to draw
draw
{ "repo_name": "HOMlab/QN-ACTR-Release", "path": "QN-ACTR Java/src/jmt/gui/jwat/workloadAnalysis/chart/SmallPlotDistGraph.java", "license": "lgpl-3.0", "size": 3777 }
[ "java.awt.Rectangle", "java.text.SimpleDateFormat", "java.util.Date" ]
import java.awt.Rectangle; import java.text.SimpleDateFormat; import java.util.Date;
import java.awt.*; import java.text.*; import java.util.*;
[ "java.awt", "java.text", "java.util" ]
java.awt; java.text; java.util;
2,829,374
public interface Long2IntMapEntryIterable extends ObjectIterable<Long2IntMap.Entry> { ObjectIterator<Long2IntMap.Entry> iterator();
interface Long2IntMapEntryIterable extends ObjectIterable<Long2IntMap.Entry> { ObjectIterator<Long2IntMap.Entry> function();
/** * Get the iterator. Not thread-safe and reuses iterator object, so you * can't have several iterators at the same time. * * @return Iterator */
Get the iterator. Not thread-safe and reuses iterator object, so you can't have several iterators at the same time
iterator
{ "repo_name": "dukechain/giraph-1.2", "path": "giraph-core/src/main/java/org/apache/giraph/types/heaps/Long2IntMapEntryIterable.java", "license": "apache-2.0", "size": 1456 }
[ "it.unimi.dsi.fastutil.longs.Long2IntMap", "it.unimi.dsi.fastutil.objects.ObjectIterable", "it.unimi.dsi.fastutil.objects.ObjectIterator" ]
import it.unimi.dsi.fastutil.longs.Long2IntMap; import it.unimi.dsi.fastutil.objects.ObjectIterable; import it.unimi.dsi.fastutil.objects.ObjectIterator;
import it.unimi.dsi.fastutil.longs.*; import it.unimi.dsi.fastutil.objects.*;
[ "it.unimi.dsi" ]
it.unimi.dsi;
2,793,394
int dividerLeftMargin(int position, RecyclerView parent);
int dividerLeftMargin(int position, RecyclerView parent);
/** * Returns left margin of divider. * * @param position Divider position * @param parent RecyclerView * @return left margin */
Returns left margin of divider
dividerLeftMargin
{ "repo_name": "canyinghao/CanRecyclerView", "path": "canrecyclerview/src/main/java/com/canyinghao/canrecyclerview/HorizontalDividerItemDecoration.java", "license": "apache-2.0", "size": 7138 }
[ "androidx.recyclerview.widget.RecyclerView" ]
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.*;
[ "androidx.recyclerview" ]
androidx.recyclerview;
1,257,811
public PluginId getPluginId() { return id; }
PluginId function() { return id; }
/** * Methods below implement PluginDescriptor and IdeaPluginDescriptor interface */
Methods below implement PluginDescriptor and IdeaPluginDescriptor interface
getPluginId
{ "repo_name": "hurricup/intellij-community", "path": "platform/platform-impl/src/com/intellij/ide/plugins/PluginNode.java", "license": "apache-2.0", "size": 8152 }
[ "com.intellij.openapi.extensions.PluginId" ]
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.extensions.*;
[ "com.intellij.openapi" ]
com.intellij.openapi;
1,854,803
public static Bound<GenericRecord> withSchema(String schema) { return withSchema((new Schema.Parser()).parse(schema)); }
static Bound<GenericRecord> function(String schema) { return withSchema((new Schema.Parser()).parse(schema)); }
/** * Returns a {@link PTransform} that reads Avro file(s) * containing records of the specified schema in a JSON-encoded * string form. */
Returns a <code>PTransform</code> that reads Avro file(s) containing records of the specified schema in a JSON-encoded string form
withSchema
{ "repo_name": "amitsela/incubator-beam", "path": "sdks/java/core/src/main/java/org/apache/beam/sdk/io/AvroIO.java", "license": "apache-2.0", "size": 39700 }
[ "org.apache.avro.Schema", "org.apache.avro.generic.GenericRecord" ]
import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord;
import org.apache.avro.*; import org.apache.avro.generic.*;
[ "org.apache.avro" ]
org.apache.avro;
1,993,714
public static IRectangle box(IRectangle relativeBox, IDimension boundingBox, int padding, BoxingStrategy boxingStrategy) { int x = relativeBox.getX(); int y = relativeBox.getY(); int width = relativeBox.getWidth(); int height = relativeBox.getHeight(); int maxWidth = boundingBox.getWidth() - (2 * padding); int maxHeight = boundingBox.getHeight() - (2 * padding); switch (boxingStrategy) { case NONE: break; case POSITION_AND_SIZE: if (width > maxWidth) { width = maxWidth; } if (height > maxHeight) { height = maxHeight; } // intentionally skipped break (POSITION part applies to POSITION_AND_SIZE, too) case POSITION: if (x + width > maxWidth + padding) { x = maxWidth + padding - width; } if (y + height > maxHeight + padding) { y = maxHeight + padding - height; } if (x < padding) { x = padding; } if (y < padding) { y = padding; } } return rectangle(x, y, width, height); }
static IRectangle function(IRectangle relativeBox, IDimension boundingBox, int padding, BoxingStrategy boxingStrategy) { int x = relativeBox.getX(); int y = relativeBox.getY(); int width = relativeBox.getWidth(); int height = relativeBox.getHeight(); int maxWidth = boundingBox.getWidth() - (2 * padding); int maxHeight = boundingBox.getHeight() - (2 * padding); switch (boxingStrategy) { case NONE: break; case POSITION_AND_SIZE: if (width > maxWidth) { width = maxWidth; } if (height > maxHeight) { height = maxHeight; } case POSITION: if (x + width > maxWidth + padding) { x = maxWidth + padding - width; } if (y + height > maxHeight + padding) { y = maxHeight + padding - height; } if (x < padding) { x = padding; } if (y < padding) { y = padding; } } return rectangle(x, y, width, height); }
/** * Constraints a box with parent relative coordinates in a given parent box * * @param relativeBox * @param boundingBox * @param padding * @return */
Constraints a box with parent relative coordinates in a given parent box
box
{ "repo_name": "camunda/camunda-eclipse-plugin", "path": "org.camunda.bpm.modeler/src/org/camunda/bpm/modeler/core/layout/util/LayoutUtil.java", "license": "epl-1.0", "size": 45536 }
[ "org.camunda.bpm.modeler.core.layout.util.ConversionUtil", "org.eclipse.graphiti.datatypes.IDimension", "org.eclipse.graphiti.datatypes.IRectangle" ]
import org.camunda.bpm.modeler.core.layout.util.ConversionUtil; import org.eclipse.graphiti.datatypes.IDimension; import org.eclipse.graphiti.datatypes.IRectangle;
import org.camunda.bpm.modeler.core.layout.util.*; import org.eclipse.graphiti.datatypes.*;
[ "org.camunda.bpm", "org.eclipse.graphiti" ]
org.camunda.bpm; org.eclipse.graphiti;
949,817
@Override @Deprecated public Servlet getServlet(String name) throws ServletException { return (null); }
Servlet function(String name) throws ServletException { return (null); }
/** * Return a null reference for the specified servlet name. * * @param name Name of the requested servlet * * @deprecated This method has been deprecated with no replacement */
Return a null reference for the specified servlet name
getServlet
{ "repo_name": "pistolove/sourcecode4junit", "path": "Source4Tomcat/src/org/apache/jasper/servlet/JspCServletContext.java", "license": "apache-2.0", "size": 14903 }
[ "javax.servlet.Servlet", "javax.servlet.ServletException" ]
import javax.servlet.Servlet; import javax.servlet.ServletException;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,514,999
public String getJsonRequest(String path, boolean timeout) { HttpHeaders headers = new HttpHeaders(); HttpEntity<String> response = null; RestTemplate templateToUse; if (timeout) { templateToUse = templateWTimeout; } else { templateToUse = template; } try { response = exchange(templateToUse, path, HttpMethod.GET, new HttpEntity(headers), String.class); } catch (HttpClientErrorException e) { logger.debug("Catch HttpClientException: {}", e.getStatusCode()); } if (response == null) { return null; } JsonParser parser = new JsonParser(); String jsonText = parser.parse(response.getBody()).getAsString(); return jsonText; }
String function(String path, boolean timeout) { HttpHeaders headers = new HttpHeaders(); HttpEntity<String> response = null; RestTemplate templateToUse; if (timeout) { templateToUse = templateWTimeout; } else { templateToUse = template; } try { response = exchange(templateToUse, path, HttpMethod.GET, new HttpEntity(headers), String.class); } catch (HttpClientErrorException e) { logger.debug(STR, e.getStatusCode()); } if (response == null) { return null; } JsonParser parser = new JsonParser(); String jsonText = parser.parse(response.getBody()).getAsString(); return jsonText; }
/** * Makes a JSONRequest with the path. Times out, if boolean timeout property is set to true. * Timeout value is set in application-context.xml (dashboard.WSCall.timeout) * @param path * @param timeout * @return */
Makes a JSONRequest with the path. Times out, if boolean timeout property is set to true. Timeout value is set in application-context.xml (dashboard.WSCall.timeout)
getJsonRequest
{ "repo_name": "inbloom/APP-dashboard", "path": "src/main/java/org/slc/sli/dashboard/client/RESTClient.java", "license": "apache-2.0", "size": 7072 }
[ "com.google.gson.JsonParser", "org.springframework.http.HttpEntity", "org.springframework.http.HttpHeaders", "org.springframework.http.HttpMethod", "org.springframework.web.client.HttpClientErrorException", "org.springframework.web.client.RestTemplate" ]
import com.google.gson.JsonParser; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate;
import com.google.gson.*; import org.springframework.http.*; import org.springframework.web.client.*;
[ "com.google.gson", "org.springframework.http", "org.springframework.web" ]
com.google.gson; org.springframework.http; org.springframework.web;
769,214
public Name toName(String name) { return ast.toName(name); }
Name function(String name) { return ast.toName(name); }
/** * Convenient shortcut to the owning JavacAST object's toName method. * * @see JavacAST#toName(String) */
Convenient shortcut to the owning JavacAST object's toName method
toName
{ "repo_name": "Beabel2/lombok", "path": "src/core/lombok/javac/JavacNode.java", "license": "mit", "size": 8317 }
[ "com.sun.tools.javac.util.Name" ]
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.*;
[ "com.sun.tools" ]
com.sun.tools;
614,819
private static FlexBean instance(FlexClass flexClass, Object object) throws ApplicationExceptions, FrameworkException { FlexBean flexBean = null; if (flexClass.getDynaProperties() != null && flexClass.getDynaProperties().length > 0) { if (object != null && object instanceof IPersistent) { flexBean = new FlexBean(flexClass, (IPersistent) object); } else { flexBean = new FlexBean(flexClass); // Clear all the changes. This can happen if initialze rules are delcared for any of the flex fields. // What this means is that initialize rules for a non-persistent object will be ignored. // This is necessary, else the initial values will be reapplied even after a flex field was modified to a different value. flexBean.flexParams.clear(); flexBean.clearChanges(); } } else { if (log.isDebugEnabled()) log.debug("FlexBean will not be instantiated for the FlexClass '" + flexClass.getName() + "', since it has no dyna-properties"); } return flexBean; }
static FlexBean function(FlexClass flexClass, Object object) throws ApplicationExceptions, FrameworkException { FlexBean flexBean = null; if (flexClass.getDynaProperties() != null && flexClass.getDynaProperties().length > 0) { if (object != null && object instanceof IPersistent) { flexBean = new FlexBean(flexClass, (IPersistent) object); } else { flexBean = new FlexBean(flexClass); flexBean.flexParams.clear(); flexBean.clearChanges(); } } else { if (log.isDebugEnabled()) log.debug(STR + flexClass.getName() + STR); } return flexBean; }
/** * This is the recommended way to instantiate a FlexBean. * It obtains the appropriate FlexClass. * * @param flexClass the associated FlexClass. * @param object the associated object. * @return a FlexBean instance. A null will be returned if the FlexClass has no dyna-properties. * @throws ApplicationExceptions if any application error occurs. * @throws FrameworkException if any framework error occurs. */
This is the recommended way to instantiate a FlexBean. It obtains the appropriate FlexClass
instance
{ "repo_name": "jaffa-projects/jaffa-framework", "path": "jaffa-core/source/java/org/jaffa/flexfields/FlexBean.java", "license": "gpl-3.0", "size": 32907 }
[ "org.jaffa.exceptions.ApplicationExceptions", "org.jaffa.exceptions.FrameworkException", "org.jaffa.persistence.IPersistent" ]
import org.jaffa.exceptions.ApplicationExceptions; import org.jaffa.exceptions.FrameworkException; import org.jaffa.persistence.IPersistent;
import org.jaffa.exceptions.*; import org.jaffa.persistence.*;
[ "org.jaffa.exceptions", "org.jaffa.persistence" ]
org.jaffa.exceptions; org.jaffa.persistence;
1,701,207
public static Collection<Query> toQueries(Collection<QueryBuilder> queryBuilders, QueryShardContext context) throws QueryShardException, IOException { List<Query> queries = new ArrayList<>(queryBuilders.size()); for (QueryBuilder queryBuilder : queryBuilders) { Query query = queryBuilder.toQuery(context); if (query != null) { queries.add(query); } } return queries; }
static Collection<Query> function(Collection<QueryBuilder> queryBuilders, QueryShardContext context) throws QueryShardException, IOException { List<Query> queries = new ArrayList<>(queryBuilders.size()); for (QueryBuilder queryBuilder : queryBuilders) { Query query = queryBuilder.toQuery(context); if (query != null) { queries.add(query); } } return queries; }
/** * Helper method to convert collection of {@link QueryBuilder} instances to lucene * {@link Query} instances. {@link QueryBuilder} that return <tt>null</tt> calling * their {@link QueryBuilder#toQuery(QueryShardContext)} method are not added to the * resulting collection. */
Helper method to convert collection of <code>QueryBuilder</code> instances to lucene <code>Query</code> instances. <code>QueryBuilder</code> that return null calling their <code>QueryBuilder#toQuery(QueryShardContext)</code> method are not added to the resulting collection
toQueries
{ "repo_name": "jprante/elasticsearch-server", "path": "server/src/main/java/org/elasticsearch/index/query/AbstractQueryBuilder.java", "license": "apache-2.0", "size": 14303 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.Collection", "java.util.List", "org.apache.lucene.search.Query" ]
import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.lucene.search.Query;
import java.io.*; import java.util.*; import org.apache.lucene.search.*;
[ "java.io", "java.util", "org.apache.lucene" ]
java.io; java.util; org.apache.lucene;
1,794,995
private static boolean resolveEnable(Context context) { int state = context.getPackageManager() .getApplicationEnabledSetting(DOWNLOAD_MANAGER_PACKAGE_NAME); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) { return !(state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED || state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER || state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED); } else { return !(state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED || state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER); } }
static boolean function(Context context) { int state = context.getPackageManager() .getApplicationEnabledSetting(DOWNLOAD_MANAGER_PACKAGE_NAME); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) { return !(state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED); } else { return !(state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED state == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER); } }
/** * Resolve whether the DownloadManager is enable in current devices. * * @param context * @return true if DownloadManager is enable,false otherwise. */
Resolve whether the DownloadManager is enable in current devices
resolveEnable
{ "repo_name": "r0nn/hipda", "path": "hipda/src/main/java/net/jejer/hipda/utils/DownloadManagerResolver.java", "license": "gpl-2.0", "size": 3382 }
[ "android.content.Context", "android.content.pm.PackageManager", "android.os.Build" ]
import android.content.Context; import android.content.pm.PackageManager; import android.os.Build;
import android.content.*; import android.content.pm.*; import android.os.*;
[ "android.content", "android.os" ]
android.content; android.os;
520,539
public mxRectangle getCellBounds(Object cell, boolean includeEdges, boolean includeDescendants, boolean boundingBox) { Object[] cells; // Recursively includes connected edges if (includeEdges) { Set<Object> allCells = new HashSet<Object>(); allCells.add(cell); Set<Object> edges = new HashSet<Object>( Arrays.asList(getEdges(cell))); while (!edges.isEmpty() && !allCells.containsAll(edges)) { allCells.addAll(edges); Set<Object> tmp = new HashSet<Object>(); Iterator<Object> it = edges.iterator(); while (it.hasNext()) { Object edge = it.next(); tmp.addAll(Arrays.asList(getEdges(edge))); } edges = tmp; } cells = allCells.toArray(); } else { cells = new Object[] { cell }; } mxRectangle result = view.getBounds(cells, boundingBox); // Recursively includes the bounds of the children if (includeDescendants) { for (int i = 0; i < cells.length; i++) { int childCount = model.getChildCount(cells[i]); for (int j = 0; j < childCount; j++) { mxRectangle tmp = getCellBounds( model.getChildAt(cells[i], j), includeEdges, true, boundingBox); if (result != null) { result.add(tmp); } else { result = tmp; } } } } return result; }
mxRectangle function(Object cell, boolean includeEdges, boolean includeDescendants, boolean boundingBox) { Object[] cells; if (includeEdges) { Set<Object> allCells = new HashSet<Object>(); allCells.add(cell); Set<Object> edges = new HashSet<Object>( Arrays.asList(getEdges(cell))); while (!edges.isEmpty() && !allCells.containsAll(edges)) { allCells.addAll(edges); Set<Object> tmp = new HashSet<Object>(); Iterator<Object> it = edges.iterator(); while (it.hasNext()) { Object edge = it.next(); tmp.addAll(Arrays.asList(getEdges(edge))); } edges = tmp; } cells = allCells.toArray(); } else { cells = new Object[] { cell }; } mxRectangle result = view.getBounds(cells, boundingBox); if (includeDescendants) { for (int i = 0; i < cells.length; i++) { int childCount = model.getChildCount(cells[i]); for (int j = 0; j < childCount; j++) { mxRectangle tmp = getCellBounds( model.getChildAt(cells[i], j), includeEdges, true, boundingBox); if (result != null) { result.add(tmp); } else { result = tmp; } } } } return result; }
/** * Returns the bounds of the given cell including all connected edges * if includeEdge is true. */
Returns the bounds of the given cell including all connected edges if includeEdge is true
getCellBounds
{ "repo_name": "tsxuehu/jgraphlearn", "path": "java/src/com/mxgraph/view/mxGraph.java", "license": "apache-2.0", "size": 205407 }
[ "java.util.Arrays", "java.util.HashSet", "java.util.Iterator", "java.util.Set" ]
import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,018,628
public List<Calendar> getCurrentCalendars() { // Get list of currently active calendars ServiceUtils serviceUtils = Core.getInstance().getServiceUtils(); List<Calendar> calendarList = serviceUtils.getCurrentCalendars(Core.getInstance().getSystemTime()); return calendarList; }
List<Calendar> function() { ServiceUtils serviceUtils = Core.getInstance().getServiceUtils(); List<Calendar> calendarList = serviceUtils.getCurrentCalendars(Core.getInstance().getSystemTime()); return calendarList; }
/** * Returns list of calendars that are currently active * @return current calendars */
Returns list of calendars that are currently active
getCurrentCalendars
{ "repo_name": "scrudden/core", "path": "transitime/src/main/java/org/transitime/gtfs/DbConfig.java", "license": "gpl-3.0", "size": 33549 }
[ "java.util.List", "org.transitime.applications.Core", "org.transitime.core.ServiceUtils", "org.transitime.db.structs.Calendar" ]
import java.util.List; import org.transitime.applications.Core; import org.transitime.core.ServiceUtils; import org.transitime.db.structs.Calendar;
import java.util.*; import org.transitime.applications.*; import org.transitime.core.*; import org.transitime.db.structs.*;
[ "java.util", "org.transitime.applications", "org.transitime.core", "org.transitime.db" ]
java.util; org.transitime.applications; org.transitime.core; org.transitime.db;
503,582
@Test public void view() throws Exception { flyway.setLocations("migration/dbsupport/mysql/sql/view"); flyway.migrate(); assertEquals(150, jdbcTemplate.queryForInt("SELECT value FROM v")); flyway.clean(); // Running migrate again on an unclean database, triggers duplicate object exceptions. flyway.migrate(); }
void function() throws Exception { flyway.setLocations(STR); flyway.migrate(); assertEquals(150, jdbcTemplate.queryForInt(STR)); flyway.clean(); flyway.migrate(); }
/** * Tests clean and migrate for MySQL Views. */
Tests clean and migrate for MySQL Views
view
{ "repo_name": "chrsoo/flyway", "path": "flyway-core/src/test/java/org/flywaydb/core/internal/dbsupport/mysql/MySQLMigrationTestCase.java", "license": "apache-2.0", "size": 6946 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,391,430