method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public EntityMappings<T> removeDescription() { childNode.removeChildren("description"); return this; } // --------------------------------------------------------------------------------------------------------|| // ClassName: EntityMappings ElementName: orm:persistence-unit-metadata ElementType : persistence-unit-metadata // MaxOccurs: - isGeneric: true isAttribute: false isEnum: false isDataType: false // --------------------------------------------------------------------------------------------------------||
EntityMappings<T> function() { childNode.removeChildren(STR); return this; }
/** * Removes the <code>description</code> element * @return the current instance of <code>EntityMappings<T></code> */
Removes the <code>description</code> element
removeDescription
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm20/EntityMappingsImpl.java", "license": "epl-1.0", "size": 29628 }
[ "org.jboss.shrinkwrap.descriptor.api.orm20.EntityMappings" ]
import org.jboss.shrinkwrap.descriptor.api.orm20.EntityMappings;
import org.jboss.shrinkwrap.descriptor.api.orm20.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
390,289
public SingleOutputStreamOperator<T> max(int positionToMax) { return aggregate(new ComparableAggregator<>(positionToMax, getType(), AggregationFunction.AggregationType.MAX, getExecutionConfig())); }
SingleOutputStreamOperator<T> function(int positionToMax) { return aggregate(new ComparableAggregator<>(positionToMax, getType(), AggregationFunction.AggregationType.MAX, getExecutionConfig())); }
/** * Applies an aggregation that gives the current maximum of the data stream * at the given position by the given key. An independent aggregate is kept * per key. * * @param positionToMax * The field position in the data points to minimize. This is applicable to * Tuple types, Scala case classes, and primitive types (which is considered * as having one field). * @return The transformed DataStream. */
Applies an aggregation that gives the current maximum of the data stream at the given position by the given key. An independent aggregate is kept per key
max
{ "repo_name": "ueshin/apache-flink", "path": "flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java", "license": "apache-2.0", "size": 44205 }
[ "org.apache.flink.streaming.api.functions.aggregation.AggregationFunction", "org.apache.flink.streaming.api.functions.aggregation.ComparableAggregator" ]
import org.apache.flink.streaming.api.functions.aggregation.AggregationFunction; import org.apache.flink.streaming.api.functions.aggregation.ComparableAggregator;
import org.apache.flink.streaming.api.functions.aggregation.*;
[ "org.apache.flink" ]
org.apache.flink;
276,862
validate(collectionName, dataCode, title, status); long id = counterLocalService.increment(); DictData dictData = dictDataPersistence.create(id); Date now = new Date(); dictData.setCollectionName(collectionName); dictData.setDataCode(dataCode); dictData.setNode_1(node_1); dictData.setNode_2(node_2); dictData.setNode_3(node_3); dictData.setNode_4(node_4); dictData.setNode_5(node_5); dictData.setDataLevel(dataLevel); dictData.setTitle(title); dictData.setDescription(description); dictData.setStatus(status); dictData.setCompanyId(serviceContext.getCompanyId()); dictData.setGroupId(serviceContext.getScopeGroupId()); dictData.setUserId(serviceContext.getUserId()); dictData.setCreateDate(serviceContext.getCreateDate(now)); dictData.setValidatedFrom(validatedFrom); dictData.setValidatedTo(validatedTo); dictDataPersistence.update(dictData); if (_log.isInfoEnabled()) { _log.info("Create new dict data " + id); } if (serviceContext.isAddGroupPermissions() || serviceContext.isAddGuestPermissions()) { addDictDataResources(dictData, serviceContext.isAddGroupPermissions(), serviceContext.isAddGuestPermissions(), serviceContext); } else { addDictDataResources(dictData, serviceContext.getGroupPermissions(), serviceContext.getGuestPermissions(), serviceContext); } return getDictData(id); }
validate(collectionName, dataCode, title, status); long id = counterLocalService.increment(); DictData dictData = dictDataPersistence.create(id); Date now = new Date(); dictData.setCollectionName(collectionName); dictData.setDataCode(dataCode); dictData.setNode_1(node_1); dictData.setNode_2(node_2); dictData.setNode_3(node_3); dictData.setNode_4(node_4); dictData.setNode_5(node_5); dictData.setDataLevel(dataLevel); dictData.setTitle(title); dictData.setDescription(description); dictData.setStatus(status); dictData.setCompanyId(serviceContext.getCompanyId()); dictData.setGroupId(serviceContext.getScopeGroupId()); dictData.setUserId(serviceContext.getUserId()); dictData.setCreateDate(serviceContext.getCreateDate(now)); dictData.setValidatedFrom(validatedFrom); dictData.setValidatedTo(validatedTo); dictDataPersistence.update(dictData); if (_log.isInfoEnabled()) { _log.info(STR + id); } if (serviceContext.isAddGroupPermissions() serviceContext.isAddGuestPermissions()) { addDictDataResources(dictData, serviceContext.isAddGroupPermissions(), serviceContext.isAddGuestPermissions(), serviceContext); } else { addDictDataResources(dictData, serviceContext.getGroupPermissions(), serviceContext.getGuestPermissions(), serviceContext); } return getDictData(id); }
/** * comment for function * * Version: OEP 2.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 18-September-2015 trungdk Create new * @param * @return: */
comment for function Version: OEP 2.0 History: DATE AUTHOR DESCRIPTION ------------------------------------------------- 18-September-2015 trungdk Create new
addDictData
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-datamgt-portlet/docroot/WEB-INF/src/org/oep/datamgt/service/impl/DictDataLocalServiceImpl.java", "license": "apache-2.0", "size": 16517 }
[ "java.util.Date", "org.oep.datamgt.model.DictData" ]
import java.util.Date; import org.oep.datamgt.model.DictData;
import java.util.*; import org.oep.datamgt.model.*;
[ "java.util", "org.oep.datamgt" ]
java.util; org.oep.datamgt;
1,818,498
public void setTexture(Texture texture) { throw new OperationNotSupportedException("Can't use big images as offscreen buffers"); }
void function(Texture texture) { throw new OperationNotSupportedException(STR); }
/** * Not supported in BigImage * * @see org.newdawn.slick.Image#setTexture(org.newdawn.slick.opengl.Texture) */
Not supported in BigImage
setTexture
{ "repo_name": "SenshiSentou/SourceFight", "path": "slick_dev/tags/Slick0.3/src/org/newdawn/slick/BigImage.java", "license": "bsd-2-clause", "size": 21276 }
[ "org.newdawn.slick.opengl.Texture", "org.newdawn.slick.util.OperationNotSupportedException" ]
import org.newdawn.slick.opengl.Texture; import org.newdawn.slick.util.OperationNotSupportedException;
import org.newdawn.slick.opengl.*; import org.newdawn.slick.util.*;
[ "org.newdawn.slick" ]
org.newdawn.slick;
2,319,251
private Map<String, Map<String, Object>> toFieldArray( final Collection<FieldMetadata> c, final IAdapter adapter) { final Map<String, Map<String, Object>> result = new LinkedHashMap<String, Map<String, Object>>(); Map<String, Object> subField = null; for (final FieldMetadata field : c) { //field.customize(adapter); subField = field.toMap(adapter); // Add field translate if (!field.isInternal() && !field.isHidden()) { field.makeString("label"); } result.put(field.getName(), subField); } return result; }
Map<String, Map<String, Object>> function( final Collection<FieldMetadata> c, final IAdapter adapter) { final Map<String, Map<String, Object>> result = new LinkedHashMap<String, Map<String, Object>>(); Map<String, Object> subField = null; for (final FieldMetadata field : c) { subField = field.toMap(adapter); if (!field.isInternal() && !field.isHidden()) { field.makeString("label"); } result.put(field.getName(), subField); } return result; }
/** * Build a map from a collection of fields. * @param c The collection of fields * @param adapter The adapter to use. * @return The fields map. */
Build a map from a collection of fields
toFieldArray
{ "repo_name": "TACTfactory/harmony-core", "path": "src/com/tactfactory/harmony/meta/ClassMetadata.java", "license": "mit", "size": 7247 }
[ "com.tactfactory.harmony.platform.IAdapter", "java.util.Collection", "java.util.LinkedHashMap", "java.util.Map" ]
import com.tactfactory.harmony.platform.IAdapter; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map;
import com.tactfactory.harmony.platform.*; import java.util.*;
[ "com.tactfactory.harmony", "java.util" ]
com.tactfactory.harmony; java.util;
1,242,327
public final void setLastLogin(IContext context, java.util.Date lastlogin) { getMendixObject().setValue(context, MemberNames.LastLogin.toString(), lastlogin); }
final void function(IContext context, java.util.Date lastlogin) { getMendixObject().setValue(context, MemberNames.LastLogin.toString(), lastlogin); }
/** * Set value of LastLogin * @param context * @param lastlogin */
Set value of LastLogin
setLastLogin
{ "repo_name": "mendix/MobileSlider", "path": "test/javasource/system/proxies/User.java", "license": "apache-2.0", "size": 14439 }
[ "com.mendix.systemwideinterfaces.core.IContext" ]
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.systemwideinterfaces.core.*;
[ "com.mendix.systemwideinterfaces" ]
com.mendix.systemwideinterfaces;
1,289,333
public void setParams(List<AstNode> params) { if (params == null) { this.params = null; } else { if (this.params != null) this.params.clear(); for (AstNode param : params) addParam(param); } } /** * Adds a parameter to the function parameter list. * Sets the parent of the param node to this node. * @param param the parameter * @throws IllegalArgumentException if param is {@code null}
void function(List<AstNode> params) { if (params == null) { this.params = null; } else { if (this.params != null) this.params.clear(); for (AstNode param : params) addParam(param); } } /** * Adds a parameter to the function parameter list. * Sets the parent of the param node to this node. * @param param the parameter * @throws IllegalArgumentException if param is {@code null}
/** * Sets the function parameter list, and sets the parent for * each element of the list. * @param params the function parameter list, or {@code null} if no params */
Sets the function parameter list, and sets the parent for each element of the list
setParams
{ "repo_name": "dound/google-closure-compiler", "path": "lib/rhino/src/org/mozilla/javascript/ast/FunctionNode.java", "license": "apache-2.0", "size": 13995 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,107,618
public Image getImage();
Image function();
/** * Returns the image this event contains. * @return The image to be displayed. */
Returns the image this event contains
getImage
{ "repo_name": "tectronics/reformationofeurope", "path": "src/net/sf/freecol/common/io/sza/ImageAnimationEvent.java", "license": "gpl-2.0", "size": 528 }
[ "java.awt.Image" ]
import java.awt.Image;
import java.awt.*;
[ "java.awt" ]
java.awt;
530,031
@Test public void testPassIncompatibleType_isFalse() { assertFalse("Passing incompatible object to equals should return false", x.equals("string")); }
void function() { assertFalse(STR, x.equals(STR)); }
/** * x.equals(WrongType) must return false; */
x.equals(WrongType) must return false
testPassIncompatibleType_isFalse
{ "repo_name": "EBIvariation/variation-commons", "path": "variation-commons-jpa/src/test/java/uk/ac/ebi/eva/commons/jpa/models/metadata/StudyTest.java", "license": "apache-2.0", "size": 15380 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,646,476
@Metadata(label = "consumer", description = "Sets the cache level by ID for the underlying JMS resources. See cacheLevelName option for more details.") public void setCacheLevel(int cacheLevel) { getConfiguration().setCacheLevel(cacheLevel); }
@Metadata(label = STR, description = STR) void function(int cacheLevel) { getConfiguration().setCacheLevel(cacheLevel); }
/** * Sets the cache level by ID for the underlying JMS resources. See cacheLevelName option for more details. */
Sets the cache level by ID for the underlying JMS resources. See cacheLevelName option for more details
setCacheLevel
{ "repo_name": "CodeSmell/camel", "path": "components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java", "license": "apache-2.0", "size": 83917 }
[ "org.apache.camel.spi.Metadata" ]
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.*;
[ "org.apache.camel" ]
org.apache.camel;
2,435,250
@SuppressWarnings("static-access") protected Options createScriptLanguageOptions(String jobType) { Option oozie = new Option(OOZIE_OPTION, true, "Oozie URL"); Option config = new Option(CONFIG_OPTION, true, "job configuration file '.properties'"); Option file = new Option(SCRIPTFILE_OPTION, true, jobType + " script"); Option property = OptionBuilder.withArgName("property=value").hasArgs(2).withValueSeparator().withDescription( "set/override value for given property").create("D"); Option params = OptionBuilder.withArgName("property=value").hasArgs(2).withValueSeparator().withDescription( "set parameters for script").create("P"); Option doAs = new Option(DO_AS_OPTION, true, "doAs user, impersonates as the specified user"); Options Options = new Options(); Options.addOption(oozie); Options.addOption(doAs); Options.addOption(config); Options.addOption(property); Options.addOption(params); Options.addOption(file); addAuthOptions(Options); return Options; }
@SuppressWarnings(STR) Options function(String jobType) { Option oozie = new Option(OOZIE_OPTION, true, STR); Option config = new Option(CONFIG_OPTION, true, STR); Option file = new Option(SCRIPTFILE_OPTION, true, jobType + STR); Option property = OptionBuilder.withArgName(STR).hasArgs(2).withValueSeparator().withDescription( STR).create("D"); Option params = OptionBuilder.withArgName(STR).hasArgs(2).withValueSeparator().withDescription( STR).create("P"); Option doAs = new Option(DO_AS_OPTION, true, STR); Options Options = new Options(); Options.addOption(oozie); Options.addOption(doAs); Options.addOption(config); Options.addOption(property); Options.addOption(params); Options.addOption(file); addAuthOptions(Options); return Options; }
/** * Create option for command line option 'pig' or 'hive' * @param jobType type of job - pig or hive * @return pig or hive options */
Create option for command line option 'pig' or 'hive'
createScriptLanguageOptions
{ "repo_name": "cbaenziger/oozie", "path": "client/src/main/java/org/apache/oozie/cli/OozieCLI.java", "license": "apache-2.0", "size": 121224 }
[ "org.apache.commons.cli.Option", "org.apache.commons.cli.OptionBuilder", "org.apache.commons.cli.Options" ]
import org.apache.commons.cli.Option; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options;
import org.apache.commons.cli.*;
[ "org.apache.commons" ]
org.apache.commons;
284,624
static public MDocType[] getOfDocBaseType (Properties ctx, String DocBaseType) { final String whereClause = "AD_Client_ID=? AND DocBaseType=?"; List<MDocType> list = new Query(ctx, Table_Name, whereClause, null) .setParameters(Env.getAD_Client_ID(ctx), DocBaseType) .setOnlyActiveRecords(true) .setOrderBy("IsDefault DESC, C_DocType_ID") .list(); return list.toArray(new MDocType[list.size()]); } // getOfDocBaseType
static MDocType[] function (Properties ctx, String DocBaseType) { final String whereClause = STR; List<MDocType> list = new Query(ctx, Table_Name, whereClause, null) .setParameters(Env.getAD_Client_ID(ctx), DocBaseType) .setOnlyActiveRecords(true) .setOrderBy(STR) .list(); return list.toArray(new MDocType[list.size()]); }
/** * Get Client Document Type with DocBaseType * @param ctx context * @param DocBaseType base document type * @return array of doc types */
Get Client Document Type with DocBaseType
getOfDocBaseType
{ "repo_name": "erpcya/adempierePOS", "path": "base/src/org/compiere/model/MDocType.java", "license": "gpl-2.0", "size": 9530 }
[ "java.util.List", "java.util.Properties", "org.compiere.util.Env" ]
import java.util.List; import java.util.Properties; import org.compiere.util.Env;
import java.util.*; import org.compiere.util.*;
[ "java.util", "org.compiere.util" ]
java.util; org.compiere.util;
172,386
public OutboundRuleInner withBackendAddressPool(SubResource backendAddressPool) { this.backendAddressPool = backendAddressPool; return this; }
OutboundRuleInner function(SubResource backendAddressPool) { this.backendAddressPool = backendAddressPool; return this; }
/** * Set a reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs. * * @param backendAddressPool the backendAddressPool value to set * @return the OutboundRuleInner object itself. */
Set a reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs
withBackendAddressPool
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/OutboundRuleInner.java", "license": "mit", "size": 8136 }
[ "com.microsoft.azure.SubResource" ]
import com.microsoft.azure.SubResource;
import com.microsoft.azure.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,106,754
String getExtensionFromFile( File file ) { // we are just interested in the section after the last - String[] parts = file.getName().split( "-" ); if ( parts.length > 0 ) { // get anything after a dot followed by a letter a-z, including other dots Pattern p = Pattern.compile( "\\.([a-z]+[a-z0-9\\.]*)" ); Matcher m = p.matcher( parts[parts.length - 1] ); if ( m.find() ) { return m.group( 1 ); } } // just in case return FilenameUtils.getExtension( file.getName() ); }
String getExtensionFromFile( File file ) { String[] parts = file.getName().split( "-" ); if ( parts.length > 0 ) { Pattern p = Pattern.compile( STR ); Matcher m = p.matcher( parts[parts.length - 1] ); if ( m.find() ) { return m.group( 1 ); } } return FilenameUtils.getExtension( file.getName() ); }
/** * Extract file extension */
Extract file extension
getExtensionFromFile
{ "repo_name": "emsouza/archiva", "path": "archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactBuilder.java", "license": "apache-2.0", "size": 4673 }
[ "java.io.File", "java.util.regex.Matcher", "java.util.regex.Pattern", "org.apache.commons.io.FilenameUtils" ]
import java.io.File; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.io.FilenameUtils;
import java.io.*; import java.util.regex.*; import org.apache.commons.io.*;
[ "java.io", "java.util", "org.apache.commons" ]
java.io; java.util; org.apache.commons;
2,049,452
public static boolean deleteTmpFile(File tempFile) { if (tempFile != null) { tempFile.delete(); ShutdownHookManager.cancelDeleteOnExit(tempFile); return true; } return false; }
static boolean function(File tempFile) { if (tempFile != null) { tempFile.delete(); ShutdownHookManager.cancelDeleteOnExit(tempFile); return true; } return false; }
/** * delete a temporary file and remove it from delete-on-exit hook. */
delete a temporary file and remove it from delete-on-exit hook
deleteTmpFile
{ "repo_name": "b-slim/hive", "path": "common/src/java/org/apache/hadoop/hive/common/FileUtils.java", "license": "apache-2.0", "size": 38403 }
[ "java.io.File", "org.apache.hive.common.util.ShutdownHookManager" ]
import java.io.File; import org.apache.hive.common.util.ShutdownHookManager;
import java.io.*; import org.apache.hive.common.util.*;
[ "java.io", "org.apache.hive" ]
java.io; org.apache.hive;
1,952,557
private void displayMessage(Message message) { Log.i(TAG, "displayMessage: " + message); mMessageTextFadeInAnimator.start(); mMessageTitleFadeInAnimator.start(); mMessageTextView.setSelected(false); mMessageTitleView.setText(message.getTitle()); mMessageTextView.setText(message.getMessage());
void function(Message message) { Log.i(TAG, STR + message); mMessageTextFadeInAnimator.start(); mMessageTitleFadeInAnimator.start(); mMessageTextView.setSelected(false); mMessageTitleView.setText(message.getTitle()); mMessageTextView.setText(message.getMessage());
/** * Displays the message in parameter. Before start scrolling with * mMessageTextView.setSelected, sets a initial delay of 3 seconds. * * @param message */
Displays the message in parameter. Before start scrolling with mMessageTextView.setSelected, sets a initial delay of 3 seconds
displayMessage
{ "repo_name": "resourcepool/dashboard", "path": "dashboard-tv/app/src/main/java/io/resourcepool/dashboard/ui/fragments/NewsFragment.java", "license": "apache-2.0", "size": 6160 }
[ "android.util.Log", "io.resourcepool.dashboard.model.entities.Message" ]
import android.util.Log; import io.resourcepool.dashboard.model.entities.Message;
import android.util.*; import io.resourcepool.dashboard.model.entities.*;
[ "android.util", "io.resourcepool.dashboard" ]
android.util; io.resourcepool.dashboard;
965,372
public Optional<GHMilestone> getMilestone() throws FB2GHException { try { if (issue.json().isNull("milestone")) { return Optional.empty(); } JsonObject milestone = issue.json().getJsonObject("milestone"); int number = milestone.getInt("number"); String title = milestone.getString("title"); return Optional.of(new GHMilestone(number, title)); } catch (AssertionError e) { throw GHUtils.rethrow(e); } catch (IOException e) { throw new FB2GHException(e); } }
Optional<GHMilestone> function() throws FB2GHException { try { if (issue.json().isNull(STR)) { return Optional.empty(); } JsonObject milestone = issue.json().getJsonObject(STR); int number = milestone.getInt(STR); String title = milestone.getString("title"); return Optional.of(new GHMilestone(number, title)); } catch (AssertionError e) { throw GHUtils.rethrow(e); } catch (IOException e) { throw new FB2GHException(e); } }
/** * Get the milestone of this issue, if one exists. * * @return An {@link Optional} which contains the milestone if one exists. * @throws FB2GHException if a GitHub error occurs */
Get the milestone of this issue, if one exists
getMilestone
{ "repo_name": "sudiamanj/fogbugz-to-github", "path": "src/main/java/com/sudicode/fb2gh/github/GHIssue.java", "license": "mit", "size": 8064 }
[ "com.sudicode.fb2gh.FB2GHException", "java.io.IOException", "java.util.Optional", "javax.json.JsonObject" ]
import com.sudicode.fb2gh.FB2GHException; import java.io.IOException; import java.util.Optional; import javax.json.JsonObject;
import com.sudicode.fb2gh.*; import java.io.*; import java.util.*; import javax.json.*;
[ "com.sudicode.fb2gh", "java.io", "java.util", "javax.json" ]
com.sudicode.fb2gh; java.io; java.util; javax.json;
2,270,056
public static <T> T first(Iterable<T> iterable, IFilter<? super T> filter) { for (T t : iterable) { if (filter == null || filter.accept(t)) { return t; } } return null; }
static <T> T function(Iterable<T> iterable, IFilter<? super T> filter) { for (T t : iterable) { if (filter == null filter.accept(t)) { return t; } } return null; }
/** * returns the first matching element of the given iterable. */
returns the first matching element of the given iterable
first
{ "repo_name": "krasv/flowr", "path": "commons/utils/src/main/java/org/flowr/utils/collections/CollectionUtils.java", "license": "epl-1.0", "size": 13801 }
[ "org.flowr.utils.IFilter" ]
import org.flowr.utils.IFilter;
import org.flowr.utils.*;
[ "org.flowr.utils" ]
org.flowr.utils;
1,215,836
public void handleManagerStart() throws ManagementException { if (!isServiceInitialised("handleManagerStart")) { return; } MBeanJMXAdapter jmxAdapter = service.getJMXAdapter(); Map<ObjectName, Object> registeredMBeans = jmxAdapter.getLocalGemFireMBean(); DistributedSystemBridge dsBridge = new DistributedSystemBridge(service); this.aggregator = new MBeanAggregator(dsBridge); // register the aggregator for Federation framework to use service.addProxyListener(aggregator); MemberMXBean localMember = service.getMemberMXBean(); ObjectName memberObjectName = MBeanJMXAdapter.getMemberMBeanName( InternalDistributedSystem.getConnectedInstance().getDistributedMember()); FederationComponent addedComp = service.getLocalManager().getFedComponents().get(memberObjectName); service.afterCreateProxy(memberObjectName, MemberMXBean.class, localMember, addedComp); for (ObjectName objectName : registeredMBeans.keySet()) { if (objectName.equals(memberObjectName)) { continue; } Object object = registeredMBeans.get(objectName); ObjectInstance instance; try { instance = mbeanServer.getObjectInstance(objectName); String className = instance.getClassName(); Class cls = ClassLoadUtil.classFromName(className); Type[] intfTyps = cls.getGenericInterfaces(); FederationComponent newObj = service.getLocalManager().getFedComponents().get(objectName); for (Type intfTyp1 : intfTyps) { Class intfTyp = (Class) intfTyp1; service.afterCreateProxy(objectName, intfTyp, object, newObj); } } catch (InstanceNotFoundException e) { if (logger.isDebugEnabled()) { logger.debug("Failed in Registering distributed mbean "); } throw new ManagementException(e); } catch (ClassNotFoundException e) { if (logger.isDebugEnabled()) { logger.debug("Failed in Registering distributed mbean"); } throw new ManagementException(e); } } }
void function() throws ManagementException { if (!isServiceInitialised(STR)) { return; } MBeanJMXAdapter jmxAdapter = service.getJMXAdapter(); Map<ObjectName, Object> registeredMBeans = jmxAdapter.getLocalGemFireMBean(); DistributedSystemBridge dsBridge = new DistributedSystemBridge(service); this.aggregator = new MBeanAggregator(dsBridge); service.addProxyListener(aggregator); MemberMXBean localMember = service.getMemberMXBean(); ObjectName memberObjectName = MBeanJMXAdapter.getMemberMBeanName( InternalDistributedSystem.getConnectedInstance().getDistributedMember()); FederationComponent addedComp = service.getLocalManager().getFedComponents().get(memberObjectName); service.afterCreateProxy(memberObjectName, MemberMXBean.class, localMember, addedComp); for (ObjectName objectName : registeredMBeans.keySet()) { if (objectName.equals(memberObjectName)) { continue; } Object object = registeredMBeans.get(objectName); ObjectInstance instance; try { instance = mbeanServer.getObjectInstance(objectName); String className = instance.getClassName(); Class cls = ClassLoadUtil.classFromName(className); Type[] intfTyps = cls.getGenericInterfaces(); FederationComponent newObj = service.getLocalManager().getFedComponents().get(objectName); for (Type intfTyp1 : intfTyps) { Class intfTyp = (Class) intfTyp1; service.afterCreateProxy(objectName, intfTyp, object, newObj); } } catch (InstanceNotFoundException e) { if (logger.isDebugEnabled()) { logger.debug(STR); } throw new ManagementException(e); } catch (ClassNotFoundException e) { if (logger.isDebugEnabled()) { logger.debug(STR); } throw new ManagementException(e); } } }
/** * Handles all the distributed mbean creation part when a Manager is started */
Handles all the distributed mbean creation part when a Manager is started
handleManagerStart
{ "repo_name": "shankarh/geode", "path": "geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java", "license": "apache-2.0", "size": 40390 }
[ "java.lang.reflect.Type", "java.util.Map", "javax.management.InstanceNotFoundException", "javax.management.ObjectInstance", "javax.management.ObjectName", "org.apache.geode.distributed.internal.InternalDistributedSystem", "org.apache.geode.internal.ClassLoadUtil", "org.apache.geode.management.ManagementException", "org.apache.geode.management.MemberMXBean", "org.apache.geode.management.internal.FederationComponent", "org.apache.geode.management.internal.MBeanJMXAdapter" ]
import java.lang.reflect.Type; import java.util.Map; import javax.management.InstanceNotFoundException; import javax.management.ObjectInstance; import javax.management.ObjectName; import org.apache.geode.distributed.internal.InternalDistributedSystem; import org.apache.geode.internal.ClassLoadUtil; import org.apache.geode.management.ManagementException; import org.apache.geode.management.MemberMXBean; import org.apache.geode.management.internal.FederationComponent; import org.apache.geode.management.internal.MBeanJMXAdapter;
import java.lang.reflect.*; import java.util.*; import javax.management.*; import org.apache.geode.distributed.internal.*; import org.apache.geode.internal.*; import org.apache.geode.management.*; import org.apache.geode.management.internal.*;
[ "java.lang", "java.util", "javax.management", "org.apache.geode" ]
java.lang; java.util; javax.management; org.apache.geode;
1,351,464
private static int calculateFrameLength(int layer, int bitRate, int sampleRate, int padding) { if (layer == AudioFrame.LAYER_1) { return (12 * bitRate / sampleRate + padding) * 4; } else { return 144 * bitRate / sampleRate + padding; } }
static int function(int layer, int bitRate, int sampleRate, int padding) { if (layer == AudioFrame.LAYER_1) { return (12 * bitRate / sampleRate + padding) * 4; } else { return 144 * bitRate / sampleRate + padding; } }
/** * Calculates the length of an MPEG frame based on the given parameters. * * @param layer * the layer * @param bitRate * the bit rate * @param sampleRate * the sample rate * @param padding * the padding flag * @return the length of the frame in bytes */
Calculates the length of an MPEG frame based on the given parameters
calculateFrameLength
{ "repo_name": "marcus-nl/red5-io", "path": "src/main/java/org/red5/io/mp3/impl/MP3Stream.java", "license": "apache-2.0", "size": 14617 }
[ "org.apache.tika.parser.mp3.AudioFrame" ]
import org.apache.tika.parser.mp3.AudioFrame;
import org.apache.tika.parser.mp3.*;
[ "org.apache.tika" ]
org.apache.tika;
2,906,498
private Updates changes(Snapshot snapshot) { return shardChanges.computeIfAbsent(snapshot, k -> new Updates()); } private static class Updates { private Map<ShardId, ShardRestoreStatus> failedShards = new HashMap<>(); private Map<ShardId, ShardRestoreStatus> startedShards = new HashMap<>(); }
Updates function(Snapshot snapshot) { return shardChanges.computeIfAbsent(snapshot, k -> new Updates()); } private static class Updates { private Map<ShardId, ShardRestoreStatus> failedShards = new HashMap<>(); private Map<ShardId, ShardRestoreStatus> startedShards = new HashMap<>(); }
/** * Helper method that creates update entry for the given shard id if such an entry does not exist yet. */
Helper method that creates update entry for the given shard id if such an entry does not exist yet
changes
{ "repo_name": "gmarz/elasticsearch", "path": "core/src/main/java/org/elasticsearch/snapshots/RestoreService.java", "license": "apache-2.0", "size": 51520 }
[ "java.util.HashMap", "java.util.Map", "org.elasticsearch.cluster.RestoreInProgress", "org.elasticsearch.index.shard.ShardId" ]
import java.util.HashMap; import java.util.Map; import org.elasticsearch.cluster.RestoreInProgress; import org.elasticsearch.index.shard.ShardId;
import java.util.*; import org.elasticsearch.cluster.*; import org.elasticsearch.index.shard.*;
[ "java.util", "org.elasticsearch.cluster", "org.elasticsearch.index" ]
java.util; org.elasticsearch.cluster; org.elasticsearch.index;
1,669,929
public void updatePodcastByFeedUrl(Podcast podcast);
void function(Podcast podcast);
/** * Updates the podcast's attributes (podcast identified in DB by url of the feed) * @param podcast */
Updates the podcast's attributes (podcast identified in DB by url of the feed)
updatePodcastByFeedUrl
{ "repo_name": "sslavescu/podcastpedia", "path": "admin/src/main/java/org/podcastpedia/admin/dao/UpdateDao.java", "license": "mit", "size": 2090 }
[ "org.podcastpedia.common.domain.Podcast" ]
import org.podcastpedia.common.domain.Podcast;
import org.podcastpedia.common.domain.*;
[ "org.podcastpedia.common" ]
org.podcastpedia.common;
2,317,515
@XmlElementWrapper(name = WARNINGS_ATTR) public List<String> getWarnings() { return warnings; }
@XmlElementWrapper(name = WARNINGS_ATTR) List<String> function() { return warnings; }
/** * This list of warnings for this response. */
This list of warnings for this response
getWarnings
{ "repo_name": "cloudera/cm_api", "path": "java/src/main/java/com/cloudera/api/model/ApiYarnApplicationResponse.java", "license": "apache-2.0", "size": 2269 }
[ "java.util.List", "javax.xml.bind.annotation.XmlElementWrapper" ]
import java.util.List; import javax.xml.bind.annotation.XmlElementWrapper;
import java.util.*; import javax.xml.bind.annotation.*;
[ "java.util", "javax.xml" ]
java.util; javax.xml;
1,169,133
StreamEntryID xadd(String key, StreamEntryID id, Map<String, String> hash);
StreamEntryID xadd(String key, StreamEntryID id, Map<String, String> hash);
/** * XADD key ID field string [field string ...] * * @param key * @param id * @param hash * @return the ID of the added entry */
XADD key ID field string [field string ...]
xadd
{ "repo_name": "sohutv/cachecloud", "path": "cachecloud-client/cachecloud-jedis/src/main/java/redis/clients/jedis/commands/JedisClusterCommands.java", "license": "apache-2.0", "size": 13103 }
[ "java.util.Map", "redis.clients.jedis.StreamEntryID" ]
import java.util.Map; import redis.clients.jedis.StreamEntryID;
import java.util.*; import redis.clients.jedis.*;
[ "java.util", "redis.clients.jedis" ]
java.util; redis.clients.jedis;
641,364
public ImageInput getInput() throws IOException { if (input == null) { imageSet = getImageSet(); if (isHiresOnly()) { // get first element (= highest resolution) input = imageSet.getBiggest(); } else if (isLoresOnly()) { // enforced lores uses next smaller resolution input = imageSet.getNextSmaller(getExpectedSourceSize()); if (input == null) { // this is the smallest we have input = imageSet.getSmallest(); } } else { // autores: use next higher resolution input = imageSet.getNextBigger(getExpectedSourceSize()); if (input == null) { // this is the highest we have input = imageSet.getBiggest(); } } if (input == null || input.getMimetype() == null) { throw new FileOpException("Unable to load " + input); } logger.info("Planning to load: " + input); } return input; }
ImageInput function() throws IOException { if (input == null) { imageSet = getImageSet(); if (isHiresOnly()) { input = imageSet.getBiggest(); } else if (isLoresOnly()) { input = imageSet.getNextSmaller(getExpectedSourceSize()); if (input == null) { input = imageSet.getSmallest(); } } else { input = imageSet.getNextBigger(getExpectedSourceSize()); if (input == null) { input = imageSet.getBiggest(); } } if (input == null input.getMimetype() == null) { throw new FileOpException(STR + input); } logger.info(STR + input); } return input; }
/** * Returns the ImageInput to use. * * @return * @throws IOException */
Returns the ImageInput to use
getInput
{ "repo_name": "BackupTheBerlios/digilib", "path": "common/src/main/java/digilib/image/ImageJobDescription.java", "license": "lgpl-3.0", "size": 23826 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,361,111
public final void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { // parse flow parseInputValues(request); // write values to file writeStyleToFlow(); } // -------------------------------------------------------------------- // Private methods // --------------------------------------------------------------------
final void function(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { parseInputValues(request); writeStyleToFlow(); }
/** * Main servlet method. * @param request servlet request. * @param response servlet request. * @throws ServletException in servlet error. * @throws IOException in other case error. */
Main servlet method
service
{ "repo_name": "industral/WFW", "path": "src/java/com/siegerstein/wfw/framework/servlets/WriteFlow.java", "license": "mit", "size": 3586 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
1,932,829
public void setResourceAdapter(ResourceAdapter resourceAdapter) { this.resourceAdapter = resourceAdapter; }
void function(ResourceAdapter resourceAdapter) { this.resourceAdapter = resourceAdapter; }
/** * Set the JCA ResourceAdapter to manage endpoints for. */
Set the JCA ResourceAdapter to manage endpoints for
setResourceAdapter
{ "repo_name": "shivpun/spring-framework", "path": "spring-tx/src/main/java/org/springframework/jca/endpoint/GenericMessageEndpointManager.java", "license": "apache-2.0", "size": 12257 }
[ "javax.resource.spi.ResourceAdapter" ]
import javax.resource.spi.ResourceAdapter;
import javax.resource.spi.*;
[ "javax.resource" ]
javax.resource;
1,072,513
private void cmd_print(boolean printPreview) { // Get process defined for this tab int AD_Process_ID = m_curTab.getAD_Process_ID(); log.info("ID=" + AD_Process_ID); // No report defined if (AD_Process_ID == 0) { cmd_report(); return; } cmd_save(false); // int table_ID = m_curTab.getAD_Table_ID(); int record_ID = m_curTab.getRecord_ID(); ProcessInfo pi = new ProcessInfo (getTitle(), AD_Process_ID, table_ID, record_ID); pi.setAD_User_ID (Env.getAD_User_ID(m_ctx)); pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx)); pi.setPrintPreview(printPreview); ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI statusBar.setStatusLine(pi.getSummary(), pi.isError()); } // cmd_print
void function(boolean printPreview) { int AD_Process_ID = m_curTab.getAD_Process_ID(); log.info("ID=" + AD_Process_ID); if (AD_Process_ID == 0) { cmd_report(); return; } cmd_save(false); int record_ID = m_curTab.getRecord_ID(); ProcessInfo pi = new ProcessInfo (getTitle(), AD_Process_ID, table_ID, record_ID); pi.setAD_User_ID (Env.getAD_User_ID(m_ctx)); pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx)); pi.setPrintPreview(printPreview); ProcessCtl.process(this, m_curWindowNo, pi, null); statusBar.setStatusLine(pi.getSummary(), pi.isError()); }
/** * Print specific Report - or start default Report */
Print specific Report - or start default Report
cmd_print
{ "repo_name": "erpcya/adempierePOS", "path": "client/src/org/compiere/apps/APanel.java", "license": "gpl-2.0", "size": 86972 }
[ "org.compiere.process.ProcessInfo", "org.compiere.util.Env" ]
import org.compiere.process.ProcessInfo; import org.compiere.util.Env;
import org.compiere.process.*; import org.compiere.util.*;
[ "org.compiere.process", "org.compiere.util" ]
org.compiere.process; org.compiere.util;
1,378,499
@Test public void testReplaceValueEqualStoreEntryStoreAccessException() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "oldValue")); this.store = spy(fakeStore); doThrow(new StoreAccessException("")).when(this.store).compute(eq("key"), getAnyBiFunction(), getBooleanNullaryFunction()); final EhcacheWithLoaderWriter<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter); ehcache.replace("key", "oldValue", "newValue"); verify(this.store).compute(eq("key"), getAnyBiFunction(), getBooleanNullaryFunction()); verify(this.spiedResilienceStrategy) .replaceFailure(eq("key"), eq("oldValue"), eq("newValue"), any(StoreAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ReplaceOutcome.FAILURE)); }
void function() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", STR)); this.store = spy(fakeStore); doThrow(new StoreAccessException(STRkeySTRkey", STR, "newValueSTRkeySTRkey"), eq(STR), eq("newValue"), any(StoreAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ReplaceOutcome.FAILURE)); }
/** * Tests the effect of a {@link EhcacheWithLoaderWriter#replace(Object, Object, Object)} for * <ul> * <li>key with equal value present in {@code Store}</li> * <li>>{@code Store.compute} throws</li> * </ul> */
Tests the effect of a <code>EhcacheWithLoaderWriter#replace(Object, Object, Object)</code> for key with equal value present in Store >Store.compute throws
testReplaceValueEqualStoreEntryStoreAccessException
{ "repo_name": "akomakom/ehcache3", "path": "core/src/test/java/org/ehcache/core/EhcacheWithLoaderWriterBasicReplaceValueTest.java", "license": "apache-2.0", "size": 43771 }
[ "java.util.Collections", "java.util.EnumSet", "org.ehcache.core.spi.store.StoreAccessException", "org.ehcache.core.statistics.CacheOperationOutcomes", "org.mockito.Matchers", "org.mockito.Mockito" ]
import java.util.Collections; import java.util.EnumSet; import org.ehcache.core.spi.store.StoreAccessException; import org.ehcache.core.statistics.CacheOperationOutcomes; import org.mockito.Matchers; import org.mockito.Mockito;
import java.util.*; import org.ehcache.core.spi.store.*; import org.ehcache.core.statistics.*; import org.mockito.*;
[ "java.util", "org.ehcache.core", "org.mockito" ]
java.util; org.ehcache.core; org.mockito;
149,260
String name = check.getName(); List<Check> list = map.get(name); if (list == null) { list = new ArrayList<>(); map.put(name, list); } list.add(check); }
String name = check.getName(); List<Check> list = map.get(name); if (list == null) { list = new ArrayList<>(); map.put(name, list); } list.add(check); }
/** * Adds validation checks. */
Adds validation checks
add
{ "repo_name": "mohanaraosv/jodd", "path": "jodd-vtor/src/main/java/jodd/vtor/ValidationContext.java", "license": "bsd-2-clause", "size": 6621 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
543,480
protected boolean flush(ByteBuffer buf) throws IOException { int remaining = buf.remaining(); if ( remaining > 0 ) { int written = sc.write(buf); return written >= remaining; }else { return true; } }
boolean function(ByteBuffer buf) throws IOException { int remaining = buf.remaining(); if ( remaining > 0 ) { int written = sc.write(buf); return written >= remaining; }else { return true; } }
/** * Flushes the buffer to the network, non blocking * @param buf ByteBuffer * @return boolean true if the buffer has been emptied out, false otherwise * @throws IOException */
Flushes the buffer to the network, non blocking
flush
{ "repo_name": "wenzhucjy/tomcat_source", "path": "tomcat-8.0.9-sourcecode/java/org/apache/tomcat/util/net/SecureNioChannel.java", "license": "apache-2.0", "size": 23732 }
[ "java.io.IOException", "java.nio.ByteBuffer" ]
import java.io.IOException; import java.nio.ByteBuffer;
import java.io.*; import java.nio.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
680,439
private DriverMeta findDriverResources(Map<String, SparkSpecification> sparkSpecs, Map<String, MapReduceSpecification> mrSpecs, WorkflowSpecification spec) { // Find the resource requirements from the workflow with 768MB as minimum. // It is the largest memory and cores from all Spark and MapReduce programs inside the workflow Resources resources = new Resources(768); boolean hasSpark = false; for (WorkflowNode node : spec.getNodeIdMap().values()) { if (WorkflowNodeType.ACTION == node.getType()) { ScheduleProgramInfo programInfo = ((WorkflowActionNode) node).getProgram(); SchedulableProgramType programType = programInfo.getProgramType(); if (programType == SchedulableProgramType.SPARK || programType == SchedulableProgramType.MAPREDUCE) { // The program spec shouldn't be null, otherwise the Workflow is not valid Resources driverResources; if (programType == SchedulableProgramType.SPARK) { hasSpark = true; driverResources = sparkSpecs.get(programInfo.getProgramName()).getClientResources(); } else { driverResources = mrSpecs.get(programInfo.getProgramName()).getDriverResources(); } if (driverResources != null) { resources = max(resources, driverResources); } } } } return new DriverMeta(resources, hasSpark); }
DriverMeta function(Map<String, SparkSpecification> sparkSpecs, Map<String, MapReduceSpecification> mrSpecs, WorkflowSpecification spec) { Resources resources = new Resources(768); boolean hasSpark = false; for (WorkflowNode node : spec.getNodeIdMap().values()) { if (WorkflowNodeType.ACTION == node.getType()) { ScheduleProgramInfo programInfo = ((WorkflowActionNode) node).getProgram(); SchedulableProgramType programType = programInfo.getProgramType(); if (programType == SchedulableProgramType.SPARK programType == SchedulableProgramType.MAPREDUCE) { Resources driverResources; if (programType == SchedulableProgramType.SPARK) { hasSpark = true; driverResources = sparkSpecs.get(programInfo.getProgramName()).getClientResources(); } else { driverResources = mrSpecs.get(programInfo.getProgramName()).getDriverResources(); } if (driverResources != null) { resources = max(resources, driverResources); } } } } return new DriverMeta(resources, hasSpark); }
/** * Returns the {@link DriverMeta} which includes the resource requirement for the workflow runnable due to spark * or MapReduce driver resources requirement. {@link DriverMeta} also contain the information about * whether the workflow contains spark. */
Returns the <code>DriverMeta</code> which includes the resource requirement for the workflow runnable due to spark or MapReduce driver resources requirement. <code>DriverMeta</code> also contain the information about whether the workflow contains spark
findDriverResources
{ "repo_name": "caskdata/cdap", "path": "cdap-app-fabric/src/main/java/co/cask/cdap/internal/app/runtime/distributed/DistributedWorkflowProgramRunner.java", "license": "apache-2.0", "size": 9624 }
[ "co.cask.cdap.api.Resources", "co.cask.cdap.api.mapreduce.MapReduceSpecification", "co.cask.cdap.api.schedule.SchedulableProgramType", "co.cask.cdap.api.spark.SparkSpecification", "co.cask.cdap.api.workflow.ScheduleProgramInfo", "co.cask.cdap.api.workflow.WorkflowActionNode", "co.cask.cdap.api.workflow.WorkflowNode", "co.cask.cdap.api.workflow.WorkflowNodeType", "co.cask.cdap.api.workflow.WorkflowSpecification", "java.util.Map" ]
import co.cask.cdap.api.Resources; import co.cask.cdap.api.mapreduce.MapReduceSpecification; import co.cask.cdap.api.schedule.SchedulableProgramType; import co.cask.cdap.api.spark.SparkSpecification; import co.cask.cdap.api.workflow.ScheduleProgramInfo; import co.cask.cdap.api.workflow.WorkflowActionNode; import co.cask.cdap.api.workflow.WorkflowNode; import co.cask.cdap.api.workflow.WorkflowNodeType; import co.cask.cdap.api.workflow.WorkflowSpecification; import java.util.Map;
import co.cask.cdap.api.*; import co.cask.cdap.api.mapreduce.*; import co.cask.cdap.api.schedule.*; import co.cask.cdap.api.spark.*; import co.cask.cdap.api.workflow.*; import java.util.*;
[ "co.cask.cdap", "java.util" ]
co.cask.cdap; java.util;
519,066
public ServiceResponseWithHeaders<Void, PoolUpgradeOSHeaders> upgradeOS(String poolId, String targetOSVersion) throws BatchErrorException, IOException, IllegalArgumentException { if (poolId == null) { throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } if (targetOSVersion == null) { throw new IllegalArgumentException("Parameter targetOSVersion is required and cannot be null."); } final PoolUpgradeOSOptions poolUpgradeOSOptions = null; Integer timeout = null; String clientRequestId = null; Boolean returnClientRequestId = null; DateTime ocpDate = null; String ifMatch = null; String ifNoneMatch = null; DateTime ifModifiedSince = null; DateTime ifUnmodifiedSince = null; PoolUpgradeOSParameter poolUpgradeOSParameter = new PoolUpgradeOSParameter(); poolUpgradeOSParameter.withTargetOSVersion(targetOSVersion); DateTimeRfc1123 ocpDateConverted = null; if (ocpDate != null) { ocpDateConverted = new DateTimeRfc1123(ocpDate); } DateTimeRfc1123 ifModifiedSinceConverted = null; if (ifModifiedSince != null) { ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); } DateTimeRfc1123 ifUnmodifiedSinceConverted = null; if (ifUnmodifiedSince != null) { ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); } Call<ResponseBody> call = service.upgradeOS(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, poolUpgradeOSParameter, this.client.userAgent()); return upgradeOSDelegate(call.execute()); }
ServiceResponseWithHeaders<Void, PoolUpgradeOSHeaders> function(String poolId, String targetOSVersion) throws BatchErrorException, IOException, IllegalArgumentException { if (poolId == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } if (targetOSVersion == null) { throw new IllegalArgumentException(STR); } final PoolUpgradeOSOptions poolUpgradeOSOptions = null; Integer timeout = null; String clientRequestId = null; Boolean returnClientRequestId = null; DateTime ocpDate = null; String ifMatch = null; String ifNoneMatch = null; DateTime ifModifiedSince = null; DateTime ifUnmodifiedSince = null; PoolUpgradeOSParameter poolUpgradeOSParameter = new PoolUpgradeOSParameter(); poolUpgradeOSParameter.withTargetOSVersion(targetOSVersion); DateTimeRfc1123 ocpDateConverted = null; if (ocpDate != null) { ocpDateConverted = new DateTimeRfc1123(ocpDate); } DateTimeRfc1123 ifModifiedSinceConverted = null; if (ifModifiedSince != null) { ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); } DateTimeRfc1123 ifUnmodifiedSinceConverted = null; if (ifUnmodifiedSince != null) { ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); } Call<ResponseBody> call = service.upgradeOS(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, poolUpgradeOSParameter, this.client.userAgent()); return upgradeOSDelegate(call.execute()); }
/** * Upgrades the operating system of the specified pool. * * @param poolId The id of the pool to upgrade. * @param targetOSVersion The Azure Guest OS version to be installed on the virtual machines in the pool. * @throws BatchErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @throws IllegalArgumentException exception thrown from invalid parameters * @return the {@link ServiceResponseWithHeaders} object if successful. */
Upgrades the operating system of the specified pool
upgradeOS
{ "repo_name": "pomortaz/azure-sdk-for-java", "path": "azure-batch/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java", "license": "mit", "size": 237401 }
[ "com.microsoft.azure.batch.protocol.models.BatchErrorException", "com.microsoft.azure.batch.protocol.models.PoolUpgradeOSHeaders", "com.microsoft.azure.batch.protocol.models.PoolUpgradeOSOptions", "com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter", "com.microsoft.rest.DateTimeRfc1123", "com.microsoft.rest.ServiceResponseWithHeaders", "java.io.IOException", "org.joda.time.DateTime" ]
import com.microsoft.azure.batch.protocol.models.BatchErrorException; import com.microsoft.azure.batch.protocol.models.PoolUpgradeOSHeaders; import com.microsoft.azure.batch.protocol.models.PoolUpgradeOSOptions; import com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter; import com.microsoft.rest.DateTimeRfc1123; import com.microsoft.rest.ServiceResponseWithHeaders; import java.io.IOException; import org.joda.time.DateTime;
import com.microsoft.azure.batch.protocol.models.*; import com.microsoft.rest.*; import java.io.*; import org.joda.time.*;
[ "com.microsoft.azure", "com.microsoft.rest", "java.io", "org.joda.time" ]
com.microsoft.azure; com.microsoft.rest; java.io; org.joda.time;
657,946
private void setupGenericPlayPen(PlayPen pp, Attributes attributes) { String zoomLevel = attributes.getValue("zoom"); //$NON-NLS-1$ if (zoomLevel != null) { pp.setZoom(Double.parseDouble(zoomLevel)); } String viewportX = attributes.getValue("viewportX"); //$NON-NLS-1$ String viewportY = attributes.getValue("viewportY"); //$NON-NLS-1$ if (viewportX != null && viewportY != null) { Point viewPoint = new Point(Integer.parseInt(viewportX), Integer.parseInt(viewportY)); pp.setViewPosition(viewPoint); } logger.debug("Viewport position is " + pp.getViewPosition()); //$NON-NLS-1$ }
void function(PlayPen pp, Attributes attributes) { String zoomLevel = attributes.getValue("zoom"); if (zoomLevel != null) { pp.setZoom(Double.parseDouble(zoomLevel)); } String viewportX = attributes.getValue(STR); String viewportY = attributes.getValue(STR); if (viewportX != null && viewportY != null) { Point viewPoint = new Point(Integer.parseInt(viewportX), Integer.parseInt(viewportY)); pp.setViewPosition(viewPoint); } logger.debug(STR + pp.getViewPosition()); }
/** * Sets up everything in common between all types of playpens. * * @param pp * the play pen to set up * @param attributes * The attributes from the start tag */
Sets up everything in common between all types of playpens
setupGenericPlayPen
{ "repo_name": "amitkr/power-architect", "path": "src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java", "license": "gpl-3.0", "size": 87256 }
[ "java.awt.Point", "org.xml.sax.Attributes" ]
import java.awt.Point; import org.xml.sax.Attributes;
import java.awt.*; import org.xml.sax.*;
[ "java.awt", "org.xml.sax" ]
java.awt; org.xml.sax;
2,011,614
// =========================================================================== // Create/Open/Delete Helpers // =========================================================================== void logFileSystemState(final Log LOG) throws IOException { FSUtils.logFileSystemState(fs, this.getRegionDir(), LOG); }
void logFileSystemState(final Log LOG) throws IOException { FSUtils.logFileSystemState(fs, this.getRegionDir(), LOG); }
/** * Log the current state of the region * @param LOG log to output information * @throws IOException if an unexpected exception occurs */
Log the current state of the region
logFileSystemState
{ "repo_name": "tenggyut/HIndex", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java", "license": "apache-2.0", "size": 40886 }
[ "java.io.IOException", "org.apache.commons.logging.Log", "org.apache.hadoop.hbase.util.FSUtils" ]
import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.hadoop.hbase.util.FSUtils;
import java.io.*; import org.apache.commons.logging.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "org.apache.commons", "org.apache.hadoop" ]
java.io; org.apache.commons; org.apache.hadoop;
1,139,368
public synchronized void messageReceived(final NextFilter nextFilter, final IoBuffer buf) throws ProxyAuthException { LOGGER.debug(" messageReceived()"); IoBufferDecoder decoder = (IoBufferDecoder) getSession().getAttribute( DECODER); if (decoder == null) { decoder = new IoBufferDecoder(HTTP_DELIMITER); getSession().setAttribute(DECODER, decoder); } try { if (parsedResponse == null) { responseData = decoder.decodeFully(buf); if (responseData == null) { return; } // Handle the response String responseHeader = responseData .getString(getProxyIoSession().getCharset() .newDecoder()); entityBodyStartPosition = responseData.position(); LOGGER.debug(" response header received:\n{}", responseHeader .replace("\r", "\\r").replace("\n", "\\n\n")); // Parse the response parsedResponse = decodeResponse(responseHeader); // Is handshake complete ? if (parsedResponse.getStatusCode() == 200 || (parsedResponse.getStatusCode() >= 300 && parsedResponse .getStatusCode() <= 307)) { buf.position(0); setHandshakeComplete(); return; } String contentLengthHeader = StringUtilities .getSingleValuedHeader(parsedResponse.getHeaders(), "Content-Length"); if (contentLengthHeader == null) { contentLength = 0; } else { contentLength = Integer .parseInt(contentLengthHeader.trim()); decoder.setContentLength(contentLength, true); } } if (!hasChunkedData) { if (contentLength > 0) { IoBuffer tmp = decoder.decodeFully(buf); if (tmp == null) { return; } responseData.setAutoExpand(true); responseData.put(tmp); contentLength = 0; } if ("chunked".equalsIgnoreCase(StringUtilities .getSingleValuedHeader(parsedResponse.getHeaders(), "Transfer-Encoding"))) { // Handle Transfer-Encoding: Chunked LOGGER.debug("Retrieving additional http response chunks"); hasChunkedData = true; waitingChunkedData = true; } } if (hasChunkedData) { // Read chunks while (waitingChunkedData) { if (contentLength == 0) { decoder.setDelimiter(CRLF_DELIMITER, false); IoBuffer tmp = decoder.decodeFully(buf); if (tmp == null) { return; } String chunkSize = tmp.getString(getProxyIoSession() .getCharset().newDecoder()); int pos = chunkSize.indexOf(';'); if (pos >= 0) { chunkSize = chunkSize.substring(0, pos); } else { chunkSize = chunkSize.substring(0, chunkSize .length() - 2); } contentLength = Integer.decode("0x" + chunkSize); if (contentLength > 0) { contentLength += 2; // also read chunk's trailing CRLF decoder.setContentLength(contentLength, true); } } if (contentLength == 0) { waitingChunkedData = false; waitingFooters = true; entityBodyLimitPosition = responseData.position(); break; } IoBuffer tmp = decoder.decodeFully(buf); if (tmp == null) { return; } contentLength = 0; responseData.put(tmp); buf.position(buf.position()); } // Read footers while (waitingFooters) { decoder.setDelimiter(CRLF_DELIMITER, false); IoBuffer tmp = decoder.decodeFully(buf); if (tmp == null) { return; } if (tmp.remaining() == 2) { waitingFooters = false; break; } // add footer to headers String footer = tmp.getString(getProxyIoSession() .getCharset().newDecoder()); String[] f = footer.split(":\\s?", 2); StringUtilities.addValueToHeader(parsedResponse .getHeaders(), f[0], f[1], false); responseData.put(tmp); responseData.put(CRLF_DELIMITER); } } responseData.flip(); LOGGER.debug(" end of response received:\n{}", responseData.getString(getProxyIoSession().getCharset() .newDecoder())); // Retrieve entity body content responseData.position(entityBodyStartPosition); responseData.limit(entityBodyLimitPosition); parsedResponse.setBody(responseData.getString(getProxyIoSession() .getCharset().newDecoder())); // Free the response buffer responseData.free(); responseData = null; handleResponse(parsedResponse); parsedResponse = null; hasChunkedData = false; contentLength = -1; decoder.setDelimiter(HTTP_DELIMITER, true); if (!isHandshakeComplete()) { doHandshake(nextFilter); } } catch (Exception ex) { if (ex instanceof ProxyAuthException) { throw ((ProxyAuthException) ex); } throw new ProxyAuthException("Handshake failed", ex); } }
synchronized void function(final NextFilter nextFilter, final IoBuffer buf) throws ProxyAuthException { LOGGER.debug(STR); IoBufferDecoder decoder = (IoBufferDecoder) getSession().getAttribute( DECODER); if (decoder == null) { decoder = new IoBufferDecoder(HTTP_DELIMITER); getSession().setAttribute(DECODER, decoder); } try { if (parsedResponse == null) { responseData = decoder.decodeFully(buf); if (responseData == null) { return; } String responseHeader = responseData .getString(getProxyIoSession().getCharset() .newDecoder()); entityBodyStartPosition = responseData.position(); LOGGER.debug(STR, responseHeader .replace("\r", "\\r").replace("\n", "\\n\n")); parsedResponse = decodeResponse(responseHeader); if (parsedResponse.getStatusCode() == 200 (parsedResponse.getStatusCode() >= 300 && parsedResponse .getStatusCode() <= 307)) { buf.position(0); setHandshakeComplete(); return; } String contentLengthHeader = StringUtilities .getSingleValuedHeader(parsedResponse.getHeaders(), STR); if (contentLengthHeader == null) { contentLength = 0; } else { contentLength = Integer .parseInt(contentLengthHeader.trim()); decoder.setContentLength(contentLength, true); } } if (!hasChunkedData) { if (contentLength > 0) { IoBuffer tmp = decoder.decodeFully(buf); if (tmp == null) { return; } responseData.setAutoExpand(true); responseData.put(tmp); contentLength = 0; } if (STR.equalsIgnoreCase(StringUtilities .getSingleValuedHeader(parsedResponse.getHeaders(), STR))) { LOGGER.debug(STR); hasChunkedData = true; waitingChunkedData = true; } } if (hasChunkedData) { while (waitingChunkedData) { if (contentLength == 0) { decoder.setDelimiter(CRLF_DELIMITER, false); IoBuffer tmp = decoder.decodeFully(buf); if (tmp == null) { return; } String chunkSize = tmp.getString(getProxyIoSession() .getCharset().newDecoder()); int pos = chunkSize.indexOf(';'); if (pos >= 0) { chunkSize = chunkSize.substring(0, pos); } else { chunkSize = chunkSize.substring(0, chunkSize .length() - 2); } contentLength = Integer.decode("0x" + chunkSize); if (contentLength > 0) { contentLength += 2; decoder.setContentLength(contentLength, true); } } if (contentLength == 0) { waitingChunkedData = false; waitingFooters = true; entityBodyLimitPosition = responseData.position(); break; } IoBuffer tmp = decoder.decodeFully(buf); if (tmp == null) { return; } contentLength = 0; responseData.put(tmp); buf.position(buf.position()); } while (waitingFooters) { decoder.setDelimiter(CRLF_DELIMITER, false); IoBuffer tmp = decoder.decodeFully(buf); if (tmp == null) { return; } if (tmp.remaining() == 2) { waitingFooters = false; break; } String footer = tmp.getString(getProxyIoSession() .getCharset().newDecoder()); String[] f = footer.split(":\\s?", 2); StringUtilities.addValueToHeader(parsedResponse .getHeaders(), f[0], f[1], false); responseData.put(tmp); responseData.put(CRLF_DELIMITER); } } responseData.flip(); LOGGER.debug(STR, responseData.getString(getProxyIoSession().getCharset() .newDecoder())); responseData.position(entityBodyStartPosition); responseData.limit(entityBodyLimitPosition); parsedResponse.setBody(responseData.getString(getProxyIoSession() .getCharset().newDecoder())); responseData.free(); responseData = null; handleResponse(parsedResponse); parsedResponse = null; hasChunkedData = false; contentLength = -1; decoder.setDelimiter(HTTP_DELIMITER, true); if (!isHandshakeComplete()) { doHandshake(nextFilter); } } catch (Exception ex) { if (ex instanceof ProxyAuthException) { throw ((ProxyAuthException) ex); } throw new ProxyAuthException(STR, ex); } }
/** * Handles incoming data during the handshake process. Should consume only the * handshake data from the buffer, leaving any extra data in place. * * @param nextFilter the next filter * @param buf the buffer holding received data */
Handles incoming data during the handshake process. Should consume only the handshake data from the buffer, leaving any extra data in place
messageReceived
{ "repo_name": "mgherghe/gateway", "path": "mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractHttpLogicHandler.java", "license": "apache-2.0", "size": 15609 }
[ "org.apache.mina.core.buffer.IoBuffer", "org.apache.mina.core.filterchain.IoFilter", "org.apache.mina.proxy.ProxyAuthException", "org.apache.mina.proxy.utils.IoBufferDecoder", "org.apache.mina.proxy.utils.StringUtilities" ]
import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.filterchain.IoFilter; import org.apache.mina.proxy.ProxyAuthException; import org.apache.mina.proxy.utils.IoBufferDecoder; import org.apache.mina.proxy.utils.StringUtilities;
import org.apache.mina.core.buffer.*; import org.apache.mina.core.filterchain.*; import org.apache.mina.proxy.*; import org.apache.mina.proxy.utils.*;
[ "org.apache.mina" ]
org.apache.mina;
387,855
public State getState() { return mState; } public SwipeLayout(Context context) { this(context,null); } public SwipeLayout(Context context, AttributeSet attrs) { this(context, attrs,0); } public SwipeLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mViewDragHelper =ViewDragHelper.create(this, 1.0f, new SwipeCallback() ); }
State function() { return mState; } public SwipeLayout(Context context) { this(context,null); } public SwipeLayout(Context context, AttributeSet attrs) { this(context, attrs,0); } public SwipeLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mViewDragHelper =ViewDragHelper.create(this, 1.0f, new SwipeCallback() ); }
/** * get the current state * @return */
get the current state
getState
{ "repo_name": "Chyrain/MCSS2.x-libraries", "path": "SwipeLayout/src/bupt/freeshare/swipelayoutlibrary/SwipeLayout.java", "license": "gpl-3.0", "size": 9691 }
[ "android.content.Context", "android.support.v4.widget.ViewDragHelper", "android.util.AttributeSet" ]
import android.content.Context; import android.support.v4.widget.ViewDragHelper; import android.util.AttributeSet;
import android.content.*; import android.support.v4.widget.*; import android.util.*;
[ "android.content", "android.support", "android.util" ]
android.content; android.support; android.util;
2,802,225
public TermVectorsRequest perFieldAnalyzer(Map<String, String> perFieldAnalyzer) { this.perFieldAnalyzer = perFieldAnalyzer != null && perFieldAnalyzer.size() != 0 ? new HashMap<>(perFieldAnalyzer) : null; return this; }
TermVectorsRequest function(Map<String, String> perFieldAnalyzer) { this.perFieldAnalyzer = perFieldAnalyzer != null && perFieldAnalyzer.size() != 0 ? new HashMap<>(perFieldAnalyzer) : null; return this; }
/** * Override the analyzer used at each field when generating term vectors. */
Override the analyzer used at each field when generating term vectors
perFieldAnalyzer
{ "repo_name": "nknize/elasticsearch", "path": "server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java", "license": "apache-2.0", "size": 24015 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,702,722
public static boolean isActionDown(MotionEvent e) { return e.getActionMasked() == MotionEvent.ACTION_DOWN; }
static boolean function(MotionEvent e) { return e.getActionMasked() == MotionEvent.ACTION_DOWN; }
/** * Returns true if event was triggered by a finger or stylus touch. */
Returns true if event was triggered by a finger or stylus touch
isActionDown
{ "repo_name": "xorware/android_frameworks_base", "path": "packages/DocumentsUI/src/com/android/documentsui/Events.java", "license": "apache-2.0", "size": 6647 }
[ "android.view.MotionEvent" ]
import android.view.MotionEvent;
import android.view.*;
[ "android.view" ]
android.view;
1,772,370
public NameComponent[] toGiop(Name name) throws InvalidName { return transformer.toName(name.toString()); }
NameComponent[] function(Name name) throws InvalidName { return transformer.toName(name.toString()); }
/** * Convert the {@link Name} into array of the name components, required to the * CORBA naming service. First the string representation is obtained, then * it is converted using parsing rules of the CORBA name. * * @param name * then name to convert * @return the converted array of components. */
Convert the <code>Name</code> into array of the name components, required to the CORBA naming service. First the string representation is obtained, then it is converted using parsing rules of the CORBA name
toGiop
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/gnu/javax/naming/giop/ContextContinuation.java", "license": "gpl-2.0", "size": 29695 }
[ "javax.naming.Name", "org.omg.CosNaming" ]
import javax.naming.Name; import org.omg.CosNaming;
import javax.naming.*; import org.omg.*;
[ "javax.naming", "org.omg" ]
javax.naming; org.omg;
2,794,657
protected void scheduleRunAsync(Runnable runnable, Time delay) { scheduleRunAsync(runnable, delay.getSize(), delay.getUnit()); }
void function(Runnable runnable, Time delay) { scheduleRunAsync(runnable, delay.getSize(), delay.getUnit()); }
/** * Execute the runnable in the main thread of the underlying RPC endpoint, with a delay of the * given number of milliseconds. * * @param runnable Runnable to be executed * @param delay The delay after which the runnable will be executed */
Execute the runnable in the main thread of the underlying RPC endpoint, with a delay of the given number of milliseconds
scheduleRunAsync
{ "repo_name": "kl0u/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcEndpoint.java", "license": "apache-2.0", "size": 17633 }
[ "org.apache.flink.api.common.time.Time" ]
import org.apache.flink.api.common.time.Time;
import org.apache.flink.api.common.time.*;
[ "org.apache.flink" ]
org.apache.flink;
2,573,366
public void setBatchClassList(List<BatchClassDTO> batchClassList) { this.batchClassList = batchClassList; }
void function(List<BatchClassDTO> batchClassList) { this.batchClassList = batchClassList; }
/** * To set Batch Class List. * * @param batchClassList List<BatchClassDTO> */
To set Batch Class List
setBatchClassList
{ "repo_name": "kuzavas/ephesoft", "path": "dcma-gwt/dcma-gwt-admin/src/main/java/com/ephesoft/dcma/gwt/admin/bm/client/BatchClassManagementController.java", "license": "agpl-3.0", "size": 26462 }
[ "com.ephesoft.dcma.gwt.core.shared.BatchClassDTO", "java.util.List" ]
import com.ephesoft.dcma.gwt.core.shared.BatchClassDTO; import java.util.List;
import com.ephesoft.dcma.gwt.core.shared.*; import java.util.*;
[ "com.ephesoft.dcma", "java.util" ]
com.ephesoft.dcma; java.util;
603,790
if (v.length < 2) { throw new EvaluationException(ErrorEval.NA); } // very naive impl, may need to be optimized int[] counts = new int[v.length]; Arrays.fill(counts, 1); for (int i = 0, iSize = v.length; i < iSize; i++) { for (int j = i + 1, jSize = v.length; j < jSize; j++) { if (v[i] == v[j]) counts[i]++; } } double maxv = 0; int maxc = 0; for (int i = 0, iSize = counts.length; i < iSize; i++) { if (counts[i] > maxc) { maxv = v[i]; maxc = counts[i]; } } if (maxc > 1) { return maxv; } throw new EvaluationException(ErrorEval.NA); }
if (v.length < 2) { throw new EvaluationException(ErrorEval.NA); } int[] counts = new int[v.length]; Arrays.fill(counts, 1); for (int i = 0, iSize = v.length; i < iSize; i++) { for (int j = i + 1, jSize = v.length; j < jSize; j++) { if (v[i] == v[j]) counts[i]++; } } double maxv = 0; int maxc = 0; for (int i = 0, iSize = counts.length; i < iSize; i++) { if (counts[i] > maxc) { maxv = v[i]; maxc = counts[i]; } } if (maxc > 1) { return maxv; } throw new EvaluationException(ErrorEval.NA); }
/** * if v is zero length or contains no duplicates, return value is * Double.NaN. Else returns the value that occurs most times and if there is * a tie, returns the first such value. * * @param v */
if v is zero length or contains no duplicates, return value is Double.NaN. Else returns the value that occurs most times and if there is a tie, returns the first such value
evaluate
{ "repo_name": "lvweiwolf/poi-3.16", "path": "src/java/org/apache/poi/ss/formula/functions/Mode.java", "license": "apache-2.0", "size": 4409 }
[ "java.util.Arrays", "org.apache.poi.ss.formula.eval.ErrorEval", "org.apache.poi.ss.formula.eval.EvaluationException" ]
import java.util.Arrays; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.EvaluationException;
import java.util.*; import org.apache.poi.ss.formula.eval.*;
[ "java.util", "org.apache.poi" ]
java.util; org.apache.poi;
1,160,375
@Test public void testBatching() throws IOException, GeneralSecurityException { Insert mockInsert = mock(Insert.class); when(mockFactory.getBigQuery(any(Configuration.class))).thenReturn(mockBigQuery); when(mockInsert.setProjectId(jobProjectId)).thenReturn(mockInsert); when(mockBigQueryJobs.insert( eq(jobProjectId), eq(getExpectedJob()), any(ByteArrayContent.class))) .thenReturn(mockInsert); when(mockInsert.execute()).thenReturn(jobReturn); // Get the RecordWriter. BigQueryRecordWriter<LongWritable, JsonObject> recordWriter = new BigQueryRecordWriter<>( mockFactory, new Configuration(), progressable, fields, jobProjectId, getSampleTableRef(), 250); // Get the RecordWriter. // Write the key, value pair. callWrite(recordWriter, 15); // Close the RecordWriter. recordWriter.close(mockContext); // Check that the proper calls were sent to the BigQuery. verify(mockFactory, times(1)).getBigQuery(any(Configuration.class)); verify(mockBigQuery, times(6)).jobs(); verify(mockBigQueryJobs, times(2)) .insert(eq(jobProjectId), eq(getExpectedJob()), argThat(new IsNumRecords(7))); verify(mockBigQueryJobs).insert( eq(jobProjectId), eq(getExpectedJob()), argThat(new IsNumRecords(1))); verify(mockJobsGet, times(3)).execute(); verify(mockBigQueryJobs, times(3)).get(eq(jobProjectId), any(String.class)); }
void function() throws IOException, GeneralSecurityException { Insert mockInsert = mock(Insert.class); when(mockFactory.getBigQuery(any(Configuration.class))).thenReturn(mockBigQuery); when(mockInsert.setProjectId(jobProjectId)).thenReturn(mockInsert); when(mockBigQueryJobs.insert( eq(jobProjectId), eq(getExpectedJob()), any(ByteArrayContent.class))) .thenReturn(mockInsert); when(mockInsert.execute()).thenReturn(jobReturn); BigQueryRecordWriter<LongWritable, JsonObject> recordWriter = new BigQueryRecordWriter<>( mockFactory, new Configuration(), progressable, fields, jobProjectId, getSampleTableRef(), 250); callWrite(recordWriter, 15); recordWriter.close(mockContext); verify(mockFactory, times(1)).getBigQuery(any(Configuration.class)); verify(mockBigQuery, times(6)).jobs(); verify(mockBigQueryJobs, times(2)) .insert(eq(jobProjectId), eq(getExpectedJob()), argThat(new IsNumRecords(7))); verify(mockBigQueryJobs).insert( eq(jobProjectId), eq(getExpectedJob()), argThat(new IsNumRecords(1))); verify(mockJobsGet, times(3)).execute(); verify(mockBigQueryJobs, times(3)).get(eq(jobProjectId), any(String.class)); }
/** * Tests the batching of the write method of BigQueryRecordWriter. */
Tests the batching of the write method of BigQueryRecordWriter
testBatching
{ "repo_name": "ravwojdyla/bigdata-interop", "path": "bigquery/src/test/java/com/google/cloud/hadoop/io/bigquery/BigQueryRecordWriterTest.java", "license": "apache-2.0", "size": 14984 }
[ "com.google.api.client.http.ByteArrayContent", "com.google.api.services.bigquery.Bigquery", "com.google.gson.JsonObject", "java.io.IOException", "java.security.GeneralSecurityException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.io.LongWritable", "org.mockito.Mockito" ]
import com.google.api.client.http.ByteArrayContent; import com.google.api.services.bigquery.Bigquery; import com.google.gson.JsonObject; import java.io.IOException; import java.security.GeneralSecurityException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.LongWritable; import org.mockito.Mockito;
import com.google.api.client.http.*; import com.google.api.services.bigquery.*; import com.google.gson.*; import java.io.*; import java.security.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; import org.mockito.*;
[ "com.google.api", "com.google.gson", "java.io", "java.security", "org.apache.hadoop", "org.mockito" ]
com.google.api; com.google.gson; java.io; java.security; org.apache.hadoop; org.mockito;
351,399
private void populateNameTypes(Authority authority) { view.nameTypeCombo.removeAllItems(); List<NameType> ntList = new ArrayList<NameType>(); Authority.NameTypes authorityNameTypes = authority.getNameTypes(); if (authorityNameTypes != null) { for (Authority.NameTypes.NameType nt : authorityNameTypes.getNameType()) { NameType nameType = (NameType) nt.getRef(); ntList.add(nameType); }
void function(Authority authority) { view.nameTypeCombo.removeAllItems(); List<NameType> ntList = new ArrayList<NameType>(); Authority.NameTypes authorityNameTypes = authority.getNameTypes(); if (authorityNameTypes != null) { for (Authority.NameTypes.NameType nt : authorityNameTypes.getNameType()) { NameType nameType = (NameType) nt.getRef(); ntList.add(nameType); }
/** * Sets the name types in the nameTypeCombo to those associated with authority. * * @param authority */
Sets the name types in the nameTypeCombo to those associated with authority
populateNameTypes
{ "repo_name": "ajenhl/eats", "path": "client/java/lookup/src/uk/ac/kcl/cch/eats/lookup/LookupController.java", "license": "gpl-3.0", "size": 27508 }
[ "java.util.ArrayList", "java.util.List", "uk.ac.kcl.cch.eats.eatsml.Authority", "uk.ac.kcl.cch.eats.eatsml.NameTypes" ]
import java.util.ArrayList; import java.util.List; import uk.ac.kcl.cch.eats.eatsml.Authority; import uk.ac.kcl.cch.eats.eatsml.NameTypes;
import java.util.*; import uk.ac.kcl.cch.eats.eatsml.*;
[ "java.util", "uk.ac.kcl" ]
java.util; uk.ac.kcl;
2,122,627
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = "") @SimpleProperty(userVisible = false, description = "This is the display name of the installed application in the phone." + "If the AppName is blank, it will be set to the name of the project when the project is built.") public void AppName(String aName) { // We don't actually need to do anything. }
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = STRThis is the display name of the installed application in the phone.STRIf the AppName is blank, it will be set to the name of the project when the project is built.") void function(String aName) { }
/** * This is the display name of the installed application in the phone. If the `AppName` is blank, * it will be set to the name of the project when the project is built. * * @param aName the display name of the installed application in the phone */
This is the display name of the installed application in the phone. If the `AppName` is blank, it will be set to the name of the project when the project is built
AppName
{ "repo_name": "kkashi01/appinventor-sources", "path": "appinventor/components/src/com/google/appinventor/components/runtime/Form.java", "license": "apache-2.0", "size": 107650 }
[ "com.google.appinventor.components.annotations.DesignerProperty", "com.google.appinventor.components.common.PropertyTypeConstants" ]
import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*;
[ "com.google.appinventor" ]
com.google.appinventor;
1,352,122
public GuacamoleTunnel assignGuacamoleTunnel(final GuacamoleSocket socket, String connectionID) { // Create tunnel with given socket this.tunnel = new AbstractGuacamoleTunnel() {
GuacamoleTunnel function(final GuacamoleSocket socket, String connectionID) { this.tunnel = new AbstractGuacamoleTunnel() {
/** * Associates a new GuacamoleTunnel with this connection record using the * given socket. * * @param socket * The GuacamoleSocket to use to create the tunnel associated with this * connection record. * * @param connectionID * The connection ID assigned to this connection by guacd. * * @return * The newly-created tunnel associated with this connection record. */
Associates a new GuacamoleTunnel with this connection record using the given socket
assignGuacamoleTunnel
{ "repo_name": "mike-jumper/incubator-guacamole-client", "path": "extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java", "license": "apache-2.0", "size": 15389 }
[ "org.apache.guacamole.net.AbstractGuacamoleTunnel", "org.apache.guacamole.net.GuacamoleSocket", "org.apache.guacamole.net.GuacamoleTunnel" ]
import org.apache.guacamole.net.AbstractGuacamoleTunnel; import org.apache.guacamole.net.GuacamoleSocket; import org.apache.guacamole.net.GuacamoleTunnel;
import org.apache.guacamole.net.*;
[ "org.apache.guacamole" ]
org.apache.guacamole;
1,641,731
@Override public boolean hasPositiveValue() { boolean hasPositive = false; for (Money money : this) { if (money.isPositive()) { hasPositive = true; } } return hasPositive; }
boolean function() { boolean hasPositive = false; for (Money money : this) { if (money.isPositive()) { hasPositive = true; } } return hasPositive; }
/** * Checks of this object has positive <code>Money</code> objects. * * @return <code>boolean</code> value */
Checks of this object has positive <code>Money</code> objects
hasPositiveValue
{ "repo_name": "ShaunPlummer/daytron-money", "path": "src/main/java/com/github/daytron/daytronmoney/collection/MoneyArrayList.java", "license": "mit", "size": 8306 }
[ "com.github.daytron.daytronmoney.currency.Money" ]
import com.github.daytron.daytronmoney.currency.Money;
import com.github.daytron.daytronmoney.currency.*;
[ "com.github.daytron" ]
com.github.daytron;
2,459,384
private static void createTrueFalseGlobalProperties() { GlobalProperty trueConceptGlobalProperty = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_TRUE_CONCEPT, "7", "Concept id of the concept defining the TRUE boolean concept"); GlobalProperty falseConceptGlobalProperty = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_FALSE_CONCEPT, "8", "Concept id of the concept defining the TRUE boolean concept"); Context.getAdministrationService().saveGlobalProperty(trueConceptGlobalProperty); Context.getAdministrationService().saveGlobalProperty(falseConceptGlobalProperty); }
static void function() { GlobalProperty trueConceptGlobalProperty = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_TRUE_CONCEPT, "7", STR); GlobalProperty falseConceptGlobalProperty = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_FALSE_CONCEPT, "8", STR); Context.getAdministrationService().saveGlobalProperty(trueConceptGlobalProperty); Context.getAdministrationService().saveGlobalProperty(falseConceptGlobalProperty); }
/** * Utility method that creates the global properties 'concept.true' and 'concept.false' */
Utility method that creates the global properties 'concept.true' and 'concept.false'
createTrueFalseGlobalProperties
{ "repo_name": "MitchellBot/openmrs-core", "path": "api/src/test/java/org/openmrs/api/ConceptServiceTest.java", "license": "mpl-2.0", "size": 161875 }
[ "org.openmrs.GlobalProperty", "org.openmrs.api.context.Context", "org.openmrs.util.OpenmrsConstants" ]
import org.openmrs.GlobalProperty; import org.openmrs.api.context.Context; import org.openmrs.util.OpenmrsConstants;
import org.openmrs.*; import org.openmrs.api.context.*; import org.openmrs.util.*;
[ "org.openmrs", "org.openmrs.api", "org.openmrs.util" ]
org.openmrs; org.openmrs.api; org.openmrs.util;
793,922
public synchronized void save() throws IOException { BufferedWriter writer = null; // Start w/no writer try { // Then try ... writer = new BufferedWriter(new FileWriter(file)); // Create a writer Document doc; // As for the doc... synchronized (DOCUMENT_BUILDER) { // Using the document builder... doc = DOCUMENT_BUILDER.newDocument(); // Create an empty document } Node root = toXML(doc); // Convert this config to XML doc.appendChild(root); // Add it to the doc DOMSource source = new DOMSource(doc); // Use the source Luke StreamResult result = new StreamResult(writer); // And serialize it to the writer TRANSFORMER.transform(source, result); // Serialize } catch (TransformerException ex) { throw new IllegalStateException("Unexpected TransformerException: " + ex.getMessage()); } finally { if (writer != null) { try { // And if we got a writer, try ... writer.close(); // to close it } catch (IOException ignore) { } // Ignoring any error } } }
synchronized void function() throws IOException { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file)); Document doc; synchronized (DOCUMENT_BUILDER) { doc = DOCUMENT_BUILDER.newDocument(); } Node root = toXML(doc); doc.appendChild(root); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(writer); TRANSFORMER.transform(source, result); } catch (TransformerException ex) { throw new IllegalStateException(STR + ex.getMessage()); } finally { if (writer != null) { try { writer.close(); } catch (IOException ignore) { } } } }
/** * Save the configuration. * * @throws IOException if an I/O error occurs. */
Save the configuration
save
{ "repo_name": "lewismc/oodt", "path": "grid/src/main/java/org/apache/oodt/grid/Configuration.java", "license": "apache-2.0", "size": 20596 }
[ "java.io.BufferedWriter", "java.io.FileWriter", "java.io.IOException", "javax.xml.transform.TransformerException", "javax.xml.transform.dom.DOMSource", "javax.xml.transform.stream.StreamResult", "org.w3c.dom.Document", "org.w3c.dom.Node" ]
import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import javax.xml.transform.TransformerException; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.w3c.dom.Node;
import java.io.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.stream.*; import org.w3c.dom.*;
[ "java.io", "javax.xml", "org.w3c.dom" ]
java.io; javax.xml; org.w3c.dom;
466,072
public static OntologyMapperPair<EcoMapper> createEcoMapper(OWLOntologyManager m) throws OWLException, IOException { ParserWrapper p = new ParserWrapper(); p.setManager(m); return createEcoMapper(p); }
static OntologyMapperPair<EcoMapper> function(OWLOntologyManager m) throws OWLException, IOException { ParserWrapper p = new ParserWrapper(); p.setManager(m); return createEcoMapper(p); }
/** * Create an instance of a {@link EcoMapper}. Uses a the manager to load ECO via the * PURL. Load mappings using the PURL. * @param m * * @return mapper pair * @throws OWLException * @throws IOException * * @see EcoMapper#ECO_PURL * @see EcoMapper#ECO_MAPPING_PURL */
Create an instance of a <code>EcoMapper</code>. Uses a the manager to load ECO via the PURL. Load mappings using the PURL
createEcoMapper
{ "repo_name": "fbastian/owltools", "path": "OWLTools-Annotation/src/main/java/owltools/gaf/eco/EcoMapperFactory.java", "license": "bsd-3-clause", "size": 16891 }
[ "java.io.IOException", "org.semanticweb.owlapi.model.OWLException", "org.semanticweb.owlapi.model.OWLOntologyManager" ]
import java.io.IOException; import org.semanticweb.owlapi.model.OWLException; import org.semanticweb.owlapi.model.OWLOntologyManager;
import java.io.*; import org.semanticweb.owlapi.model.*;
[ "java.io", "org.semanticweb.owlapi" ]
java.io; org.semanticweb.owlapi;
1,120,083
public void writeFields(String[] fields) throws IOException { if (newWriter) { this.newWriter = false; } else { this.newLine(); } for (int i = 0; i < fields.length; i++) { this.writeField(fields[i]); } }
void function(String[] fields) throws IOException { if (newWriter) { this.newWriter = false; } else { this.newLine(); } for (int i = 0; i < fields.length; i++) { this.writeField(fields[i]); } }
/** * Writes a line of fields to the writer. A new line is automatically added * if beyond the first call to this method. This is a convenience method. * * @param fields * fields to output * @throws IOException * on general I/O error */
Writes a line of fields to the writer. A new line is automatically added if beyond the first call to this method. This is a convenience method
writeFields
{ "repo_name": "gspandy/divconq", "path": "divconq.core/src/main/java/divconq/util/CSVWriter.java", "license": "apache-2.0", "size": 5182 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,222,045
private void analyseGroups (ArrayList<ArrayList<Integer>> groups) { // Initializing the auxiliary variables int sum = 0; // For each group of points for (ArrayList<Integer> group: groups) { sum = 0; log.debug(""); log.debug(group.toString()); // Estimating the sum of the point signs for (Integer index: group) sum += activeMarker[index]; // If all rising if (sum == group.size()) { log.debug("All Rising"); allRisingAnalysis(group); } // If all reduction else if (sum == -group.size()) { log.debug("All Reduction"); allReductionAnalysis(group); } // Else they are mixed else { log.debug("Mixed"); mixedAnalysis(group); } } }
void function (ArrayList<ArrayList<Integer>> groups) { int sum = 0; for (ArrayList<Integer> group: groups) { sum = 0; log.debug(STRAll RisingSTRAll ReductionSTRMixed"); mixedAnalysis(group); } } }
/** * This function is responsible for the analysis of the group of points and * their split in smaller groups or individual points. * * @param groups * The groups of points for analysis */
This function is responsible for the analysis of the group of points and their split in smaller groups or individual points
analyseGroups
{ "repo_name": "cassandra-project/disaggregation", "path": "src/eu/cassandra/event/Event.java", "license": "apache-2.0", "size": 73456 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,443,388
public List<GaleriaDTO> getGaleriaDTOs(String parametro) { JsonParser parser = new JsonParser(); JsonArray array = null; String endpoint = new String("http://192.168.56.1:7101/WSGoSmartWS/resources/RestDestinos/getGaleria"); JsonObject jObject = cargarRestWs(endpoint, parametro); logger.info("Salida: " + jObject.toString()); List<GaleriaDTO> lista = new ArrayList<GaleriaDTO>(); GaleriaDTO dto = null; if (jObject.get("ESTADO").toString().contains("OK")) { logger.info("Respuesta: ok" + jObject); JsonElement element = parser.parse(jObject.get("IMAGENES").toString()); array = element.getAsJsonArray(); for (JsonElement e : array) { JsonObject o = e.getAsJsonObject(); logger.info(o.toString()); dto = new GaleriaDTO(o.get("NOMBRE").getAsString(), o.get("DESCRIPCION").getAsString(), o.get("URL").getAsString()); logger.info(dto.toString()); lista.add(dto); } } else { logger.error("Los datos no fueron cargados exitosamente."); logger.error(jObject.get("ESTADO").toString()); logger.error(jObject.get("MENSAJE").toString()); } return lista; }
List<GaleriaDTO> function(String parametro) { JsonParser parser = new JsonParser(); JsonArray array = null; String endpoint = new String(STRSalida: STRESTADOSTROKSTRRespuesta: okSTRIMAGENESSTRNOMBRESTRDESCRIPCIONSTRURLSTRLos datos no fueron cargados exitosamente.STRESTADOSTRMENSAJE").toString()); } return lista; }
/** * <b>Consultar la imagenenes para un destino x.</b> * * @param parametro * @return */
Consultar la imagenenes para un destino x
getGaleriaDTOs
{ "repo_name": "mrsistemasytecnologia/aplicaciones", "path": "APPTourWeb/src/com/tour/model/cliente/WSClientFacade.java", "license": "gpl-3.0", "size": 8606 }
[ "com.google.gson.JsonArray", "com.google.gson.JsonParser", "com.tour.model.dto.GaleriaDTO", "java.util.List" ]
import com.google.gson.JsonArray; import com.google.gson.JsonParser; import com.tour.model.dto.GaleriaDTO; import java.util.List;
import com.google.gson.*; import com.tour.model.dto.*; import java.util.*;
[ "com.google.gson", "com.tour.model", "java.util" ]
com.google.gson; com.tour.model; java.util;
2,462,081
public static Date parseIfModifiedSince(String headerValue) { for (FastDateFormat fastDateFormat : IF_MODIFIED_SINCE_FORMATS) { try { return fastDateFormat.parse(headerValue); } catch (ParseException ignore) { LOG.debug("Error parsing value [{}] as [{}]!", headerValue, fastDateFormat); } } if (LOG.isDebugEnabled()) { LOG.debug("Error parsing value [{}] as date!", headerValue); } return null; }
static Date function(String headerValue) { for (FastDateFormat fastDateFormat : IF_MODIFIED_SINCE_FORMATS) { try { return fastDateFormat.parse(headerValue); } catch (ParseException ignore) { LOG.debug(STR, headerValue, fastDateFormat); } } if (LOG.isDebugEnabled()) { LOG.debug(STR, headerValue); } return null; }
/** * Parse input string as date in formats defined for If-Modified-Since header, * see: * https://issues.apache.org/jira/browse/WW-4263 * https://web.archive.org/web/20081014021349/http://rfc.net/rfc2616.html#p20 * * @param headerValue value of If-Modified-Since header * @return proper date or null */
Parse input string as date in formats defined for If-Modified-Since header, see: HREF HREF
parseIfModifiedSince
{ "repo_name": "Ile2/struts2-showcase-demo", "path": "src/core/src/main/java/org/apache/struts2/RequestUtils.java", "license": "apache-2.0", "size": 4754 }
[ "java.text.ParseException", "java.util.Date", "org.apache.commons.lang3.time.FastDateFormat" ]
import java.text.ParseException; import java.util.Date; import org.apache.commons.lang3.time.FastDateFormat;
import java.text.*; import java.util.*; import org.apache.commons.lang3.time.*;
[ "java.text", "java.util", "org.apache.commons" ]
java.text; java.util; org.apache.commons;
241,441
public static Wc2014Package init() { if (isInited) return (Wc2014Package)EPackage.Registry.INSTANCE.getEPackage(Wc2014Package.eNS_URI); // Obtain or create and register package Wc2014PackageImpl theWc2014Package = (Wc2014PackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Wc2014PackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new Wc2014PackageImpl()); isInited = true; // Create package meta-data objects theWc2014Package.createPackageContents(); // Initialize created meta-data theWc2014Package.initializePackageContents(); // Mark meta-data to indicate it can't be changed theWc2014Package.freeze(); // Update the registry and return the package EPackage.Registry.INSTANCE.put(Wc2014Package.eNS_URI, theWc2014Package); return theWc2014Package; }
static Wc2014Package function() { if (isInited) return (Wc2014Package)EPackage.Registry.INSTANCE.getEPackage(Wc2014Package.eNS_URI); Wc2014PackageImpl theWc2014Package = (Wc2014PackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Wc2014PackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new Wc2014PackageImpl()); isInited = true; theWc2014Package.createPackageContents(); theWc2014Package.initializePackageContents(); theWc2014Package.freeze(); EPackage.Registry.INSTANCE.put(Wc2014Package.eNS_URI, theWc2014Package); return theWc2014Package; }
/** * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. * * <p>This method is used to initialize {@link Wc2014Package#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */
Creates, registers, and initializes the Package for this model, and for any others upon which it depends. This method is used to initialize <code>Wc2014Package#eINSTANCE</code> when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
init
{ "repo_name": "ggxx/HelloBrazil", "path": "src/edu.thu.ggxx.hellobrazil/src/edu/thu/ggxx/hellobrazil/wc2014/impl/Wc2014PackageImpl.java", "license": "mit", "size": 14837 }
[ "edu.thu.ggxx.hellobrazil.wc2014.Wc2014Package", "org.eclipse.emf.ecore.EPackage" ]
import edu.thu.ggxx.hellobrazil.wc2014.Wc2014Package; import org.eclipse.emf.ecore.EPackage;
import edu.thu.ggxx.hellobrazil.wc2014.*; import org.eclipse.emf.ecore.*;
[ "edu.thu.ggxx", "org.eclipse.emf" ]
edu.thu.ggxx; org.eclipse.emf;
1,362,491
CompletableFuture<Versioned<Collection<? extends V>>> get(K key);
CompletableFuture<Versioned<Collection<? extends V>>> get(K key);
/** * Returns a collection of values associated with the specified key, if the * key is not in the map it will return an empty collection. * * @param key the key whose associated values will be returned * @return a future whose value will be the collection of the values * associated with the specified key, the collection may be empty */
Returns a collection of values associated with the specified key, if the key is not in the map it will return an empty collection
get
{ "repo_name": "Shashikanth-Huawei/bmp", "path": "core/api/src/main/java/org/onosproject/store/service/AsyncConsistentMultimap.java", "license": "apache-2.0", "size": 8696 }
[ "java.util.Collection", "java.util.concurrent.CompletableFuture" ]
import java.util.Collection; import java.util.concurrent.CompletableFuture;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
510,387
public DataQueryParams setFilterOptions( String filter, DimensionType type, String dimensionName, List<DimensionalItemObject> options ) { int index = filters.indexOf( new BaseDimensionalObject( filter ) ); if ( index != -1 ) { filters.set( index, new BaseDimensionalObject( filter, type, dimensionName, null, options ) ); } else { filters.add( new BaseDimensionalObject( filter, type, dimensionName, null, options ) ); } return this; }
DataQueryParams function( String filter, DimensionType type, String dimensionName, List<DimensionalItemObject> options ) { int index = filters.indexOf( new BaseDimensionalObject( filter ) ); if ( index != -1 ) { filters.set( index, new BaseDimensionalObject( filter, type, dimensionName, null, options ) ); } else { filters.add( new BaseDimensionalObject( filter, type, dimensionName, null, options ) ); } return this; }
/** * Sets the options for the given filter. */
Sets the options for the given filter
setFilterOptions
{ "repo_name": "EyeSeeTea/dhis2", "path": "dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java", "license": "gpl-3.0", "size": 60770 }
[ "java.util.List", "org.hisp.dhis.common.BaseDimensionalObject", "org.hisp.dhis.common.DimensionType", "org.hisp.dhis.common.DimensionalItemObject" ]
import java.util.List; import org.hisp.dhis.common.BaseDimensionalObject; import org.hisp.dhis.common.DimensionType; import org.hisp.dhis.common.DimensionalItemObject;
import java.util.*; import org.hisp.dhis.common.*;
[ "java.util", "org.hisp.dhis" ]
java.util; org.hisp.dhis;
544,392
public void setScore(CreditRating score) { this._score = score; }
void function(CreditRating score) { this._score = score; }
/** * Sets the score. * @param score the new value of the property */
Sets the score
setScore
{ "repo_name": "McLeodMoores/starling", "path": "projects/core/src/main/java/com/opengamma/core/legalentity/Rating.java", "license": "apache-2.0", "size": 9345 }
[ "com.opengamma.core.obligor.CreditRating" ]
import com.opengamma.core.obligor.CreditRating;
import com.opengamma.core.obligor.*;
[ "com.opengamma.core" ]
com.opengamma.core;
2,359,380
public static JFreeChart createMultiplePieChart3D(String title, CategoryDataset dataset, TableOrder order, boolean legend, boolean tooltips, boolean urls) { ParamChecks.nullNotPermitted(order, "order"); MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPaint(null); plot.setOutlineStroke(null); JFreeChart pieChart = new JFreeChart(new PiePlot3D(null)); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); pieChart.setTitle(seriesTitle); pieChart.removeLegend(); pieChart.setBackgroundPaint(null); plot.setPieChart(pieChart); if (tooltips) { PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); } if (urls) { PieURLGenerator urlGenerator = new StandardPieURLGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setURLGenerator(urlGenerator); } JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
static JFreeChart function(String title, CategoryDataset dataset, TableOrder order, boolean legend, boolean tooltips, boolean urls) { ParamChecks.nullNotPermitted(order, "order"); MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPaint(null); plot.setOutlineStroke(null); JFreeChart pieChart = new JFreeChart(new PiePlot3D(null)); TextTitle seriesTitle = new TextTitle(STR, new Font(STR, Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); pieChart.setTitle(seriesTitle); pieChart.removeLegend(); pieChart.setBackgroundPaint(null); plot.setPieChart(pieChart); if (tooltips) { PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); } if (urls) { PieURLGenerator urlGenerator = new StandardPieURLGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setURLGenerator(urlGenerator); } JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
/** * Creates a chart that displays multiple pie plots. The chart object * returned by this method uses a {@link MultiplePiePlot} instance as the * plot. * * @param title the chart title (<code>null</code> permitted). * @param dataset the dataset (<code>null</code> permitted). * @param order the order that the data is extracted (by row or by column) * (<code>null</code> not permitted). * @param legend include a legend? * @param tooltips generate tooltips? * @param urls generate URLs? * * @return A chart. */
Creates a chart that displays multiple pie plots. The chart object returned by this method uses a <code>MultiplePiePlot</code> instance as the plot
createMultiplePieChart3D
{ "repo_name": "tomkren/pikater", "path": "lib/jfreechart/src/org/jfree/chart/ChartFactory.java", "license": "apache-2.0", "size": 111493 }
[ "java.awt.Font", "org.jfree.chart.labels.PieToolTipGenerator", "org.jfree.chart.labels.StandardPieToolTipGenerator", "org.jfree.chart.plot.MultiplePiePlot", "org.jfree.chart.plot.PiePlot", "org.jfree.chart.plot.PiePlot3D", "org.jfree.chart.title.TextTitle", "org.jfree.chart.urls.PieURLGenerator", "org.jfree.chart.urls.StandardPieURLGenerator", "org.jfree.chart.util.ParamChecks", "org.jfree.data.category.CategoryDataset", "org.jfree.ui.RectangleEdge", "org.jfree.util.TableOrder" ]
import java.awt.Font; import org.jfree.chart.labels.PieToolTipGenerator; import org.jfree.chart.labels.StandardPieToolTipGenerator; import org.jfree.chart.plot.MultiplePiePlot; import org.jfree.chart.plot.PiePlot; import org.jfree.chart.plot.PiePlot3D; import org.jfree.chart.title.TextTitle; import org.jfree.chart.urls.PieURLGenerator; import org.jfree.chart.urls.StandardPieURLGenerator; import org.jfree.chart.util.ParamChecks; import org.jfree.data.category.CategoryDataset; import org.jfree.ui.RectangleEdge; import org.jfree.util.TableOrder;
import java.awt.*; import org.jfree.chart.labels.*; import org.jfree.chart.plot.*; import org.jfree.chart.title.*; import org.jfree.chart.urls.*; import org.jfree.chart.util.*; import org.jfree.data.category.*; import org.jfree.ui.*; import org.jfree.util.*;
[ "java.awt", "org.jfree.chart", "org.jfree.data", "org.jfree.ui", "org.jfree.util" ]
java.awt; org.jfree.chart; org.jfree.data; org.jfree.ui; org.jfree.util;
1,754,183
private String getEntityId(Entity entity) throws SerializerException { if(entity.getId() == null) { throw new SerializerException("Entity id is null.", SerializerException.MessageKeys.MISSING_ID); } return entity.getId().toASCIIString(); }
String function(Entity entity) throws SerializerException { if(entity.getId() == null) { throw new SerializerException(STR, SerializerException.MessageKeys.MISSING_ID); } return entity.getId().toASCIIString(); }
/** * Get the ascii representation of the entity id * or thrown an {@link SerializerException} if id is <code>null</code>. * * @param entity the entity * @return ascii representation of the entity id */
Get the ascii representation of the entity id or thrown an <code>SerializerException</code> if id is <code>null</code>
getEntityId
{ "repo_name": "flaminc/olingo-odata4", "path": "lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java", "license": "apache-2.0", "size": 42202 }
[ "org.apache.olingo.commons.api.data.Entity", "org.apache.olingo.server.api.serializer.SerializerException" ]
import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.commons.api.data.*; import org.apache.olingo.server.api.serializer.*;
[ "org.apache.olingo" ]
org.apache.olingo;
1,018,779
@Deployment(name = JAR_ENTRY_EJB, managed = false, testable = false) @TargetsContainer(SERVER1) public static Archive<?> createEntryBeanDeployment() { return ShrinkWrap.create(JavaArchive.class, JAR_ENTRY_EJB + ".jar") .addClasses(EntryBean.class, EntryBeanSFSB.class, Entry.class, WhoAmI.class, ReAuthnType.class, SeccontextUtil.class, CallAnotherBeanInfo.class) .addAsManifestResource(createPermissionsXmlAsset(new ElytronPermission("authenticate"), new ElytronPermission("getPrivateCredentials"), new ElytronPermission("getSecurityDomain"), new SocketPermission(TestSuiteEnvironment.getServerAddressNode1() + ":8180", "connect,resolve")), "permissions.xml") .addAsManifestResource(Utils.getJBossEjb3XmlAsset("seccontext-entry"), "jboss-ejb3.xml"); }
@Deployment(name = JAR_ENTRY_EJB, managed = false, testable = false) @TargetsContainer(SERVER1) static Archive<?> function() { return ShrinkWrap.create(JavaArchive.class, JAR_ENTRY_EJB + ".jar") .addClasses(EntryBean.class, EntryBeanSFSB.class, Entry.class, WhoAmI.class, ReAuthnType.class, SeccontextUtil.class, CallAnotherBeanInfo.class) .addAsManifestResource(createPermissionsXmlAsset(new ElytronPermission(STR), new ElytronPermission(STR), new ElytronPermission(STR), new SocketPermission(TestSuiteEnvironment.getServerAddressNode1() + ":8180", STR)), STR) .addAsManifestResource(Utils.getJBossEjb3XmlAsset(STR), STR); }
/** * Creates deployment with Entry bean - to be placed on the first server. */
Creates deployment with Entry bean - to be placed on the first server
createEntryBeanDeployment
{ "repo_name": "xasx/wildfly", "path": "testsuite/integration/manualmode/src/test/java/org/wildfly/test/manual/elytron/seccontext/AbstractSecurityContextPropagationTestBase.java", "license": "lgpl-2.1", "size": 39080 }
[ "java.net.SocketPermission", "org.jboss.arquillian.container.test.api.Deployment", "org.jboss.arquillian.container.test.api.TargetsContainer", "org.jboss.as.test.integration.security.common.Utils", "org.jboss.as.test.shared.TestSuiteEnvironment", "org.jboss.shrinkwrap.api.Archive", "org.jboss.shrinkwrap.api.ShrinkWrap", "org.jboss.shrinkwrap.api.spec.JavaArchive", "org.wildfly.security.permission.ElytronPermission" ]
import java.net.SocketPermission; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.TargetsContainer; import org.jboss.as.test.integration.security.common.Utils; import org.jboss.as.test.shared.TestSuiteEnvironment; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.wildfly.security.permission.ElytronPermission;
import java.net.*; import org.jboss.arquillian.container.test.api.*; import org.jboss.as.test.integration.security.common.*; import org.jboss.as.test.shared.*; import org.jboss.shrinkwrap.api.*; import org.jboss.shrinkwrap.api.spec.*; import org.wildfly.security.permission.*;
[ "java.net", "org.jboss.arquillian", "org.jboss.as", "org.jboss.shrinkwrap", "org.wildfly.security" ]
java.net; org.jboss.arquillian; org.jboss.as; org.jboss.shrinkwrap; org.wildfly.security;
2,428,936
@Test public void testRejectInvalidArgument() throws Exception { boolean isTestPassed = false; String script = "require 1 ;"; try { JUnitUtils.interpret(JUnitUtils.createMail(), script); } catch (SyntaxException e) { isTestPassed = true; } Assert.assertTrue(isTestPassed); }
void function() throws Exception { boolean isTestPassed = false; String script = STR; try { JUnitUtils.interpret(JUnitUtils.createMail(), script); } catch (SyntaxException e) { isTestPassed = true; } Assert.assertTrue(isTestPassed); }
/** * Test for Command 'require' rejecting invalid arguments */
Test for Command 'require' rejecting invalid arguments
testRejectInvalidArgument
{ "repo_name": "linagora/james-jsieve", "path": "core/src/test/java/org/apache/jsieve/RequireTest.java", "license": "apache-2.0", "size": 6958 }
[ "org.apache.jsieve.exception.SyntaxException", "org.apache.jsieve.utils.JUnitUtils", "org.junit.Assert" ]
import org.apache.jsieve.exception.SyntaxException; import org.apache.jsieve.utils.JUnitUtils; import org.junit.Assert;
import org.apache.jsieve.exception.*; import org.apache.jsieve.utils.*; import org.junit.*;
[ "org.apache.jsieve", "org.junit" ]
org.apache.jsieve; org.junit;
2,663,537
public String getCommandUsage(ICommandSender sender) { return "commands.me.usage"; }
String function(ICommandSender sender) { return STR; }
/** * Gets the usage string for the command. */
Gets the usage string for the command
getCommandUsage
{ "repo_name": "MartyParty21/AwakenDreamsClient", "path": "mcp/src/minecraft/net/minecraft/command/server/CommandEmote.java", "license": "gpl-3.0", "size": 1866 }
[ "net.minecraft.command.ICommandSender" ]
import net.minecraft.command.ICommandSender;
import net.minecraft.command.*;
[ "net.minecraft.command" ]
net.minecraft.command;
1,984,656
public static void trackEventAddToCart(TrackingParams params) { if (instance == null) { log.error(getErrorInitializeMessage()); } else { TrackingItem trackingItem = new TrackingItem(CustomTrackingEvents.ADD_TO_CART_INDEX, CustomTrackingEvents.ADD_TO_CART_NAME, params); TrackingWorker.track(trackingItem); } }
static void function(TrackingParams params) { if (instance == null) { log.error(getErrorInitializeMessage()); } else { TrackingItem trackingItem = new TrackingItem(CustomTrackingEvents.ADD_TO_CART_INDEX, CustomTrackingEvents.ADD_TO_CART_NAME, params); TrackingWorker.track(trackingItem); } }
/** * Tracking an Add to Cart event * @param params Map of key-value parameters. */
Tracking an Add to Cart event
trackEventAddToCart
{ "repo_name": "mpire-nxus/nxus_android_sdk", "path": "library/src/main/java/com/nxus/measurement/MpireNxusMeasurement.java", "license": "mit", "size": 7643 }
[ "com.nxus.measurement.tracking.CustomTrackingEvents", "com.nxus.measurement.tracking.TrackingItem", "com.nxus.measurement.tracking.TrackingParams", "com.nxus.measurement.tracking.TrackingWorker" ]
import com.nxus.measurement.tracking.CustomTrackingEvents; import com.nxus.measurement.tracking.TrackingItem; import com.nxus.measurement.tracking.TrackingParams; import com.nxus.measurement.tracking.TrackingWorker;
import com.nxus.measurement.tracking.*;
[ "com.nxus.measurement" ]
com.nxus.measurement;
1,852,962
protected Map<byte[], NavigableSet<byte[]>> constructFamilyMap(List<byte[]> families, List<byte[]> columns) { Map<byte[], NavigableSet<byte[]>> map = new TreeMap<byte[], NavigableSet<byte[]>>(Bytes.BYTES_COMPARATOR); NavigableSet<byte[]> colSet = getColumnSet(columns); for(byte[] f: families){ map.put(f, colSet); } return map; }
Map<byte[], NavigableSet<byte[]>> function(List<byte[]> families, List<byte[]> columns) { Map<byte[], NavigableSet<byte[]>> map = new TreeMap<byte[], NavigableSet<byte[]>>(Bytes.BYTES_COMPARATOR); NavigableSet<byte[]> colSet = getColumnSet(columns); for(byte[] f: families){ map.put(f, colSet); } return map; }
/** * Constract family map. * * @param families the families * @param columns the columns * @return the map */
Constract family map
constructFamilyMap
{ "repo_name": "VladRodionov/bigbase", "path": "block-cache/src/test/java/com/koda/integ/hbase/test/BaseTest.java", "license": "agpl-3.0", "size": 14945 }
[ "java.util.List", "java.util.Map", "java.util.NavigableSet", "java.util.TreeMap", "org.apache.hadoop.hbase.util.Bytes" ]
import java.util.List; import java.util.Map; import java.util.NavigableSet; import java.util.TreeMap; import org.apache.hadoop.hbase.util.Bytes;
import java.util.*; import org.apache.hadoop.hbase.util.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
1,495,437
public static List<ViewEntity> getViewEntities(Entitymodel entitymodel) { List<ViewEntity> viewEntities = new ArrayList<>(); for (Object o : entitymodel.getEntityOrViewEntityOrExtendEntity()) { if (o instanceof ViewEntity) { viewEntities.add((ViewEntity) o); } } return viewEntities; }
static List<ViewEntity> function(Entitymodel entitymodel) { List<ViewEntity> viewEntities = new ArrayList<>(); for (Object o : entitymodel.getEntityOrViewEntityOrExtendEntity()) { if (o instanceof ViewEntity) { viewEntities.add((ViewEntity) o); } } return viewEntities; }
/** * Get view entity list from entitymodel * @param entitymodel * @return */
Get view entity list from entitymodel
getViewEntities
{ "repo_name": "yuri0x7c1/ofbiz-explorer", "path": "src/main/java/com/github/yuri0x7c1/ofbiz/explorer/util/OfbizUtil.java", "license": "apache-2.0", "size": 12652 }
[ "com.github.yuri0x7c1.ofbiz.explorer.entity.xml.Entitymodel", "com.github.yuri0x7c1.ofbiz.explorer.entity.xml.ViewEntity", "java.util.ArrayList", "java.util.List" ]
import com.github.yuri0x7c1.ofbiz.explorer.entity.xml.Entitymodel; import com.github.yuri0x7c1.ofbiz.explorer.entity.xml.ViewEntity; import java.util.ArrayList; import java.util.List;
import com.github.yuri0x7c1.ofbiz.explorer.entity.xml.*; import java.util.*;
[ "com.github.yuri0x7c1", "java.util" ]
com.github.yuri0x7c1; java.util;
2,767,458
private BSPTree<Euclidean1D> getFirstIntervalBoundary() { // start search at the tree root BSPTree<Euclidean1D> node = getTree(false); if (node.getCut() == null) { return null; } // walk tree until we find the smallest internal node node = getFirstLeaf(node).getParent(); // walk tree until we find an interval boundary while (node != null && !(isIntervalStart(node) || isIntervalEnd(node))) { node = nextInternalNode(node); } return node; }
BSPTree<Euclidean1D> function() { BSPTree<Euclidean1D> node = getTree(false); if (node.getCut() == null) { return null; } node = getFirstLeaf(node).getParent(); while (node != null && !(isIntervalStart(node) isIntervalEnd(node))) { node = nextInternalNode(node); } return node; }
/** Get the node corresponding to the first interval boundary. * @return smallest internal node, * or null if there are no internal nodes (i.e. the set is either empty or covers the real line) */
Get the node corresponding to the first interval boundary
getFirstIntervalBoundary
{ "repo_name": "sdinot/hipparchus", "path": "hipparchus-geometry/src/main/java/org/hipparchus/geometry/euclidean/oned/IntervalsSet.java", "license": "apache-2.0", "size": 23841 }
[ "org.hipparchus.geometry.partitioning.BSPTree" ]
import org.hipparchus.geometry.partitioning.BSPTree;
import org.hipparchus.geometry.partitioning.*;
[ "org.hipparchus.geometry" ]
org.hipparchus.geometry;
1,126,396
public static void validate(ValueVector vector) { Preconditions.checkNotNull(vector); ValidateVectorTypeVisitor typeVisitor = new ValidateVectorTypeVisitor(); vector.accept(typeVisitor, null); ValidateVectorBufferVisitor bufferVisitor = new ValidateVectorBufferVisitor(); vector.accept(bufferVisitor, null); }
static void function(ValueVector vector) { Preconditions.checkNotNull(vector); ValidateVectorTypeVisitor typeVisitor = new ValidateVectorTypeVisitor(); vector.accept(typeVisitor, null); ValidateVectorBufferVisitor bufferVisitor = new ValidateVectorBufferVisitor(); vector.accept(bufferVisitor, null); }
/** * Utility to validate vector in O(1) time. */
Utility to validate vector in O(1) time
validate
{ "repo_name": "kou/arrow", "path": "java/vector/src/main/java/org/apache/arrow/vector/util/ValueVectorUtility.java", "license": "apache-2.0", "size": 6411 }
[ "org.apache.arrow.util.Preconditions", "org.apache.arrow.vector.ValueVector", "org.apache.arrow.vector.validate.ValidateVectorBufferVisitor", "org.apache.arrow.vector.validate.ValidateVectorTypeVisitor" ]
import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.validate.ValidateVectorBufferVisitor; import org.apache.arrow.vector.validate.ValidateVectorTypeVisitor;
import org.apache.arrow.util.*; import org.apache.arrow.vector.*; import org.apache.arrow.vector.validate.*;
[ "org.apache.arrow" ]
org.apache.arrow;
1,707,619
@Override public void update(final long nanoFrameTime) { if (nextY - circle.getRadius() - 10 < topBorder) { GameLog.addInfoLog("Bubble hit ceiling: (" + Double.toString(circle.getCenterX()) + Double.toString(circle.getCenterY()) + ")"); GameLog.addInfoLog("Bubble is destroyed"); getGameObjects().removeObject(getThis()); circle.destroy(); notifyObservers(EventType.KILLED_CEILING); } circle.setCenterX(nextX); circle.setCenterY(nextY); if (circle.getCenterY() == bottomBorder) { vY = -Y_MAX_SPEED; } }
void function(final long nanoFrameTime) { if (nextY - circle.getRadius() - 10 < topBorder) { GameLog.addInfoLog(STR + Double.toString(circle.getCenterX()) + Double.toString(circle.getCenterY()) + ")"); GameLog.addInfoLog(STR); getGameObjects().removeObject(getThis()); circle.destroy(); notifyObservers(EventType.KILLED_CEILING); } circle.setCenterX(nextX); circle.setCenterY(nextY); if (circle.getCenterY() == bottomBorder) { vY = -Y_MAX_SPEED; } }
/** * Update the position (called by GameLoop). * * @param nanoFrameTime the framerate (nanoseconds/frame) */
Update the position (called by GameLoop)
update
{ "repo_name": "JoshCode/SEM", "path": "src/main/java/nl/joshuaslik/tudelft/SEM/control/gameObjects/Bubble.java", "license": "apache-2.0", "size": 15154 }
[ "nl.joshuaslik.tudelft.SEM" ]
import nl.joshuaslik.tudelft.SEM;
import nl.joshuaslik.tudelft.*;
[ "nl.joshuaslik.tudelft" ]
nl.joshuaslik.tudelft;
1,980,940
@Message(id = 76, value = "The role name '%s' is not a valid standard role.") OperationFailedException invalidRoleName(String roleName);
@Message(id = 76, value = STR) OperationFailedException invalidRoleName(String roleName);
/** * Error message if the name of a role mapping being added is invalid. * * @param roleName - The name of the role. * * @return an {@link OperationFailedException} for the error. */
Error message if the name of a role mapping being added is invalid
invalidRoleName
{ "repo_name": "luck3y/wildfly-core", "path": "domain-management/src/main/java/org/jboss/as/domain/management/logging/DomainManagementLogger.java", "license": "lgpl-2.1", "size": 66410 }
[ "org.jboss.as.controller.OperationFailedException", "org.jboss.logging.annotations.Message" ]
import org.jboss.as.controller.OperationFailedException; import org.jboss.logging.annotations.Message;
import org.jboss.as.controller.*; import org.jboss.logging.annotations.*;
[ "org.jboss.as", "org.jboss.logging" ]
org.jboss.as; org.jboss.logging;
707,567
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<AzureFirewallInner>, AzureFirewallInner> beginUpdateTags( String resourceGroupName, String azureFirewallName, TagsObject parameters);
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<AzureFirewallInner>, AzureFirewallInner> beginUpdateTags( String resourceGroupName, String azureFirewallName, TagsObject parameters);
/** * Updates tags of an Azure Firewall resource. * * @param resourceGroupName The name of the resource group. * @param azureFirewallName The name of the Azure Firewall. * @param parameters Parameters supplied to update azure firewall tags. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of azure Firewall resource. */
Updates tags of an Azure Firewall resource
beginUpdateTags
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/AzureFirewallsClient.java", "license": "mit", "size": 25821 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.network.fluent.models.AzureFirewallInner", "com.azure.resourcemanager.network.models.TagsObject" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.network.fluent.models.AzureFirewallInner; import com.azure.resourcemanager.network.models.TagsObject;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.network.fluent.models.*; import com.azure.resourcemanager.network.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
916,729
public Block get(FullKey key) throws IOException;
Block function(FullKey key) throws IOException;
/** * Fetch and decode a block. Implementations should return a block if it can * be fetched and decoded. In the case where fetching fails in a way that * will not prevent fetching of the same key in the future, implementations * should return null. * * @param key * the full key of the block to fetch and decode. * @return the decoded block, or null if the block is not available possibly * because of errors in fetching the block. * @throws IOException * if the block is available but fetching or decoding failed, * and it is expected that trying again will continue to fail. * For example, a block that loads and parses but does not * decode with this key. */
Fetch and decode a block. Implementations should return a block if it can be fetched and decoded. In the case where fetching fails in a way that will not prevent fetching of the same key in the future, implementations should return null
get
{ "repo_name": "sarah-happy/happy-archive", "path": "archive/src/main/java/org/yi/happy/archive/ClearBlockSource.java", "license": "apache-2.0", "size": 1106 }
[ "java.io.IOException", "org.yi.happy.archive.block.Block", "org.yi.happy.archive.key.FullKey" ]
import java.io.IOException; import org.yi.happy.archive.block.Block; import org.yi.happy.archive.key.FullKey;
import java.io.*; import org.yi.happy.archive.block.*; import org.yi.happy.archive.key.*;
[ "java.io", "org.yi.happy" ]
java.io; org.yi.happy;
1,760,248
private static String getProgramName() { try { ProtectionDomain protectionDomain = FrenchRevolutionaryCalendarCLI.class.getProtectionDomain(); if (protectionDomain != null) { CodeSource codeSource = protectionDomain.getCodeSource(); if (codeSource != null) { URL location = codeSource.getLocation(); if (location != null) { String path = location.getPath(); if (path != null) { File file = new File(path); if (file.isFile()) { String relativeFile = new File(".").toURI().relativize(file.toURI()).getPath(); return "java -jar " + relativeFile; } } } } } } catch (Throwable t) { // don't really care } return "java " + FrenchRevolutionaryCalendarCLI.class.getName(); }
static String function() { try { ProtectionDomain protectionDomain = FrenchRevolutionaryCalendarCLI.class.getProtectionDomain(); if (protectionDomain != null) { CodeSource codeSource = protectionDomain.getCodeSource(); if (codeSource != null) { URL location = codeSource.getLocation(); if (location != null) { String path = location.getPath(); if (path != null) { File file = new File(path); if (file.isFile()) { String relativeFile = new File(".").toURI().relativize(file.toURI()).getPath(); return STR + relativeFile; } } } } } } catch (Throwable t) { } return STR + FrenchRevolutionaryCalendarCLI.class.getName(); }
/** * Try to return a string like "java -jar target/french-revolutionary-calendar-cli.jar" to be used within the usage. */
Try to return a string like "java -jar target/french-revolutionary-calendar-cli.jar" to be used within the usage
getProgramName
{ "repo_name": "caarmen/french-revolutionary-calendar", "path": "cli/src/main/java/ca/rmen/lfrc/cli/FrenchRevolutionaryCalendarCLI.java", "license": "lgpl-2.1", "size": 10354 }
[ "java.io.File", "java.security.CodeSource", "java.security.ProtectionDomain" ]
import java.io.File; import java.security.CodeSource; import java.security.ProtectionDomain;
import java.io.*; import java.security.*;
[ "java.io", "java.security" ]
java.io; java.security;
964,879
private void setBoolPref(int boolKeyId, boolean value) { SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean( getResources().getString(boolKeyId), value); editor.commit(); }
void function(int boolKeyId, boolean value) { SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean( getResources().getString(boolKeyId), value); editor.commit(); }
/** Sets boolean pref based upon a supplied key id and value. * @param boolKeyId The id to the bool pref key. * @param value The value to set the preference as. */
Sets boolean pref based upon a supplied key id and value
setBoolPref
{ "repo_name": "iamovrhere/MorseFlash", "path": "src/com/ovrhere/android/morseflash/ui/fragments/MainFragment.java", "license": "apache-2.0", "size": 15600 }
[ "android.content.SharedPreferences" ]
import android.content.SharedPreferences;
import android.content.*;
[ "android.content" ]
android.content;
2,106,476
@Deprecated public static ConfigLine<Object> readFilePointer(String name, String pointer, boolean editable, File config_location) { // Removes the file header pointer = pointer.replace(StringUtils.FilePointerHeader, " "); pointer = pointer.trim(); // Determines the location type (dynamic vs static) String location_type = pointer.substring(0, 2); File location = null; // Processes the pointer depending on the location type if (location_type.equals(ConfigLineUtils.StaticLocation)) { location = new File(pointer.substring(2)); } else if (location_type.equals(ConfigLineUtils.DynamicLocation)) { File temp = new File(config_location.getAbsolutePath()); location = new File(temp.getParent() + File.separator + pointer.substring(2)); } else { System.err.println("Error reading file location header: " + location_type + "on line " + pointer); return null; } // Read the file from the disk, specify the encoding, then read the object from that data try { String stuff = new String(Files.readAllBytes(location.toPath())); //byte[] ba = stuff.getBytes(ConfigLineUtils.ExternalObjectEncoding); byte[] ba = stuff.getBytes(); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(ba)); return new ConfigLine<Object>(name, ois.readObject(), editable, true); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } // Houston, we have a problem... System.err.println("Error reading in object with name " + name); return new ConfigLine<Object>(name, null); }
static ConfigLine<Object> function(String name, String pointer, boolean editable, File config_location) { pointer = pointer.replace(StringUtils.FilePointerHeader, " "); pointer = pointer.trim(); String location_type = pointer.substring(0, 2); File location = null; if (location_type.equals(ConfigLineUtils.StaticLocation)) { location = new File(pointer.substring(2)); } else if (location_type.equals(ConfigLineUtils.DynamicLocation)) { File temp = new File(config_location.getAbsolutePath()); location = new File(temp.getParent() + File.separator + pointer.substring(2)); } else { System.err.println(STR + location_type + STR + pointer); return null; } try { String stuff = new String(Files.readAllBytes(location.toPath())); byte[] ba = stuff.getBytes(); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(ba)); return new ConfigLine<Object>(name, ois.readObject(), editable, true); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } System.err.println(STR + name); return new ConfigLine<Object>(name, null); }
/** * Reads in a serialized object from the specified file * * @param name name of the ConfigLine * @param pointer the location of the file containing the serialized object * @param editable if the ConfigLine should be editable * @param config_location the location of the ConfigFile, used for dynamic locations * @return a ConfigLine made from the read-in serialized object */
Reads in a serialized object from the specified file
readFilePointer
{ "repo_name": "FIRST-Team-1699/autonomous-code", "path": "src/org/usfirst/frc/team1699/utils/inireader/utils/ConfigLineUtils.java", "license": "mit", "size": 12914 }
[ "java.io.ByteArrayInputStream", "java.io.File", "java.io.IOException", "java.io.ObjectInputStream", "java.io.UnsupportedEncodingException", "java.nio.file.Files", "org.usfirst.frc.team1699.utils.inireader.ConfigLine" ]
import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.ObjectInputStream; import java.io.UnsupportedEncodingException; import java.nio.file.Files; import org.usfirst.frc.team1699.utils.inireader.ConfigLine;
import java.io.*; import java.nio.file.*; import org.usfirst.frc.team1699.utils.inireader.*;
[ "java.io", "java.nio", "org.usfirst.frc" ]
java.io; java.nio; org.usfirst.frc;
274,003
@Override public void init(AuthenticationManagerBuilder auth) throws Exception { // @formatter:off auth.inMemoryAuthentication().withUser("testuser") .password("password").roles("USER"); auth.inMemoryAuthentication().withUser("admin") .password("password").roles("ADMIN"); // @formatter:on } }
void function(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser(STR) .password(STR).roles("USER"); auth.inMemoryAuthentication().withUser("admin") .password(STR).roles("ADMIN"); } }
/** * Setup 2 users with different roles */
Setup 2 users with different roles
init
{ "repo_name": "thomasletsch/moserp", "path": "backend/infrastructure/authentication-service/src/main/java/org/moserp/infrastructure/authentication/AuthorizationServerConfig.java", "license": "apache-2.0", "size": 4883 }
[ "org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder" ]
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.authentication.builders.*;
[ "org.springframework.security" ]
org.springframework.security;
1,602,429
Scan currentScan; if ((endRow != null) && (endRow.length > 0)) { if (trrRowFilter != null) { Scan scan = new Scan().withStartRow(firstRow).withStopRow(endRow); TableInputFormat.addColumns(scan, trrInputColumns); scan.setFilter(trrRowFilter); scan.setCacheBlocks(false); this.scanner = this.htable.getScanner(scan); currentScan = scan; } else { LOG.debug("TIFB.restart, firstRow: " + Bytes.toStringBinary(firstRow) + ", endRow: " + Bytes.toStringBinary(endRow)); Scan scan = new Scan().withStartRow(firstRow).withStopRow(endRow); TableInputFormat.addColumns(scan, trrInputColumns); this.scanner = this.htable.getScanner(scan); currentScan = scan; } } else { LOG.debug("TIFB.restart, firstRow: " + Bytes.toStringBinary(firstRow) + ", no endRow"); Scan scan = new Scan().withStartRow(firstRow); TableInputFormat.addColumns(scan, trrInputColumns); scan.setFilter(trrRowFilter); this.scanner = this.htable.getScanner(scan); currentScan = scan; } if (logScannerActivity) { LOG.info("Current scan=" + currentScan.toString()); timestamp = System.currentTimeMillis(); rowcount = 0; } }
Scan currentScan; if ((endRow != null) && (endRow.length > 0)) { if (trrRowFilter != null) { Scan scan = new Scan().withStartRow(firstRow).withStopRow(endRow); TableInputFormat.addColumns(scan, trrInputColumns); scan.setFilter(trrRowFilter); scan.setCacheBlocks(false); this.scanner = this.htable.getScanner(scan); currentScan = scan; } else { LOG.debug(STR + Bytes.toStringBinary(firstRow) + STR + Bytes.toStringBinary(endRow)); Scan scan = new Scan().withStartRow(firstRow).withStopRow(endRow); TableInputFormat.addColumns(scan, trrInputColumns); this.scanner = this.htable.getScanner(scan); currentScan = scan; } } else { LOG.debug(STR + Bytes.toStringBinary(firstRow) + STR); Scan scan = new Scan().withStartRow(firstRow); TableInputFormat.addColumns(scan, trrInputColumns); scan.setFilter(trrRowFilter); this.scanner = this.htable.getScanner(scan); currentScan = scan; } if (logScannerActivity) { LOG.info(STR + currentScan.toString()); timestamp = System.currentTimeMillis(); rowcount = 0; } }
/** * Restart from survivable exceptions by creating a new scanner. * * @param firstRow * @throws IOException */
Restart from survivable exceptions by creating a new scanner
restart
{ "repo_name": "francisliu/hbase", "path": "hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapred/TableRecordReaderImpl.java", "license": "apache-2.0", "size": 8087 }
[ "org.apache.hadoop.hbase.client.Scan", "org.apache.hadoop.hbase.mapreduce.TableInputFormat", "org.apache.hadoop.hbase.util.Bytes" ]
import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.mapreduce.TableInputFormat; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.mapreduce.*; import org.apache.hadoop.hbase.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,874,602
public void setProcessClusters(List<String> newClusters, String startTime, String endTime) { clearProcessCluster(); for (String newCluster : newClusters) { final Cluster processCluster = new ProcessClusterBuilder( new ClusterMerlin(newCluster).getName()) .withValidity(startTime, endTime) .build(); addProcessCluster(processCluster); } }
void function(List<String> newClusters, String startTime, String endTime) { clearProcessCluster(); for (String newCluster : newClusters) { final Cluster processCluster = new ProcessClusterBuilder( new ClusterMerlin(newCluster).getName()) .withValidity(startTime, endTime) .build(); addProcessCluster(processCluster); } }
/** * Method sets a number of clusters to process definition. * * @param newClusters list of definitions of clusters which are to be set to process * (clusters on which process should run) * @param startTime start of process validity on every cluster * @param endTime end of process validity on every cluster */
Method sets a number of clusters to process definition
setProcessClusters
{ "repo_name": "sriksun/falcon", "path": "falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/Entities/ProcessMerlin.java", "license": "apache-2.0", "size": 25837 }
[ "java.util.List", "org.apache.falcon.entity.v0.process.Cluster" ]
import java.util.List; import org.apache.falcon.entity.v0.process.Cluster;
import java.util.*; import org.apache.falcon.entity.v0.process.*;
[ "java.util", "org.apache.falcon" ]
java.util; org.apache.falcon;
52,820
public WebElement waitForElementPresence(By by) { WebDriverWait wait = new WebDriverWait(browser.driver, TestProperties.TEST_TIMEOUT); return wait.until(ExpectedConditions.presenceOfElementLocated(by)); }
WebElement function(By by) { WebDriverWait wait = new WebDriverWait(browser.driver, TestProperties.TEST_TIMEOUT); return wait.until(ExpectedConditions.presenceOfElementLocated(by)); }
/** * Waits for the element to appear in the page, up to the timeout specified. */
Waits for the element to appear in the page, up to the timeout specified
waitForElementPresence
{ "repo_name": "Malkone/teammates", "path": "src/test/java/teammates/test/pageobjects/AppPage.java", "license": "gpl-2.0", "size": 39427 }
[ "org.openqa.selenium.By", "org.openqa.selenium.WebElement", "org.openqa.selenium.support.ui.ExpectedConditions", "org.openqa.selenium.support.ui.WebDriverWait" ]
import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.*; import org.openqa.selenium.support.ui.*;
[ "org.openqa.selenium" ]
org.openqa.selenium;
1,771,571
public static UICategory create(UICategory category, String... categories) { Assert.notNull(category, "Parent UICategory must not be null."); Assert.notNull(categories, "Sub categories must not be null."); List<String> args = new ArrayList<String>(); args.add(category.getName()); args.addAll(Arrays.asList(categories)); return create(args.toArray(new String[] {})); }
static UICategory function(UICategory category, String... categories) { Assert.notNull(category, STR); Assert.notNull(categories, STR); List<String> args = new ArrayList<String>(); args.add(category.getName()); args.addAll(Arrays.asList(categories)); return create(args.toArray(new String[] {})); }
/** * Using the given {@link UICategory} as a parent, produce a hierarchical {@link UICategory} instance from the given * sub-category names. */
Using the given <code>UICategory</code> as a parent, produce a hierarchical <code>UICategory</code> instance from the given sub-category names
create
{ "repo_name": "stalep/forge-core", "path": "ui/api/src/main/java/org/jboss/forge/addon/ui/util/Categories.java", "license": "epl-1.0", "size": 3849 }
[ "java.util.ArrayList", "java.util.Arrays", "java.util.List", "org.jboss.forge.addon.ui.metadata.UICategory", "org.jboss.forge.furnace.util.Assert" ]
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.jboss.forge.addon.ui.metadata.UICategory; import org.jboss.forge.furnace.util.Assert;
import java.util.*; import org.jboss.forge.addon.ui.metadata.*; import org.jboss.forge.furnace.util.*;
[ "java.util", "org.jboss.forge" ]
java.util; org.jboss.forge;
1,472,359
if (!interceptors.hasNext()) { throw new ProcessingException(LocalizationMessages.ERROR_INTERCEPTOR_READER_PROCEED()); } final ReaderInterceptor interceptor = interceptors.next(); traceBefore(interceptor, MsgTraceEvent.RI_BEFORE); try { return interceptor.aroundReadFrom(this); } finally { processedCount++; traceAfter(interceptor, MsgTraceEvent.RI_AFTER); } }
if (!interceptors.hasNext()) { throw new ProcessingException(LocalizationMessages.ERROR_INTERCEPTOR_READER_PROCEED()); } final ReaderInterceptor interceptor = interceptors.next(); traceBefore(interceptor, MsgTraceEvent.RI_BEFORE); try { return interceptor.aroundReadFrom(this); } finally { processedCount++; traceAfter(interceptor, MsgTraceEvent.RI_AFTER); } }
/** * Starts the interceptor chain execution. * * @return an entity read from the stream. */
Starts the interceptor chain execution
proceed
{ "repo_name": "agentlab/org.glassfish.jersey", "path": "plugins/org.glassfish.jersey.common/src/main/java/org/glassfish/jersey/message/internal/ReaderInterceptorExecutor.java", "license": "epl-1.0", "size": 14233 }
[ "javax.ws.rs.ProcessingException", "javax.ws.rs.ext.ReaderInterceptor", "org.glassfish.jersey.internal.LocalizationMessages" ]
import javax.ws.rs.ProcessingException; import javax.ws.rs.ext.ReaderInterceptor; import org.glassfish.jersey.internal.LocalizationMessages;
import javax.ws.rs.*; import javax.ws.rs.ext.*; import org.glassfish.jersey.internal.*;
[ "javax.ws", "org.glassfish.jersey" ]
javax.ws; org.glassfish.jersey;
2,151,615
public void AnalysisError(String stmt, Analyzer analyzer, String expectedErrorString) { Preconditions.checkNotNull(expectedErrorString, "No expected error message given."); this.analyzer_ = analyzer; LOG.info("analyzing " + stmt); SqlScanner input = new SqlScanner(new StringReader(stmt)); SqlParser parser = new SqlParser(input); ParseNode node = null; try { node = (ParseNode) parser.parse().value; } catch (Exception e) { System.err.println(e.toString()); fail("\nParser error:\n" + parser.getErrorMsg(stmt)); } assertNotNull(node); try { node.analyze(analyzer); } catch (AnalysisException e) { String errorString = e.getMessage(); Assert.assertTrue( "got error:\n" + errorString + "\nexpected:\n" + expectedErrorString, errorString.startsWith(expectedErrorString)); return; } catch (AuthorizationException e) { fail("Authorization error: " + e.getMessage()); } fail("Stmt didn't result in analysis error: " + stmt); }
void function(String stmt, Analyzer analyzer, String expectedErrorString) { Preconditions.checkNotNull(expectedErrorString, STR); this.analyzer_ = analyzer; LOG.info(STR + stmt); SqlScanner input = new SqlScanner(new StringReader(stmt)); SqlParser parser = new SqlParser(input); ParseNode node = null; try { node = (ParseNode) parser.parse().value; } catch (Exception e) { System.err.println(e.toString()); fail(STR + parser.getErrorMsg(stmt)); } assertNotNull(node); try { node.analyze(analyzer); } catch (AnalysisException e) { String errorString = e.getMessage(); Assert.assertTrue( STR + errorString + STR + expectedErrorString, errorString.startsWith(expectedErrorString)); return; } catch (AuthorizationException e) { fail(STR + e.getMessage()); } fail(STR + stmt); }
/** * Asserts if stmt passes analysis or the error string doesn't match and it * is non-null. */
Asserts if stmt passes analysis or the error string doesn't match and it is non-null
AnalysisError
{ "repo_name": "rampage644/impala-cut", "path": "fe/src/test/java/com/cloudera/impala/analysis/AnalyzerTest.java", "license": "apache-2.0", "size": 28442 }
[ "com.cloudera.impala.catalog.AuthorizationException", "com.cloudera.impala.common.AnalysisException", "com.google.common.base.Preconditions", "java.io.StringReader", "junit.framework.Assert", "org.junit.Assert" ]
import com.cloudera.impala.catalog.AuthorizationException; import com.cloudera.impala.common.AnalysisException; import com.google.common.base.Preconditions; import java.io.StringReader; import junit.framework.Assert; import org.junit.Assert;
import com.cloudera.impala.catalog.*; import com.cloudera.impala.common.*; import com.google.common.base.*; import java.io.*; import junit.framework.*; import org.junit.*;
[ "com.cloudera.impala", "com.google.common", "java.io", "junit.framework", "org.junit" ]
com.cloudera.impala; com.google.common; java.io; junit.framework; org.junit;
561,981
TaxonomyIndexArrays add(int ordinal, int parentOrdinal) { if (ordinal >= parents.length) { int[] newarray = ArrayUtil.grow(parents, ordinal + 1); newarray[ordinal] = parentOrdinal; return new TaxonomyIndexArrays(newarray); } parents[ordinal] = parentOrdinal; return this; }
TaxonomyIndexArrays add(int ordinal, int parentOrdinal) { if (ordinal >= parents.length) { int[] newarray = ArrayUtil.grow(parents, ordinal + 1); newarray[ordinal] = parentOrdinal; return new TaxonomyIndexArrays(newarray); } parents[ordinal] = parentOrdinal; return this; }
/** * Adds the given ordinal/parent info and returns either a new instance if the * underlying array had to grow, or this instance otherwise. * <p> * <b>NOTE:</b> you should call this method from a thread-safe code. */
Adds the given ordinal/parent info and returns either a new instance if the underlying array had to grow, or this instance otherwise.
add
{ "repo_name": "halentest/solr", "path": "lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/TaxonomyIndexArrays.java", "license": "apache-2.0", "size": 7928 }
[ "org.apache.lucene.util.ArrayUtil" ]
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.*;
[ "org.apache.lucene" ]
org.apache.lucene;
1,609,123
private void setTileSource(String selectedTileSourceType, String selectedTileSourceFile, String selectedTableTitle) { Editor editor = mPreferences.edit(); editor.putString(LibraryConstants.PREFS_KEY_TILESOURCE, selectedTileSourceType); editor.putString(LibraryConstants.PREFS_KEY_TILESOURCE_FILE, selectedTileSourceFile); editor.putString(LibraryConstants.PREFS_KEY_TILESOURCE_TITLE, selectedTableTitle); editor.apply(); }
void function(String selectedTileSourceType, String selectedTileSourceFile, String selectedTableTitle) { Editor editor = mPreferences.edit(); editor.putString(LibraryConstants.PREFS_KEY_TILESOURCE, selectedTileSourceType); editor.putString(LibraryConstants.PREFS_KEY_TILESOURCE_FILE, selectedTileSourceFile); editor.putString(LibraryConstants.PREFS_KEY_TILESOURCE_TITLE, selectedTableTitle); editor.apply(); }
/** * Sets the tilesource for the map. */
Sets the tilesource for the map
setTileSource
{ "repo_name": "tghoward/geopaparazzi", "path": "geopaparazzimapsforge/src/eu/geopaparazzi/mapsforge/BaseMapSourcesManager.java", "license": "gpl-3.0", "size": 22396 }
[ "android.content.SharedPreferences", "eu.geopaparazzi.library.util.LibraryConstants" ]
import android.content.SharedPreferences; import eu.geopaparazzi.library.util.LibraryConstants;
import android.content.*; import eu.geopaparazzi.library.util.*;
[ "android.content", "eu.geopaparazzi.library" ]
android.content; eu.geopaparazzi.library;
1,336,815
public void stateChanged(Item item, State oldState, State newState);
void function(Item item, State oldState, State newState);
/** * This method is called, if a state has changed. * * @param item the item whose state has changed * @param oldState the previous state * @param newState the new state */
This method is called, if a state has changed
stateChanged
{ "repo_name": "idserda/openhab", "path": "bundles/api/org.openhab.core1/src/main/java/org/openhab/core/items/StateChangeListener.java", "license": "epl-1.0", "size": 1268 }
[ "org.openhab.core.types.State" ]
import org.openhab.core.types.State;
import org.openhab.core.types.*;
[ "org.openhab.core" ]
org.openhab.core;
1,745,737
Preconditions.checkArgument(isKey==false, "LiAvroDeserializer only works for value fields"); _datumReader = new GenericDatumReader<>(); Properties props = new Properties(); for (Map.Entry<String, ?> entry: configs.entrySet()) { String value = String.valueOf(entry.getValue()); props.setProperty(entry.getKey(), value); } _schemaRegistry = KafkaSchemaRegistryFactory.getSchemaRegistry(props); }
Preconditions.checkArgument(isKey==false, STR); _datumReader = new GenericDatumReader<>(); Properties props = new Properties(); for (Map.Entry<String, ?> entry: configs.entrySet()) { String value = String.valueOf(entry.getValue()); props.setProperty(entry.getKey(), value); } _schemaRegistry = KafkaSchemaRegistryFactory.getSchemaRegistry(props); }
/** * Configure this class. * @param configs configs in key/value pairs * @param isKey whether is for key or value */
Configure this class
configure
{ "repo_name": "lbendig/gobblin", "path": "gobblin-modules/gobblin-kafka-common/src/main/java/gobblin/kafka/serialize/LiAvroDeserializerBase.java", "license": "apache-2.0", "size": 4418 }
[ "com.google.common.base.Preconditions", "java.util.Map", "java.util.Properties", "org.apache.avro.generic.GenericDatumReader" ]
import com.google.common.base.Preconditions; import java.util.Map; import java.util.Properties; import org.apache.avro.generic.GenericDatumReader;
import com.google.common.base.*; import java.util.*; import org.apache.avro.generic.*;
[ "com.google.common", "java.util", "org.apache.avro" ]
com.google.common; java.util; org.apache.avro;
2,376,755
public void clear() { phoneList = new ArrayList<String>(); }
void function() { phoneList = new ArrayList<String>(); }
/** * Clear the contents of this and set it to a default state. */
Clear the contents of this and set it to a default state
clear
{ "repo_name": "TATRC/KMR2", "path": "Common/NhincLib/src/main/java/gov/hhs/fha/nhinc/connectmgr/data/CMPhones.java", "license": "bsd-3-clause", "size": 3177 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,177,373
@Override public void sendMail(String subject, String message, Collection<String> toAddresses) { Mailing mail = Mailing.newPlain(); mail.subject = subject; mail.content = message; mail.setRecipients(toAddresses); send(mail); }
void function(String subject, String message, Collection<String> toAddresses) { Mailing mail = Mailing.newPlain(); mail.subject = subject; mail.content = message; mail.setRecipients(toAddresses); send(mail); }
/** * Notify users by email of something. * * @param subject * @param message * @param toAddresses */
Notify users by email of something
sendMail
{ "repo_name": "wellington-junio/gitblit", "path": "src/main/java/com/gitblit/manager/NotificationManager.java", "license": "apache-2.0", "size": 3581 }
[ "com.gitblit.models.Mailing", "java.util.Collection" ]
import com.gitblit.models.Mailing; import java.util.Collection;
import com.gitblit.models.*; import java.util.*;
[ "com.gitblit.models", "java.util" ]
com.gitblit.models; java.util;
2,408,358
public void setFirstBarPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument"); } this.firstBarPaint = paint; fireChangeEvent(); }
void function(Paint paint) { if (paint == null) { throw new IllegalArgumentException(STR); } this.firstBarPaint = paint; fireChangeEvent(); }
/** * Sets the paint that will be used to draw the first bar and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param paint the paint (<code>null</code> not permitted). */
Sets the paint that will be used to draw the first bar and sends a <code>RendererChangeEvent</code> to all registered listeners
setFirstBarPaint
{ "repo_name": "ilyessou/jfreechart", "path": "source/org/jfree/chart/renderer/category/WaterfallBarRenderer.java", "license": "lgpl-2.1", "size": 19370 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,365,843
@Test void testInvalidPropertyReferenceInStrictMode() throws PebbleException, IOException { RootAttributeNotFoundException rootAttributeNotFoundException = assertThrows(RootAttributeNotFoundException.class, () -> { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(true) .build(); PebbleTemplate template = pebble.getTemplate("{{ root }}"); template.evaluate(new StringWriter()); }); assertThat(rootAttributeNotFoundException.getAttributeName()).isEqualTo("root"); assertThat(rootAttributeNotFoundException.getMessage()).contains("Root attribute [root] does not exist or can not be accessed"); }
void testInvalidPropertyReferenceInStrictMode() throws PebbleException, IOException { RootAttributeNotFoundException rootAttributeNotFoundException = assertThrows(RootAttributeNotFoundException.class, () -> { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(true) .build(); PebbleTemplate template = pebble.getTemplate(STR); template.evaluate(new StringWriter()); }); assertThat(rootAttributeNotFoundException.getAttributeName()).isEqualTo("root"); assertThat(rootAttributeNotFoundException.getMessage()).contains(STR); }
/** * An error should occur when a Pebble Template Engine instance is configured with * Strict Variables set to true and a template is executed that contains a references * to an undefined property. */
An error should occur when a Pebble Template Engine instance is configured with Strict Variables set to true and a template is executed that contains a references to an undefined property
testInvalidPropertyReferenceInStrictMode
{ "repo_name": "mbosecke/pebble", "path": "pebble/src/test/java/com/mitchellbosecke/pebble/ErrorReportingTest.java", "license": "bsd-3-clause", "size": 3118 }
[ "com.mitchellbosecke.pebble.error.PebbleException", "com.mitchellbosecke.pebble.error.RootAttributeNotFoundException", "com.mitchellbosecke.pebble.loader.StringLoader", "com.mitchellbosecke.pebble.template.PebbleTemplate", "java.io.IOException", "java.io.StringWriter", "org.assertj.core.api.Assertions", "org.junit.jupiter.api.Assertions" ]
import com.mitchellbosecke.pebble.error.PebbleException; import com.mitchellbosecke.pebble.error.RootAttributeNotFoundException; import com.mitchellbosecke.pebble.loader.StringLoader; import com.mitchellbosecke.pebble.template.PebbleTemplate; import java.io.IOException; import java.io.StringWriter; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Assertions;
import com.mitchellbosecke.pebble.error.*; import com.mitchellbosecke.pebble.loader.*; import com.mitchellbosecke.pebble.template.*; import java.io.*; import org.assertj.core.api.*; import org.junit.jupiter.api.*;
[ "com.mitchellbosecke.pebble", "java.io", "org.assertj.core", "org.junit.jupiter" ]
com.mitchellbosecke.pebble; java.io; org.assertj.core; org.junit.jupiter;
899,310
private String getProGuardName(IMethodBinding method) { if (!method.isConstructor() || !method.getDeclaringClass().isMember()) { return method.getName(); } ITypeBinding parent = method.getDeclaringClass(); assert parent != null; List<String> components = Lists.newLinkedList(); // LinkedList is faster for prepending. do { components.add(0, parent.getName()); parent = parent.getDeclaringClass(); } while (parent != null); return innerClassJoiner.join(components); }
String function(IMethodBinding method) { if (!method.isConstructor() !method.getDeclaringClass().isMember()) { return method.getName(); } ITypeBinding parent = method.getDeclaringClass(); assert parent != null; List<String> components = Lists.newLinkedList(); do { components.add(0, parent.getName()); parent = parent.getDeclaringClass(); } while (parent != null); return innerClassJoiner.join(components); }
/** * Get the ProGuard name of a method. * For non-constructors this is the method's name. * For constructors of top-level classes, this is the name of the class. * For constructors of inner classes, this is the $-delimited name path * from the outermost class declaration to the inner class declaration. */
Get the ProGuard name of a method. For non-constructors this is the method's name. For constructors of top-level classes, this is the name of the class. For constructors of inner classes, this is the $-delimited name path from the outermost class declaration to the inner class declaration
getProGuardName
{ "repo_name": "halfhp/j2objc", "path": "translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java", "license": "apache-2.0", "size": 6972 }
[ "com.google.common.collect.Lists", "java.util.List", "org.eclipse.jdt.core.dom.IMethodBinding", "org.eclipse.jdt.core.dom.ITypeBinding" ]
import com.google.common.collect.Lists; import java.util.List; import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding;
import com.google.common.collect.*; import java.util.*; import org.eclipse.jdt.core.dom.*;
[ "com.google.common", "java.util", "org.eclipse.jdt" ]
com.google.common; java.util; org.eclipse.jdt;
918,900
public void addTrait(Integer traitCode, Object prop) { // use treemap since the typical number of traits are less than four if (traits == null) { traits = new TreeMap<Integer, Object>(); } traits.put(traitCode, prop); }
void function(Integer traitCode, Object prop) { if (traits == null) { traits = new TreeMap<Integer, Object>(); } traits.put(traitCode, prop); }
/** * Add a trait to this area. * * @param traitCode the trait key * @param prop the value of the trait */
Add a trait to this area
addTrait
{ "repo_name": "pellcorp/fop", "path": "src/java/org/apache/fop/area/Area.java", "license": "apache-2.0", "size": 12917 }
[ "java.util.TreeMap" ]
import java.util.TreeMap;
import java.util.*;
[ "java.util" ]
java.util;
567,040
public void update(Graphics g) { paint(g); }
void function(Graphics g) { paint(g); }
/** * Method declaration * * * @param g */
Method declaration
update
{ "repo_name": "simeshev/parabuild-ci", "path": "3rdparty/hsqldb1733/src/org/hsqldb/util/Grid.java", "license": "lgpl-3.0", "size": 15090 }
[ "java.awt.Graphics" ]
import java.awt.Graphics;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,660,213
private String getSelectedImageName(MIDlet midlet) { Displayable d = Display.getDisplay(midlet).getCurrent(); System.out.println("[ICopyPhotoFacade] d="+d); List selected = (List) Display.getDisplay(midlet).getCurrent(); if (selected == null) System.out.println("Current List from display is NULL!"); String name = selected.getString(selected.getSelectedIndex()); return name; }
String function(MIDlet midlet) { Displayable d = Display.getDisplay(midlet).getCurrent(); System.out.println(STR+d); List selected = (List) Display.getDisplay(midlet).getCurrent(); if (selected == null) System.out.println(STR); String name = selected.getString(selected.getSelectedIndex()); return name; }
/** * Get the last selected image from the Photo List screen. * TODO: This really only gets the selected List item. * So it is only an image name if you are on the PhotoList screen... * Need to fix this */
Get the last selected image from the Photo List screen. So it is only an image name if you are on the PhotoList screen... Need to fix this
getSelectedImageName
{ "repo_name": "leotizzei/MobileMedia-Cosmos-VP-v5", "path": "src/br/unicamp/ic/sed/mobilemedia/copyphoto/impl/ICopyPhotoFacade.java", "license": "mit", "size": 1808 }
[ "javax.microedition.lcdui.Display", "javax.microedition.lcdui.Displayable", "javax.microedition.lcdui.List", "javax.microedition.midlet.MIDlet" ]
import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.List; import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*; import javax.microedition.midlet.*;
[ "javax.microedition" ]
javax.microedition;
1,761,483
int intlayerNum; try { intlayerNum=map.getLayerCount(); if(intlayerNum==0){ MessageDialog.openInformation(null,"地图出错","没有图层,请加入地图再操作,谢谢!!!"); return false; }else{ try { UID pid = new UID(); pid.setValue("{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}"); pEnumLayer = map.getLayers(pid, true); pEnumLayer.reset(); layer = pEnumLayer.next(); while (layer != null) { //把获取的layer保存到layers中 layers.add(layer); String strLayerName = layer.getName(); combo.add(strLayerName); layer = pEnumLayer.next(); // return true; } // } combo.select(0); return true; } catch (AutomationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } catch (AutomationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // try { // // UID pid = new UID(); // pid.setValue("{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}"); // pEnumLayer = map.getLayers(pid, true); // pEnumLayer.reset(); // // layer = pEnumLayer.next(); // // while (layer != null) { // // //把获取的layer保存到layers中 // layers.add(layer); // // String strLayerName = layer.getName(); // combo.add(strLayerName); // // layer = pEnumLayer.next(); // } // // } // combo.select(0); // } catch (AutomationException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } return false; }
int intlayerNum; try { intlayerNum=map.getLayerCount(); if(intlayerNum==0){ MessageDialog.openInformation(null,"地图出错",STR); return false; }else{ try { UID pid = new UID(); pid.setValue(STR); pEnumLayer = map.getLayers(pid, true); pEnumLayer.reset(); layer = pEnumLayer.next(); while (layer != null) { layers.add(layer); String strLayerName = layer.getName(); combo.add(strLayerName); layer = pEnumLayer.next(); } combo.select(0); return true; } catch (AutomationException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } catch (AutomationException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } return false; }
/** * get the map's and add them to combo renturn null */
get the map's and add them to combo renturn null
getLayer
{ "repo_name": "vonpower/VonRep", "path": "CES2/GUI/ynugis/ui/confDialog/transparentSetDialog.java", "license": "lgpl-2.1", "size": 6218 }
[ "com.esri.arcgis.interop.AutomationException", "java.io.IOException", "org.eclipse.jface.dialogs.MessageDialog" ]
import com.esri.arcgis.interop.AutomationException; import java.io.IOException; import org.eclipse.jface.dialogs.MessageDialog;
import com.esri.arcgis.interop.*; import java.io.*; import org.eclipse.jface.dialogs.*;
[ "com.esri.arcgis", "java.io", "org.eclipse.jface" ]
com.esri.arcgis; java.io; org.eclipse.jface;
872,439
protected StyledString parametersToStyledString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName) { return getParameterStyledString(elements, isVarArgs, includeName, this.keywords, this.annotationFinder, this); }
StyledString function(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName) { return getParameterStyledString(elements, isVarArgs, includeName, this.keywords, this.annotationFinder, this); }
/** Replies the styled string representation of the parameters. * * @param elements the parameters. * @param isVarArgs indicates if the last parameter is variadic. * @param includeName indicates if the names are included. * @return the styled string. * @since 0.6 */
Replies the styled string representation of the parameters
parametersToStyledString
{ "repo_name": "sarl/sarl", "path": "main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/validation/SARLUIStrings.java", "license": "apache-2.0", "size": 8011 }
[ "org.eclipse.jface.viewers.StyledString", "org.eclipse.xtext.common.types.JvmFormalParameter" ]
import org.eclipse.jface.viewers.StyledString; import org.eclipse.xtext.common.types.JvmFormalParameter;
import org.eclipse.jface.viewers.*; import org.eclipse.xtext.common.types.*;
[ "org.eclipse.jface", "org.eclipse.xtext" ]
org.eclipse.jface; org.eclipse.xtext;
1,165,654
public static boolean checkIfDataTypeNotTimeStamp(Expression expression) { if (expression.getFilterExpressionType() == ExpressionType.LITERAL && expression instanceof LiteralExpression) { DataType dataType = ((LiteralExpression) expression).getLiteralExpDataType(); if (!(dataType == DataType.TIMESTAMP || dataType == DataType.DATE)) { return true; } } for (Expression child : expression.getChildren()) { if (checkIfDataTypeNotTimeStamp(child)) { return true; } } return false; }
static boolean function(Expression expression) { if (expression.getFilterExpressionType() == ExpressionType.LITERAL && expression instanceof LiteralExpression) { DataType dataType = ((LiteralExpression) expression).getLiteralExpDataType(); if (!(dataType == DataType.TIMESTAMP dataType == DataType.DATE)) { return true; } } for (Expression child : expression.getChildren()) { if (checkIfDataTypeNotTimeStamp(child)) { return true; } } return false; }
/** * This method will check if a given literal expression is not a timestamp datatype * recursively. * * @return */
This method will check if a given literal expression is not a timestamp datatype recursively
checkIfDataTypeNotTimeStamp
{ "repo_name": "aniketadnaik/carbondataStreamIngest", "path": "core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java", "license": "apache-2.0", "size": 69343 }
[ "org.apache.carbondata.core.metadata.datatype.DataType", "org.apache.carbondata.core.scan.expression.Expression", "org.apache.carbondata.core.scan.expression.LiteralExpression", "org.apache.carbondata.core.scan.filter.intf.ExpressionType" ]
import org.apache.carbondata.core.metadata.datatype.DataType; import org.apache.carbondata.core.scan.expression.Expression; import org.apache.carbondata.core.scan.expression.LiteralExpression; import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
import org.apache.carbondata.core.metadata.datatype.*; import org.apache.carbondata.core.scan.expression.*; import org.apache.carbondata.core.scan.filter.intf.*;
[ "org.apache.carbondata" ]
org.apache.carbondata;
975,772
public Node item(int index) { DomNode ctx = first; int count = 0; while (ctx != null && count < index) { ctx = ctx.next; count++; } return ctx; }
Node function(int index) { DomNode ctx = first; int count = 0; while (ctx != null && count < index) { ctx = ctx.next; count++; } return ctx; }
/** * <b>DOM L1</b> * Returns the indexed item from the map, or null. */
DOM L1 Returns the indexed item from the map, or null
item
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/gnu/xml/dom/DomNamedNodeMap.java", "license": "bsd-3-clause", "size": 11403 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
959,578
private void grow(int minCapacity) { // overflow-conscious code int oldCapacity = elementData.length; int newCapacity = oldCapacity + (oldCapacity >> 1); if (newCapacity - minCapacity < 0) newCapacity = minCapacity; if (newCapacity - MAX_ARRAY_SIZE > 0) newCapacity = hugeCapacity(minCapacity); // minCapacity is usually close to size, so this is a win: elementData = Arrays.copyOf(elementData, newCapacity); }
void function(int minCapacity) { int oldCapacity = elementData.length; int newCapacity = oldCapacity + (oldCapacity >> 1); if (newCapacity - minCapacity < 0) newCapacity = minCapacity; if (newCapacity - MAX_ARRAY_SIZE > 0) newCapacity = hugeCapacity(minCapacity); elementData = Arrays.copyOf(elementData, newCapacity); }
/** * Increases the capacity to ensure that it can hold at least the number of elements specified by the minimum * capacity argument. * * @param minCapacity the desired minimum capacity */
Increases the capacity to ensure that it can hold at least the number of elements specified by the minimum capacity argument
grow
{ "repo_name": "lyrachord/FX3DAndroid", "path": "src/main/java/eu/mihosoft/vrl/v3d/ext/openjfx/importers/obj/IntegerArrayList.java", "license": "gpl-3.0", "size": 43755 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
761,751