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 Bitmap getThumbnail(Context context, Uri uri, Point size) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { return DocumentsContract.getDocumentThumbnail(context.getContentResolver(), uri, size, null); } else { return null; } }
static Bitmap function(Context context, Uri uri, Point size) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { return DocumentsContract.getDocumentThumbnail(context.getContentResolver(), uri, size, null); } else { return null; } }
/** * Retrieve thumbnail of file, document api feature and thus KitKat only */
Retrieve thumbnail of file, document api feature and thus KitKat only
getThumbnail
{ "repo_name": "iseki-masaya/open-keychain", "path": "OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java", "license": "gpl-3.0", "size": 11851 }
[ "android.content.Context", "android.graphics.Bitmap", "android.graphics.Point", "android.net.Uri", "android.os.Build", "android.provider.DocumentsContract" ]
import android.content.Context; import android.graphics.Bitmap; import android.graphics.Point; import android.net.Uri; import android.os.Build; import android.provider.DocumentsContract;
import android.content.*; import android.graphics.*; import android.net.*; import android.os.*; import android.provider.*;
[ "android.content", "android.graphics", "android.net", "android.os", "android.provider" ]
android.content; android.graphics; android.net; android.os; android.provider;
2,687,363
private void createSchema(String schema) throws IgniteCheckedException { executeStatement("INFORMATION_SCHEMA", "CREATE SCHEMA IF NOT EXISTS " + schema); if (log.isDebugEnabled()) log.debug("Created H2 schema for index database: " + schema); }
void function(String schema) throws IgniteCheckedException { executeStatement(STR, STR + schema); if (log.isDebugEnabled()) log.debug(STR + schema); }
/** * Creates DB schema if it has not been created yet. * * @param schema Schema name. * @throws IgniteCheckedException If failed to create db schema. */
Creates DB schema if it has not been created yet
createSchema
{ "repo_name": "tkpanther/ignite", "path": "modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java", "license": "apache-2.0", "size": 97528 }
[ "org.apache.ignite.IgniteCheckedException" ]
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,024,578
public void setProposition(PropositionDefinition.Builder prop) { this.proposition = prop; this.setPropId(prop.getId()); }
void function(PropositionDefinition.Builder prop) { this.proposition = prop; this.setPropId(prop.getId()); }
/** * Sets the value of the proposition on this builder to the given value * @param prop the proposition value to set, must not be null */
Sets the value of the proposition on this builder to the given value
setProposition
{ "repo_name": "ricepanda/rice-git3", "path": "rice-middleware/krms/api/src/main/java/org/kuali/rice/krms/api/repository/rule/RuleDefinition.java", "license": "apache-2.0", "size": 17618 }
[ "org.kuali.rice.krms.api.repository.proposition.PropositionDefinition" ]
import org.kuali.rice.krms.api.repository.proposition.PropositionDefinition;
import org.kuali.rice.krms.api.repository.proposition.*;
[ "org.kuali.rice" ]
org.kuali.rice;
346,889
protected CmsListItem createResourceListItem( CmsResource resource, CmsHtmlList list, boolean showPermissions, boolean showDateLastMod, boolean showUserLastMod, boolean showDateCreate, boolean showUserCreate, boolean showDateRel, boolean showDateExp, boolean showState, boolean showLockedBy, boolean showSite) { CmsListItem item = list.newItem(resource.getStructureId().toString()); // get an initialized resource utility CmsResourceUtil resUtil = getResourceUtil(); resUtil.setResource(resource); item.set(A_CmsListExplorerDialog.LIST_COLUMN_NAME, resUtil.getPath()); item.set(A_CmsListExplorerDialog.LIST_COLUMN_ROOT_PATH, resUtil.getFullPath()); item.set(A_CmsListExplorerDialog.LIST_COLUMN_TITLE, resUtil.getTitle()); item.set(A_CmsListExplorerDialog.LIST_COLUMN_TYPE, resUtil.getResourceTypeName()); item.set(A_CmsListExplorerDialog.LIST_COLUMN_SIZE, resUtil.getSizeString()); if (showPermissions) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_PERMISSIONS, resUtil.getPermissionString()); } if (showDateLastMod) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_DATELASTMOD, new Date(resource.getDateLastModified())); } if (showUserLastMod) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_USERLASTMOD, resUtil.getUserLastModified()); } if (showDateCreate) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_DATECREATE, new Date(resource.getDateCreated())); } if (showUserCreate) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_USERCREATE, resUtil.getUserCreated()); } if (showDateRel) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_DATEREL, new Date(resource.getDateReleased())); } if (showDateExp) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_DATEEXP, new Date(resource.getDateExpired())); } if (showState) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_STATE, resUtil.getStateName()); } if (showLockedBy) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_LOCKEDBY, resUtil.getLockedByName()); } if (showSite) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_SITE, resUtil.getSiteTitle()); } return item; }
CmsListItem function( CmsResource resource, CmsHtmlList list, boolean showPermissions, boolean showDateLastMod, boolean showUserLastMod, boolean showDateCreate, boolean showUserCreate, boolean showDateRel, boolean showDateExp, boolean showState, boolean showLockedBy, boolean showSite) { CmsListItem item = list.newItem(resource.getStructureId().toString()); CmsResourceUtil resUtil = getResourceUtil(); resUtil.setResource(resource); item.set(A_CmsListExplorerDialog.LIST_COLUMN_NAME, resUtil.getPath()); item.set(A_CmsListExplorerDialog.LIST_COLUMN_ROOT_PATH, resUtil.getFullPath()); item.set(A_CmsListExplorerDialog.LIST_COLUMN_TITLE, resUtil.getTitle()); item.set(A_CmsListExplorerDialog.LIST_COLUMN_TYPE, resUtil.getResourceTypeName()); item.set(A_CmsListExplorerDialog.LIST_COLUMN_SIZE, resUtil.getSizeString()); if (showPermissions) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_PERMISSIONS, resUtil.getPermissionString()); } if (showDateLastMod) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_DATELASTMOD, new Date(resource.getDateLastModified())); } if (showUserLastMod) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_USERLASTMOD, resUtil.getUserLastModified()); } if (showDateCreate) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_DATECREATE, new Date(resource.getDateCreated())); } if (showUserCreate) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_USERCREATE, resUtil.getUserCreated()); } if (showDateRel) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_DATEREL, new Date(resource.getDateReleased())); } if (showDateExp) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_DATEEXP, new Date(resource.getDateExpired())); } if (showState) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_STATE, resUtil.getStateName()); } if (showLockedBy) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_LOCKEDBY, resUtil.getLockedByName()); } if (showSite) { item.set(A_CmsListExplorerDialog.LIST_COLUMN_SITE, resUtil.getSiteTitle()); } return item; }
/** * Returns a list item created from the resource information, differs between valid resources and invalid resources.<p> * * @param resource the resource to create the list item from * @param list the list * @param showPermissions if to show permissions * @param showDateLastMod if to show the last modification date * @param showUserLastMod if to show the last modification user * @param showDateCreate if to show the creation date * @param showUserCreate if to show the creation date * @param showDateRel if to show the date released * @param showDateExp if to show the date expired * @param showState if to show the state * @param showLockedBy if to show the lock user * @param showSite if to show the site * * @return a list item created from the resource information */
Returns a list item created from the resource information, differs between valid resources and invalid resources
createResourceListItem
{ "repo_name": "ggiudetti/opencms-core", "path": "src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSourceSearchFilesDialog.java", "license": "lgpl-2.1", "size": 14775 }
[ "java.util.Date", "org.opencms.file.CmsResource", "org.opencms.workplace.explorer.CmsResourceUtil", "org.opencms.workplace.list.CmsHtmlList", "org.opencms.workplace.list.CmsListItem" ]
import java.util.Date; import org.opencms.file.CmsResource; import org.opencms.workplace.explorer.CmsResourceUtil; import org.opencms.workplace.list.CmsHtmlList; import org.opencms.workplace.list.CmsListItem;
import java.util.*; import org.opencms.file.*; import org.opencms.workplace.explorer.*; import org.opencms.workplace.list.*;
[ "java.util", "org.opencms.file", "org.opencms.workplace" ]
java.util; org.opencms.file; org.opencms.workplace;
869,500
private static void setIconUrl(XmlPullParser parser, KmlStyle style) throws XmlPullParserException, IOException { int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals(ICON_STYLE_URL))) { if (eventType == START_TAG && parser.getName().equals("href")) { style.setIconUrl(parser.nextText()); } eventType = parser.next(); } }
static void function(XmlPullParser parser, KmlStyle style) throws XmlPullParserException, IOException { int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals(ICON_STYLE_URL))) { if (eventType == START_TAG && parser.getName().equals("href")) { style.setIconUrl(parser.nextText()); } eventType = parser.next(); } }
/** * Sets the icon url for the style * * @param style Style to set the icon url to */
Sets the icon url for the style
setIconUrl
{ "repo_name": "josegury/AndroidMarkerClusteringMaps", "path": "MarkerClusteringMaps/app/src/main/java/joseangelpardo/markerclusteringmaps/libreryMaps/kml/KmlStyleParser.java", "license": "apache-2.0", "size": 9307 }
[ "java.io.IOException", "org.xmlpull.v1.XmlPullParser", "org.xmlpull.v1.XmlPullParserException" ]
import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException;
import java.io.*; import org.xmlpull.v1.*;
[ "java.io", "org.xmlpull.v1" ]
java.io; org.xmlpull.v1;
2,278,446
public LinkedList<AllocatableAction> getPredecessors() { return this.resourcePredecessors; }
LinkedList<AllocatableAction> function() { return this.resourcePredecessors; }
/** * Returns the list of resource predecessors. * * @return The list of resource predecessors. */
Returns the list of resource predecessors
getPredecessors
{ "repo_name": "mF2C/COMPSs", "path": "compss/runtime/scheduler/fullGraphScheduler/src/main/java/es/bsc/compss/scheduler/fullgraph/FullGraphSchedulingInformation.java", "license": "apache-2.0", "size": 10573 }
[ "es.bsc.compss.scheduler.types.AllocatableAction", "java.util.LinkedList" ]
import es.bsc.compss.scheduler.types.AllocatableAction; import java.util.LinkedList;
import es.bsc.compss.scheduler.types.*; import java.util.*;
[ "es.bsc.compss", "java.util" ]
es.bsc.compss; java.util;
970,214
public Boolean isValidPlaylistTrack(CurrentlyPlaying song, User user) { if (song.getContext() == null) { return false; } else { return song.getContext().getUri().contains(user.getId()); } }
Boolean function(CurrentlyPlaying song, User user) { if (song.getContext() == null) { return false; } else { return song.getContext().getUri().contains(user.getId()); } }
/** * determine if a given song is part of a user's playlist * @param song a given played song * @param user the user that played the song * @return if the song is played from one of the user's playlists */
determine if a given song is part of a user's playlist
isValidPlaylistTrack
{ "repo_name": "cmb9400/skip-assistant", "path": "src/main/java/com/github/cmb9400/skipassistant/service/SpotifyHelperService.java", "license": "gpl-3.0", "size": 5692 }
[ "com.wrapper.spotify.model_objects.miscellaneous.CurrentlyPlaying", "com.wrapper.spotify.model_objects.specification.User" ]
import com.wrapper.spotify.model_objects.miscellaneous.CurrentlyPlaying; import com.wrapper.spotify.model_objects.specification.User;
import com.wrapper.spotify.model_objects.miscellaneous.*; import com.wrapper.spotify.model_objects.specification.*;
[ "com.wrapper.spotify" ]
com.wrapper.spotify;
449,257
protected void createProcessErrorPump(final InputStream is, final OutputStream os) { errorThread = createPump(is, os); }
void function(final InputStream is, final OutputStream os) { errorThread = createPump(is, os); }
/** * Create the pump to handle error output. * * @param is * the <CODE>InputStream</CODE>. * @param os * the <CODE>OutputStream</CODE>. */
Create the pump to handle error output
createProcessErrorPump
{ "repo_name": "deim0s/XWBEx", "path": "src/org/apache/commons/exec/PumpStreamHandler.java", "license": "mit", "size": 8552 }
[ "java.io.InputStream", "java.io.OutputStream" ]
import java.io.InputStream; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,211,765
public void setMultipliers(final List<Double> value) { nativeSetMultipliers(getHandle(), value); }
void function(final List<Double> value) { nativeSetMultipliers(getHandle(), value); }
/** * Set the multipliers. * <p> * Use [5, 2] for static automatic multi-axis tick alignment (more docs * needed) * </p> * @param value The new multipliers. */
Set the multipliers. Use [5, 2] for static automatic multi-axis tick alignment (more docs needed)
setMultipliers
{ "repo_name": "AndroidT/TRCharts", "path": "Charts/TRChartsJava/src/com/thomsonreuters/corptech/charts/AutomaticNumberTickCalculator.java", "license": "apache-2.0", "size": 4548 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,667,527
public void resolveChainedTargets() { final Map<TypeVariable, InferredValue> inferredTypes = new LinkedHashMap<>(this.size()); //TODO: we can probably make this a bit more efficient boolean grew = true; while (grew == true) { grew = false; for (final Entry<TypeVariable, InferredValue> inferred : this.entrySet()) { final TypeVariable target = inferred.getKey(); final InferredValue value = inferred.getValue(); if (value instanceof InferredType) { inferredTypes.put(target, value); } else { final InferredTarget currentTarget = (InferredTarget) value; final InferredType equivalentType = (InferredType) inferredTypes.get(((InferredTarget) value).target); if (equivalentType != null) { grew = true; final AnnotatedTypeMirror type = equivalentType.type.deepCopy(); type.replaceAnnotations(currentTarget.additionalAnnotations); final InferredType newConstraint = new InferredType(type); inferredTypes.put(currentTarget.target, newConstraint); } } } } this.putAll(inferredTypes); }
void function() { final Map<TypeVariable, InferredValue> inferredTypes = new LinkedHashMap<>(this.size()); boolean grew = true; while (grew == true) { grew = false; for (final Entry<TypeVariable, InferredValue> inferred : this.entrySet()) { final TypeVariable target = inferred.getKey(); final InferredValue value = inferred.getValue(); if (value instanceof InferredType) { inferredTypes.put(target, value); } else { final InferredTarget currentTarget = (InferredTarget) value; final InferredType equivalentType = (InferredType) inferredTypes.get(((InferredTarget) value).target); if (equivalentType != null) { grew = true; final AnnotatedTypeMirror type = equivalentType.type.deepCopy(); type.replaceAnnotations(currentTarget.additionalAnnotations); final InferredType newConstraint = new InferredType(type); inferredTypes.put(currentTarget.target, newConstraint); } } } } this.putAll(inferredTypes); }
/** * If we had a set of inferred results, (e.g. T1 = T2, T2 = T3, T3 = String) propagate any * results we have (the above constraints become T1 = String, T2 = String, T3 = String) */
If we had a set of inferred results, (e.g. T1 = T2, T2 = T3, T3 = String) propagate any results we have (the above constraints become T1 = String, T2 = String, T3 = String)
resolveChainedTargets
{ "repo_name": "CharlesZ-Chen/checker-framework", "path": "framework/src/org/checkerframework/framework/util/typeinference/solver/InferenceResult.java", "license": "gpl-2.0", "size": 6729 }
[ "java.util.LinkedHashMap", "java.util.Map", "javax.lang.model.type.TypeVariable", "org.checkerframework.framework.type.AnnotatedTypeMirror", "org.checkerframework.framework.util.typeinference.solver.InferredValue" ]
import java.util.LinkedHashMap; import java.util.Map; import javax.lang.model.type.TypeVariable; import org.checkerframework.framework.type.AnnotatedTypeMirror; import org.checkerframework.framework.util.typeinference.solver.InferredValue;
import java.util.*; import javax.lang.model.type.*; import org.checkerframework.framework.type.*; import org.checkerframework.framework.util.typeinference.solver.*;
[ "java.util", "javax.lang", "org.checkerframework.framework" ]
java.util; javax.lang; org.checkerframework.framework;
1,205,593
public HandlerRegistration addDragStartHandler(DragStartEventHandler handler) { return addDragAndDropHandler(handler, DragStartEvent.TYPE); }
HandlerRegistration function(DragStartEventHandler handler) { return addDragAndDropHandler(handler, DragStartEvent.TYPE); }
/** * Add a handler object that will manage the {@link DragStartEvent} event. * This kind of event is fired when the drag operation starts. */
Add a handler object that will manage the <code>DragStartEvent</code> event. This kind of event is fired when the drag operation starts
addDragStartHandler
{ "repo_name": "ArcBees/gwtquery-droppable-plugin", "path": "plugin/src/main/java/gwtquery/plugins/droppable/client/gwt/DragAndDropCellTree.java", "license": "mit", "size": 9538 }
[ "com.google.gwt.event.shared.HandlerRegistration" ]
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.*;
[ "com.google.gwt" ]
com.google.gwt;
1,919,237
InternalDistributedMember getDistributionManagerId();
InternalDistributedMember getDistributionManagerId();
/** * Returns the id of this distribution manager. */
Returns the id of this distribution manager
getDistributionManagerId
{ "repo_name": "masaki-yamakawa/geode", "path": "geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java", "license": "apache-2.0", "size": 15041 }
[ "org.apache.geode.distributed.internal.membership.InternalDistributedMember" ]
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.membership.*;
[ "org.apache.geode" ]
org.apache.geode;
1,920,368
public static SecurityId of(StandardId standardId) { return new SecurityId(standardId); } /** * Parses an {@code StandardId} from a formatted scheme and value. * <p> * This parses the identifier from the form produced by {@code toString()}
static SecurityId function(StandardId standardId) { return new SecurityId(standardId); } /** * Parses an {@code StandardId} from a formatted scheme and value. * <p> * This parses the identifier from the form produced by {@code toString()}
/** * Creates an instance from a standard two-part identifier. * * @param standardId the underlying standard two-part identifier * @return the security identifier */
Creates an instance from a standard two-part identifier
of
{ "repo_name": "OpenGamma/Strata", "path": "modules/product/src/main/java/com/opengamma/strata/product/SecurityId.java", "license": "apache-2.0", "size": 5062 }
[ "com.opengamma.strata.basics.StandardId" ]
import com.opengamma.strata.basics.StandardId;
import com.opengamma.strata.basics.*;
[ "com.opengamma.strata" ]
com.opengamma.strata;
193,750
public static JmsComponent jmsComponentClientAcknowledge(ConnectionFactory connectionFactory) { JmsConfiguration configuration = new JmsConfiguration(connectionFactory); configuration.setAcknowledgementMode(Session.CLIENT_ACKNOWLEDGE); return jmsComponent(configuration); }
static JmsComponent function(ConnectionFactory connectionFactory) { JmsConfiguration configuration = new JmsConfiguration(connectionFactory); configuration.setAcknowledgementMode(Session.CLIENT_ACKNOWLEDGE); return jmsComponent(configuration); }
/** * Static builder method */
Static builder method
jmsComponentClientAcknowledge
{ "repo_name": "ullgren/camel", "path": "components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java", "license": "apache-2.0", "size": 44357 }
[ "javax.jms.ConnectionFactory", "javax.jms.Session" ]
import javax.jms.ConnectionFactory; import javax.jms.Session;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
1,932,173
public Collection<AbstractContact> getAbstractContacts() { return abstractContacts; }
Collection<AbstractContact> function() { return abstractContacts; }
/** * Gets list of contacts. * * @return */
Gets list of contacts
getAbstractContacts
{ "repo_name": "bigbugbb/iTracker", "path": "app/src/main/java/com/itracker/android/ui/adapter/GroupConfiguration.java", "license": "apache-2.0", "size": 4724 }
[ "com.itracker.android.data.roster.AbstractContact", "java.util.Collection" ]
import com.itracker.android.data.roster.AbstractContact; import java.util.Collection;
import com.itracker.android.data.roster.*; import java.util.*;
[ "com.itracker.android", "java.util" ]
com.itracker.android; java.util;
112,393
private void sendViaPost(MessageContext msgContext, URL url, String soapActionString) throws AxisFault { HttpClient httpClient = getHttpClient(msgContext); PostMethod postMethod = new PostMethod(); if (log.isTraceEnabled()) { log.trace(Thread.currentThread() + " PostMethod " + postMethod + " / " + httpClient); } MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, postMethod, httpClient, soapActionString); postMethod.setRequestEntity(new AxisRequestEntity(messageFormatter, msgContext, format, soapActionString, chunked, isAllowedRetry)); if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) { postMethod.setContentChunked(true); } String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString); if (soapAction != null && !msgContext.isDoingREST()) { postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } try { executeMethod(httpClient, msgContext, url, postMethod); handleResponse(msgContext, postMethod); } catch (IOException e) { log.info("Unable to sendViaPost to url[" + url + "]", e); throw AxisFault.makeFault(e); } finally { cleanup(msgContext, postMethod); } }
void function(MessageContext msgContext, URL url, String soapActionString) throws AxisFault { HttpClient httpClient = getHttpClient(msgContext); PostMethod postMethod = new PostMethod(); if (log.isTraceEnabled()) { log.trace(Thread.currentThread() + STR + postMethod + STR + httpClient); } MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, postMethod, httpClient, soapActionString); postMethod.setRequestEntity(new AxisRequestEntity(messageFormatter, msgContext, format, soapActionString, chunked, isAllowedRetry)); if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) { postMethod.setContentChunked(true); } String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString); if (soapAction != null && !msgContext.isDoingREST()) { postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } try { executeMethod(httpClient, msgContext, url, postMethod); handleResponse(msgContext, postMethod); } catch (IOException e) { log.info(STR + url + "]", e); throw AxisFault.makeFault(e); } finally { cleanup(msgContext, postMethod); } }
/** * Used to send a request via HTTP Post Method * * @param msgContext - The MessageContext of the message * @param url - The target URL * @param soapActionString - The soapAction string of the request * @throws AxisFault - Thrown in case an exception occurs */
Used to send a request via HTTP Post Method
sendViaPost
{ "repo_name": "Nipuni/wso2-axis2", "path": "modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java", "license": "apache-2.0", "size": 15271 }
[ "java.io.IOException", "org.apache.axis2.AxisFault", "org.apache.axis2.context.MessageContext", "org.apache.axis2.transport.MessageFormatter", "org.apache.commons.httpclient.HttpClient", "org.apache.commons.httpclient.methods.PostMethod" ]
import java.io.IOException; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.MessageFormatter; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.PostMethod;
import java.io.*; import org.apache.axis2.*; import org.apache.axis2.context.*; import org.apache.axis2.transport.*; import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.methods.*;
[ "java.io", "org.apache.axis2", "org.apache.commons" ]
java.io; org.apache.axis2; org.apache.commons;
2,911,353
private static Tuple2<Class<?>[], Object[]> filterArguments( Class<?>[] parameterTypes, Annotation[][] parameterAnnotations, Object[] args) { Class<?>[] filteredParameterTypes; Object[] filteredArgs; if (args == null) { filteredParameterTypes = parameterTypes; filteredArgs = null; } else { Preconditions.checkArgument(parameterTypes.length == parameterAnnotations.length); Preconditions.checkArgument(parameterAnnotations.length == args.length); BitSet isRpcTimeoutParameter = new BitSet(parameterTypes.length); int numberRpcParameters = parameterTypes.length; for (int i = 0; i < parameterTypes.length; i++) { if (isRpcTimeout(parameterAnnotations[i])) { isRpcTimeoutParameter.set(i); numberRpcParameters--; } } if (numberRpcParameters == parameterTypes.length) { filteredParameterTypes = parameterTypes; filteredArgs = args; } else { filteredParameterTypes = new Class<?>[numberRpcParameters]; filteredArgs = new Object[numberRpcParameters]; int counter = 0; for (int i = 0; i < parameterTypes.length; i++) { if (!isRpcTimeoutParameter.get(i)) { filteredParameterTypes[counter] = parameterTypes[i]; filteredArgs[counter] = args[i]; counter++; } } } } return Tuple2.of(filteredParameterTypes, filteredArgs); } /** * Checks whether any of the annotations is of type {@link RpcTimeout}
static Tuple2<Class<?>[], Object[]> function( Class<?>[] parameterTypes, Annotation[][] parameterAnnotations, Object[] args) { Class<?>[] filteredParameterTypes; Object[] filteredArgs; if (args == null) { filteredParameterTypes = parameterTypes; filteredArgs = null; } else { Preconditions.checkArgument(parameterTypes.length == parameterAnnotations.length); Preconditions.checkArgument(parameterAnnotations.length == args.length); BitSet isRpcTimeoutParameter = new BitSet(parameterTypes.length); int numberRpcParameters = parameterTypes.length; for (int i = 0; i < parameterTypes.length; i++) { if (isRpcTimeout(parameterAnnotations[i])) { isRpcTimeoutParameter.set(i); numberRpcParameters--; } } if (numberRpcParameters == parameterTypes.length) { filteredParameterTypes = parameterTypes; filteredArgs = args; } else { filteredParameterTypes = new Class<?>[numberRpcParameters]; filteredArgs = new Object[numberRpcParameters]; int counter = 0; for (int i = 0; i < parameterTypes.length; i++) { if (!isRpcTimeoutParameter.get(i)) { filteredParameterTypes[counter] = parameterTypes[i]; filteredArgs[counter] = args[i]; counter++; } } } } return Tuple2.of(filteredParameterTypes, filteredArgs); } /** * Checks whether any of the annotations is of type {@link RpcTimeout}
/** * Removes all {@link RpcTimeout} annotated parameters from the parameter type and argument * list. * * @param parameterTypes Array of parameter types * @param parameterAnnotations Array of parameter annotations * @param args Arary of arguments * @return Tuple of filtered parameter types and arguments which no longer contain the * {@link RpcTimeout} annotated parameter types and arguments */
Removes all <code>RpcTimeout</code> annotated parameters from the parameter type and argument list
filterArguments
{ "repo_name": "mtunique/flink", "path": "flink-runtime/src/test/java/org/apache/flink/runtime/rpc/TestingSerialRpcService.java", "license": "apache-2.0", "size": 15252 }
[ "java.lang.annotation.Annotation", "java.util.BitSet", "org.apache.flink.api.java.tuple.Tuple2", "org.apache.flink.util.Preconditions" ]
import java.lang.annotation.Annotation; import java.util.BitSet; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.util.Preconditions;
import java.lang.annotation.*; import java.util.*; import org.apache.flink.api.java.tuple.*; import org.apache.flink.util.*;
[ "java.lang", "java.util", "org.apache.flink" ]
java.lang; java.util; org.apache.flink;
2,552,905
public static <E> List<E> compose(List<E> list, Callback callback) { return new CallbackList<E>(list, callback); }
static <E> List<E> function(List<E> list, Callback callback) { return new CallbackList<E>(list, callback); }
/** * Returns the composition of the given list and callback. * <p> * Note: Any changes to the original list will cause the returned * list to change and vice versa. But direct changes on the source * will not be propagated with the callback. * </p> * * @param <E> the generic element type * @param list the underlying list * @param callback the custom callback * @return a list which propagates strucutural changes using the specified callback */
Returns the composition of the given list and callback. Note: Any changes to the original list will cause the returned list to change and vice versa. But direct changes on the source will not be propagated with the callback.
compose
{ "repo_name": "cosmocode/cosmocode-commons", "path": "src/main/java/de/cosmocode/collections/callback/Callbacks.java", "license": "apache-2.0", "size": 5183 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,860,293
HistogramValues getHistogramValues() throws IOException;
HistogramValues getHistogramValues() throws IOException;
/** * Return Histogram values. */
Return Histogram values
getHistogramValues
{ "repo_name": "gingerwizard/elasticsearch", "path": "server/src/main/java/org/elasticsearch/index/fielddata/LeafHistogramFieldData.java", "license": "apache-2.0", "size": 1108 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,107,853
public String[] getStrings(String name) { String valueString = get(name); return StringUtils.getStrings(valueString); }
String[] function(String name) { String valueString = get(name); return StringUtils.getStrings(valueString); }
/** * Get the comma delimited values of the <code>name</code> property as * an array of <code>String</code>s. * If no such property is specified then <code>null</code> is returned. * * @param name property name. * @return property value as an array of <code>String</code>s, * or <code>null</code>. */
Get the comma delimited values of the <code>name</code> property as an array of <code>String</code>s. If no such property is specified then <code>null</code> is returned
getStrings
{ "repo_name": "submergerock/avatar-hadoop", "path": "build/hadoop-0.20.1-dev/src/core/org/apache/hadoop/conf/Configuration.java", "license": "apache-2.0", "size": 42445 }
[ "org.apache.hadoop.util.StringUtils" ]
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,532,298
public void apply(WriteStream out, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_sizefmt != null) request.setAttribute("caucho.ssi.sizefmt", _sizefmt); if (_errmsg != null) request.setAttribute("caucho.ssi.errmsg", _errmsg); if (_timefmt != null) request.setAttribute("caucho.ssi.timefmt", _timefmt); }
void function(WriteStream out, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_sizefmt != null) request.setAttribute(STR, _sizefmt); if (_errmsg != null) request.setAttribute(STR, _errmsg); if (_timefmt != null) request.setAttribute(STR, _timefmt); }
/** * Executes the SSI statement. * * @param out the output stream * @param request the servlet request * @param response the servlet response */
Executes the SSI statement
apply
{ "repo_name": "mdaniel/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/servlets/ssi/ConfigStatement.java", "license": "gpl-2.0", "size": 2513 }
[ "com.caucho.vfs.WriteStream", "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import com.caucho.vfs.WriteStream; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import com.caucho.vfs.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "com.caucho.vfs", "java.io", "javax.servlet" ]
com.caucho.vfs; java.io; javax.servlet;
2,329,091
private List<Item> liveGetItems(Task t) { lock.lock(); try { List<Item> result = new ArrayList<>(); result.addAll(blockedProjects.getAll(t)); result.addAll(buildables.getAll(t)); // Do not include pendings—we have already finalized WorkUnitContext.actions. if (LOGGER.isLoggable(Level.FINE)) { List<BuildableItem> thePendings = pendings.getAll(t); if (!thePendings.isEmpty()) { LOGGER.log(Level.FINE, "ignoring {0} during scheduleInternal", thePendings); } } for (Item item : waitingList) { if (item.task.equals(t)) { result.add(item); } } return result; } finally { lock.unlock(); } }
List<Item> function(Task t) { lock.lock(); try { List<Item> result = new ArrayList<>(); result.addAll(blockedProjects.getAll(t)); result.addAll(buildables.getAll(t)); if (LOGGER.isLoggable(Level.FINE)) { List<BuildableItem> thePendings = pendings.getAll(t); if (!thePendings.isEmpty()) { LOGGER.log(Level.FINE, STR, thePendings); } } for (Item item : waitingList) { if (item.task.equals(t)) { result.add(item); } } return result; } finally { lock.unlock(); } }
/** * Gets the information about the queue item for the given project. * * @return null if the project is not in the queue. * @since 1.607 */
Gets the information about the queue item for the given project
liveGetItems
{ "repo_name": "stephenc/jenkins", "path": "core/src/main/java/hudson/model/Queue.java", "license": "mit", "size": 116868 }
[ "java.util.ArrayList", "java.util.List", "java.util.logging.Level" ]
import java.util.ArrayList; import java.util.List; import java.util.logging.Level;
import java.util.*; import java.util.logging.*;
[ "java.util" ]
java.util;
974,070
public void logReport(Logger logger) { this.initialiseLog(); for (String reportElement : this.report) { logger.logError(reportElement); } }
void function(Logger logger) { this.initialiseLog(); for (String reportElement : this.report) { logger.logError(reportElement); } }
/** * Prints the log using the specified logger. * @param logger The logger to log with. */
Prints the log using the specified logger
logReport
{ "repo_name": "Niadel/NiadelCommons", "path": "src/co/uk/niadel/commons/crash/CrashReport.java", "license": "gpl-2.0", "size": 3090 }
[ "co.uk.niadel.commons.logging.Logger" ]
import co.uk.niadel.commons.logging.Logger;
import co.uk.niadel.commons.logging.*;
[ "co.uk.niadel" ]
co.uk.niadel;
398,043
Result<Trade> getTrade() { CalculationTarget target = getTarget(); if (target instanceof Trade) { return Result.success((Trade) target); } return Result.failure(FailureReason.INVALID, "Calculaton target is not a trade"); }
Result<Trade> getTrade() { CalculationTarget target = getTarget(); if (target instanceof Trade) { return Result.success((Trade) target); } return Result.failure(FailureReason.INVALID, STR); }
/** * Returns the trade from the row. * * @return the trade from the row */
Returns the trade from the row
getTrade
{ "repo_name": "OpenGamma/Strata", "path": "modules/report/src/main/java/com/opengamma/strata/report/framework/expression/ResultsRow.java", "license": "apache-2.0", "size": 6795 }
[ "com.opengamma.strata.basics.CalculationTarget", "com.opengamma.strata.collect.result.FailureReason", "com.opengamma.strata.collect.result.Result", "com.opengamma.strata.product.Trade" ]
import com.opengamma.strata.basics.CalculationTarget; import com.opengamma.strata.collect.result.FailureReason; import com.opengamma.strata.collect.result.Result; import com.opengamma.strata.product.Trade;
import com.opengamma.strata.basics.*; import com.opengamma.strata.collect.result.*; import com.opengamma.strata.product.*;
[ "com.opengamma.strata" ]
com.opengamma.strata;
1,346,875
protected void showTabs() { if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); if (getContainer() instanceof CTabFolder) { ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); getContainer().setSize(point.x, point.y - 6); } } }
void function() { if (getPageCount() > 1) { setPageText(0, getString(STR)); if (getContainer() instanceof CTabFolder) { ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); getContainer().setSize(point.x, point.y - 6); } } }
/** * If there is more than one page in the multi-page editor part, * this shows the tabs at the bottom. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
If there is more than one page in the multi-page editor part, this shows the tabs at the bottom.
showTabs
{ "repo_name": "FraunhoferESK/ernest-eclipse-integration", "path": "de.fraunhofer.esk.ernest.core.analysismodel.editor/src/ernest/architecture/presentation/ArchitectureEditor.java", "license": "epl-1.0", "size": 57648 }
[ "org.eclipse.swt.custom.CTabFolder", "org.eclipse.swt.graphics.Point" ]
import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.custom.*; import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,419,328
public List<RunnerNode> getChildren() { return Collections.unmodifiableList(children); }
List<RunnerNode> function() { return Collections.unmodifiableList(children); }
/** Returns the children of this runner group. * @return The children of this runner group, as an unmodifiable list. */
Returns the children of this runner group
getChildren
{ "repo_name": "AludraTest/aludratest", "path": "src/main/java/org/aludratest/scheduler/node/RunnerGroup.java", "license": "apache-2.0", "size": 4650 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
229,198
public void controllerConnectionFailure(String message, IOException cause);
void function(String message, IOException cause);
/** * Receive an error notification that the controller connection has failed, which means any * further progress for any operation will not succeed. * @param message general information about the failure * @param cause the root cause */
Receive an error notification that the controller connection has failed, which means any further progress for any operation will not succeed
controllerConnectionFailure
{ "repo_name": "matteobertozzi/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/server/commit/distributed/controller/DistributedCommitControllerErrorListener.java", "license": "apache-2.0", "size": 1735 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
917,634
private boolean hasTipsAndTricks(AboutInfo[] infos) { for (int i = 0; i < infos.length; i++) { if (infos[i].getTipsAndTricksHref() != null) { return true; } } return false; }
boolean function(AboutInfo[] infos) { for (int i = 0; i < infos.length; i++) { if (infos[i].getTipsAndTricksHref() != null) { return true; } } return false; }
/** * Returns whether any of the given infos have tips and tricks. * * @param infos * the infos * @return <code>true</code> if tips and tricks were found, <code>false</code> if not */
Returns whether any of the given infos have tips and tricks
hasTipsAndTricks
{ "repo_name": "debrief/limpet", "path": "info.limpet.rcp/src/info/limpet/rcp/product/ApplicationActionBarAdvisor.java", "license": "epl-1.0", "size": 31323 }
[ "org.eclipse.ui.internal.ide.AboutInfo" ]
import org.eclipse.ui.internal.ide.AboutInfo;
import org.eclipse.ui.internal.ide.*;
[ "org.eclipse.ui" ]
org.eclipse.ui;
1,959,190
private void checkDbDeleted(String[] ids) throws JSONException { QuerySpec smartStoreQuery = QuerySpec.buildSmartQuerySpec("SELECT {accounts:_soup}, {accounts:Name} FROM {accounts} WHERE {accounts:Id} IN " + makeInClause(ids), ids.length); JSONArray accountsFromDb = smartStore.query(smartStoreQuery, 0); assertEquals("No accounts should have been returned from smartstore",0, accountsFromDb.length()); }
void function(String[] ids) throws JSONException { QuerySpec smartStoreQuery = QuerySpec.buildSmartQuerySpec(STR + makeInClause(ids), ids.length); JSONArray accountsFromDb = smartStore.query(smartStoreQuery, 0); assertEquals(STR,0, accountsFromDb.length()); }
/** * Check that records were deleted from db * @param ids * @throws JSONException */
Check that records were deleted from db
checkDbDeleted
{ "repo_name": "huminzhi/SalesforceMobileSDK-Android", "path": "libs/test/SmartSyncTest/src/com/salesforce/androidsdk/smartsync/manager/SyncManagerTest.java", "license": "apache-2.0", "size": 57743 }
[ "com.salesforce.androidsdk.smartstore.store.QuerySpec", "org.json.JSONArray", "org.json.JSONException" ]
import com.salesforce.androidsdk.smartstore.store.QuerySpec; import org.json.JSONArray; import org.json.JSONException;
import com.salesforce.androidsdk.smartstore.store.*; import org.json.*;
[ "com.salesforce.androidsdk", "org.json" ]
com.salesforce.androidsdk; org.json;
2,502,213
public static void main(String[] args) { try { if (args.length == 0) { System.out.println("USAGE: java bytecodeAnnotations.EntryLogger classname"); } else { JavaClass clazz = Repository.lookupClass(args[0]); ClassGen classGen = new ClassGen(clazz); EntryLogger entryLogger = new EntryLogger(classGen); entryLogger.convert(); String path = Repository.lookupClassFile(String.valueOf(classGen.getClass())).getPath(); System.out.println("Dumping " + path); classGen.getJavaClass().dump(path); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
static void function(String[] args) { try { if (args.length == 0) { System.out.println(STR); } else { JavaClass clazz = Repository.lookupClass(args[0]); ClassGen classGen = new ClassGen(clazz); EntryLogger entryLogger = new EntryLogger(classGen); entryLogger.convert(); String path = Repository.lookupClassFile(String.valueOf(classGen.getClass())).getPath(); System.out.println(STR + path); classGen.getJavaClass().dump(path); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
/** * Adds entry logging code for given class. * * @param args the name of class file to patch */
Adds entry logging code for given class
main
{ "repo_name": "Token3/books-source-code", "path": "corejava9/src/main/java/v2ch10/bytecodeAnnotatons/EntryLogger.java", "license": "gpl-3.0", "size": 4356 }
[ "java.io.IOException", "org.apache.bcel.Repository", "org.apache.bcel.classfile.JavaClass", "org.apache.bcel.generic.ClassGen" ]
import java.io.IOException; import org.apache.bcel.Repository; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.ClassGen;
import java.io.*; import org.apache.bcel.*; import org.apache.bcel.classfile.*; import org.apache.bcel.generic.*;
[ "java.io", "org.apache.bcel" ]
java.io; org.apache.bcel;
1,492,729
public void start(String originalText, TokenStream tokenStream);
void function(String originalText, TokenStream tokenStream);
/** * Initializes the Fragmenter. You can grab references to the Attributes you are * interested in from tokenStream and then access the values in {@link #isNewFragment()}. * * @param originalText the original source text * @param tokenStream the {@link TokenStream} to be fragmented */
Initializes the Fragmenter. You can grab references to the Attributes you are interested in from tokenStream and then access the values in <code>#isNewFragment()</code>
start
{ "repo_name": "smartan/lucene", "path": "src/main/java/org/apache/lucene/search/highlight/Fragmenter.java", "license": "apache-2.0", "size": 1795 }
[ "org.apache.lucene.analysis.TokenStream" ]
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.*;
[ "org.apache.lucene" ]
org.apache.lucene;
2,191,118
public static void info(final String message) { Logger logger = LoggerFactory.getLogger(getCallerClassName()); logger.info(message); }
static void function(final String message) { Logger logger = LoggerFactory.getLogger(getCallerClassName()); logger.info(message); }
/** * See {@link org.apache.log4j.Logger#info(Object)}. * * @param message * the message to log. */
See <code>org.apache.log4j.Logger#info(Object)</code>
info
{ "repo_name": "CloudBindle/youxia", "path": "youxia-common/src/main/java/io/cloudbindle/youxia/util/Log.java", "license": "gpl-3.0", "size": 8755 }
[ "org.slf4j.Logger", "org.slf4j.LoggerFactory" ]
import org.slf4j.Logger; import org.slf4j.LoggerFactory;
import org.slf4j.*;
[ "org.slf4j" ]
org.slf4j;
516,421
private boolean bridgeDiscovered(P1Telegram telegram) { ThingUID thingUID = new ThingUID(DSMRBindingConstants.THING_TYPE_DSMR_BRIDGE, Integer.toHexString(currentScannedPortName.hashCode())); // Construct the configuration for this meter Map<String, Object> properties = new HashMap<>(); properties.put("serialPort", currentScannedPortName); DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID) .withThingType(DSMRBindingConstants.THING_TYPE_DSMR_BRIDGE).withProperties(properties) .withLabel("@text/thing-type.dsmr.dsmrBridge.label").build(); logger.debug("[{}] discovery result:{}", currentScannedPortName, discoveryResult); thingDiscovered(discoveryResult); meterDetector.detectMeters(telegram).getKey().forEach(m -> meterDiscovered(m, thingUID)); return true; }
boolean function(P1Telegram telegram) { ThingUID thingUID = new ThingUID(DSMRBindingConstants.THING_TYPE_DSMR_BRIDGE, Integer.toHexString(currentScannedPortName.hashCode())); Map<String, Object> properties = new HashMap<>(); properties.put(STR, currentScannedPortName); DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID) .withThingType(DSMRBindingConstants.THING_TYPE_DSMR_BRIDGE).withProperties(properties) .withLabel(STR).build(); logger.debug(STR, currentScannedPortName, discoveryResult); thingDiscovered(discoveryResult); meterDetector.detectMeters(telegram).getKey().forEach(m -> meterDiscovered(m, thingUID)); return true; }
/** * * Therefore this method will always return true * * @return true if bridge is accepted, false otherwise */
Therefore this method will always return true
bridgeDiscovered
{ "repo_name": "gerrieg/openhab2", "path": "addons/binding/org.openhab.binding.dsmr/src/main/java/org/openhab/binding/dsmr/internal/discovery/DSMRBridgeDiscoveryService.java", "license": "epl-1.0", "size": 8868 }
[ "java.util.HashMap", "java.util.Map", "org.eclipse.smarthome.config.discovery.DiscoveryResult", "org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder", "org.eclipse.smarthome.core.thing.ThingUID", "org.openhab.binding.dsmr.internal.DSMRBindingConstants", "org.openhab.binding.dsmr.internal.device.p1telegram.P1Telegram" ]
import java.util.HashMap; import java.util.Map; import org.eclipse.smarthome.config.discovery.DiscoveryResult; import org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder; import org.eclipse.smarthome.core.thing.ThingUID; import org.openhab.binding.dsmr.internal.DSMRBindingConstants; import org.openhab.binding.dsmr.internal.device.p1telegram.P1Telegram;
import java.util.*; import org.eclipse.smarthome.config.discovery.*; import org.eclipse.smarthome.core.thing.*; import org.openhab.binding.dsmr.internal.*; import org.openhab.binding.dsmr.internal.device.p1telegram.*;
[ "java.util", "org.eclipse.smarthome", "org.openhab.binding" ]
java.util; org.eclipse.smarthome; org.openhab.binding;
1,364,743
public void deadlineButton(View v){ Date today = new Date(); new SlideDateTimePicker.Builder(getSupportFragmentManager()) .setListener(listener) .setInitialDate(new Date(today.getTime() + (1000 * 60 * 60 * 24))) //Tomorrow's date. .build() .show(); }
void function(View v){ Date today = new Date(); new SlideDateTimePicker.Builder(getSupportFragmentManager()) .setListener(listener) .setInitialDate(new Date(today.getTime() + (1000 * 60 * 60 * 24))) .build() .show(); }
/** * Listener method for the deadline Button * * @param v - the view that will be operated on. */
Listener method for the deadline Button
deadlineButton
{ "repo_name": "luxnova/ToDoList", "path": "app/src/main/java/itrellis/com/todolist/activities/CreateToDoActivity.java", "license": "apache-2.0", "size": 7122 }
[ "android.view.View", "com.github.jjobes.slidedatetimepicker.SlideDateTimePicker", "java.util.Date" ]
import android.view.View; import com.github.jjobes.slidedatetimepicker.SlideDateTimePicker; import java.util.Date;
import android.view.*; import com.github.jjobes.slidedatetimepicker.*; import java.util.*;
[ "android.view", "com.github.jjobes", "java.util" ]
android.view; com.github.jjobes; java.util;
567,064
@ServiceMethod(returns = ReturnType.SINGLE) Mono<List<MicrosoftGraphExtensionPropertyInner>> getAvailableExtensionPropertiesAsync( DevicesGetAvailableExtensionPropertiesRequestBody body);
@ServiceMethod(returns = ReturnType.SINGLE) Mono<List<MicrosoftGraphExtensionPropertyInner>> getAvailableExtensionPropertiesAsync( DevicesGetAvailableExtensionPropertiesRequestBody body);
/** * Invoke action getAvailableExtensionProperties. * * @param body Action parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is * rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return array of microsoft. */
Invoke action getAvailableExtensionProperties
getAvailableExtensionPropertiesAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/DevicesClient.java", "license": "mit", "size": 81714 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.authorization.fluent.models.DevicesGetAvailableExtensionPropertiesRequestBody", "com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphExtensionPropertyInner", "java.util.List" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.authorization.fluent.models.DevicesGetAvailableExtensionPropertiesRequestBody; import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphExtensionPropertyInner; import java.util.List;
import com.azure.core.annotation.*; import com.azure.resourcemanager.authorization.fluent.models.*; import java.util.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.util" ]
com.azure.core; com.azure.resourcemanager; java.util;
448,694
public Map.Entry<K, V> parseEntry(ByteString bytes, ExtensionRegistryLite extensionRegistry) throws IOException { return parseEntry(bytes.newCodedInput(), metadata, extensionRegistry); }
Map.Entry<K, V> function(ByteString bytes, ExtensionRegistryLite extensionRegistry) throws IOException { return parseEntry(bytes.newCodedInput(), metadata, extensionRegistry); }
/** * Parses an entry off of the input as a {@link Map.Entry}. This helper requires an allocation so * using {@link #parseInto} is preferred if possible. */
Parses an entry off of the input as a <code>Map.Entry</code>. This helper requires an allocation so using <code>#parseInto</code> is preferred if possible
parseEntry
{ "repo_name": "endlessm/chromium-browser", "path": "third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapEntryLite.java", "license": "bsd-3-clause", "size": 8762 }
[ "java.io.IOException", "java.util.Map" ]
import java.io.IOException; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
703,164
private void returnReferences(Transaction tx, AMQSession session) throws Exception { if (session == null || session.isClosed()) { return; } RefsOperation oper = (RefsOperation) tx.getProperty(TransactionPropertyIndexes.REFS_OPERATION); if (oper != null) { List<MessageReference> ackRefs = oper.getReferencesToAcknowledge(); for (ListIterator<MessageReference> referenceIterator = ackRefs.listIterator(ackRefs.size()); referenceIterator.hasPrevious(); ) { MessageReference ref = referenceIterator.previous(); ServerConsumer consumer = null; if (ref.hasConsumerId()) { consumer = session.getCoreSession().locateConsumer(ref.getConsumerId()); } if (consumer != null) { referenceIterator.remove(); ref.incrementDeliveryCount(); consumer.backToDelivering(ref); final AMQConsumer amqConsumer = (AMQConsumer) consumer.getProtocolData(); amqConsumer.addRolledback(ref); } } } }
void function(Transaction tx, AMQSession session) throws Exception { if (session == null session.isClosed()) { return; } RefsOperation oper = (RefsOperation) tx.getProperty(TransactionPropertyIndexes.REFS_OPERATION); if (oper != null) { List<MessageReference> ackRefs = oper.getReferencesToAcknowledge(); for (ListIterator<MessageReference> referenceIterator = ackRefs.listIterator(ackRefs.size()); referenceIterator.hasPrevious(); ) { MessageReference ref = referenceIterator.previous(); ServerConsumer consumer = null; if (ref.hasConsumerId()) { consumer = session.getCoreSession().locateConsumer(ref.getConsumerId()); } if (consumer != null) { referenceIterator.remove(); ref.incrementDeliveryCount(); consumer.backToDelivering(ref); final AMQConsumer amqConsumer = (AMQConsumer) consumer.getProtocolData(); amqConsumer.addRolledback(ref); } } } }
/** * Openwire will redeliver rolled back references. * We need to return those here. */
Openwire will redeliver rolled back references. We need to return those here
returnReferences
{ "repo_name": "clebertsuconic/activemq-artemis", "path": "artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java", "license": "apache-2.0", "size": 67055 }
[ "java.util.List", "java.util.ListIterator", "org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConsumer", "org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSession", "org.apache.activemq.artemis.core.server.MessageReference", "org.apache.activemq.artemis.core.server.ServerConsumer", "org.apache.activemq.artemis.core.server.impl.RefsOperation", "org.apache.activemq.artemis.core.transaction.Transaction", "org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes" ]
import java.util.List; import java.util.ListIterator; import org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConsumer; import org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSession; import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.server.ServerConsumer; import org.apache.activemq.artemis.core.server.impl.RefsOperation; import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes;
import java.util.*; import org.apache.activemq.artemis.core.protocol.openwire.amq.*; import org.apache.activemq.artemis.core.server.*; import org.apache.activemq.artemis.core.server.impl.*; import org.apache.activemq.artemis.core.transaction.*;
[ "java.util", "org.apache.activemq" ]
java.util; org.apache.activemq;
1,929,391
public void zkDelete(String path, boolean recursive, BackgroundCallback backgroundCallback) throws IOException { checkServiceLive(); String fullpath = createFullPath(path); try { if (LOG.isDebugEnabled()) { LOG.debug("Deleting {}", fullpath); } DeleteBuilder delete = curator.delete(); if (recursive) { delete.deletingChildrenIfNeeded(); } if (backgroundCallback != null) { delete.inBackground(backgroundCallback); } delete.forPath(fullpath); } catch (KeeperException.NoNodeException e) { // not an error } catch (Exception e) { throw operationFailure(fullpath, "delete()", e); } }
void function(String path, boolean recursive, BackgroundCallback backgroundCallback) throws IOException { checkServiceLive(); String fullpath = createFullPath(path); try { if (LOG.isDebugEnabled()) { LOG.debug(STR, fullpath); } DeleteBuilder delete = curator.delete(); if (recursive) { delete.deletingChildrenIfNeeded(); } if (backgroundCallback != null) { delete.inBackground(backgroundCallback); } delete.forPath(fullpath); } catch (KeeperException.NoNodeException e) { } catch (Exception e) { throw operationFailure(fullpath, STR, e); } }
/** * Delete a directory/directory tree. * It is not an error to delete a path that does not exist * @param path path of operation * @param recursive flag to trigger recursive deletion * @param backgroundCallback callback; this being set converts the operation * into an async/background operation. * task * @throws IOException on problems other than no-such-path */
Delete a directory/directory tree. It is not an error to delete a path that does not exist
zkDelete
{ "repo_name": "bruthe/hadoop-2.6.0r", "path": "src/yarn/registry/org/apache/hadoop/registry/client/impl/zk/CuratorService.java", "license": "apache-2.0", "size": 23994 }
[ "java.io.IOException", "org.apache.curator.framework.api.BackgroundCallback", "org.apache.curator.framework.api.DeleteBuilder", "org.apache.zookeeper.KeeperException" ]
import java.io.IOException; import org.apache.curator.framework.api.BackgroundCallback; import org.apache.curator.framework.api.DeleteBuilder; import org.apache.zookeeper.KeeperException;
import java.io.*; import org.apache.curator.framework.api.*; import org.apache.zookeeper.*;
[ "java.io", "org.apache.curator", "org.apache.zookeeper" ]
java.io; org.apache.curator; org.apache.zookeeper;
1,726,089
private void dispatchEvent(KeyEvent keyEvent) { // Gets the active text edition area AcideTextComponent textPane = AcideMainWindow.getInstance() .getFileEditorManager().getSelectedFileEditorPanel() .getActiveTextEditionArea(); // Gets the view port from the text pane parent JViewport viewport = (JViewport) textPane.getParent(); // Gets the view rectangle from it Rectangle rectangle = viewport.getViewRect(); // Gets the location Point point = rectangle.getLocation(); // Calculates the increment for the line by line scrolling int increment = textPane.getFontMetrics(textPane.getFont()).getHeight() / 2; // Control + Up key if (keyEvent.isControlDown() && keyEvent.getKeyCode() == KeyEvent.VK_UP) { // Calculates the new position point.y = (point.y - increment >= 0) ? point.y - increment : 0; } // Control + Down key if (keyEvent.isControlDown() && keyEvent.getKeyCode() == KeyEvent.VK_DOWN) { // Calculates the maximum value for the y coordinate int maxY = viewport.getView().getHeight() - rectangle.height; // Calculates the new position point.y = (point.y + increment <= maxY) ? point.y + increment : maxY; } // Updates the location viewport.setViewPosition(point); }
void function(KeyEvent keyEvent) { AcideTextComponent textPane = AcideMainWindow.getInstance() .getFileEditorManager().getSelectedFileEditorPanel() .getActiveTextEditionArea(); JViewport viewport = (JViewport) textPane.getParent(); Rectangle rectangle = viewport.getViewRect(); Point point = rectangle.getLocation(); int increment = textPane.getFontMetrics(textPane.getFont()).getHeight() / 2; if (keyEvent.isControlDown() && keyEvent.getKeyCode() == KeyEvent.VK_UP) { point.y = (point.y - increment >= 0) ? point.y - increment : 0; } if (keyEvent.isControlDown() && keyEvent.getKeyCode() == KeyEvent.VK_DOWN) { int maxY = viewport.getView().getHeight() - rectangle.height; point.y = (point.y + increment <= maxY) ? point.y + increment : maxY; } viewport.setViewPosition(point); }
/** * Dispatches the key event. * * @param keyEvent * key event. */
Dispatches the key event
dispatchEvent
{ "repo_name": "salcedonia/acide-0-8-release-2010-2011", "path": "acide/src/acide/gui/fileEditor/fileEditorPanel/fileEditorTextEditionArea/listeners/AcideFileEditorScrollPaneKeyListener.java", "license": "gpl-3.0", "size": 4273 }
[ "java.awt.Point", "java.awt.Rectangle", "java.awt.event.KeyEvent", "javax.swing.JViewport" ]
import java.awt.Point; import java.awt.Rectangle; import java.awt.event.KeyEvent; import javax.swing.JViewport;
import java.awt.*; import java.awt.event.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
2,675,328
protected boolean limitsMatch(List<AwardBudgetLimit> awardLimits, List<AwardBudgetLimit> budgetLimits) { if (awardLimits.size() < budgetLimits.size()) { getAuditWarnings().add(new AuditError("document.budget.awardBudgetLimits", KeyConstants.AUDIT_ERROR_COST_LIMITS_CHANGED, Constants.BUDGET_PERIOD_PAGE + "." + "BudgetPeriodsTotals")); return true; } for (AwardBudgetLimit limit : awardLimits) { AwardBudgetLimit budgetLimit = getBudgetLimit(limit.getLimitType(), budgetLimits); if (budgetLimit == null || !org.apache.commons.lang3.ObjectUtils.equals(limit.getLimit(), budgetLimit.getLimit())) { getAuditWarnings().add(new AuditError("document.budget.awardBudgetLimits", KeyConstants.AUDIT_ERROR_SPECIFIC_COST_LIMITS_CHANGED, Constants.BUDGET_PERIOD_PAGE + "." + "BudgetPeriodsTotals", new String[]{budgetLimit.getLimitType().getDesc(), budgetLimit == null || budgetLimit.getLimit() == null ? "N/A" : budgetLimit.getLimit().toString(), limit == null || limit.getLimit() == null ? "N/A" : limit.getLimit().toString()})); } } return true; }
boolean function(List<AwardBudgetLimit> awardLimits, List<AwardBudgetLimit> budgetLimits) { if (awardLimits.size() < budgetLimits.size()) { getAuditWarnings().add(new AuditError(STR, KeyConstants.AUDIT_ERROR_COST_LIMITS_CHANGED, Constants.BUDGET_PERIOD_PAGE + "." + STR)); return true; } for (AwardBudgetLimit limit : awardLimits) { AwardBudgetLimit budgetLimit = getBudgetLimit(limit.getLimitType(), budgetLimits); if (budgetLimit == null !org.apache.commons.lang3.ObjectUtils.equals(limit.getLimit(), budgetLimit.getLimit())) { getAuditWarnings().add(new AuditError(STR, KeyConstants.AUDIT_ERROR_SPECIFIC_COST_LIMITS_CHANGED, Constants.BUDGET_PERIOD_PAGE + "." + STR, new String[]{budgetLimit.getLimitType().getDesc(), budgetLimit == null budgetLimit.getLimit() == null ? "N/A" : budgetLimit.getLimit().toString(), limit == null limit.getLimit() == null ? "N/A" : limit.getLimit().toString()})); } } return true; }
/** * * Compares the budget limit lists to make sure they match. * @param awardLimits * @param budgetLimits * @return */
Compares the budget limit lists to make sure they match
limitsMatch
{ "repo_name": "sanjupolus/kc-coeus-1508.3", "path": "coeus-impl/src/main/java/org/kuali/kra/award/budget/AwardBudgetCostLimitAuditRule.java", "license": "agpl-3.0", "size": 9297 }
[ "java.util.List", "org.kuali.kra.infrastructure.Constants", "org.kuali.kra.infrastructure.KeyConstants", "org.kuali.rice.krad.util.AuditError", "org.kuali.rice.krad.util.ObjectUtils" ]
import java.util.List; import org.kuali.kra.infrastructure.Constants; import org.kuali.kra.infrastructure.KeyConstants; import org.kuali.rice.krad.util.AuditError; import org.kuali.rice.krad.util.ObjectUtils;
import java.util.*; import org.kuali.kra.infrastructure.*; import org.kuali.rice.krad.util.*;
[ "java.util", "org.kuali.kra", "org.kuali.rice" ]
java.util; org.kuali.kra; org.kuali.rice;
2,637,363
@Test public void testLoadPropertiesOk() throws Exception { Properties props; props = new Properties(); props.setProperty("set1", TestModelRoot.class.getName() + ":intProperty,secondLevelModelProperty.int2Property " + ",thirdLevelModelProperty.string3Property " + ",secondLevelModelProperty.thirdLevel2ModelProperty.string3Property " + ",stringProperty"); props.setProperty("set2", TestModelSecondLevel.class.getName() + ":int2Property,string2Property"); registry.loadFromProperties(props); Assert.assertFalse(registry.isEmpty()); Assert.assertEquals(2, registry.size()); Assert.assertTrue(registry.containsSet("set1")); Assert.assertTrue(registry.containsSet("set2")); }
void function() throws Exception { Properties props; props = new Properties(); props.setProperty("set1", TestModelRoot.class.getName() + STR + STR + STR + STR); props.setProperty("set2", TestModelSecondLevel.class.getName() + STR); registry.loadFromProperties(props); Assert.assertFalse(registry.isEmpty()); Assert.assertEquals(2, registry.size()); Assert.assertTrue(registry.containsSet("set1")); Assert.assertTrue(registry.containsSet("set2")); }
/** * Test {@link SetRegistryDefaultImpl#loadFromResource(org.springframework.core.io.Resource)} without errors. */
Test <code>SetRegistryDefaultImpl#loadFromResource(org.springframework.core.io.Resource)</code> without errors
testLoadPropertiesOk
{ "repo_name": "albirar/framework", "path": "core/src/test/java/cat/albirar/framework/sets/registry/impl/SetRegistryDefaultImplTest.java", "license": "gpl-3.0", "size": 19918 }
[ "cat.albirar.framework.sets.impl.models.TestModelRoot", "cat.albirar.framework.sets.impl.models.TestModelSecondLevel", "java.util.Properties", "org.junit.Assert" ]
import cat.albirar.framework.sets.impl.models.TestModelRoot; import cat.albirar.framework.sets.impl.models.TestModelSecondLevel; import java.util.Properties; import org.junit.Assert;
import cat.albirar.framework.sets.impl.models.*; import java.util.*; import org.junit.*;
[ "cat.albirar.framework", "java.util", "org.junit" ]
cat.albirar.framework; java.util; org.junit;
1,738,578
public void renameStreamRecord(int dirId, int fid, int stid, String newName) throws DBException { // TODO Auto-generated method stub }
void function(int dirId, int fid, int stid, String newName) throws DBException { }
/** * Rename a file stream * * @param dirId int * @param fid int * @param stid int * @param newName * @exception DBException */
Rename a file stream
renameStreamRecord
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/alfresco-jlan/source/java/org/alfresco/jlan/server/filesys/db/mysql/MySQLDBInterface.java", "license": "lgpl-3.0", "size": 104504 }
[ "org.alfresco.jlan.server.filesys.db.DBException" ]
import org.alfresco.jlan.server.filesys.db.DBException;
import org.alfresco.jlan.server.filesys.db.*;
[ "org.alfresco.jlan" ]
org.alfresco.jlan;
530,360
public long estimateMemoryOverhead(SingleObjectSizer sizer) { long size = sizer.sizeof(this); if (isApplicationTableOrGlobalIndex()) { size += this.region.estimateMemoryOverhead(sizer); } else { assert isLocalIndex(); // nothing, use estimateEntryOverhead(...) on ConcurrentSkipList for better // break down of local index overhead. } return size; } public static final class SerializableDelta extends GfxdDataSerializable implements Delta, Sizeable { private DataValueDescriptor[] changedRow; private FormatableBitSet validColumns; private transient int deltaSize = -1; private transient VersionTag<?> versionTag; private static final byte HAS_FBS = 0x1; private static final byte HAS_VERSION_TAG = 0x2; private static final byte HAS_PERSISTENT_VERSION_TAG = 0x4; public SerializableDelta() { } public SerializableDelta(final DataValueDescriptor[] changedRow, final FormatableBitSet validColumns) { this.changedRow = changedRow; this.validColumns = validColumns; }
long function(SingleObjectSizer sizer) { long size = sizer.sizeof(this); if (isApplicationTableOrGlobalIndex()) { size += this.region.estimateMemoryOverhead(sizer); } else { assert isLocalIndex(); } return size; } public static final class SerializableDelta extends GfxdDataSerializable implements Delta, Sizeable { private DataValueDescriptor[] changedRow; private FormatableBitSet validColumns; private transient int deltaSize = -1; private transient VersionTag<?> versionTag; private static final byte HAS_FBS = 0x1; private static final byte HAS_VERSION_TAG = 0x2; private static final byte HAS_PERSISTENT_VERSION_TAG = 0x4; public SerializableDelta() { } public SerializableDelta(final DataValueDescriptor[] changedRow, final FormatableBitSet validColumns) { this.changedRow = changedRow; this.validColumns = validColumns; }
/** * This returns memory overhead excluding individual entry sizes. Just additional * memory consumed by this data structure. * * @param sizer The sizer object that is to be used for estimating objects. * @return */
This returns memory overhead excluding individual entry sizes. Just additional memory consumed by this data structure
estimateMemoryOverhead
{ "repo_name": "papicella/snappy-store", "path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/engine/store/GemFireContainer.java", "license": "apache-2.0", "size": 239877 }
[ "com.gemstone.gemfire.internal.cache.delta.Delta", "com.gemstone.gemfire.internal.cache.lru.Sizeable", "com.gemstone.gemfire.internal.cache.versions.VersionTag", "com.gemstone.gemfire.internal.size.SingleObjectSizer", "com.pivotal.gemfirexd.internal.engine.GfxdDataSerializable", "com.pivotal.gemfirexd.internal.iapi.services.io.FormatableBitSet", "com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor" ]
import com.gemstone.gemfire.internal.cache.delta.Delta; import com.gemstone.gemfire.internal.cache.lru.Sizeable; import com.gemstone.gemfire.internal.cache.versions.VersionTag; import com.gemstone.gemfire.internal.size.SingleObjectSizer; import com.pivotal.gemfirexd.internal.engine.GfxdDataSerializable; import com.pivotal.gemfirexd.internal.iapi.services.io.FormatableBitSet; import com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor;
import com.gemstone.gemfire.internal.cache.delta.*; import com.gemstone.gemfire.internal.cache.lru.*; import com.gemstone.gemfire.internal.cache.versions.*; import com.gemstone.gemfire.internal.size.*; import com.pivotal.gemfirexd.internal.engine.*; import com.pivotal.gemfirexd.internal.iapi.services.io.*; import com.pivotal.gemfirexd.internal.iapi.types.*;
[ "com.gemstone.gemfire", "com.pivotal.gemfirexd" ]
com.gemstone.gemfire; com.pivotal.gemfirexd;
24,448
public static SelectorText.Builder builder(Text text, Selector selector) { return new SelectorText.Builder(text, selector); }
static SelectorText.Builder function(Text text, Selector selector) { return new SelectorText.Builder(text, selector); }
/** * Creates a new {@link SelectorText.Builder} with the formatting and * actions of the specified {@link Text} and the given selector. * * @param text The text to apply the properties from * @param selector The selector for the builder * @return The created text builder * @see SelectorText * @see SelectorText.Builder */
Creates a new <code>SelectorText.Builder</code> with the formatting and actions of the specified <code>Text</code> and the given selector
builder
{ "repo_name": "JBYoshi/SpongeAPI", "path": "src/main/java/org/spongepowered/api/text/Text.java", "license": "mit", "size": 42927 }
[ "org.spongepowered.api.text.selector.Selector" ]
import org.spongepowered.api.text.selector.Selector;
import org.spongepowered.api.text.selector.*;
[ "org.spongepowered.api" ]
org.spongepowered.api;
2,159,658
private IAnswerData preloadDate(String preloadParams) { Date d = null; if (preloadParams.equals("today")) { d = new Date(); } else if (preloadParams.substring(0, 11).equals("prevperiod-")) { List<String> v = DateUtils.split(preloadParams.substring(11), "-", false); String[] params = new String[v.size()]; for (int i = 0; i < params.length; i++) params[i] = (String)v.get(i); try { String type = params[0]; String start = params[1]; boolean beginning; if (params[2].equals("head")) beginning = true; else if (params[2].equals("tail")) beginning = false; else throw new RuntimeException(); boolean includeToday; if (params.length >= 4) { if (params[3].equals("x")) includeToday = true; else if (params[3].equals("")) includeToday = false; else throw new RuntimeException(); } else { includeToday = false; } int nAgo; if (params.length >= 5) { nAgo = Integer.parseInt(params[4]); } else { nAgo = 1; } d = DateUtils.getPastPeriodDate(new Date(), type, start, beginning, includeToday, nAgo); } catch (Exception e) { throw new IllegalArgumentException("invalid preload params for preload mode 'date'"); } } DateData data = new DateData(d); return data; }
IAnswerData function(String preloadParams) { Date d = null; if (preloadParams.equals("today")) { d = new Date(); } else if (preloadParams.substring(0, 11).equals(STR)) { List<String> v = DateUtils.split(preloadParams.substring(11), "-", false); String[] params = new String[v.size()]; for (int i = 0; i < params.length; i++) params[i] = (String)v.get(i); try { String type = params[0]; String start = params[1]; boolean beginning; if (params[2].equals("head")) beginning = true; else if (params[2].equals("tail")) beginning = false; else throw new RuntimeException(); boolean includeToday; if (params.length >= 4) { if (params[3].equals("x")) includeToday = true; else if (params[3].equals(STRinvalid preload params for preload mode 'date'"); } } DateData data = new DateData(d); return data; }
/** * Preloads a DateData object for the preload type 'date' * * @param preloadParams The parameters determining the date * @return A preload date value if the parameters can be parsed, * null otherwise */
Preloads a DateData object for the preload type 'date'
preloadDate
{ "repo_name": "medic/javarosa", "path": "core/src/org/javarosa/core/model/utils/QuestionPreloader.java", "license": "apache-2.0", "size": 8271 }
[ "java.util.Date", "java.util.List", "org.javarosa.core.model.data.DateData", "org.javarosa.core.model.data.IAnswerData" ]
import java.util.Date; import java.util.List; import org.javarosa.core.model.data.DateData; import org.javarosa.core.model.data.IAnswerData;
import java.util.*; import org.javarosa.core.model.data.*;
[ "java.util", "org.javarosa.core" ]
java.util; org.javarosa.core;
1,774,689
public boolean hasListener(EventListener listener) { return listenerList.contains(listener); }
boolean function(EventListener listener) { return listenerList.contains(listener); }
/** * Returns <code>true</code> if the specified object is registered with * the dataset as a listener. Most applications won't need to call this * method, it exists mainly for use by unit testing code. * * @param listener the listener. * * @return A boolean. */
Returns <code>true</code> if the specified object is registered with the dataset as a listener. Most applications won't need to call this method, it exists mainly for use by unit testing code
hasListener
{ "repo_name": "djun100/afreechart", "path": "src/org/afree/chart/axis/Axis.java", "license": "lgpl-3.0", "size": 47554 }
[ "java.util.EventListener" ]
import java.util.EventListener;
import java.util.*;
[ "java.util" ]
java.util;
552,673
public DiagnosticContractInner withBackend(PipelineDiagnosticSettings backend) { if (this.innerProperties() == null) { this.innerProperties = new DiagnosticContractProperties(); } this.innerProperties().withBackend(backend); return this; }
DiagnosticContractInner function(PipelineDiagnosticSettings backend) { if (this.innerProperties() == null) { this.innerProperties = new DiagnosticContractProperties(); } this.innerProperties().withBackend(backend); return this; }
/** * Set the backend property: Diagnostic settings for incoming/outgoing HTTP messages to the Backend. * * @param backend the backend value to set. * @return the DiagnosticContractInner object itself. */
Set the backend property: Diagnostic settings for incoming/outgoing HTTP messages to the Backend
withBackend
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/fluent/models/DiagnosticContractInner.java", "license": "mit", "size": 9339 }
[ "com.azure.resourcemanager.apimanagement.models.PipelineDiagnosticSettings" ]
import com.azure.resourcemanager.apimanagement.models.PipelineDiagnosticSettings;
import com.azure.resourcemanager.apimanagement.models.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
2,005,438
public com.google.common.util.concurrent.ListenableFuture<com.google.cloud.language.v1.ClassifyTextResponse> classifyText( com.google.cloud.language.v1.ClassifyTextRequest request) { return futureUnaryCall( getChannel().newCall(getClassifyTextMethodHelper(), getCallOptions()), request); }
com.google.common.util.concurrent.ListenableFuture<com.google.cloud.language.v1.ClassifyTextResponse> function( com.google.cloud.language.v1.ClassifyTextRequest request) { return futureUnaryCall( getChannel().newCall(getClassifyTextMethodHelper(), getCallOptions()), request); }
/** * <pre> * Classifies a document into categories. * </pre> */
<code> Classifies a document into categories. </code>
classifyText
{ "repo_name": "pongad/api-client-staging", "path": "generated/java/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java", "license": "bsd-3-clause", "size": 38611 }
[ "io.grpc.stub.ClientCalls" ]
import io.grpc.stub.ClientCalls;
import io.grpc.stub.*;
[ "io.grpc.stub" ]
io.grpc.stub;
1,519,698
public AzureEnvironment getEnvironment() { return this.environment == null ? DEFAULT_ENVIRONMENT : parseEnvironment(this.environment); }
AzureEnvironment function() { return this.environment == null ? DEFAULT_ENVIRONMENT : parseEnvironment(this.environment); }
/** * The particular Azure environment (see {@link AzureEnvironment}) to * authenticate against. One of: {@code AZURE}, {@code AZURE_CHINA}, * {@code AZURE_US_GOVERNMENT}, {@code AZURE_GERMANY}. * * @return */
The particular Azure environment (see <code>AzureEnvironment</code>) to authenticate against. One of: AZURE, AZURE_CHINA, AZURE_US_GOVERNMENT, AZURE_GERMANY
getEnvironment
{ "repo_name": "elastisys/scale.cloudpool", "path": "azure/src/main/java/com/elastisys/scale/cloudpool/azure/driver/config/AzureAuth.java", "license": "apache-2.0", "size": 6618 }
[ "com.microsoft.azure.AzureEnvironment" ]
import com.microsoft.azure.AzureEnvironment;
import com.microsoft.azure.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,712,110
@Test void testGetImplementationUnknown() { assertCause(() -> configurer.getImplementation(Object.class, "unknown"), ClassNotFoundException.class); }
void testGetImplementationUnknown() { assertCause(() -> configurer.getImplementation(Object.class, STR), ClassNotFoundException.class); }
/** * Test the get implementation using unknown class. */
Test the get implementation using unknown class
testGetImplementationUnknown
{ "repo_name": "b3dgs/lionengine", "path": "lionengine-game/src/test/java/com/b3dgs/lionengine/game/ConfigurerTest.java", "license": "gpl-3.0", "size": 13471 }
[ "com.b3dgs.lionengine.UtilAssert" ]
import com.b3dgs.lionengine.UtilAssert;
import com.b3dgs.lionengine.*;
[ "com.b3dgs.lionengine" ]
com.b3dgs.lionengine;
2,776,151
public void setGroups(Map<String, Group> groups) { this.groups = groups; }
void function(Map<String, Group> groups) { this.groups = groups; }
/** * Set the user's groups */
Set the user's groups
setGroups
{ "repo_name": "Wundero/Ray", "path": "src/main/java/me/Wundero/Ray/framework/player/RayPlayer.java", "license": "mit", "size": 12192 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,219,952
public ArrayList<String> getGeneList() { return geneList; }
ArrayList<String> function() { return geneList; }
/** * Gets the Gene List. * * @return ArrayList of Gene Symbols. */
Gets the Gene List
getGeneList
{ "repo_name": "bihealth/cbioportal", "path": "core/src/main/java/org/mskcc/cbio/portal/model/DownloadLink.java", "license": "agpl-3.0", "size": 2964 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,554,697
public WriteFiles<UserT, DestinationT, OutputT> withNumShards( ValueProvider<Integer> numShardsProvider) { return toBuilder().setNumShardsProvider(numShardsProvider).build(); }
WriteFiles<UserT, DestinationT, OutputT> function( ValueProvider<Integer> numShardsProvider) { return toBuilder().setNumShardsProvider(numShardsProvider).build(); }
/** * Returns a new {@link WriteFiles} that will write to the current {@link FileBasedSink} using the * {@link ValueProvider} specified number of shards. * * <p>This option should be used sparingly as it can hurt performance. See {@link WriteFiles} for * more information. */
Returns a new <code>WriteFiles</code> that will write to the current <code>FileBasedSink</code> using the <code>ValueProvider</code> specified number of shards. This option should be used sparingly as it can hurt performance. See <code>WriteFiles</code> for more information
withNumShards
{ "repo_name": "lukecwik/incubator-beam", "path": "sdks/java/core/src/main/java/org/apache/beam/sdk/io/WriteFiles.java", "license": "apache-2.0", "size": 46885 }
[ "org.apache.beam.sdk.options.ValueProvider" ]
import org.apache.beam.sdk.options.ValueProvider;
import org.apache.beam.sdk.options.*;
[ "org.apache.beam" ]
org.apache.beam;
1,543,959
@SideOnly(Side.CLIENT) public boolean isInRangeToRenderDist(double distance) { double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D; if (Double.isNaN(d0)) { d0 = 4.0D; } d0 = d0 * 64.0D; return distance < d0 * d0; } public EntityFireball(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ) { super(worldIn); this.setSize(1.0F, 1.0F); this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); this.setPosition(x, y, z); double d0 = (double)MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ); this.accelerationX = accelX / d0 * 0.1D; this.accelerationY = accelY / d0 * 0.1D; this.accelerationZ = accelZ / d0 * 0.1D; } public EntityFireball(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ) { super(worldIn); this.shootingEntity = shooter; this.setSize(1.0F, 1.0F); this.setLocationAndAngles(shooter.posX, shooter.posY, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); this.setPosition(this.posX, this.posY, this.posZ); this.motionX = this.motionY = this.motionZ = 0.0D; accelX = accelX + this.rand.nextGaussian() * 0.4D; accelY = accelY + this.rand.nextGaussian() * 0.4D; accelZ = accelZ + this.rand.nextGaussian() * 0.4D; double d0 = (double)MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ); this.accelerationX = accelX / d0 * 0.1D; this.accelerationY = accelY / d0 * 0.1D; this.accelerationZ = accelZ / d0 * 0.1D; }
@SideOnly(Side.CLIENT) boolean function(double distance) { double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D; if (Double.isNaN(d0)) { d0 = 4.0D; } d0 = d0 * 64.0D; return distance < d0 * d0; } public EntityFireball(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ) { super(worldIn); this.setSize(1.0F, 1.0F); this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); this.setPosition(x, y, z); double d0 = (double)MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ); this.accelerationX = accelX / d0 * 0.1D; this.accelerationY = accelY / d0 * 0.1D; this.accelerationZ = accelZ / d0 * 0.1D; } public EntityFireball(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ) { super(worldIn); this.shootingEntity = shooter; this.setSize(1.0F, 1.0F); this.setLocationAndAngles(shooter.posX, shooter.posY, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); this.setPosition(this.posX, this.posY, this.posZ); this.motionX = this.motionY = this.motionZ = 0.0D; accelX = accelX + this.rand.nextGaussian() * 0.4D; accelY = accelY + this.rand.nextGaussian() * 0.4D; accelZ = accelZ + this.rand.nextGaussian() * 0.4D; double d0 = (double)MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ); this.accelerationX = accelX / d0 * 0.1D; this.accelerationY = accelY / d0 * 0.1D; this.accelerationZ = accelZ / d0 * 0.1D; }
/** * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge * length * 64 * renderDistanceWeight Args: distance */
Checks if the entity is in range to render by using the past in distance and comparing it to its average edge length * 64 * renderDistanceWeight Args: distance
isInRangeToRenderDist
{ "repo_name": "aebert1/BigTransport", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/projectile/EntityFireball.java", "license": "gpl-3.0", "size": 10501 }
[ "net.minecraft.entity.EntityLivingBase", "net.minecraft.util.math.MathHelper", "net.minecraft.world.World", "net.minecraftforge.fml.relauncher.Side", "net.minecraftforge.fml.relauncher.SideOnly" ]
import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.entity.*; import net.minecraft.util.math.*; import net.minecraft.world.*; import net.minecraftforge.fml.relauncher.*;
[ "net.minecraft.entity", "net.minecraft.util", "net.minecraft.world", "net.minecraftforge.fml" ]
net.minecraft.entity; net.minecraft.util; net.minecraft.world; net.minecraftforge.fml;
1,612,709
public void loadPluginRegistry() throws KettlePluginException { }
void function() throws KettlePluginException { }
/** * Loads the plugin registry. * * @throws KettlePluginException if any errors are encountered while loading the plugin registry. */
Loads the plugin registry
loadPluginRegistry
{ "repo_name": "nicoben/pentaho-kettle", "path": "engine/src/org/pentaho/di/core/KettleEnvironment.java", "license": "apache-2.0", "size": 8775 }
[ "org.pentaho.di.core.exception.KettlePluginException" ]
import org.pentaho.di.core.exception.KettlePluginException;
import org.pentaho.di.core.exception.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,099,572
public static String getLabel(ComponentJob job, boolean includeDescriptorName, boolean includeInputColumnNames, boolean includeRequirements) { final String jobName = job.getName(); final StringBuilder label = new StringBuilder(); if (Strings.isNullOrEmpty(jobName)) { ComponentDescriptor<?> descriptor = job.getDescriptor(); String baseName = descriptor.getDisplayName(); if (ReflectionUtils.is(descriptor.getComponentClass(), HasLabelAdvice.class)) { try { HasLabelAdvice c = (HasLabelAdvice) descriptor.newInstance(); LifeCycleHelper lch = new LifeCycleHelper((DataCleanerConfiguration) null, (AnalysisJob) null, false); lch.assignConfiguredProperties(descriptor, c, job.getConfiguration()); String suggestedLabel = c.getSuggestedLabel(); if(!StringUtils.isNullOrEmpty(suggestedLabel)) { baseName = suggestedLabel; } } catch (Exception e) { // Ignore. } } label.append(baseName); } else { label.append(jobName); } if (job instanceof AnalyzerJob) { AnalyzerJob analyzerJob = (AnalyzerJob) job; if (includeDescriptorName && !Strings.isNullOrEmpty(jobName)) { label.append(" ("); label.append(analyzerJob.getDescriptor().getDisplayName()); label.append(')'); } final InputColumn<?>[] input = analyzerJob.getInput(); if (input.length == 1) { if (input[0].getName().equals(jobName)) { // special case where jobName is the same as the single // input column - in that case we'll leave out the column // name includeInputColumnNames = false; } } if (includeInputColumnNames && input.length > 0) { label.append(" ("); if (input.length < 5) { for (int i = 0; i < input.length; i++) { if (i != 0) { label.append(','); } label.append(input[i].getName()); } } else { label.append(input.length); label.append(" columns"); } label.append(")"); } final ComponentRequirement requirement = analyzerJob.getComponentRequirement(); if (includeRequirements && requirement != null) { if (!(requirement instanceof AnyComponentRequirement)) { label.append(" ("); label.append(requirement.toString()); label.append(")"); } } } return label.toString(); }
static String function(ComponentJob job, boolean includeDescriptorName, boolean includeInputColumnNames, boolean includeRequirements) { final String jobName = job.getName(); final StringBuilder label = new StringBuilder(); if (Strings.isNullOrEmpty(jobName)) { ComponentDescriptor<?> descriptor = job.getDescriptor(); String baseName = descriptor.getDisplayName(); if (ReflectionUtils.is(descriptor.getComponentClass(), HasLabelAdvice.class)) { try { HasLabelAdvice c = (HasLabelAdvice) descriptor.newInstance(); LifeCycleHelper lch = new LifeCycleHelper((DataCleanerConfiguration) null, (AnalysisJob) null, false); lch.assignConfiguredProperties(descriptor, c, job.getConfiguration()); String suggestedLabel = c.getSuggestedLabel(); if(!StringUtils.isNullOrEmpty(suggestedLabel)) { baseName = suggestedLabel; } } catch (Exception e) { } } label.append(baseName); } else { label.append(jobName); } if (job instanceof AnalyzerJob) { AnalyzerJob analyzerJob = (AnalyzerJob) job; if (includeDescriptorName && !Strings.isNullOrEmpty(jobName)) { label.append(STR); label.append(analyzerJob.getDescriptor().getDisplayName()); label.append(')'); } final InputColumn<?>[] input = analyzerJob.getInput(); if (input.length == 1) { if (input[0].getName().equals(jobName)) { includeInputColumnNames = false; } } if (includeInputColumnNames && input.length > 0) { label.append(STR); if (input.length < 5) { for (int i = 0; i < input.length; i++) { if (i != 0) { label.append(','); } label.append(input[i].getName()); } } else { label.append(input.length); label.append(STR); } label.append(")"); } final ComponentRequirement requirement = analyzerJob.getComponentRequirement(); if (includeRequirements && requirement != null) { if (!(requirement instanceof AnyComponentRequirement)) { label.append(STR); label.append(requirement.toString()); label.append(")"); } } } return label.toString(); }
/** * Gets the label of a components job * * @param job * @param includeDescriptorName * @param includeInputColumnNames * @param includeRequirements * * @return */
Gets the label of a components job
getLabel
{ "repo_name": "anandswarupv/DataCleaner", "path": "engine/core/src/main/java/org/datacleaner/util/LabelUtils.java", "license": "lgpl-3.0", "size": 8106 }
[ "com.google.common.base.Strings", "org.datacleaner.api.HasLabelAdvice", "org.datacleaner.api.InputColumn", "org.datacleaner.configuration.DataCleanerConfiguration", "org.datacleaner.descriptors.ComponentDescriptor", "org.datacleaner.job.AnalysisJob", "org.datacleaner.job.AnalyzerJob", "org.datacleaner.job.AnyComponentRequirement", "org.datacleaner.job.ComponentJob", "org.datacleaner.job.ComponentRequirement", "org.datacleaner.lifecycle.LifeCycleHelper" ]
import com.google.common.base.Strings; import org.datacleaner.api.HasLabelAdvice; import org.datacleaner.api.InputColumn; import org.datacleaner.configuration.DataCleanerConfiguration; import org.datacleaner.descriptors.ComponentDescriptor; import org.datacleaner.job.AnalysisJob; import org.datacleaner.job.AnalyzerJob; import org.datacleaner.job.AnyComponentRequirement; import org.datacleaner.job.ComponentJob; import org.datacleaner.job.ComponentRequirement; import org.datacleaner.lifecycle.LifeCycleHelper;
import com.google.common.base.*; import org.datacleaner.api.*; import org.datacleaner.configuration.*; import org.datacleaner.descriptors.*; import org.datacleaner.job.*; import org.datacleaner.lifecycle.*;
[ "com.google.common", "org.datacleaner.api", "org.datacleaner.configuration", "org.datacleaner.descriptors", "org.datacleaner.job", "org.datacleaner.lifecycle" ]
com.google.common; org.datacleaner.api; org.datacleaner.configuration; org.datacleaner.descriptors; org.datacleaner.job; org.datacleaner.lifecycle;
831,411
public static DocIdAndVersion loadDocIdAndVersion(IndexReader reader, Term term, boolean loadSeqNo) throws IOException { PerThreadIDVersionAndSeqNoLookup[] lookups = getLookupState(reader, term.field()); List<LeafReaderContext> leaves = reader.leaves(); // iterate backwards to optimize for the frequently updated documents // which are likely to be in the last segments for (int i = leaves.size() - 1; i >= 0; i--) { final LeafReaderContext leaf = leaves.get(i); PerThreadIDVersionAndSeqNoLookup lookup = lookups[leaf.ord]; DocIdAndVersion result = lookup.lookupVersion(term.bytes(), loadSeqNo, leaf); if (result != null) { return result; } } return null; }
static DocIdAndVersion function(IndexReader reader, Term term, boolean loadSeqNo) throws IOException { PerThreadIDVersionAndSeqNoLookup[] lookups = getLookupState(reader, term.field()); List<LeafReaderContext> leaves = reader.leaves(); for (int i = leaves.size() - 1; i >= 0; i--) { final LeafReaderContext leaf = leaves.get(i); PerThreadIDVersionAndSeqNoLookup lookup = lookups[leaf.ord]; DocIdAndVersion result = lookup.lookupVersion(term.bytes(), loadSeqNo, leaf); if (result != null) { return result; } } return null; }
/** * Load the internal doc ID and version for the uid from the reader, returning<ul> * <li>null if the uid wasn't found, * <li>a doc ID and a version otherwise * </ul> */
Load the internal doc ID and version for the uid from the reader, returning null if the uid wasn't found, a doc ID and a version otherwise
loadDocIdAndVersion
{ "repo_name": "strapdata/elassandra", "path": "server/src/main/java/org/elasticsearch/common/lucene/uid/VersionsAndSeqNoResolver.java", "license": "apache-2.0", "size": 8085 }
[ "java.io.IOException", "java.util.List", "org.apache.lucene.index.IndexReader", "org.apache.lucene.index.LeafReaderContext", "org.apache.lucene.index.Term" ]
import java.io.IOException; import java.util.List; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.Term;
import java.io.*; import java.util.*; import org.apache.lucene.index.*;
[ "java.io", "java.util", "org.apache.lucene" ]
java.io; java.util; org.apache.lucene;
1,843,674
void handleNotificationError(IBinder key, StatusBarNotification n, String message) { removeNotification(key); try { mBarService.onNotificationError(n.pkg, n.tag, n.id, n.uid, n.initialPid, message); } catch (RemoteException ex) { // The end is nigh. } }
void handleNotificationError(IBinder key, StatusBarNotification n, String message) { removeNotification(key); try { mBarService.onNotificationError(n.pkg, n.tag, n.id, n.uid, n.initialPid, message); } catch (RemoteException ex) { } }
/** * Cancel this notification and tell the StatusBarManagerService / NotificationManagerService * about the failure. * * WARNING: this will call back into us. Don't hold any locks. */
Cancel this notification and tell the StatusBarManagerService / NotificationManagerService about the failure
handleNotificationError
{ "repo_name": "rex-xxx/mt6572_x201", "path": "frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java", "license": "gpl-2.0", "size": 50130 }
[ "android.os.IBinder", "android.os.RemoteException", "com.android.internal.statusbar.StatusBarNotification" ]
import android.os.IBinder; import android.os.RemoteException; import com.android.internal.statusbar.StatusBarNotification;
import android.os.*; import com.android.internal.statusbar.*;
[ "android.os", "com.android.internal" ]
android.os; com.android.internal;
150,229
void sendMessage(Message message) throws IOException;
void sendMessage(Message message) throws IOException;
/** * Attempts to send the message to the server. * Note: The message will not be sent if an exception occurs. * * @param message The message to be sent * @throws IOException Exception which may occur during the sending of the message. */
Attempts to send the message to the server. Note: The message will not be sent if an exception occurs
sendMessage
{ "repo_name": "aaruff/LabManager", "path": "src/main/java/edu/nyu/cess/remote/common/message/MessageSocket.java", "license": "gpl-3.0", "size": 1448 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,147,927
public void addTopologySerializer(String[] extensions, TopologySerializer topologySerializer) { for(String ext : extensions) addTopologySerializer(".*\\."+ext+"$", topologySerializer); } private static class SupportedSerializer { String regex; TopologySerializer topologySerializer; public SupportedSerializer(String regex, TopologySerializer topologySerializer) { this.regex = regex; this.topologySerializer = topologySerializer; } }
void function(String[] extensions, TopologySerializer topologySerializer) { for(String ext : extensions) addTopologySerializer(".*\\."+ext+"$", topologySerializer); } private static class SupportedSerializer { String regex; TopologySerializer topologySerializer; public SupportedSerializer(String regex, TopologySerializer topologySerializer) { this.regex = regex; this.topologySerializer = topologySerializer; } }
/** * Records and links the provided {@link TopologySerializer} to a given array. * of filename extensions. * * @param extensions an array if filename extensions (without the . character) * @param topologySerializer the {@link TopologySerializer} to be recorded */
Records and links the provided <code>TopologySerializer</code> to a given array. of filename extensions
addTopologySerializer
{ "repo_name": "acasteigts/JBotSim", "path": "lib/jbotsim-serialization-common/src/main/java/io/jbotsim/io/format/TopologySerializerFilenameMatcher.java", "license": "lgpl-3.0", "size": 3076 }
[ "io.jbotsim.io.TopologySerializer" ]
import io.jbotsim.io.TopologySerializer;
import io.jbotsim.io.*;
[ "io.jbotsim.io" ]
io.jbotsim.io;
2,891,546
private RefreshListeners buildRefreshListeners() { return new RefreshListeners( indexSettings::getMaxRefreshListeners, () -> refresh("too_many_listeners"), threadPool.executor(ThreadPool.Names.LISTENER)::execute, logger, threadPool.getThreadContext()); } public static final class ShardFailure { public final ShardRouting routing; public final String reason; @Nullable public final Exception cause; public ShardFailure(ShardRouting routing, String reason, @Nullable Exception cause) { this.routing = routing; this.reason = reason; this.cause = cause; } }
RefreshListeners function() { return new RefreshListeners( indexSettings::getMaxRefreshListeners, () -> refresh(STR), threadPool.executor(ThreadPool.Names.LISTENER)::execute, logger, threadPool.getThreadContext()); } public static final class ShardFailure { public final ShardRouting routing; public final String reason; public final Exception cause; public ShardFailure(ShardRouting routing, String reason, @Nullable Exception cause) { this.routing = routing; this.reason = reason; this.cause = cause; } }
/** * Build {@linkplain RefreshListeners} for this shard. */
Build RefreshListeners for this shard
buildRefreshListeners
{ "repo_name": "jprante/elasticsearch-server", "path": "server/src/main/java/org/elasticsearch/index/shard/IndexShard.java", "license": "apache-2.0", "size": 126001 }
[ "org.elasticsearch.cluster.routing.ShardRouting", "org.elasticsearch.common.Nullable", "org.elasticsearch.threadpool.ThreadPool" ]
import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Nullable; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.cluster.routing.*; import org.elasticsearch.common.*; import org.elasticsearch.threadpool.*;
[ "org.elasticsearch.cluster", "org.elasticsearch.common", "org.elasticsearch.threadpool" ]
org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.threadpool;
1,121,871
if (catalogServices == null) { catalogServices = new ArrayList<CatalogServiceRestRep>(); } return catalogServices; }
if (catalogServices == null) { catalogServices = new ArrayList<CatalogServiceRestRep>(); } return catalogServices; }
/** * List of catalog services * * @return catalog services list */
List of catalog services
getCatalogServices
{ "repo_name": "emcvipr/controller-client-java", "path": "models/src/main/java/com/emc/vipr/model/catalog/CatalogServiceBulkRep.java", "license": "apache-2.0", "size": 1134 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
868,719
List<Attribute> getRequiredAttributes(PerunSession sess, Service service, Facility facility, Resource resource, User user, Member member) throws MemberResourceMismatchException;
List<Attribute> getRequiredAttributes(PerunSession sess, Service service, Facility facility, Resource resource, User user, Member member) throws MemberResourceMismatchException;
/** * Get memner, user, member-resource, user-facility attributes which are required by the service. * * * @param sess * @param service * @param facility * @param resource * @param user * @param member * @return * * @throws InternalErrorException * @throws MemberResourceMismatchException */
Get memner, user, member-resource, user-facility attributes which are required by the service
getRequiredAttributes
{ "repo_name": "zlamalp/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/AttributesManagerBl.java", "license": "bsd-2-clause", "size": 244560 }
[ "cz.metacentrum.perun.core.api.Attribute", "cz.metacentrum.perun.core.api.Facility", "cz.metacentrum.perun.core.api.Member", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.Resource", "cz.metacentrum.perun.core.api.Service", "cz.metacentrum.perun.core.api.User", "cz.metacentrum.perun.core.api.exceptions.MemberResourceMismatchException", "java.util.List" ]
import cz.metacentrum.perun.core.api.Attribute; import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.Member; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.Resource; import cz.metacentrum.perun.core.api.Service; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.exceptions.MemberResourceMismatchException; import java.util.List;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,814,056
private Map<String, Integer> calculateFrequencyOfAttributeValues( List<String[]> instances, int indexAttribute) { // A map to calculate the frequency of each value: // Key: a string indicating a value // Value: the frequency Map<String, Integer> targetValuesFrequency = new HashMap<String, Integer>(); // for each instance of the training set for (String[] instance : instances) { // get the value of the attribute for that instance String targetValue = instance[indexAttribute]; // increase the frequency by 1 if (targetValuesFrequency.get(targetValue) == null) { targetValuesFrequency.put(targetValue, 1); } else { targetValuesFrequency.put(targetValue, targetValuesFrequency.get(targetValue) + 1); } } // return the map return targetValuesFrequency; }
Map<String, Integer> function( List<String[]> instances, int indexAttribute) { Map<String, Integer> targetValuesFrequency = new HashMap<String, Integer>(); for (String[] instance : instances) { String targetValue = instance[indexAttribute]; if (targetValuesFrequency.get(targetValue) == null) { targetValuesFrequency.put(targetValue, 1); } else { targetValuesFrequency.put(targetValue, targetValuesFrequency.get(targetValue) + 1); } } return targetValuesFrequency; }
/** * This method calculates the frequency of each value for an attribute in a * given set of instances * * @param instances * A set of instances * @param indexAttribute * The attribute. * @return A map where the keys are attributes and values are the number of * times that the value appeared in the set of instances. */
This method calculates the frequency of each value for an attribute in a given set of instances
calculateFrequencyOfAttributeValues
{ "repo_name": "ArneBinder/LanguageAnalyzer", "path": "src/main/java/ca/pfv/spmf/algorithms/classifiers/decisiontree/id3/AlgoID3.java", "license": "gpl-3.0", "size": 13484 }
[ "java.util.HashMap", "java.util.List", "java.util.Map" ]
import java.util.HashMap; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,863,901
public Map<String, String> getHeaders() { return headers; }
Map<String, String> function() { return headers; }
/** * Obtains a {@link Map} containing the HTTP Response Headers * * @return headers */
Obtains a <code>Map</code> containing the HTTP Response Headers
getHeaders
{ "repo_name": "scribejava/scribejava", "path": "scribejava-core/src/main/java/com/github/scribejava/core/model/Response.java", "license": "mit", "size": 4137 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
434,256
@Before public void createBlankRepo() throws IOException { helper.createEmptyRepository(); }
void function() throws IOException { helper.createEmptyRepository(); }
/** * Every test in this class gets a blank github repository created for them. * * @throws IOException */
Every test in this class gets a blank github repository created for them
createBlankRepo
{ "repo_name": "jenkinsci/blueocean-plugin", "path": "acceptance-tests/src/test/java/io/blueocean/ath/live/GithubCreationTest.java", "license": "mit", "size": 5487 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,663,670
@Override public void paintComponent(Graphics g) { if (stop || deleteIt) { // System.out.println("stop="+stop+" deleteIt="+deleteIt); try { if (ais != null) { // System.out.println("closing "+ais); ais.close(); ais = null; System.gc(); } if (deleteIt) { deleteIt = false; if (getCurrentFile() != null && getCurrentFile().isFile()) { boolean deleted = getCurrentFile().delete(); if (deleted) { log.info("succesfully deleted " + getCurrentFile()); chooser.rescanCurrentDirectory(); } else { log.warning("couldn't delete file " + getCurrentFile()); } } } } catch (IOException e) { } return; } Graphics2D g2 = (Graphics2D) canvas.getCanvas().getGraphics(); if (newFileSelected) { // erases old text, otherwise draws over it newFileSelected = false; g2.clearRect(0, 0, getWidth(), getHeight()); } // g2.setColor(Color.black); // g2.fillRect(0,0,getWidth(),getHeight()); // rendering method already paints frame black, shouldn't do it here or we get flicker from black to image if (!indexFileEnabled && !hdf5FileEnabled) { if (ais != null) { try { aeRaw = ais.readPacketByTime(packetTimeUs); } catch (EOFException e) { try { ais.rewind(); } catch (IOException ioe) { log.warning("IOException on rewind from EOF: " + ioe.getMessage()); } } catch (IOException e) { e.printStackTrace(); try { ais.close(); if (ais != null) { try { ais.close(); } catch (IOException e2) { e2.printStackTrace(); } } } catch (Exception e3) { e3.printStackTrace(); } } if (aeRaw != null) { extractor = chip.getEventExtractor(); // Desipte extrator is initiliazed at first, if jAER 3.0 file used, then Jaer3BufferParser // will update the extrator, so we need to update this value here. ae = extractor.extractPacket(aeRaw); } } if (ae != null) { renderer.render(ae); ArrayList<FrameAnnotater> annotators = canvas.getDisplayMethod().getAnnotators(); canvas.getDisplayMethod().setAnnotators(null); canvas.paintFrame(); canvas.getDisplayMethod().setAnnotators(annotators); } } else { if (hdf5FileEnabled) { int packetTotalNum = (int)hafir.getFileDims()[0]; if (packetNum >= 100) { packetNum = 0; } hafir.readRowData(packetNum); ae = hafir.extractPacket(packetNum); renderer.render(ae); packetNum ++; ArrayList<FrameAnnotater> annotators = canvas.getDisplayMethod().getAnnotators(); canvas.getDisplayMethod().setAnnotators(null); canvas.paintFrame(); canvas.getDisplayMethod().setAnnotators(annotators); } else { fileSizeString = indexFileString; g2.clearRect(0, 0, getWidth(), getHeight()); } } g2.setColor(Color.red); g2.setFont(g2.getFont().deriveFont(17f)); g2.drawString(fileSizeString, 30f, 30f); // infoLabel.repaint(); try { Thread.sleep(15); } catch (InterruptedException e) { } repaint(); // recurse } EngineeringFormat fmt = new EngineeringFormat(); volatile String fileSizeString = ""; volatile String indexFileString = "";
void function(Graphics g) { if (stop deleteIt) { try { if (ais != null) { ais.close(); ais = null; System.gc(); } if (deleteIt) { deleteIt = false; if (getCurrentFile() != null && getCurrentFile().isFile()) { boolean deleted = getCurrentFile().delete(); if (deleted) { log.info(STR + getCurrentFile()); chooser.rescanCurrentDirectory(); } else { log.warning(STR + getCurrentFile()); } } } } catch (IOException e) { } return; } Graphics2D g2 = (Graphics2D) canvas.getCanvas().getGraphics(); if (newFileSelected) { newFileSelected = false; g2.clearRect(0, 0, getWidth(), getHeight()); } if (!indexFileEnabled && !hdf5FileEnabled) { if (ais != null) { try { aeRaw = ais.readPacketByTime(packetTimeUs); } catch (EOFException e) { try { ais.rewind(); } catch (IOException ioe) { log.warning(STR + ioe.getMessage()); } } catch (IOException e) { e.printStackTrace(); try { ais.close(); if (ais != null) { try { ais.close(); } catch (IOException e2) { e2.printStackTrace(); } } } catch (Exception e3) { e3.printStackTrace(); } } if (aeRaw != null) { extractor = chip.getEventExtractor(); ae = extractor.extractPacket(aeRaw); } } if (ae != null) { renderer.render(ae); ArrayList<FrameAnnotater> annotators = canvas.getDisplayMethod().getAnnotators(); canvas.getDisplayMethod().setAnnotators(null); canvas.paintFrame(); canvas.getDisplayMethod().setAnnotators(annotators); } } else { if (hdf5FileEnabled) { int packetTotalNum = (int)hafir.getFileDims()[0]; if (packetNum >= 100) { packetNum = 0; } hafir.readRowData(packetNum); ae = hafir.extractPacket(packetNum); renderer.render(ae); packetNum ++; ArrayList<FrameAnnotater> annotators = canvas.getDisplayMethod().getAnnotators(); canvas.getDisplayMethod().setAnnotators(null); canvas.paintFrame(); canvas.getDisplayMethod().setAnnotators(annotators); } else { fileSizeString = indexFileString; g2.clearRect(0, 0, getWidth(), getHeight()); } } g2.setColor(Color.red); g2.setFont(g2.getFont().deriveFont(17f)); g2.drawString(fileSizeString, 30f, 30f); try { Thread.sleep(15); } catch (InterruptedException e) { } repaint(); } EngineeringFormat fmt = new EngineeringFormat(); volatile String fileSizeString = STR";
/** * Paints the file preview using {@link ChipCanvas#paintFrame() }. * * @param g the graphics context */
Paints the file preview using <code>ChipCanvas#paintFrame() </code>
paintComponent
{ "repo_name": "viktorbahr/jaer", "path": "src/net/sf/jaer/graphics/ChipDataFilePreview.java", "license": "lgpl-2.1", "size": 13265 }
[ "java.awt.Color", "java.awt.Graphics", "java.awt.Graphics2D", "java.io.EOFException", "java.io.IOException", "java.util.ArrayList", "net.sf.jaer.util.EngineeringFormat" ]
import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.io.EOFException; import java.io.IOException; import java.util.ArrayList; import net.sf.jaer.util.EngineeringFormat;
import java.awt.*; import java.io.*; import java.util.*; import net.sf.jaer.util.*;
[ "java.awt", "java.io", "java.util", "net.sf.jaer" ]
java.awt; java.io; java.util; net.sf.jaer;
1,834,788
AsyncStage<T> readThrough(Stat storingStatIn);
AsyncStage<T> readThrough(Stat storingStatIn);
/** * Same as {@link #read(org.apache.zookeeper.data.Stat)} except that if the cache does not have a value * for this path a direct query is made. * * @param storingStatIn the stat for the new ZNode is stored here * @return AsyncStage * @see org.apache.curator.x.async.AsyncStage */
Same as <code>#read(org.apache.zookeeper.data.Stat)</code> except that if the cache does not have a value for this path a direct query is made
readThrough
{ "repo_name": "mosoft521/curator", "path": "curator-x-async/src/main/java/org/apache/curator/x/async/modeled/cached/CachedModeledFramework.java", "license": "apache-2.0", "size": 3362 }
[ "org.apache.curator.x.async.AsyncStage", "org.apache.zookeeper.data.Stat" ]
import org.apache.curator.x.async.AsyncStage; import org.apache.zookeeper.data.Stat;
import org.apache.curator.x.async.*; import org.apache.zookeeper.data.*;
[ "org.apache.curator", "org.apache.zookeeper" ]
org.apache.curator; org.apache.zookeeper;
1,639,486
public Set getPropertiesForPattern( String pattern ) { RE regex = new RE( pattern ); Set result = new HashSet(); Iterator it = super.keySet().iterator(); while ( it.hasNext() ) { String key = (String) it.next(); if ( regex.match( key ) ) result.add( getProperty( key ) ); } return result; }
Set function( String pattern ) { RE regex = new RE( pattern ); Set result = new HashSet(); Iterator it = super.keySet().iterator(); while ( it.hasNext() ) { String key = (String) it.next(); if ( regex.match( key ) ) result.add( getProperty( key ) ); } return result; }
/** * Returns property values for keys matching regular expression pattern. * * @param pattern interpreted as regular expression * @return Set contains String objects */
Returns property values for keys matching regular expression pattern
getPropertiesForPattern
{ "repo_name": "nezbo/neat4speed2", "path": "src/com/anji/util/Properties.java", "license": "gpl-2.0", "size": 22220 }
[ "java.util.HashSet", "java.util.Iterator", "java.util.Set" ]
import java.util.HashSet; import java.util.Iterator; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
577,699
@Override protected String getSqlQueryString() { StringBuilder query = new StringBuilder() .append("SELECT * FROM ") .append(getTableName()) .append(" WHERE "); // constrain query based on the last ID read if (getMarkMethod() == MarkMethod.LAST_ID) { if (getKeyColumns().size() > 1) throw new SessionInternalError("LAST_ID marking method only allows for one key column."); query.append(getKeyColumns().get(0)).append(" > ").append(getLastId()).append(' '); } // append optional user-defined where clause String where = getParameter(PARAM_WHERE_APPEND.getName(), (String) null); if (where != null) query.append(where).append(' '); // append optional user-defined order, or build one by using defined key columns String order = getParameter(PARAM_ORDER_BY.getName(), (String) null); query.append("ORDER BY "); if (order != null) { query.append(order); } else { for (Iterator<String> it = getKeyColumns().iterator(); it.hasNext();) { query.append(it.next()); if (it.hasNext()) query.append(", "); } } LOG.debug("SQL query: '" + query + "'"); return query.toString(); }
String function() { StringBuilder query = new StringBuilder() .append(STR) .append(getTableName()) .append(STR); if (getMarkMethod() == MarkMethod.LAST_ID) { if (getKeyColumns().size() > 1) throw new SessionInternalError(STR); query.append(getKeyColumns().get(0)).append(STR).append(getLastId()).append(' '); } String where = getParameter(PARAM_WHERE_APPEND.getName(), (String) null); if (where != null) query.append(where).append(' '); String order = getParameter(PARAM_ORDER_BY.getName(), (String) null); query.append(STR); if (order != null) { query.append(order); } else { for (Iterator<String> it = getKeyColumns().iterator(); it.hasNext();) { query.append(it.next()); if (it.hasNext()) query.append(STR); } } LOG.debug(STR + query + "'"); return query.toString(); }
/** * Returns a SQL query that reads all records present regardless of previous reads. * * @return SQL query string */
Returns a SQL query that reads all records present regardless of previous reads
getSqlQueryString
{ "repo_name": "liquidJbilling/LT-Jbilling-MsgQ-3.1", "path": "src/java/com/sapienter/jbilling/server/mediation/task/StatelessJDBCReader.java", "license": "agpl-3.0", "size": 4212 }
[ "com.sapienter.jbilling.common.SessionInternalError", "java.util.Iterator" ]
import com.sapienter.jbilling.common.SessionInternalError; import java.util.Iterator;
import com.sapienter.jbilling.common.*; import java.util.*;
[ "com.sapienter.jbilling", "java.util" ]
com.sapienter.jbilling; java.util;
1,608,898
@Override public Automaton clone() { try { Automaton a = (Automaton)super.clone(); if (!isSingleton()) { HashMap<State, State> m = new HashMap<State, State>(); Set<State> states = getStates(); for (State s : states) m.put(s, new State()); for (State s : states) { State p = m.get(s); p.accept = s.accept; if (s == initial) a.initial = p; for (Transition t : s.transitions) p.transitions.add(new Transition(t.min, t.max, m.get(t.to))); } } return a; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } }
Automaton function() { try { Automaton a = (Automaton)super.clone(); if (!isSingleton()) { HashMap<State, State> m = new HashMap<State, State>(); Set<State> states = getStates(); for (State s : states) m.put(s, new State()); for (State s : states) { State p = m.get(s); p.accept = s.accept; if (s == initial) a.initial = p; for (Transition t : s.transitions) p.transitions.add(new Transition(t.min, t.max, m.get(t.to))); } } return a; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } }
/** * Returns a clone of this automaton. */
Returns a clone of this automaton
clone
{ "repo_name": "zhouzusheng/automation", "path": "src/dk/brics/automaton/Automaton.java", "license": "apache-2.0", "size": 31084 }
[ "java.util.HashMap", "java.util.Set" ]
import java.util.HashMap; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
639,290
public VenueLocation getUserLocation() { return mUserLocation; }
VenueLocation function() { return mUserLocation; }
/** * Get user location on the map * @return */
Get user location on the map
getUserLocation
{ "repo_name": "geolys/geolys-android-sdk-vtm", "path": "src/com/tevolys/geolys/sdk/map/VenueMap.java", "license": "gpl-3.0", "size": 14979 }
[ "com.tevolys.geolys.sdk.model.VenueLocation" ]
import com.tevolys.geolys.sdk.model.VenueLocation;
import com.tevolys.geolys.sdk.model.*;
[ "com.tevolys.geolys" ]
com.tevolys.geolys;
1,529,261
@Test public void retainServedDateFormat() throws Exception { // Serve a response with a non-standard date format that OkHttp supports. Date lastModifiedDate = new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(-1)); Date servedDate = new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(-2)); DateFormat dateFormat = new SimpleDateFormat("EEE dd-MMM-yyyy HH:mm:ss z", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("EDT")); String lastModifiedString = dateFormat.format(lastModifiedDate); String servedString = dateFormat.format(servedDate); // This response should be conditionally cached. server.enqueue(new MockResponse() .addHeader("Last-Modified: " + lastModifiedString) .addHeader("Expires: " + servedString) .setBody("A")); server.enqueue(new MockResponse() .setResponseCode(HttpURLConnection.HTTP_NOT_MODIFIED)); assertEquals("A", readAscii(openConnection(server.url("/").url()))); assertEquals("A", readAscii(openConnection(server.url("/").url()))); // The first request has no conditions. RecordedRequest request1 = server.takeRequest(); assertNull(request1.getHeader("If-Modified-Since")); // The 2nd request uses the server's date format. RecordedRequest request2 = server.takeRequest(); assertEquals(lastModifiedString, request2.getHeader("If-Modified-Since")); }
@Test void function() throws Exception { Date lastModifiedDate = new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(-1)); Date servedDate = new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(-2)); DateFormat dateFormat = new SimpleDateFormat(STR, Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("EDT")); String lastModifiedString = dateFormat.format(lastModifiedDate); String servedString = dateFormat.format(servedDate); server.enqueue(new MockResponse() .addHeader(STR + lastModifiedString) .addHeader(STR + servedString) .setBody("A")); server.enqueue(new MockResponse() .setResponseCode(HttpURLConnection.HTTP_NOT_MODIFIED)); assertEquals("A", readAscii(openConnection(server.url("/").url()))); assertEquals("A", readAscii(openConnection(server.url("/").url()))); RecordedRequest request1 = server.takeRequest(); assertNull(request1.getHeader(STR)); RecordedRequest request2 = server.takeRequest(); assertEquals(lastModifiedString, request2.getHeader(STR)); }
/** * For Last-Modified and Date headers, we should echo the date back in the exact format we were * served. */
For Last-Modified and Date headers, we should echo the date back in the exact format we were served
retainServedDateFormat
{ "repo_name": "germanattanasio/okhttp", "path": "okhttp-android-support/src/test/java/okhttp3/internal/huc/ResponseCacheTest.java", "license": "apache-2.0", "size": 89121 }
[ "java.net.HttpURLConnection", "java.text.DateFormat", "java.text.SimpleDateFormat", "java.util.Date", "java.util.Locale", "java.util.TimeZone", "java.util.concurrent.TimeUnit", "org.junit.Assert", "org.junit.Test" ]
import java.net.HttpURLConnection; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.TimeUnit; import org.junit.Assert; import org.junit.Test;
import java.net.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import org.junit.*;
[ "java.net", "java.text", "java.util", "org.junit" ]
java.net; java.text; java.util; org.junit;
1,671,239
@Override public Value evalAssignValue(Env env, Value value) { Value array = _expr.evalVar(env); array = array.toAutoArray(); array.put(value); return value; }
Value function(Env env, Value value) { Value array = _expr.evalVar(env); array = array.toAutoArray(); array.put(value); return value; }
/** * Evaluates the expression. * * @param env the calling environment. * * @return the expression value. */
Evaluates the expression
evalAssignValue
{ "repo_name": "CleverCloud/Quercus", "path": "quercus/src/main/java/com/caucho/quercus/expr/ArrayTailExpr.java", "license": "gpl-2.0", "size": 4259 }
[ "com.caucho.quercus.env.Env", "com.caucho.quercus.env.Value" ]
import com.caucho.quercus.env.Env; import com.caucho.quercus.env.Value;
import com.caucho.quercus.env.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
576,192
public final Collection<GrantedAuthority> getGrantedAuthorities( DirContextOperations user, String username) { String userDn = user.getNameInNamespace(); if (logger.isDebugEnabled()) { logger.debug("Getting authorities for user " + userDn); } Set<GrantedAuthority> roles = getGroupMembershipRoles(userDn, username); Set<GrantedAuthority> extraRoles = getAdditionalRoles(user, username); if (extraRoles != null) { roles.addAll(extraRoles); } if (defaultRole != null) { roles.add(defaultRole); } List<GrantedAuthority> result = new ArrayList<GrantedAuthority>(roles.size()); result.addAll(roles); return result; }
final Collection<GrantedAuthority> function( DirContextOperations user, String username) { String userDn = user.getNameInNamespace(); if (logger.isDebugEnabled()) { logger.debug(STR + userDn); } Set<GrantedAuthority> roles = getGroupMembershipRoles(userDn, username); Set<GrantedAuthority> extraRoles = getAdditionalRoles(user, username); if (extraRoles != null) { roles.addAll(extraRoles); } if (defaultRole != null) { roles.add(defaultRole); } List<GrantedAuthority> result = new ArrayList<GrantedAuthority>(roles.size()); result.addAll(roles); return result; }
/** * Obtains the authorities for the user who's directory entry is represented by the * supplied LdapUserDetails object. * * @param user the user who's authorities are required * @return the set of roles granted to the user. */
Obtains the authorities for the user who's directory entry is represented by the supplied LdapUserDetails object
getGrantedAuthorities
{ "repo_name": "jmnarloch/spring-security", "path": "ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java", "license": "apache-2.0", "size": 13370 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.List", "java.util.Set", "org.springframework.ldap.core.DirContextOperations", "org.springframework.security.core.GrantedAuthority" ]
import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; import org.springframework.ldap.core.DirContextOperations; import org.springframework.security.core.GrantedAuthority;
import java.util.*; import org.springframework.ldap.core.*; import org.springframework.security.core.*;
[ "java.util", "org.springframework.ldap", "org.springframework.security" ]
java.util; org.springframework.ldap; org.springframework.security;
1,870,248
protected Node exitImplicit(Token node) throws ParseException { return node; }
Node function(Token node) throws ParseException { return node; }
/** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree, or * null if no parse tree should be created * * @throws ParseException if the node analysis discovered errors */
Called when exiting a parse tree node
exitImplicit
{ "repo_name": "richb-hanover/mibble-2.9.2", "path": "src/java/net/percederberg/mibble/asn1/Asn1Analyzer.java", "license": "gpl-2.0", "size": 275483 }
[ "net.percederberg.grammatica.parser.Node", "net.percederberg.grammatica.parser.ParseException", "net.percederberg.grammatica.parser.Token" ]
import net.percederberg.grammatica.parser.Node; import net.percederberg.grammatica.parser.ParseException; import net.percederberg.grammatica.parser.Token;
import net.percederberg.grammatica.parser.*;
[ "net.percederberg.grammatica" ]
net.percederberg.grammatica;
447,338
private void assureReturnObjFlagSet(SearchControls controls) { Validate.notNull(controls); if (!controls.getReturningObjFlag()) { log.debug("The returnObjFlag of supplied SearchControls is not set" + " but a ContextMapper is used - setting flag to true"); controls.setReturningObjFlag(true); } }
void function(SearchControls controls) { Validate.notNull(controls); if (!controls.getReturningObjFlag()) { log.debug(STR + STR); controls.setReturningObjFlag(true); } }
/** * Make sure the returnObjFlag is set in the supplied SearchControls. Set it * and log if it's not set. * * @param controls the SearchControls to check. */
Make sure the returnObjFlag is set in the supplied SearchControls. Set it and log if it's not set
assureReturnObjFlagSet
{ "repo_name": "pbzdyl/spring-ldap", "path": "core/src/main/java/org/springframework/ldap/core/LdapTemplate.java", "license": "apache-2.0", "size": 51777 }
[ "javax.naming.directory.SearchControls", "org.apache.commons.lang.Validate" ]
import javax.naming.directory.SearchControls; import org.apache.commons.lang.Validate;
import javax.naming.directory.*; import org.apache.commons.lang.*;
[ "javax.naming", "org.apache.commons" ]
javax.naming; org.apache.commons;
673,993
private static XYDataset createDataset() { TimeSeries s1 = new TimeSeries("L&G European Index Trust"); s1.add(new Month(2, 2001), 181.8); s1.add(new Month(3, 2001), 167.3); s1.add(new Month(4, 2001), 153.8); s1.add(new Month(5, 2001), 167.6); s1.add(new Month(6, 2001), 158.8); s1.add(new Month(7, 2001), 148.3); s1.add(new Month(8, 2001), 153.9); s1.add(new Month(9, 2001), 142.7); s1.add(new Month(10, 2001), 123.2); s1.add(new Month(11, 2001), 131.8); s1.add(new Month(12, 2001), 139.6); s1.add(new Month(1, 2002), 142.9); s1.add(new Month(2, 2002), 138.7); s1.add(new Month(3, 2002), 137.3); s1.add(new Month(4, 2002), 143.9); s1.add(new Month(5, 2002), 139.8); s1.add(new Month(6, 2002), 137.0); s1.add(new Month(7, 2002), 132.8); TimeSeries s2 = new TimeSeries("L&G UK Index Trust"); s2.add(new Month(2, 2001), 129.6); s2.add(new Month(3, 2001), 123.2); s2.add(new Month(4, 2001), 117.2); s2.add(new Month(5, 2001), 124.1); s2.add(new Month(6, 2001), 122.6); s2.add(new Month(7, 2001), 119.2); s2.add(new Month(8, 2001), 116.5); s2.add(new Month(9, 2001), 112.7); s2.add(new Month(10, 2001), 101.5); s2.add(new Month(11, 2001), 106.1); s2.add(new Month(12, 2001), 110.3); s2.add(new Month(1, 2002), 111.7); s2.add(new Month(2, 2002), 111.0); s2.add(new Month(3, 2002), 109.6); s2.add(new Month(4, 2002), 113.2); s2.add(new Month(5, 2002), 111.6); s2.add(new Month(6, 2002), 108.8); s2.add(new Month(7, 2002), 101.6); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(s1); dataset.addSeries(s2); return dataset; }
static XYDataset function() { TimeSeries s1 = new TimeSeries(STR); s1.add(new Month(2, 2001), 181.8); s1.add(new Month(3, 2001), 167.3); s1.add(new Month(4, 2001), 153.8); s1.add(new Month(5, 2001), 167.6); s1.add(new Month(6, 2001), 158.8); s1.add(new Month(7, 2001), 148.3); s1.add(new Month(8, 2001), 153.9); s1.add(new Month(9, 2001), 142.7); s1.add(new Month(10, 2001), 123.2); s1.add(new Month(11, 2001), 131.8); s1.add(new Month(12, 2001), 139.6); s1.add(new Month(1, 2002), 142.9); s1.add(new Month(2, 2002), 138.7); s1.add(new Month(3, 2002), 137.3); s1.add(new Month(4, 2002), 143.9); s1.add(new Month(5, 2002), 139.8); s1.add(new Month(6, 2002), 137.0); s1.add(new Month(7, 2002), 132.8); TimeSeries s2 = new TimeSeries(STR); s2.add(new Month(2, 2001), 129.6); s2.add(new Month(3, 2001), 123.2); s2.add(new Month(4, 2001), 117.2); s2.add(new Month(5, 2001), 124.1); s2.add(new Month(6, 2001), 122.6); s2.add(new Month(7, 2001), 119.2); s2.add(new Month(8, 2001), 116.5); s2.add(new Month(9, 2001), 112.7); s2.add(new Month(10, 2001), 101.5); s2.add(new Month(11, 2001), 106.1); s2.add(new Month(12, 2001), 110.3); s2.add(new Month(1, 2002), 111.7); s2.add(new Month(2, 2002), 111.0); s2.add(new Month(3, 2002), 109.6); s2.add(new Month(4, 2002), 113.2); s2.add(new Month(5, 2002), 111.6); s2.add(new Month(6, 2002), 108.8); s2.add(new Month(7, 2002), 101.6); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(s1); dataset.addSeries(s2); return dataset; }
/** * Creates a dataset, consisting of two series of monthly data. * * @return The dataset. */
Creates a dataset, consisting of two series of monthly data
createDataset
{ "repo_name": "aaronc/jfreechart", "path": "source/org/jfree/chart/demo/TimeSeriesChartDemo1.java", "license": "lgpl-2.1", "size": 8025 }
[ "org.jfree.data.time.Month", "org.jfree.data.time.TimeSeries", "org.jfree.data.time.TimeSeriesCollection", "org.jfree.data.xy.XYDataset" ]
import org.jfree.data.time.Month; import org.jfree.data.time.TimeSeries; import org.jfree.data.time.TimeSeriesCollection; import org.jfree.data.xy.XYDataset;
import org.jfree.data.time.*; import org.jfree.data.xy.*;
[ "org.jfree.data" ]
org.jfree.data;
2,091,815
// Read some value from the Preferences to ensure it's in memory. getStoredOrigins(); } public TrustedWebActivityPermissionStore() { // On some versions of Android, creating the Preferences object involves a disk read (to // check if the Preferences directory exists, not even to read the actual Preferences). try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) { mPreferences = ContextUtils.getApplicationContext().getSharedPreferences( SHARED_PREFS_FILE, Context.MODE_PRIVATE); } }
getStoredOrigins(); } public TrustedWebActivityPermissionStore() { try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) { mPreferences = ContextUtils.getApplicationContext().getSharedPreferences( SHARED_PREFS_FILE, Context.MODE_PRIVATE); } }
/** * Reads the underlying storage into memory, should be called initially on a background thread. */
Reads the underlying storage into memory, should be called initially on a background thread
initStorage
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/chrome/android/java/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPermissionStore.java", "license": "bsd-3-clause", "size": 10943 }
[ "android.content.Context", "org.chromium.base.ContextUtils", "org.chromium.base.StrictModeContext" ]
import android.content.Context; import org.chromium.base.ContextUtils; import org.chromium.base.StrictModeContext;
import android.content.*; import org.chromium.base.*;
[ "android.content", "org.chromium.base" ]
android.content; org.chromium.base;
337,945
public void testReceive_NonBlockNoServerBufNotEmpty() throws Exception { this.channel1.configureBlocking(false); connectWithoutServer(); ByteBuffer dst = allocateNonEmptyBuf(); assertNull(this.channel1.receive(dst)); }
void function() throws Exception { this.channel1.configureBlocking(false); connectWithoutServer(); ByteBuffer dst = allocateNonEmptyBuf(); assertNull(this.channel1.receive(dst)); }
/** * Test method for 'DatagramChannelImpl.receive(ByteBuffer)' * * @throws Exception */
Test method for 'DatagramChannelImpl.receive(ByteBuffer)'
testReceive_NonBlockNoServerBufNotEmpty
{ "repo_name": "skyHALud/codenameone", "path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java", "license": "gpl-2.0", "size": 95313 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
205,071
public final Id<Address> getBillingAddressId() { return billingAddressId; }
final Id<Address> function() { return billingAddressId; }
/** * Gets the billing address id. * * @return the billing address id */
Gets the billing address id
getBillingAddressId
{ "repo_name": "OptimalPayments/Java_SDK", "path": "NetBanxSDK/src/main/java/com/optimalpayments/customervault/ACHBankAccounts.java", "license": "mit", "size": 11062 }
[ "com.optimalpayments.common.Id" ]
import com.optimalpayments.common.Id;
import com.optimalpayments.common.*;
[ "com.optimalpayments.common" ]
com.optimalpayments.common;
1,859,688
public Future<List<generated.classic.jdbc.regular.vertx.tables.pojos.Something>> findManyBySomeregularnumber(Collection<Integer> values) { return findManyByCondition(Something.SOMETHING.SOMEREGULARNUMBER.in(values)); }
Future<List<generated.classic.jdbc.regular.vertx.tables.pojos.Something>> function(Collection<Integer> values) { return findManyByCondition(Something.SOMETHING.SOMEREGULARNUMBER.in(values)); }
/** * Find records that have <code>SOMEREGULARNUMBER IN (values)</code> * asynchronously */
Find records that have <code>SOMEREGULARNUMBER IN (values)</code> asynchronously
findManyBySomeregularnumber
{ "repo_name": "jklingsporn/vertx-jooq", "path": "vertx-jooq-generate/src/test/java/generated/classic/jdbc/regular/vertx/tables/daos/SomethingDao.java", "license": "mit", "size": 9803 }
[ "io.vertx.core.Future", "java.util.Collection", "java.util.List" ]
import io.vertx.core.Future; import java.util.Collection; import java.util.List;
import io.vertx.core.*; import java.util.*;
[ "io.vertx.core", "java.util" ]
io.vertx.core; java.util;
1,188,454
@Test public void defaultLocale() { Locale locale = Configuration.getLocale(); assertThat(locale).isEqualTo(Locale.ROOT); }
void function() { Locale locale = Configuration.getLocale(); assertThat(locale).isEqualTo(Locale.ROOT); }
/** * Verifies that {@link Locale#ROOT} will be used, if there is no defined locale. */
Verifies that <code>Locale#ROOT</code> will be used, if there is no defined locale
defaultLocale
{ "repo_name": "pmwmedia/tinylog", "path": "tinylog-api/src/test/java/org/tinylog/configuration/ConfigurationTest.java", "license": "apache-2.0", "size": 20283 }
[ "java.util.Locale", "org.assertj.core.api.Assertions" ]
import java.util.Locale; import org.assertj.core.api.Assertions;
import java.util.*; import org.assertj.core.api.*;
[ "java.util", "org.assertj.core" ]
java.util; org.assertj.core;
1,523,584
private CalendarDay findAccessibilityFocus() { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child instanceof MonthView) { final CalendarDay focus = ((MonthView) child).getAccessibilityFocus(); if (focus != null) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) { // Clear focus to avoid ListView bug in Jelly Bean MR1. ((MonthView) child).clearAccessibilityFocus(); } return focus; } } } return null; }
CalendarDay function() { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child instanceof MonthView) { final CalendarDay focus = ((MonthView) child).getAccessibilityFocus(); if (focus != null) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) { ((MonthView) child).clearAccessibilityFocus(); } return focus; } } } return null; }
/** * Attempts to return the date that has accessibility focus. * * @return The date that has accessibility focus, or {@code null} if no date * has focus. */
Attempts to return the date that has accessibility focus
findAccessibilityFocus
{ "repo_name": "seklum/NewHeart", "path": "app/src/main/java/com/android/datetimepicker/date/DayPickerView.java", "license": "gpl-3.0", "size": 18230 }
[ "android.os.Build", "android.view.View", "com.android.datetimepicker.date.MonthAdapter" ]
import android.os.Build; import android.view.View; import com.android.datetimepicker.date.MonthAdapter;
import android.os.*; import android.view.*; import com.android.datetimepicker.date.*;
[ "android.os", "android.view", "com.android.datetimepicker" ]
android.os; android.view; com.android.datetimepicker;
896,948
@Test public void testLabelAssigningWithoutObjectType() { AuditActivity activity = new AuditActivity(); command.assignLabel(activity, null); Assert.assertNull(activity.getObjectTypeLabel()); activity.setObjectType(""); command.assignLabel(activity, null); Assert.assertNull(activity.getObjectTypeLabel()); }
void function() { AuditActivity activity = new AuditActivity(); command.assignLabel(activity, null); Assert.assertNull(activity.getObjectTypeLabel()); activity.setObjectType(""); command.assignLabel(activity, null); Assert.assertNull(activity.getObjectTypeLabel()); }
/** * Tests the logic in {@link AuditObjectTypeCommand#assignLabel(AuditActivity, AuditContext)} when the provided * activity has no object type or it's empty. */
Tests the logic in <code>AuditObjectTypeCommand#assignLabel(AuditActivity, AuditContext)</code> when the provided activity has no object type or it's empty
testLabelAssigningWithoutObjectType
{ "repo_name": "SirmaITT/conservation-space-1.7.0", "path": "docker/sirma-platform/platform/seip-parent/platform/seip-audit/seip-audit-impl/src/test/java/com/sirma/itt/emf/audit/command/AuditObjectTypeCommandTest.java", "license": "lgpl-3.0", "size": 3073 }
[ "com.sirma.itt.emf.audit.activity.AuditActivity", "org.junit.Assert" ]
import com.sirma.itt.emf.audit.activity.AuditActivity; import org.junit.Assert;
import com.sirma.itt.emf.audit.activity.*; import org.junit.*;
[ "com.sirma.itt", "org.junit" ]
com.sirma.itt; org.junit;
2,797,972
public synchronized void waitForScan() throws Exception { // wait for 2 scans for stable files CountDownLatch latch = new CountDownLatch(2); _scanningListener.setScanningLatch(latch); _scanner.scan(); latch.await(); }
synchronized void function() throws Exception { CountDownLatch latch = new CountDownLatch(2); _scanningListener.setScanningLatch(latch); _scanner.scan(); latch.await(); }
/** * initiates a scan and blocks until it has been completed * * @throws Exception */
initiates a scan and blocks until it has been completed
waitForScan
{ "repo_name": "whiteley/jetty8", "path": "jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyMonitor.java", "license": "apache-2.0", "size": 8695 }
[ "java.util.concurrent.CountDownLatch" ]
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,774,778
public Color getColor() { Color c = Color.blue; switch (this.freqMain) { case 200: { switch (this.freqFrac) { case 24: c = Color.decode("0x33CC33"); break; case 48: c = Color.decode("0x009933"); break; case 72: c = Color.decode("0x669900"); break; default: c = Color.yellow; } break; } case 201: { switch (this.freqFrac) { case 24: c = Color.decode("0x3399FF"); break; case 48: c = Color.decode("0x0000FF"); break; case 72: c = Color.decode("0x3366CC"); break; default: c = Color.yellow; } break; } case 202: { switch (this.freqFrac) { case 24: c = Color.decode("0xFF00FF"); break; case 48: c = Color.decode("0xFF0066"); break; case 72: c = Color.decode("0x6600CC"); break; default: c = Color.yellow; } break; } case 203: { switch (this.freqFrac) { case 24: c = Color.decode("0x663300"); break; case 48: c = Color.decode("0xCC6600"); break; case 72: c = Color.decode("0xCCCC00"); break; default: c = Color.yellow; } break; } default: c = Color.orange; } return c; }
Color function() { Color c = Color.blue; switch (this.freqMain) { case 200: { switch (this.freqFrac) { case 24: c = Color.decode(STR); break; case 48: c = Color.decode(STR); break; case 72: c = Color.decode(STR); break; default: c = Color.yellow; } break; } case 201: { switch (this.freqFrac) { case 24: c = Color.decode(STR); break; case 48: c = Color.decode(STR); break; case 72: c = Color.decode(STR); break; default: c = Color.yellow; } break; } case 202: { switch (this.freqFrac) { case 24: c = Color.decode(STR); break; case 48: c = Color.decode(STR); break; case 72: c = Color.decode(STR); break; default: c = Color.yellow; } break; } case 203: { switch (this.freqFrac) { case 24: c = Color.decode(STR); break; case 48: c = Color.decode(STR); break; case 72: c = Color.decode(STR); break; default: c = Color.yellow; } break; } default: c = Color.orange; } return c; }
/** * Returns a color based on frequency * * @return */
Returns a color based on frequency
getColor
{ "repo_name": "goodsky65/ehud", "path": "ehud/src/ehud/Radio.java", "license": "gpl-3.0", "size": 6860 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
241,022
public Object getGroupById(String id) { String name = elementToName.get(id); if (name != null) { return idToGroup.get(Dom.disAssembleId(id, name)); } else { return null; } }
Object function(String id) { String name = elementToName.get(id); if (name != null) { return idToGroup.get(Dom.disAssembleId(id, name)); } else { return null; } }
/** * Return the (enclosing) group for the specified element id. * * @param id * element id * @return the group object */
Return the (enclosing) group for the specified element id
getGroupById
{ "repo_name": "geomajas/geomajas-project-client-gwt", "path": "client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java", "license": "agpl-3.0", "size": 35524 }
[ "org.geomajas.gwt.client.util.Dom" ]
import org.geomajas.gwt.client.util.Dom;
import org.geomajas.gwt.client.util.*;
[ "org.geomajas.gwt" ]
org.geomajas.gwt;
585,404
public void setPlayerWeather(WeatherType type);
void function(WeatherType type);
/** * Sets the type of weather the player will see. When used, the weather * status of the player is locked until {@link #resetPlayerWeather()} is * used. * * @param type The WeatherType enum type the player should experience */
Sets the type of weather the player will see. When used, the weather status of the player is locked until <code>#resetPlayerWeather()</code> is used
setPlayerWeather
{ "repo_name": "AlmuraDev/Almura-API", "path": "src/main/java/org/bukkit/entity/Player.java", "license": "gpl-3.0", "size": 25356 }
[ "org.bukkit.WeatherType" ]
import org.bukkit.WeatherType;
import org.bukkit.*;
[ "org.bukkit" ]
org.bukkit;
2,289,307
public DeleteEntity withProjectId(String projectId) { checkNotNull(projectId, "projectId"); return new DeleteEntity(projectId, null); }
DeleteEntity function(String projectId) { checkNotNull(projectId, STR); return new DeleteEntity(projectId, null); }
/** * Returns a new {@link DeleteEntity} that deletes entities from the Cloud Datastore for the * specified project. */
Returns a new <code>DeleteEntity</code> that deletes entities from the Cloud Datastore for the specified project
withProjectId
{ "repo_name": "jasonkuster/incubator-beam", "path": "sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/datastore/DatastoreV1.java", "license": "apache-2.0", "size": 42948 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,405,773
protected void sequence_RelationInstanceCreate(EObject context, RelationInstanceCreate semanticObject) { if(errorAcceptor != null) { if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Name()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Name())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Nameofrelation()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Nameofrelation())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Classinstancefrom()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Classinstancefrom())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Classinstanceto()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Classinstanceto())); } INodesForEObjectProvider nodes = createNodeProvider(semanticObject); SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes); feeder.accept(grammarAccess.getRelationInstanceCreateAccess().getNameValidIDParserRuleCall_1_0(), semanticObject.getName()); feeder.accept(grammarAccess.getRelationInstanceCreateAccess().getNameofrelationRelationQualifiedNameParserRuleCall_2_0_1(), semanticObject.getNameofrelation()); feeder.accept(grammarAccess.getRelationInstanceCreateAccess().getClassinstancefromClassInstanceCreateQualifiedNameParserRuleCall_4_0_1(), semanticObject.getClassinstancefrom()); feeder.accept(grammarAccess.getRelationInstanceCreateAccess().getClassinstancetoClassInstanceCreateQualifiedNameParserRuleCall_6_0_1(), semanticObject.getClassinstanceto()); feeder.finish(); }
void function(EObject context, RelationInstanceCreate semanticObject) { if(errorAcceptor != null) { if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Name()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Name())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Nameofrelation()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Nameofrelation())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Classinstancefrom()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Classinstancefrom())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Classinstanceto()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getRelationInstanceCreate_Classinstanceto())); } INodesForEObjectProvider nodes = createNodeProvider(semanticObject); SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes); feeder.accept(grammarAccess.getRelationInstanceCreateAccess().getNameValidIDParserRuleCall_1_0(), semanticObject.getName()); feeder.accept(grammarAccess.getRelationInstanceCreateAccess().getNameofrelationRelationQualifiedNameParserRuleCall_2_0_1(), semanticObject.getNameofrelation()); feeder.accept(grammarAccess.getRelationInstanceCreateAccess().getClassinstancefromClassInstanceCreateQualifiedNameParserRuleCall_4_0_1(), semanticObject.getClassinstancefrom()); feeder.accept(grammarAccess.getRelationInstanceCreateAccess().getClassinstancetoClassInstanceCreateQualifiedNameParserRuleCall_6_0_1(), semanticObject.getClassinstanceto()); feeder.finish(); }
/** * Constraint: * ( * name=ValidID * nameofrelation=[Relation|QualifiedName] * classinstancefrom=[ClassInstanceCreate|QualifiedName] * classinstanceto=[ClassInstanceCreate|QualifiedName] * ) */
Constraint: ( name=ValidID nameofrelation=[Relation|QualifiedName] classinstancefrom=[ClassInstanceCreate|QualifiedName] classinstanceto=[ClassInstanceCreate|QualifiedName] )
sequence_RelationInstanceCreate
{ "repo_name": "niksavis/mm-dsl", "path": "org.xtext.nv.dsl/src-gen/org/xtext/nv/dsl/serializer/MMDSLSemanticSequencer.java", "license": "epl-1.0", "size": 190481 }
[ "org.eclipse.emf.ecore.EObject", "org.eclipse.xtext.serializer.acceptor.SequenceFeeder", "org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider", "org.eclipse.xtext.serializer.sequencer.ITransientValueService", "org.xtext.nv.dsl.mMDSL.MMDSLPackage", "org.xtext.nv.dsl.mMDSL.RelationInstanceCreate" ]
import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.serializer.acceptor.SequenceFeeder; import org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider; import org.eclipse.xtext.serializer.sequencer.ITransientValueService; import org.xtext.nv.dsl.mMDSL.MMDSLPackage; import org.xtext.nv.dsl.mMDSL.RelationInstanceCreate;
import org.eclipse.emf.ecore.*; import org.eclipse.xtext.serializer.acceptor.*; import org.eclipse.xtext.serializer.sequencer.*; import org.xtext.nv.dsl.*;
[ "org.eclipse.emf", "org.eclipse.xtext", "org.xtext.nv" ]
org.eclipse.emf; org.eclipse.xtext; org.xtext.nv;
1,125,912
private static void processExpressionPlan(LOForEach foreach, LogicalPlan lp, LogicalExpressionPlan plan, ArrayList<Operator> inputs ) throws FrontendException { Iterator<Operator> it = plan.getOperators(); while( it.hasNext() ) { Operator sink = it.next(); //check all ProjectExpression if( sink instanceof ProjectExpression ) { ProjectExpression projExpr = (ProjectExpression)sink; String colAlias = projExpr.getColAlias(); if( projExpr.isRangeProject()){ LOInnerLoad innerLoad = new LOInnerLoad( lp, foreach, new ProjectExpression(projExpr, new LogicalExpressionPlan()) ); setupInnerLoadAndProj(innerLoad, projExpr, lp, inputs); } else if( colAlias != null ) { // the project is using a column alias Operator op = projExpr.getProjectedOperator(); if( op != null ) { // this means the project expression refers to a relation // in the nested foreach //add the relation to inputs of LOGenerate and set // projection input int index = inputs.indexOf( op ); if( index == -1 ) { index = inputs.size(); inputs.add( op ); } projExpr.setInputNum( index ); projExpr.setColNum( -1 ); } else { // this means the project expression refers to a column // in the input of foreach. Add a LOInnerLoad and use that // as input LOInnerLoad innerLoad = new LOInnerLoad( lp, foreach, colAlias ); setupInnerLoadAndProj(innerLoad, projExpr, lp, inputs); } } else { // the project expression is referring to column in ForEach input // using position (eg $1) LOInnerLoad innerLoad = new LOInnerLoad( lp, foreach, projExpr.getColNum() ); setupInnerLoadAndProj(innerLoad, projExpr, lp, inputs); } } } }
static void function(LOForEach foreach, LogicalPlan lp, LogicalExpressionPlan plan, ArrayList<Operator> inputs ) throws FrontendException { Iterator<Operator> it = plan.getOperators(); while( it.hasNext() ) { Operator sink = it.next(); if( sink instanceof ProjectExpression ) { ProjectExpression projExpr = (ProjectExpression)sink; String colAlias = projExpr.getColAlias(); if( projExpr.isRangeProject()){ LOInnerLoad innerLoad = new LOInnerLoad( lp, foreach, new ProjectExpression(projExpr, new LogicalExpressionPlan()) ); setupInnerLoadAndProj(innerLoad, projExpr, lp, inputs); } else if( colAlias != null ) { Operator op = projExpr.getProjectedOperator(); if( op != null ) { int index = inputs.indexOf( op ); if( index == -1 ) { index = inputs.size(); inputs.add( op ); } projExpr.setInputNum( index ); projExpr.setColNum( -1 ); } else { LOInnerLoad innerLoad = new LOInnerLoad( lp, foreach, colAlias ); setupInnerLoadAndProj(innerLoad, projExpr, lp, inputs); } } else { LOInnerLoad innerLoad = new LOInnerLoad( lp, foreach, projExpr.getColNum() ); setupInnerLoadAndProj(innerLoad, projExpr, lp, inputs); } } } }
/** * Process expression plans of LOGenerate and set inputs relation * for the ProjectExpression * @param foreach * @param lp Logical plan in which the LOGenerate is in * @param plan One of the output expression of the LOGenerate * @param inputs inputs of the LOGenerate * @throws FrontendException */
Process expression plans of LOGenerate and set inputs relation for the ProjectExpression
processExpressionPlan
{ "repo_name": "kexianda/pig", "path": "src/org/apache/pig/parser/LogicalPlanBuilder.java", "license": "apache-2.0", "size": 76727 }
[ "java.util.ArrayList", "java.util.Iterator", "org.apache.pig.impl.logicalLayer.FrontendException", "org.apache.pig.newplan.Operator", "org.apache.pig.newplan.logical.expression.LogicalExpressionPlan", "org.apache.pig.newplan.logical.expression.ProjectExpression", "org.apache.pig.newplan.logical.relational.LOForEach", "org.apache.pig.newplan.logical.relational.LOInnerLoad", "org.apache.pig.newplan.logical.relational.LogicalPlan" ]
import java.util.ArrayList; import java.util.Iterator; import org.apache.pig.impl.logicalLayer.FrontendException; import org.apache.pig.newplan.Operator; import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan; import org.apache.pig.newplan.logical.expression.ProjectExpression; import org.apache.pig.newplan.logical.relational.LOForEach; import org.apache.pig.newplan.logical.relational.LOInnerLoad; import org.apache.pig.newplan.logical.relational.LogicalPlan;
import java.util.*; import org.apache.pig.impl.*; import org.apache.pig.newplan.*; import org.apache.pig.newplan.logical.expression.*; import org.apache.pig.newplan.logical.relational.*;
[ "java.util", "org.apache.pig" ]
java.util; org.apache.pig;
22,620
public ScanQuery<K, V> setFilter(@Nullable IgniteBiPredicate<K, V> filter) { this.filter = filter; return this; }
ScanQuery<K, V> function(@Nullable IgniteBiPredicate<K, V> filter) { this.filter = filter; return this; }
/** * Sets filter. * * @param filter Filter. If {@code null} then all entries will be returned. * @return {@code this} for chaining. */
Sets filter
setFilter
{ "repo_name": "pperalta/ignite", "path": "modules/core/src/main/java/org/apache/ignite/cache/query/ScanQuery.java", "license": "apache-2.0", "size": 3991 }
[ "org.apache.ignite.lang.IgniteBiPredicate", "org.jetbrains.annotations.Nullable" ]
import org.apache.ignite.lang.IgniteBiPredicate; import org.jetbrains.annotations.Nullable;
import org.apache.ignite.lang.*; import org.jetbrains.annotations.*;
[ "org.apache.ignite", "org.jetbrains.annotations" ]
org.apache.ignite; org.jetbrains.annotations;
1,975,424
public static void main(String... args) throws ExecutionException, InterruptedException, FileNotFoundException { try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { File mdlRsrc = IgniteUtils.resolveIgnitePath(TEST_MODEL_RES); if (mdlRsrc == null) throw new IllegalArgumentException("File not found [resource_path=" + TEST_MODEL_RES + "]"); ModelReader reader = new FileSystemModelReader(mdlRsrc.getPath()); AsyncModelBuilder mdlBuilder = new IgniteDistributedModelBuilder(ignite, 4, 4); File testData = IgniteUtils.resolveIgnitePath(TEST_DATA_RES); if (testData == null) throw new IllegalArgumentException("File not found [resource_path=" + TEST_DATA_RES + "]"); File testExpRes = IgniteUtils.resolveIgnitePath(TEST_ER_RES); if (testExpRes == null) throw new IllegalArgumentException("File not found [resource_path=" + TEST_ER_RES + "]"); try (Model<NamedVector, Future<Double>> mdl = mdlBuilder.build(reader, parser); Scanner testDataScanner = new Scanner(testData); Scanner testExpResultsScanner = new Scanner(testExpRes)) { while (testDataScanner.hasNextLine()) { String testDataStr = testDataScanner.nextLine(); String testExpResultsStr = testExpResultsScanner.nextLine(); HashMap<String, Double> testObj = new HashMap<>(); for (String keyValueString : testDataStr.split(" ")) { String[] keyVal = keyValueString.split(":"); if (keyVal.length == 2) testObj.put("f" + keyVal[0], Double.parseDouble(keyVal[1])); } double prediction = mdl.predict(VectorUtils.of(testObj)).get(); double expPrediction = Double.parseDouble(testExpResultsStr); System.out.println("Expected: " + expPrediction + ", prediction: " + prediction); } } } finally { System.out.flush(); } }
static void function(String... args) throws ExecutionException, InterruptedException, FileNotFoundException { try (Ignite ignite = Ignition.start(STR)) { File mdlRsrc = IgniteUtils.resolveIgnitePath(TEST_MODEL_RES); if (mdlRsrc == null) throw new IllegalArgumentException(STR + TEST_MODEL_RES + "]"); ModelReader reader = new FileSystemModelReader(mdlRsrc.getPath()); AsyncModelBuilder mdlBuilder = new IgniteDistributedModelBuilder(ignite, 4, 4); File testData = IgniteUtils.resolveIgnitePath(TEST_DATA_RES); if (testData == null) throw new IllegalArgumentException(STR + TEST_DATA_RES + "]"); File testExpRes = IgniteUtils.resolveIgnitePath(TEST_ER_RES); if (testExpRes == null) throw new IllegalArgumentException(STR + TEST_ER_RES + "]"); try (Model<NamedVector, Future<Double>> mdl = mdlBuilder.build(reader, parser); Scanner testDataScanner = new Scanner(testData); Scanner testExpResultsScanner = new Scanner(testExpRes)) { while (testDataScanner.hasNextLine()) { String testDataStr = testDataScanner.nextLine(); String testExpResultsStr = testExpResultsScanner.nextLine(); HashMap<String, Double> testObj = new HashMap<>(); for (String keyValueString : testDataStr.split(" ")) { String[] keyVal = keyValueString.split(":"); if (keyVal.length == 2) testObj.put("f" + keyVal[0], Double.parseDouble(keyVal[1])); } double prediction = mdl.predict(VectorUtils.of(testObj)).get(); double expPrediction = Double.parseDouble(testExpResultsStr); System.out.println(STR + expPrediction + STR + prediction); } } } finally { System.out.flush(); } }
/** * Run example. */
Run example
main
{ "repo_name": "samaitra/ignite", "path": "examples/src/main/java/org/apache/ignite/examples/ml/inference/xgboost/XGBoostModelParserExample.java", "license": "apache-2.0", "size": 4693 }
[ "java.io.File", "java.io.FileNotFoundException", "java.util.HashMap", "java.util.Scanner", "java.util.concurrent.ExecutionException", "java.util.concurrent.Future", "org.apache.ignite.Ignite", "org.apache.ignite.Ignition", "org.apache.ignite.internal.util.IgniteUtils", "org.apache.ignite.ml.inference.Model", "org.apache.ignite.ml.inference.builder.AsyncModelBuilder", "org.apache.ignite.ml.inference.builder.IgniteDistributedModelBuilder", "org.apache.ignite.ml.inference.reader.FileSystemModelReader", "org.apache.ignite.ml.inference.reader.ModelReader", "org.apache.ignite.ml.math.primitives.vector.NamedVector", "org.apache.ignite.ml.math.primitives.vector.VectorUtils" ]
import java.io.File; import java.io.FileNotFoundException; import java.util.HashMap; import java.util.Scanner; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import org.apache.ignite.Ignite; import org.apache.ignite.Ignition; import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.ml.inference.Model; import org.apache.ignite.ml.inference.builder.AsyncModelBuilder; import org.apache.ignite.ml.inference.builder.IgniteDistributedModelBuilder; import org.apache.ignite.ml.inference.reader.FileSystemModelReader; import org.apache.ignite.ml.inference.reader.ModelReader; import org.apache.ignite.ml.math.primitives.vector.NamedVector; import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import java.io.*; import java.util.*; import java.util.concurrent.*; import org.apache.ignite.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.ml.inference.*; import org.apache.ignite.ml.inference.builder.*; import org.apache.ignite.ml.inference.reader.*; import org.apache.ignite.ml.math.primitives.vector.*;
[ "java.io", "java.util", "org.apache.ignite" ]
java.io; java.util; org.apache.ignite;
515,724
public void set(final IGetLocationWithLook from, final IGetLocationWithLook to) { setPositions(from, to); resetBase(); // TODO: this.from/this.to setExtraProperties ? }
void function(final IGetLocationWithLook from, final IGetLocationWithLook to) { setPositions(from, to); resetBase(); }
/** * Set some basic data and reset all other properties properly. Does not set * extra properties for locations. * * @param from * @param to */
Set some basic data and reset all other properties properly. Does not set extra properties for locations
set
{ "repo_name": "NoCheatPlus/NoCheatPlus", "path": "NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/model/MoveData.java", "license": "gpl-3.0", "size": 7565 }
[ "fr.neatmonster.nocheatplus.components.location.IGetLocationWithLook" ]
import fr.neatmonster.nocheatplus.components.location.IGetLocationWithLook;
import fr.neatmonster.nocheatplus.components.location.*;
[ "fr.neatmonster.nocheatplus" ]
fr.neatmonster.nocheatplus;
2,162,771
private void parsePatternParameters() throws IgniteCheckedException { assert pat != null; String regEx = "(\\{(\\*|\\d+),\\s*(\\*|\\d+)\\})?(.*)"; Matcher matcher = Pattern.compile(regEx).matcher(pat.trim()); if (matcher.matches()) { String delayStr = matcher.group(2); if (delayStr != null) if ("*".equals(delayStr)) delay = 0; else try { delay = Integer.valueOf(delayStr); } catch (NumberFormatException e) { throw new IgniteCheckedException("Invalid delay parameter in schedule pattern [delay=" + delayStr + ", pattern=" + pat + ']', e); } String numOfCallsStr = matcher.group(3); if (numOfCallsStr != null) { int maxCalls0; if ("*".equals(numOfCallsStr)) maxCalls0 = 0; else { try { maxCalls0 = Integer.valueOf(numOfCallsStr); } catch (NumberFormatException e) { throw new IgniteCheckedException("Invalid number of calls parameter in schedule pattern [numOfCalls=" + numOfCallsStr + ", pattern=" + pat + ']', e); } if (maxCalls0 <= 0) throw new IgniteCheckedException("Number of calls must be greater than 0 or must be equal to \"*\"" + " in schedule pattern [numOfCalls=" + maxCalls0 + ", pattern=" + pat + ']'); } synchronized (mux) { maxCalls = maxCalls0; } } cron = matcher.group(4); if (cron != null) cron = cron.trim(); // Cron expression should never be empty and should be of correct format. if (cron.isEmpty() || !SchedulingPattern.validate(cron)) throw new IgniteCheckedException("Invalid cron expression in schedule pattern: " + pat); } else throw new IgniteCheckedException("Invalid schedule pattern: " + pat); }
void function() throws IgniteCheckedException { assert pat != null; String regEx = STR; Matcher matcher = Pattern.compile(regEx).matcher(pat.trim()); if (matcher.matches()) { String delayStr = matcher.group(2); if (delayStr != null) if ("*".equals(delayStr)) delay = 0; else try { delay = Integer.valueOf(delayStr); } catch (NumberFormatException e) { throw new IgniteCheckedException(STR + delayStr + STR + pat + ']', e); } String numOfCallsStr = matcher.group(3); if (numOfCallsStr != null) { int maxCalls0; if ("*".equals(numOfCallsStr)) maxCalls0 = 0; else { try { maxCalls0 = Integer.valueOf(numOfCallsStr); } catch (NumberFormatException e) { throw new IgniteCheckedException(STR + numOfCallsStr + STR + pat + ']', e); } if (maxCalls0 <= 0) throw new IgniteCheckedException(STR*\STR in schedule pattern [numOfCalls=" + maxCalls0 + STR + pat + ']'); } synchronized (mux) { maxCalls = maxCalls0; } } cron = matcher.group(4); if (cron != null) cron = cron.trim(); if (cron.isEmpty() !SchedulingPattern.validate(cron)) throw new IgniteCheckedException("Invalid cron expression in schedule pattern: STRInvalid schedule pattern: " + pat); }
/** * Parse delay, number of task calls and mere cron expression from extended pattern * that looks like "{n1,n2} * * * * *". * @throws IgniteCheckedException Thrown if pattern is invalid. */
Parse delay, number of task calls and mere cron expression from extended pattern that looks like "{n1,n2} * * * * *"
parsePatternParameters
{ "repo_name": "irudyak/ignite", "path": "modules/schedule/src/main/java/org/apache/ignite/internal/processors/schedule/ScheduleFutureImpl.java", "license": "apache-2.0", "size": 26455 }
[ "it.sauronsoftware.cron4j.SchedulingPattern", "java.util.regex.Matcher", "java.util.regex.Pattern", "org.apache.ignite.IgniteCheckedException" ]
import it.sauronsoftware.cron4j.SchedulingPattern; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.ignite.IgniteCheckedException;
import it.sauronsoftware.cron4j.*; import java.util.regex.*; import org.apache.ignite.*;
[ "it.sauronsoftware.cron4j", "java.util", "org.apache.ignite" ]
it.sauronsoftware.cron4j; java.util; org.apache.ignite;
2,443,171
public ConnectionResult getSignInError() { return mSignInError ? mConnectionResult : null; }
ConnectionResult function() { return mSignInError ? mConnectionResult : null; }
/** * Returns the error that happened during the sign-in process, null if no * error occurred. */
Returns the error that happened during the sign-in process, null if no error occurred
getSignInError
{ "repo_name": "aogilvie/phonegap-plugin-googleGameServices", "path": "platforms/android/src/com/google/example/games/basegameutils/GameHelper.java", "license": "mit", "size": 28133 }
[ "com.google.android.gms.common.ConnectionResult" ]
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.*;
[ "com.google.android" ]
com.google.android;
1,411,399
public static void reverse(Version matchVersion, final char[] buffer, final int start, final int len) { if (!matchVersion.onOrAfter(Version.LUCENE_31)) { reverseUnicode3(buffer, start, len); return; } if (len < 2) return; int end = (start + len) - 1; char frontHigh = buffer[start]; char endLow = buffer[end]; boolean allowFrontSur = true, allowEndSur = true; final int mid = start + (len >> 1); for (int i = start; i < mid; ++i, --end) { final char frontLow = buffer[i + 1]; final char endHigh = buffer[end - 1]; final boolean surAtFront = allowFrontSur && Character.isSurrogatePair(frontHigh, frontLow); if (surAtFront && (len < 3)) { // nothing to do since surAtFront is allowed and 1 char left return; } final boolean surAtEnd = allowEndSur && Character.isSurrogatePair(endHigh, endLow); allowFrontSur = allowEndSur = true; if (surAtFront == surAtEnd) { if (surAtFront) { // both surrogates buffer[end] = frontLow; buffer[--end] = frontHigh; buffer[i] = endHigh; buffer[++i] = endLow; frontHigh = buffer[i + 1]; endLow = buffer[end - 1]; } else { // neither surrogates buffer[end] = frontHigh; buffer[i] = endLow; frontHigh = frontLow; endLow = endHigh; } } else { if (surAtFront) { // surrogate only at the front buffer[end] = frontLow; buffer[i] = endLow; endLow = endHigh; allowFrontSur = false; } else { // surrogate only at the end buffer[end] = frontHigh; buffer[i] = endHigh; frontHigh = frontLow; allowEndSur = false; } } } if ((len & 0x01) == 1 && !(allowFrontSur && allowEndSur)) { // only if odd length buffer[end] = allowFrontSur ? endLow : frontHigh; } }
static void function(Version matchVersion, final char[] buffer, final int start, final int len) { if (!matchVersion.onOrAfter(Version.LUCENE_31)) { reverseUnicode3(buffer, start, len); return; } if (len < 2) return; int end = (start + len) - 1; char frontHigh = buffer[start]; char endLow = buffer[end]; boolean allowFrontSur = true, allowEndSur = true; final int mid = start + (len >> 1); for (int i = start; i < mid; ++i, --end) { final char frontLow = buffer[i + 1]; final char endHigh = buffer[end - 1]; final boolean surAtFront = allowFrontSur && Character.isSurrogatePair(frontHigh, frontLow); if (surAtFront && (len < 3)) { return; } final boolean surAtEnd = allowEndSur && Character.isSurrogatePair(endHigh, endLow); allowFrontSur = allowEndSur = true; if (surAtFront == surAtEnd) { if (surAtFront) { buffer[end] = frontLow; buffer[--end] = frontHigh; buffer[i] = endHigh; buffer[++i] = endLow; frontHigh = buffer[i + 1]; endLow = buffer[end - 1]; } else { buffer[end] = frontHigh; buffer[i] = endLow; frontHigh = frontLow; endLow = endHigh; } } else { if (surAtFront) { buffer[end] = frontLow; buffer[i] = endLow; endLow = endHigh; allowFrontSur = false; } else { buffer[end] = frontHigh; buffer[i] = endHigh; frontHigh = frontLow; allowEndSur = false; } } } if ((len & 0x01) == 1 && !(allowFrontSur && allowEndSur)) { buffer[end] = allowFrontSur ? endLow : frontHigh; } }
/** * Partially reverses the given input buffer in-place from the given offset * up to the given length. * @param matchVersion See <a href="#version">above</a> * @param buffer the input char array to reverse * @param start the offset from where to reverse the buffer * @param len the length in the buffer up to where the * buffer should be reversed */
Partially reverses the given input buffer in-place from the given offset up to the given length
reverse
{ "repo_name": "terrancesnyder/solr-analytics", "path": "lucene/analysis/common/src/java/org/apache/lucene/analysis/reverse/ReverseStringFilter.java", "license": "apache-2.0", "size": 8235 }
[ "org.apache.lucene.util.Version" ]
import org.apache.lucene.util.Version;
import org.apache.lucene.util.*;
[ "org.apache.lucene" ]
org.apache.lucene;
601,852
@Test public void actionClassTest() { RangeExtension rangeExtension = new RangeExtension(); Assert.assertEquals(RangeExtension.RangeTag.class, rangeExtension.getTagActionClass()); }
void function() { RangeExtension rangeExtension = new RangeExtension(); Assert.assertEquals(RangeExtension.RangeTag.class, rangeExtension.getTagActionClass()); }
/** * RangeExtension has an inner class called RangeTag used in model parsing */
RangeExtension has an inner class called RangeTag used in model parsing
actionClassTest
{ "repo_name": "wnilkamal/DataGenerator", "path": "dg-core/src/test/java/org/finra/datagenerator/engine/scxml/tags/RangeExtensionTest.java", "license": "apache-2.0", "size": 10826 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,996,038
public void setSortHLAPI( SortHLAPI elem){ if(elem!=null) item.setSort((Sort)elem.getContainedItem()); }
void function( SortHLAPI elem){ if(elem!=null) item.setSort((Sort)elem.getContainedItem()); }
/** * set Sort */
set Sort
setSortHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/finiteIntRanges/hlapi/GreaterThanHLAPI.java", "license": "epl-1.0", "size": 108747 }
[ "fr.lip6.move.pnml.hlpn.terms.Sort", "fr.lip6.move.pnml.hlpn.terms.hlapi.SortHLAPI" ]
import fr.lip6.move.pnml.hlpn.terms.Sort; import fr.lip6.move.pnml.hlpn.terms.hlapi.SortHLAPI;
import fr.lip6.move.pnml.hlpn.terms.*; import fr.lip6.move.pnml.hlpn.terms.hlapi.*;
[ "fr.lip6.move" ]
fr.lip6.move;
1,531,759