method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
@ApiModelProperty(required = true, value = "bookmark_id integer")
public Integer getBookmarkId() {
return bookmarkId;
} | @ApiModelProperty(required = true, value = STR) Integer function() { return bookmarkId; } | /**
* bookmark_id integer
*
* @return bookmarkId
**/ | bookmark_id integer | getBookmarkId | {
"repo_name": "burberius/eve-esi",
"path": "src/main/java/net/troja/eve/esi/model/CharacterBookmarksResponse.java",
"license": "apache-2.0",
"size": 8879
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 762,549 |
private void initialiseActivitiDBSchema(Connection connection)
{
// create instance of activiti engine to initialise schema
ProcessEngine engine = null;
ProcessEngineConfiguration engineConfig = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
try
{
// build the engine
engine = engineConfig.setDataSource(dataSource).
setDatabaseSchemaUpdate("none").
setProcessEngineName("activitiBootstrapEngine").
setHistory("full").
setJobExecutorActivate(false).
buildProcessEngine();
String schemaName = dbSchemaName != null ? dbSchemaName : databaseMetaDataHelper.getSchema(connection);
// create or upgrade the DB schema
engine.getManagementService().databaseSchemaUpgrade(connection, null, schemaName);
}
finally
{
if (engine != null)
{
// close the process engine
engine.close();
}
}
}
| void function(Connection connection) { ProcessEngine engine = null; ProcessEngineConfiguration engineConfig = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration(); try { engine = engineConfig.setDataSource(dataSource). setDatabaseSchemaUpdate("none"). setProcessEngineName(STR). setHistory("full"). setJobExecutorActivate(false). buildProcessEngine(); String schemaName = dbSchemaName != null ? dbSchemaName : databaseMetaDataHelper.getSchema(connection); engine.getManagementService().databaseSchemaUpgrade(connection, null, schemaName); } finally { if (engine != null) { engine.close(); } } } | /**
* Initialises the Activiti DB schema, if not present it's created.
*
* @param connection Connection to use the initialise DB schema
*/ | Initialises the Activiti DB schema, if not present it's created | initialiseActivitiDBSchema | {
"repo_name": "loftuxab/alfresco-community-loftux",
"path": "projects/repository/source/java/org/alfresco/repo/domain/schema/SchemaBootstrap.java",
"license": "lgpl-3.0",
"size": 99930
} | [
"java.sql.Connection",
"org.activiti.engine.ProcessEngine",
"org.activiti.engine.ProcessEngineConfiguration"
] | import java.sql.Connection; import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngineConfiguration; | import java.sql.*; import org.activiti.engine.*; | [
"java.sql",
"org.activiti.engine"
] | java.sql; org.activiti.engine; | 1,436,625 |
public void setContents(MaterialData materialData) {
Material mat = materialData.getItemType();
if (mat == Material.RED_ROSE) {
setData((byte) 1);
} else if (mat == Material.YELLOW_FLOWER) {
setData((byte) 2);
} else if (mat == Material.RED_MUSHROOM) {
setData((byte) 7);
} else if (mat == Material.BROWN_MUSHROOM) {
setData((byte) 8);
} else if (mat == Material.CACTUS) {
setData((byte) 9);
} else if (mat == Material.DEAD_BUSH) {
setData((byte) 10);
} else if (mat == Material.SAPLING) {
TreeSpecies species = ((Tree) materialData).getSpecies();
if (species == TreeSpecies.GENERIC) {
setData((byte) 3);
} else if (species == TreeSpecies.REDWOOD) {
setData((byte) 4);
} else if (species == TreeSpecies.BIRCH) {
setData((byte) 5);
} else {
setData((byte) 6);
}
} else if (mat == Material.LONG_GRASS) {
GrassSpecies species = ((LongGrass) materialData).getSpecies();
if (species == GrassSpecies.FERN_LIKE) {
setData((byte) 11);
}
}
} | void function(MaterialData materialData) { Material mat = materialData.getItemType(); if (mat == Material.RED_ROSE) { setData((byte) 1); } else if (mat == Material.YELLOW_FLOWER) { setData((byte) 2); } else if (mat == Material.RED_MUSHROOM) { setData((byte) 7); } else if (mat == Material.BROWN_MUSHROOM) { setData((byte) 8); } else if (mat == Material.CACTUS) { setData((byte) 9); } else if (mat == Material.DEAD_BUSH) { setData((byte) 10); } else if (mat == Material.SAPLING) { TreeSpecies species = ((Tree) materialData).getSpecies(); if (species == TreeSpecies.GENERIC) { setData((byte) 3); } else if (species == TreeSpecies.REDWOOD) { setData((byte) 4); } else if (species == TreeSpecies.BIRCH) { setData((byte) 5); } else { setData((byte) 6); } } else if (mat == Material.LONG_GRASS) { GrassSpecies species = ((LongGrass) materialData).getSpecies(); if (species == GrassSpecies.FERN_LIKE) { setData((byte) 11); } } } | /**
* Set the contents of the flower pot
*
* @param materialData MaterialData of the block to put in the flower pot.
*/ | Set the contents of the flower pot | setContents | {
"repo_name": "MasterMarkHarmon/Spigot",
"path": "src/main/java/org/bukkit/material/FlowerPot.java",
"license": "gpl-3.0",
"size": 3678
} | [
"org.bukkit.GrassSpecies",
"org.bukkit.Material",
"org.bukkit.TreeSpecies"
] | import org.bukkit.GrassSpecies; import org.bukkit.Material; import org.bukkit.TreeSpecies; | import org.bukkit.*; | [
"org.bukkit"
] | org.bukkit; | 528,753 |
@JsonProperty("date")
public Date getDate() {
return date;
} | @JsonProperty("date") Date function() { return date; } | /**
* Release Date
* <p>
* The date this information is released, it may well be the same as the parent publishedDate,
* it must not be later than the publishedDate from the parent package. It is used to determine merge order.
* (Required)
*
* @return
* The date
*/ | Release Date The date this information is released, it may well be the same as the parent publishedDate, it must not be later than the publishedDate from the parent package. It is used to determine merge order. (Required) | getDate | {
"repo_name": "devgateway/ocvn",
"path": "persistence-mongodb/src/main/java/org/devgateway/ocds/persistence/mongo/Release.java",
"license": "mit",
"size": 18384
} | [
"com.fasterxml.jackson.annotation.JsonProperty",
"java.util.Date"
] | import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Date; | import com.fasterxml.jackson.annotation.*; import java.util.*; | [
"com.fasterxml.jackson",
"java.util"
] | com.fasterxml.jackson; java.util; | 1,309,736 |
public AttributeList queryAttributes(ObjectName objectname, String attrname) throws Exception {
MBeanAttributeInfo[] infos = mbeanServer.getMBeanInfo(objectname).getAttributes();
ArrayList<String> attrnames = new ArrayList<String>();
if (attrname.equals("*")) {
for (MBeanAttributeInfo info : infos) {
attrnames.add(info.getName());
}
} else if (attrname.indexOf(',') >= 0) {
for (String token : attrname.split(","))
attrnames.add(token);
} else {
attrnames.add(attrname);
}
| AttributeList function(ObjectName objectname, String attrname) throws Exception { MBeanAttributeInfo[] infos = mbeanServer.getMBeanInfo(objectname).getAttributes(); ArrayList<String> attrnames = new ArrayList<String>(); if (attrname.equals("*")) { for (MBeanAttributeInfo info : infos) { attrnames.add(info.getName()); } } else if (attrname.indexOf(',') >= 0) { for (String token : attrname.split(",")) attrnames.add(token); } else { attrnames.add(attrname); } | /** Get a sorted list of Attributes given the objectname query string and an attrname string.
* @param objectname e.g. "java.lang:type=Memory" or "org.hornetq:module=Core,type=Acceptor,*"
* @param attrname e.g. "HeapMemoryUsage" or "HeapMemoryUsage,NonHeapMemoryUsage" or "*"
*/ | Get a sorted list of Attributes given the objectname query string and an attrname string | queryAttributes | {
"repo_name": "g76r/jmxsi",
"path": "src/main/java/com/hallowyn/jmxsi/JmxShellInterface.java",
"license": "gpl-3.0",
"size": 17200
} | [
"java.util.ArrayList",
"javax.management.AttributeList",
"javax.management.MBeanAttributeInfo",
"javax.management.ObjectName"
] | import java.util.ArrayList; import javax.management.AttributeList; import javax.management.MBeanAttributeInfo; import javax.management.ObjectName; | import java.util.*; import javax.management.*; | [
"java.util",
"javax.management"
] | java.util; javax.management; | 619,514 |
private static List<List<String>> importCsv(File file) throws FileNotFoundException, IOException {
List<List<String>> rows = new ArrayList<List<String>>();
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
String line;
while ((line = br.readLine()) != null) {
rows.add(Arrays.asList(line.split(",")));
}
}
return rows;
}
| static List<List<String>> function(File file) throws FileNotFoundException, IOException { List<List<String>> rows = new ArrayList<List<String>>(); try (BufferedReader br = new BufferedReader(new FileReader(file))) { String line; while ((line = br.readLine()) != null) { rows.add(Arrays.asList(line.split(","))); } } return rows; } | /**
* Imports a CSV file.
*
* @param file points to the CSV file
* @return List<List<String>> are the rows and values of the CSV file
* @throws FileNotFoundException
* @throws IOException
*/ | Imports a CSV file | importCsv | {
"repo_name": "woodser/logistic_regression",
"path": "test/test/learner/TestAbalone.java",
"license": "mit",
"size": 5032
} | [
"java.io.BufferedReader",
"java.io.File",
"java.io.FileNotFoundException",
"java.io.FileReader",
"java.io.IOException",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List"
] | import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,076,659 |
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMultiRoleMetricDefinitionsSinglePageAsync(final String resourceGroupName, final String name) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> function(final String resourceGroupName, final String name) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (name == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Get metric definitions for a multi-role pool of an App Service Environment.
* Get metric definitions for a multi-role pool of an App Service Environment.
*
ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> * @param resourceGroupName Name of the resource group to which the resource belongs.
ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> * @param name Name of the App Service Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<ResourceMetricDefinitionInner> object wrapped in {@link ServiceResponse} if successful.
*/ | Get metric definitions for a multi-role pool of an App Service Environment. Get metric definitions for a multi-role pool of an App Service Environment | listMultiRoleMetricDefinitionsSinglePageAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/appservice/mgmt-v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java",
"license": "mit",
"size": 595166
} | [
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 1,234,502 |
boolean supports(ConfigAttribute attribute); | boolean supports(ConfigAttribute attribute); | /**
* Indicates whether this <code>ChannelDecisionManager</code> is able to process the
* passed <code>ConfigAttribute</code>.
* <p>
* This allows the <code>ChannelProcessingFilter</code> to check every configuration
* attribute can be consumed by the configured <code>ChannelDecisionManager</code>.
* </p>
*
* @param attribute a configuration attribute that has been configured against the
* <code>ChannelProcessingFilter</code>
*
* @return true if this <code>ChannelDecisionManager</code> can support the passed
* configuration attribute
*/ | Indicates whether this <code>ChannelDecisionManager</code> is able to process the passed <code>ConfigAttribute</code>. This allows the <code>ChannelProcessingFilter</code> to check every configuration attribute can be consumed by the configured <code>ChannelDecisionManager</code>. | supports | {
"repo_name": "eddumelendez/spring-security",
"path": "web/src/main/java/org/springframework/security/web/access/channel/ChannelDecisionManager.java",
"license": "apache-2.0",
"size": 2086
} | [
"org.springframework.security.access.ConfigAttribute"
] | import org.springframework.security.access.ConfigAttribute; | import org.springframework.security.access.*; | [
"org.springframework.security"
] | org.springframework.security; | 1,271,739 |
protected void selectedFile(IFile file, IAction action) {
String path = file.getLocation().toOSString();
if(!RegistryCheckInClientUtils.isRegistryResource(file.getLocation().toOSString()) || (RegistryCheckInClientUtils.isRegistryResource(file.getLocation().toOSString()) &&
RegistryCheckInClientUtils.getResourceState(file.getLocation().toOSString()) == RegistryCheckInClientUtils.RESOURCE_STATE_NORMAL)){
action.setEnabled(false);
}else{
try {
if (isRequestUser()) {
action.setText("Commit changes as user...");
} else {
RemoteRegistryInfo r = RegistryCheckInClientUtils
.getResourceRemoteRegistryUrlInfo(path);
String username = RegistryCredentialData.getInstance()
.getUsername(r.getUrl().toString());
if (username != null && !username.equals("")){
action.setText("Commit changes [user:" + username+ "]");
}else {
action.setText("Commit changes");
action.setEnabled(false);
}
}
} catch (Exception e) {
// MessageDialog.openError(Display.getCurrent().getActiveShell(),
// "Failure",
// "Commit Failed due to un-availability of the registry instance..");
log.error(e);
}
}
// if(!RegistryCheckInClientUtils.isRegistryResource(file.getLocation().toOSString())){
// action.setEnabled(false);
// }
}
| void function(IFile file, IAction action) { String path = file.getLocation().toOSString(); if(!RegistryCheckInClientUtils.isRegistryResource(file.getLocation().toOSString()) (RegistryCheckInClientUtils.isRegistryResource(file.getLocation().toOSString()) && RegistryCheckInClientUtils.getResourceState(file.getLocation().toOSString()) == RegistryCheckInClientUtils.RESOURCE_STATE_NORMAL)){ action.setEnabled(false); }else{ try { if (isRequestUser()) { action.setText(STR); } else { RemoteRegistryInfo r = RegistryCheckInClientUtils .getResourceRemoteRegistryUrlInfo(path); String username = RegistryCredentialData.getInstance() .getUsername(r.getUrl().toString()); if (username != null && !username.equals(STRCommit changes [user:STR]STRCommit changes"); action.setEnabled(false); } } } catch (Exception e) { log.error(e); } } } | /**
* diasble action for selected File
*/ | diasble action for selected File | selectedFile | {
"repo_name": "chanakaudaya/developer-studio",
"path": "registry/org.wso2.developerstudio.eclipse.greg.manager.local/src/org/wso2/developerstudio/eclipse/greg/manager/local/checkout/actions/CommitAction.java",
"license": "apache-2.0",
"size": 9351
} | [
"org.eclipse.core.resources.IFile",
"org.eclipse.jface.action.IAction",
"org.wso2.developerstudio.eclipse.greg.base.persistent.RegistryCredentialData",
"org.wso2.developerstudio.eclipse.greg.manager.local.bean.RemoteRegistryInfo",
"org.wso2.developerstudio.eclipse.greg.manager.local.utils.RegistryCheckInClientUtils"
] | import org.eclipse.core.resources.IFile; import org.eclipse.jface.action.IAction; import org.wso2.developerstudio.eclipse.greg.base.persistent.RegistryCredentialData; import org.wso2.developerstudio.eclipse.greg.manager.local.bean.RemoteRegistryInfo; import org.wso2.developerstudio.eclipse.greg.manager.local.utils.RegistryCheckInClientUtils; | import org.eclipse.core.resources.*; import org.eclipse.jface.action.*; import org.wso2.developerstudio.eclipse.greg.base.persistent.*; import org.wso2.developerstudio.eclipse.greg.manager.local.bean.*; import org.wso2.developerstudio.eclipse.greg.manager.local.utils.*; | [
"org.eclipse.core",
"org.eclipse.jface",
"org.wso2.developerstudio"
] | org.eclipse.core; org.eclipse.jface; org.wso2.developerstudio; | 2,032,115 |
public static int fuzzyScore(CharSequence term, CharSequence query) {
return fuzzyScore(term, query, Locale.getDefault());
} | static int function(CharSequence term, CharSequence query) { return fuzzyScore(term, query, Locale.getDefault()); } | /**
* Copied from Apache FuzzyScore implementation.
* One point is given for every matched character. Subsequent matches yield two bonus points. A higher score
* indicates a higher similarity.
*/ | Copied from Apache FuzzyScore implementation. One point is given for every matched character. Subsequent matches yield two bonus points. A higher score indicates a higher similarity | fuzzyScore | {
"repo_name": "liuyuanyuan/dbeaver",
"path": "plugins/org.jkiss.dbeaver.model.sql/src/org/jkiss/dbeaver/model/text/TextUtils.java",
"license": "apache-2.0",
"size": 4872
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,268,859 |
FontMetrics m = g2d.getFontMetrics();
int originalY = y;
if (m.stringWidth(text) < lineWidth) {
g2d.drawString(text, x, y);
} else {
String[] words = text.split(" ");
String currentLine = words[0];
for (int i = 1; i < words.length; i++) {
if (m.stringWidth(currentLine + words[i]) < lineWidth) {
currentLine += " " + words[i];
} else {
g2d.drawString(currentLine, x, y);
y += m.getHeight();
currentLine = words[i];
}
}
if (currentLine.trim().length() > 0) {
g2d.drawString(currentLine, x, y);
}
}
return y - originalY + m.getHeight();
} | FontMetrics m = g2d.getFontMetrics(); int originalY = y; if (m.stringWidth(text) < lineWidth) { g2d.drawString(text, x, y); } else { String[] words = text.split(" "); String currentLine = words[0]; for (int i = 1; i < words.length; i++) { if (m.stringWidth(currentLine + words[i]) < lineWidth) { currentLine += " " + words[i]; } else { g2d.drawString(currentLine, x, y); y += m.getHeight(); currentLine = words[i]; } } if (currentLine.trim().length() > 0) { g2d.drawString(currentLine, x, y); } } return y - originalY + m.getHeight(); } | /**
* Draw a String (splitted over spaces) over several lines, such that it can fit within the lines.
* @param g2d the graphics of the jcomponent
* @param text the text it should blit on the screen
* @param lineWidth the max-linewidth a line should occupy.
* @param x the x-position of the text to start
* @param y the y-position of the text to start.
* @return the amount of pixels downwards it took to draw
*/ | Draw a String (splitted over spaces) over several lines, such that it can fit within the lines | drawMultiLineString | {
"repo_name": "MartijnTheunissen/PLNR",
"path": "src/psopv/taskplanner/util/Graphics2DHelper.java",
"license": "gpl-2.0",
"size": 4760
} | [
"java.awt.FontMetrics"
] | import java.awt.FontMetrics; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,903,522 |
public static MozuClient<com.mozu.api.contracts.productadmin.CategoryPagedCollection> getCategoriesClient() throws Exception
{
return getCategoriesClient( null, null, null, null, null);
} | static MozuClient<com.mozu.api.contracts.productadmin.CategoryPagedCollection> function() throws Exception { return getCategoriesClient( null, null, null, null, null); } | /**
* Retrieves a list of categories according to any specified filter criteria and sort options.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.productadmin.CategoryPagedCollection> mozuClient=GetCategoriesClient();
* client.setBaseAddress(url);
* client.executeRequest();
* CategoryPagedCollection categoryPagedCollection = client.Result();
* </code></pre></p>
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.CategoryPagedCollection>
* @see com.mozu.api.contracts.productadmin.CategoryPagedCollection
*/ | Retrieves a list of categories according to any specified filter criteria and sort options. <code><code> MozuClient mozuClient=GetCategoriesClient(); client.setBaseAddress(url); client.executeRequest(); CategoryPagedCollection categoryPagedCollection = client.Result(); </code></code> | getCategoriesClient | {
"repo_name": "bhewett/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/CategoryClient.java",
"license": "mit",
"size": 23217
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 1,622,546 |
@Nullable
private static ScaleType getScaleTypeFromXml(
TypedArray gdhAttrs,
int attrId) {
switch (gdhAttrs.getInt(attrId, -2)) {
case -1: // none
return null;
case 0: // fitXY
return ScaleType.FIT_XY;
case 1: // fitStart
return ScaleType.FIT_START;
case 2: // fitCenter
return ScaleType.FIT_CENTER;
case 3: // fitEnd
return ScaleType.FIT_END;
case 4: // center
return ScaleType.CENTER;
case 5: // centerInside
return ScaleType.CENTER_INSIDE;
case 6: // centerCrop
return ScaleType.CENTER_CROP;
case 7: // focusCrop
return ScaleType.FOCUS_CROP;
case 8: // fitBottomStart
return ScaleType.FIT_BOTTOM_START;
default:
// this method is supposed to be called only when XML attribute is specified.
throw new RuntimeException("XML attribute not specified!");
}
} | static ScaleType function( TypedArray gdhAttrs, int attrId) { switch (gdhAttrs.getInt(attrId, -2)) { case -1: return null; case 0: return ScaleType.FIT_XY; case 1: return ScaleType.FIT_START; case 2: return ScaleType.FIT_CENTER; case 3: return ScaleType.FIT_END; case 4: return ScaleType.CENTER; case 5: return ScaleType.CENTER_INSIDE; case 6: return ScaleType.CENTER_CROP; case 7: return ScaleType.FOCUS_CROP; case 8: return ScaleType.FIT_BOTTOM_START; default: throw new RuntimeException(STR); } } | /**
* Returns the scale type indicated in XML, or null if the special 'none' value was found.
* Important: these values need to be in sync with GenericDraweeHierarchy styleable attributes.
*/ | Returns the scale type indicated in XML, or null if the special 'none' value was found. Important: these values need to be in sync with GenericDraweeHierarchy styleable attributes | getScaleTypeFromXml | {
"repo_name": "s1rius/fresco",
"path": "drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchyInflater.java",
"license": "mit",
"size": 13356
} | [
"android.content.res.TypedArray",
"com.facebook.drawee.drawable.ScalingUtils"
] | import android.content.res.TypedArray; import com.facebook.drawee.drawable.ScalingUtils; | import android.content.res.*; import com.facebook.drawee.drawable.*; | [
"android.content",
"com.facebook.drawee"
] | android.content; com.facebook.drawee; | 688,889 |
public static Logger getLogger(final String name)
{
return ((CoalaLog4jHierarchy) LogManager.getLoggerRepository()).getLogger(name);
}
/**
* @param clazz the object type generating the log messages
* @return the {@link java.util.logging.Logger} instance for specified
* {@code clazz} | static Logger function(final String name) { return ((CoalaLog4jHierarchy) LogManager.getLoggerRepository()).getLogger(name); } /** * @param clazz the object type generating the log messages * @return the {@link java.util.logging.Logger} instance for specified * {@code clazz} | /**
* this method is preferred over {@link Logger#getLogger} so as to
* initialize the Log$j system correctly via this {@link LogUtil} class
*
* @param name
* @return
*/ | this method is preferred over <code>Logger#getLogger</code> so as to initialize the Log$j system correctly via this <code>LogUtil</code> class | getLogger | {
"repo_name": "krevelen/coala",
"path": "coala-core/src/main/java/io/coala/log/LogUtil.java",
"license": "apache-2.0",
"size": 6298
} | [
"org.apache.log4j.LogManager",
"org.apache.log4j.Logger"
] | import org.apache.log4j.LogManager; import org.apache.log4j.Logger; | import org.apache.log4j.*; | [
"org.apache.log4j"
] | org.apache.log4j; | 146,308 |
public static <T extends Offset<T>> Ordering<OffsetRange<T>> byEarlierStartLaterEndOrdering() {
return Ordering.<T>natural().onResultOf(OffsetRange.<T>toStartInclusiveFunction())
.compound(
Ordering.<T>natural().onResultOf(OffsetRange.<T>toEndInclusiveFunction()).reverse());
} | static <T extends Offset<T>> Ordering<OffsetRange<T>> function() { return Ordering.<T>natural().onResultOf(OffsetRange.<T>toStartInclusiveFunction()) .compound( Ordering.<T>natural().onResultOf(OffsetRange.<T>toEndInclusiveFunction()).reverse()); } | /**
* Provides a total {@link Ordering} over {@link OffsetRange}s by their start position, breaking
* ties by placing the later end position first.
*/ | Provides a total <code>Ordering</code> over <code>OffsetRange</code>s by their start position, breaking ties by placing the later end position first | byEarlierStartLaterEndOrdering | {
"repo_name": "BBN-E/bue-common-open",
"path": "common-core-open/src/main/java/com/bbn/bue/common/strings/offsets/OffsetRange.java",
"license": "mit",
"size": 9433
} | [
"com.google.common.collect.Ordering"
] | import com.google.common.collect.Ordering; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 2,868,114 |
public Pointer hnj_hyphen_load(String fn); | Pointer function(String fn); | /**
* Create the hyphen lib instance
*
* @param fn
* The hyphenation file path
* @return The hyphen library object
*/ | Create the hyphen lib instance | hnj_hyphen_load | {
"repo_name": "dedeibel/libhyphenjna",
"path": "src/name/benjaminpeter/hyphen/HyphenLibrary.java",
"license": "lgpl-3.0",
"size": 846
} | [
"com.sun.jna.Pointer"
] | import com.sun.jna.Pointer; | import com.sun.jna.*; | [
"com.sun.jna"
] | com.sun.jna; | 2,670,937 |
public static MozuClient deleteLocationTypeClient(String locationTypeCode) throws Exception
{
MozuUrl url = com.mozu.api.urls.commerce.admin.LocationTypeUrl.deleteLocationTypeUrl(locationTypeCode);
String verb = "DELETE";
MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance();
mozuClient.setVerb(verb);
mozuClient.setResourceUrl(url);
return mozuClient;
} | static MozuClient function(String locationTypeCode) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.admin.LocationTypeUrl.deleteLocationTypeUrl(locationTypeCode); String verb = STR; MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance(); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; } | /**
* Deletes the location type specified in the request.
* <p><pre><code>
* MozuClient mozuClient=DeleteLocationTypeClient( locationTypeCode);
* client.setBaseAddress(url);
* client.executeRequest();
* </code></pre></p>
* @param locationTypeCode The user-defined code that identifies the location type.
* @return Mozu.Api.MozuClient
*/ | Deletes the location type specified in the request. <code><code> MozuClient mozuClient=DeleteLocationTypeClient( locationTypeCode); client.setBaseAddress(url); client.executeRequest(); </code></code> | deleteLocationTypeClient | {
"repo_name": "lakshmi-nair/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/admin/LocationTypeClient.java",
"license": "mit",
"size": 9977
} | [
"com.mozu.api.MozuClient",
"com.mozu.api.MozuClientFactory",
"com.mozu.api.MozuUrl"
] | import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 1,117,216 |
public void adjustMediumProperties(final PlayerLocation loc) {
// Ensure block flags have been collected.
loc.collectBlockFlags();
// Simplified.
if (loc.isInWeb()) {
liftOffEnvelope = LiftOffEnvelope.NO_JUMP;
nextFrictionHorizontal = nextFrictionVertical = 0.0;
}
else if (loc.isInLiquid()) {
// TODO: Distinguish strong limit.
liftOffEnvelope = LiftOffEnvelope.LIMIT_LIQUID;
if (loc.isInLava()) {
nextFrictionHorizontal = nextFrictionVertical = Magic.FRICTION_MEDIUM_LAVA;
} else {
nextFrictionHorizontal = nextFrictionVertical = Magic.FRICTION_MEDIUM_WATER;
}
}
else if (loc.isOnGround()) {
liftOffEnvelope = LiftOffEnvelope.NORMAL;
nextFrictionHorizontal = nextFrictionVertical = Magic.FRICTION_MEDIUM_AIR;
}
else {
liftOffEnvelope = LiftOffEnvelope.UNKNOWN;
nextFrictionHorizontal = nextFrictionVertical = Magic.FRICTION_MEDIUM_AIR;
}
insideMediumCount = 0;
}
| void function(final PlayerLocation loc) { loc.collectBlockFlags(); if (loc.isInWeb()) { liftOffEnvelope = LiftOffEnvelope.NO_JUMP; nextFrictionHorizontal = nextFrictionVertical = 0.0; } else if (loc.isInLiquid()) { liftOffEnvelope = LiftOffEnvelope.LIMIT_LIQUID; if (loc.isInLava()) { nextFrictionHorizontal = nextFrictionVertical = Magic.FRICTION_MEDIUM_LAVA; } else { nextFrictionHorizontal = nextFrictionVertical = Magic.FRICTION_MEDIUM_WATER; } } else if (loc.isOnGround()) { liftOffEnvelope = LiftOffEnvelope.NORMAL; nextFrictionHorizontal = nextFrictionVertical = Magic.FRICTION_MEDIUM_AIR; } else { liftOffEnvelope = LiftOffEnvelope.UNKNOWN; nextFrictionHorizontal = nextFrictionVertical = Magic.FRICTION_MEDIUM_AIR; } insideMediumCount = 0; } | /**
* Adjust properties that relate to the medium, called on set back and
* similar. <br>
* Currently: liftOffEnvelope, nextFriction.
*
* @param loc
*/ | Adjust properties that relate to the medium, called on set back and similar. Currently: liftOffEnvelope, nextFriction | adjustMediumProperties | {
"repo_name": "NoCheatPlus/NoCheatPlus",
"path": "NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingData.java",
"license": "gpl-3.0",
"size": 48888
} | [
"fr.neatmonster.nocheatplus.checks.moving.magic.Magic",
"fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope",
"fr.neatmonster.nocheatplus.utilities.location.PlayerLocation"
] | import fr.neatmonster.nocheatplus.checks.moving.magic.Magic; import fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope; import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation; | import fr.neatmonster.nocheatplus.checks.moving.magic.*; import fr.neatmonster.nocheatplus.checks.moving.model.*; import fr.neatmonster.nocheatplus.utilities.location.*; | [
"fr.neatmonster.nocheatplus"
] | fr.neatmonster.nocheatplus; | 2,670,654 |
public File getRootDir() {
File f = new File(project.getBuildDir(),getId());
f.mkdirs();
return f;
} | File function() { File f = new File(project.getBuildDir(),getId()); f.mkdirs(); return f; } | /**
* Root directory of this {@link Run} on the master.
*
* Files related to this {@link Run} should be stored below this directory.
*/ | Root directory of this <code>Run</code> on the master. Files related to this <code>Run</code> should be stored below this directory | getRootDir | {
"repo_name": "IsCoolEntertainment/debpkg_jenkins",
"path": "core/src/main/java/hudson/model/Run.java",
"license": "mit",
"size": 68634
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,408,932 |
conf = new OzoneConfiguration();
// set to as small as 100 bytes per block.
conf.setLong(OzoneConfigKeys.OZONE_SCM_BLOCK_SIZE_IN_MB, 1);
conf.setInt(ScmConfigKeys.OZONE_SCM_CONTAINER_PROVISION_BATCH_SIZE, 5);
cluster = MiniOzoneCluster.newBuilder(conf).build();
cluster.waitForClusterToBeReady();
storageHandler = new ObjectStoreHandler(conf).getStorageHandler();
userArgs = new UserArgs(null, OzoneUtils.getRequestID(),
null, null, null, null);
} | conf = new OzoneConfiguration(); conf.setLong(OzoneConfigKeys.OZONE_SCM_BLOCK_SIZE_IN_MB, 1); conf.setInt(ScmConfigKeys.OZONE_SCM_CONTAINER_PROVISION_BATCH_SIZE, 5); cluster = MiniOzoneCluster.newBuilder(conf).build(); cluster.waitForClusterToBeReady(); storageHandler = new ObjectStoreHandler(conf).getStorageHandler(); userArgs = new UserArgs(null, OzoneUtils.getRequestID(), null, null, null, null); } | /**
* Create a MiniDFSCluster for testing.
* <p>
* Ozone is made active by setting OZONE_ENABLED = true
*
* @throws IOException
*/ | Create a MiniDFSCluster for testing. Ozone is made active by setting OZONE_ENABLED = true | init | {
"repo_name": "xiao-chen/hadoop",
"path": "hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestMultipleContainerReadWrite.java",
"license": "apache-2.0",
"size": 8490
} | [
"org.apache.hadoop.hdds.conf.OzoneConfiguration",
"org.apache.hadoop.hdds.scm.ScmConfigKeys",
"org.apache.hadoop.hdfs.server.datanode.ObjectStoreHandler",
"org.apache.hadoop.ozone.MiniOzoneCluster",
"org.apache.hadoop.ozone.OzoneConfigKeys",
"org.apache.hadoop.ozone.web.handlers.UserArgs",
"org.apache.hadoop.ozone.web.utils.OzoneUtils"
] | import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.hdds.scm.ScmConfigKeys; import org.apache.hadoop.hdfs.server.datanode.ObjectStoreHandler; import org.apache.hadoop.ozone.MiniOzoneCluster; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.web.handlers.UserArgs; import org.apache.hadoop.ozone.web.utils.OzoneUtils; | import org.apache.hadoop.hdds.conf.*; import org.apache.hadoop.hdds.scm.*; import org.apache.hadoop.hdfs.server.datanode.*; import org.apache.hadoop.ozone.*; import org.apache.hadoop.ozone.web.handlers.*; import org.apache.hadoop.ozone.web.utils.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 323,571 |
public Object getIdentifier(Transaction tx); | Object function(Transaction tx); | /**
* Get the identifier for the transaction
* @param tx The transaction
* @return Its stable identifier
*/ | Get the identifier for the transaction | getIdentifier | {
"repo_name": "jandsu/ironjacamar",
"path": "core/src/main/java/org/ironjacamar/core/spi/transaction/TransactionIntegration.java",
"license": "epl-1.0",
"size": 10651
} | [
"javax.transaction.Transaction"
] | import javax.transaction.Transaction; | import javax.transaction.*; | [
"javax.transaction"
] | javax.transaction; | 1,700,190 |
T visitMulDiv( @NotNull QuestionnaireParser.MulDivContext ctx ); | T visitMulDiv( @NotNull QuestionnaireParser.MulDivContext ctx ); | /**
* Visit a parse tree produced by {@link QuestionnaireParser#mulDiv}.
*
* @param ctx the parse tree
* @return the visitor result
*/ | Visit a parse tree produced by <code>QuestionnaireParser#mulDiv</code> | visitMulDiv | {
"repo_name": "software-engineering-amsterdam/poly-ql",
"path": "SantiagoCarrillo/q-language/src/edu/uva/softwarecons/grammar/QuestionnaireVisitor.java",
"license": "apache-2.0",
"size": 5749
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 322,930 |
protected boolean checkAndAskPermissions() {
if (ContextCompat.checkSelfPermission(this,
android.Manifest.permission.RECORD_AUDIO)
!= PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
android.Manifest.permission.RECORD_AUDIO)) {
// After the user
// sees the explanation, try again to request the permission.
Toast.makeText(this,
R.string.permission_explain_audio_record, Toast.LENGTH_LONG).show();
}
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
android.Manifest.permission.ACCESS_FINE_LOCATION)) {
// After the user
// sees the explanation, try again to request the permission.
Toast.makeText(this,
R.string.permission_explain_gps, Toast.LENGTH_LONG).show();
}
// Request the permission.
ActivityCompat.requestPermissions(this,
new String[]{android.Manifest.permission.RECORD_AUDIO,
android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION},
PERMISSION_RECORD_AUDIO_AND_GPS);
return false;
}
return true;
} | boolean function() { if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.RECORD_AUDIO)) { Toast.makeText(this, R.string.permission_explain_audio_record, Toast.LENGTH_LONG).show(); } if (ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.ACCESS_FINE_LOCATION)) { Toast.makeText(this, R.string.permission_explain_gps, Toast.LENGTH_LONG).show(); } ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSION_RECORD_AUDIO_AND_GPS); return false; } return true; } | /**
* If necessary request user to acquire permisions for critical ressources (gps and microphone)
* @return True if service can be bind immediately. Otherwise the bind should be done using the
* @see #onRequestPermissionsResult
*/ | If necessary request user to acquire permisions for critical ressources (gps and microphone) | checkAndAskPermissions | {
"repo_name": "Picaut/NoiseCapture",
"path": "app/src/main/java/org/noise_planet/noisecapture/MainActivity.java",
"license": "gpl-3.0",
"size": 29483
} | [
"android.content.pm.PackageManager",
"android.support.v4.app.ActivityCompat",
"android.support.v4.content.ContextCompat",
"android.widget.Toast"
] | import android.content.pm.PackageManager; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.widget.Toast; | import android.content.pm.*; import android.support.v4.app.*; import android.support.v4.content.*; import android.widget.*; | [
"android.content",
"android.support",
"android.widget"
] | android.content; android.support; android.widget; | 537,072 |
protected void displayConnectionErrorDialog(String repositoryName, String repositoryURL) {
SwingTools.showVerySimpleErrorMessage("configurable_controller_connection_failed", repositoryName, repositoryURL);
} | void function(String repositoryName, String repositoryURL) { SwingTools.showVerySimpleErrorMessage(STR, repositoryName, repositoryURL); } | /**
* Displays an error dialog indicating that the connection to the server has failed.
*/ | Displays an error dialog indicating that the connection to the server has failed | displayConnectionErrorDialog | {
"repo_name": "transwarpio/rapidminer",
"path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/tools/config/gui/ConfigurableDialog.java",
"license": "gpl-3.0",
"size": 71607
} | [
"com.rapidminer.gui.tools.SwingTools"
] | import com.rapidminer.gui.tools.SwingTools; | import com.rapidminer.gui.tools.*; | [
"com.rapidminer.gui"
] | com.rapidminer.gui; | 1,184,201 |
public ArrayList<String> saveProveedor() {
ArrayList<String> listAcumulaErroresAS400 = new ArrayList<String>();
try {
//TODO: Validar datos del proveedor. Duplicidad?
Document docDummy = JSFUtil.getDocDummy();
docDummy.appendItemValue("razon", proveedor.getPrv_razonSocial());
docDummy.appendItemValue("domici", proveedor.getPrv_domicilio());
docDummy.appendItemValue("locali", proveedor.getPrv_localidad());
if(proveedor.getPrv_codigoPostal() == null){
docDummy.appendItemValue("cp1","");
docDummy.appendItemValue("cp2","");
docDummy.appendItemValue("cp3","");
}else if(proveedor.getPrv_codigoPostal().matches("[0-9]+")){//Solo numeros
docDummy.appendItemValue("cp1","");
docDummy.appendItemValue("cp2", proveedor.getPrv_codigoPostal());
docDummy.appendItemValue("cp3","");
}else{
docDummy.appendItemValue("cp1", proveedor.getPrv_codigoPostal().substring(0, 1));
docDummy.appendItemValue("cp2", proveedor.getPrv_codigoPostal().substring(1, 5));
docDummy.appendItemValue("cp3", proveedor.getPrv_codigoPostal().substring(5, 8));
}
docDummy.appendItemValue("cuit", proveedor.getPrv_cuit().replaceAll("-", ""));
docDummy.appendItemValue("telef", proveedor.getPrv_telefono());
docDummy.appendItemValue("tipofa", proveedor.getPrv_tipoFactura());
docDummy.appendItemValue("comis", (proveedor.getPrv_comision() == null) ? "0.00" : ar.com.ada3d.utilidades.Conversores.bigDecimalToAS400(proveedor.getPrv_comision(), 2));
docDummy.appendItemValue("sldini", (proveedor.getPrv_saldoInicial() == null) ? "0.00" : ar.com.ada3d.utilidades.Conversores.bigDecimalToAS400(proveedor.getPrv_saldoInicial(), 2));
docDummy.appendItemValue("estado", "0");
QueryAS400 query = new QueryAS400();
DocUsr docUsuario = (DocUsr) JSFUtil.resolveVariable("DocUsr");
String errCode = ar.com.ada3d.utilidades.Conversores.DateToString(Calendar.getInstance().getTime(), docUsuario.getUserSec() + "ddMMyyHHmmss" );
docDummy.appendItemValue("codadm", docUsuario.getUserDB());
if (proveedor.isPrv_isNew()){
if (!query.updateAS("proveedorProveInsert", docDummy)){
listAcumulaErroresAS400.add("btnSave~Por favor comuniquese con Sistemas Administrativos e informe el código de error: " + errCode);
System.out.println("ERROR: " + errCode + " METH:saveProveedor" + "_CUIT:" + proveedor.getPrv_cuit() + "_DESC: No se pudo insertar en la tabla PH_PROVE.");
}
}else{
if (!query.updateAS("proveedorProveUpdate", docDummy)) {
listAcumulaErroresAS400.add("btnSave~Por favor comuniquese con Sistemas Administrativos e informe el código de error: " + errCode);
System.out.println("ERROR: " + errCode + " METH:saveProveedor" + "_CUIT:" + proveedor.getPrv_cuit() + "_DESC: No se pudo actualizar la tabla PH_PROVE.");
}
}
} catch (Exception e) {
e.printStackTrace();
}
return listAcumulaErroresAS400;
}
| ArrayList<String> function() { ArrayList<String> listAcumulaErroresAS400 = new ArrayList<String>(); try { Document docDummy = JSFUtil.getDocDummy(); docDummy.appendItemValue("razon", proveedor.getPrv_razonSocial()); docDummy.appendItemValue(STR, proveedor.getPrv_domicilio()); docDummy.appendItemValue(STR, proveedor.getPrv_localidad()); if(proveedor.getPrv_codigoPostal() == null){ docDummy.appendItemValue("cp1",STRcp2",STRcp3","STR[0-9]+STRcp1",STRcp2STRcp3","STRcp1STRcp2STRcp3STRcuitSTR-STRSTRtelefSTRtipofaSTRcomisSTR0.00STRsldiniSTR0.00STRestadoSTR0STRDocUsrSTRddMMyyHHmmssSTRcodadmSTRproveedorProveInsertSTRbtnSave~Por favor comuniquese con Sistemas Administrativos e informe el código de error: STRERROR: STR METH:saveProveedorSTR_CUIT:STR_DESC: No se pudo insertar en la tabla PH_PROVE.STRproveedorProveUpdateSTRbtnSave~Por favor comuniquese con Sistemas Administrativos e informe el código de error: STRERROR: STR METH:saveProveedorSTR_CUIT:STR_DESC: No se pudo actualizar la tabla PH_PROVE."); } } } catch (Exception e) { e.printStackTrace(); } return listAcumulaErroresAS400; } | /**Cuando presiona btnSave Proveedor
*/ | Cuando presiona btnSave Proveedor | saveProveedor | {
"repo_name": "applinet/ar.com.ada3d.desa",
"path": "L8669/Code/Java/ar/com/ada3d/controller/ProveedorBean.java",
"license": "apache-2.0",
"size": 9698
} | [
"ar.com.ada3d.utilidades.JSFUtil",
"java.util.ArrayList",
"org.openntf.domino.Document"
] | import ar.com.ada3d.utilidades.JSFUtil; import java.util.ArrayList; import org.openntf.domino.Document; | import ar.com.ada3d.utilidades.*; import java.util.*; import org.openntf.domino.*; | [
"ar.com.ada3d",
"java.util",
"org.openntf.domino"
] | ar.com.ada3d; java.util; org.openntf.domino; | 1,266,926 |
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
private static MediaTypes getType(final Request req) throws IOException {
MediaTypes list = new MediaTypes();
final Iterable<String> headers = new RqHeaders.Base(req)
.header("Content-Type");
for (final String hdr : headers) {
list = list.merge(new MediaTypes(hdr));
}
if (list.isEmpty()) {
list = new MediaTypes("*/*");
}
return list;
} | @SuppressWarnings(STR) static MediaTypes function(final Request req) throws IOException { MediaTypes list = new MediaTypes(); final Iterable<String> headers = new RqHeaders.Base(req) .header(STR); for (final String hdr : headers) { list = list.merge(new MediaTypes(hdr)); } if (list.isEmpty()) { list = new MediaTypes("*/*"); } return list; } | /**
* Get Content-Type type provided by the client.
* @param req Request
* @return Media type
* @throws IOException If fails
*/ | Get Content-Type type provided by the client | getType | {
"repo_name": "bdragan/takes",
"path": "src/main/java/org/takes/facets/fork/FkContentType.java",
"license": "mit",
"size": 3114
} | [
"java.io.IOException",
"org.takes.Request",
"org.takes.rq.RqHeaders"
] | import java.io.IOException; import org.takes.Request; import org.takes.rq.RqHeaders; | import java.io.*; import org.takes.*; import org.takes.rq.*; | [
"java.io",
"org.takes",
"org.takes.rq"
] | java.io; org.takes; org.takes.rq; | 1,681,509 |
public NodeList getXblChildNodes(Node n) {
XBLRecord rec = getRecord(n);
if (rec.childNodes == null) {
rec.childNodes = new XblChildNodes(rec);
}
return rec.childNodes;
} | NodeList function(Node n) { XBLRecord rec = getRecord(n); if (rec.childNodes == null) { rec.childNodes = new XblChildNodes(rec); } return rec.childNodes; } | /**
* Get the list of child nodes of a node in the fully flattened tree.
*/ | Get the list of child nodes of a node in the fully flattened tree | getXblChildNodes | {
"repo_name": "git-moss/Push2Display",
"path": "lib/batik-1.8/sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java",
"license": "lgpl-3.0",
"size": 70498
} | [
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 2,830,307 |
public ListMultimap<String, String> getAllFunctionsWithSignatures() {
try (@SuppressWarnings("unused") Closeable lock = readLock.open()) {
ListMultimap<String, String> functionsWithSignatures = ArrayListMultimap.create();
for (Map.Entry<String, Map<String, DrillFuncHolder>> function : functions.entrySet()) {
functionsWithSignatures.putAll(function.getKey(), new ArrayList<>(function.getValue().keySet()));
}
return functionsWithSignatures;
}
} | ListMultimap<String, String> function() { try (@SuppressWarnings(STR) Closeable lock = readLock.open()) { ListMultimap<String, String> functionsWithSignatures = ArrayListMultimap.create(); for (Map.Entry<String, Map<String, DrillFuncHolder>> function : functions.entrySet()) { functionsWithSignatures.putAll(function.getKey(), new ArrayList<>(function.getValue().keySet())); } return functionsWithSignatures; } } | /**
* Returns list of functions with list of function signatures for each functions.
* Uses guava {@link ListMultimap} structure to return data.
* If no functions present, will return empty {@link ListMultimap}.
* This is read operation, so several users can perform this operation at the same time.
*
* @return all functions which their signatures
*/ | Returns list of functions with list of function signatures for each functions. Uses guava <code>ListMultimap</code> structure to return data. If no functions present, will return empty <code>ListMultimap</code>. This is read operation, so several users can perform this operation at the same time | getAllFunctionsWithSignatures | {
"repo_name": "superbstreak/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/FunctionRegistryHolder.java",
"license": "apache-2.0",
"size": 17312
} | [
"java.util.ArrayList",
"java.util.Map",
"org.apache.drill.common.AutoCloseables",
"org.apache.drill.exec.expr.fn.DrillFuncHolder",
"org.apache.drill.shaded.guava.com.google.common.collect.ArrayListMultimap",
"org.apache.drill.shaded.guava.com.google.common.collect.ListMultimap"
] | import java.util.ArrayList; import java.util.Map; import org.apache.drill.common.AutoCloseables; import org.apache.drill.exec.expr.fn.DrillFuncHolder; import org.apache.drill.shaded.guava.com.google.common.collect.ArrayListMultimap; import org.apache.drill.shaded.guava.com.google.common.collect.ListMultimap; | import java.util.*; import org.apache.drill.common.*; import org.apache.drill.exec.expr.fn.*; import org.apache.drill.shaded.guava.com.google.common.collect.*; | [
"java.util",
"org.apache.drill"
] | java.util; org.apache.drill; | 2,045,998 |
public static Bitmap extractMiniThumb(
Bitmap source, int width, int height, boolean recycle) {
if (source == null) {
return null;
}
float scale;
if (source.getWidth() < source.getHeight()) {
scale = width / (float) source.getWidth();
} else {
scale = height / (float) source.getHeight();
}
Matrix matrix = new Matrix();
matrix.setScale(scale, scale);
Bitmap miniThumbnail = transform(matrix, source, width, height, true, recycle);
return miniThumbnail;
}
| static Bitmap function( Bitmap source, int width, int height, boolean recycle) { if (source == null) { return null; } float scale; if (source.getWidth() < source.getHeight()) { scale = width / (float) source.getWidth(); } else { scale = height / (float) source.getHeight(); } Matrix matrix = new Matrix(); matrix.setScale(scale, scale); Bitmap miniThumbnail = transform(matrix, source, width, height, true, recycle); return miniThumbnail; } | /**
* Creates a centered bitmap of the desired size.
* @param source
* @param recycle whether we want to recycle the input
*/ | Creates a centered bitmap of the desired size | extractMiniThumb | {
"repo_name": "sdubinsky/financisto-bzr",
"path": "src/ru/orangesoftware/financisto/utils/ThumbnailUtil.java",
"license": "gpl-2.0",
"size": 15119
} | [
"android.graphics.Bitmap",
"android.graphics.Matrix"
] | import android.graphics.Bitmap; import android.graphics.Matrix; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 151,257 |
protected ProcurementCardSourceAccountingLine createSourceAccountingLine(ProcurementCardTransaction transaction, ProcurementCardTransactionDetail docTransactionDetail) {
ProcurementCardSourceAccountingLine sourceLine = new ProcurementCardSourceAccountingLine();
sourceLine.setDocumentNumber(docTransactionDetail.getDocumentNumber());
sourceLine.setFinancialDocumentTransactionLineNumber(docTransactionDetail.getFinancialDocumentTransactionLineNumber());
sourceLine.setChartOfAccountsCode(getDefaultChartCode());
sourceLine.setAccountNumber(getDefaultAccountNumber());
sourceLine.setFinancialObjectCode(getDefaultObjectCode());
if (GL_CREDIT_CODE.equals(transaction.getTransactionDebitCreditCode())) {
sourceLine.setAmount(transaction.getFinancialDocumentTotalAmount().negated());
}
else {
sourceLine.setAmount(transaction.getFinancialDocumentTotalAmount());
}
return sourceLine;
} | ProcurementCardSourceAccountingLine function(ProcurementCardTransaction transaction, ProcurementCardTransactionDetail docTransactionDetail) { ProcurementCardSourceAccountingLine sourceLine = new ProcurementCardSourceAccountingLine(); sourceLine.setDocumentNumber(docTransactionDetail.getDocumentNumber()); sourceLine.setFinancialDocumentTransactionLineNumber(docTransactionDetail.getFinancialDocumentTransactionLineNumber()); sourceLine.setChartOfAccountsCode(getDefaultChartCode()); sourceLine.setAccountNumber(getDefaultAccountNumber()); sourceLine.setFinancialObjectCode(getDefaultObjectCode()); if (GL_CREDIT_CODE.equals(transaction.getTransactionDebitCreditCode())) { sourceLine.setAmount(transaction.getFinancialDocumentTotalAmount().negated()); } else { sourceLine.setAmount(transaction.getFinancialDocumentTotalAmount()); } return sourceLine; } | /**
* Creates the from record for the transaction. The clearing chart, account, and object code is used for creating the line.
*
* @param transaction The transaction to pull information from to create the accounting line.
* @param docTransactionDetail The transaction detail to pull information from to populate the accounting line.
* @return The source accounting line fully populated with values from the parameters passed in.
*/ | Creates the from record for the transaction. The clearing chart, account, and object code is used for creating the line | createSourceAccountingLine | {
"repo_name": "ua-eas/kfs",
"path": "kfs-core/src/main/java/org/kuali/kfs/fp/batch/service/impl/ProcurementCardCreateDocumentServiceImpl.java",
"license": "agpl-3.0",
"size": 95596
} | [
"edu.arizona.kfs.fp.businessobject.ProcurementCardTransaction",
"edu.arizona.kfs.fp.businessobject.ProcurementCardTransactionDetail",
"org.kuali.kfs.fp.businessobject.ProcurementCardSourceAccountingLine"
] | import edu.arizona.kfs.fp.businessobject.ProcurementCardTransaction; import edu.arizona.kfs.fp.businessobject.ProcurementCardTransactionDetail; import org.kuali.kfs.fp.businessobject.ProcurementCardSourceAccountingLine; | import edu.arizona.kfs.fp.businessobject.*; import org.kuali.kfs.fp.businessobject.*; | [
"edu.arizona.kfs",
"org.kuali.kfs"
] | edu.arizona.kfs; org.kuali.kfs; | 1,108,642 |
public List<StudentAttributes> getStudentsForTeam(String teamName, String courseId) {
return studentsDb.getStudentsForTeam(teamName, courseId);
} | List<StudentAttributes> function(String teamName, String courseId) { return studentsDb.getStudentsForTeam(teamName, courseId); } | /**
* Gets all students of a team.
*/ | Gets all students of a team | getStudentsForTeam | {
"repo_name": "xpdavid/teammates",
"path": "src/main/java/teammates/logic/core/StudentsLogic.java",
"license": "gpl-2.0",
"size": 15619
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 921,439 |
protected void checkFileInUnderStorage(AlluxioURI filePath, int fileLen) throws Exception {
URIStatus status = mFileSystem.getStatus(filePath);
String checkpointPath = status.getUfsPath();
UnderFileSystem ufs = UnderFileSystem.Factory.create(checkpointPath);
try (InputStream is = ufs.open(checkpointPath)) {
byte[] res = new byte[(int) status.getLength()];
int totalBytesRead = 0;
while (true) {
int bytesRead = is.read(res, totalBytesRead, res.length - totalBytesRead);
if (bytesRead <= 0) {
break;
}
totalBytesRead += bytesRead;
}
Assert.assertEquals((int) status.getLength(), totalBytesRead);
Assert.assertTrue(BufferUtils.equalIncreasingByteArray(fileLen, res));
}
} | void function(AlluxioURI filePath, int fileLen) throws Exception { URIStatus status = mFileSystem.getStatus(filePath); String checkpointPath = status.getUfsPath(); UnderFileSystem ufs = UnderFileSystem.Factory.create(checkpointPath); try (InputStream is = ufs.open(checkpointPath)) { byte[] res = new byte[(int) status.getLength()]; int totalBytesRead = 0; while (true) { int bytesRead = is.read(res, totalBytesRead, res.length - totalBytesRead); if (bytesRead <= 0) { break; } totalBytesRead += bytesRead; } Assert.assertEquals((int) status.getLength(), totalBytesRead); Assert.assertTrue(BufferUtils.equalIncreasingByteArray(fileLen, res)); } } | /**
* Checks the given file exists in under storage and expects its content to be an increasing
* array of the given length.
*
* @param filePath path of the tmp file
* @param fileLen length of the file
*/ | Checks the given file exists in under storage and expects its content to be an increasing array of the given length | checkFileInUnderStorage | {
"repo_name": "PasaLab/tachyon",
"path": "tests/src/test/java/alluxio/client/fs/AbstractFileOutStreamIntegrationTest.java",
"license": "apache-2.0",
"size": 5698
} | [
"java.io.InputStream",
"org.junit.Assert"
] | import java.io.InputStream; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 523,641 |
protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
IOException {
processRequest( request, response );
} | void function( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { processRequest( request, response ); } | /**
* Handles the HTTP <code>POST</code> method.
*
* @param request
* servlet request
* @param response
* servlet response
*/ | Handles the HTTP <code>POST</code> method | doPost | {
"repo_name": "Aliaksandr-Kastenka/cdf",
"path": "cdf-pentaho5/src/org/pentaho/cdf/GetCDFResource.java",
"license": "mpl-2.0",
"size": 4467
} | [
"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; | 986,027 |
public final Set<String> getServicesInUpgrade(UpgradeCheckRequest request) throws AmbariException {
final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
// the check is scoped to some services, so determine if any of those
// services are included in this upgrade
try {
VersionDefinitionXml vdf = getVersionDefinitionXml(request);
ClusterVersionSummary clusterVersionSummary = vdf.getClusterSummary(cluster,
metaInfoProvider.get());
return clusterVersionSummary.getAvailableServiceNames();
} catch (Exception exception) {
throw new AmbariException("Unable to run upgrade checks because of an invalid VDF",
exception);
}
}
final class ServiceQualification implements CheckQualification {
private final UpgradeCheck m_upgradeCheck;
public ServiceQualification(UpgradeCheck upgradeCheck) {
m_upgradeCheck = upgradeCheck;
}
/**
* {@inheritDoc} | final Set<String> function(UpgradeCheckRequest request) throws AmbariException { final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName()); try { VersionDefinitionXml vdf = getVersionDefinitionXml(request); ClusterVersionSummary clusterVersionSummary = vdf.getClusterSummary(cluster, metaInfoProvider.get()); return clusterVersionSummary.getAvailableServiceNames(); } catch (Exception exception) { throw new AmbariException(STR, exception); } } final class ServiceQualification implements CheckQualification { private final UpgradeCheck m_upgradeCheck; public ServiceQualification(UpgradeCheck upgradeCheck) { m_upgradeCheck = upgradeCheck; } /** * {@inheritDoc} | /**
* Gets the services participating in the upgrade from the VDF.
*
* @param request
* the upgrade check request.
* @return the services participating in the upgrade, which can either be all
* of the cluster's services or a subset based on repository type.
*/ | Gets the services participating in the upgrade from the VDF | getServicesInUpgrade | {
"repo_name": "sekikn/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java",
"license": "apache-2.0",
"size": 9228
} | [
"java.util.Set",
"org.apache.ambari.server.AmbariException",
"org.apache.ambari.server.state.repository.ClusterVersionSummary",
"org.apache.ambari.server.state.repository.VersionDefinitionXml",
"org.apache.ambari.spi.upgrade.CheckQualification",
"org.apache.ambari.spi.upgrade.UpgradeCheck",
"org.apache.ambari.spi.upgrade.UpgradeCheckRequest"
] | import java.util.Set; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.state.repository.ClusterVersionSummary; import org.apache.ambari.server.state.repository.VersionDefinitionXml; import org.apache.ambari.spi.upgrade.CheckQualification; import org.apache.ambari.spi.upgrade.UpgradeCheck; import org.apache.ambari.spi.upgrade.UpgradeCheckRequest; | import java.util.*; import org.apache.ambari.server.*; import org.apache.ambari.server.state.repository.*; import org.apache.ambari.spi.upgrade.*; | [
"java.util",
"org.apache.ambari"
] | java.util; org.apache.ambari; | 417,843 |
private void cacheDtdSystemId(I_CmsXmlConfiguration configuration) {
if (configuration.getDtdSystemLocation() != null) {
try {
String file = CmsFileUtil.readFile(
configuration.getDtdSystemLocation() + configuration.getDtdFilename(),
CmsEncoder.ENCODING_UTF_8);
CmsXmlEntityResolver.cacheSystemId(
configuration.getDtdUrlPrefix() + configuration.getDtdFilename(),
file.getBytes(CmsEncoder.ENCODING_UTF_8));
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_CACHE_DTD_SYSTEM_ID_1,
configuration.getDtdUrlPrefix()
+ configuration.getDtdFilename()
+ " --> "
+ configuration.getDtdSystemLocation()
+ configuration.getDtdFilename()));
}
} catch (IOException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_CACHE_DTD_SYSTEM_ID_FAILURE_1,
configuration.getDtdSystemLocation() + configuration.getDtdFilename()),
e);
}
}
} | void function(I_CmsXmlConfiguration configuration) { if (configuration.getDtdSystemLocation() != null) { try { String file = CmsFileUtil.readFile( configuration.getDtdSystemLocation() + configuration.getDtdFilename(), CmsEncoder.ENCODING_UTF_8); CmsXmlEntityResolver.cacheSystemId( configuration.getDtdUrlPrefix() + configuration.getDtdFilename(), file.getBytes(CmsEncoder.ENCODING_UTF_8)); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_CACHE_DTD_SYSTEM_ID_1, configuration.getDtdUrlPrefix() + configuration.getDtdFilename() + STR + configuration.getDtdSystemLocation() + configuration.getDtdFilename())); } } catch (IOException e) { LOG.error( Messages.get().getBundle().key( Messages.LOG_CACHE_DTD_SYSTEM_ID_FAILURE_1, configuration.getDtdSystemLocation() + configuration.getDtdFilename()), e); } } } | /**
* Adds a new DTD system id prefix mapping for internal resolution of external URLs.<p>
*
* @param configuration the configuration to add the mapping from
*/ | Adds a new DTD system id prefix mapping for internal resolution of external URLs | cacheDtdSystemId | {
"repo_name": "ggiudetti/opencms-core",
"path": "src/org/opencms/configuration/CmsConfigurationManager.java",
"license": "lgpl-2.1",
"size": 25709
} | [
"java.io.IOException",
"org.opencms.i18n.CmsEncoder",
"org.opencms.util.CmsFileUtil",
"org.opencms.xml.CmsXmlEntityResolver"
] | import java.io.IOException; import org.opencms.i18n.CmsEncoder; import org.opencms.util.CmsFileUtil; import org.opencms.xml.CmsXmlEntityResolver; | import java.io.*; import org.opencms.i18n.*; import org.opencms.util.*; import org.opencms.xml.*; | [
"java.io",
"org.opencms.i18n",
"org.opencms.util",
"org.opencms.xml"
] | java.io; org.opencms.i18n; org.opencms.util; org.opencms.xml; | 1,527,872 |
private void renderOperatorBackground(final Operator operator, final Graphics2D g2) {
Rectangle2D frame = model.getOperatorRect(operator);
// the first paint can come before any of the operator register listeners fire
// thus we need to check the rect for null and set it here once
// all subsequent calls will then have a valid rect
if (frame == null) {
return;
}
RoundRectangle2D background = new RoundRectangle2D.Double(frame.getX() - 7, frame.getY() - 3, frame.getWidth() + 14,
frame.getHeight() + 11, OPERATOR_BG_CORNER, OPERATOR_BG_CORNER);
g2.setColor(Color.WHITE);
g2.fill(background);
// if name is wider than operator, extend white background for header
Rectangle2D nameBounds = OPERATOR_FONT.getStringBounds(operator.getName(), g2.getFontRenderContext());
if (nameBounds.getWidth() > frame.getWidth()) {
double relevantWidth = Math.min(nameBounds.getWidth(), frame.getWidth() * MAX_HEADER_RATIO);
double offset = (frame.getWidth() - relevantWidth) / 2;
int x = (int) (frame.getX() + offset);
int padding = 5;
RoundRectangle2D nameBackground = new RoundRectangle2D.Double(
(int) Math.min(frame.getX() - padding, x - padding), frame.getY() - 3, relevantWidth + 2 * padding,
ProcessRendererModel.HEADER_HEIGHT + 3, OPERATOR_BG_CORNER, OPERATOR_BG_CORNER);
g2.fill(nameBackground);
}
// render ports
renderPortsBackground(operator.getInputPorts(), g2);
renderPortsBackground(operator.getOutputPorts(), g2);
} | void function(final Operator operator, final Graphics2D g2) { Rectangle2D frame = model.getOperatorRect(operator); if (frame == null) { return; } RoundRectangle2D background = new RoundRectangle2D.Double(frame.getX() - 7, frame.getY() - 3, frame.getWidth() + 14, frame.getHeight() + 11, OPERATOR_BG_CORNER, OPERATOR_BG_CORNER); g2.setColor(Color.WHITE); g2.fill(background); Rectangle2D nameBounds = OPERATOR_FONT.getStringBounds(operator.getName(), g2.getFontRenderContext()); if (nameBounds.getWidth() > frame.getWidth()) { double relevantWidth = Math.min(nameBounds.getWidth(), frame.getWidth() * MAX_HEADER_RATIO); double offset = (frame.getWidth() - relevantWidth) / 2; int x = (int) (frame.getX() + offset); int padding = 5; RoundRectangle2D nameBackground = new RoundRectangle2D.Double( (int) Math.min(frame.getX() - padding, x - padding), frame.getY() - 3, relevantWidth + 2 * padding, ProcessRendererModel.HEADER_HEIGHT + 3, OPERATOR_BG_CORNER, OPERATOR_BG_CORNER); g2.fill(nameBackground); } renderPortsBackground(operator.getInputPorts(), g2); renderPortsBackground(operator.getOutputPorts(), g2); } | /**
* Draws the operator background (white round rectangle).
*
* @param operator
* the operator to draw the background for
* @param g2
* the graphics context to draw upon
*/ | Draws the operator background (white round rectangle) | renderOperatorBackground | {
"repo_name": "transwarpio/rapidminer",
"path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/gui/flow/processrendering/draw/ProcessDrawer.java",
"license": "gpl-3.0",
"size": 54494
} | [
"com.rapidminer.gui.flow.processrendering.model.ProcessRendererModel",
"com.rapidminer.operator.Operator",
"java.awt.Color",
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D",
"java.awt.geom.RoundRectangle2D"
] | import com.rapidminer.gui.flow.processrendering.model.ProcessRendererModel; import com.rapidminer.operator.Operator; import java.awt.Color; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; | import com.rapidminer.gui.flow.processrendering.model.*; import com.rapidminer.operator.*; import java.awt.*; import java.awt.geom.*; | [
"com.rapidminer.gui",
"com.rapidminer.operator",
"java.awt"
] | com.rapidminer.gui; com.rapidminer.operator; java.awt; | 1,844,389 |
public void setCriteria(MmdCriteria criteria) {
_criteria = criteria;
}
| void function(MmdCriteria criteria) { _criteria = criteria; } | /**
* Sets the criteria for a manage metadata request.
* @param criteria the criteria
*/ | Sets the criteria for a manage metadata request | setCriteria | {
"repo_name": "usgin/usgin-geoportal",
"path": "src/com/esri/gpt/control/publication/ManageMetadataController.java",
"license": "apache-2.0",
"size": 23664
} | [
"com.esri.gpt.catalog.management.MmdCriteria"
] | import com.esri.gpt.catalog.management.MmdCriteria; | import com.esri.gpt.catalog.management.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 2,473,336 |
@Override
public MoviesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(R.layout.listitem_movie, parent, false);
return new MoviesViewHolder(view);
} | MoviesViewHolder function(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(mContext); View view = inflater.inflate(R.layout.listitem_movie, parent, false); return new MoviesViewHolder(view); } | /**
* Called when a new ViewHolder is created.
*
* @param parent Parent View for the ViewHolder.
* @param viewType Type of view. In this case, it'll always be the same.
* @return A ViewHolder that holds the View for a list item.
*/ | Called when a new ViewHolder is created | onCreateViewHolder | {
"repo_name": "DioMuller/PopularMovies",
"path": "app/src/main/java/com/diomuller/popularmovies/adapters/MoviesAdapter.java",
"license": "mit",
"size": 3921
} | [
"android.view.LayoutInflater",
"android.view.View",
"android.view.ViewGroup"
] | import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; | import android.view.*; | [
"android.view"
] | android.view; | 2,000,779 |
CompletableFuture<Void> addListener(AtomicValueEventListener<V> listener); | CompletableFuture<Void> addListener(AtomicValueEventListener<V> listener); | /**
* Registers the specified listener to be notified whenever the atomic value is updated.
* @param listener listener to notify about events
* @return CompletableFuture that will be completed when the operation finishes
*/ | Registers the specified listener to be notified whenever the atomic value is updated | addListener | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "core/api/src/main/java/org/onosproject/store/service/AsyncAtomicValue.java",
"license": "apache-2.0",
"size": 3883
} | [
"java.util.concurrent.CompletableFuture"
] | import java.util.concurrent.CompletableFuture; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,818,645 |
@Test
public void testGeneratingValidErrorResponse() throws XmppStringprepException {
final StanzaError error = StanzaError.getBuilder(StanzaError.Condition.bad_request).build();
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
request.setType(IQ.Type.set);
request.setFrom(JidCreate.from("sender@test/Smack"));
request.setTo(JidCreate.from("receiver@test/Smack"));
final IQ result = IQ.createErrorResponse(request, error);
assertEquals(IQ.Type.error, result.getType());
assertNotNull(result.getStanzaId());
assertEquals(request.getStanzaId(), result.getStanzaId());
assertEquals(request.getFrom(), result.getTo());
assertEquals(error.toXML().toString(), result.getError().toXML().toString());
// TODO this test was never valid
// assertEquals(CHILD_ELEMENT, result.getChildElementXML());
} | void function() throws XmppStringprepException { final StanzaError error = StanzaError.getBuilder(StanzaError.Condition.bad_request).build(); final IQ request = new TestIQ(ELEMENT, NAMESPACE); request.setType(IQ.Type.set); request.setFrom(JidCreate.from(STR)); request.setTo(JidCreate.from(STR)); final IQ result = IQ.createErrorResponse(request, error); assertEquals(IQ.Type.error, result.getType()); assertNotNull(result.getStanzaId()); assertEquals(request.getStanzaId(), result.getStanzaId()); assertEquals(request.getFrom(), result.getTo()); assertEquals(error.toXML().toString(), result.getError().toXML().toString()); } | /**
* Test creating a error response based on an IQ request.
* @throws XmppStringprepException if the provided string is invalid.
*/ | Test creating a error response based on an IQ request | testGeneratingValidErrorResponse | {
"repo_name": "igniterealtime/Smack",
"path": "smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java",
"license": "apache-2.0",
"size": 4914
} | [
"org.junit.Assert",
"org.jxmpp.jid.impl.JidCreate",
"org.jxmpp.stringprep.XmppStringprepException"
] | import org.junit.Assert; import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.stringprep.XmppStringprepException; | import org.junit.*; import org.jxmpp.jid.impl.*; import org.jxmpp.stringprep.*; | [
"org.junit",
"org.jxmpp.jid",
"org.jxmpp.stringprep"
] | org.junit; org.jxmpp.jid; org.jxmpp.stringprep; | 397,167 |
private Authenticator getAuthenticator(){
// final String strUserId = null;
// final String strPassword = null;
//
// if (strUserId != null){
// MailServerAuthenticator authenticator = new MailServerAuthenticator(strUserId, strPassword);
// logger_.debug("Authenticator #" + authenticator);
// return authenticator;
// }
// logger_.debug("No mail authenticator specified.");
return null;
}
| Authenticator function(){ return null; } | /**
* Returns the Session Authenticator.
*
* @return Authenticator
*/ | Returns the Session Authenticator | getAuthenticator | {
"repo_name": "MastekLtd/JBEAM",
"path": "jbeam-core-components/jbeam-monitor-services/src/main/java/com/stgmastek/monitor/mailer/CSMTPMailer.java",
"license": "lgpl-3.0",
"size": 9112
} | [
"javax.mail.Authenticator"
] | import javax.mail.Authenticator; | import javax.mail.*; | [
"javax.mail"
] | javax.mail; | 1,956,223 |
public List<HRegionInfo> createMultiRegionsInMeta(final Configuration conf,
final HTableDescriptor htd, byte [][] startKeys)
throws IOException {
HTable meta = new HTable(conf, HConstants.META_TABLE_NAME);
Arrays.sort(startKeys, Bytes.BYTES_COMPARATOR);
List<HRegionInfo> newRegions = new ArrayList<HRegionInfo>(startKeys.length);
// add custom ones
for (int i = 0; i < startKeys.length; i++) {
int j = (i + 1) % startKeys.length;
HRegionInfo hri = new HRegionInfo(htd.getName(), startKeys[i],
startKeys[j]);
MetaEditor.addRegionToMeta(meta, hri);
newRegions.add(hri);
}
meta.close();
return newRegions;
} | List<HRegionInfo> function(final Configuration conf, final HTableDescriptor htd, byte [][] startKeys) throws IOException { HTable meta = new HTable(conf, HConstants.META_TABLE_NAME); Arrays.sort(startKeys, Bytes.BYTES_COMPARATOR); List<HRegionInfo> newRegions = new ArrayList<HRegionInfo>(startKeys.length); for (int i = 0; i < startKeys.length; i++) { int j = (i + 1) % startKeys.length; HRegionInfo hri = new HRegionInfo(htd.getName(), startKeys[i], startKeys[j]); MetaEditor.addRegionToMeta(meta, hri); newRegions.add(hri); } meta.close(); return newRegions; } | /**
* Create rows in META for regions of the specified table with the specified
* start keys. The first startKey should be a 0 length byte array if you
* want to form a proper range of regions.
* @param conf
* @param htd
* @param startKeys
* @return list of region info for regions added to meta
* @throws IOException
*/ | Create rows in META for regions of the specified table with the specified start keys. The first startKey should be a 0 length byte array if you want to form a proper range of regions | createMultiRegionsInMeta | {
"repo_name": "matteobertozzi/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 79792
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.catalog.MetaEditor",
"org.apache.hadoop.hbase.client.HTable",
"org.apache.hadoop.hbase.util.Bytes"
] | import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.catalog.MetaEditor; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.util.Bytes; | import java.io.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.catalog.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 1,571,846 |
public void removeRegistrar(final String protocolIdentifier)
{
final Object localRegistrar ;
synchronized(registrarMap)
{
localRegistrar = registrarMap.remove(protocolIdentifier) ;
}
if (localRegistrar != null)
{
((Registrar)localRegistrar).uninstall(protocolIdentifier) ;
}
} | void function(final String protocolIdentifier) { final Object localRegistrar ; synchronized(registrarMap) { localRegistrar = registrarMap.remove(protocolIdentifier) ; } if (localRegistrar != null) { ((Registrar)localRegistrar).uninstall(protocolIdentifier) ; } } | /**
* Remove the registrar for the specified protocol identifier.
* @param protocolIdentifier The protocol identifier.
*/ | Remove the registrar for the specified protocol identifier | removeRegistrar | {
"repo_name": "nmcl/scratch",
"path": "graalvm/transactions/fork/narayana/XTS/WS-C/dev/src/com/arjuna/wsc11/RegistrarMapper.java",
"license": "apache-2.0",
"size": 2095
} | [
"com.arjuna.wsc11.Registrar"
] | import com.arjuna.wsc11.Registrar; | import com.arjuna.wsc11.*; | [
"com.arjuna.wsc11"
] | com.arjuna.wsc11; | 2,298,698 |
private Problem newProblem(long id, long contestId, Limit limit) {
Problem problem = new Problem();
problem.setId(id);
problem.setContestId(contestId);
problem.setCode("code" + id);
problem.setAuthor("author" + id);
problem.setChecker(id % 2 == 1);
problem.setContest("contest" + id);
problem.setLimit(limit);
problem.setRevision((int) id * 10);
problem.setSource("source" + id);
problem.setTitle("title" + id);
return problem;
}
| Problem function(long id, long contestId, Limit limit) { Problem problem = new Problem(); problem.setId(id); problem.setContestId(contestId); problem.setCode("code" + id); problem.setAuthor(STR + id); problem.setChecker(id % 2 == 1); problem.setContest(STR + id); problem.setLimit(limit); problem.setRevision((int) id * 10); problem.setSource(STR + id); problem.setTitle("title" + id); return problem; } | /**
* Creates a new problem.
* @param id the id
* @param forumId the forum id
* @param limit the limit
* @param languages a list of languages
* @return a new Problem instance
*/ | Creates a new problem | newProblem | {
"repo_name": "lei-cao/zoj",
"path": "na/judge_server/src/tests/cn/edu/zju/acm/onlinejudge/persistence/sql/ProblemPersistenceImplTest.java",
"license": "gpl-3.0",
"size": 11469
} | [
"cn.edu.zju.acm.onlinejudge.bean.Limit",
"cn.edu.zju.acm.onlinejudge.bean.Problem"
] | import cn.edu.zju.acm.onlinejudge.bean.Limit; import cn.edu.zju.acm.onlinejudge.bean.Problem; | import cn.edu.zju.acm.onlinejudge.bean.*; | [
"cn.edu.zju"
] | cn.edu.zju; | 2,730,947 |
public final void setBitmapDecoderClass(Class<? extends ImageDecoder> bitmapDecoderClass) {
if (bitmapDecoderClass == null) {
throw new IllegalArgumentException("Decoder class cannot be set to null");
}
this.bitmapDecoderFactory = new CompatDecoderFactory<ImageDecoder>(bitmapDecoderClass);
} | final void function(Class<? extends ImageDecoder> bitmapDecoderClass) { if (bitmapDecoderClass == null) { throw new IllegalArgumentException(STR); } this.bitmapDecoderFactory = new CompatDecoderFactory<ImageDecoder>(bitmapDecoderClass); } | /**
* Swap the default bitmap decoder implementation for one of your own. You must do this before setting the image file or
* asset, and you cannot use a custom decoder when using layout XML to set an asset name. Your class must have a
* public default constructor.
*
* @param bitmapDecoderClass The {@link ImageDecoder} implementation to use.
*/ | Swap the default bitmap decoder implementation for one of your own. You must do this before setting the image file or asset, and you cannot use a custom decoder when using layout XML to set an asset name. Your class must have a public default constructor | setBitmapDecoderClass | {
"repo_name": "newpasung/coordinator",
"path": "app/src/main/java/com/scut/gof/coordinator/libs/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java",
"license": "apache-2.0",
"size": 117765
} | [
"com.scut.gof.coordinator.libs.com.davemorrissey.labs.subscaleview.decoder.CompatDecoderFactory",
"com.scut.gof.coordinator.libs.com.davemorrissey.labs.subscaleview.decoder.ImageDecoder"
] | import com.scut.gof.coordinator.libs.com.davemorrissey.labs.subscaleview.decoder.CompatDecoderFactory; import com.scut.gof.coordinator.libs.com.davemorrissey.labs.subscaleview.decoder.ImageDecoder; | import com.scut.gof.coordinator.libs.com.davemorrissey.labs.subscaleview.decoder.*; | [
"com.scut.gof"
] | com.scut.gof; | 2,620,115 |
@Test
public void testEhCacheGetSingleByExternalIdBundleVersion() {
final Cache ehCache = _cacheManager.getCache("legalentity");
// nothing in the cache
assertNull(ehCache.get(Pairs.of(EID_1, VC_1)));
assertNull(ehCache.get(Pairs.of(EID_3, VC_2)));
// put the values in the cache
assertEquals(_source.getSingle(EID_1, VC_1), VERSIONED_1);
assertEquals(_source.getSingle(EID_3, VC_2), VERSIONED_2);
// clear cache
_source.emptyFrontCache();
// values in the cache
assertEquals(ehCache.get(Pairs.of(EID_1, VC_1)).getObjectValue(), VERSIONED_1);
assertEquals(ehCache.get(Pairs.of(EID_3, VC_2)).getObjectValue(), VERSIONED_2);
// get values from the cache
assertEquals(_source.getSingle(EID_1, VC_1), VERSIONED_1);
assertEquals(_source.getSingle(EID_3, VC_2), VERSIONED_2);
// underlying has been called once
Mockito.verify(_underlying, Mockito.times(1)).getSingle(EID_1, VC_1);
Mockito.verify(_underlying, Mockito.times(1)).getSingle(EID_3, VC_2);
} | void function() { final Cache ehCache = _cacheManager.getCache(STR); assertNull(ehCache.get(Pairs.of(EID_1, VC_1))); assertNull(ehCache.get(Pairs.of(EID_3, VC_2))); assertEquals(_source.getSingle(EID_1, VC_1), VERSIONED_1); assertEquals(_source.getSingle(EID_3, VC_2), VERSIONED_2); _source.emptyFrontCache(); assertEquals(ehCache.get(Pairs.of(EID_1, VC_1)).getObjectValue(), VERSIONED_1); assertEquals(ehCache.get(Pairs.of(EID_3, VC_2)).getObjectValue(), VERSIONED_2); assertEquals(_source.getSingle(EID_1, VC_1), VERSIONED_1); assertEquals(_source.getSingle(EID_3, VC_2), VERSIONED_2); Mockito.verify(_underlying, Mockito.times(1)).getSingle(EID_1, VC_1); Mockito.verify(_underlying, Mockito.times(1)).getSingle(EID_3, VC_2); } | /**
* Tests that values are not cached.
*/ | Tests that values are not cached | testEhCacheGetSingleByExternalIdBundleVersion | {
"repo_name": "McLeodMoores/starling",
"path": "projects/core/src/test/java/com/opengamma/core/legalentity/impl/EHCachingLegalEntitySourceTest.java",
"license": "apache-2.0",
"size": 24174
} | [
"com.opengamma.util.tuple.Pairs",
"net.sf.ehcache.Cache",
"org.mockito.Mockito",
"org.testng.Assert"
] | import com.opengamma.util.tuple.Pairs; import net.sf.ehcache.Cache; import org.mockito.Mockito; import org.testng.Assert; | import com.opengamma.util.tuple.*; import net.sf.ehcache.*; import org.mockito.*; import org.testng.*; | [
"com.opengamma.util",
"net.sf.ehcache",
"org.mockito",
"org.testng"
] | com.opengamma.util; net.sf.ehcache; org.mockito; org.testng; | 846,007 |
protected void sequence_FileOperation(EObject context, FileOperation semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
| void function(EObject context, FileOperation semanticObject) { genericSequencer.createSequence(context, semanticObject); } | /**
* Constraint:
* (filecopy=FileCopy | filedelete=FileDelete | filecreate=FileCreate | fileread=FileRead | filewrite=FileWrite)
*/ | Constraint: (filecopy=FileCopy | filedelete=FileDelete | filecreate=FileCreate | fileread=FileRead | filewrite=FileWrite) | sequence_FileOperation | {
"repo_name": "niksavis/mm-dsl",
"path": "org.xtext.nv.dsl/src-gen/org/xtext/nv/dsl/serializer/MMDSLSemanticSequencer.java",
"license": "epl-1.0",
"size": 190481
} | [
"org.eclipse.emf.ecore.EObject",
"org.xtext.nv.dsl.mMDSL.FileOperation"
] | import org.eclipse.emf.ecore.EObject; import org.xtext.nv.dsl.mMDSL.FileOperation; | import org.eclipse.emf.ecore.*; import org.xtext.nv.dsl.*; | [
"org.eclipse.emf",
"org.xtext.nv"
] | org.eclipse.emf; org.xtext.nv; | 1,125,853 |
public Object getValue() {
final Object raw = getDataRow().get( getField() );
if ( raw == null ) {
return null;
}
final String text = String.valueOf( raw );
final StringBuffer buffer = new StringBuffer();
if ( prefix != null ) {
buffer.append( prefix );
}
if ( delimeter != null ) {
final StringTokenizer strtok = new StringTokenizer( text, delimeter, false );
while ( strtok.hasMoreTokens() ) {
final String o = strtok.nextToken();
buffer.append( o );
if ( replacement != null && strtok.hasMoreTokens() ) {
buffer.append( replacement );
}
}
}
if ( suffix != null ) {
buffer.append( suffix );
}
return buffer.toString();
} | Object function() { final Object raw = getDataRow().get( getField() ); if ( raw == null ) { return null; } final String text = String.valueOf( raw ); final StringBuffer buffer = new StringBuffer(); if ( prefix != null ) { buffer.append( prefix ); } if ( delimeter != null ) { final StringTokenizer strtok = new StringTokenizer( text, delimeter, false ); while ( strtok.hasMoreTokens() ) { final String o = strtok.nextToken(); buffer.append( o ); if ( replacement != null && strtok.hasMoreTokens() ) { buffer.append( replacement ); } } } if ( suffix != null ) { buffer.append( suffix ); } return buffer.toString(); } | /**
* Computes the tokenized string. Replaces
*
* @return the value of the function.
*/ | Computes the tokenized string. Replaces | getValue | {
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/function/strings/TokenizeStringExpression.java",
"license": "lgpl-2.1",
"size": 4462
} | [
"java.util.StringTokenizer"
] | import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 2,635,823 |
protected File validateFolder( File folder ) {
return folder != null && folder.exists() && folder.isDirectory() ? folder : null;
} | File function( File folder ) { return folder != null && folder.exists() && folder.isDirectory() ? folder : null; } | /**
* Validates the {@link File} for multiple criteria to be a folder
*
* @param folder The {@link File} being validated
* @return null if the {@link File} does not pass the criteria, otherwise the {@link File} is returned
*/ | Validates the <code>File</code> for multiple criteria to be a folder | validateFolder | {
"repo_name": "pentaho/pentaho-osgi-bundles",
"path": "pentaho-bundle-resource-manager/src/main/java/org/pentaho/osgi/manager/resource/ManagedResourceProvider.java",
"license": "apache-2.0",
"size": 4828
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,504,135 |
protected ServerSocketFactory getServerSocketFactory() {
return ServerSocketFactory.getDefault();
}
| ServerSocketFactory function() { return ServerSocketFactory.getDefault(); } | /**
* Gets the platform default {@link ServerSocketFactory}.
* <p>
* Subclasses may override to provide a custom server socket factory.
*/ | Gets the platform default <code>ServerSocketFactory</code>. Subclasses may override to provide a custom server socket factory | getServerSocketFactory | {
"repo_name": "JPAT-ROSEMARY/SCUBA",
"path": "org.jpat.scuba.external.slf4j/logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java",
"license": "mit",
"size": 7455
} | [
"javax.net.ServerSocketFactory"
] | import javax.net.ServerSocketFactory; | import javax.net.*; | [
"javax.net"
] | javax.net; | 2,097,822 |
CdmiDataObject getStoredObject(CdmiId id); | CdmiDataObject getStoredObject(CdmiId id); | /**
* Returns a previously stored object from the drive.
*
* @param id the ID of the requested object
* @return the object with the given ID or {@code null} if the object could not be found.
*/ | Returns a previously stored object from the drive | getStoredObject | {
"repo_name": "toebbel/StorageCloudSim",
"path": "src/edu/kit/cloudSimStorage/storageModel/IObjectStorageDrive.java",
"license": "gpl-3.0",
"size": 4889
} | [
"edu.kit.cloudSimStorage.cdmi.CdmiDataObject",
"edu.kit.cloudSimStorage.cdmi.CdmiId"
] | import edu.kit.cloudSimStorage.cdmi.CdmiDataObject; import edu.kit.cloudSimStorage.cdmi.CdmiId; | import edu.kit.*; | [
"edu.kit"
] | edu.kit; | 51,283 |
protected void scanPI(XMLStringBuffer data) throws IOException, XNIException {
// target
fReportEntity = false;
String target = fEntityScanner.scanName();
if (target == null) {
reportFatalError("PITargetRequired", null);
}
// scan data
scanPIData(target, data);
fReportEntity = true;
} // scanPI(XMLStringBuffer)
//CHANGED:
//Earlier:This method uses the fStringBuffer and later buffer values are set to
//the supplied XMLString....
//Now: Changed the signature of this function to pass XMLStringBuffer.. and data would
//be appended to that buffer | void function(XMLStringBuffer data) throws IOException, XNIException { fReportEntity = false; String target = fEntityScanner.scanName(); if (target == null) { reportFatalError(STR, null); } scanPIData(target, data); fReportEntity = true; } | /**
* Scans a processing instruction.
* <p>
* <pre>
* [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
* [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
* </pre>
*/ | Scans a processing instruction. <code> [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) </code> | scanPI | {
"repo_name": "lizhekang/TCJDK",
"path": "sources/openjdk8/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java",
"license": "gpl-2.0",
"size": 58427
} | [
"com.sun.org.apache.xerces.internal.util.XMLStringBuffer",
"com.sun.org.apache.xerces.internal.xni.XNIException",
"java.io.IOException"
] | import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; import com.sun.org.apache.xerces.internal.xni.XNIException; import java.io.IOException; | import com.sun.org.apache.xerces.internal.util.*; import com.sun.org.apache.xerces.internal.xni.*; import java.io.*; | [
"com.sun.org",
"java.io"
] | com.sun.org; java.io; | 16,192 |
public void removeDataChangedListener(DataChangedListener l){
listeners.removeListener(l);
} | void function(DataChangedListener l){ listeners.removeListener(l); } | /**
* Removes a listener from data changed events, notice that the status argument to the data change listener
* shouldn't be relied upon.
*
* @param l listener to remove
*/ | Removes a listener from data changed events, notice that the status argument to the data change listener shouldn't be relied upon | removeDataChangedListener | {
"repo_name": "shannah/cn1",
"path": "CodenameOne/src/com/codename1/ui/Slider.java",
"license": "gpl-2.0",
"size": 21143
} | [
"com.codename1.ui.events.DataChangedListener"
] | import com.codename1.ui.events.DataChangedListener; | import com.codename1.ui.events.*; | [
"com.codename1.ui"
] | com.codename1.ui; | 2,482,709 |
public void setDefaultSchema(String schemaName) throws SQLException {
if (schemaName == null) {
return;
}
final LanguageConnectionContext lcc;
if ((lcc = getTR().getLcc()) == null
|| lcc.getDefaultSchema().getSchemaName().equals(schemaName)) {
return;
}
synchronized (getConnectionSynchronization()) {
if (isClosed()) {
return;
}
setupContextStack(true);
try {
FabricDatabase.setupDefaultSchema(lcc.getDataDictionary(), lcc, lcc
.getTransactionExecute(), schemaName, true);
} catch (StandardException sqle) {
throw new SQLException(sqle);
} finally {
restoreContextStack();
}
}
} | void function(String schemaName) throws SQLException { if (schemaName == null) { return; } final LanguageConnectionContext lcc; if ((lcc = getTR().getLcc()) == null lcc.getDefaultSchema().getSchemaName().equals(schemaName)) { return; } synchronized (getConnectionSynchronization()) { if (isClosed()) { return; } setupContextStack(true); try { FabricDatabase.setupDefaultSchema(lcc.getDataDictionary(), lcc, lcc .getTransactionExecute(), schemaName, true); } catch (StandardException sqle) { throw new SQLException(sqle); } finally { restoreContextStack(); } } } | /**
* Internal method for setting up current schema.
*
* @param schemaName
* @throws SQLException
*/ | Internal method for setting up current schema | setDefaultSchema | {
"repo_name": "papicella/snappy-store",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/jdbc/EmbedConnection.java",
"license": "apache-2.0",
"size": 157035
} | [
"com.pivotal.gemfirexd.internal.engine.db.FabricDatabase",
"com.pivotal.gemfirexd.internal.iapi.error.StandardException",
"com.pivotal.gemfirexd.internal.iapi.sql.conn.LanguageConnectionContext",
"java.sql.SQLException"
] | import com.pivotal.gemfirexd.internal.engine.db.FabricDatabase; import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.sql.conn.LanguageConnectionContext; import java.sql.SQLException; | import com.pivotal.gemfirexd.internal.engine.db.*; import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.sql.conn.*; import java.sql.*; | [
"com.pivotal.gemfirexd",
"java.sql"
] | com.pivotal.gemfirexd; java.sql; | 2,219,653 |
public ProcessingInstruction createProcessingInstruction(String target,
String data)
throws DOMException {
if (errorChecking && !isXMLName(target,xml11Version)) {
String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
}
return new ProcessingInstructionImpl(this, target, data);
} // createProcessingInstruction(String,String):ProcessingInstruction | ProcessingInstruction function(String target, String data) throws DOMException { if (errorChecking && !isXMLName(target,xml11Version)) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, STR, null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg); } return new ProcessingInstructionImpl(this, target, data); } | /**
* Factory method; creates a ProcessingInstruction having this Document
* as its OwnerDoc.
*
* @param target The target "processor channel"
* @param data Parameter string to be passed to the target.
*
* @throws DOMException(INVALID_NAME_ERR) if the target name is not
* acceptable.
*
* @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents. (HTML
* not yet implemented.)
*/ | Factory method; creates a ProcessingInstruction having this Document as its OwnerDoc | createProcessingInstruction | {
"repo_name": "jimma/xerces",
"path": "src/org/apache/xerces/dom/CoreDocumentImpl.java",
"license": "apache-2.0",
"size": 99456
} | [
"org.w3c.dom.DOMException",
"org.w3c.dom.ProcessingInstruction"
] | import org.w3c.dom.DOMException; import org.w3c.dom.ProcessingInstruction; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 522,121 |
public void onTrackDeselected(@NonNull SessionPlayer player, @NonNull TrackInfo trackInfo) {
}
}
@SuppressWarnings("HiddenSuperclass")
public static class PlayerResult implements BaseResult {
@IntDef(flag = false, value = {
RESULT_SUCCESS,
RESULT_ERROR_UNKNOWN,
RESULT_ERROR_INVALID_STATE,
RESULT_ERROR_BAD_VALUE,
RESULT_ERROR_PERMISSION_DENIED,
RESULT_ERROR_IO,
RESULT_ERROR_NOT_SUPPORTED,
RESULT_INFO_SKIPPED})
@Retention(RetentionPolicy.SOURCE)
@RestrictTo(LIBRARY)
public @interface ResultCode {}
private final int mResultCode;
private final long mCompletionTime;
private final MediaItem mItem;
// Note: resultCode is intentionally not annotated for subclass to return extra error codes.
public PlayerResult(int resultCode, @Nullable MediaItem item) {
this(resultCode, item, SystemClock.elapsedRealtime());
}
// Note: resultCode is intentionally not annotated for subclass to return extra error codes.
private PlayerResult(int resultCode, @Nullable MediaItem item, long completionTime) {
mResultCode = resultCode;
mItem = item;
mCompletionTime = completionTime;
} | void function(@NonNull SessionPlayer player, @NonNull TrackInfo trackInfo) { } } @SuppressWarnings(STR) public static class PlayerResult implements BaseResult { @IntDef(flag = false, value = { RESULT_SUCCESS, RESULT_ERROR_UNKNOWN, RESULT_ERROR_INVALID_STATE, RESULT_ERROR_BAD_VALUE, RESULT_ERROR_PERMISSION_DENIED, RESULT_ERROR_IO, RESULT_ERROR_NOT_SUPPORTED, RESULT_INFO_SKIPPED}) @Retention(RetentionPolicy.SOURCE) @RestrictTo(LIBRARY) public @interface ResultCode {} private final int mResultCode; private final long mCompletionTime; private final MediaItem mItem; public PlayerResult(int resultCode, @Nullable MediaItem item) { this(resultCode, item, SystemClock.elapsedRealtime()); } private PlayerResult(int resultCode, @Nullable MediaItem item, long completionTime) { mResultCode = resultCode; mItem = item; mCompletionTime = completionTime; } | /**
* Called when a track is deselected.
* <p>
* This callback will generally be called only after calling
* {@link #deselectTrack(TrackInfo)}.
*
* @param player the player associated with this callback
* @param trackInfo the deselected track
* @see #deselectTrack(TrackInfo)
*/ | Called when a track is deselected. This callback will generally be called only after calling <code>#deselectTrack(TrackInfo)</code> | onTrackDeselected | {
"repo_name": "AndroidX/androidx",
"path": "media2/media2-common/src/main/java/androidx/media2/common/SessionPlayer.java",
"license": "apache-2.0",
"size": 65397
} | [
"android.os.SystemClock",
"androidx.annotation.IntDef",
"androidx.annotation.NonNull",
"androidx.annotation.Nullable",
"androidx.annotation.RestrictTo",
"java.lang.annotation.Retention",
"java.lang.annotation.RetentionPolicy"
] | import android.os.SystemClock; import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RestrictTo; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; | import android.os.*; import androidx.annotation.*; import java.lang.annotation.*; | [
"android.os",
"androidx.annotation",
"java.lang"
] | android.os; androidx.annotation; java.lang; | 2,153,300 |
public static final List<IAlgebraicRewriteRule> buildUnnestingRuleCollection() {
List<IAlgebraicRewriteRule> xquery = new LinkedList<>();
xquery.add(new PushSelectDownRule());
xquery.add(new ComplexUnnestToProductRule());
xquery.add(new ComplexJoinInferenceRule());
xquery.add(new PushSelectIntoJoinRule());
xquery.add(new IntroJoinInsideSubplanRule());
xquery.add(new PushMapOperatorDownThroughProductRule());
xquery.add(new PushSubplanWithAggregateDownThroughProductRule());
//xquery.add(new IntroduceGroupByForSubplanRule());
xquery.add(new SubplanOutOfGroupRule());
// xquery.add(new InsertOuterJoinRule());
xquery.add(new ExtractFunctionsFromJoinConditionRule());
xquery.add(new RemoveRedundantVariablesRule());
xquery.add(new RemoveUnusedAssignAndAggregateRule());
xquery.add(new FactorRedundantGroupAndDecorVarsRule());
return xquery;
} | static final List<IAlgebraicRewriteRule> function() { List<IAlgebraicRewriteRule> xquery = new LinkedList<>(); xquery.add(new PushSelectDownRule()); xquery.add(new ComplexUnnestToProductRule()); xquery.add(new ComplexJoinInferenceRule()); xquery.add(new PushSelectIntoJoinRule()); xquery.add(new IntroJoinInsideSubplanRule()); xquery.add(new PushMapOperatorDownThroughProductRule()); xquery.add(new PushSubplanWithAggregateDownThroughProductRule()); xquery.add(new SubplanOutOfGroupRule()); xquery.add(new ExtractFunctionsFromJoinConditionRule()); xquery.add(new RemoveRedundantVariablesRule()); xquery.add(new RemoveUnusedAssignAndAggregateRule()); xquery.add(new FactorRedundantGroupAndDecorVarsRule()); return xquery; } | /**
* Unnest more complex structures.
*
* @return List of algebraic rewrite rules.
*/ | Unnest more complex structures | buildUnnestingRuleCollection | {
"repo_name": "prestoncarman/vxquery",
"path": "vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java",
"license": "apache-2.0",
"size": 19498
} | [
"java.util.LinkedList",
"java.util.List",
"org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule",
"org.apache.hyracks.algebricks.rewriter.rules.ComplexJoinInferenceRule",
"org.apache.hyracks.algebricks.rewriter.rules.ComplexUnnestToProductRule",
"org.apache.hyracks.algebricks.rewriter.rules.FactorRedundantGroupAndDecorVarsRule",
"org.apache.hyracks.algebricks.rewriter.rules.IntroJoinInsideSubplanRule",
"org.apache.hyracks.algebricks.rewriter.rules.PushMapOperatorDownThroughProductRule",
"org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule",
"org.apache.hyracks.algebricks.rewriter.rules.PushSelectIntoJoinRule",
"org.apache.hyracks.algebricks.rewriter.rules.PushSubplanWithAggregateDownThroughProductRule",
"org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule",
"org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule",
"org.apache.hyracks.algebricks.rewriter.rules.subplan.SubplanOutOfGroupRule",
"org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.ExtractFunctionsFromJoinConditionRule"
] | import java.util.LinkedList; import java.util.List; import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule; import org.apache.hyracks.algebricks.rewriter.rules.ComplexJoinInferenceRule; import org.apache.hyracks.algebricks.rewriter.rules.ComplexUnnestToProductRule; import org.apache.hyracks.algebricks.rewriter.rules.FactorRedundantGroupAndDecorVarsRule; import org.apache.hyracks.algebricks.rewriter.rules.IntroJoinInsideSubplanRule; import org.apache.hyracks.algebricks.rewriter.rules.PushMapOperatorDownThroughProductRule; import org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule; import org.apache.hyracks.algebricks.rewriter.rules.PushSelectIntoJoinRule; import org.apache.hyracks.algebricks.rewriter.rules.PushSubplanWithAggregateDownThroughProductRule; import org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule; import org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule; import org.apache.hyracks.algebricks.rewriter.rules.subplan.SubplanOutOfGroupRule; import org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.ExtractFunctionsFromJoinConditionRule; | import java.util.*; import org.apache.hyracks.algebricks.core.rewriter.base.*; import org.apache.hyracks.algebricks.rewriter.rules.*; import org.apache.hyracks.algebricks.rewriter.rules.subplan.*; import org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.*; | [
"java.util",
"org.apache.hyracks",
"org.apache.vxquery"
] | java.util; org.apache.hyracks; org.apache.vxquery; | 1,097,160 |
public static String getLineSeparator() {
final String nl = System.getProperty("line.separator");
if (Strings.isNullOrEmpty(nl)) {
return "\n";
}
return nl;
} | static String function() { final String nl = System.getProperty(STR); if (Strings.isNullOrEmpty(nl)) { return "\n"; } return nl; } | /** Replies the OS-dependent line separator.
*
* @return the line separator from the {@code "line.separator"} property, or {@code "\n"}.
* @since 0.5
*/ | Replies the OS-dependent line separator | getLineSeparator | {
"repo_name": "jgfoster/sarl",
"path": "tests/io.sarl.tests.api/src/main/java/io/sarl/tests/api/AbstractSarlTest.java",
"license": "apache-2.0",
"size": 70743
} | [
"com.google.common.base.Strings"
] | import com.google.common.base.Strings; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 282,334 |
protected TokenIterator createTokenIterator(final HeaderIterator hit) {
return new BasicTokenIterator(hit);
} | TokenIterator function(final HeaderIterator hit) { return new BasicTokenIterator(hit); } | /**
* Creates a token iterator from a header iterator.
* This method can be overridden to replace the implementation of
* the token iterator.
*
* @param hit the header iterator
*
* @return the token iterator
*/ | Creates a token iterator from a header iterator. This method can be overridden to replace the implementation of the token iterator | createTokenIterator | {
"repo_name": "garymabin/YGOMobile",
"path": "apache-async-http-HC4/src/org/apache/http/HC4/impl/DefaultConnectionReuseStrategy.java",
"license": "mit",
"size": 8335
} | [
"org.apache.http.HC4"
] | import org.apache.http.HC4; | import org.apache.http.*; | [
"org.apache.http"
] | org.apache.http; | 1,941,909 |
public int put(MethodBinding key, int value) {
int index = hashCode(key);
while (keyTable[index] != null) {
if (equalsForNameAndType(keyTable[index], key))
return valueTable[index] = value;
index = (index + 1) % keyTable.length;
}
keyTable[index] = key;
valueTable[index] = value;
// assumes the threshold is never equal to the size of the table
if (++elementSize > threshold)
rehash();
return value;
} | int function(MethodBinding key, int value) { int index = hashCode(key); while (keyTable[index] != null) { if (equalsForNameAndType(keyTable[index], key)) return valueTable[index] = value; index = (index + 1) % keyTable.length; } keyTable[index] = key; valueTable[index] = value; if (++elementSize > threshold) rehash(); return value; } | /**
* Puts the specified element into the hashtable, using the specified
* key. The element may be retrieved by doing a get() with the same key.
* The key and the element cannot be null.
*
* @param key <CODE>Object</CODE> the specified key in the hashtable
* @param value <CODE>int</CODE> the specified element
* @return int the old value of the key, or -1 if it did not have one.
*/ | Puts the specified element into the hashtable, using the specified key. The element may be retrieved by doing a get() with the same key. The key and the element cannot be null | put | {
"repo_name": "Niky4000/UsefulUtils",
"path": "projects/others/eclipse-platform-parent/eclipse.jdt.core-master/org.eclipse.jdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/codegen/MethodNameAndTypeCache.java",
"license": "gpl-3.0",
"size": 5019
} | [
"org.eclipse.jdt.internal.compiler.lookup.MethodBinding"
] | import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; | import org.eclipse.jdt.internal.compiler.lookup.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 219,796 |
@ApiModelProperty(example = "null", value = "Inform if this item by nature is subject to COFINS taxation or exempt - 'T' # TAXABLE - 'Z' # TAXABLE WITH RATE=0.00 - 'E' # EXEMPT - 'H' # SUSPENDED - 'N' # NO TAXABLE ")
public AccruableCOFINSTaxationEnum getAccruableCOFINSTaxation() {
return accruableCOFINSTaxation;
} | @ApiModelProperty(example = "null", value = STR) AccruableCOFINSTaxationEnum function() { return accruableCOFINSTaxation; } | /**
* Inform if this item by nature is subject to COFINS taxation or exempt - 'T' # TAXABLE - 'Z' # TAXABLE WITH RATE=0.00 - 'E' # EXEMPT - 'H' # SUSPENDED - 'N' # NO TAXABLE
* @return accruableCOFINSTaxation
**/ | Inform if this item by nature is subject to COFINS taxation or exempt - 'T' # TAXABLE - 'Z' # TAXABLE WITH RATE=0.00 - 'E' # EXEMPT - 'H' # SUSPENDED - 'N' # NO TAXABLE | getAccruableCOFINSTaxation | {
"repo_name": "Avalara/avataxbr-clients",
"path": "java-client/src/main/java/io/swagger/client/model/Agast.java",
"license": "gpl-3.0",
"size": 29773
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,113,131 |
public static void put(String key, Object o) {
MDC.put(key, o);
} | static void function(String key, Object o) { MDC.put(key, o); } | /**
* Put a context value (the o parameter) as identified with the key parameter
* into the current thread's context map.
*/ | Put a context value (the o parameter) as identified with the key parameter into the current thread's context map | put | {
"repo_name": "kkopacz/agiso-core",
"path": "bundles/agiso-core-logging/src/main/java/org/agiso/core/logging/log4j/LogContext.java",
"license": "apache-2.0",
"size": 2029
} | [
"org.apache.log4j.MDC"
] | import org.apache.log4j.MDC; | import org.apache.log4j.*; | [
"org.apache.log4j"
] | org.apache.log4j; | 2,304,960 |
private void getDeltaFrom1To2() throws JSONException {
long t1 = 1;
long t2 = 2;
Delta delta = mService.getDelta(t1, t2);
List<IdentifierGraph> deletes = delta.getDeletes();
// ### check Delta sizes for deletes and updates ###
testDeltaSize(delta, 0, 1);
// ### check Identifiers size ###
// check deletes
IdentifierGraph deletegraph = deletes.get(0);
testIdentifierCount(deletegraph, 2);
// check updates
// nothing to check, size must be 0
// ### check JSON-String ###
// check deletes
JSONArray actualDeletes = toJson(deletes);
JSONArray expectedDeletes = new JSONArray();
expectedDeletes.put(createJSON(2L,createJSONIdentifierMetadataConnection("access-request_rawData1", "device_rawData1", "access-request-device2_rawData1")));
assertTrue(jsonsEqual(actualDeletes, expectedDeletes));
// check updates
// nothing to check, size must be 0
} | void function() throws JSONException { long t1 = 1; long t2 = 2; Delta delta = mService.getDelta(t1, t2); List<IdentifierGraph> deletes = delta.getDeletes(); testDeltaSize(delta, 0, 1); IdentifierGraph deletegraph = deletes.get(0); testIdentifierCount(deletegraph, 2); JSONArray actualDeletes = toJson(deletes); JSONArray expectedDeletes = new JSONArray(); expectedDeletes.put(createJSON(2L,createJSONIdentifierMetadataConnection(STR, STR, STR))); assertTrue(jsonsEqual(actualDeletes, expectedDeletes)); } | /**
* Delta from a graph with one metadata and two properties and a empty graph
* @throws JSONException
*/ | Delta from a graph with one metadata and two properties and a empty graph | getDeltaFrom1To2 | {
"repo_name": "MReichenbach/visitmeta",
"path": "dataservice/src/test/java/de/hshannover/f4/trust/visitmeta/dataservice/graphservice/testcases/SingleValueMetadataTest.java",
"license": "apache-2.0",
"size": 25688
} | [
"de.hshannover.f4.trust.visitmeta.interfaces.Delta",
"de.hshannover.f4.trust.visitmeta.interfaces.IdentifierGraph",
"java.util.List",
"org.codehaus.jettison.json.JSONArray",
"org.codehaus.jettison.json.JSONException",
"org.junit.Assert"
] | import de.hshannover.f4.trust.visitmeta.interfaces.Delta; import de.hshannover.f4.trust.visitmeta.interfaces.IdentifierGraph; import java.util.List; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; import org.junit.Assert; | import de.hshannover.f4.trust.visitmeta.interfaces.*; import java.util.*; import org.codehaus.jettison.json.*; import org.junit.*; | [
"de.hshannover.f4",
"java.util",
"org.codehaus.jettison",
"org.junit"
] | de.hshannover.f4; java.util; org.codehaus.jettison; org.junit; | 814,504 |
public void afterAllTests()
throws IOException {
// Delete buckets created during test.
deleteBuckets();
} | void function() throws IOException { deleteBuckets(); } | /**
* Perform clean-up once after all tests are turn.
*/ | Perform clean-up once after all tests are turn | afterAllTests | {
"repo_name": "peltekster/bigdata-interop-leanplum",
"path": "gcsio/src/test/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageIntegrationHelper.java",
"license": "apache-2.0",
"size": 17522
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,033,602 |
List getSessionMessages(String session); | List getSessionMessages(String session); | /**
* returns a List of the Messages associated with the session
*
* @param session
* @return
*/ | returns a List of the Messages associated with the session | getSessionMessages | {
"repo_name": "willkara/sakai",
"path": "rwiki/rwiki-api/api/src/java/uk/ac/cam/caret/sakai/rwiki/service/message/api/MessageService.java",
"license": "apache-2.0",
"size": 2235
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 85,029 |
@Override
public DocumentView next() {
QueryResult queryResult = delegate.next();
String objectId = (String) queryResult.getPropertyByQueryName(PropertyIds.OBJECT_ID).getFirstValue();
return documentFetcher.getDocument(objectId);
}
/**
* Removes from the underlying collection the last element returned
* by this iterator (optional operation). This method can be called
* only once per call to {@link #next}. The behavior of an iterator
* is unspecified if the underlying collection is modified while the
* iteration is in progress in any way other than by calling this
* method.
*
* @throws UnsupportedOperationException if the {@code remove}
* operation is not supported by this iterator
* @throws IllegalStateException if the {@code next} method has not
* yet been called, or the {@code remove} method has already
* been called after the last call to the {@code next} | DocumentView function() { QueryResult queryResult = delegate.next(); String objectId = (String) queryResult.getPropertyByQueryName(PropertyIds.OBJECT_ID).getFirstValue(); return documentFetcher.getDocument(objectId); } /** * Removes from the underlying collection the last element returned * by this iterator (optional operation). This method can be called * only once per call to {@link #next}. The behavior of an iterator * is unspecified if the underlying collection is modified while the * iteration is in progress in any way other than by calling this * method. * * @throws UnsupportedOperationException if the {@code remove} * operation is not supported by this iterator * @throws IllegalStateException if the {@code next} method has not * yet been called, or the {@code remove} method has already * been called after the last call to the {@code next} | /**
* Returns the next element in the iteration.
*
* @return the next element in the iteration
* @throws NoSuchElementException if the iteration has no more elements
*/ | Returns the next element in the iteration | next | {
"repo_name": "itzamnamx/documentManager",
"path": "src/main/java/com/github/atave/VaadinCmisBrowser/cmis/api/QueryResults.java",
"license": "gpl-3.0",
"size": 5615
} | [
"org.apache.chemistry.opencmis.client.api.QueryResult",
"org.apache.chemistry.opencmis.commons.PropertyIds"
] | import org.apache.chemistry.opencmis.client.api.QueryResult; import org.apache.chemistry.opencmis.commons.PropertyIds; | import org.apache.chemistry.opencmis.client.api.*; import org.apache.chemistry.opencmis.commons.*; | [
"org.apache.chemistry"
] | org.apache.chemistry; | 325,510 |
public Builder add(Attribute attribute) {
Preconditions.checkArgument(attribute.isImplicit() || attribute.isLateBound()
|| (attribute.getType() == Type.STRING && attribute.checkAllowedValues()),
"Invalid attribute '%s' (%s)", attribute.getName(), attribute.getType());
Preconditions.checkArgument(!attributes.containsKey(attribute.getName()),
"An attribute with the name '%s' already exists.", attribute.getName());
attributes.put(attribute.getName(), attribute);
return this;
} | Builder function(Attribute attribute) { Preconditions.checkArgument(attribute.isImplicit() attribute.isLateBound() (attribute.getType() == Type.STRING && attribute.checkAllowedValues()), STR, attribute.getName(), attribute.getType()); Preconditions.checkArgument(!attributes.containsKey(attribute.getName()), STR, attribute.getName()); attributes.put(attribute.getName(), attribute); return this; } | /**
* Adds an attribute to the aspect.
*
* <p>Since aspects do not appear in BUILD files, the attribute must be either implicit
* (not available in the BUILD file, starting with '$') or late-bound (determined after the
* configuration is available, starting with ':')
*/ | Adds an attribute to the aspect. Since aspects do not appear in BUILD files, the attribute must be either implicit (not available in the BUILD file, starting with '$') or late-bound (determined after the configuration is available, starting with ':') | add | {
"repo_name": "mrdomino/bazel",
"path": "src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java",
"license": "apache-2.0",
"size": 16854
} | [
"com.google.devtools.build.lib.syntax.Type",
"com.google.devtools.build.lib.util.Preconditions"
] | import com.google.devtools.build.lib.syntax.Type; import com.google.devtools.build.lib.util.Preconditions; | import com.google.devtools.build.lib.syntax.*; import com.google.devtools.build.lib.util.*; | [
"com.google.devtools"
] | com.google.devtools; | 2,483,858 |
public void setBaseDocumentClass(Class<? extends Document> baseDocumentClass) {
this.baseDocumentClass = baseDocumentClass;
} | void function(Class<? extends Document> baseDocumentClass) { this.baseDocumentClass = baseDocumentClass; } | /**
* The optional baseDocumentClass element is the name of the java base class
* associated with the document. This gives the data dictionary the ability
* to index by the base class in addition to the current class.
*/ | The optional baseDocumentClass element is the name of the java base class associated with the document. This gives the data dictionary the ability to index by the base class in addition to the current class | setBaseDocumentClass | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-kns/src/main/java/org/kuali/kfs/krad/datadictionary/DocumentEntry.java",
"license": "agpl-3.0",
"size": 13917
} | [
"org.kuali.kfs.krad.document.Document"
] | import org.kuali.kfs.krad.document.Document; | import org.kuali.kfs.krad.document.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,726,943 |
EReference getTerminal_OperationalLimitSet(); | EReference getTerminal_OperationalLimitSet(); | /**
* Returns the meta object for the reference list '{@link CIM.IEC61970.Core.Terminal#getOperationalLimitSet <em>Operational Limit Set</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Operational Limit Set</em>'.
* @see CIM.IEC61970.Core.Terminal#getOperationalLimitSet()
* @see #getTerminal()
* @generated
*/ | Returns the meta object for the reference list '<code>CIM.IEC61970.Core.Terminal#getOperationalLimitSet Operational Limit Set</code>'. | getTerminal_OperationalLimitSet | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Core/CorePackage.java",
"license": "mit",
"size": 253784
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,481,090 |
public static Object invokeExactMethod(
final Object object,
final String methodName,
Object[] args)
throws
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException {
if (args == null) {
args = EMPTY_OBJECT_ARRAY;
}
final int arguments = args.length;
final Class<?>[] parameterTypes = new Class[arguments];
for (int i = 0; i < arguments; i++) {
parameterTypes[i] = args[i].getClass();
}
return invokeExactMethod(object, methodName, args, parameterTypes);
} | static Object function( final Object object, final String methodName, Object[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (args == null) { args = EMPTY_OBJECT_ARRAY; } final int arguments = args.length; final Class<?>[] parameterTypes = new Class[arguments]; for (int i = 0; i < arguments; i++) { parameterTypes[i] = args[i].getClass(); } return invokeExactMethod(object, methodName, args, parameterTypes); } | /**
* <p>Invoke a method whose parameter types match exactly the object
* types.</p>
*
* <p> This uses reflection to invoke the method obtained from a call to
* <code>getAccessibleMethod()</code>.</p>
*
* @param object invoke method on this object
* @param methodName get method with this name
* @param args use these arguments - treat null as empty array (passing null will
* result in calling the parameterless method with name {@code methodName}).
* @return The value returned by the invoked method
*
* @throws NoSuchMethodException if there is no such accessible method
* @throws InvocationTargetException wraps an exception thrown by the
* method invoked
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/ | Invoke a method whose parameter types match exactly the object types. This uses reflection to invoke the method obtained from a call to <code>getAccessibleMethod()</code> | invokeExactMethod | {
"repo_name": "8enet/AppOpsX",
"path": "opsxlib/src/main/java/com/zzzmode/appopsx/common/MethodUtils.java",
"license": "mit",
"size": 51215
} | [
"java.lang.reflect.InvocationTargetException"
] | import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,235,568 |
public static boolean isReachable(String host, int numTries) {
int tryNo = 0;
boolean reachable = false;
while (tryNo < numTries) {
Socket socket = null;
try {
socket = new Socket();
InetSocketAddress inetSocketAddress = new InetSocketAddress(host, 22);
socket.connect(inetSocketAddress, 2000);
reachable = true;
break;
} catch (Exception e) {
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
break;
}
logger.info("not reachable yet, trying again (" + tryNo + "/"
+ numTries + ") - " + Throwables.getRootCause(e).getMessage());
tryNo++;
} finally {
if (socket != null)
try {
socket.close();
} catch (IOException ignore) {
}
}
}
return reachable;
} | static boolean function(String host, int numTries) { int tryNo = 0; boolean reachable = false; while (tryNo < numTries) { Socket socket = null; try { socket = new Socket(); InetSocketAddress inetSocketAddress = new InetSocketAddress(host, 22); socket.connect(inetSocketAddress, 2000); reachable = true; break; } catch (Exception e) { try { Thread.sleep(2000); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); break; } logger.info(STR + tryNo + "/" + numTries + STR + Throwables.getRootCause(e).getMessage()); tryNo++; } finally { if (socket != null) try { socket.close(); } catch (IOException ignore) { } } } return reachable; } | /**
* Utility method to determine if the given host reachable. Usefull when
* waiting for VMs to startup in the cloud.
*
* @param host
* @param numTries
* @return
*/ | Utility method to determine if the given host reachable. Usefull when waiting for VMs to startup in the cloud | isReachable | {
"repo_name": "RoddiPotter/cicstart",
"path": "cicstart/src/main/java/ca/ualberta/physics/cssdp/util/NetworkUtil.java",
"license": "apache-2.0",
"size": 3031
} | [
"com.google.common.base.Throwables",
"java.io.IOException",
"java.net.InetSocketAddress",
"java.net.Socket"
] | import com.google.common.base.Throwables; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; | import com.google.common.base.*; import java.io.*; import java.net.*; | [
"com.google.common",
"java.io",
"java.net"
] | com.google.common; java.io; java.net; | 483,685 |
public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() {
return ManagementFactoryHelper.getMemoryManagerMXBeans();
} | static List<MemoryManagerMXBean> function() { return ManagementFactoryHelper.getMemoryManagerMXBeans(); } | /**
* Returns a list of {@link MemoryManagerMXBean} objects
* in the Java virtual machine.
* The Java virtual machine can have one or more memory managers.
* It may add or remove memory managers during execution.
*
* @return a list of <tt>MemoryManagerMXBean</tt> objects.
*
*/ | Returns a list of <code>MemoryManagerMXBean</code> objects in the Java virtual machine. The Java virtual machine can have one or more memory managers. It may add or remove memory managers during execution | getMemoryManagerMXBeans | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/java/lang/management/ManagementFactory.java",
"license": "apache-2.0",
"size": 35734
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,144,488 |
protected void onAmendVmArgs(ImmutableList.Builder<String> vmArgsBuilder,
Optional<TargetDevice> targetDevice) {
if (!targetDevice.isPresent()) {
return;
}
TargetDevice device = targetDevice.get();
if (device.isEmulator()) {
vmArgsBuilder.add("-Dbuck.device=emulator");
} else {
vmArgsBuilder.add("-Dbuck.device=device");
}
if (device.hasIdentifier()) {
vmArgsBuilder.add("-Dbuck.device.id=" + device.getIdentifier());
}
} | void function(ImmutableList.Builder<String> vmArgsBuilder, Optional<TargetDevice> targetDevice) { if (!targetDevice.isPresent()) { return; } TargetDevice device = targetDevice.get(); if (device.isEmulator()) { vmArgsBuilder.add(STR); } else { vmArgsBuilder.add(STR); } if (device.hasIdentifier()) { vmArgsBuilder.add(STR + device.getIdentifier()); } } | /**
* Override this method if you need to amend vm args. Subclasses are required
* to call super.onAmendVmArgs(...).
*/ | Override this method if you need to amend vm args. Subclasses are required to call super.onAmendVmArgs(...) | onAmendVmArgs | {
"repo_name": "hgl888/buck",
"path": "src/com/facebook/buck/java/JavaTest.java",
"license": "apache-2.0",
"size": 20360
} | [
"com.facebook.buck.step.TargetDevice",
"com.google.common.base.Optional",
"com.google.common.collect.ImmutableList"
] | import com.facebook.buck.step.TargetDevice; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; | import com.facebook.buck.step.*; import com.google.common.base.*; import com.google.common.collect.*; | [
"com.facebook.buck",
"com.google.common"
] | com.facebook.buck; com.google.common; | 2,102,514 |
protected String getCriteriaLabel(LookupForm form, String componentId) {
return (String) form.getViewPostMetadata().getComponentPostData(componentId, UifConstants.PostMetadata.LABEL);
}
| String function(LookupForm form, String componentId) { return (String) form.getViewPostMetadata().getComponentPostData(componentId, UifConstants.PostMetadata.LABEL); } | /**
* Returns the label of the search criteria field.
*
* @param form lookup form instance containing the lookup data
* @param componentId component id of the search criteria field
* @return label of the search criteria field
*/ | Returns the label of the search criteria field | getCriteriaLabel | {
"repo_name": "mztaylor/rice-git",
"path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/lookup/LookupableImpl.java",
"license": "apache-2.0",
"size": 54828
} | [
"org.kuali.rice.krad.uif.UifConstants"
] | import org.kuali.rice.krad.uif.UifConstants; | import org.kuali.rice.krad.uif.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 1,964,060 |
PDFont getFont() throws IOException
{
return font;
} | PDFont getFont() throws IOException { return font; } | /**
* Returns the font.
*/ | Returns the font | getFont | {
"repo_name": "gavanx/pdflearn",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceString.java",
"license": "apache-2.0",
"size": 9438
} | [
"java.io.IOException",
"org.apache.pdfbox.pdmodel.font.PDFont"
] | import java.io.IOException; import org.apache.pdfbox.pdmodel.font.PDFont; | import java.io.*; import org.apache.pdfbox.pdmodel.font.*; | [
"java.io",
"org.apache.pdfbox"
] | java.io; org.apache.pdfbox; | 705,414 |
private boolean replayLog(final AuditReplayCommand command) {
final String src = command.getSrc();
final String dst = command.getDest();
FileSystem proxyFs = fsCache.get(command.getSimpleUgi());
if (proxyFs == null) {
UserGroupInformation ugi = UserGroupInformation
.createProxyUser(command.getSimpleUgi(), loginUser);
proxyFs = ugi.doAs((PrivilegedAction<FileSystem>) () -> {
try {
FileSystem fs = new DistributedFileSystem();
fs.initialize(namenodeUri, mapperConf);
return fs;
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
});
fsCache.put(command.getSimpleUgi(), proxyFs);
}
final FileSystem fs = proxyFs;
ReplayCommand replayCommand;
try {
replayCommand = ReplayCommand
.valueOf(command.getCommand().split(" ")[0].toUpperCase());
} catch (IllegalArgumentException iae) {
LOG.warn("Unsupported/invalid command: " + command);
replayCountersMap.get(REPLAYCOUNTERS.TOTALUNSUPPORTEDCOMMANDS)
.increment(1);
return false;
}
try {
long startTime = System.currentTimeMillis();
switch (replayCommand) {
case CREATE:
FSDataOutputStream fsDos = fs.create(new Path(src));
if (createBlocks) {
fsDos.writeByte(0);
}
fsDos.close();
break;
case GETFILEINFO:
fs.getFileStatus(new Path(src));
break;
case CONTENTSUMMARY:
fs.getContentSummary(new Path(src));
break;
case MKDIRS:
fs.mkdirs(new Path(src));
break;
case RENAME:
fs.rename(new Path(src), new Path(dst));
break;
case LISTSTATUS:
((DistributedFileSystem) fs).getClient().listPaths(src,
HdfsFileStatus.EMPTY_NAME);
break;
case APPEND:
fs.append(new Path(src));
return true;
case DELETE:
fs.delete(new Path(src), true);
break;
case OPEN:
fs.open(new Path(src)).close();
break;
case SETPERMISSION:
fs.setPermission(new Path(src), FsPermission.getDefault());
break;
case SETOWNER:
fs.setOwner(new Path(src),
UserGroupInformation.getCurrentUser().getShortUserName(),
UserGroupInformation.getCurrentUser().getPrimaryGroupName());
break;
case SETTIMES:
fs.setTimes(new Path(src), System.currentTimeMillis(),
System.currentTimeMillis());
break;
case SETREPLICATION:
fs.setReplication(new Path(src), (short) 1);
break;
case CONCAT:
// dst is like [path1, path2] - strip brackets and split on comma
String bareDist = dst.length() < 2 ? ""
: dst.substring(1, dst.length() - 1).trim();
List<Path> dsts = new ArrayList<>();
for (String s : Splitter.on(",").omitEmptyStrings().trimResults()
.split(bareDist)) {
dsts.add(new Path(s));
}
fs.concat(new Path(src), dsts.toArray(new Path[] {}));
break;
default:
throw new RuntimeException("Unexpected command: " + replayCommand);
}
long latency = System.currentTimeMillis() - startTime;
UserCommandKey userCommandKey = new UserCommandKey(command.getSimpleUgi(),
replayCommand.toString(), replayCommand.getType().toString());
commandLatencyMap.putIfAbsent(userCommandKey, new CountTimeWritable());
CountTimeWritable latencyWritable = commandLatencyMap.get(userCommandKey);
latencyWritable.setCount(latencyWritable.getCount() + 1);
latencyWritable.setTime(latencyWritable.getTime() + latency);
switch (replayCommand.getType()) {
case WRITE:
replayCountersMap.get(REPLAYCOUNTERS.TOTALWRITECOMMANDLATENCY)
.increment(latency);
replayCountersMap.get(REPLAYCOUNTERS.TOTALWRITECOMMANDS).increment(1);
break;
case READ:
replayCountersMap.get(REPLAYCOUNTERS.TOTALREADCOMMANDLATENCY)
.increment(latency);
replayCountersMap.get(REPLAYCOUNTERS.TOTALREADCOMMANDS).increment(1);
break;
default:
throw new RuntimeException("Unexpected command type: "
+ replayCommand.getType());
}
individualCommandsMap
.get(replayCommand + INDIVIDUAL_COMMANDS_LATENCY_SUFFIX)
.increment(latency);
individualCommandsMap
.get(replayCommand + INDIVIDUAL_COMMANDS_COUNT_SUFFIX).increment(1);
return true;
} catch (IOException e) {
LOG.debug("IOException: " + e.getLocalizedMessage());
individualCommandsMap
.get(replayCommand + INDIVIDUAL_COMMANDS_INVALID_SUFFIX).increment(1);
return false;
}
} | boolean function(final AuditReplayCommand command) { final String src = command.getSrc(); final String dst = command.getDest(); FileSystem proxyFs = fsCache.get(command.getSimpleUgi()); if (proxyFs == null) { UserGroupInformation ugi = UserGroupInformation .createProxyUser(command.getSimpleUgi(), loginUser); proxyFs = ugi.doAs((PrivilegedAction<FileSystem>) () -> { try { FileSystem fs = new DistributedFileSystem(); fs.initialize(namenodeUri, mapperConf); return fs; } catch (IOException ioe) { throw new RuntimeException(ioe); } }); fsCache.put(command.getSimpleUgi(), proxyFs); } final FileSystem fs = proxyFs; ReplayCommand replayCommand; try { replayCommand = ReplayCommand .valueOf(command.getCommand().split(" ")[0].toUpperCase()); } catch (IllegalArgumentException iae) { LOG.warn(STR + command); replayCountersMap.get(REPLAYCOUNTERS.TOTALUNSUPPORTEDCOMMANDS) .increment(1); return false; } try { long startTime = System.currentTimeMillis(); switch (replayCommand) { case CREATE: FSDataOutputStream fsDos = fs.create(new Path(src)); if (createBlocks) { fsDos.writeByte(0); } fsDos.close(); break; case GETFILEINFO: fs.getFileStatus(new Path(src)); break; case CONTENTSUMMARY: fs.getContentSummary(new Path(src)); break; case MKDIRS: fs.mkdirs(new Path(src)); break; case RENAME: fs.rename(new Path(src), new Path(dst)); break; case LISTSTATUS: ((DistributedFileSystem) fs).getClient().listPaths(src, HdfsFileStatus.EMPTY_NAME); break; case APPEND: fs.append(new Path(src)); return true; case DELETE: fs.delete(new Path(src), true); break; case OPEN: fs.open(new Path(src)).close(); break; case SETPERMISSION: fs.setPermission(new Path(src), FsPermission.getDefault()); break; case SETOWNER: fs.setOwner(new Path(src), UserGroupInformation.getCurrentUser().getShortUserName(), UserGroupInformation.getCurrentUser().getPrimaryGroupName()); break; case SETTIMES: fs.setTimes(new Path(src), System.currentTimeMillis(), System.currentTimeMillis()); break; case SETREPLICATION: fs.setReplication(new Path(src), (short) 1); break; case CONCAT: String bareDist = dst.length() < 2 ? STR,STRUnexpected command: STRUnexpected command type: STRIOException: " + e.getLocalizedMessage()); individualCommandsMap .get(replayCommand + INDIVIDUAL_COMMANDS_INVALID_SUFFIX).increment(1); return false; } } | /**
* Attempt to replay the provided command. Updates counters accordingly.
*
* @param command The command to replay
* @return True iff the command was successfully replayed (i.e., no exceptions
* were thrown).
*/ | Attempt to replay the provided command. Updates counters accordingly | replayLog | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-workload/src/main/java/org/apache/hadoop/tools/dynamometer/workloadgenerator/audit/AuditReplayThread.java",
"license": "apache-2.0",
"size": 12691
} | [
"java.io.IOException",
"java.security.PrivilegedAction",
"org.apache.hadoop.fs.FSDataOutputStream",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.fs.permission.FsPermission",
"org.apache.hadoop.hdfs.DistributedFileSystem",
"org.apache.hadoop.hdfs.protocol.HdfsFileStatus",
"org.apache.hadoop.security.UserGroupInformation",
"org.apache.hadoop.tools.dynamometer.workloadgenerator.audit.AuditReplayMapper"
] | import java.io.IOException; import java.security.PrivilegedAction; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.tools.dynamometer.workloadgenerator.audit.AuditReplayMapper; | import java.io.*; import java.security.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.security.*; import org.apache.hadoop.tools.dynamometer.workloadgenerator.audit.*; | [
"java.io",
"java.security",
"org.apache.hadoop"
] | java.io; java.security; org.apache.hadoop; | 415,631 |
public static <T> T find(Iterable<T> iterable,
Predicate<? super T> predicate) {
return Iterators.find(iterable.iterator(), predicate);
} | static <T> T function(Iterable<T> iterable, Predicate<? super T> predicate) { return Iterators.find(iterable.iterator(), predicate); } | /**
* Returns the first element in {@code iterable} that satisfies the given
* predicate; use this method only when such an element is known to exist. If
* it is possible that <i>no</i> element will match, use {@link #tryFind} or
* {@link #find(Iterable, Predicate, Object)} instead.
*
* @throws NoSuchElementException if no element in {@code iterable} matches
* the given predicate
*/ | Returns the first element in iterable that satisfies the given predicate; use this method only when such an element is known to exist. If it is possible that no element will match, use <code>#tryFind</code> or <code>#find(Iterable, Predicate, Object)</code> instead | find | {
"repo_name": "cogitate/guava-libraries",
"path": "guava/src/com/google/common/collect/Iterables.java",
"license": "apache-2.0",
"size": 38135
} | [
"com.google.common.base.Predicate"
] | import com.google.common.base.Predicate; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,079,123 |
public static boolean testMutators()
{
boolean sentinel = true;
Movie m = new Movie(MOVIE_FILE_NAME);
if(!assertEquals("Incorrect Movie Name:"+m.getName(), m.getName(), EXPECTED_MOVIE_NAME))
{
sentinel = false;
}
return sentinel;
} | static boolean function() { boolean sentinel = true; Movie m = new Movie(MOVIE_FILE_NAME); if(!assertEquals(STR+m.getName(), m.getName(), EXPECTED_MOVIE_NAME)) { sentinel = false; } return sentinel; } | /**
* Tests mutators method in the Movie class
*
* @return boolean
*/ | Tests mutators method in the Movie class | testMutators | {
"repo_name": "RyanDawkins/glowing-spice",
"path": "test/Test_Movie.java",
"license": "apache-2.0",
"size": 1675
} | [
"com.ryanddawkins.glowing_spice.Movie"
] | import com.ryanddawkins.glowing_spice.Movie; | import com.ryanddawkins.glowing_spice.*; | [
"com.ryanddawkins.glowing_spice"
] | com.ryanddawkins.glowing_spice; | 2,157,164 |
public void loadFCommands() {
fCommands = new FCommandCache(this);
fCommands.register(this);
fCommands.registerAliases();
} | void function() { fCommands = new FCommandCache(this); fCommands.register(this); fCommands.registerAliases(); } | /**
* load / reload a new instance of FCommandCache
*/ | load / reload a new instance of FCommandCache | loadFCommands | {
"repo_name": "DRE2N/FactionsXL",
"path": "src/main/java/de/erethon/factionsxl/FactionsXL.java",
"license": "gpl-3.0",
"size": 16484
} | [
"de.erethon.factionsxl.command.FCommandCache"
] | import de.erethon.factionsxl.command.FCommandCache; | import de.erethon.factionsxl.command.*; | [
"de.erethon.factionsxl"
] | de.erethon.factionsxl; | 2,028,306 |
private static Test getEmbeddedSuite(String postfix) {
BaseTestSuite suite = new BaseTestSuite("Embedded" + postfix);
suite.addTest(new DataSourceTest("testDSRequestAuthentication"));
return suite;
} | static Test function(String postfix) { BaseTestSuite suite = new BaseTestSuite(STR + postfix); suite.addTest(new DataSourceTest(STR)); return suite; } | /**
* Return a suite of tests that are run with embedded only
*
* @param postfix suite name postfix
* @return A suite of tests being run with embedded only
*/ | Return a suite of tests that are run with embedded only | getEmbeddedSuite | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java",
"license": "apache-2.0",
"size": 30082
} | [
"junit.framework.Test",
"org.apache.derbyTesting.junit.BaseTestSuite"
] | import junit.framework.Test; import org.apache.derbyTesting.junit.BaseTestSuite; | import junit.framework.*; import org.apache.*; | [
"junit.framework",
"org.apache"
] | junit.framework; org.apache; | 160,637 |
public void testNRules() {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet();
CellRangeAddress[] cellRanges = {
new CellRangeAddress(0,1,0,0),
new CellRangeAddress(0,1,2,2),
};
CFRuleRecord[] rules = {
CFRuleRecord.create(sheet, "7"),
CFRuleRecord.create(sheet, ComparisonOperator.BETWEEN, "2", "5"),
};
CFRecordsAggregate agg = new CFRecordsAggregate(cellRanges, rules);
byte[] serializedRecord = new byte[agg.getRecordSize()];
agg.serialize(0, serializedRecord);
int nRules = LittleEndian.getUShort(serializedRecord, 4);
if (nRules == 0) {
throw new AssertionFailedError("Identified bug 45682 b");
}
assertEquals(rules.length, nRules);
} | void function() { HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet(); CellRangeAddress[] cellRanges = { new CellRangeAddress(0,1,0,0), new CellRangeAddress(0,1,2,2), }; CFRuleRecord[] rules = { CFRuleRecord.create(sheet, "7"), CFRuleRecord.create(sheet, ComparisonOperator.BETWEEN, "2", "5"), }; CFRecordsAggregate agg = new CFRecordsAggregate(cellRanges, rules); byte[] serializedRecord = new byte[agg.getRecordSize()]; agg.serialize(0, serializedRecord); int nRules = LittleEndian.getUShort(serializedRecord, 4); if (nRules == 0) { throw new AssertionFailedError(STR); } assertEquals(rules.length, nRules); } | /**
* Make sure that the CF Header record is properly updated with the number of rules
*/ | Make sure that the CF Header record is properly updated with the number of rules | testNRules | {
"repo_name": "lvweiwolf/poi-3.16",
"path": "src/testcases/org/apache/poi/hssf/record/aggregates/TestCFRecordsAggregate.java",
"license": "apache-2.0",
"size": 6560
} | [
"junit.framework.AssertionFailedError",
"org.apache.poi.hssf.record.CFRuleBase",
"org.apache.poi.hssf.record.CFRuleRecord",
"org.apache.poi.hssf.usermodel.HSSFSheet",
"org.apache.poi.hssf.usermodel.HSSFWorkbook",
"org.apache.poi.ss.util.CellRangeAddress",
"org.apache.poi.util.LittleEndian"
] | import junit.framework.AssertionFailedError; import org.apache.poi.hssf.record.CFRuleBase; import org.apache.poi.hssf.record.CFRuleRecord; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.util.LittleEndian; | import junit.framework.*; import org.apache.poi.hssf.record.*; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.util.*; import org.apache.poi.util.*; | [
"junit.framework",
"org.apache.poi"
] | junit.framework; org.apache.poi; | 2,020,073 |
private static boolean getIsFrescoEnabledFromXml(Resources resources, String resourcePackageName) {
// Read from appboy xml for the xml setting
boolean frescoEnabledXmlSetting;
int resId = resources.getIdentifier(FRESCO_ENABLED, "bool", resourcePackageName);
if (resId != 0) {
// Resources are loaded, retrieve the xml setting
frescoEnabledXmlSetting = resources.getBoolean(resId);
} else {
// If the xml setting isn't present, default to false.
frescoEnabledXmlSetting = false;
}
return frescoEnabledXmlSetting;
} | static boolean function(Resources resources, String resourcePackageName) { boolean frescoEnabledXmlSetting; int resId = resources.getIdentifier(FRESCO_ENABLED, "bool", resourcePackageName); if (resId != 0) { frescoEnabledXmlSetting = resources.getBoolean(resId); } else { frescoEnabledXmlSetting = false; } return frescoEnabledXmlSetting; } | /**
* Returns the xml value for Fresco out of the Appboy xml location. If the xml setting is not present,
* then this method returns true.
*/ | Returns the xml value for Fresco out of the Appboy xml location. If the xml setting is not present, then this method returns true | getIsFrescoEnabledFromXml | {
"repo_name": "TorreyKahuna/mparticle-android-sdk",
"path": "kits/appboy-kit/src/main/java/com/appboy/ui/support/FrescoLibraryUtils.java",
"license": "apache-2.0",
"size": 7226
} | [
"android.content.res.Resources"
] | import android.content.res.Resources; | import android.content.res.*; | [
"android.content"
] | android.content; | 2,816,335 |
@Override
public Map<String, Object> toMap(int maxCols) {
// we start with the fingerprint map and build on top of it.
Map<String, Object> map = getFingerprint();
// replace the fingerprint's simple list of families with a
// map from column families to lists of qualifiers and kv details
Map<String, List<String>> columns = new HashMap<String, List<String>>();
map.put("families", columns);
// add scalar information first
map.put("row", Bytes.toStringBinary(this.row));
map.put("maxVersions", this.maxVersions);
map.put("cacheBlocks", this.cacheBlocks);
List<Long> timeRange = new ArrayList<Long>();
timeRange.add(this.tr.getMin());
timeRange.add(this.tr.getMax());
map.put("timeRange", timeRange);
int colCount = 0;
// iterate through affected families and add details
for (Map.Entry<byte [], NavigableSet<byte[]>> entry :
this.familyMap.entrySet()) {
List<String> familyList = new ArrayList<String>();
columns.put(Bytes.toStringBinary(entry.getKey()), familyList);
if(entry.getValue() == null) {
colCount++;
--maxCols;
familyList.add("ALL");
} else {
colCount += entry.getValue().size();
if (maxCols <= 0) {
continue;
}
for (byte [] column : entry.getValue()) {
if (--maxCols <= 0) {
continue;
}
familyList.add(Bytes.toStringBinary(column));
}
}
}
map.put("totalColumns", colCount);
if (this.filter != null) {
map.put("filter", this.filter.toString());
}
// add the id if set
if (getId() != null) {
map.put("id", getId());
}
return map;
} | Map<String, Object> function(int maxCols) { Map<String, Object> map = getFingerprint(); Map<String, List<String>> columns = new HashMap<String, List<String>>(); map.put(STR, columns); map.put("row", Bytes.toStringBinary(this.row)); map.put(STR, this.maxVersions); map.put(STR, this.cacheBlocks); List<Long> timeRange = new ArrayList<Long>(); timeRange.add(this.tr.getMin()); timeRange.add(this.tr.getMax()); map.put(STR, timeRange); int colCount = 0; for (Map.Entry<byte [], NavigableSet<byte[]>> entry : this.familyMap.entrySet()) { List<String> familyList = new ArrayList<String>(); columns.put(Bytes.toStringBinary(entry.getKey()), familyList); if(entry.getValue() == null) { colCount++; --maxCols; familyList.add("ALL"); } else { colCount += entry.getValue().size(); if (maxCols <= 0) { continue; } for (byte [] column : entry.getValue()) { if (--maxCols <= 0) { continue; } familyList.add(Bytes.toStringBinary(column)); } } } map.put(STR, colCount); if (this.filter != null) { map.put(STR, this.filter.toString()); } if (getId() != null) { map.put("id", getId()); } return map; } | /**
* Compile the details beyond the scope of getFingerprint (row, columns,
* timestamps, etc.) into a Map along with the fingerprinted information.
* Useful for debugging, logging, and administration tools.
* @param maxCols a limit on the number of columns output prior to truncation
* @return Map
*/ | Compile the details beyond the scope of getFingerprint (row, columns, timestamps, etc.) into a Map along with the fingerprinted information. Useful for debugging, logging, and administration tools | toMap | {
"repo_name": "zqxjjj/NobidaBase",
"path": "target/hbase-0.94.9/hbase-0.94.9/src/main/java/org/apache/hadoop/hbase/client/Get.java",
"license": "apache-2.0",
"size": 13935
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.NavigableSet",
"org.apache.hadoop.hbase.util.Bytes"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.NavigableSet; 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; | 658,225 |
EReference getVariableDeclaration_VariableExp(); | EReference getVariableDeclaration_VariableExp(); | /**
* Returns the meta object for the reference list '{@link anatlyzer.atlext.OCL.VariableDeclaration#getVariableExp <em>Variable Exp</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Variable Exp</em>'.
* @see anatlyzer.atlext.OCL.VariableDeclaration#getVariableExp()
* @see #getVariableDeclaration()
* @generated
*/ | Returns the meta object for the reference list '<code>anatlyzer.atlext.OCL.VariableDeclaration#getVariableExp Variable Exp</code>'. | getVariableDeclaration_VariableExp | {
"repo_name": "jesusc/anatlyzer",
"path": "plugins/anatlyzer.atl.typing/src-gen/anatlyzer/atlext/OCL/OCLPackage.java",
"license": "epl-1.0",
"size": 484377
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,621,606 |
private Map<String, String> generateWorkers(WorkerCompiler<?> w) {
Map<String, String> files = new HashMap<String, String>();
WorkerSignature workerSignature = w.getGeneratee().getSignature();
String[] identifiers = workerSignature.getName().split("\\.");
String workerSimpleClassName = identifiers[identifiers.length - 1];
String workerClassName = "Worker_" + workerSimpleClassName.substring(0, 1).toUpperCase()
+ workerSimpleClassName.substring(1) + "_" + counterWorkerName;
counterWorkerName++;
STGroupFile workerTemplates = new STGroupFile(
eclipse ? "src/main/resources/java-worker.stg" : "java-worker.stg");
String workerCode = "";
w.getGeneratee().addAnnotation("className", workerClassName);
// Generate header
ST workerHeaderTemplate = workerTemplates.getInstanceOf("header");
if (!packagename.equals(""))
workerHeaderTemplate.add("packageName", packagename);
workerCode += workerHeaderTemplate.render();
// Generate body
ST workerClassTemplate = workerTemplates.getInstanceOf("workerClass");
workerClassTemplate.add("simpleClassName", workerClassName);
workerClassTemplate.add("signature", workerSignature);
workerCode += "\n\n" + workerClassTemplate.render();
files.put(workerClassName + ".java", workerCode);
return files;
} | Map<String, String> function(WorkerCompiler<?> w) { Map<String, String> files = new HashMap<String, String>(); WorkerSignature workerSignature = w.getGeneratee().getSignature(); String[] identifiers = workerSignature.getName().split("\\."); String workerSimpleClassName = identifiers[identifiers.length - 1]; String workerClassName = STR + workerSimpleClassName.substring(0, 1).toUpperCase() + workerSimpleClassName.substring(1) + "_" + counterWorkerName; counterWorkerName++; STGroupFile workerTemplates = new STGroupFile( eclipse ? STR : STR); String workerCode = STRclassNameSTRheaderSTRSTRpackageNameSTRworkerClassSTRsimpleClassNameSTRsignatureSTR\n\nSTR.java", workerCode); return files; } | /**
* Generates the worker classes.
*
* @param w
* worker compiler
*
* @return Map assigning Java code to a file name
*/ | Generates the worker classes | generateWorkers | {
"repo_name": "kasperdokter/Reo-compiler",
"path": "reo-compiler-lykos/src/main/java/nl/cwi/reo/lykos/SimpleLykos.java",
"license": "mit",
"size": 10866
} | [
"java.util.HashMap",
"java.util.Map",
"nl.cwi.reo.pr.comp.WorkerCompiler",
"org.stringtemplate.v4.STGroupFile"
] | import java.util.HashMap; import java.util.Map; import nl.cwi.reo.pr.comp.WorkerCompiler; import org.stringtemplate.v4.STGroupFile; | import java.util.*; import nl.cwi.reo.pr.comp.*; import org.stringtemplate.v4.*; | [
"java.util",
"nl.cwi.reo",
"org.stringtemplate.v4"
] | java.util; nl.cwi.reo; org.stringtemplate.v4; | 52,191 |
private ServiceRegistration<?> registerMBeanService(String jmsResourceName, BundleContext bundleContext) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put(KEY_SERVICE_VENDOR, "IBM");
JmsServiceProviderMBeanImpl jmsProviderMBean = new JmsServiceProviderMBeanImpl(getServerName(), KEY_JMS2_PROVIDER);
props.put(KEY_JMX_OBJECTNAME, jmsProviderMBean.getobjectName());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "JmsQueueMBeanImpl=" + jmsProviderMBean.getobjectName() + " props=" + props);
}
return bundleContext.registerService(JmsServiceProviderMBeanImpl.class, jmsProviderMBean, props);
} | ServiceRegistration<?> function(String jmsResourceName, BundleContext bundleContext) { Dictionary<String, String> props = new Hashtable<String, String>(); props.put(KEY_SERVICE_VENDOR, "IBM"); JmsServiceProviderMBeanImpl jmsProviderMBean = new JmsServiceProviderMBeanImpl(getServerName(), KEY_JMS2_PROVIDER); props.put(KEY_JMX_OBJECTNAME, jmsProviderMBean.getobjectName()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR + jmsProviderMBean.getobjectName() + STR + props); } return bundleContext.registerService(JmsServiceProviderMBeanImpl.class, jmsProviderMBean, props); } | /**
* Registers MBean for JMSServiceProvider .. in future can be made generic.
*
* @param jmsResourceName
* @param bundleContext
* @return
*/ | Registers MBean for JMSServiceProvider .. in future can be made generic | registerMBeanService | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.messaging.jms.j2ee.mbeans/src/com/ibm/ws/messaging/jms/j2ee/mbeans/internal/JMSMbeansActivator.java",
"license": "epl-1.0",
"size": 4698
} | [
"com.ibm.websphere.ras.Tr",
"com.ibm.websphere.ras.TraceComponent",
"com.ibm.ws.messaging.jms.j2ee.mbeans.JmsServiceProviderMBeanImpl",
"java.util.Dictionary",
"java.util.Hashtable",
"org.osgi.framework.BundleContext",
"org.osgi.framework.ServiceRegistration"
] | import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent; import com.ibm.ws.messaging.jms.j2ee.mbeans.JmsServiceProviderMBeanImpl; import java.util.Dictionary; import java.util.Hashtable; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; | import com.ibm.websphere.ras.*; import com.ibm.ws.messaging.jms.j2ee.mbeans.*; import java.util.*; import org.osgi.framework.*; | [
"com.ibm.websphere",
"com.ibm.ws",
"java.util",
"org.osgi.framework"
] | com.ibm.websphere; com.ibm.ws; java.util; org.osgi.framework; | 1,816,124 |
public MessagePacker packString(String s)
throws IOException
{
if (s.length() <= 0) {
packRawStringHeader(0);
return this;
}
CharBuffer in = CharBuffer.wrap(s);
prepareEncoder();
flush();
prepareBuffer();
boolean isExtension = false;
ByteBuffer encodeBuffer = buffer.toByteBuffer(position, buffer.size() - position);
encoder.reset();
while (in.hasRemaining()) {
try {
CoderResult cr = encoder.encode(in, encodeBuffer, true);
// Input data is insufficient
if (cr.isUnderflow()) {
cr = encoder.flush(encodeBuffer);
}
// encodeBuffer is too small
if (cr.isOverflow()) {
// Allocate a larger buffer
int estimatedRemainingSize = Math.max(1, (int) (in.remaining() * encoder.averageBytesPerChar()));
encodeBuffer.flip();
ByteBuffer newBuffer = ByteBuffer.allocate(Math.max((int) (encodeBuffer.capacity() * 1.5), encodeBuffer.remaining() + estimatedRemainingSize));
// Coy the current encodeBuffer contents to the new buffer
newBuffer.put(encodeBuffer);
encodeBuffer = newBuffer;
isExtension = true;
encoder.reset();
continue;
}
if (cr.isError()) {
if ((cr.isMalformed() && config.getActionOnMalFormedInput() == CodingErrorAction.REPORT) ||
(cr.isUnmappable() && config.getActionOnUnmappableCharacter() == CodingErrorAction.REPORT)) {
cr.throwException();
}
}
}
catch (CharacterCodingException e) {
throw new MessageStringCodingException(e);
}
}
encodeBuffer.flip();
int strLen = encodeBuffer.remaining();
// Preserve the current buffer
MessageBuffer tmpBuf = buffer;
// Switch the buffer to write the string length
if (strLenBuffer == null) {
strLenBuffer = MessageBuffer.newBuffer(5);
}
buffer = strLenBuffer;
position = 0;
// pack raw string header (string binary size)
packRawStringHeader(strLen);
flush(); // We need to dump the data here to MessageBufferOutput so that we can switch back to the original buffer
// Reset to the original buffer (or encodeBuffer if new buffer is allocated)
buffer = isExtension ? MessageBuffer.wrap(encodeBuffer) : tmpBuf;
// No need exists to write payload since the encoded string (payload) is already written to the buffer
position = strLen;
return this;
} | MessagePacker function(String s) throws IOException { if (s.length() <= 0) { packRawStringHeader(0); return this; } CharBuffer in = CharBuffer.wrap(s); prepareEncoder(); flush(); prepareBuffer(); boolean isExtension = false; ByteBuffer encodeBuffer = buffer.toByteBuffer(position, buffer.size() - position); encoder.reset(); while (in.hasRemaining()) { try { CoderResult cr = encoder.encode(in, encodeBuffer, true); if (cr.isUnderflow()) { cr = encoder.flush(encodeBuffer); } if (cr.isOverflow()) { int estimatedRemainingSize = Math.max(1, (int) (in.remaining() * encoder.averageBytesPerChar())); encodeBuffer.flip(); ByteBuffer newBuffer = ByteBuffer.allocate(Math.max((int) (encodeBuffer.capacity() * 1.5), encodeBuffer.remaining() + estimatedRemainingSize)); newBuffer.put(encodeBuffer); encodeBuffer = newBuffer; isExtension = true; encoder.reset(); continue; } if (cr.isError()) { if ((cr.isMalformed() && config.getActionOnMalFormedInput() == CodingErrorAction.REPORT) (cr.isUnmappable() && config.getActionOnUnmappableCharacter() == CodingErrorAction.REPORT)) { cr.throwException(); } } } catch (CharacterCodingException e) { throw new MessageStringCodingException(e); } } encodeBuffer.flip(); int strLen = encodeBuffer.remaining(); MessageBuffer tmpBuf = buffer; if (strLenBuffer == null) { strLenBuffer = MessageBuffer.newBuffer(5); } buffer = strLenBuffer; position = 0; packRawStringHeader(strLen); flush(); buffer = isExtension ? MessageBuffer.wrap(encodeBuffer) : tmpBuf; position = strLen; return this; } | /**
* Pack the input String in UTF-8 encoding
*
* @param s
* @return
* @throws IOException
*/ | Pack the input String in UTF-8 encoding | packString | {
"repo_name": "suzukaze/msgpack-java",
"path": "msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java",
"license": "apache-2.0",
"size": 21713
} | [
"java.io.IOException",
"java.nio.ByteBuffer",
"java.nio.CharBuffer",
"java.nio.charset.CharacterCodingException",
"java.nio.charset.CoderResult",
"java.nio.charset.CodingErrorAction",
"org.msgpack.core.buffer.MessageBuffer"
] | import java.io.IOException; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; import org.msgpack.core.buffer.MessageBuffer; | import java.io.*; import java.nio.*; import java.nio.charset.*; import org.msgpack.core.buffer.*; | [
"java.io",
"java.nio",
"org.msgpack.core"
] | java.io; java.nio; org.msgpack.core; | 178,119 |
@ApiModelProperty(example = "null", value = "")
public String getCategoryType() {
return categoryType;
} | @ApiModelProperty(example = "null", value = "") String function() { return categoryType; } | /**
* Get categoryType
* @return categoryType
**/ | Get categoryType | getCategoryType | {
"repo_name": "PitneyBowes/LocationIntelligenceSDK-Java",
"path": "src/main/java/pb/locationintelligence/model/Lifestyle.java",
"license": "apache-2.0",
"size": 4590
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 2,861,017 |
public long bucketOwner(GcsPath path) throws IOException {
return getBucket(
path,
BACKOFF_FACTORY.backoff(),
Sleeper.DEFAULT).getProjectNumber().longValue();
} | long function(GcsPath path) throws IOException { return getBucket( path, BACKOFF_FACTORY.backoff(), Sleeper.DEFAULT).getProjectNumber().longValue(); } | /**
* Returns the project number of the project which owns this bucket.
* If the bucket exists, it must be accessible otherwise the permissions
* exception will be propagated. If the bucket does not exist, an exception
* will be thrown.
*/ | Returns the project number of the project which owns this bucket. If the bucket exists, it must be accessible otherwise the permissions exception will be propagated. If the bucket does not exist, an exception will be thrown | bucketOwner | {
"repo_name": "yafengguo/Apache-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/util/GcsUtil.java",
"license": "apache-2.0",
"size": 22750
} | [
"com.google.api.client.util.Sleeper",
"java.io.IOException",
"org.apache.beam.sdk.util.gcsfs.GcsPath"
] | import com.google.api.client.util.Sleeper; import java.io.IOException; import org.apache.beam.sdk.util.gcsfs.GcsPath; | import com.google.api.client.util.*; import java.io.*; import org.apache.beam.sdk.util.gcsfs.*; | [
"com.google.api",
"java.io",
"org.apache.beam"
] | com.google.api; java.io; org.apache.beam; | 690,002 |
public static void createJcrontabDir() {
File distDir = new File(dir);
distDir.mkdir();
}
| static void function() { File distDir = new File(dir); distDir.mkdir(); } | /**
* This method creates the default jcrontabDir
*
*/ | This method creates the default jcrontabDir | createJcrontabDir | {
"repo_name": "vpupkin/jcheduler",
"path": "src/main/java/org/jcrontab/data/DefaultFiles.java",
"license": "lgpl-2.1",
"size": 4723
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 250,280 |
public BL getNegationInd() { return BLimpl.NI; } | public BL getNegationInd() { return BLimpl.NI; } | /** Property mutator, does nothing if not overloaded.sequenceNumber.
@see org.hl7.rim.Participation#setSequenceNumber
*/ | Property mutator, does nothing if not overloaded.sequenceNumber | setSequenceNumber | {
"repo_name": "markusgumbel/dshl7",
"path": "hl7-javasig/gencode/org/hl7/rim/decorators/ParticipationDecorator.java",
"license": "apache-2.0",
"size": 9606
} | [
"org.hl7.types.impl.BLimpl"
] | import org.hl7.types.impl.BLimpl; | import org.hl7.types.impl.*; | [
"org.hl7.types"
] | org.hl7.types; | 518,814 |
public Object getDataArray(int b) {
Object dataArray = null;
switch(getDataType()) {
case DataBuffer.TYPE_BYTE:
dataArray = getByteDataArray(b);
break;
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
dataArray = getShortDataArray(b);
break;
case DataBuffer.TYPE_INT:
dataArray = getIntDataArray(b);
break;
case DataBuffer.TYPE_FLOAT:
dataArray = getFloatDataArray(b);
break;
case DataBuffer.TYPE_DOUBLE:
dataArray = getDoubleDataArray(b);
break;
default:
dataArray = null;
}
return dataArray;
} | Object function(int b) { Object dataArray = null; switch(getDataType()) { case DataBuffer.TYPE_BYTE: dataArray = getByteDataArray(b); break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: dataArray = getShortDataArray(b); break; case DataBuffer.TYPE_INT: dataArray = getIntDataArray(b); break; case DataBuffer.TYPE_FLOAT: dataArray = getFloatDataArray(b); break; case DataBuffer.TYPE_DOUBLE: dataArray = getDoubleDataArray(b); break; default: dataArray = null; } return dataArray; } | /**
* Returns the image data as an Object for a specific band.
*
* @param b The index of the image band of interest.
*/ | Returns the image data as an Object for a specific band | getDataArray | {
"repo_name": "MarinnaCole/LightZone",
"path": "lightcrafts/extsrc/com/lightcrafts/mediax/jai/RasterAccessor.java",
"license": "bsd-3-clause",
"size": 57845
} | [
"java.awt.image.DataBuffer"
] | import java.awt.image.DataBuffer; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 739,465 |
public void testSubmitRunnable() throws Throwable {
ExecutorService e = new ForkJoinPool(1);
PoolCleaner cleaner = null;
try {
cleaner = cleaner(e);
Future<?> future = e.submit(new NoOpRunnable());
assertNull(future.get());
assertTrue(future.isDone());
assertFalse(future.isCancelled());
} finally {
if (cleaner != null) {
cleaner.close();
}
}
} | void function() throws Throwable { ExecutorService e = new ForkJoinPool(1); PoolCleaner cleaner = null; try { cleaner = cleaner(e); Future<?> future = e.submit(new NoOpRunnable()); assertNull(future.get()); assertTrue(future.isDone()); assertFalse(future.isCancelled()); } finally { if (cleaner != null) { cleaner.close(); } } } | /**
* Completed submit(runnable) returns successfully
*/ | Completed submit(runnable) returns successfully | testSubmitRunnable | {
"repo_name": "streamsupport/streamsupport",
"path": "src/tests/java/org/openjdk/tests/tck/ForkJoinPoolTest.java",
"license": "gpl-2.0",
"size": 41090
} | [
"java.util.concurrent.ExecutorService",
"java.util.concurrent.Future"
] | import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,055,668 |
TimeValue nextExecutionDelay(DateTime now);
}
static class DefaultExecutionScheduler implements ExecutionScheduler { | TimeValue nextExecutionDelay(DateTime now); } static class DefaultExecutionScheduler implements ExecutionScheduler { | /**
* Calculates the delay in millis between "now" and the next execution.
*
* @param now the current time
* @return the delay in millis
*/ | Calculates the delay in millis between "now" and the next execution | nextExecutionDelay | {
"repo_name": "gfyoung/elasticsearch",
"path": "x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/cleaner/CleanerService.java",
"license": "apache-2.0",
"size": 9387
} | [
"org.elasticsearch.common.unit.TimeValue",
"org.joda.time.DateTime"
] | import org.elasticsearch.common.unit.TimeValue; import org.joda.time.DateTime; | import org.elasticsearch.common.unit.*; import org.joda.time.*; | [
"org.elasticsearch.common",
"org.joda.time"
] | org.elasticsearch.common; org.joda.time; | 1,850,491 |
public OutputStream open(
OutputStream out,
OutputCompressor compressor)
throws IOException
{
return open(CMSObjectIdentifiers.data, out, compressor);
} | OutputStream function( OutputStream out, OutputCompressor compressor) throws IOException { return open(CMSObjectIdentifiers.data, out, compressor); } | /**
* Open a compressing output stream with the PKCS#7 content type OID of "data".
*
* @param out the stream to encode to.
* @param compressor the type of compressor to use.
* @return an output stream to write the data be compressed to.
* @throws IOException
*/ | Open a compressing output stream with the PKCS#7 content type OID of "data" | open | {
"repo_name": "thedrummeraki/Aki-SSL",
"path": "src/org/bouncycastle/cms/CMSCompressedDataStreamGenerator.java",
"license": "apache-2.0",
"size": 4334
} | [
"java.io.IOException",
"java.io.OutputStream",
"org.bouncycastle.asn1.cms.CMSObjectIdentifiers",
"org.bouncycastle.operator.OutputCompressor"
] | import java.io.IOException; import java.io.OutputStream; import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; import org.bouncycastle.operator.OutputCompressor; | import java.io.*; import org.bouncycastle.asn1.cms.*; import org.bouncycastle.operator.*; | [
"java.io",
"org.bouncycastle.asn1",
"org.bouncycastle.operator"
] | java.io; org.bouncycastle.asn1; org.bouncycastle.operator; | 2,890,925 |
public void removeRolleFromAllSchleifen(RolleId _rolleId) throws StdException
{
PreparedStatement pst = getPstRolleFromAllSchleifen();
pst.setRolleId(1, _rolleId);
pst.execute();
pst.close();
} | void function(RolleId _rolleId) throws StdException { PreparedStatement pst = getPstRolleFromAllSchleifen(); pst.setRolleId(1, _rolleId); pst.execute(); pst.close(); } | /**
* Entzieht allen Personen die Berechtigungen der ggb. Rolle in Bezug auf
* *alle* Schleifen.
*
* @param _rolleId
* @throws StdException
*/ | Entzieht allen Personen die Berechtigungen der ggb. Rolle in Bezug auf alle* Schleifen | removeRolleFromAllSchleifen | {
"repo_name": "schakko/zabos",
"path": "src/zabos/src/main/java/de/ecw/zabos/sql/dao/SchleifenDAO.java",
"license": "gpl-3.0",
"size": 48875
} | [
"de.ecw.zabos.exceptions.StdException",
"de.ecw.zabos.sql.util.PreparedStatement",
"de.ecw.zabos.types.id.RolleId"
] | import de.ecw.zabos.exceptions.StdException; import de.ecw.zabos.sql.util.PreparedStatement; import de.ecw.zabos.types.id.RolleId; | import de.ecw.zabos.exceptions.*; import de.ecw.zabos.sql.util.*; import de.ecw.zabos.types.id.*; | [
"de.ecw.zabos"
] | de.ecw.zabos; | 2,289,343 |
ServiceFuture<Error> getRequiredGlobalQueryAsync(final ServiceCallback<Error> serviceCallback); | ServiceFuture<Error> getRequiredGlobalQueryAsync(final ServiceCallback<Error> serviceCallback); | /**
* Test implicitly required query parameter.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Test implicitly required query parameter | getRequiredGlobalQueryAsync | {
"repo_name": "vishrutshah/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/requiredoptional/Implicits.java",
"license": "mit",
"size": 15143
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 529,554 |
Author getAuthor();
| Author getAuthor(); | /** Get the author of the comment
* @return the BlogAuthor instance
*/ | Get the author of the comment | getAuthor | {
"repo_name": "WouterBanckenACA/aries",
"path": "samples/blog/blog-api/src/main/java/org/apache/aries/samples/blog/api/comment/persistence/Comment.java",
"license": "apache-2.0",
"size": 1711
} | [
"org.apache.aries.samples.blog.api.persistence.Author"
] | import org.apache.aries.samples.blog.api.persistence.Author; | import org.apache.aries.samples.blog.api.persistence.*; | [
"org.apache.aries"
] | org.apache.aries; | 2,298,774 |
@Deprecated
public View getView(){
return mHost;
} | View function(){ return mHost; } | /**
* use {@link #getHostView()} instead
* @return
*/ | use <code>#getHostView()</code> instead | getView | {
"repo_name": "MrRaindrop/incubator-weex",
"path": "android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java",
"license": "apache-2.0",
"size": 65023
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,391,069 |
public static void nukeSharedPreferences(@NonNull List<String> exceptions) {
for (String prefName : Pref.getAll()) {
if (exceptions.contains(prefName)) {
continue;
}
MainApplication.application.getSharedPreferences(
prefName, Context.MODE_PRIVATE).edit().clear().apply();
}
} | static void function(@NonNull List<String> exceptions) { for (String prefName : Pref.getAll()) { if (exceptions.contains(prefName)) { continue; } MainApplication.application.getSharedPreferences( prefName, Context.MODE_PRIVATE).edit().clear().apply(); } } | /**
* Clears all the shared preferences that are used in the app.
*
* @param exceptions Names of the preferences that need to be skipped while clearing.
*/ | Clears all the shared preferences that are used in the app | nukeSharedPreferences | {
"repo_name": "edx/edx-app-android",
"path": "OpenEdXMobile/src/main/java/org/edx/mobile/module/prefs/PrefManager.java",
"license": "apache-2.0",
"size": 11730
} | [
"android.content.Context",
"androidx.annotation.NonNull",
"java.util.List",
"org.edx.mobile.base.MainApplication"
] | import android.content.Context; import androidx.annotation.NonNull; import java.util.List; import org.edx.mobile.base.MainApplication; | import android.content.*; import androidx.annotation.*; import java.util.*; import org.edx.mobile.base.*; | [
"android.content",
"androidx.annotation",
"java.util",
"org.edx.mobile"
] | android.content; androidx.annotation; java.util; org.edx.mobile; | 967,484 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.