method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public static byte[] getBytesFromURL(URL url) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream is = null;
try {
is = url.openStream();
int bytesRead = 0;
byte[] buffer = new byte[8092];
while((bytesRead=is.read(buffer))!=-1) {
baos.write(buffer, 0, bytesRead);
}
return baos.toByteArray();
} catch (Exception e) {
throw new RuntimeException("Failed to read source of [" + url + "]", e);
} finally {
try { is.close(); } catch (Exception e) {}
}
}
| static byte[] function(URL url) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = null; try { is = url.openStream(); int bytesRead = 0; byte[] buffer = new byte[8092]; while((bytesRead=is.read(buffer))!=-1) { baos.write(buffer, 0, bytesRead); } return baos.toByteArray(); } catch (Exception e) { throw new RuntimeException(STR + url + "]", e); } finally { try { is.close(); } catch (Exception e) {} } } | /**
* Reads the content of a URL as a byte array
* @param url The url to get the bytes from
* @return a byte array representing the text read from the passed URL
*/ | Reads the content of a URL as a byte array | getBytesFromURL | {
"repo_name": "nickman/jboss7Sample",
"path": "project/services/src/main/java/org/helios/jboss7/util/URLHelper.java",
"license": "lgpl-2.1",
"size": 9842
} | [
"java.io.ByteArrayOutputStream",
"java.io.InputStream"
] | import java.io.ByteArrayOutputStream; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,254,920 |
private void setQueryFilterProperty(SolrQuery query, String propertyName, String leftPropertyValue, String leftOp,
String rightPropertyValue, String rightOp) {
if (StringUtils.isNotEmpty(propertyName)) {
if (leftPropertyValue != null && rightPropertyValue != null || rightOp
.equals(SolrConstants.OPERATION_EQUAL)) {
String rightValueType, leftValueType;
int rightIntValue = 0;
double rightDoubleValue = 0;
// No operation values only check the property name
if (StringUtils.isEmpty(leftPropertyValue) && StringUtils.isEmpty(rightPropertyValue)) {
String fieldKeyInt = propertyName + SolrConstants.SOLR_MULTIVALUED_INT_FIELD_KEY_SUFFIX + ":";
String fieldKeyDouble = propertyName + SolrConstants.SOLR_MULTIVALUED_DOUBLE_FIELD_KEY_SUFFIX + ":";
String fieldKeyString = propertyName + SolrConstants.SOLR_MULTIVALUED_STRING_FIELD_KEY_SUFFIX + ":";
query.addFilterQuery(fieldKeyInt + "* | " + fieldKeyDouble + "* | " + fieldKeyString + "*");
}
// check foe equal operation
if (rightOp.equals(SolrConstants.OPERATION_EQUAL) && StringUtils.isNotEmpty(rightPropertyValue)) {
setQueryFilterPropertyEqualOperation(query, propertyName, rightPropertyValue);
} else {
rightValueType = getType(rightPropertyValue);
leftValueType = getType(leftPropertyValue);
if (rightValueType.equals(SolrConstants.TYPE_INT)) {
rightIntValue = Integer.parseInt(rightPropertyValue);
if (rightOp.equals(SolrConstants.OPERATION_LESS_THAN)) {
--rightIntValue;
}
} else if (rightValueType.equals(SolrConstants.TYPE_DOUBLE)) {
rightDoubleValue = Double.parseDouble(rightPropertyValue);
if (rightOp.equals(SolrConstants.OPERATION_LESS_THAN)) {
rightDoubleValue = rightDoubleValue - 0.1;
}
}
if (rightValueType.equals(SolrConstants.TYPE_INT) || leftValueType.equals(SolrConstants.TYPE_INT)) {
setQueryFilterForIntegerPropertyValues(query, propertyName, leftPropertyValue,
rightPropertyValue, rightIntValue,
leftOp, rightOp);
} else if (rightValueType.equals(SolrConstants.TYPE_DOUBLE) || leftValueType
.equals(SolrConstants.TYPE_DOUBLE)) {
setQueryFilterForDoublePropertyValues(query, propertyName, leftPropertyValue,
rightPropertyValue, rightDoubleValue,
leftOp, rightOp);
}
}
}
}
} | void function(SolrQuery query, String propertyName, String leftPropertyValue, String leftOp, String rightPropertyValue, String rightOp) { if (StringUtils.isNotEmpty(propertyName)) { if (leftPropertyValue != null && rightPropertyValue != null rightOp .equals(SolrConstants.OPERATION_EQUAL)) { String rightValueType, leftValueType; int rightIntValue = 0; double rightDoubleValue = 0; if (StringUtils.isEmpty(leftPropertyValue) && StringUtils.isEmpty(rightPropertyValue)) { String fieldKeyInt = propertyName + SolrConstants.SOLR_MULTIVALUED_INT_FIELD_KEY_SUFFIX + ":"; String fieldKeyDouble = propertyName + SolrConstants.SOLR_MULTIVALUED_DOUBLE_FIELD_KEY_SUFFIX + ":"; String fieldKeyString = propertyName + SolrConstants.SOLR_MULTIVALUED_STRING_FIELD_KEY_SUFFIX + ":"; query.addFilterQuery(fieldKeyInt + STR + fieldKeyDouble + STR + fieldKeyString + "*"); } if (rightOp.equals(SolrConstants.OPERATION_EQUAL) && StringUtils.isNotEmpty(rightPropertyValue)) { setQueryFilterPropertyEqualOperation(query, propertyName, rightPropertyValue); } else { rightValueType = getType(rightPropertyValue); leftValueType = getType(leftPropertyValue); if (rightValueType.equals(SolrConstants.TYPE_INT)) { rightIntValue = Integer.parseInt(rightPropertyValue); if (rightOp.equals(SolrConstants.OPERATION_LESS_THAN)) { --rightIntValue; } } else if (rightValueType.equals(SolrConstants.TYPE_DOUBLE)) { rightDoubleValue = Double.parseDouble(rightPropertyValue); if (rightOp.equals(SolrConstants.OPERATION_LESS_THAN)) { rightDoubleValue = rightDoubleValue - 0.1; } } if (rightValueType.equals(SolrConstants.TYPE_INT) leftValueType.equals(SolrConstants.TYPE_INT)) { setQueryFilterForIntegerPropertyValues(query, propertyName, leftPropertyValue, rightPropertyValue, rightIntValue, leftOp, rightOp); } else if (rightValueType.equals(SolrConstants.TYPE_DOUBLE) leftValueType .equals(SolrConstants.TYPE_DOUBLE)) { setQueryFilterForDoublePropertyValues(query, propertyName, leftPropertyValue, rightPropertyValue, rightDoubleValue, leftOp, rightOp); } } } } } | /**
* Method to add the query filter for resource property values
* @param propertyName name of the property (property key)
* @param leftPropertyValue left property value
* @param leftOp left operation
* @param rightPropertyValue right property value
* @param rightOp right operation
* @param query solr query
*/ | Method to add the query filter for resource property values | setQueryFilterProperty | {
"repo_name": "laki88/carbon-registry",
"path": "components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java",
"license": "apache-2.0",
"size": 68907
} | [
"org.apache.commons.lang.StringUtils",
"org.apache.solr.client.solrj.SolrQuery",
"org.wso2.carbon.registry.indexing.SolrConstants"
] | import org.apache.commons.lang.StringUtils; import org.apache.solr.client.solrj.SolrQuery; import org.wso2.carbon.registry.indexing.SolrConstants; | import org.apache.commons.lang.*; import org.apache.solr.client.solrj.*; import org.wso2.carbon.registry.indexing.*; | [
"org.apache.commons",
"org.apache.solr",
"org.wso2.carbon"
] | org.apache.commons; org.apache.solr; org.wso2.carbon; | 45,257 |
private void touchEventsEnded () {
itemBeingDragged = false;
final View mobileView = getViewForID(mMobileItemId);
if (mobileView == null) {
mAboveItemId = INVALID_ID;
mMobileItemId = INVALID_ID;
mBelowItemId = INVALID_ID;
mHoverCell = null;
invalidate();
return;
}
if (mCellIsMobile|| mIsWaitingForScrollFinish) {
mCellIsMobile = false;
mIsWaitingForScrollFinish = false;
mIsMobileScrolling = false;
mActivePointerId = INVALID_POINTER_ID;
int finalPosition = getPositionForView(mobileView);
if( finalPosition != mOriginalPosition ) {
((DynamicListAdapter) getAdapter()).onSwapFinished(mOriginalPosition, finalPosition);
}
// If the autoscroller has not completed scrolling, we need to wait for it to
// finish in order to determine the final location of where the hover cell
// should be animated to.
if (mScrollState != OnScrollListener.SCROLL_STATE_IDLE) {
mIsWaitingForScrollFinish = true;
return;
}
mHoverCellCurrentBounds.offsetTo(mHoverCellOriginalBounds.left, mobileView.getTop()); | void function () { itemBeingDragged = false; final View mobileView = getViewForID(mMobileItemId); if (mobileView == null) { mAboveItemId = INVALID_ID; mMobileItemId = INVALID_ID; mBelowItemId = INVALID_ID; mHoverCell = null; invalidate(); return; } if (mCellIsMobile mIsWaitingForScrollFinish) { mCellIsMobile = false; mIsWaitingForScrollFinish = false; mIsMobileScrolling = false; mActivePointerId = INVALID_POINTER_ID; int finalPosition = getPositionForView(mobileView); if( finalPosition != mOriginalPosition ) { ((DynamicListAdapter) getAdapter()).onSwapFinished(mOriginalPosition, finalPosition); } if (mScrollState != OnScrollListener.SCROLL_STATE_IDLE) { mIsWaitingForScrollFinish = true; return; } mHoverCellCurrentBounds.offsetTo(mHoverCellOriginalBounds.left, mobileView.getTop()); | /**
* Resets all the appropriate fields to a default state while also animating
* the hover cell back to its correct location.
*/ | Resets all the appropriate fields to a default state while also animating the hover cell back to its correct location | touchEventsEnded | {
"repo_name": "xbmc/Kore",
"path": "app/src/main/java/org/xbmc/kore/ui/viewgroups/DynamicListView.java",
"license": "apache-2.0",
"size": 26344
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,269,526 |
ActorDTO dto = new DummyActorDTO();
dto.setId(entity.getId());
dto.setName(entity.getName());
dto.setType(entity.getType());
return dto;
}
| ActorDTO dto = new DummyActorDTO(); dto.setId(entity.getId()); dto.setName(entity.getName()); dto.setType(entity.getType()); return dto; } | /**
* Converts an {@code Actor} entity to DTO.
* @param entity the entity to convert to DTO
* @return {@code ActorDTO} equivalent to the entity
*/ | Converts an Actor entity to DTO | toDTO | {
"repo_name": "daergoth/hiots",
"path": "core/src/main/java/net/daergoth/core/actor/ActorConverter.java",
"license": "mit",
"size": 2149
} | [
"net.daergoth.coreapi.actor.ActorDTO",
"net.daergoth.coreapi.actor.DummyActorDTO"
] | import net.daergoth.coreapi.actor.ActorDTO; import net.daergoth.coreapi.actor.DummyActorDTO; | import net.daergoth.coreapi.actor.*; | [
"net.daergoth.coreapi"
] | net.daergoth.coreapi; | 55,284 |
public ServiceRefType<T> jaxrpcMappingFile(String jaxrpcMappingFile)
{
childNode.getOrCreate("jaxrpc-mapping-file").text(jaxrpcMappingFile);
return this;
} | ServiceRefType<T> function(String jaxrpcMappingFile) { childNode.getOrCreate(STR).text(jaxrpcMappingFile); return this; } | /**
* Sets the <code>jaxrpc-mapping-file</code> element
* @param jaxrpcMappingFile the value for the element <code>jaxrpc-mapping-file</code>
* @return the current instance of <code>ServiceRefType<T></code>
*/ | Sets the <code>jaxrpc-mapping-file</code> element | jaxrpcMappingFile | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/javaeewebservicesclient12/ServiceRefTypeImpl.java",
"license": "epl-1.0",
"size": 25854
} | [
"org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient12.ServiceRefType"
] | import org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient12.ServiceRefType; | import org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient12.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 78,628 |
public Date getModifiedSinceConstraint() {
return modifiedSinceConstraint;
} | Date function() { return modifiedSinceConstraint; } | /**
* Gets the optional modified constraint that restricts this
* request to executing only if the object <b>has</b> been
* modified after the specified date.
*
* @return The optional modified constraint that restricts this
* request to executing only if the object <b>has</b>
* been modified after the specified date.
*
* @see GetObjectRequest#setModifiedSinceConstraint(Date)
* @see GetObjectRequest#withModifiedSinceConstraint(Date)
*/ | Gets the optional modified constraint that restricts this request to executing only if the object has been modified after the specified date | getModifiedSinceConstraint | {
"repo_name": "nterry/aws-sdk-java",
"path": "aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/GetObjectRequest.java",
"license": "apache-2.0",
"size": 36552
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 481,635 |
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ResourceMetricInner> listMultiRoleMetricsAsync(String resourceGroupName, String name) {
final String startTime = null;
final String endTime = null;
final String timeGrain = null;
final Boolean details = null;
final String filter = null;
return new PagedFlux<>(
() ->
listMultiRoleMetricsSinglePageAsync(
resourceGroupName, name, startTime, endTime, timeGrain, details, filter),
nextLink -> listMultiRoleMetricsNextSinglePageAsync(nextLink));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ResourceMetricInner> function(String resourceGroupName, String name) { final String startTime = null; final String endTime = null; final String timeGrain = null; final Boolean details = null; final String filter = null; return new PagedFlux<>( () -> listMultiRoleMetricsSinglePageAsync( resourceGroupName, name, startTime, endTime, timeGrain, details, filter), nextLink -> listMultiRoleMetricsNextSinglePageAsync(nextLink)); } | /**
* Get metrics for a multi-role pool of an App Service Environment.
*
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of the App Service Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return metrics for a multi-role pool of an App Service Environment.
*/ | Get metrics for a multi-role pool of an App Service Environment | listMultiRoleMetricsAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/implementation/AppServiceEnvironmentsClientImpl.java",
"license": "mit",
"size": 563770
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.appservice.fluent.models.ResourceMetricInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.appservice.fluent.models.ResourceMetricInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.appservice.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,642,946 |
@Id
@Basic( optional = false )
@Column( name = "id", nullable = false ) @org.hibernate.annotations.Type(type="org.hibernate.type.PostgresUUIDType")
public java.util.UUID getId() {
return this.id;
} | @Basic( optional = false ) @Column( name = "id", nullable = false ) @org.hibernate.annotations.Type(type=STR) java.util.UUID function() { return this.id; } | /**
* Return the value associated with the column: id.
* @return A java.util.UUID object (this.id)
*/ | Return the value associated with the column: id | getId | {
"repo_name": "servinglynk/servinglynk-hmis",
"path": "base-model/src/main/java/com/servinglynk/hmis/warehouse/model/base/Client.java",
"license": "mpl-2.0",
"size": 23726
} | [
"javax.persistence.Basic",
"javax.persistence.Column",
"org.hibernate.annotations.Type"
] | import javax.persistence.Basic; import javax.persistence.Column; import org.hibernate.annotations.Type; | import javax.persistence.*; import org.hibernate.annotations.*; | [
"javax.persistence",
"org.hibernate.annotations"
] | javax.persistence; org.hibernate.annotations; | 2,633,761 |
public void handlePut(String[] args) {
if(args.length == 2) {
String fileToUpload = args[1];
try {
long bytesTransferred = client.put(fileToUpload);
System.out.println("Uploaded " + fileToUpload
+ " (" + bytesTransferred + " bytes)");
}
catch (IOException e) {
System.err.println(
"Unable to upload \"" + args[1] + "\"; " +
"unable to find file."
);
}
}
else {
System.out.println(HELP_PUT);
}
} | void function(String[] args) { if(args.length == 2) { String fileToUpload = args[1]; try { long bytesTransferred = client.put(fileToUpload); System.out.println(STR + fileToUpload + STR + bytesTransferred + STR); } catch (IOException e) { System.err.println( STRSTR\STR + STR ); } } else { System.out.println(HELP_PUT); } } | /**
* Handles the put function
* @param args arguments to pass to put
*/ | Handles the put function | handlePut | {
"repo_name": "nimbus154/ftp471",
"path": "ftp-client/src/main/java/cpsc471/ftp/client/control/Shell.java",
"license": "mit",
"size": 5849
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,796,151 |
StructuredQuery<R> nextPageQuery() {
Cursor cursorAfter = currentPage.getCursorAfter();
StructuredQuery<R> queryForMoreResults =
query.toBuilder()
.setStartCursor(cursorAfter)
.build();
return queryForMoreResults;
} | StructuredQuery<R> nextPageQuery() { Cursor cursorAfter = currentPage.getCursorAfter(); StructuredQuery<R> queryForMoreResults = query.toBuilder() .setStartCursor(cursorAfter) .build(); return queryForMoreResults; } | /**
* Creates a query to the next batch of entities.
*
* <p>The query is built utilizing the {@linkplain Cursor Datastore Cursor} from the current
* query results.
*/ | Creates a query to the next batch of entities. The query is built utilizing the Cursor Datastore Cursor from the current query results | nextPageQuery | {
"repo_name": "SpineEventEngine/gae-java",
"path": "datastore/src/main/java/io/spine/server/storage/datastore/DsQueryIterator.java",
"license": "apache-2.0",
"size": 4263
} | [
"com.google.cloud.datastore.Cursor",
"com.google.cloud.datastore.StructuredQuery"
] | import com.google.cloud.datastore.Cursor; import com.google.cloud.datastore.StructuredQuery; | import com.google.cloud.datastore.*; | [
"com.google.cloud"
] | com.google.cloud; | 2,744,321 |
void preInstantiateSingletons() throws BeansException;
| void preInstantiateSingletons() throws BeansException; | /**
* Ensure that all non-lazy-init singletons are instantiated, also considering
* {@link org.springframework.beans.factory.FactoryBean FactoryBeans}.
* Typically invoked at the end of factory setup, if desired.
* @throws BeansException if one of the singleton beans could not be created.
* Note: This may have left the factory with some beans already initialized!
* Call {@link #destroySingletons()} for full cleanup in this case.
* @see #destroySingletons()
*/ | Ensure that all non-lazy-init singletons are instantiated, also considering <code>org.springframework.beans.factory.FactoryBean FactoryBeans</code>. Typically invoked at the end of factory setup, if desired | preInstantiateSingletons | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/beans/factory/config/ConfigurableListableBeanFactory.java",
"license": "unlicense",
"size": 6431
} | [
"org.springframework.beans.BeansException"
] | import org.springframework.beans.BeansException; | import org.springframework.beans.*; | [
"org.springframework.beans"
] | org.springframework.beans; | 736,120 |
protected void addOutSequenceNamePropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_ProxyService_outSequenceName_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_ProxyService_outSequenceName_feature",
"_UI_ProxyService_type"),
EsbPackage.Literals.PROXY_SERVICE__OUT_SEQUENCE_NAME, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, "Out Sequence", null));
} | void function(Object object) { itemPropertyDescriptors .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.PROXY_SERVICE__OUT_SEQUENCE_NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, STR, null)); } | /**
* This adds a property descriptor for the Out Sequence Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/ | This adds a property descriptor for the Out Sequence Name feature. | addOutSequenceNamePropertyDescriptor | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/ProxyServiceItemProvider.java",
"license": "apache-2.0",
"size": 49025
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage; | import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*; | [
"org.eclipse.emf",
"org.wso2.developerstudio"
] | org.eclipse.emf; org.wso2.developerstudio; | 970,976 |
public void receiveScrollEvent(Api api, ScrollEvent event) {
Zooming.changeZoom(api, event);
} | void function(Api api, ScrollEvent event) { Zooming.changeZoom(api, event); } | /**
* Called when user interacts with the plot using a mouse wheel.
* @param api API interface
* @param event JavaFX mouse wheel event
*/ | Called when user interacts with the plot using a mouse wheel | receiveScrollEvent | {
"repo_name": "gronostajo/gnupolpot",
"path": "api/src/net/avensome/dev/gnupolpot/api/Tool.java",
"license": "gpl-2.0",
"size": 2152
} | [
"net.avensome.dev.gnupolpot.api.action.Zooming"
] | import net.avensome.dev.gnupolpot.api.action.Zooming; | import net.avensome.dev.gnupolpot.api.action.*; | [
"net.avensome.dev"
] | net.avensome.dev; | 359,669 |
private Path normalize(Path path) {
return repository.getFilesystem().resolve(path);
} | Path function(Path path) { return repository.getFilesystem().resolve(path); } | /**
* Always use Files created from absolute paths as they are returned from buck.py and must be
* created from consistent paths to be looked up correctly in maps.
* @param path A File to normalize.
* @return An equivalent file constructed from a normalized, absolute path to the given File.
*/ | Always use Files created from absolute paths as they are returned from buck.py and must be created from consistent paths to be looked up correctly in maps | normalize | {
"repo_name": "mnuessler/buck",
"path": "src/com/facebook/buck/parser/Parser.java",
"license": "apache-2.0",
"size": 52742
} | [
"java.nio.file.Path"
] | import java.nio.file.Path; | import java.nio.file.*; | [
"java.nio"
] | java.nio; | 2,481,462 |
private String generateFieldInfoInputs()
{
java.lang.reflect.Field[] fields = pojoClass.getDeclaredFields();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < fields.length; i++) {
java.lang.reflect.Field f = fields[i];
Class<?> c = ClassUtils.primitiveToWrapper(f.getType());
sb.append(f.getName() + FIELD_SEPARATOR + f.getName() + FIELD_SEPARATOR + c.getSimpleName().toUpperCase()
+ RECORD_SEPARATOR);
}
return sb.substring(0, sb.length() - 1);
} | String function() { java.lang.reflect.Field[] fields = pojoClass.getDeclaredFields(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < fields.length; i++) { java.lang.reflect.Field f = fields[i]; Class<?> c = ClassUtils.primitiveToWrapper(f.getType()); sb.append(f.getName() + FIELD_SEPARATOR + f.getName() + FIELD_SEPARATOR + c.getSimpleName().toUpperCase() + RECORD_SEPARATOR); } return sb.substring(0, sb.length() - 1); } | /**
* Use reflection to generate field info values if the user has not provided
* the inputs mapping.
*
* @return String representing the Parquet field name to POJO field name
* mapping
*/ | Use reflection to generate field info values if the user has not provided the inputs mapping | generateFieldInfoInputs | {
"repo_name": "ilganeli/incubator-apex-malhar",
"path": "contrib/src/main/java/com/datatorrent/contrib/parquet/ParquetFilePOJOReader.java",
"license": "apache-2.0",
"size": 9980
} | [
"org.apache.commons.lang3.ClassUtils"
] | import org.apache.commons.lang3.ClassUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,043,773 |
public static String getTextValue(Element valueEle) {
Assert.notNull(valueEle, "Element must not be null");
StringBuffer value = new StringBuffer();
NodeList nl = valueEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node item = nl.item(i);
if ((item instanceof CharacterData && !(item instanceof Comment)) || item instanceof EntityReference) {
value.append(item.getNodeValue());
}
}
return value.toString();
}
| static String function(Element valueEle) { Assert.notNull(valueEle, STR); StringBuffer value = new StringBuffer(); NodeList nl = valueEle.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node item = nl.item(i); if ((item instanceof CharacterData && !(item instanceof Comment)) item instanceof EntityReference) { value.append(item.getNodeValue()); } } return value.toString(); } | /**
* Extract the text value from the given DOM element, ignoring XML comments.
* <p>Appends all CharacterData nodes and EntityReference nodes
* into a single String value, excluding Comment nodes.
* @see CharacterData
* @see EntityReference
* @see Comment
*/ | Extract the text value from the given DOM element, ignoring XML comments. Appends all CharacterData nodes and EntityReference nodes into a single String value, excluding Comment nodes | getTextValue | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/util/xml/DomUtils.java",
"license": "unlicense",
"size": 6159
} | [
"org.springframework.util.Assert",
"org.w3c.dom.CharacterData",
"org.w3c.dom.Comment",
"org.w3c.dom.Element",
"org.w3c.dom.EntityReference",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import org.springframework.util.Assert; import org.w3c.dom.CharacterData; import org.w3c.dom.Comment; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import org.springframework.util.*; import org.w3c.dom.*; | [
"org.springframework.util",
"org.w3c.dom"
] | org.springframework.util; org.w3c.dom; | 678,076 |
@Test
public void testConstructorNull()
{
final ResourceProduct product = products.findByName("Hides");
final String askFilename = "someFile.png";
final RobotImage askImage = getAskImage();
final String bidFilename = "anotherFile.png";
final RobotImage bidImage = getBidImage();
try
{
new MarketDataImage(null, askFilename, askImage, bidFilename, bidImage);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("product is null"));
}
try
{
new MarketDataImage(product, null, askImage, bidFilename, bidImage);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("askFilename and askImage are inconsistent"));
}
try
{
new MarketDataImage(product, "", askImage, bidFilename, bidImage);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("askFilename and askImage are inconsistent"));
}
try
{
new MarketDataImage(product, askFilename, null, bidFilename, bidImage);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("askFilename and askImage are inconsistent"));
}
try
{
new MarketDataImage(product, askFilename, askImage, null, bidImage);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("bidFilename and bidImage are inconsistent"));
}
try
{
new MarketDataImage(product, askFilename, askImage, "", bidImage);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("bidFilename and bidImage are inconsistent"));
}
try
{
new MarketDataImage(product, askFilename, askImage, bidFilename, null);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("bidFilename and bidImage are inconsistent"));
}
} | void function() { final ResourceProduct product = products.findByName("Hides"); final String askFilename = STR; final RobotImage askImage = getAskImage(); final String bidFilename = STR; final RobotImage bidImage = getBidImage(); try { new MarketDataImage(null, askFilename, askImage, bidFilename, bidImage); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is(STR)); } try { new MarketDataImage(product, null, askImage, bidFilename, bidImage); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is(STR)); } try { new MarketDataImage(product, "", askImage, bidFilename, bidImage); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is(STR)); } try { new MarketDataImage(product, askFilename, null, bidFilename, bidImage); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is(STR)); } try { new MarketDataImage(product, askFilename, askImage, null, bidImage); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is("bidFilename and bidImage are inconsistentSTR", bidImage); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is("bidFilename and bidImage are inconsistent")); } try { new MarketDataImage(product, askFilename, askImage, bidFilename, null); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is("bidFilename and bidImage are inconsistent")); } } | /**
* Test the <code>MarketDataImage()</code> method.
*/ | Test the <code>MarketDataImage()</code> method | testConstructorNull | {
"repo_name": "jmthompson2015/vizzini",
"path": "game/illyriad/src/test/java/org/vizzini/illyriad/robot/market/MarketDataImageTest.java",
"license": "mit",
"size": 4801
} | [
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.vizzini.ai.robot.RobotImage",
"org.vizzini.illyriad.ResourceProduct"
] | import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.vizzini.ai.robot.RobotImage; import org.vizzini.illyriad.ResourceProduct; | import org.hamcrest.*; import org.junit.*; import org.vizzini.ai.robot.*; import org.vizzini.illyriad.*; | [
"org.hamcrest",
"org.junit",
"org.vizzini.ai",
"org.vizzini.illyriad"
] | org.hamcrest; org.junit; org.vizzini.ai; org.vizzini.illyriad; | 1,355,174 |
public static void paintCenteredString(Graphics2D g, String str, Font font,
int centerX, int centerY) {
g.setFont(font);
FontMetrics fm = g.getFontMetrics();
Rectangle2D r = fm.getStringBounds(str, g);
float x = (float) (centerX - r.getWidth() / 2);
float y = (float) (centerY - r.getHeight() / 2 - r.getY());
g.drawString(str, x, y);
} | static void function(Graphics2D g, String str, Font font, int centerX, int centerY) { g.setFont(font); FontMetrics fm = g.getFontMetrics(); Rectangle2D r = fm.getStringBounds(str, g); float x = (float) (centerX - r.getWidth() / 2); float y = (float) (centerY - r.getHeight() / 2 - r.getY()); g.drawString(str, x, y); } | /**
* Paint a String centered at a given (x,y) coordinate.
*/ | Paint a String centered at a given (x,y) coordinate | paintCenteredString | {
"repo_name": "mickleness/pumpernickel",
"path": "src/main/java/com/pump/plaf/PlafPaintUtils.java",
"license": "mit",
"size": 11315
} | [
"java.awt.Font",
"java.awt.FontMetrics",
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D"
] | import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 587,526 |
ZipOutputStream zos = new ZipOutputStream(outputStream);
File agentFile = new File(System.getProperty(UnaCloudConstants.ROOT_PATH), "agentSources" + File.separator + UnaCloudConstants.AGENT_JAR);
System.out.println("\t " + agentFile);
copyFile( zos, UnaCloudConstants.AGENT_JAR, agentFile, true);
zos.putNextEntry(new ZipEntry(UnaCloudConstants.GLOBAL_FILE));
PrintWriter pw = new PrintWriter(zos);
List<ServerVariableEntity> variables = null;
try (Connection con = FileManager.getInstance().getDBConnection();) {
variables = ServerVariableManager.getAllVariablesForAgent(con);
} catch (Exception e) {
e.printStackTrace();
}
for (ServerVariableEntity sv : variables)
pw.println(sv.getName() + "=" + sv.getValue());
pw.flush();
zos.closeEntry();
zos.close();
}
| ZipOutputStream zos = new ZipOutputStream(outputStream); File agentFile = new File(System.getProperty(UnaCloudConstants.ROOT_PATH), STR + File.separator + UnaCloudConstants.AGENT_JAR); System.out.println(STR + agentFile); copyFile( zos, UnaCloudConstants.AGENT_JAR, agentFile, true); zos.putNextEntry(new ZipEntry(UnaCloudConstants.GLOBAL_FILE)); PrintWriter pw = new PrintWriter(zos); List<ServerVariableEntity> variables = null; try (Connection con = FileManager.getInstance().getDBConnection();) { variables = ServerVariableManager.getAllVariablesForAgent(con); } catch (Exception e) { e.printStackTrace(); } for (ServerVariableEntity sv : variables) pw.println(sv.getName() + "=" + sv.getValue()); pw.flush(); zos.closeEntry(); zos.close(); } | /**
* Prepares the agent files and sends them in a zip.
* @param outputStream file output stream for download
* @param appDir directory where the zip will be stored
* @throws IOException
* @throws SQLException
*/ | Prepares the agent files and sends them in a zip | copyAgentOnStream | {
"repo_name": "UnaCloud/UnaCloud2",
"path": "UnaCloudFileManager/src/java/uniandes/unacloud/file/files/AgentFileManager.java",
"license": "gpl-2.0",
"size": 2370
} | [
"java.io.File",
"java.io.PrintWriter",
"java.sql.Connection",
"java.util.List",
"java.util.zip.ZipEntry",
"java.util.zip.ZipOutputStream"
] | import java.io.File; import java.io.PrintWriter; import java.sql.Connection; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; | import java.io.*; import java.sql.*; import java.util.*; import java.util.zip.*; | [
"java.io",
"java.sql",
"java.util"
] | java.io; java.sql; java.util; | 2,518,562 |
public static void setGlobalURLHandlerFactory(URLStreamHandlerFactory urlHandlerFactory)
{
globalURLHandlerFactory = urlHandlerFactory;
}
| static void function(URLStreamHandlerFactory urlHandlerFactory) { globalURLHandlerFactory = urlHandlerFactory; } | /**
* Sets a global URL stream handler facotry to be used for resource resolution.
*
* @param urlHandlerFactory the URL stream handler factory
* @see #getURLHandlerFactory(URLStreamHandlerFactory)
* @deprecated To be removed.
*/ | Sets a global URL stream handler facotry to be used for resource resolution | setGlobalURLHandlerFactory | {
"repo_name": "sikachu/jasperreports",
"path": "src/net/sf/jasperreports/engine/util/JRResourcesUtil.java",
"license": "lgpl-3.0",
"size": 16663
} | [
"java.net.URLStreamHandlerFactory"
] | import java.net.URLStreamHandlerFactory; | import java.net.*; | [
"java.net"
] | java.net; | 1,937,785 |
@SuppressWarnings("unchecked")
public static Collection<String> parseMechanisms(Element mechanismsEl)
throws Exception {
List<Element> mechanisms = mechanismsEl.elements("mechanism");
List<String> mechanismsStr = new LinkedList<String>();
for (Element mechanismEl : mechanisms) {
mechanismsStr.add(mechanismEl.getText());
}
return mechanismsStr;
} | @SuppressWarnings(STR) static Collection<String> function(Element mechanismsEl) throws Exception { List<Element> mechanisms = mechanismsEl.elements(STR); List<String> mechanismsStr = new LinkedList<String>(); for (Element mechanismEl : mechanisms) { mechanismsStr.add(mechanismEl.getText()); } return mechanismsStr; } | /**
* Parse the available SASL mechanisms reported from the server.
*
* @param mechanismsEl
* the XML parser, positioned at the start of the mechanisms
* stanza.
* @return a collection of Stings with the mechanisms included in the
* mechanisms stanza.
* @throws Exception
* if an exception occurs while parsing the stanza.
*/ | Parse the available SASL mechanisms reported from the server | parseMechanisms | {
"repo_name": "abmargb/jamppa",
"path": "src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java",
"license": "apache-2.0",
"size": 8487
} | [
"java.util.Collection",
"java.util.LinkedList",
"java.util.List",
"org.dom4j.Element"
] | import java.util.Collection; import java.util.LinkedList; import java.util.List; import org.dom4j.Element; | import java.util.*; import org.dom4j.*; | [
"java.util",
"org.dom4j"
] | java.util; org.dom4j; | 592,909 |
public void testTailSetContents() {
ConcurrentSkipListSet set = set5();
SortedSet sm = set.tailSet(two);
assertFalse(sm.contains(one));
assertTrue(sm.contains(two));
assertTrue(sm.contains(three));
assertTrue(sm.contains(four));
assertTrue(sm.contains(five));
Iterator i = sm.iterator();
Object k;
k = (Integer)(i.next());
assertEquals(two, k);
k = (Integer)(i.next());
assertEquals(three, k);
k = (Integer)(i.next());
assertEquals(four, k);
k = (Integer)(i.next());
assertEquals(five, k);
assertFalse(i.hasNext());
SortedSet ssm = sm.tailSet(four);
assertEquals(four, ssm.first());
assertEquals(five, ssm.last());
assertTrue(ssm.remove(four));
assertEquals(1, ssm.size());
assertEquals(3, sm.size());
assertEquals(4, set.size());
}
Random rnd = new Random(666); | void function() { ConcurrentSkipListSet set = set5(); SortedSet sm = set.tailSet(two); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertTrue(sm.contains(four)); assertTrue(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); SortedSet ssm = sm.tailSet(four); assertEquals(four, ssm.first()); assertEquals(five, ssm.last()); assertTrue(ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, set.size()); } Random rnd = new Random(666); | /**
* tailSet returns set with keys in requested range
*/ | tailSet returns set with keys in requested range | testTailSetContents | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java",
"license": "gpl-2.0",
"size": 31925
} | [
"java.util.Iterator",
"java.util.Random",
"java.util.SortedSet",
"java.util.concurrent.ConcurrentSkipListSet"
] | import java.util.Iterator; import java.util.Random; import java.util.SortedSet; import java.util.concurrent.ConcurrentSkipListSet; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,348,912 |
@Override
protected MCRCondition<Void> parseSimpleCondition(String s) throws MCRParseException {
Matcher m = pattern.matcher(s);
if (!m.find()) {
return super.parseSimpleCondition(s);
}
String field = m.group(1);
String operator = m.group(2);
String value = m.group(3);
if (value.startsWith("\"") && value.endsWith("\"")) {
value = value.substring(1, value.length() - 1);
}
return buildConditions(field, operator, value);
} | MCRCondition<Void> function(String s) throws MCRParseException { Matcher m = pattern.matcher(s); if (!m.find()) { return super.parseSimpleCondition(s); } String field = m.group(1); String operator = m.group(2); String value = m.group(3); if (value.startsWith("\"STR\"")) { value = value.substring(1, value.length() - 1); } return buildConditions(field, operator, value); } | /**
* Parses a String containing a simple query condition, for example: (title
* contains "Java") and (creatorID = "122132131")
*
* @param s
* the condition as a String
* @return the parsed MCRQueryCondition object
*/ | Parses a String containing a simple query condition, for example: (title contains "Java") and (creatorID = "122132131") | parseSimpleCondition | {
"repo_name": "MyCoRe-Org/mycore",
"path": "mycore-base/src/main/java/org/mycore/services/fieldquery/MCRQueryParser.java",
"license": "gpl-3.0",
"size": 11942
} | [
"java.util.regex.Matcher",
"org.mycore.parsers.bool.MCRCondition",
"org.mycore.parsers.bool.MCRParseException"
] | import java.util.regex.Matcher; import org.mycore.parsers.bool.MCRCondition; import org.mycore.parsers.bool.MCRParseException; | import java.util.regex.*; import org.mycore.parsers.bool.*; | [
"java.util",
"org.mycore.parsers"
] | java.util; org.mycore.parsers; | 647,024 |
public Name getPrefix(int posn) {
try {
return new LdapName(null, rdns, 0, posn);
} catch (IllegalArgumentException e) {
throw new IndexOutOfBoundsException(
"Posn: " + posn + ", Size: "+ rdns.size());
}
} | Name function(int posn) { try { return new LdapName(null, rdns, 0, posn); } catch (IllegalArgumentException e) { throw new IndexOutOfBoundsException( STR + posn + STR+ rdns.size()); } } | /**
* Creates a name whose components consist of a prefix of the
* components of this LDAP name.
* Subsequent changes to this name will not affect the name
* that is returned and vice versa.
* @param posn The 0-based index of the component at which to stop.
* Must be in the range [0,size()].
* @return An instance of <tt>LdapName</tt> consisting of the
* components at indexes in the range [0,posn).
* If posn is zero, an empty LDAP name is returned.
* @exception IndexOutOfBoundsException
* If posn is outside the specified range.
*/ | Creates a name whose components consist of a prefix of the components of this LDAP name. Subsequent changes to this name will not affect the name that is returned and vice versa | getPrefix | {
"repo_name": "andreagenso/java2scala",
"path": "test/J2s/java/openjdk-6-src-b27/jdk/src/share/classes/javax/naming/ldap/LdapName.java",
"license": "apache-2.0",
"size": 29197
} | [
"javax.naming.Name"
] | import javax.naming.Name; | import javax.naming.*; | [
"javax.naming"
] | javax.naming; | 460,160 |
@Test public void testPublicIpAddresses() throws Exception {
new TestPublicIpAddress().runTest(azure.publicIpAddresses(), azure.resourceGroups());
} | @Test void function() throws Exception { new TestPublicIpAddress().runTest(azure.publicIpAddresses(), azure.resourceGroups()); } | /**
* Tests the public IP address implementation
* @throws Exception
*/ | Tests the public IP address implementation | testPublicIpAddresses | {
"repo_name": "jalves94/azure-sdk-for-java",
"path": "azure/src/test/java/com/microsoft/azure/AzureTests.java",
"license": "mit",
"size": 11895
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,337,579 |
@Deprecated
public static <B extends Builder<B>> MemoryMappedFileAppender createAppender(
// @formatter:off
final String fileName, //
final String append, //
final String name, //
final String immediateFlush, //
final String regionLengthStr, //
final String ignore, //
final Layout<? extends Serializable> layout, //
final Filter filter, //
final String advertise, //
final String advertiseURI, //
final Configuration config) {
// @formatter:on
final boolean isAppend = Booleans.parseBoolean(append, true);
final boolean isImmediateFlush = Booleans.parseBoolean(immediateFlush, false);
final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
final boolean isAdvertise = Boolean.parseBoolean(advertise);
final int regionLength = Integers.parseInt(regionLengthStr, MemoryMappedFileManager.DEFAULT_REGION_LENGTH);
// @formatter:off
return MemoryMappedFileAppender.<B>newBuilder()
.setAdvertise(isAdvertise)
.setAdvertiseURI(advertiseURI)
.setAppend(isAppend)
.setConfiguration(config)
.setFileName(fileName)
.withFilter(filter)
.withIgnoreExceptions(ignoreExceptions)
.withImmediateFlush(isImmediateFlush)
.withLayout(layout)
.withName(name)
.setRegionLength(regionLength)
.build();
// @formatter:on
} | static <B extends Builder<B>> MemoryMappedFileAppender function( final String fileName, final String name, final String regionLengthStr, final Layout<? extends Serializable> layout, final String advertise, final Configuration config) { final boolean isAppend = Booleans.parseBoolean(append, true); final boolean isImmediateFlush = Booleans.parseBoolean(immediateFlush, false); final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true); final boolean isAdvertise = Boolean.parseBoolean(advertise); final int regionLength = Integers.parseInt(regionLengthStr, MemoryMappedFileManager.DEFAULT_REGION_LENGTH); return MemoryMappedFileAppender.<B>newBuilder() .setAdvertise(isAdvertise) .setAdvertiseURI(advertiseURI) .setAppend(isAppend) .setConfiguration(config) .setFileName(fileName) .withFilter(filter) .withIgnoreExceptions(ignoreExceptions) .withImmediateFlush(isImmediateFlush) .withLayout(layout) .withName(name) .setRegionLength(regionLength) .build(); } | /**
* Create a Memory Mapped File Appender.
*
* @param fileName The name and path of the file.
* @param append "True" if the file should be appended to, "false" if it should be overwritten. The default is
* "true".
* @param name The name of the Appender.
* @param immediateFlush "true" if the contents should be flushed on every write, "false" otherwise. The default is
* "false".
* @param regionLengthStr The buffer size, defaults to {@value MemoryMappedFileManager#DEFAULT_REGION_LENGTH}.
* @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise they
* are propagated to the caller.
* @param layout The layout to use to format the event. If no layout is provided the default PatternLayout will be
* used.
* @param filter The filter, if any, to use.
* @param advertise "true" if the appender configuration should be advertised, "false" otherwise.
* @param advertiseURI The advertised URI which can be used to retrieve the file contents.
* @param config The Configuration.
* @return The FileAppender.
* @deprecated Use {@link #newBuilder()}.
*/ | Create a Memory Mapped File Appender | createAppender | {
"repo_name": "codescale/logging-log4j2",
"path": "log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java",
"license": "apache-2.0",
"size": 11112
} | [
"java.io.Serializable",
"org.apache.logging.log4j.core.Layout",
"org.apache.logging.log4j.core.config.Configuration",
"org.apache.logging.log4j.core.util.Booleans",
"org.apache.logging.log4j.core.util.Integers"
] | import java.io.Serializable; import org.apache.logging.log4j.core.Layout; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.util.Booleans; import org.apache.logging.log4j.core.util.Integers; | import java.io.*; import org.apache.logging.log4j.core.*; import org.apache.logging.log4j.core.config.*; import org.apache.logging.log4j.core.util.*; | [
"java.io",
"org.apache.logging"
] | java.io; org.apache.logging; | 125,394 |
public String begin( CharSequence message )
{
String id = newId();
fireEvent( Event.Type.BEGIN, id, message, null, null );
return id;
} | String function( CharSequence message ) { String id = newId(); fireEvent( Event.Type.BEGIN, id, message, null, null ); return id; } | /**
* Sends a {@link Event.Type#BEGIN} event with a new, unique ongoing event
* ID and returns it.
*
* @param message
* The message or null
* @return The ongoing event ID
*/ | Sends a <code>Event.Type#BEGIN</code> event with a new, unique ongoing event ID and returns it | begin | {
"repo_name": "tliron/creel",
"path": "components/creel/source/com/threecrickets/creel/event/Notifier.java",
"license": "lgpl-3.0",
"size": 6275
} | [
"com.threecrickets.creel.event.Event"
] | import com.threecrickets.creel.event.Event; | import com.threecrickets.creel.event.*; | [
"com.threecrickets.creel"
] | com.threecrickets.creel; | 2,156,919 |
@Generated
@Selector("addBoundaryTimeObserverForTimes:queue:usingBlock:")
@MappedReturn(ObjCObjectMapper.class)
public native Object addBoundaryTimeObserverForTimesQueueUsingBlock(NSArray<? extends NSValue> times,
NSObject queue,
@ObjCBlock(name = "call_addBoundaryTimeObserverForTimesQueueUsingBlock") Block_addBoundaryTimeObserverForTimesQueueUsingBlock block); | @Selector(STR) @MappedReturn(ObjCObjectMapper.class) native Object function(NSArray<? extends NSValue> times, NSObject queue, @ObjCBlock(name = STR) Block_addBoundaryTimeObserverForTimesQueueUsingBlock block); | /**
* addBoundaryTimeObserverForTimes:queue:usingBlock:
* <p>
* Requests invocation of a block when specified times are traversed during normal playback.
* <p>
* Each call to -addPeriodicTimeObserverForInterval:queue:usingBlock: should be paired with a corresponding call to -removeTimeObserver:.
* Releasing the observer object without a call to -removeTimeObserver: will result in undefined behavior.
*
* @return An object conforming to the NSObject protocol. You must retain this returned value as long as you want the time observer to be invoked by the player.
* Pass this object to -removeTimeObserver: to cancel time observation.
* @param times The times for which the observer requests notification, supplied as an array of NSValues carrying CMTimes.
* @param queue The serial queue onto which block should be enqueued. If you pass NULL, the main queue (obtained using dispatch_get_main_queue()) will be used. Passing a
* concurrent queue to this method will result in undefined behavior.
* @param block The block to be invoked when any of the specified times is crossed during normal playback.
*/ | addBoundaryTimeObserverForTimes:queue:usingBlock: Requests invocation of a block when specified times are traversed during normal playback. Each call to -addPeriodicTimeObserverForInterval:queue:usingBlock: should be paired with a corresponding call to -removeTimeObserver:. Releasing the observer object without a call to -removeTimeObserver: will result in undefined behavior | addBoundaryTimeObserverForTimesQueueUsingBlock | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/avfoundation/AVPlayer.java",
"license": "apache-2.0",
"size": 61892
} | [
"org.moe.natj.general.ann.MappedReturn",
"org.moe.natj.objc.ann.ObjCBlock",
"org.moe.natj.objc.ann.Selector",
"org.moe.natj.objc.map.ObjCObjectMapper"
] | import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.ann.ObjCBlock; import org.moe.natj.objc.ann.Selector; import org.moe.natj.objc.map.ObjCObjectMapper; | import org.moe.natj.general.ann.*; import org.moe.natj.objc.ann.*; import org.moe.natj.objc.map.*; | [
"org.moe.natj"
] | org.moe.natj; | 2,354,928 |
private void send(OutputStream outputStream) {
String mime = mimeType;
SimpleDateFormat gmtFrmt = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT"));
try {
if (status == null) {
throw new Error("sendResponse(): Status can't be null.");
}
PrintWriter pw = new PrintWriter(outputStream);
pw.print("HTTP/1.1 " + status.getDescription() + " \r\n");
if (mime != null) {
pw.print("Content-Type: " + mime + "\r\n");
}
if (header == null || header.get("Date") == null) {
pw.print("Date: " + gmtFrmt.format(new Date()) + "\r\n");
}
if (header != null) {
for (String key : header.keySet()) {
String value = header.get(key);
pw.print(key + ": " + value + "\r\n");
}
}
pw.print("Connection: keep-alive\r\n");
if (requestMethod != Method.HEAD && chunkedTransfer) {
sendAsChunked(outputStream, pw);
} else {
sendAsFixedLength(outputStream, pw);
}
outputStream.flush();
safeClose(data);
} catch (IOException ioe) {
// Couldn't write? No can do.
}
} | void function(OutputStream outputStream) { String mime = mimeType; SimpleDateFormat gmtFrmt = new SimpleDateFormat(STR, Locale.US); gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT")); try { if (status == null) { throw new Error(STR); } PrintWriter pw = new PrintWriter(outputStream); pw.print(STR + status.getDescription() + STR); if (mime != null) { pw.print(STR + mime + "\r\n"); } if (header == null header.get("Date") == null) { pw.print(STR + gmtFrmt.format(new Date()) + "\r\n"); } if (header != null) { for (String key : header.keySet()) { String value = header.get(key); pw.print(key + STR + value + "\r\n"); } } pw.print(STR); if (requestMethod != Method.HEAD && chunkedTransfer) { sendAsChunked(outputStream, pw); } else { sendAsFixedLength(outputStream, pw); } outputStream.flush(); safeClose(data); } catch (IOException ioe) { } } | /**
* Sends given response to the socket.
*/ | Sends given response to the socket | send | {
"repo_name": "crazylinuxsir/nanohttpdsim",
"path": "app/src/main/java/com/sina/weibo/utils/weibohttpd/NanoHTTPD.java",
"license": "apache-2.0",
"size": 34708
} | [
"java.io.IOException",
"java.io.OutputStream",
"java.io.PrintWriter",
"java.text.SimpleDateFormat",
"java.util.Date",
"java.util.Locale",
"java.util.TimeZone"
] | import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; | import java.io.*; import java.text.*; import java.util.*; | [
"java.io",
"java.text",
"java.util"
] | java.io; java.text; java.util; | 2,446,591 |
T page = instantiatePage(driver, pageClassToProxy);
final WebDriver driverRef = driver;
PageFactory.initElements(
new ElementDecorator(
new CustomElementLocatorFactory(driverRef)
), page
);
return page;
}
/**
* See {@link org.openqa.selenium.support.PageFactory#initElements(org.openqa.selenium.support.pagefactory.FieldDecorator, Object)}
| T page = instantiatePage(driver, pageClassToProxy); final WebDriver driverRef = driver; PageFactory.initElements( new ElementDecorator( new CustomElementLocatorFactory(driverRef) ), page ); return page; } /** * See {@link org.openqa.selenium.support.PageFactory#initElements(org.openqa.selenium.support.pagefactory.FieldDecorator, Object)} | /**
* See {@link org.openqa.selenium.support.PageFactory#initElements(org.openqa.selenium.WebDriver driver, Class)}
*/ | See <code>org.openqa.selenium.support.PageFactory#initElements(org.openqa.selenium.WebDriver driver, Class)</code> | initElements | {
"repo_name": "waitsavery/Selenium-Toyota-POC",
"path": "src/main/java/com/orasi/core/interfaces/impl/internal/ElementFactory.java",
"license": "apache-2.0",
"size": 2894
} | [
"org.openqa.selenium.WebDriver",
"org.openqa.selenium.support.PageFactory",
"org.openqa.selenium.support.pagefactory.FieldDecorator"
] | import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.pagefactory.FieldDecorator; | import org.openqa.selenium.*; import org.openqa.selenium.support.*; import org.openqa.selenium.support.pagefactory.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 1,927,935 |
public static <K> Integer getInteger(final Map<? super K, ?> map, final K key, final Integer defaultValue) {
Integer answer = getInteger(map, key);
if (answer == null) {
answer = defaultValue;
}
return answer;
} | static <K> Integer function(final Map<? super K, ?> map, final K key, final Integer defaultValue) { Integer answer = getInteger(map, key); if (answer == null) { answer = defaultValue; } return answer; } | /**
* Looks up the given key in the given map, converting the result into
* an integer, using the default value if the the conversion fails.
*
* @param <K> the key type
* @param map the map whose value to look up
* @param key the key of the value to look up in that map
* @param defaultValue what to return if the value is null or if the
* conversion fails
* @return the value in the map as a number, or defaultValue if the
* original value is null, the map is null or the number conversion fails
*/ | Looks up the given key in the given map, converting the result into an integer, using the default value if the the conversion fails | getInteger | {
"repo_name": "gonmarques/commons-collections",
"path": "src/main/java/org/apache/commons/collections4/MapUtils.java",
"license": "apache-2.0",
"size": 72285
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 138,562 |
public void doHide_preview_assignment_student_view(RunData data)
{
SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid());
state.setAttribute(PREVIEW_ASSIGNMENT_STUDENT_VIEW_HIDE_FLAG, Boolean.valueOf(true));
} // doHide_preview_assignment_student_view | void function(RunData data) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); state.setAttribute(PREVIEW_ASSIGNMENT_STUDENT_VIEW_HIDE_FLAG, Boolean.valueOf(true)); } | /**
* Action is to hide the preview assignment student view
*/ | Action is to hide the preview assignment student view | doHide_preview_assignment_student_view | {
"repo_name": "harfalm/Sakai-10.1",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 605178
} | [
"org.sakaiproject.cheftool.JetspeedRunData",
"org.sakaiproject.cheftool.RunData",
"org.sakaiproject.event.api.SessionState"
] | import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.event.api.SessionState; | import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*; | [
"org.sakaiproject.cheftool",
"org.sakaiproject.event"
] | org.sakaiproject.cheftool; org.sakaiproject.event; | 1,498,555 |
private void applyPageCounters(Transaction tx, Page page, RouteContextList ctx, long size) throws Exception {
List<org.apache.activemq.artemis.core.server.Queue> durableQueues = ctx.getDurableQueues();
List<org.apache.activemq.artemis.core.server.Queue> nonDurableQueues = ctx.getNonDurableQueues();
for (org.apache.activemq.artemis.core.server.Queue q : durableQueues) {
if (tx == null) {
// non transactional writes need an intermediate place
// to avoid the counter getting out of sync
q.getPageSubscription().getCounter().pendingCounter(page, 1, size);
} else {
// null tx is treated through pending counters
q.getPageSubscription().getCounter().increment(tx, 1, size);
}
}
for (org.apache.activemq.artemis.core.server.Queue q : nonDurableQueues) {
q.getPageSubscription().getCounter().increment(tx, 1, size);
}
} | void function(Transaction tx, Page page, RouteContextList ctx, long size) throws Exception { List<org.apache.activemq.artemis.core.server.Queue> durableQueues = ctx.getDurableQueues(); List<org.apache.activemq.artemis.core.server.Queue> nonDurableQueues = ctx.getNonDurableQueues(); for (org.apache.activemq.artemis.core.server.Queue q : durableQueues) { if (tx == null) { q.getPageSubscription().getCounter().pendingCounter(page, 1, size); } else { q.getPageSubscription().getCounter().increment(tx, 1, size); } } for (org.apache.activemq.artemis.core.server.Queue q : nonDurableQueues) { q.getPageSubscription().getCounter().increment(tx, 1, size); } } | /**
* This is done to prevent non tx to get out of sync in case of failures
*
* @param tx
* @param page
* @param ctx
* @throws Exception
*/ | This is done to prevent non tx to get out of sync in case of failures | applyPageCounters | {
"repo_name": "gaohoward/activemq-artemis",
"path": "artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java",
"license": "apache-2.0",
"size": 37397
} | [
"java.util.List",
"java.util.Queue",
"org.apache.activemq.artemis.core.server.RouteContextList",
"org.apache.activemq.artemis.core.transaction.Transaction"
] | import java.util.List; import java.util.Queue; import org.apache.activemq.artemis.core.server.RouteContextList; import org.apache.activemq.artemis.core.transaction.Transaction; | import java.util.*; import org.apache.activemq.artemis.core.server.*; import org.apache.activemq.artemis.core.transaction.*; | [
"java.util",
"org.apache.activemq"
] | java.util; org.apache.activemq; | 1,888,871 |
public void removeAllDeltas(String tenant, DateTime uptoTime) {
deltaJournal.removeDeltaJournals(tenant, uptoTime.getMillis());
}
public static class DeltaRecord {
private Entity entity;
private Set<String> belongsToEdOrgs;
private Operation op;
private boolean spamDelete;
private String type;
public DeltaRecord(Entity entity, Set<String> belongsToEdOrgs, Operation op, boolean spamDelete, String type) {
this.entity = entity;
this.belongsToEdOrgs = belongsToEdOrgs;
this.op = op;
this.spamDelete = spamDelete;
this.type = type;
} | void function(String tenant, DateTime uptoTime) { deltaJournal.removeDeltaJournals(tenant, uptoTime.getMillis()); } public static class DeltaRecord { private Entity entity; private Set<String> belongsToEdOrgs; private Operation op; private boolean spamDelete; private String type; public DeltaRecord(Entity entity, Set<String> belongsToEdOrgs, Operation op, boolean spamDelete, String type) { this.entity = entity; this.belongsToEdOrgs = belongsToEdOrgs; this.op = op; this.spamDelete = spamDelete; this.type = type; } | /**
* Remove all deltas that is updated before the start of this run, those entities have no values
* now since we created delta extract for them
*
* @param tenant
* @param uptoTime
*/ | Remove all deltas that is updated before the start of this run, those entities have no values now since we created delta extract for them | removeAllDeltas | {
"repo_name": "inbloom/secure-data-service",
"path": "sli/bulk-extract/src/main/java/org/slc/sli/bulk/extract/delta/DeltaEntityIterator.java",
"license": "apache-2.0",
"size": 21743
} | [
"java.util.Set",
"org.joda.time.DateTime",
"org.slc.sli.bulk.extract.delta.DeltaEntityIterator",
"org.slc.sli.domain.Entity"
] | import java.util.Set; import org.joda.time.DateTime; import org.slc.sli.bulk.extract.delta.DeltaEntityIterator; import org.slc.sli.domain.Entity; | import java.util.*; import org.joda.time.*; import org.slc.sli.bulk.extract.delta.*; import org.slc.sli.domain.*; | [
"java.util",
"org.joda.time",
"org.slc.sli"
] | java.util; org.joda.time; org.slc.sli; | 951,877 |
private String[] getAlternativeNames(String name) {
String altNames[] = null;
DeprecatedKeyInfo keyInfo = null;
DeprecationContext cur = deprecationContext.get();
String depKey = cur.getReverseDeprecatedKeyMap().get(name);
if(depKey != null) {
keyInfo = cur.getDeprecatedKeyMap().get(depKey);
if(keyInfo.newKeys.length > 0) {
if(getProps().containsKey(depKey)) {
//if deprecated key is previously set explicitly
List<String> list = new ArrayList<String>();
list.addAll(Arrays.asList(keyInfo.newKeys));
list.add(depKey);
altNames = list.toArray(new String[list.size()]);
}
else {
altNames = keyInfo.newKeys;
}
}
}
return altNames;
} | String[] function(String name) { String altNames[] = null; DeprecatedKeyInfo keyInfo = null; DeprecationContext cur = deprecationContext.get(); String depKey = cur.getReverseDeprecatedKeyMap().get(name); if(depKey != null) { keyInfo = cur.getDeprecatedKeyMap().get(depKey); if(keyInfo.newKeys.length > 0) { if(getProps().containsKey(depKey)) { List<String> list = new ArrayList<String>(); list.addAll(Arrays.asList(keyInfo.newKeys)); list.add(depKey); altNames = list.toArray(new String[list.size()]); } else { altNames = keyInfo.newKeys; } } } return altNames; } | /**
* Returns alternative names (non-deprecated keys or previously-set deprecated keys)
* for a given non-deprecated key.
* If the given key is deprecated, return null.
*
* @param name property name.
* @return alternative names.
*/ | Returns alternative names (non-deprecated keys or previously-set deprecated keys) for a given non-deprecated key. If the given key is deprecated, return null | getAlternativeNames | {
"repo_name": "yew1eb/flink",
"path": "flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java",
"license": "apache-2.0",
"size": 112692
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 216,024 |
@Extension
public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {
public FormValidation doCheckJqlSearch(@QueryParameter String value) throws IOException, ServletException {
if (value.length() == 0) {
return FormValidation.error(Messages.JiraIssueUpdateBuilder_NoJqlSearch());
}
return FormValidation.ok();
} | static final class DescriptorImpl extends BuildStepDescriptor<Builder> { public FormValidation function(@QueryParameter String value) throws IOException, ServletException { if (value.length() == 0) { return FormValidation.error(Messages.JiraIssueUpdateBuilder_NoJqlSearch()); } return FormValidation.ok(); } | /**
* Performs on-the-fly validation of the form field 'Jql'.
*
* @param value This parameter receives the value that the user has typed.
* @return Indicates the outcome of the validation. This is sent to the browser.
*/ | Performs on-the-fly validation of the form field 'Jql' | doCheckJqlSearch | {
"repo_name": "escoem/jira-plugin",
"path": "src/main/java/hudson/plugins/jira/JiraIssueUpdateBuilder.java",
"license": "mit",
"size": 5526
} | [
"hudson.tasks.BuildStepDescriptor",
"hudson.tasks.Builder",
"hudson.util.FormValidation",
"java.io.IOException",
"javax.servlet.ServletException",
"org.kohsuke.stapler.QueryParameter"
] | import hudson.tasks.BuildStepDescriptor; import hudson.tasks.Builder; import hudson.util.FormValidation; import java.io.IOException; import javax.servlet.ServletException; import org.kohsuke.stapler.QueryParameter; | import hudson.tasks.*; import hudson.util.*; import java.io.*; import javax.servlet.*; import org.kohsuke.stapler.*; | [
"hudson.tasks",
"hudson.util",
"java.io",
"javax.servlet",
"org.kohsuke.stapler"
] | hudson.tasks; hudson.util; java.io; javax.servlet; org.kohsuke.stapler; | 685,856 |
public List<OCFile> getChildren() {
return mChildren;
}
/**
* Performs the synchronization.
*
* {@inheritDoc} | List<OCFile> function() { return mChildren; } /** * Performs the synchronization. * * {@inheritDoc} | /**
* Returns the list of files and folders contained in the synchronized folder,
* if called after synchronization is complete.
*
* @return List of files and folders contained in the synchronized folder.
*/ | Returns the list of files and folders contained in the synchronized folder, if called after synchronization is complete | getChildren | {
"repo_name": "jsargent7089/android",
"path": "src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java",
"license": "gpl-2.0",
"size": 27978
} | [
"com.owncloud.android.datamodel.OCFile",
"java.util.List"
] | import com.owncloud.android.datamodel.OCFile; import java.util.List; | import com.owncloud.android.datamodel.*; import java.util.*; | [
"com.owncloud.android",
"java.util"
] | com.owncloud.android; java.util; | 199,491 |
protected static ParseResults parseMimeType(String mimeType) {
String[] parts = split(mimeType, ";");
ParseResults results = new ParseResults();
results.params = new LinkedHashMap<String, String>();
for (int i = 1; i < parts.length; ++i) {
String p = parts[i];
String[] subParts = split(p, '=');
if (subParts.length == 2)
results.params.put(subParts[0].trim(), subParts[1].trim());
}
String fullType = parts[0].trim();
// Java URLConnection class sends an Accept header that includes a
// single "*" - Turn it into a legal wildcard.
if (fullType.equals("*"))
fullType = "*/*";
String[] types = split(fullType, "/");
results.type = types[0].trim();
results.subType = types[1].trim();
return results;
} | static ParseResults function(String mimeType) { String[] parts = split(mimeType, ";"); ParseResults results = new ParseResults(); results.params = new LinkedHashMap<String, String>(); for (int i = 1; i < parts.length; ++i) { String p = parts[i]; String[] subParts = split(p, '='); if (subParts.length == 2) results.params.put(subParts[0].trim(), subParts[1].trim()); } String fullType = parts[0].trim(); if (fullType.equals("*")) fullType = "*/*"; String[] types = split(fullType, "/"); results.type = types[0].trim(); results.subType = types[1].trim(); return results; } | /**
* Carves up a mime-type and returns a ParseResults object
*
* For example, the media range 'application/xhtml;q=0.5' would get parsed into:
*
* ('application', 'xhtml', {'q', '0.5'})
*/ | Carves up a mime-type and returns a ParseResults object For example, the media range 'application/xhtml;q=0.5' would get parsed into: ('application', 'xhtml', {'q', '0.5'}) | parseMimeType | {
"repo_name": "primeval-io/saga",
"path": "saga-core/src/main/java/io/primeval/saga/core/internal/http/shared/MimeParse.java",
"license": "apache-2.0",
"size": 8698
} | [
"java.util.LinkedHashMap"
] | import java.util.LinkedHashMap; | import java.util.*; | [
"java.util"
] | java.util; | 579,208 |
public void setMaximumCategoryLabelWidthRatio(float ratio) {
this.maximumCategoryLabelWidthRatio = ratio;
notifyListeners(new AxisChangeEvent(this));
}
| void function(float ratio) { this.maximumCategoryLabelWidthRatio = ratio; notifyListeners(new AxisChangeEvent(this)); } | /**
* Sets the maximum category label width ratio and sends an
* {@link AxisChangeEvent} to all registered listeners.
*
* @param ratio the ratio.
*
* @see #getMaximumCategoryLabelWidthRatio()
*/ | Sets the maximum category label width ratio and sends an <code>AxisChangeEvent</code> to all registered listeners | setMaximumCategoryLabelWidthRatio | {
"repo_name": "SOCR/HTML5_WebSite",
"path": "SOCR2.8/src/jfreechart/org/jfree/chart/axis/CategoryAxis.java",
"license": "lgpl-3.0",
"size": 51383
} | [
"org.jfree.chart.event.AxisChangeEvent"
] | import org.jfree.chart.event.AxisChangeEvent; | import org.jfree.chart.event.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 761,983 |
void setItem(MItem value); | void setItem(MItem value); | /**
* Sets the value of the '{@link at.ecrit.document.model.ecritdocument.InitiatableItem#getItem <em>Item</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Item</em>' reference.
* @see #getItem()
* @generated
*/ | Sets the value of the '<code>at.ecrit.document.model.ecritdocument.InitiatableItem#getItem Item</code>' reference. | setItem | {
"repo_name": "ecrit/ecrit",
"path": "at.ecrit.document.model/src-gen/at/ecrit/document/model/ecritdocument/InitiatableItem.java",
"license": "epl-1.0",
"size": 9668
} | [
"org.eclipse.e4.ui.model.application.ui.menu.MItem"
] | import org.eclipse.e4.ui.model.application.ui.menu.MItem; | import org.eclipse.e4.ui.model.application.ui.menu.*; | [
"org.eclipse.e4"
] | org.eclipse.e4; | 92,075 |
public static Shape convertPointsToShape(Point2D[] points) {
GeneralPath result = new GeneralPath();
result.moveTo((float)points[0].getX(), (float)points[0].getY());
for(int i = 1; i < points.length; i++) {
result.lineTo((float)points[i].getX(), (float)points[i].getY());
}
result.closePath();
return result;
}
/////////////////////////////////
// CLASS CONSTRUCTORS
/////////////////////////////////
private GeomUtil(){}; | static Shape function(Point2D[] points) { GeneralPath result = new GeneralPath(); result.moveTo((float)points[0].getX(), (float)points[0].getY()); for(int i = 1; i < points.length; i++) { result.lineTo((float)points[i].getX(), (float)points[i].getY()); } result.closePath(); return result; } private GeomUtil(){}; | /**
* Construct a shape out of a set of corner points.
*
* @param points a set of points at the corners of the shape
* @return the shape
*/ | Construct a shape out of a set of corner points | convertPointsToShape | {
"repo_name": "bowzheng/AIM4_delay",
"path": "src/main/java/aim4/util/GeomUtil.java",
"license": "gpl-3.0",
"size": 4692
} | [
"java.awt.Shape",
"java.awt.geom.GeneralPath",
"java.awt.geom.Point2D"
] | import java.awt.Shape; import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,038,811 |
public InBandBytestreamSession accept() throws NotConnectedException, InterruptedException {
XMPPConnection connection = this.manager.getConnection();
// create In-Band Bytestream session and store it
InBandBytestreamSession ibbSession = new InBandBytestreamSession(connection,
this.byteStreamRequest, this.byteStreamRequest.getFrom());
this.manager.getSessions().put(this.byteStreamRequest.getSessionID(), ibbSession);
// acknowledge request
IQ resultIQ = IQ.createResultIQ(this.byteStreamRequest);
connection.sendPacket(resultIQ);
return ibbSession;
} | InBandBytestreamSession function() throws NotConnectedException, InterruptedException { XMPPConnection connection = this.manager.getConnection(); InBandBytestreamSession ibbSession = new InBandBytestreamSession(connection, this.byteStreamRequest, this.byteStreamRequest.getFrom()); this.manager.getSessions().put(this.byteStreamRequest.getSessionID(), ibbSession); IQ resultIQ = IQ.createResultIQ(this.byteStreamRequest); connection.sendPacket(resultIQ); return ibbSession; } | /**
* Accepts the In-Band Bytestream open request and returns the session to
* send/receive data.
*
* @return the session to send/receive data
* @throws NotConnectedException
* @throws InterruptedException
*/ | Accepts the In-Band Bytestream open request and returns the session to send/receive data | accept | {
"repo_name": "magnetsystems/message-smack",
"path": "smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequest.java",
"license": "apache-2.0",
"size": 3350
} | [
"org.jivesoftware.smack.SmackException",
"org.jivesoftware.smack.XMPPConnection",
"org.jivesoftware.smack.packet.IQ"
] | import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.IQ; | import org.jivesoftware.smack.*; import org.jivesoftware.smack.packet.*; | [
"org.jivesoftware.smack"
] | org.jivesoftware.smack; | 1,547,705 |
public boolean isDeleted(Composite name, long timestamp)
{
int idx = searchInternal(name);
return idx >= 0 && markedAts[idx] >= timestamp;
} | boolean function(Composite name, long timestamp) { int idx = searchInternal(name); return idx >= 0 && markedAts[idx] >= timestamp; } | /**
* Returns whether the given name/timestamp pair is deleted by one of the tombstone
* of this RangeTombstoneList.
*/ | Returns whether the given name/timestamp pair is deleted by one of the tombstone of this RangeTombstoneList | isDeleted | {
"repo_name": "miguel0afd/cassandra-cqlMod",
"path": "src/java/org/apache/cassandra/db/RangeTombstoneList.java",
"license": "apache-2.0",
"size": 24307
} | [
"org.apache.cassandra.db.composites.Composite"
] | import org.apache.cassandra.db.composites.Composite; | import org.apache.cassandra.db.composites.*; | [
"org.apache.cassandra"
] | org.apache.cassandra; | 669,188 |
public MethodParameter getReturnValueType(Object returnValue) {
return new ReturnValueMethodParameter(returnValue);
} | MethodParameter function(Object returnValue) { return new ReturnValueMethodParameter(returnValue); } | /**
* Return the actual return value type.
*/ | Return the actual return value type | getReturnValueType | {
"repo_name": "shivpun/spring-framework",
"path": "spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java",
"license": "apache-2.0",
"size": 11034
} | [
"org.springframework.core.MethodParameter"
] | import org.springframework.core.MethodParameter; | import org.springframework.core.*; | [
"org.springframework.core"
] | org.springframework.core; | 2,150,418 |
public synchronized void loadOneForTenant(String tenant, File lib) {
Map<String, JarIdentification> tenantmap = writetenantlibmap.get(tenant);
if (tenantmap == null) {
// Adds the tenant to the plugins cache
tenantmap = new HashMap<String, JarIdentification>();
writetenantlibmap.put(tenant, tenantmap);
}
if (lib.exists() && lib.isFile()) {
JarIdentification j = ValidationUtils.analyzeJar(lib.getName());
tenantmap.put(j.getArtifactId(), j);
writeliblocationmap.put(j.getArtifactId(), lib.getAbsolutePath());
}
logger.info(String.format("Analyzed jar file %s", lib.getAbsolutePath()));
} | synchronized void function(String tenant, File lib) { Map<String, JarIdentification> tenantmap = writetenantlibmap.get(tenant); if (tenantmap == null) { tenantmap = new HashMap<String, JarIdentification>(); writetenantlibmap.put(tenant, tenantmap); } if (lib.exists() && lib.isFile()) { JarIdentification j = ValidationUtils.analyzeJar(lib.getName()); tenantmap.put(j.getArtifactId(), j); writeliblocationmap.put(j.getArtifactId(), lib.getAbsolutePath()); } logger.info(String.format(STR, lib.getAbsolutePath())); } | /**
* Loads one plugin for only one tenant into the cache, analyzing the file
* and putting the jar info into a map indexed by artifactId.
*/ | Loads one plugin for only one tenant into the cache, analyzing the file and putting the jar info into a map indexed by artifactId | loadOneForTenant | {
"repo_name": "deleidos/digitaledge-platform",
"path": "webapp-ingestapi/src/main/java/com/deleidos/rtws/webapp/ingestapi/cache/PluginsCache.java",
"license": "apache-2.0",
"size": 18118
} | [
"com.deleidos.rtws.webapp.ingestapi.validator.ValidationUtils",
"java.io.File",
"java.util.HashMap",
"java.util.Map",
"org.apache.maven.shared.jar.identification.JarIdentification"
] | import com.deleidos.rtws.webapp.ingestapi.validator.ValidationUtils; import java.io.File; import java.util.HashMap; import java.util.Map; import org.apache.maven.shared.jar.identification.JarIdentification; | import com.deleidos.rtws.webapp.ingestapi.validator.*; import java.io.*; import java.util.*; import org.apache.maven.shared.jar.identification.*; | [
"com.deleidos.rtws",
"java.io",
"java.util",
"org.apache.maven"
] | com.deleidos.rtws; java.io; java.util; org.apache.maven; | 1,823,794 |
public final Iterable<java.lang.String> queryKeysByCity(java.lang.String city) {
final Filter filter = createEqualsFilter(COLUMN_NAME_CITY, city);
return queryIterableKeys(0, -1, null, null, null, false, null, false, filter);
} | final Iterable<java.lang.String> function(java.lang.String city) { final Filter filter = createEqualsFilter(COLUMN_NAME_CITY, city); return queryIterableKeys(0, -1, null, null, null, false, null, false, filter); } | /**
* query-key-by method for attribute field city
* @param city the specified attribute
* @return an Iterable of keys to the DmContacts with the specified attribute
*/ | query-key-by method for attribute field city | queryKeysByCity | {
"repo_name": "goldengekko/Meetr-Backend",
"path": "src/main/java/com/goldengekko/meetr/dao/GeneratedDmContactDaoImpl.java",
"license": "gpl-3.0",
"size": 37469
} | [
"net.sf.mardao.core.Filter"
] | import net.sf.mardao.core.Filter; | import net.sf.mardao.core.*; | [
"net.sf.mardao"
] | net.sf.mardao; | 2,354,079 |
public void assertObject(final InternalFactHandle factHandle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
// this method was silently failing, so I am now throwing an exception to make
// sure no one calls it by mistake
throw new UnsupportedOperationException( "This method should NEVER EVER be called" );
} | void function(final InternalFactHandle factHandle, final PropagationContext context, final InternalWorkingMemory workingMemory) { throw new UnsupportedOperationException( STR ); } | /**
* This is the entry point into the network for all asserted Facts. Iterates a cache
* of matching <code>ObjectTypdeNode</code>s asserting the Fact. If the cache does not
* exist it first iterates and builds the cache.
*
* @param factHandle
* The FactHandle of the fact to assert
* @param context
* The <code>PropagationContext</code> of the <code>WorkingMemory</code> action
* @param workingMemory
* The working memory session.
*/ | This is the entry point into the network for all asserted Facts. Iterates a cache of matching <code>ObjectTypdeNode</code>s asserting the Fact. If the cache does not exist it first iterates and builds the cache | assertObject | {
"repo_name": "amckee23/drools",
"path": "drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java",
"license": "apache-2.0",
"size": 19769
} | [
"org.drools.core.common.InternalFactHandle",
"org.drools.core.common.InternalWorkingMemory",
"org.drools.core.spi.PropagationContext"
] | import org.drools.core.common.InternalFactHandle; import org.drools.core.common.InternalWorkingMemory; import org.drools.core.spi.PropagationContext; | import org.drools.core.common.*; import org.drools.core.spi.*; | [
"org.drools.core"
] | org.drools.core; | 2,488,811 |
String destType;
Destination dest = null;
JMSConsumer consumer;
if (args.length != 1) {
System.err.println("Program takes one argument: <dest_type>");
System.exit(1);
}
destType = args[0];
System.out.println("Destination type is " + destType);
if (!(destType.equals("queue") || destType.equals("topic"))) {
System.err.println("Argument must be \"queue\" or \"topic\"");
System.exit(1);
}
try {
if (destType.equals("queue")) {
dest = (Destination) queue;
} else {
dest = (Destination) topic;
}
} catch (JMSRuntimeException e) {
System.err.println("Error setting destination: " + e.toString());
System.exit(1);
}
try (JMSContext context = connectionFactory.createContext();) {
consumer = context.createConsumer(dest);
int count = 0;
while (true) {
Message m = consumer.receive(1000);
if (m != null) {
if (m instanceof TextMessage) {
// Comment out the following two lines to receive
// a large volume of messages
System.out.println(
"Reading message: " + m.getBody(String.class));
count += 1;
} else {
break;
}
}
}
System.out.println("Messages received: " + count);
} catch (JMSException e) {
System.err.println("Exception occurred: " + e.toString());
System.exit(1);
}
System.exit(0);
} | String destType; Destination dest = null; JMSConsumer consumer; if (args.length != 1) { System.err.println(STR); System.exit(1); } destType = args[0]; System.out.println(STR + destType); if (!(destType.equals("queue") destType.equals("topic"))) { System.err.println(STRqueue\STRtopic\STRqueueSTRError setting destination: STRReading message: STRMessages received: STRException occurred: " + e.toString()); System.exit(1); } System.exit(0); } | /**
* Main method.
*
* @param args the destination name and type used by the example
*/ | Main method | main | {
"repo_name": "paulnguyen/cmpe279",
"path": "modules/module10/jms/simple/synchconsumer/src/main/java/javaeetutorial/synchconsumer/SynchConsumer.java",
"license": "apache-2.0",
"size": 3463
} | [
"javax.jms.Destination",
"javax.jms.JMSConsumer"
] | import javax.jms.Destination; import javax.jms.JMSConsumer; | import javax.jms.*; | [
"javax.jms"
] | javax.jms; | 156,310 |
private void registerIdlingResource() {
Espresso.registerIdlingResources(
mNoteDetailActivityTestRule.getActivity().getCountingIdlingResource());
} | void function() { Espresso.registerIdlingResources( mNoteDetailActivityTestRule.getActivity().getCountingIdlingResource()); } | /**
* Convenience method to register an IdlingResources with Espresso. IdlingResource resource is
* a great way to tell Espresso when your app is in an idle state. This helps Espresso to
* synchronize your test actions, which makes tests significantly more reliable.
*/ | Convenience method to register an IdlingResources with Espresso. IdlingResource resource is a great way to tell Espresso when your app is in an idle state. This helps Espresso to synchronize your test actions, which makes tests significantly more reliable | registerIdlingResource | {
"repo_name": "cdsap/FinalCodeCodeLabTesting",
"path": "app/src/androidTestMock/java/com/example/android/testing/notes/notedetail/NoteDetailScreenTest.java",
"license": "apache-2.0",
"size": 5350
} | [
"android.support.test.espresso.Espresso"
] | import android.support.test.espresso.Espresso; | import android.support.test.espresso.*; | [
"android.support"
] | android.support; | 2,038,850 |
public int processBlock(
byte[] in,
int inOff,
byte[] out,
int outOff)
throws DataLengthException, IllegalStateException
{
if ((inOff + blockSize) > in.length)
{
throw new DataLengthException("input buffer too short");
}
if ((outOff + blockSize) > out.length)
{
throw new DataLengthException("output buffer too short");
}
cipher.processBlock(ofbV, 0, ofbOutV, 0);
//
// XOR the ofbV with the plaintext producing the cipher text (and
// the next input block).
//
for (int i = 0; i < blockSize; i++)
{
out[outOff + i] = (byte)(ofbOutV[i] ^ in[inOff + i]);
}
//
// change over the input block.
//
System.arraycopy(ofbV, blockSize, ofbV, 0, ofbV.length - blockSize);
System.arraycopy(ofbOutV, 0, ofbV, ofbV.length - blockSize, blockSize);
return blockSize;
} | int function( byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException { if ((inOff + blockSize) > in.length) { throw new DataLengthException(STR); } if ((outOff + blockSize) > out.length) { throw new DataLengthException(STR); } cipher.processBlock(ofbV, 0, ofbOutV, 0); { out[outOff + i] = (byte)(ofbOutV[i] ^ in[inOff + i]); } System.arraycopy(ofbOutV, 0, ofbV, ofbV.length - blockSize, blockSize); return blockSize; } | /**
* Process one block of input from the array in and write it to
* the out array.
*
* @param in the array containing the input data.
* @param inOff offset into the in array the data starts at.
* @param out the array the output data will be copied into.
* @param outOff the offset into the out array the output will start at.
* @exception DataLengthException if there isn't enough data in in, or
* space in out.
* @exception IllegalStateException if the cipher isn't initialised.
* @return the number of bytes processed and produced.
*/ | Process one block of input from the array in and write it to the out array | processBlock | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "external/bouncycastle/bcprov/src/main/java/org/bouncycastle/crypto/modes/OFBBlockCipher.java",
"license": "gpl-2.0",
"size": 5433
} | [
"org.bouncycastle.crypto.DataLengthException"
] | import org.bouncycastle.crypto.DataLengthException; | import org.bouncycastle.crypto.*; | [
"org.bouncycastle.crypto"
] | org.bouncycastle.crypto; | 1,406,309 |
boolean setLastThumbnailLocked(Bitmap thumbnail) {
final Configuration serviceConfig = mService.mConfiguration;
int taskWidth = 0;
int taskHeight = 0;
if (mBounds != null) {
// Non-fullscreen tasks
taskWidth = mBounds.width();
taskHeight = mBounds.height();
} else if (stack != null) {
// Fullscreen tasks
final Point displaySize = new Point();
stack.getDisplaySize(displaySize);
taskWidth = displaySize.x;
taskHeight = displaySize.y;
} else {
Slog.e(TAG, "setLastThumbnailLocked() called on Task without stack");
}
return setLastThumbnailLocked(thumbnail, taskWidth, taskHeight, serviceConfig.orientation);
} | boolean setLastThumbnailLocked(Bitmap thumbnail) { final Configuration serviceConfig = mService.mConfiguration; int taskWidth = 0; int taskHeight = 0; if (mBounds != null) { taskWidth = mBounds.width(); taskHeight = mBounds.height(); } else if (stack != null) { final Point displaySize = new Point(); stack.getDisplaySize(displaySize); taskWidth = displaySize.x; taskHeight = displaySize.y; } else { Slog.e(TAG, STR); } return setLastThumbnailLocked(thumbnail, taskWidth, taskHeight, serviceConfig.orientation); } | /**
* Sets the last thumbnail with the current task bounds and the system orientation.
* @return whether the thumbnail was set
*/ | Sets the last thumbnail with the current task bounds and the system orientation | setLastThumbnailLocked | {
"repo_name": "daiqiquan/framework-base",
"path": "services/core/java/com/android/server/am/TaskRecord.java",
"license": "apache-2.0",
"size": 82289
} | [
"android.content.res.Configuration",
"android.graphics.Bitmap",
"android.graphics.Point",
"android.util.Slog"
] | import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Point; import android.util.Slog; | import android.content.res.*; import android.graphics.*; import android.util.*; | [
"android.content",
"android.graphics",
"android.util"
] | android.content; android.graphics; android.util; | 1,870,551 |
public String getNodeDisplayName( Object object )
{
SlotHandle model = (SlotHandle) object;
if ( model.getElementHandle( ) instanceof ListHandle )
{
switch ( model.getSlotID( ) )
{
case ListHandle.HEADER_SLOT :
return HEADER_DISPALYNAME;
case ListHandle.FOOTER_SLOT :
return FOOTER_DISPALYNAME;
case ListHandle.DETAIL_SLOT :
return DETAIL_DISPALYNAME;
case ListHandle.GROUP_SLOT :
return GROUPS_DISPALYNAME;
}
}
else if ( model.getElementHandle( ) instanceof ListGroupHandle )
{
switch ( model.getSlotID( ) )
{
case ListGroupHandle.HEADER_SLOT :
return HEADER_DISPALYNAME;
case ListGroupHandle.FOOTER_SLOT :
return FOOTER_DISPALYNAME;
}
}
return super.getNodeDisplayName( model );
} | String function( Object object ) { SlotHandle model = (SlotHandle) object; if ( model.getElementHandle( ) instanceof ListHandle ) { switch ( model.getSlotID( ) ) { case ListHandle.HEADER_SLOT : return HEADER_DISPALYNAME; case ListHandle.FOOTER_SLOT : return FOOTER_DISPALYNAME; case ListHandle.DETAIL_SLOT : return DETAIL_DISPALYNAME; case ListHandle.GROUP_SLOT : return GROUPS_DISPALYNAME; } } else if ( model.getElementHandle( ) instanceof ListGroupHandle ) { switch ( model.getSlotID( ) ) { case ListGroupHandle.HEADER_SLOT : return HEADER_DISPALYNAME; case ListGroupHandle.FOOTER_SLOT : return FOOTER_DISPALYNAME; } } return super.getNodeDisplayName( model ); } | /**
* Gets the display name of the node
*
* @param object
* the object
*/ | Gets the display name of the node | getNodeDisplayName | {
"repo_name": "Charling-Huang/birt",
"path": "UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/outline/providers/ListBandProvider.java",
"license": "epl-1.0",
"size": 5024
} | [
"org.eclipse.birt.report.model.api.ListGroupHandle",
"org.eclipse.birt.report.model.api.ListHandle",
"org.eclipse.birt.report.model.api.SlotHandle"
] | import org.eclipse.birt.report.model.api.ListGroupHandle; import org.eclipse.birt.report.model.api.ListHandle; import org.eclipse.birt.report.model.api.SlotHandle; | import org.eclipse.birt.report.model.api.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 1,930,110 |
public Timestamp getUpdated();
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; | Timestamp function(); public static final String COLUMNNAME_UpdatedBy = STR; | /** Get Updated.
* Date this record was updated
*/ | Get Updated. Date this record was updated | getUpdated | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/I_AD_PInstance_Para.java",
"license": "gpl-2.0",
"size": 6715
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,678,428 |
public void addInput(int channelIndex, int channelUGenInput,
UGen sourceUGen, int sourceOutput) {
addInput(channelIndex * insPerChannel + channelUGenInput, sourceUGen,
sourceOutput);
} | void function(int channelIndex, int channelUGenInput, UGen sourceUGen, int sourceOutput) { addInput(channelIndex * insPerChannel + channelUGenInput, sourceUGen, sourceOutput); } | /**
* A convenience method of adding inputs to specific channel UGens. Calling
* <p>
* <code>addInput(c, i, sUGen, o)</code> is equivalent to calling
* <p>
* <code>addInput(c * insPerChannel + i, sUGen, o)</code>.
*
* @param channelIndex
* The channel to call addInput on.
* @param channelUGenInput
* The input index of the channel UGen.
* @param sourceUGen
* The source UGen.
* @param sourceOutput
* The output of the source UGen.
*/ | A convenience method of adding inputs to specific channel UGens. Calling <code>addInput(c, i, sUGen, o)</code> is equivalent to calling <code>addInput(c * insPerChannel + i, sUGen, o)</code> | addInput | {
"repo_name": "occloxium/Monoid",
"path": "beads/src/beads_main/net/beadsproject/beads/ugens/MultiWrapper.java",
"license": "mit",
"size": 7294
} | [
"net.beadsproject.beads.core.UGen"
] | import net.beadsproject.beads.core.UGen; | import net.beadsproject.beads.core.*; | [
"net.beadsproject.beads"
] | net.beadsproject.beads; | 43,598 |
public AxisAlignedBB getCollisionBox(Entity entityIn)
{
return null;
} | AxisAlignedBB function(Entity entityIn) { return null; } | /**
* Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
* pushable on contact, like boats or minecarts.
*/ | Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be pushable on contact, like boats or minecarts | getCollisionBox | {
"repo_name": "TorchPowered/Thallium",
"path": "src/main/java/net/minecraft/entity/Entity.java",
"license": "mit",
"size": 81824
} | [
"net.minecraft.util.AxisAlignedBB"
] | import net.minecraft.util.AxisAlignedBB; | import net.minecraft.util.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 2,687,908 |
final public void Statement() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IF_DIRECTIVE:
IfStatement();
break;
default:
jj_la1[1] = jj_gen;
if (jj_2_1(2)) {
Reference();
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SINGLE_LINE_COMMENT_START:
case FORMAL_COMMENT:
case MULTI_LINE_COMMENT:
Comment();
break;
case TEXTBLOCK:
Textblock();
break;
case SET_DIRECTIVE:
SetDirective();
break;
case ESCAPE_DIRECTIVE:
EscapedDirective();
break;
case DOUBLE_ESCAPE:
Escape();
break;
case WORD:
case BRACKETED_WORD:
Directive();
break;
case LPAREN:
case RPAREN:
case ESCAPE:
case TEXT:
case STRING_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case DOT:
case LCURLY:
case RCURLY:
case EMPTY_INDEX:
Text();
break;
default:
jj_la1[2] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
} | final void function() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IF_DIRECTIVE: IfStatement(); break; default: jj_la1[1] = jj_gen; if (jj_2_1(2)) { Reference(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SINGLE_LINE_COMMENT_START: case FORMAL_COMMENT: case MULTI_LINE_COMMENT: Comment(); break; case TEXTBLOCK: Textblock(); break; case SET_DIRECTIVE: SetDirective(); break; case ESCAPE_DIRECTIVE: EscapedDirective(); break; case DOUBLE_ESCAPE: Escape(); break; case WORD: case BRACKETED_WORD: Directive(); break; case LPAREN: case RPAREN: case ESCAPE: case TEXT: case STRING_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case DOT: case LCURLY: case RCURLY: case EMPTY_INDEX: Text(); break; default: jj_la1[2] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } } | /**
* These are the types of statements that
* are acceptable in Velocity templates.
*/ | These are the types of statements that are acceptable in Velocity templates | Statement | {
"repo_name": "dotCMS/core",
"path": "dotCMS/src/main/java/org/apache/velocity/runtime/parser/Parser.java",
"license": "gpl-3.0",
"size": 105896
} | [
"org.apache.velocity.runtime.directive.Directive"
] | import org.apache.velocity.runtime.directive.Directive; | import org.apache.velocity.runtime.directive.*; | [
"org.apache.velocity"
] | org.apache.velocity; | 603,729 |
public void forward(String controllerName) throws Throwable {
SilentGo instance = SilentGo.me();
((ActionChain) instance.getConfig().getActionChain().getObject()).doAction(instance.getConfig().getCtx().get().getActionParam());
} | void function(String controllerName) throws Throwable { SilentGo instance = SilentGo.me(); ((ActionChain) instance.getConfig().getActionChain().getObject()).doAction(instance.getConfig().getCtx().get().getActionParam()); } | /**
* forward to another controller
*
* @param controllerName
* @throws Throwable
*/ | forward to another controller | forward | {
"repo_name": "Teddy-Zhu/SilentGo",
"path": "framework/src/main/java/com/silentgo/servlet/http/Request.java",
"license": "mit",
"size": 3076
} | [
"com.silentgo.core.SilentGo",
"com.silentgo.core.action.ActionChain"
] | import com.silentgo.core.SilentGo; import com.silentgo.core.action.ActionChain; | import com.silentgo.core.*; import com.silentgo.core.action.*; | [
"com.silentgo.core"
] | com.silentgo.core; | 2,211,793 |
public ResultSet getData() throws DataSourceException {
return executeQuery(recordsQueryString());
} | ResultSet function() throws DataSourceException { return executeQuery(recordsQueryString()); } | /**
* Retrieves the data for this object (where applicable).
*
* @return the data for this object
*/ | Retrieves the data for this object (where applicable) | getData | {
"repo_name": "toxeh/ExecuteQuery",
"path": "java/src/org/executequery/databaseobjects/impl/AbstractDatabaseObject.java",
"license": "gpl-3.0",
"size": 12817
} | [
"java.sql.ResultSet",
"org.underworldlabs.jdbc.DataSourceException"
] | import java.sql.ResultSet; import org.underworldlabs.jdbc.DataSourceException; | import java.sql.*; import org.underworldlabs.jdbc.*; | [
"java.sql",
"org.underworldlabs.jdbc"
] | java.sql; org.underworldlabs.jdbc; | 1,668,350 |
public int getMetaFromState(@Nonnull IBlockState state) {
boolean burningValue = state.getValue(BURNING);
boolean masterValue = state.getValue(ISMASTER);
int meta = 0;
meta = (masterValue ? 1 : 0) | (burningValue ? 2 : 0);
return meta;
} | int function(@Nonnull IBlockState state) { boolean burningValue = state.getValue(BURNING); boolean masterValue = state.getValue(ISMASTER); int meta = 0; meta = (masterValue ? 1 : 0) (burningValue ? 2 : 0); return meta; } | /**
* Convert the BlockState into the correct metadata value
*/ | Convert the BlockState into the correct metadata value | getMetaFromState | {
"repo_name": "SmithsGaming/Armory",
"path": "src/main/com/smithsmodding/armory/common/block/BlockForge.java",
"license": "lgpl-3.0",
"size": 14290
} | [
"javax.annotation.Nonnull",
"net.minecraft.block.state.IBlockState"
] | import javax.annotation.Nonnull; import net.minecraft.block.state.IBlockState; | import javax.annotation.*; import net.minecraft.block.state.*; | [
"javax.annotation",
"net.minecraft.block"
] | javax.annotation; net.minecraft.block; | 1,636,383 |
@Test
public void whenUpdateElementByIndex() throws Exception {
MyList<String> array = new MyArrayList<>();
array.addAll(new String[]{"a", "b", "c"});
String[] result = {"a", "h", "c"};
assertThat(array.update(1, "h"), is("b"));
assertThat(array.toArray(), is(result));
} | void function() throws Exception { MyList<String> array = new MyArrayList<>(); array.addAll(new String[]{"a", "b", "c"}); String[] result = {"a", "h", "c"}; assertThat(array.update(1, "h"), is("b")); assertThat(array.toArray(), is(result)); } | /**
* The method check edit element by index.
*
* @throws Exception - check any errors;
*/ | The method check edit element by index | whenUpdateElementByIndex | {
"repo_name": "ArtemFM/JavaJunior",
"path": "lesson05/task05_03/src/test/java/apavlov/MyArrayListTest.java",
"license": "apache-2.0",
"size": 6531
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
] | org.hamcrest.core; org.junit; | 278,013 |
public static Control doOverride(Control child, Map<String, Defines> definesMap)
{
Control result = null;
if (child instanceof ControlPlaceHolder)
{
ControlPlaceHolder ph = (ControlPlaceHolder) child;
Defines def = definesMap.get(ph.getName());
if (def != null && def.getControl() != null)
{
result = def.getControl();
}
}
else
{
result = child;
}
return result;
} | static Control function(Control child, Map<String, Defines> definesMap) { Control result = null; if (child instanceof ControlPlaceHolder) { ControlPlaceHolder ph = (ControlPlaceHolder) child; Defines def = definesMap.get(ph.getName()); if (def != null && def.getControl() != null) { result = def.getControl(); } } else { result = child; } return result; } | /**
* Utility method to override all placeholders in the given list of
* controls.
*
* @param child The control to evaluate if it can be replace.
* @param definesMap The map with the source objects.
*
* @return The resulting control.
*/ | Utility method to override all placeholders in the given list of controls | doOverride | {
"repo_name": "bridje/bridje-framework",
"path": "bridje-web/src/main/java/org/bridje/web/view/controls/Control.java",
"license": "apache-2.0",
"size": 12709
} | [
"java.util.Map",
"org.bridje.web.view.Defines"
] | import java.util.Map; import org.bridje.web.view.Defines; | import java.util.*; import org.bridje.web.view.*; | [
"java.util",
"org.bridje.web"
] | java.util; org.bridje.web; | 429,528 |
public Iterator<MessagePart> iterator() {
return messageParts.iterator();
}
private static JsonParser _stringParser = new JsonParser();
| Iterator<MessagePart> function() { return messageParts.iterator(); } private static JsonParser _stringParser = new JsonParser(); | /**
* <b>Internally called method. Not for API consumption.</b>
*/ | Internally called method. Not for API consumption | iterator | {
"repo_name": "JohnnPM/PartyLobby",
"path": "src/mkremins/fanciful/FancyMessage.java",
"license": "gpl-2.0",
"size": 30285
} | [
"java.util.Iterator",
"org.bukkit.craftbukkit.libs.com.google.gson.JsonParser"
] | import java.util.Iterator; import org.bukkit.craftbukkit.libs.com.google.gson.JsonParser; | import java.util.*; import org.bukkit.craftbukkit.libs.com.google.gson.*; | [
"java.util",
"org.bukkit.craftbukkit"
] | java.util; org.bukkit.craftbukkit; | 1,211,452 |
@WebMethod(operationName = "createGroupMember")
@WebResult(name = "groupMember")
@CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true)
GroupMember createGroupMember(@WebParam(name="groupMember") GroupMember groupMember) throws RiceIllegalArgumentException; | @WebMethod(operationName = STR) @WebResult(name = STR) @CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true) GroupMember createGroupMember(@WebParam(name=STR) GroupMember groupMember) throws RiceIllegalArgumentException; | /**
* Creates a new group using the given GroupMember.
*
* <p>
* This will attempt to create a new GroupMember
* </p>
*
* @param groupMember The new groupMember to be created
* @return a the GroupMember that has been created.
* @throws RiceIllegalArgumentException if the group is null
*/ | Creates a new group using the given GroupMember. This will attempt to create a new GroupMember | createGroupMember | {
"repo_name": "mztaylor/rice-git",
"path": "rice-middleware/kim/kim-api/src/main/java/org/kuali/rice/kim/api/group/GroupService.java",
"license": "apache-2.0",
"size": 32391
} | [
"javax.jws.WebMethod",
"javax.jws.WebParam",
"javax.jws.WebResult",
"org.kuali.rice.core.api.exception.RiceIllegalArgumentException",
"org.kuali.rice.kim.api.role.Role",
"org.springframework.cache.annotation.CacheEvict"
] | import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; import org.kuali.rice.kim.api.role.Role; import org.springframework.cache.annotation.CacheEvict; | import javax.jws.*; import org.kuali.rice.core.api.exception.*; import org.kuali.rice.kim.api.role.*; import org.springframework.cache.annotation.*; | [
"javax.jws",
"org.kuali.rice",
"org.springframework.cache"
] | javax.jws; org.kuali.rice; org.springframework.cache; | 2,711,658 |
protected WebApplicationContext initWebApplicationContext() throws BeansException, IllegalStateException {
getServletContext().log("Initializing WebApplicationContext for Struts ActionServlet '" +
getServletName() + "', module '" + getModulePrefix() + "'");
WebApplicationContext parent = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
WebApplicationContext wac = createWebApplicationContext(parent);
if (logger.isInfoEnabled()) {
logger.info("Using context class '" + wac.getClass().getName() + "' for servlet '" + getServletName() + "'");
}
// Publish the context as a servlet context attribute.
String attrName = getServletContextAttributeName();
getServletContext().setAttribute(attrName, wac);
if (logger.isDebugEnabled()) {
logger.debug("Published WebApplicationContext of Struts ActionServlet '" + getServletName() +
"', module '" + getModulePrefix() + "' as ServletContext attribute with name [" + attrName + "]");
}
return wac;
} | WebApplicationContext function() throws BeansException, IllegalStateException { getServletContext().log(STR + getServletName() + STR + getModulePrefix() + "'"); WebApplicationContext parent = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); WebApplicationContext wac = createWebApplicationContext(parent); if (logger.isInfoEnabled()) { logger.info(STR + wac.getClass().getName() + STR + getServletName() + "'"); } String attrName = getServletContextAttributeName(); getServletContext().setAttribute(attrName, wac); if (logger.isDebugEnabled()) { logger.debug(STR + getServletName() + STR + getModulePrefix() + STR + attrName + "]"); } return wac; } | /**
* Initialize and publish the WebApplicationContext for the ActionServlet.
* <p>Delegates to {@link #createWebApplicationContext} for actual creation.
* <p>Can be overridden in subclasses. Call <code>getActionServlet()</code>
* and/or <code>getModuleConfig()</code> to access the Struts configuration
* that this PlugIn is associated with.
* @throws org.springframework.beans.BeansException if the context couldn't be initialized
* @throws IllegalStateException if there is already a context for the Struts ActionServlet
* @see #getActionServlet()
* @see #getServletName()
* @see #getServletContext()
* @see #getModuleConfig()
* @see #getModulePrefix()
*/ | Initialize and publish the WebApplicationContext for the ActionServlet. Delegates to <code>#createWebApplicationContext</code> for actual creation. Can be overridden in subclasses. Call <code>getActionServlet()</code> and/or <code>getModuleConfig()</code> to access the Struts configuration that this PlugIn is associated with | initWebApplicationContext | {
"repo_name": "cbeams-archive/spring-framework-2.5.x",
"path": "src/org/springframework/web/struts/ContextLoaderPlugIn.java",
"license": "apache-2.0",
"size": 15298
} | [
"org.springframework.beans.BeansException",
"org.springframework.web.context.WebApplicationContext",
"org.springframework.web.context.support.WebApplicationContextUtils"
] | import org.springframework.beans.BeansException; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; | import org.springframework.beans.*; import org.springframework.web.context.*; import org.springframework.web.context.support.*; | [
"org.springframework.beans",
"org.springframework.web"
] | org.springframework.beans; org.springframework.web; | 1,716,258 |
return ConsumerInfo.DATA_STRUCTURE_TYPE;
} | return ConsumerInfo.DATA_STRUCTURE_TYPE; } | /**
* Return the type of Data Structure we marshal
*
* @return short representation of the type data structure
*/ | Return the type of Data Structure we marshal | getDataStructureType | {
"repo_name": "tabish121/OpenWire",
"path": "openwire-legacy/src/main/java/io/openwire/codec/v2/ConsumerInfoMarshaller.java",
"license": "apache-2.0",
"size": 9232
} | [
"io.openwire.commands.ConsumerInfo"
] | import io.openwire.commands.ConsumerInfo; | import io.openwire.commands.*; | [
"io.openwire.commands"
] | io.openwire.commands; | 725,181 |
public java.util.List<fr.lip6.move.pnml.symmetricnet.integers.hlapi.LessThanHLAPI> getSubterm_integers_LessThanHLAPI(){
java.util.List<fr.lip6.move.pnml.symmetricnet.integers.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.integers.hlapi.LessThanHLAPI>();
for (Term elemnt : getSubterm()) {
if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.integers.impl.LessThanImpl.class)){
retour.add(new fr.lip6.move.pnml.symmetricnet.integers.hlapi.LessThanHLAPI(
(fr.lip6.move.pnml.symmetricnet.integers.LessThan)elemnt
));
}
}
return retour;
}
| java.util.List<fr.lip6.move.pnml.symmetricnet.integers.hlapi.LessThanHLAPI> function(){ java.util.List<fr.lip6.move.pnml.symmetricnet.integers.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.integers.hlapi.LessThanHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.integers.impl.LessThanImpl.class)){ retour.add(new fr.lip6.move.pnml.symmetricnet.integers.hlapi.LessThanHLAPI( (fr.lip6.move.pnml.symmetricnet.integers.LessThan)elemnt )); } } return retour; } | /**
* This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/ | This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind. WARNING : this method can creates a lot of new object in memory | getSubterm_integers_LessThanHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/integers/hlapi/ModuloHLAPI.java",
"license": "epl-1.0",
"size": 89721
} | [
"fr.lip6.move.pnml.symmetricnet.terms.Term",
"java.util.ArrayList",
"java.util.List"
] | import fr.lip6.move.pnml.symmetricnet.terms.Term; import java.util.ArrayList; import java.util.List; | import fr.lip6.move.pnml.symmetricnet.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
] | fr.lip6.move; java.util; | 1,424,589 |
public int guardarMisEquipos(List<Equipo> listaElegidos){
int error=0;
// Guardamos las preferencias
SharedPreferences.Editor editor = preferencias.edit();
/////////////////jjramos/////////////////////////
// Creamos un string con los equipos::
String equiposElegidosString=preferencias.getString(MIS_EQUIPOS, "*");
// listaElegidos=mezclarListaEquipos(deserializarListaEquipos(equiposElegidosString),listaElegidos);
equiposElegidosString=serializaListaEquipos(listaElegidos);
editor.putString(MIS_EQUIPOS,equiposElegidosString);
editor.commit();
/////////////////////////////
return error;
}
| int function(List<Equipo> listaElegidos){ int error=0; SharedPreferences.Editor editor = preferencias.edit(); String equiposElegidosString=preferencias.getString(MIS_EQUIPOS, "*"); equiposElegidosString=serializaListaEquipos(listaElegidos); editor.putString(MIS_EQUIPOS,equiposElegidosString); editor.commit(); return error; } | /**
* Metodo que nos permite almacenar en una Lista los equipos seleccionados
* @param listaElegidos Variable que es una Lista de la clase Equipo
* @return Devuelve un entero
*/ | Metodo que nos permite almacenar en una Lista los equipos seleccionados | guardarMisEquipos | {
"repo_name": "jjramos-dev/DeportesUGRApp",
"path": "src/es/ugr/deportesugrapp/GestorPreferencias.java",
"license": "gpl-3.0",
"size": 4250
} | [
"android.content.SharedPreferences",
"es.ugr.deportesugrapp.torneos.Equipo",
"java.util.List"
] | import android.content.SharedPreferences; import es.ugr.deportesugrapp.torneos.Equipo; import java.util.List; | import android.content.*; import es.ugr.deportesugrapp.torneos.*; import java.util.*; | [
"android.content",
"es.ugr.deportesugrapp",
"java.util"
] | android.content; es.ugr.deportesugrapp; java.util; | 1,472,656 |
public Read<K, V> withTopics(List<String> topics) {
checkState(
getTopicPartitions().isEmpty(), "Only topics or topicPartitions can be set, not both");
return toBuilder().setTopics(ImmutableList.copyOf(topics)).build();
} | Read<K, V> function(List<String> topics) { checkState( getTopicPartitions().isEmpty(), STR); return toBuilder().setTopics(ImmutableList.copyOf(topics)).build(); } | /**
* Sets a list of topics to read from. All the partitions from each
* of the topics are read.
*
* <p>See {@link UnboundedKafkaSource#split(int, PipelineOptions)} for description
* of how the partitions are distributed among the splits.
*/ | Sets a list of topics to read from. All the partitions from each of the topics are read. See <code>UnboundedKafkaSource#split(int, PipelineOptions)</code> for description of how the partitions are distributed among the splits | withTopics | {
"repo_name": "wtanaka/beam",
"path": "sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java",
"license": "apache-2.0",
"size": 67158
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.ImmutableList",
"java.util.List"
] | import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import java.util.List; | import com.google.common.base.*; import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 1,149,700 |
public void agregarMueble(Mueble mueble); | void function(Mueble mueble); | /**
* Agrega un mueble al sistema
* @param mueble Nuevo mueble
*/ | Agrega un mueble al sistema | agregarMueble | {
"repo_name": "xdeamx/lab6mbd",
"path": "Lab3-MueblesDeLosAlpes-ejb/src/java/com/losalpes/servicios/IServicioCatalogoMockRemote.java",
"license": "mit",
"size": 1573
} | [
"com.losalpes.entities.Mueble"
] | import com.losalpes.entities.Mueble; | import com.losalpes.entities.*; | [
"com.losalpes.entities"
] | com.losalpes.entities; | 2,802,958 |
@NonNull
static List<AssetStatement> filterAssetStatements(@NonNull final List<AssetStatement>
assetStatements,
@NonNull final RelationType relationType) {
require(assetStatements, notNullValue());
require(relationType, notNullValue());
List<AssetStatement> outputStatements = new ArrayList<>();
for (AssetStatement stmt : assetStatements) {
if (containsRelation(stmt, relationType)) {
outputStatements.add(stmt);
}
}
return outputStatements;
} | static List<AssetStatement> filterAssetStatements(@NonNull final List<AssetStatement> assetStatements, @NonNull final RelationType relationType) { require(assetStatements, notNullValue()); require(relationType, notNullValue()); List<AssetStatement> outputStatements = new ArrayList<>(); for (AssetStatement stmt : assetStatements) { if (containsRelation(stmt, relationType)) { outputStatements.add(stmt); } } return outputStatements; } | /**
* From the provided list of {@link AssetStatement}s, return those containing the specified
* {@link RelationType}.
*
* @param assetStatements Asset statements from with the return List will be generated
* @param relationType Asset statements must have this relation type to be included in the
* output.
* @return List of asset statements containing the specified relation type, or empty
*/ | From the provided list of <code>AssetStatement</code>s, return those containing the specified <code>RelationType</code> | filterAssetStatements | {
"repo_name": "sgaw/OpenYOLO-Android",
"path": "spi/java/org/openyolo/spi/assetlinks/loader/TargetAndroidAssetStatementLoader.java",
"license": "apache-2.0",
"size": 14075
} | [
"android.support.annotation.NonNull",
"java.util.ArrayList",
"java.util.List",
"org.hamcrest.CoreMatchers",
"org.openyolo.spi.assetlinks.data.AssetStatement",
"org.openyolo.spi.assetlinks.data.RelationType",
"org.valid4j.Assertive"
] | import android.support.annotation.NonNull; import java.util.ArrayList; import java.util.List; import org.hamcrest.CoreMatchers; import org.openyolo.spi.assetlinks.data.AssetStatement; import org.openyolo.spi.assetlinks.data.RelationType; import org.valid4j.Assertive; | import android.support.annotation.*; import java.util.*; import org.hamcrest.*; import org.openyolo.spi.assetlinks.data.*; import org.valid4j.*; | [
"android.support",
"java.util",
"org.hamcrest",
"org.openyolo.spi",
"org.valid4j"
] | android.support; java.util; org.hamcrest; org.openyolo.spi; org.valid4j; | 1,739,498 |
public static ZoneTransferIn
newIXFR(Name zone, long serial, boolean fallback, SocketAddress address,
TSIG key)
{
return new ZoneTransferIn(zone, Type.IXFR, serial, fallback, address,
key);
} | static ZoneTransferIn function(Name zone, long serial, boolean fallback, SocketAddress address, TSIG key) { return new ZoneTransferIn(zone, Type.IXFR, serial, fallback, address, key); } | /**
* Instantiates a ZoneTransferIn object to do an IXFR (incremental zone
* transfer).
* @param zone The zone to transfer.
* @param serial The existing serial number.
* @param fallback If true, fall back to AXFR if IXFR is not supported.
* @param address The host/port from which to transfer the zone.
* @param key The TSIG key used to authenticate the transfer, or null.
* @return The ZoneTransferIn object.
* @throws UnknownHostException The host does not exist.
*/ | Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer) | newIXFR | {
"repo_name": "Jimmy-Gao/browsermob-proxy",
"path": "src/main/java/org/xbill/DNS/ZoneTransferIn.java",
"license": "apache-2.0",
"size": 14851
} | [
"java.net.SocketAddress"
] | import java.net.SocketAddress; | import java.net.*; | [
"java.net"
] | java.net; | 1,591,924 |
@Test(expectedExceptions = DataNotFoundException.class)
public void testRemoveByIdNotFound() {
_master.removeById(ObjectId.of("NOT", "FOUND"));
} | @Test(expectedExceptions = DataNotFoundException.class) void function() { _master.removeById(ObjectId.of("NOT", "FOUND")); } | /**
* Test that an exception is thrown when trying to remove a user that does not exist.
*/ | Test that an exception is thrown when trying to remove a user that does not exist | testRemoveByIdNotFound | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master/src/test/java/com/opengamma/master/user/impl/InMemoryUserMasterTest.java",
"license": "apache-2.0",
"size": 15202
} | [
"com.opengamma.DataNotFoundException",
"com.opengamma.id.ObjectId",
"org.testng.annotations.Test"
] | import com.opengamma.DataNotFoundException; import com.opengamma.id.ObjectId; import org.testng.annotations.Test; | import com.opengamma.*; import com.opengamma.id.*; import org.testng.annotations.*; | [
"com.opengamma",
"com.opengamma.id",
"org.testng.annotations"
] | com.opengamma; com.opengamma.id; org.testng.annotations; | 910,843 |
public List<String> getParentClassNames(final String ontologyClassName) {
if (null == ontologyClassName) {
return Collections.emptyList();
}
try {
@SuppressWarnings("unchecked")
List<String> classNames = (List<String>) parentCache.get(ontologyClassName, new Callable<Object>() { | List<String> function(final String ontologyClassName) { if (null == ontologyClassName) { return Collections.emptyList(); } try { @SuppressWarnings(STR) List<String> classNames = (List<String>) parentCache.get(ontologyClassName, new Callable<Object>() { | /**
* This method can be used to return parent class names
* of the passed in ontology class name
*
* @param ontologyClassName
* @return list of parent class names
*/ | This method can be used to return parent class names of the passed in ontology class name | getParentClassNames | {
"repo_name": "AKSW/SmartDataWebKG",
"path": "Ingestion/src/org/aksw/sdw/ingestion/csv/utils/OntologyHandler.java",
"license": "apache-2.0",
"size": 8195
} | [
"java.util.Collections",
"java.util.List",
"java.util.concurrent.Callable"
] | import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 4,045 |
public MetaProperty<ZoneId> expiryZone() {
return expiryZone;
} | MetaProperty<ZoneId> function() { return expiryZone; } | /**
* The meta-property for the {@code expiryZone} property.
* @return the meta-property, not null
*/ | The meta-property for the expiryZone property | expiryZone | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/product/src/main/java/com/opengamma/strata/product/index/IborFutureOptionSecurity.java",
"license": "apache-2.0",
"size": 34787
} | [
"java.time.ZoneId",
"org.joda.beans.MetaProperty"
] | import java.time.ZoneId; import org.joda.beans.MetaProperty; | import java.time.*; import org.joda.beans.*; | [
"java.time",
"org.joda.beans"
] | java.time; org.joda.beans; | 2,146,558 |
String V0 = "onsite";
IndexStoreMemory fake = new IndexStoreMemory();
IndexStore index = fake;
assertEquals(list(), index.listVolumeSets());
assertEquals(list(), index.listVolumeNames(V0));
} | String V0 = STR; IndexStoreMemory fake = new IndexStoreMemory(); IndexStore index = fake; assertEquals(list(), index.listVolumeSets()); assertEquals(list(), index.listVolumeNames(V0)); } | /**
* List the volume indexes. When the store is empty.
*
* @throws Exception
*/ | List the volume indexes. When the store is empty | testListEmpty | {
"repo_name": "sarah-happy/happy-archive",
"path": "archive/src/main/java/org/yi/happy/archive/index/IndexStoreMemoryTest.java",
"license": "apache-2.0",
"size": 2669
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,618,481 |
@Get("json|xml")
@AnonymousAllowed
public GadgetRepresentation getRenderedGadget() {
Request request = getRequest();
Response response = getResponse();
Map<String, Object> attrs = request.getAttributes();
DashboardId dashboardId = DashboardId.valueOf(attrs.get("dashboardId"));
GadgetId gadgetId = GadgetId.valueOf(attrs.get("gadgetId"));
if (log.isDebugEnabled()) {
log.debug("GadgetResource: GET received: dashboardId=" + dashboardId + ", gadgetId = " + gadgetId);
}
final GadgetRequestContext requestContext = gadgetRequestContextFactory.get(request);
if (!permissionService.isReadableBy(dashboardId, requestContext.getViewer())) {
response.setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
return null;
}
final IDashboard dashboard = repository.get(dashboardId, requestContext);
IGadget myGadget = null;
DashboardState.ColumnIndex myColumn = null;
for (DashboardState.ColumnIndex column : dashboard.getLayout().getColumnRange()) {
for (IGadget gadget : dashboard.getGadgetsInColumn(column)) {
if (gadget.getId().equals(gadgetId)) {
myGadget = gadget;
myColumn = column;
log.debug("GadgetResource: GET: Found gadget ID '" + gadgetId + "' in column " + myColumn.index()
+ "; state=" + myGadget.toString());
break;
}
}
if (myGadget != null) {
break;
}
}
if (myGadget == null) {
response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
return null;
}
final GadgetRepresentation rep = representationFactory.createGadgetRepresentation(dashboardId, myGadget,
requestContext, permissionService.isWritableBy(dashboardId, requestContext.getViewer()), myColumn);
return rep;
} | @Get(STR) GadgetRepresentation function() { Request request = getRequest(); Response response = getResponse(); Map<String, Object> attrs = request.getAttributes(); DashboardId dashboardId = DashboardId.valueOf(attrs.get(STR)); GadgetId gadgetId = GadgetId.valueOf(attrs.get(STR)); if (log.isDebugEnabled()) { log.debug(STR + dashboardId + STR + gadgetId); } final GadgetRequestContext requestContext = gadgetRequestContextFactory.get(request); if (!permissionService.isReadableBy(dashboardId, requestContext.getViewer())) { response.setStatus(Status.CLIENT_ERROR_UNAUTHORIZED); return null; } final IDashboard dashboard = repository.get(dashboardId, requestContext); IGadget myGadget = null; DashboardState.ColumnIndex myColumn = null; for (DashboardState.ColumnIndex column : dashboard.getLayout().getColumnRange()) { for (IGadget gadget : dashboard.getGadgetsInColumn(column)) { if (gadget.getId().equals(gadgetId)) { myGadget = gadget; myColumn = column; log.debug(STR + gadgetId + STR + myColumn.index() + STR + myGadget.toString()); break; } } if (myGadget != null) { break; } } if (myGadget == null) { response.setStatus(Status.CLIENT_ERROR_NOT_FOUND); return null; } final GadgetRepresentation rep = representationFactory.createGadgetRepresentation(dashboardId, myGadget, requestContext, permissionService.isWritableBy(dashboardId, requestContext.getViewer()), myColumn); return rep; } | /**
* Returns a Gadget's JSON or XMl representation.
*
* @param dashboardId
* the id of the dashboard which it belongs to
* @param gadgetId
* the ID of the gadget to return
* @param request
* the {@code HttpServletRequest} that was routed here
* @return The gadget representation
*/ | Returns a Gadget's JSON or XMl representation | getRenderedGadget | {
"repo_name": "devacfr/spring-restlet",
"path": "restlet.ext.shindig/src/main/java/org/cfr/restlet/ext/shindig/dashboard/resource/impl/GadgetResource.java",
"license": "unlicense",
"size": 9483
} | [
"com.pmi.restlet.gadgets.GadgetId",
"com.pmi.restlet.gadgets.GadgetRequestContext",
"com.pmi.restlet.gadgets.dashboard.DashboardId",
"com.pmi.restlet.gadgets.dashboard.DashboardState",
"com.pmi.restlet.gadgets.dashboard.internal.IDashboard",
"com.pmi.restlet.gadgets.dashboard.internal.IGadget",
"com.pmi.restlet.gadgets.representations.GadgetRepresentation",
"java.util.Map",
"org.restlet.Request",
"org.restlet.Response",
"org.restlet.data.Status",
"org.restlet.resource.Get"
] | import com.pmi.restlet.gadgets.GadgetId; import com.pmi.restlet.gadgets.GadgetRequestContext; import com.pmi.restlet.gadgets.dashboard.DashboardId; import com.pmi.restlet.gadgets.dashboard.DashboardState; import com.pmi.restlet.gadgets.dashboard.internal.IDashboard; import com.pmi.restlet.gadgets.dashboard.internal.IGadget; import com.pmi.restlet.gadgets.representations.GadgetRepresentation; import java.util.Map; import org.restlet.Request; import org.restlet.Response; import org.restlet.data.Status; import org.restlet.resource.Get; | import com.pmi.restlet.gadgets.*; import com.pmi.restlet.gadgets.dashboard.*; import com.pmi.restlet.gadgets.dashboard.internal.*; import com.pmi.restlet.gadgets.representations.*; import java.util.*; import org.restlet.*; import org.restlet.data.*; import org.restlet.resource.*; | [
"com.pmi.restlet",
"java.util",
"org.restlet",
"org.restlet.data",
"org.restlet.resource"
] | com.pmi.restlet; java.util; org.restlet; org.restlet.data; org.restlet.resource; | 868,415 |
public int getRam() {
if (partial) {
throw new PartialObjectException();
}
return ram;
} | int function() { if (partial) { throw new PartialObjectException(); } return ram; } | /**
* Returns the amount of RAM of this flavor
*
* @return the amount of RAM of this flavor
*
* @throws PartialObjectException if this object is partially loaded
*/ | Returns the amount of RAM of this flavor | getRam | {
"repo_name": "cambierr/OvhApi",
"path": "src/main/java/com/github/cambierr/ovhapi/cloud/Flavor.java",
"license": "mit",
"size": 8432
} | [
"com.github.cambierr.ovhapi.exception.PartialObjectException"
] | import com.github.cambierr.ovhapi.exception.PartialObjectException; | import com.github.cambierr.ovhapi.exception.*; | [
"com.github.cambierr"
] | com.github.cambierr; | 1,469,916 |
public static int followedByPrep(SurfaceFormOccurrence surfaceFormOccurrence) {
TaggedToken rightNeighbourToken = null;
try {
rightNeighbourToken = ((TaggedText) surfaceFormOccurrence.context()).taggedTokenProvider()
.getRightNeighbourToken(surfaceFormOccurrence);
} catch (ItemNotFoundException e) {
return 0;
}
if (rightNeighbourToken.getPOSTag().equals("in"))
return 1;
else
return 0;
} | static int function(SurfaceFormOccurrence surfaceFormOccurrence) { TaggedToken rightNeighbourToken = null; try { rightNeighbourToken = ((TaggedText) surfaceFormOccurrence.context()).taggedTokenProvider() .getRightNeighbourToken(surfaceFormOccurrence); } catch (ItemNotFoundException e) { return 0; } if (rightNeighbourToken.getPOSTag().equals("in")) return 1; else return 0; } | /**
* Surface form occurrence is followed by preposition.
*
* @param surfaceFormOccurrence the surface form in context
* @return is surface form followed by preposition?
*/ | Surface form occurrence is followed by preposition | followedByPrep | {
"repo_name": "Skunnyk/dbpedia-spotlight-model",
"path": "core/src/main/java/org/dbpedia/spotlight/spot/cooccurrence/features/CandidateFeatures.java",
"license": "apache-2.0",
"size": 10436
} | [
"org.dbpedia.spotlight.exceptions.ItemNotFoundException",
"org.dbpedia.spotlight.model.SurfaceFormOccurrence",
"org.dbpedia.spotlight.model.TaggedText",
"org.dbpedia.spotlight.tagging.TaggedToken"
] | import org.dbpedia.spotlight.exceptions.ItemNotFoundException; import org.dbpedia.spotlight.model.SurfaceFormOccurrence; import org.dbpedia.spotlight.model.TaggedText; import org.dbpedia.spotlight.tagging.TaggedToken; | import org.dbpedia.spotlight.exceptions.*; import org.dbpedia.spotlight.model.*; import org.dbpedia.spotlight.tagging.*; | [
"org.dbpedia.spotlight"
] | org.dbpedia.spotlight; | 2,440,433 |
private FlowRule connectPorts(ConnectPoint src, ConnectPoint dst, int priority) {
checkArgument(src.deviceId().equals(dst.deviceId()));
TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
selectorBuilder.matchInPort(src.port());
//selectorBuilder.add(Criteria.matchCltSignalType)
treatmentBuilder.setOutput(dst.port());
//treatmentBuilder.add(Instructions.modL1OduSignalType)
FlowRule flowRule = DefaultFlowRule.builder()
.forDevice(src.deviceId())
.withSelector(selectorBuilder.build())
.withTreatment(treatmentBuilder.build())
.withPriority(priority)
.fromApp(appId)
.makePermanent()
.build();
return flowRule;
} | FlowRule function(ConnectPoint src, ConnectPoint dst, int priority) { checkArgument(src.deviceId().equals(dst.deviceId())); TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder(); TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder(); selectorBuilder.matchInPort(src.port()); treatmentBuilder.setOutput(dst.port()); FlowRule flowRule = DefaultFlowRule.builder() .forDevice(src.deviceId()) .withSelector(selectorBuilder.build()) .withTreatment(treatmentBuilder.build()) .withPriority(priority) .fromApp(appId) .makePermanent() .build(); return flowRule; } | /**
* Builds flow rule for mapping between two ports.
*
* @param src source port
* @param dst destination port
* @return flow rules
*/ | Builds flow rule for mapping between two ports | connectPorts | {
"repo_name": "kkkane/ONOS",
"path": "core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java",
"license": "apache-2.0",
"size": 14994
} | [
"com.google.common.base.Preconditions",
"org.onosproject.net.ConnectPoint",
"org.onosproject.net.flow.DefaultFlowRule",
"org.onosproject.net.flow.DefaultTrafficSelector",
"org.onosproject.net.flow.DefaultTrafficTreatment",
"org.onosproject.net.flow.FlowRule",
"org.onosproject.net.flow.TrafficSelector",
"org.onosproject.net.flow.TrafficTreatment"
] | import com.google.common.base.Preconditions; import org.onosproject.net.ConnectPoint; import org.onosproject.net.flow.DefaultFlowRule; import org.onosproject.net.flow.DefaultTrafficSelector; import org.onosproject.net.flow.DefaultTrafficTreatment; import org.onosproject.net.flow.FlowRule; import org.onosproject.net.flow.TrafficSelector; import org.onosproject.net.flow.TrafficTreatment; | import com.google.common.base.*; import org.onosproject.net.*; import org.onosproject.net.flow.*; | [
"com.google.common",
"org.onosproject.net"
] | com.google.common; org.onosproject.net; | 2,098,176 |
private void initDocumentListCache() {
setCachedDocumentListResponses(CacheBuilder.newBuilder().maximumSize(CACHE_MAX_ENTRIES_DOCUMENTLIST)
.expireAfterWrite(CACHE_TIMEOUT_MS, TimeUnit.MILLISECONDS).<CacheableXmlObject, XmlObject> build());
} | void function() { setCachedDocumentListResponses(CacheBuilder.newBuilder().maximumSize(CACHE_MAX_ENTRIES_DOCUMENTLIST) .expireAfterWrite(CACHE_TIMEOUT_MS, TimeUnit.MILLISECONDS).<CacheableXmlObject, XmlObject> build()); } | /**
* Inits the cache.
*/ | Inits the cache | initDocumentListCache | {
"repo_name": "vkscorpio3/atg-BaseSite",
"path": "src/MyDomain/common/WebServices/src/services/soap/weather/GlobalWeatherServiceTools.java",
"license": "epl-1.0",
"size": 7924
} | [
"com.google.common.cache.CacheBuilder",
"java.util.concurrent.TimeUnit",
"org.apache.xmlbeans.XmlObject"
] | import com.google.common.cache.CacheBuilder; import java.util.concurrent.TimeUnit; import org.apache.xmlbeans.XmlObject; | import com.google.common.cache.*; import java.util.concurrent.*; import org.apache.xmlbeans.*; | [
"com.google.common",
"java.util",
"org.apache.xmlbeans"
] | com.google.common; java.util; org.apache.xmlbeans; | 1,887,312 |
public Applications getVirtualClusterApplications() {
Applications virtualClusterApplications = new Applications();
if(this.selectedApplications != null) {
virtualClusterApplications.getApplication().addAll(Arrays.asList(this.selectedApplications));
}
return virtualClusterApplications;
}
/**
* Sets the value of {@link #applicationsFilter} | Applications function() { Applications virtualClusterApplications = new Applications(); if(this.selectedApplications != null) { virtualClusterApplications.getApplication().addAll(Arrays.asList(this.selectedApplications)); } return virtualClusterApplications; } /** * Sets the value of {@link #applicationsFilter} | /**
* Returns collection of selected applications mapped to {@link VirtualCluster.Applications}.
* @return virtual cluster applications
*/ | Returns collection of selected applications mapped to <code>VirtualCluster.Applications</code> | getVirtualClusterApplications | {
"repo_name": "ow2-xlcloud/vcms",
"path": "vcms-gui/modules/virtualClusters/src/main/java/org/xlcloud/console/virtualClusters/controllers/wizard/ManageApplicationsBean.java",
"license": "apache-2.0",
"size": 4776
} | [
"java.util.Arrays",
"org.xlcloud.service.Applications"
] | import java.util.Arrays; import org.xlcloud.service.Applications; | import java.util.*; import org.xlcloud.service.*; | [
"java.util",
"org.xlcloud.service"
] | java.util; org.xlcloud.service; | 311,751 |
@Test
public void coverageTest() {
CommonTester.checkExceptionInstantiation(DigestRuntimeException.class);
Assert.assertEquals(Algorithm.MD2, Algorithm.get(Algorithm.MD2.getAlgorithmName()));
Assert.assertEquals(Algorithm.SHA_1, Algorithm.get(Algorithm.SHA_1.getAlgorithmName()));
Assert.assertEquals(Algorithm.SHA_512, Algorithm.get(Algorithm.SHA_512.getAlgorithmName()));
Assert.assertEquals(CipherUtils.EMPTY_STRING, DigestUtils.digest(Algorithm.MD2, null));
Assert.assertEquals(CipherUtils.EMPTY_STRING, DigestUtils.digest(Algorithm.MD2, null, null));
Assert.assertSame(CipherUtils.EMPTY_BYTE_ARRAY, Algorithm.MD2.digest(null));
Assert.assertSame(CipherUtils.EMPTY_BYTE_ARRAY, Algorithm.MD2.digest(null, null));
Assert.assertSame(CipherUtils.EMPTY_BYTE_ARRAY, Algorithm.MD2.digest(new byte[0]));
Assert.assertSame(CipherUtils.EMPTY_BYTE_ARRAY, Algorithm.MD2.digest(new byte[0], null));
}
| void function() { CommonTester.checkExceptionInstantiation(DigestRuntimeException.class); Assert.assertEquals(Algorithm.MD2, Algorithm.get(Algorithm.MD2.getAlgorithmName())); Assert.assertEquals(Algorithm.SHA_1, Algorithm.get(Algorithm.SHA_1.getAlgorithmName())); Assert.assertEquals(Algorithm.SHA_512, Algorithm.get(Algorithm.SHA_512.getAlgorithmName())); Assert.assertEquals(CipherUtils.EMPTY_STRING, DigestUtils.digest(Algorithm.MD2, null)); Assert.assertEquals(CipherUtils.EMPTY_STRING, DigestUtils.digest(Algorithm.MD2, null, null)); Assert.assertSame(CipherUtils.EMPTY_BYTE_ARRAY, Algorithm.MD2.digest(null)); Assert.assertSame(CipherUtils.EMPTY_BYTE_ARRAY, Algorithm.MD2.digest(null, null)); Assert.assertSame(CipherUtils.EMPTY_BYTE_ARRAY, Algorithm.MD2.digest(new byte[0])); Assert.assertSame(CipherUtils.EMPTY_BYTE_ARRAY, Algorithm.MD2.digest(new byte[0], null)); } | /**
* Cases mostly for good code coverage.
*/ | Cases mostly for good code coverage | coverageTest | {
"repo_name": "Squadity/bb-utils",
"path": "src/test/java/net/bolbat/utils/crypt/DigestUtilsTest.java",
"license": "mit",
"size": 6785
} | [
"net.bolbat.test.utils.CommonTester",
"net.bolbat.utils.crypt.DigestUtils",
"org.junit.Assert"
] | import net.bolbat.test.utils.CommonTester; import net.bolbat.utils.crypt.DigestUtils; import org.junit.Assert; | import net.bolbat.test.utils.*; import net.bolbat.utils.crypt.*; import org.junit.*; | [
"net.bolbat.test",
"net.bolbat.utils",
"org.junit"
] | net.bolbat.test; net.bolbat.utils; org.junit; | 215,094 |
public void testBuild() throws Exception {
final DrlParser parser = new DrlParser();
final PackageBuilder pkgBuilder = new PackageBuilder();
pkgBuilder.addPackage( new PackageDescr( "org.drools" ) );
Package pkg = pkgBuilder.getPackage();
final PackageDescr pkgDescr = parser.parse( new InputStreamReader( getClass().getResourceAsStream( "nestedConditionalElements.drl" ) ) );
// just checking there is no parsing errors
Assert.assertFalse( parser.getErrors().toString(),
parser.hasErrors() );
final RuleDescr ruleDescr = (RuleDescr) pkgDescr.getRules().get( 0 );
final String ruleClassName = "RuleClassName.java";
ruleDescr.setClassName( ruleClassName );
ruleDescr.addAttribute( new AttributeDescr("dialect", "java") );
final TypeResolver typeResolver = new ClassTypeResolver( new HashSet(),
this.getClass().getClassLoader() );
// make an automatic import for the current package
typeResolver.addImport( pkgDescr.getName() + ".*" );
typeResolver.addImport( "java.lang.*" );
final RuleBuilder builder = new RuleBuilder( );
final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
DialectCompiletimeRegistry dialectRegistry = pkgBuilder.getPackageRegistry( pkg.getName() ).getDialectCompiletimeRegistry();
Dialect dialect = dialectRegistry.getDialect( "java" );
RuleBuildContext context = new RuleBuildContext(pkgBuilder, ruleDescr, dialectRegistry, pkg, dialect);
builder.build( context );
Assert.assertTrue( context.getErrors().toString(),
context.getErrors().isEmpty() );
final Rule rule = context.getRule();
assertEquals( "There should be 2 rule level declarations",
2,
rule.getDeclarations().length );
// second GE should be a not
final GroupElement not = (GroupElement) rule.getLhs().getChildren().get( 1 );
assertTrue( not.isNot() );
// not has no outer declarations
assertTrue( not.getOuterDeclarations().isEmpty() );
assertEquals( 1,
not.getInnerDeclarations().size() );
assertTrue( not.getInnerDeclarations().keySet().contains( "$state" ) );
// second not
final GroupElement not2 = (GroupElement) ((GroupElement) not.getChildren().get( 0 )).getChildren().get( 1 );
assertTrue( not2.isNot() );
// not has no outer declarations
assertTrue( not2.getOuterDeclarations().isEmpty() );
assertEquals( 1,
not2.getInnerDeclarations().size() );
assertTrue( not2.getInnerDeclarations().keySet().contains( "$likes" ) );
} | void function() throws Exception { final DrlParser parser = new DrlParser(); final PackageBuilder pkgBuilder = new PackageBuilder(); pkgBuilder.addPackage( new PackageDescr( STR ) ); Package pkg = pkgBuilder.getPackage(); final PackageDescr pkgDescr = parser.parse( new InputStreamReader( getClass().getResourceAsStream( STR ) ) ); Assert.assertFalse( parser.getErrors().toString(), parser.hasErrors() ); final RuleDescr ruleDescr = (RuleDescr) pkgDescr.getRules().get( 0 ); final String ruleClassName = STR; ruleDescr.setClassName( ruleClassName ); ruleDescr.addAttribute( new AttributeDescr(STR, "java") ); final TypeResolver typeResolver = new ClassTypeResolver( new HashSet(), this.getClass().getClassLoader() ); typeResolver.addImport( pkgDescr.getName() + ".*" ); typeResolver.addImport( STR ); final RuleBuilder builder = new RuleBuilder( ); final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration(); DialectCompiletimeRegistry dialectRegistry = pkgBuilder.getPackageRegistry( pkg.getName() ).getDialectCompiletimeRegistry(); Dialect dialect = dialectRegistry.getDialect( "java" ); RuleBuildContext context = new RuleBuildContext(pkgBuilder, ruleDescr, dialectRegistry, pkg, dialect); builder.build( context ); Assert.assertTrue( context.getErrors().toString(), context.getErrors().isEmpty() ); final Rule rule = context.getRule(); assertEquals( STR, 2, rule.getDeclarations().length ); final GroupElement not = (GroupElement) rule.getLhs().getChildren().get( 1 ); assertTrue( not.isNot() ); assertTrue( not.getOuterDeclarations().isEmpty() ); assertEquals( 1, not.getInnerDeclarations().size() ); assertTrue( not.getInnerDeclarations().keySet().contains( STR ) ); final GroupElement not2 = (GroupElement) ((GroupElement) not.getChildren().get( 0 )).getChildren().get( 1 ); assertTrue( not2.isNot() ); assertTrue( not2.getOuterDeclarations().isEmpty() ); assertEquals( 1, not2.getInnerDeclarations().size() ); assertTrue( not2.getInnerDeclarations().keySet().contains( STR ) ); } | /**
* Test method for {@link org.drools.rule.builder.RuleBuilder#build(org.drools.rule.Package, org.drools.lang.descr.RuleDescr)}.
*/ | Test method for <code>org.drools.rule.builder.RuleBuilder#build(org.drools.rule.Package, org.drools.lang.descr.RuleDescr)</code> | testBuild | {
"repo_name": "bobmcwhirter/drools",
"path": "drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/RuleBuilderTest.java",
"license": "apache-2.0",
"size": 6857
} | [
"java.io.InputStreamReader",
"java.util.HashSet",
"junit.framework.Assert",
"org.drools.base.ClassTypeResolver",
"org.drools.base.TypeResolver",
"org.drools.compiler.Dialect",
"org.drools.compiler.DialectCompiletimeRegistry",
"org.drools.compiler.DrlParser",
"org.drools.compiler.PackageBuilder",
"org.drools.compiler.PackageBuilderConfiguration",
"org.drools.lang.descr.AttributeDescr",
"org.drools.lang.descr.PackageDescr",
"org.drools.lang.descr.RuleDescr",
"org.drools.rule.GroupElement",
"org.drools.rule.Package",
"org.drools.rule.Rule",
"org.drools.rule.builder.RuleBuildContext",
"org.drools.rule.builder.RuleBuilder"
] | import java.io.InputStreamReader; import java.util.HashSet; import junit.framework.Assert; import org.drools.base.ClassTypeResolver; import org.drools.base.TypeResolver; import org.drools.compiler.Dialect; import org.drools.compiler.DialectCompiletimeRegistry; import org.drools.compiler.DrlParser; import org.drools.compiler.PackageBuilder; import org.drools.compiler.PackageBuilderConfiguration; import org.drools.lang.descr.AttributeDescr; import org.drools.lang.descr.PackageDescr; import org.drools.lang.descr.RuleDescr; import org.drools.rule.GroupElement; import org.drools.rule.Package; import org.drools.rule.Rule; import org.drools.rule.builder.RuleBuildContext; import org.drools.rule.builder.RuleBuilder; | import java.io.*; import java.util.*; import junit.framework.*; import org.drools.base.*; import org.drools.compiler.*; import org.drools.lang.descr.*; import org.drools.rule.*; import org.drools.rule.builder.*; | [
"java.io",
"java.util",
"junit.framework",
"org.drools.base",
"org.drools.compiler",
"org.drools.lang",
"org.drools.rule"
] | java.io; java.util; junit.framework; org.drools.base; org.drools.compiler; org.drools.lang; org.drools.rule; | 827,305 |
public Set<Variable> refsSyncedAtNode(ASTNode node, IAnalysisInput input) {
Map<ASTNode, NodeTree> synced = this.resultsAtNode(node, input);
if( synced.containsKey(node) )
return synced.get(node).syncedVars();
else
return Collections.emptySet();
}
| Set<Variable> function(ASTNode node, IAnalysisInput input) { Map<ASTNode, NodeTree> synced = this.resultsAtNode(node, input); if( synced.containsKey(node) ) return synced.get(node).syncedVars(); else return Collections.emptySet(); } | /**
* At the given AST node, which variables are known to be synchronized?
* If the node is in any way 'weird,' like something that cannot contain
* any synchronized references (e.g., field initializer) that's fine, this
* method will just return the empty set.
*/ | At the given AST node, which variables are known to be synchronized? If the node is in any way 'weird,' like something that cannot contain any synchronized references (e.g., field initializer) that's fine, this method will just return the empty set | refsSyncedAtNode | {
"repo_name": "plaidgroup/plural",
"path": "Plural/src/edu/cmu/cs/plural/concurrent/syncorswim/IsSynchronizedRefAnalysis.java",
"license": "gpl-2.0",
"size": 12097
} | [
"edu.cmu.cs.crystal.IAnalysisInput",
"edu.cmu.cs.crystal.tac.model.Variable",
"java.util.Collections",
"java.util.Map",
"java.util.Set",
"org.eclipse.jdt.core.dom.ASTNode"
] | import edu.cmu.cs.crystal.IAnalysisInput; import edu.cmu.cs.crystal.tac.model.Variable; import java.util.Collections; import java.util.Map; import java.util.Set; import org.eclipse.jdt.core.dom.ASTNode; | import edu.cmu.cs.crystal.*; import edu.cmu.cs.crystal.tac.model.*; import java.util.*; import org.eclipse.jdt.core.dom.*; | [
"edu.cmu.cs",
"java.util",
"org.eclipse.jdt"
] | edu.cmu.cs; java.util; org.eclipse.jdt; | 96,749 |
public ApiResponse<Void> updateReason_WithHttpInfo(String authorization, LegalReason body) throws ApiException {
com.squareup.okhttp.Call call = updateReason_ValidateBeforeCall(authorization, body, null, null);
return apiClient.execute(call);
} | ApiResponse<Void> function(String authorization, LegalReason body) throws ApiException { com.squareup.okhttp.Call call = updateReason_ValidateBeforeCall(authorization, body, null, null); return apiClient.execute(call); } | /**
* Update Legal Reason.
*
* @param authorization Bearer {auth} (required)
* @param body (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ | Update Legal Reason | updateReason_WithHttpInfo | {
"repo_name": "Avalara/avataxbr-clients",
"path": "java-client/src/main/java/io/swagger/client/api/LegalReasonApi.java",
"license": "gpl-3.0",
"size": 31807
} | [
"io.swagger.client.ApiException",
"io.swagger.client.ApiResponse",
"io.swagger.client.model.LegalReason"
] | import io.swagger.client.ApiException; import io.swagger.client.ApiResponse; import io.swagger.client.model.LegalReason; | import io.swagger.client.*; import io.swagger.client.model.*; | [
"io.swagger.client"
] | io.swagger.client; | 814,172 |
public void setShape(Shape shape) {
this.shape = shape;
}
| void function(Shape shape) { this.shape = shape; } | /**
* Sets the shape.
*
* @param shape the shape.
*
* @see #getShape()
*/ | Sets the shape | setShape | {
"repo_name": "jfree/jfreechart",
"path": "src/main/java/org/jfree/chart/legend/LegendGraphic.java",
"license": "lgpl-2.1",
"size": 22714
} | [
"java.awt.Shape"
] | import java.awt.Shape; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,580,796 |
@Test
public void appendEmptyVarargsQueryParams() throws Exception {
assertEquals("http://test.com/1", KieRemoteHttpRequest.appendQueryParameters("http://test.com/1", new Object[0]));
} | void function() throws Exception { assertEquals("http: } | /**
* Append empty params
*
* @throws Exception
*/ | Append empty params | appendEmptyVarargsQueryParams | {
"repo_name": "jiripetrlik/droolsjbpm-integration",
"path": "kie-remote/kie-remote-common/src/test/java/org/kie/remote/common/rest/KieRemoteHttpRequestTest.java",
"license": "apache-2.0",
"size": 77298
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,765,927 |
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public int getsite_assessment_versionsesCount()
throws com.liferay.portal.kernel.exception.SystemException; | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) int function() throws com.liferay.portal.kernel.exception.SystemException; | /**
* Returns the number of site_assessment_versionses.
*
* @return the number of site_assessment_versionses
* @throws SystemException if a system exception occurred
*/ | Returns the number of site_assessment_versionses | getsite_assessment_versionsesCount | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/service/com/iucn/whp/dbservice/service/site_assessment_versionsLocalService.java",
"license": "gpl-2.0",
"size": 12586
} | [
"com.liferay.portal.kernel.exception.SystemException",
"com.liferay.portal.kernel.transaction.Propagation",
"com.liferay.portal.kernel.transaction.Transactional"
] | import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.transaction.Propagation; import com.liferay.portal.kernel.transaction.Transactional; | import com.liferay.portal.kernel.exception.*; import com.liferay.portal.kernel.transaction.*; | [
"com.liferay.portal"
] | com.liferay.portal; | 1,806,031 |
public Collection<SwitchData> getAllSwitchDataEntries(); | Collection<SwitchData> function(); | /**
* Gets all SwitchData entries.
*
* @return all SwitchData entries.
*/ | Gets all SwitchData entries | getAllSwitchDataEntries | {
"repo_name": "opennetworkinglab/spring-open",
"path": "src/main/java/net/onrc/onos/core/topology/BaseInternalTopology.java",
"license": "apache-2.0",
"size": 3627
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,267,533 |
public GVRSceneObject loadModel(GVRSceneObject model, String filePath, GVRScene scene) throws IOException
{
if ((filePath == null) || (filePath.isEmpty()))
{
throw new IllegalArgumentException("Cannot load a model without a filename");
}
AssetRequest assetRequest = new AssetRequest(mContext, filePath, scene, false);
String ext = filePath.substring(filePath.length() - 3).toLowerCase();
model.setName(assetRequest.getBaseName());
if (ext.equals("x3d"))
loadX3DModel(assetRequest, model, GVRImportSettings.getRecommendedSettings(), true, null);
else
loadJassimpModel(assetRequest, model, GVRImportSettings.getRecommendedSettings(), true, null);
return model;
} | GVRSceneObject function(GVRSceneObject model, String filePath, GVRScene scene) throws IOException { if ((filePath == null) (filePath.isEmpty())) { throw new IllegalArgumentException(STR); } AssetRequest assetRequest = new AssetRequest(mContext, filePath, scene, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); model.setName(assetRequest.getBaseName()); if (ext.equals("x3d")) loadX3DModel(assetRequest, model, GVRImportSettings.getRecommendedSettings(), true, null); else loadJassimpModel(assetRequest, model, GVRImportSettings.getRecommendedSettings(), true, null); return model; } | /**
* Loads a scene object {@link GVRModelSceneObject} from
* a 3D model and adds it to the scene (if it is not already there).
*
* @param model
* A GVRModelSceneObject that has been initialized with a filename.
* If the filename starts with "sd:" the file is assumed to reside on the SD Card.
* If the filename starts with "http:" or "https:" it is assumed to be a URL.
* Otherwise the file is assumed to be relative to the "assets" directory.
*
* @param scene
* If present, this asset loader will wait until all of the textures have been
* loaded and then it will add the model to the scene.
*
* @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones
* and animations.
* @throws IOException
*
*/ | Loads a scene object <code>GVRModelSceneObject</code> from a 3D model and adds it to the scene (if it is not already there) | loadModel | {
"repo_name": "rahul27/GearVRf",
"path": "GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java",
"license": "apache-2.0",
"size": 38993
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 989,389 |
@Override
public storm.trident.spout.ITridentSpout.Emitter<Object> getEmitter(
String arg0, Map arg1, TopologyContext arg2) {
// TODO Auto-generated method stub
return emitter;
} | storm.trident.spout.ITridentSpout.Emitter<Object> function( String arg0, Map arg1, TopologyContext arg2) { return emitter; } | /**
* The emitter for a TransactionalSpout runs as many tasks across the cluster. Emitters are responsible for
* emitting batches of tuples for a transaction and must ensure that the same batch of tuples is always
* emitted for the same transaction id.
*/ | The emitter for a TransactionalSpout runs as many tasks across the cluster. Emitters are responsible for emitting batches of tuples for a transaction and must ensure that the same batch of tuples is always emitted for the same transaction id | getEmitter | {
"repo_name": "BinitaBharati/storm-trident-example",
"path": "src/main/java/bharati/binita/storm/trident/eg1/Spout.java",
"license": "epl-1.0",
"size": 1900
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,127,973 |
public static TextureBlender createTextureBlender(Format format, int flag, boolean negate, int blendType, float[] materialColor, float[] color, float colfac) {
switch (format) {
case Luminance8:
case Luminance8Alpha8:
case Luminance16F:
case Luminance16FAlpha16F:
case Luminance32F:
return new TextureBlenderLuminance(flag, negate, blendType, materialColor, color, colfac);
case RGBA8:
case ABGR8:
case BGR8:
case RGB8:
case RGB111110F:
case RGB16F:
case RGB16F_to_RGB111110F:
case RGB16F_to_RGB9E5:
case RGB32F:
case RGB565:
case RGB5A1:
case RGB9E5:
case RGBA16F:
case RGBA32F:
return new TextureBlenderAWT(flag, negate, blendType, materialColor, color, colfac);
case DXT1:
case DXT1A:
case DXT3:
case DXT5:
return new TextureBlenderDDS(flag, negate, blendType, materialColor, color, colfac);
default:
LOGGER.log(Level.WARNING, "Image type not yet supported for blending: {0}. Returning a blender that does not change the texture.", format);
return NON_CHANGING_BLENDER;
}
} | static TextureBlender function(Format format, int flag, boolean negate, int blendType, float[] materialColor, float[] color, float colfac) { switch (format) { case Luminance8: case Luminance8Alpha8: case Luminance16F: case Luminance16FAlpha16F: case Luminance32F: return new TextureBlenderLuminance(flag, negate, blendType, materialColor, color, colfac); case RGBA8: case ABGR8: case BGR8: case RGB8: case RGB111110F: case RGB16F: case RGB16F_to_RGB111110F: case RGB16F_to_RGB9E5: case RGB32F: case RGB565: case RGB5A1: case RGB9E5: case RGBA16F: case RGBA32F: return new TextureBlenderAWT(flag, negate, blendType, materialColor, color, colfac); case DXT1: case DXT1A: case DXT3: case DXT5: return new TextureBlenderDDS(flag, negate, blendType, materialColor, color, colfac); default: LOGGER.log(Level.WARNING, STR, format); return NON_CHANGING_BLENDER; } } | /**
* This method creates the blending class.
*
* @param format
* the texture format
* @return texture blending class
*/ | This method creates the blending class | createTextureBlender | {
"repo_name": "PlanetWaves/clockworkengine",
"path": "trunk/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderFactory.java",
"license": "apache-2.0",
"size": 4633
} | [
"com.jme3.texture.Image",
"java.util.logging.Level"
] | import com.jme3.texture.Image; import java.util.logging.Level; | import com.jme3.texture.*; import java.util.logging.*; | [
"com.jme3.texture",
"java.util"
] | com.jme3.texture; java.util; | 654,970 |
public ModalMessageDialog setMessage(final String message)
{
if (messageModel == null) {
setMessage(new Model<String>(message));
}
this.messageModel.setObject(message);
return this;
} | ModalMessageDialog function(final String message) { if (messageModel == null) { setMessage(new Model<String>(message)); } this.messageModel.setObject(message); return this; } | /**
* For updating or setting a fixed message.
* @param message
* @return this for chaining.
*/ | For updating or setting a fixed message | setMessage | {
"repo_name": "developerleo/ProjectForge-2nd",
"path": "src/main/java/org/projectforge/web/dialog/ModalMessageDialog.java",
"license": "gpl-3.0",
"size": 4775
} | [
"org.apache.wicket.model.Model"
] | import org.apache.wicket.model.Model; | import org.apache.wicket.model.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 2,138,656 |
public Iterator<List<String>> getAllRowIterator(String queryXml) {
return getRowIterator(queryXml, Page.DEFAULT);
} | Iterator<List<String>> function(String queryXml) { return getRowIterator(queryXml, Page.DEFAULT); } | /**
* Returns all the results of a specified PathQuery as an iterator. We would recommend that
* you use this method if you expect a lot of rows of results and might run out of memory.
*
* @param queryXml the query represented as an XML string
*
* @return an iterator over the results of the specified PathQuery
*/ | Returns all the results of a specified PathQuery as an iterator. We would recommend that you use this method if you expect a lot of rows of results and might run out of memory | getAllRowIterator | {
"repo_name": "JoeCarlson/intermine",
"path": "intermine/webservice/client/main/src/org/intermine/webservice/client/services/QueryService.java",
"license": "lgpl-2.1",
"size": 22047
} | [
"java.util.Iterator",
"java.util.List",
"org.intermine.webservice.client.results.Page"
] | import java.util.Iterator; import java.util.List; import org.intermine.webservice.client.results.Page; | import java.util.*; import org.intermine.webservice.client.results.*; | [
"java.util",
"org.intermine.webservice"
] | java.util; org.intermine.webservice; | 2,447,579 |
protected boolean visitUnionSupertype(AnnotatedTypeMirror subtype, AnnotatedUnionType supertype, VisitHistory visited) {
return isSubtypeOfAny(subtype, supertype.getAlternatives(), visited);
} | boolean function(AnnotatedTypeMirror subtype, AnnotatedUnionType supertype, VisitHistory visited) { return isSubtypeOfAny(subtype, supertype.getAlternatives(), visited); } | /**
* A union is a supertype if ONE of it's alternatives is a supertype of subtype
*/ | A union is a supertype if ONE of it's alternatives is a supertype of subtype | visitUnionSupertype | {
"repo_name": "jthaine/checker-framework",
"path": "framework/src/org/checkerframework/framework/type/DefaultTypeHierarchy.java",
"license": "gpl-2.0",
"size": 44239
} | [
"org.checkerframework.framework.type.AnnotatedTypeMirror",
"org.checkerframework.framework.type.visitor.VisitHistory"
] | import org.checkerframework.framework.type.AnnotatedTypeMirror; import org.checkerframework.framework.type.visitor.VisitHistory; | import org.checkerframework.framework.type.*; import org.checkerframework.framework.type.visitor.*; | [
"org.checkerframework.framework"
] | org.checkerframework.framework; | 1,128,133 |
@Test
public final void testCPass2() {
for (int row = 0; row < this.pass2Functions.length; row++) {
System.out.println("Post2String: "
+ this.pass2Functions[row][0] + LFCR
+ this.pass2Functions[row][1]);
try {
LoadScript ls = new LoadScript(TESTPATH
+ this.pass2Functions[row][1], null);
ls.generateTokenlist();
ls.generateTable();
logger.trace("Table: "+LFCR+ls.getTable());
this.vp.valueParser(ls.getTable(), ls.getQuotes(), (byte)0);
logger.trace("Table: "+LFCR+ls.getTable());
assertEquals(this.pass2Functions[row][0], this.pass2Functions[row][2], ls.getTable());
// _ElementBuilder eb = new _ElementBuilder(this.pass2Functions[row][0], null, null, ls.getTable(), TESTPATH);
// assertEquals(this.pass2Functions[row][0], this.pass2Functions[row][2], eb.toString());
// System.err.print(VERSION);
} catch (LoadScriptException e) {
System.out.println(e.getLocalizedMessage());
if (e.getLocalizedMessage().contains("Ordner ["))
System.out.println("OK");
else if (e.getLocalizedMessage().contains("Datei [")
&& e.getLocalizedMessage().contains("Gibt es nicht"))
System.out.println("OK");
else {
e.printStackTrace();
fail(e.getMessage());
}
} catch (ParseException e) {
e.printStackTrace();
fail(e.getMessage());
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
fail(e.getMessage());
} catch (NullPointerException e) {
e.printStackTrace();
fail(e.getMessage());
} catch (TableException e) {
e.printStackTrace();
fail(e.getMessage());
} catch (ScriptException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
}
| final void function() { for (int row = 0; row < this.pass2Functions.length; row++) { System.out.println(STR + this.pass2Functions[row][0] + LFCR + this.pass2Functions[row][1]); try { LoadScript ls = new LoadScript(TESTPATH + this.pass2Functions[row][1], null); ls.generateTokenlist(); ls.generateTable(); logger.trace(STR+LFCR+ls.getTable()); this.vp.valueParser(ls.getTable(), ls.getQuotes(), (byte)0); logger.trace(STR+LFCR+ls.getTable()); assertEquals(this.pass2Functions[row][0], this.pass2Functions[row][2], ls.getTable()); } catch (LoadScriptException e) { System.out.println(e.getLocalizedMessage()); if (e.getLocalizedMessage().contains(STR)) System.out.println("OK"); else if (e.getLocalizedMessage().contains(STR) && e.getLocalizedMessage().contains(STR)) System.out.println("OK"); else { e.printStackTrace(); fail(e.getMessage()); } } catch (ParseException e) { e.printStackTrace(); fail(e.getMessage()); } catch (ArrayIndexOutOfBoundsException e) { e.printStackTrace(); fail(e.getMessage()); } catch (NullPointerException e) { e.printStackTrace(); fail(e.getMessage()); } catch (TableException e) { e.printStackTrace(); fail(e.getMessage()); } catch (ScriptException e) { e.printStackTrace(); fail(e.getMessage()); } } } | /**
* Testen Pass2
*
* @modified -
*/ | Testen Pass2 | testCPass2 | {
"repo_name": "tfossi/APolGe",
"path": "tst/tfossi/apolge/common/scripting/ValueParserTest.java",
"license": "gpl-3.0",
"size": 13162
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 948,584 |
@Override
public List<String> getComponentsNames() {
return theRef.getComponentsNames();
}
| List<String> function() { return theRef.getComponentsNames(); } | /**
* Get Attribute exposed for management
*
*
*
* @return a value of <code>List<String></code>
*/ | Get Attribute exposed for management | getComponentsNames | {
"repo_name": "DanielYao/tigase-server",
"path": "src/main/java/tigase/stats/StatisticsProvider.java",
"license": "agpl-3.0",
"size": 36069
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,110,605 |
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeEnumValue(this.eventType);
if (this.eventType == Event.END_COMBAT)
{
buf.writeVarIntToBuffer(this.field_179772_d);
buf.writeInt(this.field_179775_c);
}
else if (this.eventType == Event.ENTITY_DIED)
{
buf.writeVarIntToBuffer(this.field_179774_b);
buf.writeInt(this.field_179775_c);
buf.writeString(this.deathMessage);
}
} | void function(PacketBuffer buf) throws IOException { buf.writeEnumValue(this.eventType); if (this.eventType == Event.END_COMBAT) { buf.writeVarIntToBuffer(this.field_179772_d); buf.writeInt(this.field_179775_c); } else if (this.eventType == Event.ENTITY_DIED) { buf.writeVarIntToBuffer(this.field_179774_b); buf.writeInt(this.field_179775_c); buf.writeString(this.deathMessage); } } | /**
* Writes the raw packet data to the data stream.
*/ | Writes the raw packet data to the data stream | writePacketData | {
"repo_name": "TorchPowered/CraftBloom",
"path": "src/net/minecraft/network/play/server/S42PacketCombatEvent.java",
"license": "mit",
"size": 2964
} | [
"java.io.IOException",
"net.minecraft.network.PacketBuffer"
] | import java.io.IOException; import net.minecraft.network.PacketBuffer; | import java.io.*; import net.minecraft.network.*; | [
"java.io",
"net.minecraft.network"
] | java.io; net.minecraft.network; | 1,178,292 |
private void getAll (JSONArray ids, CallbackContext command) {
getOptions(ids, Notification.Type.ALL, command);
} | void function (JSONArray ids, CallbackContext command) { getOptions(ids, Notification.Type.ALL, command); } | /**
* Set of options from local notification.
*
* @param ids
* Set of local notification IDs
* @param command
* The callback context used when calling back into JavaScript.
*/ | Set of options from local notification | getAll | {
"repo_name": "DayBr3ak/cordova-plugin-local-notifications",
"path": "src/android/LocalNotification.java",
"license": "apache-2.0",
"size": 18251
} | [
"de.appplant.cordova.plugin.notification.Notification",
"org.apache.cordova.CallbackContext",
"org.json.JSONArray"
] | import de.appplant.cordova.plugin.notification.Notification; import org.apache.cordova.CallbackContext; import org.json.JSONArray; | import de.appplant.cordova.plugin.notification.*; import org.apache.cordova.*; import org.json.*; | [
"de.appplant.cordova",
"org.apache.cordova",
"org.json"
] | de.appplant.cordova; org.apache.cordova; org.json; | 1,079,893 |
void updateSpaceConsumed(INodesInPath iip, long nsDelta, long ssDelta, short replication)
throws QuotaExceededException, FileNotFoundException,
UnresolvedLinkException, SnapshotAccessControlException {
writeLock();
try {
if (iip.getLastINode() == null) {
throw new FileNotFoundException("Path not found: " + iip.getPath());
}
updateCount(iip, nsDelta, ssDelta, replication, true);
} finally {
writeUnlock();
}
} | void updateSpaceConsumed(INodesInPath iip, long nsDelta, long ssDelta, short replication) throws QuotaExceededException, FileNotFoundException, UnresolvedLinkException, SnapshotAccessControlException { writeLock(); try { if (iip.getLastINode() == null) { throw new FileNotFoundException(STR + iip.getPath()); } updateCount(iip, nsDelta, ssDelta, replication, true); } finally { writeUnlock(); } } | /** Updates namespace, storagespace and typespaces consumed for all
* directories until the parent directory of file represented by path.
*
* @param iip the INodesInPath instance containing all the INodes for
* updating quota usage
* @param nsDelta the delta change of namespace
* @param ssDelta the delta change of storage space consumed without replication
* @param replication the replication factor of the block consumption change
* @throws QuotaExceededException if the new count violates any quota limit
* @throws FileNotFoundException if path does not exist.
*/ | Updates namespace, storagespace and typespaces consumed for all directories until the parent directory of file represented by path | updateSpaceConsumed | {
"repo_name": "mix/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java",
"license": "apache-2.0",
"size": 63942
} | [
"java.io.FileNotFoundException",
"org.apache.hadoop.fs.UnresolvedLinkException",
"org.apache.hadoop.hdfs.protocol.QuotaExceededException",
"org.apache.hadoop.hdfs.protocol.SnapshotAccessControlException"
] | import java.io.FileNotFoundException; import org.apache.hadoop.fs.UnresolvedLinkException; import org.apache.hadoop.hdfs.protocol.QuotaExceededException; import org.apache.hadoop.hdfs.protocol.SnapshotAccessControlException; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,804,687 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.